@namzu/sdk 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +241 -0
- package/dist/advisory/executor.d.ts.map +1 -1
- package/dist/advisory/executor.js +3 -2
- package/dist/advisory/executor.js.map +1 -1
- package/dist/advisory/executor.test.js +36 -14
- package/dist/advisory/executor.test.js.map +1 -1
- package/dist/agents/ReactiveAgent.d.ts.map +1 -1
- package/dist/agents/ReactiveAgent.js +1 -0
- package/dist/agents/ReactiveAgent.js.map +1 -1
- package/dist/agents/RouterAgent.d.ts.map +1 -1
- package/dist/agents/RouterAgent.js +3 -2
- package/dist/agents/RouterAgent.js.map +1 -1
- package/dist/agents/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/SupervisorAgent.js +2 -0
- package/dist/agents/SupervisorAgent.js.map +1 -1
- package/dist/bridge/a2a/mapper.d.ts.map +1 -1
- package/dist/bridge/a2a/mapper.js +23 -9
- package/dist/bridge/a2a/mapper.js.map +1 -1
- package/dist/bridge/a2a/mapper.test.js +35 -9
- package/dist/bridge/a2a/mapper.test.js.map +1 -1
- package/dist/bridge/sse/mapper.d.ts.map +1 -1
- package/dist/bridge/sse/mapper.js +60 -8
- package/dist/bridge/sse/mapper.js.map +1 -1
- package/dist/bridge/sse/mapper.test.js +123 -16
- package/dist/bridge/sse/mapper.test.js.map +1 -1
- package/dist/compaction/verifier.d.ts.map +1 -1
- package/dist/compaction/verifier.js +3 -2
- package/dist/compaction/verifier.js.map +1 -1
- package/dist/config/runtime.d.ts +14 -14
- package/dist/config/runtime.js +1 -1
- package/dist/config/runtime.js.map +1 -1
- package/dist/contracts/api.d.ts +1 -1
- package/dist/contracts/api.d.ts.map +1 -1
- package/dist/contracts/schemas.js +1 -1
- package/dist/contracts/schemas.js.map +1 -1
- package/dist/gateway/local.d.ts +1 -1
- package/dist/gateway/local.d.ts.map +1 -1
- package/dist/gateway/local.js +1 -0
- package/dist/gateway/local.js.map +1 -1
- package/dist/manager/agent/__tests__/lifecycle.test.js +2 -2
- package/dist/provider/collect.d.ts +25 -0
- package/dist/provider/collect.d.ts.map +1 -0
- package/dist/provider/collect.js +82 -0
- package/dist/provider/collect.js.map +1 -0
- package/dist/provider/collect.test.d.ts +22 -0
- package/dist/provider/collect.test.d.ts.map +1 -0
- package/dist/provider/collect.test.js +123 -0
- package/dist/provider/collect.test.js.map +1 -0
- package/dist/provider/instrumentation.d.ts.map +1 -1
- package/dist/provider/instrumentation.js +10 -43
- package/dist/provider/instrumentation.js.map +1 -1
- package/dist/provider/instrumentation.test.d.ts +15 -0
- package/dist/provider/instrumentation.test.d.ts.map +1 -1
- package/dist/provider/instrumentation.test.js +73 -87
- package/dist/provider/instrumentation.test.js.map +1 -1
- package/dist/provider/mock.d.ts +1 -2
- package/dist/provider/mock.d.ts.map +1 -1
- package/dist/provider/mock.js +2 -5
- package/dist/provider/mock.js.map +1 -1
- package/dist/public-runtime.d.ts +1 -0
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +5 -0
- package/dist/public-runtime.js.map +1 -1
- package/dist/run/LimitChecker.test.d.ts +2 -0
- package/dist/run/LimitChecker.test.d.ts.map +1 -0
- package/dist/run/LimitChecker.test.js +26 -0
- package/dist/run/LimitChecker.test.js.map +1 -0
- package/dist/run/reporter.d.ts.map +1 -1
- package/dist/run/reporter.js +10 -6
- package/dist/run/reporter.js.map +1 -1
- package/dist/runtime/query/__tests__/prompt.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/prompt.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/prompt.test.js +35 -0
- package/dist/runtime/query/__tests__/prompt.test.js.map +1 -0
- package/dist/runtime/query/context-cache.d.ts +2 -0
- package/dist/runtime/query/context-cache.d.ts.map +1 -1
- package/dist/runtime/query/context-cache.js +3 -0
- package/dist/runtime/query/context-cache.js.map +1 -1
- package/dist/runtime/query/events.d.ts +2 -0
- package/dist/runtime/query/events.d.ts.map +1 -1
- package/dist/runtime/query/events.js +48 -1
- package/dist/runtime/query/events.js.map +1 -1
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +55 -5
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/index.d.ts +2 -1
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +2 -0
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +245 -13
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +2 -0
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/runtime/query/prompt.d.ts +2 -0
- package/dist/runtime/query/prompt.d.ts.map +1 -1
- package/dist/runtime/query/prompt.js +35 -13
- package/dist/runtime/query/prompt.js.map +1 -1
- package/dist/session/__tests__/integration/e2e-spawn.test.js +2 -2
- package/dist/session/__tests__/integration/event-stream-ordering.test.d.ts +1 -1
- package/dist/session/__tests__/integration/event-stream-ordering.test.js +7 -7
- package/dist/streaming/coalesce.d.ts +28 -0
- package/dist/streaming/coalesce.d.ts.map +1 -0
- package/dist/streaming/coalesce.js +75 -0
- package/dist/streaming/coalesce.js.map +1 -0
- package/dist/streaming/coalesce.test.d.ts +19 -0
- package/dist/streaming/coalesce.test.d.ts.map +1 -0
- package/dist/streaming/coalesce.test.js +120 -0
- package/dist/streaming/coalesce.test.js.map +1 -0
- package/dist/tools/coordinator/index.d.ts +2 -0
- package/dist/tools/coordinator/index.d.ts.map +1 -1
- package/dist/tools/coordinator/index.js +1 -0
- package/dist/tools/coordinator/index.js.map +1 -1
- package/dist/types/agent/base.d.ts +7 -0
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/agent/gateway.d.ts +2 -1
- package/dist/types/agent/gateway.d.ts.map +1 -1
- package/dist/types/ids/index.d.ts +10 -0
- package/dist/types/ids/index.d.ts.map +1 -1
- package/dist/types/ids/index.js.map +1 -1
- package/dist/types/provider/interface.d.ts +26 -2
- package/dist/types/provider/interface.d.ts.map +1 -1
- package/dist/types/provider/stream.d.ts +18 -0
- package/dist/types/provider/stream.d.ts.map +1 -1
- package/dist/types/run/events.d.ts +58 -8
- package/dist/types/run/events.d.ts.map +1 -1
- package/dist/types/run/events.js +23 -1
- package/dist/types/run/events.js.map +1 -1
- package/dist/types/run/schema-version.d.ts +7 -1
- package/dist/types/run/schema-version.d.ts.map +1 -1
- package/dist/types/run/schema-version.js +7 -1
- package/dist/types/run/schema-version.js.map +1 -1
- package/dist/types/run/stop-reason.d.ts +9 -0
- package/dist/types/run/stop-reason.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/advisory/executor.test.ts +37 -15
- package/src/advisory/executor.ts +10 -7
- package/src/agents/ReactiveAgent.ts +1 -0
- package/src/agents/RouterAgent.ts +9 -6
- package/src/agents/SupervisorAgent.ts +2 -0
- package/src/bridge/a2a/mapper.test.ts +35 -9
- package/src/bridge/a2a/mapper.ts +23 -9
- package/src/bridge/sse/mapper.test.ts +152 -24
- package/src/bridge/sse/mapper.ts +66 -9
- package/src/compaction/verifier.ts +9 -6
- package/src/config/runtime.ts +1 -1
- package/src/contracts/api.ts +7 -0
- package/src/contracts/schemas.ts +1 -1
- package/src/gateway/local.ts +3 -2
- package/src/manager/agent/__tests__/lifecycle.test.ts +2 -2
- package/src/provider/collect.test.ts +142 -0
- package/src/provider/collect.ts +85 -0
- package/src/provider/instrumentation.test.ts +81 -100
- package/src/provider/instrumentation.ts +11 -53
- package/src/provider/mock.ts +2 -6
- package/src/public-runtime.ts +6 -0
- package/src/run/LimitChecker.test.ts +32 -0
- package/src/run/reporter.ts +10 -7
- package/src/runtime/query/__tests__/prompt.test.ts +38 -0
- package/src/runtime/query/context-cache.ts +5 -0
- package/src/runtime/query/events.ts +52 -1
- package/src/runtime/query/executor.ts +54 -5
- package/src/runtime/query/index.ts +5 -1
- package/src/runtime/query/iteration/index.ts +301 -26
- package/src/runtime/query/iteration/phases/compaction.ts +2 -0
- package/src/runtime/query/prompt.ts +45 -17
- package/src/session/__tests__/integration/e2e-spawn.test.ts +2 -2
- package/src/session/__tests__/integration/event-stream-ordering.test.ts +7 -7
- package/src/streaming/coalesce.test.ts +132 -0
- package/src/streaming/coalesce.ts +89 -0
- package/src/tools/coordinator/index.ts +3 -0
- package/src/types/agent/base.ts +9 -0
- package/src/types/agent/gateway.ts +3 -1
- package/src/types/ids/index.ts +10 -0
- package/src/types/provider/interface.ts +28 -3
- package/src/types/provider/stream.ts +18 -0
- package/src/types/run/events.ts +105 -9
- package/src/types/run/schema-version.ts +7 -1
- package/src/types/run/stop-reason.ts +17 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/types/run/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/types/run/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,KAAK,EACX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vB,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAuBxE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAEzD"}
|
package/dist/types/run/events.js
CHANGED
|
@@ -1,2 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Event types whose volume makes durable persistence wasteful.
|
|
3
|
+
*
|
|
4
|
+
* `text_delta` and `tool_input_delta` arrive at provider cadence (often
|
|
5
|
+
* 50–100 events per second), carry no information not derivable from the
|
|
6
|
+
* surrounding message/tool lifecycle events, and are not consulted by
|
|
7
|
+
* replay (`runtime/query/replay/prepare.ts` reads checkpoints, not the
|
|
8
|
+
* transcript). The kernel still dispatches them on the in-memory bus so
|
|
9
|
+
* SSE consumers can render live progress, but the disk store
|
|
10
|
+
* (`store/run/disk.ts:appendEvent`) skips them via this predicate.
|
|
11
|
+
*
|
|
12
|
+
* Keeping the predicate centralised — rather than threading an
|
|
13
|
+
* `ephemeral: true` field through every emit site — means new ephemeral
|
|
14
|
+
* variants are added by editing one Set and consumers don't have to
|
|
15
|
+
* inspect event shape to decide what to persist.
|
|
16
|
+
*/
|
|
17
|
+
const EPHEMERAL_EVENT_TYPES = new Set([
|
|
18
|
+
'text_delta',
|
|
19
|
+
'tool_input_delta',
|
|
20
|
+
]);
|
|
21
|
+
export function isEphemeralEvent(event) {
|
|
22
|
+
return EPHEMERAL_EVENT_TYPES.has(event.type);
|
|
23
|
+
}
|
|
2
24
|
//# sourceMappingURL=events.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/types/run/events.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/types/run/events.ts"],"names":[],"mappings":"AA4RA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,qBAAqB,GAAkC,IAAI,GAAG,CAAmB;IACtF,YAAY;IACZ,kBAAkB;CAClB,CAAC,CAAA;AAEF,MAAM,UAAU,gBAAgB,CAAC,KAAe;IAC/C,OAAO,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAC7C,CAAC"}
|
|
@@ -4,10 +4,16 @@
|
|
|
4
4
|
* - v1: pre-0.2.0 (implicit; untagged events are treated as v1 by consumers).
|
|
5
5
|
* - v2: 0.2.0+ — adds `schemaVersion`, `lineage`, and sub-session lifecycle
|
|
6
6
|
* events.
|
|
7
|
+
* - v3: 2026-05-01 — removes `llm_response`; adds message + tool-input
|
|
8
|
+
* lifecycle variants (`message_started`, `text_delta`,
|
|
9
|
+
* `message_completed`, `tool_input_started`, `tool_input_delta`,
|
|
10
|
+
* `tool_input_completed`); `tool_executing`/`tool_completed` carry
|
|
11
|
+
* required `toolUseId`; `tool_completed` carries required `isError`.
|
|
12
|
+
* See ses_001-tool-stream-events.
|
|
7
13
|
*
|
|
8
14
|
* See session-hierarchy.md §10.1 (Event-schema evolution contract) and
|
|
9
15
|
* §13.3.2 (`schemaVersion` back-compat).
|
|
10
16
|
*/
|
|
11
|
-
export declare const RUN_EVENT_SCHEMA_VERSION:
|
|
17
|
+
export declare const RUN_EVENT_SCHEMA_VERSION: 3;
|
|
12
18
|
export type RunEventSchemaVersion = typeof RUN_EVENT_SCHEMA_VERSION;
|
|
13
19
|
//# sourceMappingURL=schema-version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-version.d.ts","sourceRoot":"","sources":["../../../src/types/run/schema-version.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema-version.d.ts","sourceRoot":"","sources":["../../../src/types/run/schema-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,wBAAwB,EAAG,CAAU,CAAA;AAElD,MAAM,MAAM,qBAAqB,GAAG,OAAO,wBAAwB,CAAA"}
|
|
@@ -4,9 +4,15 @@
|
|
|
4
4
|
* - v1: pre-0.2.0 (implicit; untagged events are treated as v1 by consumers).
|
|
5
5
|
* - v2: 0.2.0+ — adds `schemaVersion`, `lineage`, and sub-session lifecycle
|
|
6
6
|
* events.
|
|
7
|
+
* - v3: 2026-05-01 — removes `llm_response`; adds message + tool-input
|
|
8
|
+
* lifecycle variants (`message_started`, `text_delta`,
|
|
9
|
+
* `message_completed`, `tool_input_started`, `tool_input_delta`,
|
|
10
|
+
* `tool_input_completed`); `tool_executing`/`tool_completed` carry
|
|
11
|
+
* required `toolUseId`; `tool_completed` carries required `isError`.
|
|
12
|
+
* See ses_001-tool-stream-events.
|
|
7
13
|
*
|
|
8
14
|
* See session-hierarchy.md §10.1 (Event-schema evolution contract) and
|
|
9
15
|
* §13.3.2 (`schemaVersion` back-compat).
|
|
10
16
|
*/
|
|
11
|
-
export const RUN_EVENT_SCHEMA_VERSION =
|
|
17
|
+
export const RUN_EVENT_SCHEMA_VERSION = 3;
|
|
12
18
|
//# sourceMappingURL=schema-version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-version.js","sourceRoot":"","sources":["../../../src/types/run/schema-version.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema-version.js","sourceRoot":"","sources":["../../../src/types/run/schema-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAU,CAAA"}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
export type StopReason = 'end_turn' | 'token_budget' | 'cost_limit' | 'timeout' | 'max_iterations' | 'cancelled' | 'plan_rejected' | 'paused' | 'error';
|
|
2
|
+
/**
|
|
3
|
+
* Per-LLM-message stop reason — distinct from the run-level {@link StopReason}.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the union of Anthropic and OpenAI finish reasons normalised into a
|
|
6
|
+
* provider-agnostic vocabulary. `forced_finalize` is a Namzu-specific value
|
|
7
|
+
* emitted by the orchestrator when iteration limits force a final response
|
|
8
|
+
* without a model-issued stop reason.
|
|
9
|
+
*/
|
|
10
|
+
export type MessageStopReason = 'end_turn' | 'tool_use' | 'max_tokens' | 'stop_sequence' | 'pause_turn' | 'refusal' | 'forced_finalize';
|
|
2
11
|
//# sourceMappingURL=stop-reason.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stop-reason.d.ts","sourceRoot":"","sources":["../../../src/types/run/stop-reason.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GACnB,UAAU,GACV,cAAc,GACd,YAAY,GACZ,SAAS,GACT,gBAAgB,GAChB,WAAW,GACX,eAAe,GACf,QAAQ,GACR,OAAO,CAAA"}
|
|
1
|
+
{"version":3,"file":"stop-reason.d.ts","sourceRoot":"","sources":["../../../src/types/run/stop-reason.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GACnB,UAAU,GACV,cAAc,GACd,YAAY,GACZ,SAAS,GACT,gBAAgB,GAChB,WAAW,GACX,eAAe,GACf,QAAQ,GACR,OAAO,CAAA;AAEV;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAC1B,UAAU,GACV,UAAU,GACV,YAAY,GACZ,eAAe,GACf,YAAY,GACZ,SAAS,GACT,iBAAiB,CAAA"}
|
package/package.json
CHANGED
|
@@ -41,12 +41,21 @@ import type {
|
|
|
41
41
|
ChatCompletionParams,
|
|
42
42
|
ChatCompletionResponse,
|
|
43
43
|
LLMProvider,
|
|
44
|
+
StreamChunk,
|
|
44
45
|
} from '../types/provider/index.js'
|
|
45
46
|
|
|
46
47
|
import { type AdvisoryCallContext, AdvisoryExecutor } from './executor.js'
|
|
47
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Builds a minimal mock provider for advisory tests. Phase 2 of
|
|
51
|
+
* ses_001-tool-stream-events removed `chat()` from `LLMProvider`, so
|
|
52
|
+
* the test stubs `chatStream` and `AdvisoryExecutor` consumes via
|
|
53
|
+
* `collect()`. The mock returns a single chunk with the legacy text +
|
|
54
|
+
* usage so the aggregated response shape matches what `chat()` would
|
|
55
|
+
* have returned.
|
|
56
|
+
*/
|
|
48
57
|
function mockProvider(response: Partial<ChatCompletionResponse> = {}): LLMProvider {
|
|
49
|
-
const
|
|
58
|
+
const merged: ChatCompletionResponse = {
|
|
50
59
|
id: 'resp_1',
|
|
51
60
|
model: 'm',
|
|
52
61
|
message: { role: 'assistant', content: 'advice text' },
|
|
@@ -59,13 +68,26 @@ function mockProvider(response: Partial<ChatCompletionResponse> = {}): LLMProvid
|
|
|
59
68
|
},
|
|
60
69
|
finishReason: 'stop',
|
|
61
70
|
...response,
|
|
62
|
-
}
|
|
71
|
+
}
|
|
72
|
+
const chatStream = vi.fn<(p: ChatCompletionParams) => AsyncIterable<StreamChunk>>(() => {
|
|
73
|
+
const chunks: StreamChunk[] = [
|
|
74
|
+
{ id: merged.id, delta: { content: merged.message.content ?? '' } },
|
|
75
|
+
{
|
|
76
|
+
id: merged.id,
|
|
77
|
+
delta: {},
|
|
78
|
+
finishReason: merged.finishReason,
|
|
79
|
+
usage: merged.usage,
|
|
80
|
+
},
|
|
81
|
+
]
|
|
82
|
+
return (async function* () {
|
|
83
|
+
for (const c of chunks) yield c
|
|
84
|
+
})()
|
|
85
|
+
})
|
|
63
86
|
return {
|
|
64
87
|
id: 'mock',
|
|
65
88
|
name: 'Mock',
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
} as unknown as LLMProvider
|
|
89
|
+
chatStream,
|
|
90
|
+
}
|
|
69
91
|
}
|
|
70
92
|
|
|
71
93
|
function advisor(overrides: Partial<AdvisorDefinition> = {}): AdvisorDefinition {
|
|
@@ -94,7 +116,7 @@ describe('AdvisoryExecutor — consult happy path', () => {
|
|
|
94
116
|
const e = new AdvisoryExecutor()
|
|
95
117
|
const a = advisor({ provider, systemPrompt: 'You are Adv.' })
|
|
96
118
|
await e.consult(a, req, ctx())
|
|
97
|
-
const call = vi.mocked(provider.
|
|
119
|
+
const call = vi.mocked(provider.chatStream).mock.calls[0]?.[0] as ChatCompletionParams
|
|
98
120
|
expect(call.model).toBe('m')
|
|
99
121
|
expect(call.toolChoice).toBe('none')
|
|
100
122
|
const roles = call.messages.map((m) => m.role)
|
|
@@ -140,7 +162,7 @@ describe('AdvisoryExecutor — buildSystemPrompt', () => {
|
|
|
140
162
|
const provider = mockProvider()
|
|
141
163
|
const e = new AdvisoryExecutor()
|
|
142
164
|
await e.consult(advisor({ provider, systemPrompt: 'FIXED PROMPT' }), req, ctx())
|
|
143
|
-
const call = vi.mocked(provider.
|
|
165
|
+
const call = vi.mocked(provider.chatStream).mock.calls[0]?.[0] as ChatCompletionParams
|
|
144
166
|
expect(call.messages[0]?.content).toBe('FIXED PROMPT')
|
|
145
167
|
})
|
|
146
168
|
|
|
@@ -152,7 +174,7 @@ describe('AdvisoryExecutor — buildSystemPrompt', () => {
|
|
|
152
174
|
req,
|
|
153
175
|
ctx(),
|
|
154
176
|
)
|
|
155
|
-
const call = vi.mocked(provider.
|
|
177
|
+
const call = vi.mocked(provider.chatStream).mock.calls[0]?.[0] as ChatCompletionParams
|
|
156
178
|
const systemContent = call.messages[0]?.content ?? ''
|
|
157
179
|
expect(systemContent).toContain('Architect')
|
|
158
180
|
expect(systemContent).toContain('security, performance')
|
|
@@ -163,7 +185,7 @@ describe('AdvisoryExecutor — buildSystemPrompt', () => {
|
|
|
163
185
|
const provider = mockProvider()
|
|
164
186
|
const e = new AdvisoryExecutor()
|
|
165
187
|
await e.consult(advisor({ provider, name: 'Adv' }), req, ctx())
|
|
166
|
-
const call = vi.mocked(provider.
|
|
188
|
+
const call = vi.mocked(provider.chatStream).mock.calls[0]?.[0] as ChatCompletionParams
|
|
167
189
|
const systemContent = call.messages[0]?.content ?? ''
|
|
168
190
|
expect(systemContent).not.toContain('domains of expertise')
|
|
169
191
|
})
|
|
@@ -178,7 +200,7 @@ describe('AdvisoryExecutor — buildContext', () => {
|
|
|
178
200
|
{ question: 'q', includeContext: false },
|
|
179
201
|
ctx({ workingStateSummary: 'should be ignored' }),
|
|
180
202
|
)
|
|
181
|
-
const call = vi.mocked(provider.
|
|
203
|
+
const call = vi.mocked(provider.chatStream).mock.calls[0]?.[0] as ChatCompletionParams
|
|
182
204
|
// Only system + user(question)
|
|
183
205
|
expect(call.messages).toHaveLength(2)
|
|
184
206
|
})
|
|
@@ -201,7 +223,7 @@ describe('AdvisoryExecutor — buildContext', () => {
|
|
|
201
223
|
},
|
|
202
224
|
],
|
|
203
225
|
})
|
|
204
|
-
const call = vi.mocked(provider.
|
|
226
|
+
const call = vi.mocked(provider.chatStream).mock.calls[0]?.[0] as ChatCompletionParams
|
|
205
227
|
const contextMsg = call.messages[1]?.content ?? ''
|
|
206
228
|
expect(contextMsg).toContain('Working State')
|
|
207
229
|
expect(contextMsg).toContain('state summary here')
|
|
@@ -217,7 +239,7 @@ describe('AdvisoryExecutor — buildContext', () => {
|
|
|
217
239
|
]
|
|
218
240
|
const e = new AdvisoryExecutor()
|
|
219
241
|
await e.consult(advisor({ provider }), req, ctx({ messages }))
|
|
220
|
-
const call = vi.mocked(provider.
|
|
242
|
+
const call = vi.mocked(provider.chatStream).mock.calls[0]?.[0] as ChatCompletionParams
|
|
221
243
|
const contextMsg = call.messages[1]?.content ?? ''
|
|
222
244
|
expect(contextMsg).toContain('Conversation Context')
|
|
223
245
|
expect(contextMsg).toContain('[user]: hi')
|
|
@@ -233,7 +255,7 @@ describe('AdvisoryExecutor — buildContext', () => {
|
|
|
233
255
|
const e = new AdvisoryExecutor()
|
|
234
256
|
// maxContextTokens=5 → 5*4=20 char budget; only 'recent' (6 chars) fits.
|
|
235
257
|
await e.consult(advisor({ provider, maxContextTokens: 5 }), req, ctx({ messages }))
|
|
236
|
-
const call = vi.mocked(provider.
|
|
258
|
+
const call = vi.mocked(provider.chatStream).mock.calls[0]?.[0] as ChatCompletionParams
|
|
237
259
|
const contextMsg = call.messages[1]?.content ?? ''
|
|
238
260
|
expect(contextMsg).toContain('recent')
|
|
239
261
|
expect(contextMsg).not.toContain('a'.repeat(100))
|
|
@@ -243,7 +265,7 @@ describe('AdvisoryExecutor — buildContext', () => {
|
|
|
243
265
|
const provider = mockProvider()
|
|
244
266
|
const e = new AdvisoryExecutor()
|
|
245
267
|
await e.consult(advisor({ provider }), req, ctx())
|
|
246
|
-
const call = vi.mocked(provider.
|
|
268
|
+
const call = vi.mocked(provider.chatStream).mock.calls[0]?.[0] as ChatCompletionParams
|
|
247
269
|
expect(call.messages).toHaveLength(2)
|
|
248
270
|
})
|
|
249
271
|
})
|
|
@@ -265,7 +287,7 @@ describe('AdvisoryExecutor — tool calls in context', () => {
|
|
|
265
287
|
],
|
|
266
288
|
}),
|
|
267
289
|
)
|
|
268
|
-
const call = vi.mocked(provider.
|
|
290
|
+
const call = vi.mocked(provider.chatStream).mock.calls[0]?.[0] as ChatCompletionParams
|
|
269
291
|
const contextMsg = call.messages[1]?.content ?? ''
|
|
270
292
|
expect(contextMsg).toContain('[assistant]: (tool calls)')
|
|
271
293
|
})
|
package/src/advisory/executor.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CHARS_PER_TOKEN } from '../constants/limits.js'
|
|
2
2
|
import { assembleSystemPrompt } from '../persona/assembler.js'
|
|
3
|
+
import { collect } from '../provider/collect.js'
|
|
3
4
|
import type { AdvisorDefinition } from '../types/advisory/config.js'
|
|
4
5
|
import type { AdvisoryRequest, AdvisoryResult } from '../types/advisory/result.js'
|
|
5
6
|
import type { CostInfo, TokenUsage } from '../types/common/index.js'
|
|
@@ -51,13 +52,15 @@ export class AdvisoryExecutor {
|
|
|
51
52
|
urgency: request.urgency,
|
|
52
53
|
})
|
|
53
54
|
|
|
54
|
-
const response = await
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
const response = await collect(
|
|
56
|
+
advisor.provider.chatStream({
|
|
57
|
+
model: advisor.model,
|
|
58
|
+
messages,
|
|
59
|
+
temperature: advisor.temperature,
|
|
60
|
+
maxTokens: advisor.maxResponseTokens,
|
|
61
|
+
toolChoice: 'none',
|
|
62
|
+
}),
|
|
63
|
+
)
|
|
61
64
|
|
|
62
65
|
const durationMs = Date.now() - startMs
|
|
63
66
|
|
|
@@ -71,6 +71,7 @@ export class ReactiveAgent extends AbstractAgent<ReactiveAgentConfig, ReactiveAg
|
|
|
71
71
|
signal: input.signal,
|
|
72
72
|
taskStore: input.taskStore,
|
|
73
73
|
runtimeToolOverrides: input.runtimeToolOverrides,
|
|
74
|
+
runtimeContext: input.runtimeContext,
|
|
74
75
|
advisory: config.advisory,
|
|
75
76
|
invocationState: config.invocationState,
|
|
76
77
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EMPTY_TOKEN_USAGE } from '../constants/limits.js'
|
|
2
|
+
import { collect } from '../provider/collect.js'
|
|
2
3
|
import { FallbackResolver } from '../runtime/decision/fallback.js'
|
|
3
4
|
import { DecisionParser } from '../runtime/decision/parser.js'
|
|
4
5
|
import type {
|
|
@@ -176,12 +177,14 @@ export class RouterAgent extends AbstractAgent<RouterAgentConfig, RouterAgentRes
|
|
|
176
177
|
|
|
177
178
|
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
178
179
|
try {
|
|
179
|
-
const response = await
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
180
|
+
const response = await collect(
|
|
181
|
+
config.provider.chatStream({
|
|
182
|
+
model: config.model,
|
|
183
|
+
messages: [createSystemMessage(prompt), createUserMessage(userContent)],
|
|
184
|
+
temperature: 0,
|
|
185
|
+
maxTokens: 200,
|
|
186
|
+
}),
|
|
187
|
+
)
|
|
185
188
|
|
|
186
189
|
const parseResult = parser.parse(response.message.content)
|
|
187
190
|
|
|
@@ -102,6 +102,7 @@ export class SupervisorAgent extends AbstractAgent<SupervisorAgentConfig, Superv
|
|
|
102
102
|
const coordinatorToolDefs = buildCoordinatorTools({
|
|
103
103
|
gateway,
|
|
104
104
|
workingDirectory: input.workingDirectory,
|
|
105
|
+
runtimeContext: input.runtimeContext,
|
|
105
106
|
allowedAgentIds: config.agentIds,
|
|
106
107
|
taskStore: input.taskStore,
|
|
107
108
|
runId,
|
|
@@ -152,6 +153,7 @@ export class SupervisorAgent extends AbstractAgent<SupervisorAgentConfig, Superv
|
|
|
152
153
|
},
|
|
153
154
|
taskStore: input.taskStore,
|
|
154
155
|
runtimeToolOverrides: input.runtimeToolOverrides,
|
|
156
|
+
runtimeContext: input.runtimeContext,
|
|
155
157
|
taskGateway: gateway,
|
|
156
158
|
launchedTasks,
|
|
157
159
|
advisory: config.advisory,
|
|
@@ -96,8 +96,15 @@ describe('mapRunToA2AEvent — mapped variants', () => {
|
|
|
96
96
|
}
|
|
97
97
|
})
|
|
98
98
|
|
|
99
|
-
it('
|
|
100
|
-
const event: RunEvent = {
|
|
99
|
+
it('message_completed with content → running status + text part (codex M5)', () => {
|
|
100
|
+
const event: RunEvent = {
|
|
101
|
+
type: 'message_completed',
|
|
102
|
+
runId: RID,
|
|
103
|
+
iteration: 0,
|
|
104
|
+
messageId: 'msg_a' as `msg_${string}`,
|
|
105
|
+
stopReason: 'end_turn',
|
|
106
|
+
content: 'hi',
|
|
107
|
+
}
|
|
101
108
|
const a2a = mapRunToA2AEvent(event)
|
|
102
109
|
expect(isStatusEvent(a2a)).toBe(true)
|
|
103
110
|
if (isStatusEvent(a2a)) {
|
|
@@ -106,22 +113,37 @@ describe('mapRunToA2AEvent — mapped variants', () => {
|
|
|
106
113
|
}
|
|
107
114
|
})
|
|
108
115
|
|
|
109
|
-
it('
|
|
110
|
-
const event: RunEvent = {
|
|
116
|
+
it('message_completed without content → null (no aggregated text to surface)', () => {
|
|
117
|
+
const event: RunEvent = {
|
|
118
|
+
type: 'message_completed',
|
|
119
|
+
runId: RID,
|
|
120
|
+
iteration: 0,
|
|
121
|
+
messageId: 'msg_b' as `msg_${string}`,
|
|
122
|
+
stopReason: 'tool_use',
|
|
123
|
+
}
|
|
111
124
|
expect(mapRunToA2AEvent(event)).toBeNull()
|
|
112
125
|
})
|
|
113
126
|
|
|
114
|
-
it('
|
|
115
|
-
const event: RunEvent = {
|
|
127
|
+
it('message_completed with empty-string content → null (falsy)', () => {
|
|
128
|
+
const event: RunEvent = {
|
|
129
|
+
type: 'message_completed',
|
|
130
|
+
runId: RID,
|
|
131
|
+
iteration: 0,
|
|
132
|
+
messageId: 'msg_c' as `msg_${string}`,
|
|
133
|
+
stopReason: 'end_turn',
|
|
134
|
+
content: '',
|
|
135
|
+
}
|
|
116
136
|
expect(mapRunToA2AEvent(event)).toBeNull()
|
|
117
137
|
})
|
|
118
138
|
|
|
119
|
-
it('tool_completed → artifact with toolName
|
|
139
|
+
it('tool_completed → artifact with toolName + toolUseId + isError metadata', () => {
|
|
120
140
|
const event: RunEvent = {
|
|
121
141
|
type: 'tool_completed',
|
|
122
142
|
runId: RID,
|
|
143
|
+
toolUseId: 'toolu_a',
|
|
123
144
|
toolName: 'read_file',
|
|
124
145
|
result: 'ok',
|
|
146
|
+
isError: false,
|
|
125
147
|
}
|
|
126
148
|
const a2a = mapRunToA2AEvent(event)
|
|
127
149
|
expect(isArtifactEvent(a2a)).toBe(true)
|
|
@@ -129,7 +151,11 @@ describe('mapRunToA2AEvent — mapped variants', () => {
|
|
|
129
151
|
expect(a2a.artifact.artifactId).toMatch(/^tool-read_file-\d+$/)
|
|
130
152
|
expect(a2a.artifact.name).toBe('read_file result')
|
|
131
153
|
expect(a2a.artifact.parts).toEqual([{ kind: 'text', text: 'ok' }])
|
|
132
|
-
expect(a2a.artifact.metadata).toEqual({
|
|
154
|
+
expect(a2a.artifact.metadata).toEqual({
|
|
155
|
+
toolName: 'read_file',
|
|
156
|
+
toolUseId: 'toolu_a',
|
|
157
|
+
isError: false,
|
|
158
|
+
})
|
|
133
159
|
}
|
|
134
160
|
})
|
|
135
161
|
|
|
@@ -212,7 +238,7 @@ describe('mapRunToA2AEvent — mapped variants', () => {
|
|
|
212
238
|
describe('mapRunToA2AEvent — explicit null set', () => {
|
|
213
239
|
const nullEvents: RunEvent[] = [
|
|
214
240
|
{ type: 'iteration_completed', runId: RID, iteration: 1, hasToolCalls: false },
|
|
215
|
-
{ type: 'tool_executing', runId: RID, toolName: 'x', input: {} },
|
|
241
|
+
{ type: 'tool_executing', runId: RID, toolUseId: 'toolu_x', toolName: 'x', input: {} },
|
|
216
242
|
{ type: 'tool_review_completed', runId: RID, decision: 'approved' },
|
|
217
243
|
{
|
|
218
244
|
type: 'checkpoint_created',
|
package/src/bridge/a2a/mapper.ts
CHANGED
|
@@ -66,20 +66,16 @@ const MAPPING: {
|
|
|
66
66
|
parts: [{ kind: 'text', text: `Iteration ${e.iteration} started` }],
|
|
67
67
|
}),
|
|
68
68
|
|
|
69
|
-
llm_response: (e, ctx) => {
|
|
70
|
-
if (!e.content) return null
|
|
71
|
-
return statusEvent(e.runId, 'running', false, ctx, {
|
|
72
|
-
role: 'agent',
|
|
73
|
-
parts: [{ kind: 'text', text: e.content }],
|
|
74
|
-
})
|
|
75
|
-
},
|
|
76
|
-
|
|
77
69
|
tool_completed: (e, ctx) =>
|
|
78
70
|
artifactEvent(e.runId, ctx, {
|
|
79
71
|
artifactId: `tool-${e.toolName}-${Date.now()}`,
|
|
80
72
|
name: `${e.toolName} result`,
|
|
81
73
|
parts: [{ kind: 'text', text: e.result }],
|
|
82
|
-
metadata: {
|
|
74
|
+
metadata: {
|
|
75
|
+
toolName: e.toolName,
|
|
76
|
+
toolUseId: e.toolUseId,
|
|
77
|
+
isError: e.isError,
|
|
78
|
+
},
|
|
83
79
|
}),
|
|
84
80
|
|
|
85
81
|
tool_review_requested: (e, ctx) => {
|
|
@@ -164,6 +160,24 @@ const MAPPING: {
|
|
|
164
160
|
subsession_spawned: null,
|
|
165
161
|
subsession_messaged: null,
|
|
166
162
|
subsession_idled: null,
|
|
163
|
+
|
|
164
|
+
// v3 message + tool-input lifecycle (ses_001-tool-stream-events). A2A's
|
|
165
|
+
// status-update model is coarse-grained, so per-delta events are dropped
|
|
166
|
+
// at this layer. `message_completed` carries the aggregated assistant
|
|
167
|
+
// content (codex A1) — A2A surfaces a single status event with the
|
|
168
|
+
// full text, replacing the per-iteration `llm_response` mapping.
|
|
169
|
+
message_started: null,
|
|
170
|
+
text_delta: null,
|
|
171
|
+
message_completed: (e, ctx) => {
|
|
172
|
+
if (!e.content) return null
|
|
173
|
+
return statusEvent(e.runId, 'running', false, ctx, {
|
|
174
|
+
role: 'agent',
|
|
175
|
+
parts: [{ kind: 'text', text: e.content }],
|
|
176
|
+
})
|
|
177
|
+
},
|
|
178
|
+
tool_input_started: null,
|
|
179
|
+
tool_input_delta: null,
|
|
180
|
+
tool_input_completed: null,
|
|
167
181
|
}
|
|
168
182
|
|
|
169
183
|
export function mapRunToA2AEvent(event: RunEvent, contextId?: string): A2AStreamEvent | null {
|