test(remotes): unwrap the Remote envelope in the built-lib chain

Every generated method resolves to RemoteResult, so the plain-Node script
must read the business value through `.value`: the CAS ref it passed on to
goals/edit was undefined, which the client codec rejected before the request
left. The invalid-payload case keeps its try/catch — a codec-rejected
argument still throws at the Client Remote face rather than folding into the
error branch.
This commit is contained in:
imccyu
2026-08-11 23:56:39 +08:00
parent b0d3686f57
commit 7c3bd75bcc
+6 -4
View File
@@ -147,19 +147,21 @@ describe.skipIf(!requiredArtifacts)('Goal Remote built LIB chain', () => {
} catch { } catch {
invalidRejected = true invalidRejected = true
} }
// Every generated method resolves to the RemoteResult envelope; the
// business values below are what the assertions pin.
const rootResult = await client.remote.goals.create(rootAgent.id, { objective: 'root goal' }) const rootResult = await client.remote.goals.create(rootAgent.id, { objective: 'root goal' })
const rootEdit = await client.remote.goals.edit( const rootEdit = await client.remote.goals.edit(
rootAgent.id, rootAgent.id,
rootResult.ref, rootResult.value.ref,
{ objective: 'edited root goal' }, { objective: 'edited root goal' },
) )
const agentContext = client.extend({ builtAgentId: scopedAgent.id }) const agentContext = client.extend({ builtAgentId: scopedAgent.id })
const scopedResult = await agentContext.remote.goals.create({ objective: 'scoped goal', maxGoalRounds: 3 }) const scopedResult = await agentContext.remote.goals.create({ objective: 'scoped goal', maxGoalRounds: 3 })
const result = { const result = {
invalidRejected, invalidRejected,
rootResult, rootResult: rootResult.value,
rootEdit, rootEdit: rootEdit.value,
scopedResult, scopedResult: scopedResult.value,
rootGoal: host.goals.get(rootAgent)?.objective, rootGoal: host.goals.get(rootAgent)?.objective,
scopedGoal: host.goals.get(scopedAgent)?.objective, scopedGoal: host.goals.get(scopedAgent)?.objective,
rootEvents: rootAgent.session.events.length, rootEvents: rootAgent.session.events.length,