@deepstrike/wasm 0.2.61 → 0.2.62

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.
@@ -37,8 +37,8 @@ export interface CanonicalTransition {
37
37
  replayed: boolean;
38
38
  }
39
39
  export declare function canonicalUnsupportedEffectResolution(effectId: string, effectKind: string): CanonicalKernelInput;
40
- /** The only ABI-v3 planned-step → Node host-action projection. */
41
- export declare function canonicalActionFromPlannedStep(plannedStep: CanonicalPlannedStep): KernelRunnerAction | null;
40
+ /** Adapt the additive core CurrentProjection JSON into the existing WASM action surface. */
41
+ export declare function canonicalActionFromProjectionJson(raw: string): KernelRunnerAction | null;
42
42
  export declare class CanonicalKernelRejectedError extends Error {
43
43
  readonly fault: Record<string, unknown>;
44
44
  constructor(faultJson: string);
@@ -27,240 +27,186 @@ export function canonicalUnsupportedEffectResolution(effectId, effectKind) {
27
27
  },
28
28
  };
29
29
  }
30
- /** The only ABI-v3 planned-step → Node host-action projection. */
31
- export function canonicalActionFromPlannedStep(plannedStep) {
32
- if (plannedStep.disposition.kind === "terminal") {
33
- const terminal = plannedStep.disposition.terminal;
34
- const usage = asObject(terminal.usage);
35
- let termination = String(terminal.kind ?? "failed");
36
- let turnsUsed = Number(usage.turns ?? 0);
37
- if (terminal.kind === "agent") {
38
- const result = asObject(terminal.result);
39
- termination = String(result.termination ?? "completed");
40
- turnsUsed = Number(result.turns_used ?? turnsUsed);
41
- const finalMessage = asObject(result.final_message);
42
- const pace = asObject(result.pace_decision);
43
- if (Object.keys(finalMessage).length > 0) {
44
- return {
45
- kind: "done",
46
- effectId: "",
47
- result: {
48
- termination,
49
- turnsUsed,
50
- totalTokensUsed: totalUsageTokens(terminal),
51
- finalMessage: {
52
- role: String(finalMessage.role ?? "assistant"),
53
- content: String(finalMessage.content ?? ""),
54
- toolCalls: (Array.isArray(finalMessage.tool_calls) ? finalMessage.tool_calls : [])
55
- .map(value => {
56
- const call = asObject(value);
57
- return {
58
- id: String(call.call_id ?? ""),
59
- name: String(call.name ?? ""),
60
- arguments: JSON.stringify(call.arguments ?? {}),
61
- };
62
- }),
63
- },
64
- ...(Object.keys(pace).length > 0
65
- ? {
66
- paceDecision: {
67
- action: String(pace.action ?? "stop"),
68
- ...(pace.delay_ms !== undefined ? { delayMs: Number(pace.delay_ms) } : {}),
69
- reason: String(pace.reason ?? ""),
70
- ...(pace.coerced_from ? { coercedFrom: String(pace.coerced_from) } : {}),
71
- },
72
- }
73
- : {}),
74
- },
75
- };
76
- }
77
- }
78
- else if (terminal.kind === "workflow") {
79
- const outcome = asObject(terminal.outcome);
80
- termination = String(outcome.status ?? "completed");
81
- }
82
- else if (terminal.kind === "cancelled") {
83
- termination = String(terminal.reason ?? "cancelled");
84
- }
85
- else if (terminal.kind === "failed") {
86
- const failure = asObject(terminal.failure);
87
- termination = failure.code === "provider_recovery_exhausted"
88
- ? "context_overflow"
89
- : "error";
90
- }
30
+ function canonicalDoneFromTerminal(terminal) {
31
+ const usage = asObject(terminal.usage);
32
+ let termination = String(terminal.kind ?? "failed");
33
+ let turnsUsed = Number(usage.turns ?? 0);
34
+ if (terminal.kind === "agent") {
35
+ const result = asObject(terminal.result);
36
+ termination = String(result.termination ?? "completed");
37
+ turnsUsed = Number(result.turns_used ?? turnsUsed);
38
+ const finalMessage = asObject(result.final_message);
39
+ const pace = asObject(result.pace_decision);
91
40
  return {
92
- kind: "done",
93
- effectId: "",
41
+ kind: "done", effectId: "",
94
42
  result: {
95
- termination,
96
- turnsUsed,
97
- totalTokensUsed: totalUsageTokens(terminal),
43
+ termination, turnsUsed, totalTokensUsed: totalUsageTokens(terminal),
44
+ ...(Object.keys(finalMessage).length > 0 ? { finalMessage: {
45
+ role: String(finalMessage.role ?? "assistant"),
46
+ content: String(finalMessage.content ?? ""),
47
+ toolCalls: (Array.isArray(finalMessage.tool_calls) ? finalMessage.tool_calls : []).map(value => {
48
+ const call = asObject(value);
49
+ return { id: String(call.call_id ?? ""), name: String(call.name ?? ""), arguments: JSON.stringify(call.arguments ?? {}) };
50
+ }),
51
+ } } : {}),
52
+ ...(Object.keys(pace).length > 0 ? { paceDecision: {
53
+ action: String(pace.action ?? "stop"),
54
+ ...(pace.delay_ms !== undefined ? { delayMs: Number(pace.delay_ms) } : {}),
55
+ reason: String(pace.reason ?? ""),
56
+ ...(pace.coerced_from ? { coercedFrom: String(pace.coerced_from) } : {}),
57
+ } } : {}),
98
58
  },
99
59
  };
100
60
  }
101
- const published = plannedStep.disposition.effects ?? [];
102
- if (published.length === 0)
61
+ if (terminal.kind === "workflow")
62
+ termination = String(asObject(terminal.outcome).status ?? "completed");
63
+ if (terminal.kind === "cancelled")
64
+ termination = String(terminal.reason ?? "cancelled");
65
+ if (terminal.kind === "failed")
66
+ termination = asObject(terminal.failure).code === "provider_recovery_exhausted" ? "context_overflow" : "error";
67
+ return { kind: "done", effectId: "", result: { termination, turnsUsed, totalTokensUsed: totalUsageTokens(terminal) } };
68
+ }
69
+ /** Adapt the additive core CurrentProjection JSON into the existing WASM action surface. */
70
+ export function canonicalActionFromProjectionJson(raw) {
71
+ const projection = asObject(JSON.parse(raw));
72
+ const state = String(projection.state ?? "idle");
73
+ if (state === "idle")
103
74
  return null;
104
- if (published.length !== 1) {
105
- throw new Error(`WASM runner expects one canonical effect at a time, received ${published.length}`);
75
+ if (state === "terminal") {
76
+ return canonicalDoneFromTerminal(asObject(projection.action));
106
77
  }
107
- const envelope = asObject(published[0]);
108
- const effectId = String(envelope.effect_id ?? "");
109
- const effect = asObject(envelope.effect);
110
- if (!effectId)
111
- throw new Error("canonical effect is missing effect_id");
112
- switch (effect.kind) {
113
- case "call_provider":
114
- return {
115
- kind: "call_provider",
116
- effectId,
117
- context: renderedContextToSdk(asObject(effect.context)),
118
- tools: (Array.isArray(effect.tools) ? effect.tools : []).map(raw => {
119
- const tool = asObject(raw);
120
- return {
121
- name: String(tool.name ?? ""),
122
- description: String(tool.description ?? ""),
123
- parameters: JSON.stringify(tool.parameters ?? {}),
124
- };
125
- }),
126
- };
127
- case "execute_tools":
128
- return {
129
- kind: "execute_tool",
130
- effectId,
131
- calls: (Array.isArray(effect.calls) ? effect.calls : []).map(raw => {
132
- const call = asObject(raw);
133
- return {
134
- id: String(call.call_id ?? ""),
135
- name: String(call.name ?? ""),
136
- arguments: JSON.stringify(call.arguments ?? {}),
137
- };
138
- }),
139
- };
140
- case "request_approval":
141
- return {
142
- kind: "request_approval",
143
- effectId,
144
- requests: (Array.isArray(effect.requests) ? effect.requests : []).map(raw => {
145
- const request = asObject(raw);
146
- return {
147
- callId: String(request.call_id ?? ""),
148
- tool: String(request.tool_name ?? ""),
149
- arguments: JSON.stringify(request.arguments ?? {}),
150
- reason: String(request.reason ?? ""),
151
- };
152
- }),
153
- };
154
- case "spawn_tasks":
155
- return {
156
- kind: "spawn_workflow",
157
- effectId,
158
- nodes: (Array.isArray(effect.tasks) ? effect.tasks : []).map(raw => {
159
- const task = asObject(raw);
160
- const spec = asObject(task.spec);
161
- return {
162
- agent_id: String(task.task_id ?? ""),
163
- task_id: String(task.task_id ?? ""),
164
- attempt_id: String(task.attempt_id ?? ""),
165
- launch_token: String(task.launch_token ?? ""),
166
- node_id: String(task.node_id ?? ""),
167
- goal: String(spec.goal ?? ""),
168
- role: String(spec.role ?? "custom"),
169
- isolation: String(spec.isolation ?? "shared"),
170
- context_inheritance: String(spec.context_inheritance ?? "none"),
171
- ...(spec.metadata && typeof spec.metadata === "object"
172
- ? asObject(spec.metadata)
173
- : {}),
174
- };
175
- }),
176
- ...(effect.budget ? { budget: asObject(effect.budget) } : {}),
177
- };
178
- case "preempt_tasks": {
179
- const attempts = (Array.isArray(effect.attempts) ? effect.attempts : []).map(raw => {
180
- const attempt = asObject(raw);
78
+ const action = asObject(projection.action);
79
+ const payload = asObject(action.payload);
80
+ const effectId = String(action.effect_id ?? "");
81
+ if (action.kind === "query_memory") {
82
+ return {
83
+ kind: "query_memory",
84
+ effectId,
85
+ query: asObject(payload.query),
86
+ requestedK: Number(payload.requested_k ?? 0),
87
+ };
88
+ }
89
+ if (action.kind === "execute_tools") {
90
+ return {
91
+ kind: "execute_tool",
92
+ effectId,
93
+ calls: (Array.isArray(payload.calls) ? payload.calls : []).map(raw => {
94
+ const call = asObject(raw);
181
95
  return {
182
- task_id: String(attempt.task_id ?? ""),
183
- attempt_id: String(attempt.attempt_id ?? ""),
96
+ id: String(call.call_id ?? ""),
97
+ name: String(call.name ?? ""),
98
+ arguments: JSON.stringify(call.arguments ?? {}),
184
99
  };
185
- });
186
- return {
187
- kind: "preempt_sub_agents",
188
- effectId,
189
- attempts,
190
- agentIds: attempts.map(attempt => attempt.task_id),
191
- reason: String(effect.reason ?? ""),
192
- };
193
- }
194
- case "persist_memory":
195
- return {
196
- kind: "persist_memory",
197
- effectId,
198
- memory: asObject(effect.memory),
199
- };
200
- case "query_memory":
201
- return {
202
- kind: "query_memory",
203
- effectId,
204
- query: asObject(effect.query),
205
- requestedK: Number(effect.requested_k ?? 0),
206
- };
207
- case "archive_page_out": {
208
- const payload = asObject(effect.payload);
209
- let archived = [];
210
- try {
211
- const decoded = JSON.parse(String(payload.content ?? ""));
212
- if (Array.isArray(decoded)) {
213
- archived = decoded.map(value => kernelMessageToSdk(asObject(value)));
214
- }
215
- }
216
- catch {
217
- // Persistence still uses the opaque body and digest. Only optional presentation-side
218
- // summarization is skipped if the archived message batch cannot be decoded.
219
- }
220
- const compressed = (plannedStep.observations ?? [])
221
- .find(observation => observation.kind === "compressed");
222
- const pressureAction = compressed ? String(compressed.action ?? "") : "";
223
- return {
224
- kind: "archive_page_out",
225
- effectId,
226
- handleId: String(effect.handle_id ?? ""),
227
- payload,
228
- archived,
229
- ...(pressureAction ? { action: pressureAction } : {}),
230
- ...(compressed?.summary ? { summary: String(compressed.summary) } : {}),
231
- ...(pressureAction
232
- ? {
233
- tier: ["context_collapse", "auto_compact"].includes(pressureAction)
234
- ? "semantic"
235
- : "durable",
236
- }
237
- : {}),
238
- };
100
+ }),
101
+ };
102
+ }
103
+ if (action.kind === "call_provider") {
104
+ const context = asObject(payload.context);
105
+ return {
106
+ kind: "call_provider",
107
+ effectId,
108
+ context: renderedContextToSdk(context),
109
+ tools: (Array.isArray(payload.tools) ? payload.tools : []).map(raw => {
110
+ const tool = asObject(raw);
111
+ return {
112
+ name: String(tool.name ?? ""),
113
+ description: String(tool.description ?? ""),
114
+ parameters: JSON.stringify(tool.parameters ?? {}),
115
+ };
116
+ }),
117
+ };
118
+ }
119
+ if (action.kind === "request_approval") {
120
+ return {
121
+ kind: "request_approval",
122
+ effectId,
123
+ requests: (Array.isArray(payload.requests) ? payload.requests : []).map(raw => {
124
+ const request = asObject(raw);
125
+ return {
126
+ callId: String(request.call_id ?? ""),
127
+ tool: String(request.tool_name ?? ""),
128
+ arguments: JSON.stringify(request.arguments ?? {}),
129
+ reason: String(request.reason ?? ""),
130
+ };
131
+ }),
132
+ };
133
+ }
134
+ if (action.kind === "load_payload") {
135
+ return {
136
+ kind: "load_payload",
137
+ effectId,
138
+ handleId: String(payload.handle_id ?? ""),
139
+ payloadRef: String(payload.payload_ref ?? ""),
140
+ };
141
+ }
142
+ if (action.kind === "evaluate_milestone") {
143
+ const request = asObject(payload.request);
144
+ return {
145
+ kind: "evaluate_milestone",
146
+ effectId,
147
+ phaseId: String(request.phase_id ?? ""),
148
+ criteria: [],
149
+ requiredEvidence: [],
150
+ };
151
+ }
152
+ if (action.kind === "spawn_tasks") {
153
+ return {
154
+ kind: "spawn_workflow",
155
+ effectId,
156
+ nodes: (Array.isArray(payload.tasks) ? payload.tasks : []).map(raw => {
157
+ const task = asObject(raw);
158
+ const spec = asObject(task.spec);
159
+ return {
160
+ agent_id: String(task.task_id ?? ""), task_id: String(task.task_id ?? ""),
161
+ attempt_id: String(task.attempt_id ?? ""), launch_token: String(task.launch_token ?? ""),
162
+ node_id: String(task.node_id ?? ""), goal: String(spec.goal ?? ""),
163
+ role: String(spec.role ?? "custom"), isolation: String(spec.isolation ?? "shared"),
164
+ context_inheritance: String(spec.context_inheritance ?? "none"),
165
+ ...(spec.metadata && typeof spec.metadata === "object" ? asObject(spec.metadata) : {}),
166
+ };
167
+ }),
168
+ ...(payload.budget ? { budget: asObject(payload.budget) } : {}),
169
+ };
170
+ }
171
+ if (action.kind === "preempt_tasks") {
172
+ const attempts = (Array.isArray(payload.attempts) ? payload.attempts : []).map(raw => {
173
+ const attempt = asObject(raw);
174
+ return { task_id: String(attempt.task_id ?? ""), attempt_id: String(attempt.attempt_id ?? "") };
175
+ });
176
+ return { kind: "preempt_sub_agents", effectId, attempts, agentIds: attempts.map(a => a.task_id), reason: String(payload.reason ?? "") };
177
+ }
178
+ if (action.kind === "persist_memory") {
179
+ return { kind: "persist_memory", effectId, memory: asObject(payload.memory) };
180
+ }
181
+ if (action.kind === "archive_page_out") {
182
+ const archivePayload = asObject(payload.payload);
183
+ let archived = [];
184
+ try {
185
+ const decoded = JSON.parse(String(archivePayload.content ?? ""));
186
+ if (Array.isArray(decoded))
187
+ archived = decoded.map(value => kernelMessageToSdk(asObject(value)));
239
188
  }
240
- case "load_payload":
241
- return {
242
- kind: "load_payload",
243
- effectId,
244
- handleId: String(effect.handle_id ?? ""),
245
- payloadRef: String(effect.payload_ref ?? ""),
246
- };
247
- case "evaluate_milestone": {
248
- const request = asObject(effect.request);
249
- return {
250
- kind: "evaluate_milestone",
251
- effectId,
252
- phaseId: String(request.phase_id ?? ""),
253
- criteria: [],
254
- requiredEvidence: [],
255
- };
189
+ catch {
190
+ // The opaque archive payload remains authoritative even when presentation decoding fails.
256
191
  }
257
- default:
258
- return {
259
- kind: "unsupported_effect",
260
- effectId,
261
- effectKind: String(effect.kind),
262
- };
192
+ return {
193
+ kind: "archive_page_out",
194
+ effectId,
195
+ handleId: String(payload.handle_id ?? ""),
196
+ payload: {
197
+ content: String(archivePayload.content ?? ""),
198
+ digest: String(archivePayload.digest ?? ""),
199
+ original_size: String(archivePayload.original_size ?? "0"),
200
+ ...(archivePayload.preview ? { preview: String(archivePayload.preview) } : {}),
201
+ },
202
+ archived,
203
+ };
263
204
  }
205
+ return {
206
+ kind: "unsupported_effect",
207
+ effectId,
208
+ effectKind: String(action.kind ?? ""),
209
+ };
264
210
  }
265
211
  export class CanonicalKernelRejectedError extends Error {
266
212
  fault;
@@ -1165,6 +1111,16 @@ export class CanonicalRunnerRuntime {
1165
1111
  throw new Error("canonical observation is missing kind");
1166
1112
  this.hostObservations.push({ ...raw, kind });
1167
1113
  }
1114
+ // §7.11 · a committed step that publishes effects is a fact worth recording in the
1115
+ // host event log: the journal stores only a digest of the step, so this manifest is
1116
+ // what makes the published effect ids + kinds recoverable post-hoc without replaying.
1117
+ const published = JSON.parse(this.host.kernel.publishedEffectsManifestJson(JSON.stringify(transition.plannedStep)));
1118
+ if (published.length > 0) {
1119
+ this.hostObservations.push({
1120
+ kind: "step_published_effects",
1121
+ effects: published,
1122
+ });
1123
+ }
1168
1124
  if (transition.checkpointAdvice) {
1169
1125
  this.hostObservations.push({
1170
1126
  kind: "checkpoint_advised",
@@ -1178,7 +1134,7 @@ export class CanonicalRunnerRuntime {
1178
1134
  });
1179
1135
  }
1180
1136
  }
1181
- this.lastAction = canonicalActionFromPlannedStep(transition.plannedStep);
1137
+ this.lastAction = canonicalActionFromProjectionJson(this.host.kernel.projectPlannedStepJson(JSON.stringify(transition.plannedStep)));
1182
1138
  }
1183
1139
  if (this.lastAction?.kind !== "unsupported_effect")
1184
1140
  return this.lastAction;
@@ -1186,16 +1142,7 @@ export class CanonicalRunnerRuntime {
1186
1142
  }
1187
1143
  }
1188
1144
  currentAction() {
1189
- const terminal = this.host.kernel.terminalJson();
1190
- if (terminal) {
1191
- return canonicalActionFromPlannedStep({
1192
- disposition: { kind: "terminal", terminal: JSON.parse(terminal) },
1193
- });
1194
- }
1195
- const effects = this.pendingEffects();
1196
- return canonicalActionFromPlannedStep({
1197
- disposition: { kind: "effects", effects },
1198
- });
1145
+ return canonicalActionFromProjectionJson(this.host.kernel.currentProjectionJson());
1199
1146
  }
1200
1147
  pendingEffects() {
1201
1148
  return JSON.parse(this.host.kernel.pendingEffectsJson());
@@ -9,7 +9,7 @@ export type { MemoryPolicy, MemoryWriteRateLimit, OperationCancellationReason, P
9
9
  export { RuntimeRunner, collectText } from "./runner.js";
10
10
  export { MemoryPayloadDriver, PayloadStore } from "./payload-store.js";
11
11
  export type { PayloadStorageDriver, PayloadStoreConfig } from "./payload-store.js";
12
- export { CanonicalKernelHost, CanonicalKernelRejectedError, CanonicalKernelRebuildRequiredError, CanonicalRunnerRuntime, canonicalActionFromPlannedStep, sha256, } from "./canonical-kernel-step.js";
12
+ export { CanonicalKernelHost, CanonicalKernelRejectedError, CanonicalKernelRebuildRequiredError, CanonicalRunnerRuntime, sha256, } from "./canonical-kernel-step.js";
13
13
  export type { CanonicalKernelInput, CanonicalPlannedStep, CanonicalRunnerRuntimeOptions, CanonicalTransition, CanonicalTransitionOptions, } from "./canonical-kernel-step.js";
14
14
  export { runAgent, runFanout } from "./facade.js";
15
15
  export type { RunAgentOptions, RunFanoutOptions } from "./facade.js";
@@ -5,7 +5,7 @@ export * from "./context-policy.js";
5
5
  export { LocalExecutionPlane } from "./execution-plane.js";
6
6
  export { RuntimeRunner, collectText } from "./runner.js";
7
7
  export { MemoryPayloadDriver, PayloadStore } from "./payload-store.js";
8
- export { CanonicalKernelHost, CanonicalKernelRejectedError, CanonicalKernelRebuildRequiredError, CanonicalRunnerRuntime, canonicalActionFromPlannedStep, sha256, } from "./canonical-kernel-step.js";
8
+ export { CanonicalKernelHost, CanonicalKernelRejectedError, CanonicalKernelRebuildRequiredError, CanonicalRunnerRuntime, sha256, } from "./canonical-kernel-step.js";
9
9
  export { runAgent, runFanout } from "./facade.js";
10
10
  export { builtinReducers, resolveReducer } from "./reducers.js";
11
11
  export { getKernel } from "./kernel.js";
@@ -84,11 +84,7 @@ export type KernelRunnerAction = {
84
84
  } | {
85
85
  kind: "archive_page_out";
86
86
  effectId: string;
87
- turn?: number;
88
- action?: string;
89
- summary?: string;
90
87
  archived: Message[];
91
- tier?: string;
92
88
  handleId?: string;
93
89
  payload?: {
94
90
  content: string;
@@ -204,7 +200,17 @@ export interface KernelObservation {
204
200
  rollbacks_in_window?: number;
205
201
  window_turns?: number;
206
202
  threshold?: number;
203
+ effects?: Array<{
204
+ effect_id: string;
205
+ kind: string;
206
+ }>;
207
207
  }
208
+ /** Presentation/policy facts for archive actions are sourced from committed observations. */
209
+ export declare function archivePresentationFromObservations(observations: readonly KernelObservation[]): {
210
+ action?: string;
211
+ summary?: string;
212
+ tier?: "semantic" | "durable";
213
+ };
208
214
  export declare function toolSchemaToKernel(schema: ToolSchema): Record<string, unknown>;
209
215
  export declare function skillMetadataToKernel(skill: SkillMetadata): Record<string, unknown>;
210
216
  export declare function messageToKernelMessage(message: Message): Record<string, unknown>;
@@ -25,6 +25,18 @@ export function decodeCanonicalContentParts(content) {
25
25
  return undefined;
26
26
  }
27
27
  }
28
+ /** Presentation/policy facts for archive actions are sourced from committed observations. */
29
+ export function archivePresentationFromObservations(observations) {
30
+ const compressed = [...observations].reverse().find(observation => observation.kind === "compressed");
31
+ const action = compressed?.action;
32
+ if (action !== "snip_compact" && action !== "micro_compact" && action !== "context_collapse" && action !== "auto_compact")
33
+ return {};
34
+ return {
35
+ action,
36
+ ...(compressed?.summary ? { summary: compressed.summary } : {}),
37
+ tier: action === "context_collapse" || action === "auto_compact" ? "semantic" : "durable",
38
+ };
39
+ }
28
40
  function tryParseJson(s) {
29
41
  try {
30
42
  return JSON.parse(s);
@@ -8,7 +8,7 @@ import { sanitizeReplayText } from "./replay-sanitize.js";
8
8
  import { decodeDurableContent, decodeDurableToolResult, durableBlocksToToolOutput, toolOutputBlocksToDurable } from "./durable-content.js";
9
9
  import { formatToolError } from "../tools/errors.js";
10
10
  import { buildLlmCompletedEvent, buildRunTerminalEvent, buildWorkflowNodeCompletedEvent, buildWorkflowNodesSubmittedEvent, } from "./session-repair.js";
11
- import { messageToKernelMessage, skillMetadataToKernel, taskUpdateToKernel, toolResultToKernel, toolSchemaToKernel, } from "./kernel-step.js";
11
+ import { messageToKernelMessage, archivePresentationFromObservations, skillMetadataToKernel, taskUpdateToKernel, toolResultToKernel, toolSchemaToKernel, } from "./kernel-step.js";
12
12
  import { agentRunSpecToKernel, MILESTONE_UNVERIFIED_REASON, milestoneCheckFail, milestoneCheckPass, milestoneCheckResultToKernel, subAgentResultToKernel, workflowBudgetNote, workflowNodeSpecToKernel, workflowNodeOutcomeFromKernel, workflowNodeStatusFromTermination, workflowNodeToManifest, workflowNodeToSpec, workflowSpecToKernel, } from "./types/agent.js";
13
13
  import { defaultSubAgentOrchestrator } from "./sub-agent-orchestrator.js";
14
14
  import { extractJsonValue, schemaInstruction, schemaRetryInstruction, validateAgainstSchema, } from "./output-schema.js";
@@ -899,8 +899,8 @@ export class RuntimeRunner {
899
899
  error = formatToolError(cause);
900
900
  }
901
901
  const archived = action.archived;
902
- const archiveAction = compressionAction(action.action) ?? "auto_compact";
903
- const archiveTier = action.tier;
902
+ const archiveAction = archiveMeta.action ?? "auto_compact";
903
+ const archiveTier = archiveMeta.tier;
904
904
  if (!error)
905
905
  this.activePageOutArchive = undefined;
906
906
  action = await this.commitKernelAction(runtime, this.pendingObservations, {
@@ -1767,7 +1767,11 @@ export class RuntimeRunner {
1767
1767
  const compressedSeq = await this.opts.sessionLog.append(sessionId, event);
1768
1768
  if (event.kind === "compressed") {
1769
1769
  if ((obs.archived_count ?? 0) > 0) {
1770
- this.pendingPageOutArchives.push({ archiveStart: nextArchiveStart, compressedSeq });
1770
+ this.pendingPageOutArchives.push({
1771
+ archiveStart: nextArchiveStart,
1772
+ compressedSeq,
1773
+ ...archivePresentationFromObservations([obs]),
1774
+ });
1771
1775
  }
1772
1776
  nextArchiveStart = compressedSeq + 1;
1773
1777
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepstrike/wasm",
3
- "version": "0.2.61",
3
+ "version": "0.2.62",
4
4
  "description": "DeepStrike WASM SDK — browser, Cloudflare Workers, Deno Deploy",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "test:canonical-binding": "wasm-pack build ../crates/deepstrike-wasm --target nodejs --dev --out-dir ../../wasm/pkg-node && node tests/canonical-binding.node.cjs"
17
17
  },
18
18
  "dependencies": {
19
- "@deepstrike/wasm-kernel": "0.2.61"
19
+ "@deepstrike/wasm-kernel": "0.2.62"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/jest": "^30.0.0",