@deepstrike/wasm 0.2.78 → 0.2.79
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/runtime/kernel-event-log.js +2 -0
- package/dist/runtime/kernel-step.d.ts +3 -1
- package/dist/runtime/runner.d.ts +4 -1
- package/dist/runtime/runner.js +10 -0
- package/dist/runtime/session-event-registry.generated.d.ts +1 -1
- package/dist/runtime/session-event-registry.generated.js +1 -1
- package/dist/runtime/session-log.d.ts +15 -1
- package/dist/runtime/sub-agent-orchestrator.d.ts +3 -1
- package/dist/runtime/sub-agent-orchestrator.js +2 -0
- package/dist/runtime/types/agent.d.ts +9 -0
- package/package.json +2 -2
|
@@ -82,6 +82,8 @@ function projectKernelObservation(obs, turn, opts = {}) {
|
|
|
82
82
|
recall_expanded: obs.recall_expanded ?? 0,
|
|
83
83
|
...(obs.items && obs.items.length > 0 ? { items: obs.items } : {}),
|
|
84
84
|
...(obs.history && obs.history.length > 0 ? { history: obs.history } : {}),
|
|
85
|
+
...(obs.history_items && obs.history_items.length > 0 ? { history_items: obs.history_items } : {}),
|
|
86
|
+
...(obs.history_items_omitted ? { history_items_omitted: obs.history_items_omitted } : {}),
|
|
85
87
|
};
|
|
86
88
|
case "rollbacked":
|
|
87
89
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ModelMessage, RenderedContext, ToolCall, ToolExecutionResult, ToolSchema } from "../types.js";
|
|
2
|
-
import type { ContextItemRecord, ContextOriginTally, RollbackReason } from "./session-log.js";
|
|
2
|
+
import type { ContextHistoryItemRecord, ContextItemRecord, ContextOriginTally, RollbackReason } from "./session-log.js";
|
|
3
3
|
interface TaskUpdate {
|
|
4
4
|
plan?: string[];
|
|
5
5
|
currentStep?: number;
|
|
@@ -137,6 +137,8 @@ export interface KernelObservation {
|
|
|
137
137
|
recall_expanded?: number;
|
|
138
138
|
items?: ContextItemRecord[];
|
|
139
139
|
history?: ContextOriginTally[];
|
|
140
|
+
history_items?: ContextHistoryItemRecord[];
|
|
141
|
+
history_items_omitted?: number;
|
|
140
142
|
archived_count?: number;
|
|
141
143
|
turn?: number;
|
|
142
144
|
checkpoint_history_len?: number;
|
package/dist/runtime/runner.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { SessionLog, SessionEvent } from "./session-log.js";
|
|
|
9
9
|
import type { ExecutionPlane } from "./execution-plane.js";
|
|
10
10
|
import { type GovernancePolicy, type LivePolicyPatch } from "../governance.js";
|
|
11
11
|
import type { KernelJournal } from "./kernel-journal.js";
|
|
12
|
-
import type { AgentRunSpec, MilestonePolicy, MilestoneContract, MilestoneCheckResult, WorkflowSpec, WorkflowOutcome } from "./types/agent.js";
|
|
12
|
+
import type { AgentRunSpec, MilestonePolicy, MilestoneContract, MilestoneCheckResult, WorkflowSpec, InheritedKnowledge, WorkflowOutcome } from "./types/agent.js";
|
|
13
13
|
import { type SubAgentOrchestrator } from "./sub-agent-orchestrator.js";
|
|
14
14
|
import { type NativeOsProfile, type OsProfileId, type SignalPolicy } from "./os-profile.js";
|
|
15
15
|
import { PayloadStore } from "./payload-store.js";
|
|
@@ -141,6 +141,9 @@ export interface RuntimeOptions {
|
|
|
141
141
|
/** Plan task 3.1 · outputs of the workflow nodes this run depends on, by agent id. The kernel
|
|
142
142
|
* holds them; the model reads one with `read_result(call_id="dep:<agent_id>")`. */
|
|
143
143
|
dependencyOutputs?: Record<string, string>;
|
|
144
|
+
/** Plan task 1.1 · the parent knowledge a child run starts with, chosen by the kernel from the
|
|
145
|
+
* items' scope and the node's context inheritance. Set by the workflow driver. */
|
|
146
|
+
inheritedKnowledge?: InheritedKnowledge[];
|
|
144
147
|
/** Skill name → markdown body (WASM has no filesystem). */
|
|
145
148
|
skillContentMap?: Map<string, string>;
|
|
146
149
|
memoryRuntimePolicy?: MemoryRuntimePolicy;
|
package/dist/runtime/runner.js
CHANGED
|
@@ -758,6 +758,15 @@ export class RuntimeRunner {
|
|
|
758
758
|
content,
|
|
759
759
|
});
|
|
760
760
|
}
|
|
761
|
+
for (const entry of this.opts.inheritedKnowledge ?? []) {
|
|
762
|
+
await this.commitKernelApply(runtime, this.pendingObservations, {
|
|
763
|
+
kind: "add_knowledge_message",
|
|
764
|
+
content: entry.content,
|
|
765
|
+
...(entry.key ? { key: entry.key } : {}),
|
|
766
|
+
tokens: entry.tokens ?? Math.max(1, Math.ceil(entry.content.length / 4)),
|
|
767
|
+
...(entry.pinned ? { pinned: true } : {}),
|
|
768
|
+
});
|
|
769
|
+
}
|
|
761
770
|
if (this.opts.initialMemory) {
|
|
762
771
|
for (const mem of this.opts.initialMemory) {
|
|
763
772
|
await this.commitKernelApply(runtime, this.pendingObservations, {
|
|
@@ -1674,6 +1683,7 @@ export class RuntimeRunner {
|
|
|
1674
1683
|
...(node.dependency_outputs
|
|
1675
1684
|
? { dependencyOutputs: node.dependency_outputs }
|
|
1676
1685
|
: {}),
|
|
1686
|
+
...(node.inherited_knowledge?.length ? { inheritedKnowledge: node.inherited_knowledge } : {}),
|
|
1677
1687
|
manifest,
|
|
1678
1688
|
sessionLog: this.opts.sessionLog,
|
|
1679
1689
|
// This child is a workflow node, so capability resolution applies workflow-node quarantine
|
|
@@ -77,7 +77,7 @@ export declare const SESSION_EVENT_REGISTRY: {
|
|
|
77
77
|
};
|
|
78
78
|
readonly context_lifecycle_reported: {
|
|
79
79
|
readonly required: readonly ["cache_loss_tokens", "knowledge_entries", "knowledge_referenced", "recall_expanded", "recalled", "regret", "turn", "waste_tokens"];
|
|
80
|
-
readonly optional: readonly ["history", "items"];
|
|
80
|
+
readonly optional: readonly ["history", "history_items", "history_items_omitted", "items"];
|
|
81
81
|
};
|
|
82
82
|
readonly suspended: {
|
|
83
83
|
readonly required: readonly ["reason", "turn"];
|
|
@@ -21,7 +21,7 @@ export const SESSION_EVENT_REGISTRY = {
|
|
|
21
21
|
rollbacked: { required: ["checkpoint_history_len", "turn"], optional: ["reason"] },
|
|
22
22
|
capability_changed: { required: ["added", "removed", "turn"], optional: ["capability_id", "change_kind", "mount_reason", "mounted_by", "version"] },
|
|
23
23
|
context_renewed: { required: ["handoff_ref", "sprint", "turn"], optional: [] },
|
|
24
|
-
context_lifecycle_reported: { required: ["cache_loss_tokens", "knowledge_entries", "knowledge_referenced", "recall_expanded", "recalled", "regret", "turn", "waste_tokens"], optional: ["history", "items"] },
|
|
24
|
+
context_lifecycle_reported: { required: ["cache_loss_tokens", "knowledge_entries", "knowledge_referenced", "recall_expanded", "recalled", "regret", "turn", "waste_tokens"], optional: ["history", "history_items", "history_items_omitted", "items"] },
|
|
25
25
|
suspended: { required: ["reason", "turn"], optional: ["pending_calls"] },
|
|
26
26
|
resumed: { required: ["turn"], optional: ["approved", "denied"] },
|
|
27
27
|
tool_gated: { required: ["call_id", "reason", "tool", "turn"], optional: [] },
|
|
@@ -65,7 +65,18 @@ export interface ContextItemRecord {
|
|
|
65
65
|
paged_in_after_evict?: boolean;
|
|
66
66
|
};
|
|
67
67
|
/** Why it left; absent while resident. */
|
|
68
|
-
end?: "evicted" | "expired" | "removed";
|
|
68
|
+
end?: "evicted" | "expired" | "removed" | "compacted" | "renewed";
|
|
69
|
+
}
|
|
70
|
+
/** One history item's lifecycle in a `context_lifecycle_reported` event (plan task 4.1). */
|
|
71
|
+
export interface ContextHistoryItemRecord {
|
|
72
|
+
id: number;
|
|
73
|
+
origin: ContextItemRecord["origin"];
|
|
74
|
+
tokens: number;
|
|
75
|
+
injected_turn: number;
|
|
76
|
+
/** What it rendered when it left, or renders now; absent = full. */
|
|
77
|
+
fidelity?: "structured" | "excerpt" | "handle";
|
|
78
|
+
/** Why it left; absent while still in history. */
|
|
79
|
+
end?: "removed" | "compacted" | "renewed";
|
|
69
80
|
}
|
|
70
81
|
export type SessionEvent = {
|
|
71
82
|
kind: "run_started";
|
|
@@ -202,6 +213,9 @@ export type SessionEvent = {
|
|
|
202
213
|
items?: ContextItemRecord[];
|
|
203
214
|
/** History items by origin: admitted, still in history at the end, read back with `read_result`. */
|
|
204
215
|
history?: ContextOriginTally[];
|
|
216
|
+
/** The latest history items one by one (at most 128); older ones are only counted. */
|
|
217
|
+
history_items?: ContextHistoryItemRecord[];
|
|
218
|
+
history_items_omitted?: number;
|
|
205
219
|
} | {
|
|
206
220
|
kind: "suspended";
|
|
207
221
|
turn: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentRunSpec, AgentProcessChangedObservation, SubAgentResult } from "./types/agent.js";
|
|
1
|
+
import type { AgentRunSpec, AgentProcessChangedObservation, SubAgentResult, InheritedKnowledge } from "./types/agent.js";
|
|
2
2
|
import type { RuntimeOptions } from "./runner.js";
|
|
3
3
|
import type { SessionLog } from "./session-log.js";
|
|
4
4
|
export interface SubAgentRunContext {
|
|
@@ -22,6 +22,8 @@ export interface SubAgentRunContext {
|
|
|
22
22
|
abortSignal?: AbortSignal;
|
|
23
23
|
/** Plan task 3.1 · the outputs of the workflow nodes this child depends on, by agent id. */
|
|
24
24
|
dependencyOutputs?: Record<string, string>;
|
|
25
|
+
/** Plan task 1.1 · the parent knowledge the kernel lets this child inherit. */
|
|
26
|
+
inheritedKnowledge?: InheritedKnowledge[];
|
|
25
27
|
}
|
|
26
28
|
/** M1/G3 intelligence routing: resolve the provider for a sub-agent from its spec's `modelHint`.
|
|
27
29
|
* Falls back to the parent provider when there is no hint or no `providerFor` hook resolves it. */
|
|
@@ -128,6 +128,8 @@ export class SubAgentOrchestrator {
|
|
|
128
128
|
: undefined,
|
|
129
129
|
// A child reads only its own dependencies, never ones inherited from the parent's options.
|
|
130
130
|
dependencyOutputs: ctx.dependencyOutputs,
|
|
131
|
+
// Likewise only the knowledge the kernel chose for this child, never the parent's own.
|
|
132
|
+
inheritedKnowledge: ctx.inheritedKnowledge,
|
|
131
133
|
});
|
|
132
134
|
// #2-B-ii: parent preempt → interrupt the child (cancels its in-flight LLM call).
|
|
133
135
|
linkAbort(ctx.abortSignal, childRunner);
|
|
@@ -208,6 +208,13 @@ export interface WorkflowOutcome {
|
|
|
208
208
|
rejection?: ControlRequestRejection;
|
|
209
209
|
}
|
|
210
210
|
export declare function workflowNodeOutcomeFromKernel(raw: KernelWorkflowNodeOutcome): WorkflowNodeOutcome;
|
|
211
|
+
/** Plan task 1.1 · one parent knowledge item a child run starts with (kernel-chosen by scope). */
|
|
212
|
+
export interface InheritedKnowledge {
|
|
213
|
+
content: string;
|
|
214
|
+
key?: string;
|
|
215
|
+
tokens?: number;
|
|
216
|
+
pinned?: boolean;
|
|
217
|
+
}
|
|
211
218
|
/** Per-node spawn descriptor carried in the `workflow_batch_spawned` observation. */
|
|
212
219
|
export interface WorkflowSpawnInfo {
|
|
213
220
|
agent_id: string;
|
|
@@ -227,6 +234,8 @@ export interface WorkflowSpawnInfo {
|
|
|
227
234
|
input_agent_ids?: string[];
|
|
228
235
|
/** The kernel-composed dependency section that follows the node's goal. */
|
|
229
236
|
dependency_brief?: string;
|
|
237
|
+
/** Plan task 1.1 · the parent knowledge the kernel lets this node inherit (by item scope). */
|
|
238
|
+
inherited_knowledge?: InheritedKnowledge[];
|
|
230
239
|
/** M4/G5: the node's per-node cumulative token cap, if set — the runner caps the child run here. */
|
|
231
240
|
token_budget?: number;
|
|
232
241
|
/** O3: per-node turn cap → the child run's `maxTurns`. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepstrike/wasm",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.79",
|
|
4
4
|
"description": "DeepStrike WASM SDK — browser, Cloudflare Workers, Deno Deploy",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"test:canonical-binding": "wasm-pack build ../crates/deepstrike-wasm --target nodejs --dev --out-dir ../../wasm/pkg-node && node tests/canonical-binding.node.cjs && node tests/golden-fixtures-sweep.node.cjs && npm run build && node tests/boundary-p0-regressions.node.mjs && node tests/boundary-p1-regressions.node.mjs && node tests/boundary-p2-regressions.node.mjs && node tests/memory-candidate-binding.node.mjs && node tests/memory-recall-renewal.node.mjs"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@deepstrike/wasm-kernel": "0.2.
|
|
20
|
+
"@deepstrike/wasm-kernel": "0.2.79"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/jest": "^30.0.0",
|