kiokuko-dsh 0.2.4 → 0.2.5
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/dist/dsh/agenticreplay-event-mapper.d.ts +7 -0
- package/dist/dsh/agenticreplay-event-mapper.d.ts.map +1 -1
- package/dist/dsh/agenticreplay-event-mapper.js +52 -13
- package/dist/dsh/agenticreplay-event-mapper.js.map +1 -1
- package/dist/dsh/agenticreplay-hooks.d.ts.map +1 -1
- package/dist/dsh/agenticreplay-hooks.js +10 -1
- package/dist/dsh/agenticreplay-hooks.js.map +1 -1
- package/dist/dsh/agenticreplay-recorder.d.ts +5 -0
- package/dist/dsh/agenticreplay-recorder.d.ts.map +1 -1
- package/dist/dsh/agenticreplay-recorder.js +193 -20
- package/dist/dsh/agenticreplay-recorder.js.map +1 -1
- package/dist/dsh/answer-context.d.ts +8 -6
- package/dist/dsh/answer-context.d.ts.map +1 -1
- package/dist/dsh/answer-context.js +85 -21
- package/dist/dsh/answer-context.js.map +1 -1
- package/dist/dsh/coding-workflow/contracts.d.ts +5 -0
- package/dist/dsh/coding-workflow/contracts.d.ts.map +1 -1
- package/dist/dsh/coding-workflow/contracts.js +20 -3
- package/dist/dsh/coding-workflow/contracts.js.map +1 -1
- package/dist/dsh/coding-workflow/host.d.ts +4 -1
- package/dist/dsh/coding-workflow/host.d.ts.map +1 -1
- package/dist/dsh/coding-workflow/host.js +72 -44
- package/dist/dsh/coding-workflow/host.js.map +1 -1
- package/dist/dsh/coding-workflow/intent.d.ts +8 -0
- package/dist/dsh/coding-workflow/intent.d.ts.map +1 -1
- package/dist/dsh/coding-workflow/intent.js +33 -2
- package/dist/dsh/coding-workflow/intent.js.map +1 -1
- package/dist/dsh/coding-workflow/service.d.ts +214 -0
- package/dist/dsh/coding-workflow/service.d.ts.map +1 -1
- package/dist/dsh/coding-workflow/service.js +86 -6
- package/dist/dsh/coding-workflow/service.js.map +1 -1
- package/dist/dsh/coding-workflow/store.d.ts.map +1 -1
- package/dist/dsh/coding-workflow/store.js +10 -1
- package/dist/dsh/coding-workflow/store.js.map +1 -1
- package/dist/dsh/core/host.d.ts.map +1 -1
- package/dist/dsh/core/host.js +288 -48
- package/dist/dsh/core/host.js.map +1 -1
- package/dist/dsh/core/tasks.d.ts +7 -0
- package/dist/dsh/core/tasks.d.ts.map +1 -1
- package/dist/dsh/core/tasks.js +59 -8
- package/dist/dsh/core/tasks.js.map +1 -1
- package/dist/dsh/decisions/contracts.d.ts +3 -2
- package/dist/dsh/decisions/contracts.d.ts.map +1 -1
- package/dist/dsh/decisions/contracts.js +1 -1
- package/dist/dsh/decisions/contracts.js.map +1 -1
- package/dist/dsh/decisions/request-intent.d.ts +121 -0
- package/dist/dsh/decisions/request-intent.d.ts.map +1 -0
- package/dist/dsh/decisions/request-intent.js +260 -0
- package/dist/dsh/decisions/request-intent.js.map +1 -0
- package/dist/dsh/decisions/service.d.ts +5 -1
- package/dist/dsh/decisions/service.d.ts.map +1 -1
- package/dist/dsh/decisions/service.js +2 -1
- package/dist/dsh/decisions/service.js.map +1 -1
- package/dist/dsh/execution-support.d.ts +2 -0
- package/dist/dsh/execution-support.d.ts.map +1 -1
- package/dist/dsh/execution-support.js +36 -8
- package/dist/dsh/execution-support.js.map +1 -1
- package/dist/dsh/host-adapter/admission.d.ts +4 -1
- package/dist/dsh/host-adapter/admission.d.ts.map +1 -1
- package/dist/dsh/host-adapter/admission.js +294 -12
- package/dist/dsh/host-adapter/admission.js.map +1 -1
- package/dist/dsh/host-adapter/routing.d.ts +2 -1
- package/dist/dsh/host-adapter/routing.d.ts.map +1 -1
- package/dist/dsh/host-adapter/routing.js +32 -18
- package/dist/dsh/host-adapter/routing.js.map +1 -1
- package/dist/dsh/host-adapter/turn-state.d.ts +6 -0
- package/dist/dsh/host-adapter/turn-state.d.ts.map +1 -1
- package/dist/dsh/host-adapter/turn-state.js +19 -1
- package/dist/dsh/host-adapter/turn-state.js.map +1 -1
- package/dist/dsh/host-adapter.d.ts.map +1 -1
- package/dist/dsh/host-adapter.js +71 -8
- package/dist/dsh/host-adapter.js.map +1 -1
- package/dist/dsh/intake-clarification.d.ts +2 -2
- package/dist/dsh/intake-clarification.d.ts.map +1 -1
- package/dist/dsh/intake-clarification.js +13 -4
- package/dist/dsh/intake-clarification.js.map +1 -1
- package/dist/dsh/intake-gate.d.ts +5 -0
- package/dist/dsh/intake-gate.d.ts.map +1 -1
- package/dist/dsh/intake-gate.js +19 -5
- package/dist/dsh/intake-gate.js.map +1 -1
- package/dist/dsh/lisp/candidate.d.ts +1 -1
- package/dist/dsh/lisp/surface.d.ts +1 -1
- package/dist/dsh/memory-owner.d.ts +24 -0
- package/dist/dsh/memory-owner.d.ts.map +1 -0
- package/dist/dsh/memory-owner.js +35 -0
- package/dist/dsh/memory-owner.js.map +1 -0
- package/dist/dsh/memory-request-fence.d.ts +37 -0
- package/dist/dsh/memory-request-fence.d.ts.map +1 -0
- package/dist/dsh/memory-request-fence.js +48 -0
- package/dist/dsh/memory-request-fence.js.map +1 -0
- package/dist/dsh/message-sources.d.ts.map +1 -1
- package/dist/dsh/message-sources.js +2 -1
- package/dist/dsh/message-sources.js.map +1 -1
- package/dist/dsh/models/profiles.d.ts +23 -0
- package/dist/dsh/models/profiles.d.ts.map +1 -1
- package/dist/dsh/models/profiles.js +30 -1
- package/dist/dsh/models/profiles.js.map +1 -1
- package/dist/dsh/models/service.d.ts +9 -0
- package/dist/dsh/models/service.d.ts.map +1 -1
- package/dist/dsh/models/service.js +52 -13
- package/dist/dsh/models/service.js.map +1 -1
- package/dist/dsh/on-demand-intake.d.ts +71 -5
- package/dist/dsh/on-demand-intake.d.ts.map +1 -1
- package/dist/dsh/on-demand-intake.js +299 -70
- package/dist/dsh/on-demand-intake.js.map +1 -1
- package/dist/dsh/owned-execution.d.ts +3 -0
- package/dist/dsh/owned-execution.d.ts.map +1 -1
- package/dist/dsh/owned-execution.js +7 -0
- package/dist/dsh/owned-execution.js.map +1 -1
- package/dist/dsh/request-memory.d.ts +2 -0
- package/dist/dsh/request-memory.d.ts.map +1 -1
- package/dist/dsh/request-memory.js +33 -2
- package/dist/dsh/request-memory.js.map +1 -1
- package/dist/dsh/setup.d.ts +2 -2
- package/dist/dsh/setup.d.ts.map +1 -1
- package/dist/dsh/setup.js +37 -14
- package/dist/dsh/setup.js.map +1 -1
- package/dist/dsh/skill-prompts.json +1 -1
- package/dist/dsh/standard-skills.d.ts +2 -1
- package/dist/dsh/standard-skills.d.ts.map +1 -1
- package/dist/dsh/standard-skills.js +2 -1
- package/dist/dsh/standard-skills.js.map +1 -1
- package/dist/dsh/task-intake.d.ts +6 -0
- package/dist/dsh/task-intake.d.ts.map +1 -1
- package/dist/dsh/task-intake.js +7 -2
- package/dist/dsh/task-intake.js.map +1 -1
- package/dist/locale/en.json +1 -1
- package/dist/locale/ja.json +1 -1
- package/dist/locale/ko.json +1 -1
- package/dist/locale/zh-CN.json +1 -1
- package/docs/coding-workflow.md +3 -1
- package/docs/dsh-plugin.md +28 -5
- package/docs/on-demand-intake.md +13 -7
- package/package.json +3 -2
- package/skills/japanese-translation-for-oss-models/SKILL.md +5 -3
|
@@ -14,6 +14,11 @@ export declare const AGENTICREPLAY_CAPTURE: Readonly<{
|
|
|
14
14
|
export declare const record: (value: unknown) => Record<string, any>;
|
|
15
15
|
export declare function label(value: unknown): string;
|
|
16
16
|
export declare function projectBlocks(value: unknown, config: AgenticReplayConfig): unknown[];
|
|
17
|
+
export declare function boundedAgenticReplayPayload(value: unknown, maxBytes: number, format: string): {
|
|
18
|
+
payload: Record<string, unknown>;
|
|
19
|
+
omitted: boolean;
|
|
20
|
+
omissionReason?: string;
|
|
21
|
+
};
|
|
17
22
|
/** Hash only host-attributed sections still present at the final request seam. */
|
|
18
23
|
export declare function requestSourceManifest(messages: unknown, config: AgenticReplayConfig): {
|
|
19
24
|
coverage: 'observed' | 'partial' | 'unknown';
|
|
@@ -28,4 +33,6 @@ export declare function requestSourceManifest(messages: unknown, config: Agentic
|
|
|
28
33
|
export declare function modelRequest(options: Record<string, any>, id: string, config: AgenticReplayConfig): EventInit;
|
|
29
34
|
/** DSH uses a replacement usage snapshot, with disjoint cache counters. */
|
|
30
35
|
export declare function usageAttrs(value: unknown): Record<string, unknown>;
|
|
36
|
+
/** Classify only the native result envelope; JSON/text returned as domain data is not an error signal. */
|
|
37
|
+
export declare function toolResultOutcome(value: Record<string, any>): Record<string, unknown>;
|
|
31
38
|
//# sourceMappingURL=agenticreplay-event-mapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agenticreplay-event-mapper.d.ts","sourceRoot":"","sources":["../../src/dsh/agenticreplay-event-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAMtD,eAAO,MAAM,qBAAqB;;;;;;;;;;EACsE,CAAA;AACxG,eAAO,MAAM,MAAM,GAAI,OAAO,OAAO,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAoF,CAAA;AAC9I,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAI5C;AACD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,EAAE,CAcpF;AAED,kFAAkF;AAClF,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,mBAAmB,GAAG;IACrF,QAAQ,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IACnE,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CACrE,
|
|
1
|
+
{"version":3,"file":"agenticreplay-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2E;AAC3E,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQlE;AAGD,0GAA0G;AAC1G,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWrF"}
|
|
@@ -33,6 +33,19 @@ export function projectBlocks(value, config) {
|
|
|
33
33
|
return { type: label(block.type), omitted: true };
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
+
export function boundedAgenticReplayPayload(value, maxBytes, format) {
|
|
37
|
+
try {
|
|
38
|
+
const projected = projectAgenticReplayJson(value, maxBytes);
|
|
39
|
+
if (typeof projected !== 'object' || projected === null || Array.isArray(projected))
|
|
40
|
+
throw new AgenticReplayError('unsupported_payload');
|
|
41
|
+
return { payload: projected, omitted: false };
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (!(error instanceof AgenticReplayError) || error.code !== 'queue_limit')
|
|
45
|
+
throw error;
|
|
46
|
+
return { payload: { format, content_omitted: true, omission_reason: 'payload_limit' }, omitted: true, omissionReason: 'payload_limit' };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
36
49
|
/** Hash only host-attributed sections still present at the final request seam. */
|
|
37
50
|
export function requestSourceManifest(messages, config) {
|
|
38
51
|
if (!Array.isArray(messages))
|
|
@@ -52,8 +65,13 @@ export function requestSourceManifest(messages, config) {
|
|
|
52
65
|
continue;
|
|
53
66
|
for (const candidate of source.sections) {
|
|
54
67
|
const section = record(candidate);
|
|
55
|
-
if (typeof section.name !== 'string' || typeof section.text !== 'string'
|
|
56
|
-
|
|
68
|
+
if (typeof section.name !== 'string' || typeof section.text !== 'string' || section.name.length > 256)
|
|
69
|
+
continue;
|
|
70
|
+
if (Buffer.byteLength(section.text) > limit) {
|
|
71
|
+
omittedCount++;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (!body.includes(section.text))
|
|
57
75
|
continue;
|
|
58
76
|
if (source.kind === 'runtime-context' && section.name !== 'kiokuko:execution')
|
|
59
77
|
continue;
|
|
@@ -74,18 +92,26 @@ export function requestSourceManifest(messages, config) {
|
|
|
74
92
|
}
|
|
75
93
|
export function modelRequest(options, id, config) {
|
|
76
94
|
const messages = Array.isArray(options.messages) ? options.messages : [];
|
|
77
|
-
if (messages.length * 64 > config.maxQueuedBytesPerTrace)
|
|
78
|
-
throw new AgenticReplayError('queue_limit');
|
|
79
95
|
const sources = requestSourceManifest(options.messages, config);
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
messages: messages.
|
|
88
|
-
|
|
96
|
+
const attrs = { modelCallId: id, provider: label(options.provider), model: label(options.model),
|
|
97
|
+
messages: messages.length, purpose: options.purpose === undefined ? 'conversation' : label(options.purpose) };
|
|
98
|
+
try {
|
|
99
|
+
if (messages.length * 64 > config.maxQueuedBytesPerTrace)
|
|
100
|
+
throw new AgenticReplayError('queue_limit');
|
|
101
|
+
const payload = config.capture.content === 'metadata' ? { format: 'dsh.llm.request.v1', sources } : {
|
|
102
|
+
format: 'dsh.llm.request.v1', system: options.system, sources,
|
|
103
|
+
messages: messages.map(item => ({ role: label(record(item).role), content: projectBlocks(record(item).content, config) })),
|
|
104
|
+
tools: Array.isArray(options.tools) ? options.tools.map(item => ({ name: label(record(item).name) })) : [],
|
|
105
|
+
};
|
|
106
|
+
return { type: 'model.request', actor: 'harness', attrs,
|
|
107
|
+
payload: projectAgenticReplayJson(payload, config.maxQueuedBytesPerTrace) };
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
if (!(error instanceof AgenticReplayError) || error.code !== 'queue_limit')
|
|
111
|
+
throw error;
|
|
112
|
+
return { type: 'model.request', actor: 'harness', attrs: { ...attrs, content_omitted: true, omission_reason: 'payload_limit' },
|
|
113
|
+
payload: { format: 'dsh.llm.request.v1', sources, content_omitted: true, omission_reason: 'payload_limit' } };
|
|
114
|
+
}
|
|
89
115
|
}
|
|
90
116
|
/** DSH uses a replacement usage snapshot, with disjoint cache counters. */
|
|
91
117
|
export function usageAttrs(value) {
|
|
@@ -97,4 +123,17 @@ export function usageAttrs(value) {
|
|
|
97
123
|
...(output === undefined ? {} : { output_tokens: output }),
|
|
98
124
|
...(read === undefined ? {} : { cache_read_tokens: read }), ...(write === undefined ? {} : { cache_write_tokens: write }) };
|
|
99
125
|
}
|
|
126
|
+
/** Classify only the native result envelope; JSON/text returned as domain data is not an error signal. */
|
|
127
|
+
export function toolResultOutcome(value) {
|
|
128
|
+
const error = record(value.error);
|
|
129
|
+
const structured = Object.keys(error).length > 0;
|
|
130
|
+
const process = record(value.value);
|
|
131
|
+
const processFailed = process.timedOut === true || process.aborted === true
|
|
132
|
+
|| typeof process.signal === 'string' && process.signal.length > 0
|
|
133
|
+
|| Number.isSafeInteger(process.exitCode) && process.exitCode !== 0;
|
|
134
|
+
const failed = value.isError === true || structured || processFailed;
|
|
135
|
+
return { is_error: failed, native_is_error: value.isError,
|
|
136
|
+
...(structured ? { error_source: 'native_error_envelope' } : processFailed ? { error_source: 'native_process_result' } : {}),
|
|
137
|
+
...(failed && value.isError === false ? { error_flag_conflict: true } : {}) };
|
|
138
|
+
}
|
|
100
139
|
//# sourceMappingURL=agenticreplay-event-mapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agenticreplay-event-mapper.js","sourceRoot":"","sources":["../../src/dsh/agenticreplay-event-mapper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;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,EAAE,QAAQ,EAAE,4BAA4B,GAAG,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"agenticreplay-hooks.d.ts","sourceRoot":"","sources":["../../src/dsh/agenticreplay-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,4BAA4B,EAA8B,MAAM,0BAA0B,CAAA;AAExG,qGAAqG;AACrG,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,4BAA4B,GAAG,MAAM,IAAI,CAwC3G"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Global Cordis observation with exact host bindings; result observer survives ingress shutdown. */
|
|
2
2
|
export function mountDshAgenticReplayHooks(ctx, services) {
|
|
3
3
|
const disposers = [];
|
|
4
|
-
const on = (name, listener) => disposers.push(ctx.on(name, listener, { global: true }));
|
|
4
|
+
const on = (name, listener, prepend = false) => disposers.push(ctx.on(name, listener, { global: true, prepend }));
|
|
5
5
|
const binding = (exec) => {
|
|
6
6
|
try {
|
|
7
7
|
const resolved = exec.agent?.session ? services.resolveSessionBinding(exec.agent, exec.agent.session) : undefined;
|
|
@@ -22,6 +22,15 @@ export function mountDshAgenticReplayHooks(ctx, services) {
|
|
|
22
22
|
if (resolved && !services.canRecord(resolved))
|
|
23
23
|
return next();
|
|
24
24
|
return services.recorder.stream(resolved, options, next);
|
|
25
|
+
}, true);
|
|
26
|
+
on('agent/error', (event) => {
|
|
27
|
+
try {
|
|
28
|
+
const agent = event.agent;
|
|
29
|
+
const resolved = agent?.session ? services.resolveSessionBinding(agent, agent.session) : undefined;
|
|
30
|
+
if (resolved && services.canRecord(resolved))
|
|
31
|
+
services.recorder.nativeFailure(resolved);
|
|
32
|
+
}
|
|
33
|
+
catch { /* an observer never replaces the native error */ }
|
|
25
34
|
});
|
|
26
35
|
on('tools/pre-execute', async (exec, next) => {
|
|
27
36
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agenticreplay-hooks.js","sourceRoot":"","sources":["../../src/dsh/agenticreplay-hooks.ts"],"names":[],"mappings":"AAGA,qGAAqG;AACrG,MAAM,UAAU,0BAA0B,CAAC,GAAY,EAAE,QAAsC;IAC7F,MAAM,SAAS,GAAmB,EAAE,CAAA;IACpC,MAAM,EAAE,GAAG,CAAC,IAAY,EAAE,QAAiC,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAE,GAAW,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"agenticreplay-hooks.js","sourceRoot":"","sources":["../../src/dsh/agenticreplay-hooks.ts"],"names":[],"mappings":"AAGA,qGAAqG;AACrG,MAAM,UAAU,0BAA0B,CAAC,GAAY,EAAE,QAAsC;IAC7F,MAAM,SAAS,GAAmB,EAAE,CAAA;IACpC,MAAM,EAAE,GAAG,CAAC,IAAY,EAAE,QAAiC,EAAE,OAAO,GAAG,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAE,GAAW,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;IAC3J,MAAM,OAAO,GAAG,CAAC,IAAgC,EAAE,EAAE;QACnD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;YACjH,OAAO,QAAQ,IAAI,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAA;QACxE,CAAC;QAAC,MAAM,C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AM,KAAK,CAAA;IAAC,CAAC;IACrF,IAAI,QAAQ,GAAG,KAAK,CAAA;IACpB,OAAO,GAAG,EAAE,GAAG,IAAI,QAAQ;QAAE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,CAAA,CAAC,CAAC,CAAA;AAC9G,CAAC"}
|
|
@@ -19,6 +19,7 @@ export declare class DshAgenticReplayRecorder {
|
|
|
19
19
|
auxiliary: number;
|
|
20
20
|
lateResults: number;
|
|
21
21
|
unsupportedChunks: number;
|
|
22
|
+
omittedBodies: number;
|
|
22
23
|
};
|
|
23
24
|
constructor(config: AgenticReplayConfig, withIndex: WithAgenticReplayIndex, deps?: AgenticReplayRecorderDependencies);
|
|
24
25
|
status(sessionId: string): {
|
|
@@ -48,6 +49,7 @@ export declare class DshAgenticReplayRecorder {
|
|
|
48
49
|
auxiliary: number;
|
|
49
50
|
lateResults: number;
|
|
50
51
|
unsupportedChunks: number;
|
|
52
|
+
omittedBodies: number;
|
|
51
53
|
};
|
|
52
54
|
unavailableReason: string | undefined;
|
|
53
55
|
capture: Readonly<{
|
|
@@ -62,6 +64,8 @@ export declare class DshAgenticReplayRecorder {
|
|
|
62
64
|
attachments: false;
|
|
63
65
|
}>;
|
|
64
66
|
};
|
|
67
|
+
/** Diagnostic flush is separate from capture, including traces stopped by limits. */
|
|
68
|
+
flushDiagnostics(sessionId: string): Promise<void>;
|
|
65
69
|
start(binding: DshAgenticReplayBinding): void;
|
|
66
70
|
markUnavailable(reason: string): void;
|
|
67
71
|
stream<T>(binding: DshAgenticReplayBinding | undefined, options: Record<string, any>, next: () => AsyncIterable<T>): AsyncIterable<T>;
|
|
@@ -71,6 +75,7 @@ export declare class DshAgenticReplayRecorder {
|
|
|
71
75
|
toolDispatched(exec: AgenticReplayToolExecution): void;
|
|
72
76
|
toolResult(binding: DshAgenticReplayBinding | undefined, exec: AgenticReplayToolExecution, result: unknown): void;
|
|
73
77
|
stopAccepting(): void;
|
|
78
|
+
nativeFailure(binding: DshAgenticReplayBinding | undefined): void;
|
|
74
79
|
closeSessionRecording(sessionId: string, reason: string): Promise<void>;
|
|
75
80
|
forgetSession(sessionId: string): void;
|
|
76
81
|
shutdown(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agenticreplay-recorder.d.ts","sourceRoot":"","sources":["../../src/dsh/agenticreplay-recorder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agenticreplay-recorder.d.ts","sourceRoot":"","sources":["../../src/dsh/agenticreplay-recorder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiG,KAAK,iBAAiB,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC1M,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAItD,OAAO,EAA8C,KAAK,uBAAuB,EAAE,KAAK,0BAA0B,EAA2B,KAAK,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAmB1M,MAAM,WAAW,iCAAiC;IAChD,YAAY,CAAC,EAAE,iBAAiB,CAAA;IAChC,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;IACrC,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAA;IACzC,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;CACxC;AACD,+EAA+E;AAC/E,qBAAa,wBAAwB;;IAYvB,QAAQ,CAAC,MAAM,EAAE,mBAAmB;IAAE,QAAQ,CAAC,SAAS,EAAE,sBAAsB;IAAE,OAAO,CAAC,QAAQ,CAAC,IAAI;IAXnH,QAAQ,CAAC,UAAU,SAA0D;IAC7E,QAAQ,CAAC,WAAW;;;;;;MAA4F;gBAU3F,MAAM,EAAE,mBAAmB,EAAW,SAAS,EAAE,sBAAsB,EAAmB,IAAI,GAAE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
|
|
2
|
-
import { mkdir } from 'node:fs/promises';
|
|
2
|
+
import { mkdir, open, rename, rm } from 'node:fs/promises';
|
|
3
|
+
import { constants } from 'node:fs';
|
|
3
4
|
import { join } from 'node:path';
|
|
4
5
|
import { loadAgenticReplayLibrary, installedAgenticReplayCoreVersion } from './agenticreplay-libraries.js';
|
|
5
|
-
import { AGENTICREPLAY_CAPTURE, label, modelRequest, projectBlocks, record, usageAttrs } from './agenticreplay-event-mapper.js';
|
|
6
|
-
import {
|
|
6
|
+
import { AGENTICREPLAY_CAPTURE, boundedAgenticReplayPayload, label, modelRequest, projectBlocks, record, usageAttrs, toolResultOutcome } from './agenticreplay-event-mapper.js';
|
|
7
|
+
import { checkPrivatePath, prepareAgenticReplayParent, workspaceKey } from './agenticreplay-security.js';
|
|
7
8
|
import { agenticReplayDiskBytes, scanAgenticReplayTrace } from './agenticreplay-files.js';
|
|
8
9
|
import { AgenticReplayError, agenticReplayErrorCode } from './agenticreplay-types.js';
|
|
9
10
|
/** Owns all writers. Observation methods never throw into the DSH pipeline. */
|
|
@@ -12,7 +13,7 @@ export class DshAgenticReplayRecorder {
|
|
|
12
13
|
withIndex;
|
|
13
14
|
deps;
|
|
14
15
|
instanceId = `pid_${process.pid}_${randomBytes(12).toString('hex')}`;
|
|
15
|
-
diagnostics = { unattributed: 0, auxiliary: 0, lateResults: 0, unsupportedChunks: 0 };
|
|
16
|
+
diagnostics = { unattributed: 0, auxiliary: 0, lateResults: 0, unsupportedChunks: 0, omittedBodies: 0 };
|
|
16
17
|
#traces = new Map();
|
|
17
18
|
#attempts = new Map();
|
|
18
19
|
// Node 24 supports nonregistered symbols as weak keys. No unbounded token tombstones.
|
|
@@ -39,6 +40,53 @@ export class DshAgenticReplayRecorder {
|
|
|
39
40
|
trace.row.last_error_code ??= code;
|
|
40
41
|
if (!trace.sealed)
|
|
41
42
|
trace.row.state = trace.writer ? 'incomplete' : 'failed';
|
|
43
|
+
// The event queue may have stopped. Persist a bounded independent diagnostic,
|
|
44
|
+
// without retrying the failed capture or delaying the native operation.
|
|
45
|
+
if (!trace.diagnosticPromise) {
|
|
46
|
+
const pending = trace.tail;
|
|
47
|
+
trace.diagnosticPromise = pending.then(() => this.#persistDiagnostic(trace)).catch(() => { trace.persistenceFailed = true; });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async #persistDiagnostic(trace) {
|
|
51
|
+
try {
|
|
52
|
+
await this.withIndex(store => store.save({ ...trace.row }));
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
trace.persistenceFailed = true;
|
|
56
|
+
}
|
|
57
|
+
if (!trace.writer)
|
|
58
|
+
return;
|
|
59
|
+
const dir = trace.writer.runDir;
|
|
60
|
+
const temporary = join(dir, `.capture-status-${randomBytes(12).toString('hex')}.tmp`);
|
|
61
|
+
try {
|
|
62
|
+
await checkPrivatePath(dir, true);
|
|
63
|
+
const handle = await open(temporary, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (constants.O_NOFOLLOW ?? 0), 0o600);
|
|
64
|
+
try {
|
|
65
|
+
await handle.writeFile(JSON.stringify({ format: 'dsh.capture-status.v1', httpCapture: false,
|
|
66
|
+
runId: trace.row.agenticreplay_run_id, state: trace.row.state, lastErrorCode: trace.row.last_error_code,
|
|
67
|
+
missingEvents: trace.row.missing_event_count, unresolvedCalls: trace.row.unresolved_call_count,
|
|
68
|
+
endedAt: trace.row.ended_at }) + '\n');
|
|
69
|
+
await handle.sync();
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
await handle.close();
|
|
73
|
+
}
|
|
74
|
+
await rename(temporary, join(dir, 'capture-status.json'));
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
trace.persistenceFailed = true;
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
await rm(temporary, { force: true }).catch(() => undefined);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** Diagnostic flush is separate from capture, including traces stopped by limits. */
|
|
84
|
+
async flushDiagnostics(sessionId) {
|
|
85
|
+
const trace = this.#traces.get(sessionId);
|
|
86
|
+
if (!trace)
|
|
87
|
+
return;
|
|
88
|
+
await trace.tail;
|
|
89
|
+
await trace.diagnosticPromise;
|
|
42
90
|
}
|
|
43
91
|
#safe(trace, operation) {
|
|
44
92
|
if (trace.sealed)
|
|
@@ -59,6 +107,19 @@ export class DshAgenticReplayRecorder {
|
|
|
59
107
|
this.#bytes += bytes;
|
|
60
108
|
return true;
|
|
61
109
|
}
|
|
110
|
+
#reserveBody(trace, bytes) {
|
|
111
|
+
if (trace.pendingBytes + bytes > this.config.maxQueuedBytesPerTrace || this.#bytes + bytes > this.config.maxQueuedBytesTotal)
|
|
112
|
+
return false;
|
|
113
|
+
trace.pendingBytes += bytes;
|
|
114
|
+
this.#bytes += bytes;
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
#recordOmission(trace, eventType, id, reason, cause) {
|
|
118
|
+
this.diagnostics.omittedBodies++;
|
|
119
|
+
this.#enqueue(trace, { type: 'note', actor: 'harness', attrs: {
|
|
120
|
+
diagnostic: 'content_omitted', event_type: eventType, correlation_id: label(id), omission_reason: label(reason),
|
|
121
|
+
} }, cause);
|
|
122
|
+
}
|
|
62
123
|
#release(trace, bytes) { trace.pendingBytes -= bytes; this.#bytes -= bytes; }
|
|
63
124
|
async #save(trace) {
|
|
64
125
|
try {
|
|
@@ -185,7 +246,9 @@ export class DshAgenticReplayRecorder {
|
|
|
185
246
|
let ref;
|
|
186
247
|
const id = randomBytes(12).toString('hex');
|
|
187
248
|
const blocks = new Map();
|
|
188
|
-
|
|
249
|
+
const seenBlocks = new Set();
|
|
250
|
+
let heldBytes = 0, finish, usage, failure = false, finishFailureCode;
|
|
251
|
+
let bodyOmitted = false, bodyOmissionReason, omissionRecorded = false, bodyBytes = 0, bodyChars = 0, blockCount = 0;
|
|
189
252
|
const started = performance.now();
|
|
190
253
|
const releaseModel = () => { if (trace) {
|
|
191
254
|
self.#release(trace, heldBytes);
|
|
@@ -193,6 +256,21 @@ export class DshAgenticReplayRecorder {
|
|
|
193
256
|
blocks.clear();
|
|
194
257
|
trace.modelCleanups.delete(releaseModel);
|
|
195
258
|
} };
|
|
259
|
+
const countBody = (text) => {
|
|
260
|
+
bodyBytes = Math.min(Number.MAX_SAFE_INTEGER, bodyBytes + Buffer.byteLength(text, 'utf8'));
|
|
261
|
+
bodyChars = Math.min(Number.MAX_SAFE_INTEGER, bodyChars + text.length);
|
|
262
|
+
};
|
|
263
|
+
const omitBody = (reason) => {
|
|
264
|
+
if (bodyOmitted)
|
|
265
|
+
return;
|
|
266
|
+
bodyOmitted = true;
|
|
267
|
+
bodyOmissionReason = reason;
|
|
268
|
+
blocks.clear();
|
|
269
|
+
if (trace && heldBytes > 0) {
|
|
270
|
+
self.#release(trace, heldBytes);
|
|
271
|
+
heldBytes = 0;
|
|
272
|
+
}
|
|
273
|
+
};
|
|
196
274
|
try {
|
|
197
275
|
if (!binding)
|
|
198
276
|
self.diagnostics.unattributed++;
|
|
@@ -207,7 +285,11 @@ export class DshAgenticReplayRecorder {
|
|
|
207
285
|
trace.modelCleanups.add(releaseModel);
|
|
208
286
|
trace.active++;
|
|
209
287
|
self.#safe(trace, () => {
|
|
210
|
-
|
|
288
|
+
const requestEvent = modelRequest(options, id, self.config);
|
|
289
|
+
ref = self.#enqueue(trace, requestEvent);
|
|
290
|
+
const attrs = record(requestEvent.attrs);
|
|
291
|
+
if (attrs.content_omitted === true)
|
|
292
|
+
self.#recordOmission(trace, 'model.request', id, typeof attrs.omission_reason === 'string' ? attrs.omission_reason : 'payload_limit', ref);
|
|
211
293
|
self.#link(trace, binding);
|
|
212
294
|
});
|
|
213
295
|
}
|
|
@@ -223,6 +305,11 @@ export class DshAgenticReplayRecorder {
|
|
|
223
305
|
const c = record(chunk);
|
|
224
306
|
if (c.type === 'finish') {
|
|
225
307
|
finish = label(record(c.reason).kind);
|
|
308
|
+
const code = record(record(c.reason).failure).code;
|
|
309
|
+
if (finish === 'error' && ['DSH_MEMORY_SNAPSHOT_STALE', 'DSH_MEMORY_REBUILD_EXHAUSTED'].includes(code)) {
|
|
310
|
+
finishFailureCode = code;
|
|
311
|
+
self.#enqueue(trace, { type: 'error', actor: 'harness', attrs: { code, modelCallId: id } }, ref);
|
|
312
|
+
}
|
|
226
313
|
return;
|
|
227
314
|
}
|
|
228
315
|
if (c.type === 'usage') {
|
|
@@ -234,21 +321,41 @@ export class DshAgenticReplayRecorder {
|
|
|
234
321
|
if (c.type === 'reasoning-delta' && !self.config.capture.reasoning)
|
|
235
322
|
return;
|
|
236
323
|
if (c.type === 'text-delta' || c.type === 'reasoning-delta' || c.type === 'tool-call-delta' || c.type === 'block-end') {
|
|
324
|
+
const n = c.index;
|
|
325
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
326
|
+
throw new AgenticReplayError('unsupported_chunk');
|
|
327
|
+
if (blocks.get(n)?.closed)
|
|
328
|
+
return;
|
|
329
|
+
const firstBlockObservation = !seenBlocks.has(n);
|
|
330
|
+
if (firstBlockObservation) {
|
|
331
|
+
if (seenBlocks.size >= 256) {
|
|
332
|
+
blockCount = 257;
|
|
333
|
+
omitBody('metadata_limit');
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
seenBlocks.add(n);
|
|
337
|
+
blockCount++;
|
|
338
|
+
}
|
|
339
|
+
const sourceBlock = c.type === 'block-end' ? record(c.block) : undefined;
|
|
340
|
+
const observedText = c.type === 'block-end'
|
|
341
|
+
? firstBlockObservation ? sourceBlock?.text ?? sourceBlock?.arguments : undefined
|
|
342
|
+
: c.type === 'tool-call-delta' ? c.argumentsDelta : c.text;
|
|
343
|
+
if (typeof observedText === 'string')
|
|
344
|
+
countBody(observedText);
|
|
345
|
+
if (bodyOmitted)
|
|
346
|
+
return;
|
|
237
347
|
const value = c.type === 'block-end' ? projectBlocks([c.block], self.config)[0] :
|
|
238
348
|
c.type === 'tool-call-delta' ? { type: 'tool-call', id: label(c.id), name: label(c.name), arguments: c.argumentsDelta } :
|
|
239
349
|
{ type: c.type === 'text-delta' ? 'text' : 'reasoning', text: c.text };
|
|
240
350
|
const v = record(value);
|
|
241
351
|
if (v.omitted)
|
|
242
352
|
return;
|
|
243
|
-
const n = c.index;
|
|
244
|
-
if (!Number.isSafeInteger(n) || n < 0)
|
|
245
|
-
throw new AgenticReplayError('unsupported_chunk');
|
|
246
|
-
if (blocks.get(n)?.closed)
|
|
247
|
-
return;
|
|
248
353
|
if (self.config.capture.content === 'metadata') {
|
|
249
354
|
if (!blocks.has(n)) {
|
|
250
|
-
if (!self.#
|
|
355
|
+
if (!self.#reserveBody(trace, 128)) {
|
|
356
|
+
omitBody('payload_limit');
|
|
251
357
|
return;
|
|
358
|
+
}
|
|
252
359
|
heldBytes += 128;
|
|
253
360
|
blocks.set(n, { type: v.type, chars: 0 });
|
|
254
361
|
}
|
|
@@ -265,8 +372,10 @@ export class DshAgenticReplayRecorder {
|
|
|
265
372
|
if (typeof text !== 'string')
|
|
266
373
|
throw new AgenticReplayError('unsupported_chunk');
|
|
267
374
|
const bytes = text.length * 6 + (blocks.has(n) ? 0 : 256);
|
|
268
|
-
if (!self.#
|
|
375
|
+
if (!self.#reserveBody(trace, bytes)) {
|
|
376
|
+
omitBody('payload_limit');
|
|
269
377
|
return;
|
|
378
|
+
}
|
|
270
379
|
heldBytes += bytes;
|
|
271
380
|
const previous = blocks.get(n);
|
|
272
381
|
if (c.type === 'block-end' || !previous)
|
|
@@ -293,12 +402,38 @@ export class DshAgenticReplayRecorder {
|
|
|
293
402
|
if (trace) {
|
|
294
403
|
self.#release(trace, heldBytes);
|
|
295
404
|
heldBytes = 0;
|
|
405
|
+
// Capture is observational. Never wait for writer creation or disk
|
|
406
|
+
// drain before returning the native response.
|
|
296
407
|
self.#safe(trace, () => {
|
|
297
408
|
if (finish === undefined && !failure)
|
|
298
409
|
self.#fail(trace, 'model_finish_missing');
|
|
299
|
-
|
|
410
|
+
// Projection can fail before a request exists. Never invent an
|
|
411
|
+
// uncaused response, which looks like a missing API request.
|
|
412
|
+
if (!ref)
|
|
413
|
+
return;
|
|
414
|
+
let payload;
|
|
415
|
+
if (bodyOmitted) {
|
|
416
|
+
payload = { format: 'dsh.llm.response.v1', content_omitted: true, omission_reason: bodyOmissionReason ?? 'payload_limit',
|
|
417
|
+
observed_body_bytes: bodyBytes, observed_body_chars: bodyChars, block_count: blockCount };
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
const bounded = boundedAgenticReplayPayload({ format: 'dsh.llm.response.v1', blocks: [...blocks.values()] }, Math.max(1, self.config.maxQueuedBytesPerTrace - 2048), 'dsh.llm.response.v1');
|
|
421
|
+
if (bounded.omitted) {
|
|
422
|
+
bodyOmitted = true;
|
|
423
|
+
bodyOmissionReason = bounded.omissionReason ?? 'payload_limit';
|
|
424
|
+
payload = { ...bounded.payload, observed_body_bytes: bodyBytes, observed_body_chars: bodyChars, block_count: blockCount };
|
|
425
|
+
}
|
|
426
|
+
else
|
|
427
|
+
payload = bounded.payload;
|
|
428
|
+
}
|
|
429
|
+
if (bodyOmitted && !omissionRecorded) {
|
|
430
|
+
self.#recordOmission(trace, 'model.response', id, bodyOmissionReason ?? 'payload_limit', ref);
|
|
431
|
+
omissionRecorded = true;
|
|
432
|
+
}
|
|
300
433
|
self.#enqueue(trace, { type: 'model.response', actor: 'model', attrs: { modelCallId: id,
|
|
301
434
|
stop_reason: finish ?? (failure ? 'exception' : 'incomplete'), duration_ms: performance.now() - started,
|
|
435
|
+
...(finishFailureCode ? { failure_code: finishFailureCode } : {}),
|
|
436
|
+
...(bodyOmitted ? { content_omitted: true, omission_reason: bodyOmissionReason ?? 'payload_limit', observed_body_bytes: bodyBytes, observed_body_chars: bodyChars } : {}),
|
|
302
437
|
...(usage === undefined ? { usage_known: false } : record(usage)) }, payload: payload }, ref);
|
|
303
438
|
});
|
|
304
439
|
releaseModel();
|
|
@@ -316,15 +451,20 @@ export class DshAgenticReplayRecorder {
|
|
|
316
451
|
if (!trace)
|
|
317
452
|
return;
|
|
318
453
|
this.#safe(trace, () => {
|
|
319
|
-
const projected = this.config.capture.content === 'metadata' ? undefined
|
|
454
|
+
const projected = this.config.capture.content === 'metadata' ? undefined
|
|
455
|
+
: boundedAgenticReplayPayload(exec.arguments, Math.max(1, this.config.maxQueuedBytesPerTrace - 2048), 'dsh.tool.arguments.v1');
|
|
320
456
|
const name = label(exec.name), callId = label(exec.callId), rootCallId = label(exec.rootCallId);
|
|
321
457
|
if (!this.#reserve(trace, 512))
|
|
322
458
|
return;
|
|
323
459
|
const id = randomBytes(12).toString('hex');
|
|
324
460
|
const parent = exec.parent === undefined ? undefined : this.#attempts.get(exec.parent);
|
|
461
|
+
const omitted = projected?.omitted === true;
|
|
325
462
|
const ref = this.#enqueue(trace, { type: 'tool.call', actor: 'harness', attrs: { name, callId,
|
|
326
|
-
rootCallId, attemptId: id, startObserved, ...(
|
|
327
|
-
|
|
463
|
+
rootCallId, attemptId: id, startObserved, ...(omitted ? { content_omitted: true, omission_reason: projected.omissionReason ?? 'payload_limit' } : {}),
|
|
464
|
+
...(parent && parent.trace === trace ? { parentAttemptId: parent.id } : {}) },
|
|
465
|
+
...(this.config.capture.content === 'metadata' ? {} : { payload: projected.payload }) });
|
|
466
|
+
if (omitted)
|
|
467
|
+
this.#recordOmission(trace, 'tool.call', id, projected.omissionReason ?? 'payload_limit', ref);
|
|
328
468
|
trace.active++;
|
|
329
469
|
this.#attempts.set(exec.token, { trace, ref, id, phase: 'permission_pending', bytes: 512 });
|
|
330
470
|
this.#link(trace, binding);
|
|
@@ -379,13 +519,40 @@ export class DshAgenticReplayRecorder {
|
|
|
379
519
|
const r = record(result);
|
|
380
520
|
if (typeof r.isError !== 'boolean')
|
|
381
521
|
throw new AgenticReplayError('unsupported_tool_result');
|
|
382
|
-
|
|
383
|
-
|
|
522
|
+
let projected;
|
|
523
|
+
try {
|
|
524
|
+
projected = boundedAgenticReplayPayload({ content: projectBlocks(r.content, this.config) }, Math.max(1, this.config.maxQueuedBytesPerTrace - 2048), 'dsh.tool.result.v1');
|
|
525
|
+
}
|
|
526
|
+
catch (error) {
|
|
527
|
+
if (!(error instanceof AgenticReplayError) || error.code !== 'queue_limit')
|
|
528
|
+
throw error;
|
|
529
|
+
projected = { payload: { format: 'dsh.tool.result.v1', content_omitted: true, omission_reason: 'payload_limit' },
|
|
530
|
+
omitted: true, omissionReason: 'payload_limit' };
|
|
531
|
+
}
|
|
532
|
+
this.#enqueue(trace, { type: 'tool.result', actor: 'tool', attrs: { name: label(exec.name), attemptId: id, ...toolResultOutcome(r),
|
|
533
|
+
...(projected.omitted ? { content_omitted: true, omission_reason: projected.omissionReason ?? 'payload_limit' } : {}) },
|
|
534
|
+
payload: projected.payload }, ref);
|
|
535
|
+
if (projected.omitted)
|
|
536
|
+
this.#recordOmission(trace, 'tool.result', id, projected.omissionReason ?? 'payload_limit', ref);
|
|
384
537
|
});
|
|
385
538
|
this.#settle(trace);
|
|
386
539
|
}
|
|
387
540
|
stopAccepting() { this.#accepting = false; for (const t of this.#traces.values())
|
|
388
541
|
t.accepting = false; }
|
|
542
|
+
nativeFailure(binding) {
|
|
543
|
+
try {
|
|
544
|
+
if (!binding)
|
|
545
|
+
return;
|
|
546
|
+
const trace = this.#admit(binding);
|
|
547
|
+
if (trace)
|
|
548
|
+
this.#safe(trace, () => this.#enqueue(trace, { type: 'error', actor: 'harness', attrs: {
|
|
549
|
+
code: 'native_turn_failed', phase: 'agent', httpCapture: false,
|
|
550
|
+
} }));
|
|
551
|
+
}
|
|
552
|
+
catch {
|
|
553
|
+
this.diagnostics.unattributed++;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
389
556
|
closeSessionRecording(sessionId, reason) {
|
|
390
557
|
const trace = this.#traces.get(sessionId);
|
|
391
558
|
if (!trace)
|
|
@@ -415,14 +582,18 @@ export class DshAgenticReplayRecorder {
|
|
|
415
582
|
this.#release(trace, attempt.bytes);
|
|
416
583
|
this.#attempts.delete(token);
|
|
417
584
|
}
|
|
585
|
+
// Let all already-reserved event writes release their bounded queue bytes
|
|
586
|
+
// before reserving the final diagnostic/end event.
|
|
587
|
+
await trace.tail;
|
|
418
588
|
this.#safe(trace, () => {
|
|
419
589
|
this.#enqueue(trace, { type: 'run.end', actor: 'harness', attrs: {
|
|
420
590
|
reason: label(reason), missing_events: trace.row.missing_event_count, unresolved_calls: trace.row.unresolved_call_count,
|
|
421
|
-
recording_complete: trace.row.last_error_code === null
|
|
591
|
+
last_error_code: trace.row.last_error_code, recording_complete: trace.row.last_error_code === null
|
|
422
592
|
} });
|
|
423
593
|
});
|
|
424
594
|
trace.sealed = true; // late observations cannot append behind run.end
|
|
425
595
|
await trace.tail;
|
|
596
|
+
await trace.diagnosticPromise;
|
|
426
597
|
if (this.#unavailable && !trace.writer)
|
|
427
598
|
return;
|
|
428
599
|
try {
|
|
@@ -441,6 +612,8 @@ export class DshAgenticReplayRecorder {
|
|
|
441
612
|
}
|
|
442
613
|
trace.row.ended_at = new Date().toISOString();
|
|
443
614
|
await this.#save(trace);
|
|
615
|
+
if (trace.row.last_error_code)
|
|
616
|
+
await this.#persistDiagnostic(trace);
|
|
444
617
|
if (trace.persistenceFailed && trace.row.state === 'completed')
|
|
445
618
|
trace.row.state = 'incomplete';
|
|
446
619
|
delete trace.writer;
|