@deepstrike/wasm 0.2.49 → 0.2.51
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/README.md +2 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +3 -2
- package/dist/runtime/canonical-kernel-step.d.ts +146 -0
- package/dist/runtime/canonical-kernel-step.js +1484 -0
- package/dist/runtime/execution-plane.d.ts +0 -3
- package/dist/runtime/execution-plane.js +0 -25
- package/dist/runtime/facade.js +3 -0
- package/dist/runtime/index.d.ts +7 -7
- package/dist/runtime/index.js +4 -3
- package/dist/runtime/kernel-event-log.d.ts +0 -1
- package/dist/runtime/kernel-event-log.js +7 -13
- package/dist/runtime/kernel-journal.d.ts +332 -0
- package/dist/runtime/kernel-journal.js +681 -0
- package/dist/runtime/kernel-step.d.ts +34 -89
- package/dist/runtime/kernel-step.js +67 -167
- package/dist/runtime/os-snapshot.d.ts +2 -2
- package/dist/runtime/os-snapshot.js +2 -6
- package/dist/runtime/payload-store.d.ts +30 -0
- package/dist/runtime/payload-store.js +66 -0
- package/dist/runtime/runner.d.ts +72 -79
- package/dist/runtime/runner.js +424 -637
- package/dist/runtime/session-log.d.ts +24 -27
- package/dist/runtime/session-log.js +11 -52
- package/dist/runtime/session-repair.d.ts +2 -36
- package/dist/runtime/session-repair.js +2 -47
- package/dist/runtime/sub-agent-orchestrator.d.ts +2 -2
- package/dist/runtime/sub-agent-orchestrator.js +36 -40
- package/dist/runtime/types/agent.d.ts +21 -16
- package/dist/runtime/types/agent.js +21 -41
- package/package.json +4 -3
- package/dist/runtime/kernel-rebuild.d.ts +0 -8
- package/dist/runtime/kernel-rebuild.js +0 -65
- package/dist/runtime/kernel-transaction-log.d.ts +0 -61
- package/dist/runtime/kernel-transaction-log.js +0 -140
- package/dist/runtime/large-result-spool.d.ts +0 -57
- package/dist/runtime/large-result-spool.js +0 -169
package/README.md
CHANGED
|
@@ -85,7 +85,8 @@ src/
|
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
The kernel (`@deepstrike/wasm-kernel`, Rust/wasm-bindgen) owns:
|
|
88
|
-
-
|
|
88
|
+
- the Canonical Kernel ABI durable `prepare → append → commit` transition contract
|
|
89
|
+
- typed effects, a single effect-resolution input, observations, and terminal disposition
|
|
89
90
|
- `ContextEngine` — 4-slot context with tiered history compression
|
|
90
91
|
- `Governance` — tool veto authority
|
|
91
92
|
- `SignalRouter` — external interrupt queue
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
export { RuntimeRunner, collectText, runAgent, runFanout, InMemorySessionLog, LocalExecutionPlane, DEFAULT_NATIVE_SIGNAL_POLICY, DEFAULT_NATIVE_GOVERNANCE_POLICY, DEFAULT_SANDBOX_POLICY, assertNativeProfile, osProfile, validateDeclarativePolicy, ReplayProvider, extractRecordedMessages, judge, buildEvalMessages, parseVerdict, verdictOutputSchema, } from "./runtime/index.js";
|
|
2
|
-
export
|
|
2
|
+
export { DriverKernelJournal, InMemoryJournalDriver, InMemoryKernelJournal, JournalCasConflictError, JournalIntegrityError, JournalIoError, } from "./runtime/kernel-journal.js";
|
|
3
|
+
export type { CheckpointCandidate, InstalledCheckpoint, JournalAppendReceipt, JournalEntry, JournalHead, JournalPruneReceipt, JournalRecordInput, JournalStorageDriver, KernelJournal, } from "./runtime/kernel-journal.js";
|
|
3
4
|
export type { ReplayProviderOpts, Criterion, Verdict, VerdictDetail, JudgeArgs, } from "./runtime/index.js";
|
|
4
|
-
export type { NativeOsProfile, OsProfileId, MemoryPolicy, MemoryWriteRateLimit, ResourceQuota, RuntimeOptions, PromptBudget, SchedulerPolicy, SignalPolicy, SessionEvent, SessionLog,
|
|
5
|
+
export type { NativeOsProfile, OsProfileId, MemoryPolicy, MemoryWriteRateLimit, ResourceQuota, RuntimeOptions, PromptBudget, SchedulerPolicy, SignalPolicy, SessionEvent, SessionLog, RunContext, ExecutionPlane, KernelEventCategory, KernelPrimitive, } from "./runtime/index.js";
|
|
5
6
|
export { primitiveForCategory, primitiveForKind } from "./runtime/index.js";
|
|
6
7
|
export { FilteredExecutionPlane } from "./runtime/filtered-plane.js";
|
|
7
8
|
export { SubAgentOrchestrator, defaultSubAgentOrchestrator, spawnStandalone } from "./runtime/sub-agent-orchestrator.js";
|
|
8
9
|
export type { SubAgentRunContext } from "./runtime/sub-agent-orchestrator.js";
|
|
9
10
|
export type { AgentCapabilityFilter, AgentIdentity, AgentIsolation, AgentRunSpec, AgentProcessChangedObservation, ContextInheritance, KernelAgentRole, LoopResult, MilestoneCheckResult, MilestoneContract, MilestonePhase, MilestonePolicy, SubAgentResult, TerminationReason, WorkflowSpec, WorkflowNodeSpec, WorkflowDependencyPolicy, WorkflowNodeStatus, WorkflowNodeOutcome, WorkflowOutcome, WorkflowTaskSpec, WorkflowSpawnInfo, } from "./runtime/types/agent.js";
|
|
10
|
-
export { workflowSpecToKernel, workflowNodeSpecToKernel,
|
|
11
|
+
export { workflowSpecToKernel, workflowNodeSpecToKernel, submitWorkflowNodesTool, startWorkflowTool, fanoutSynthesize, generateAndFilter, genEval, verifyRules } from "./runtime/types/agent.js";
|
|
11
12
|
export { loopInstruction, classifyInstruction, judgeGoal, extractLoopContinue, extractClassifyBranch, extractJudgeWinner, } from "./runtime/workflow-control-flow.js";
|
|
12
13
|
export { Governance } from "./governance.js";
|
|
13
14
|
export type { GovernanceVerdict } from "./governance.js";
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { RuntimeRunner, collectText, runAgent, runFanout, InMemorySessionLog, LocalExecutionPlane, DEFAULT_NATIVE_SIGNAL_POLICY, DEFAULT_NATIVE_GOVERNANCE_POLICY, DEFAULT_SANDBOX_POLICY, assertNativeProfile, osProfile, validateDeclarativePolicy, ReplayProvider, extractRecordedMessages, judge, buildEvalMessages, parseVerdict, verdictOutputSchema, } from "./runtime/index.js";
|
|
2
|
-
|
|
2
|
+
// ── Durable transaction capability (Canonical Kernel ABI §9.1) ──────────────
|
|
3
|
+
export { DriverKernelJournal, InMemoryJournalDriver, InMemoryKernelJournal, JournalCasConflictError, JournalIntegrityError, JournalIoError, } from "./runtime/kernel-journal.js";
|
|
3
4
|
export { primitiveForCategory, primitiveForKind } from "./runtime/index.js";
|
|
4
5
|
export { FilteredExecutionPlane } from "./runtime/filtered-plane.js";
|
|
5
6
|
export { SubAgentOrchestrator, defaultSubAgentOrchestrator, spawnStandalone } from "./runtime/sub-agent-orchestrator.js";
|
|
6
|
-
export { workflowSpecToKernel, workflowNodeSpecToKernel,
|
|
7
|
+
export { workflowSpecToKernel, workflowNodeSpecToKernel, submitWorkflowNodesTool, startWorkflowTool, fanoutSynthesize, generateAndFilter, genEval, verifyRules } from "./runtime/types/agent.js";
|
|
7
8
|
export { loopInstruction, classifyInstruction, judgeGoal, extractLoopContinue, extractClassifyBranch, extractJudgeWinner, } from "./runtime/workflow-control-flow.js";
|
|
8
9
|
export { Governance } from "./governance.js";
|
|
9
10
|
export { AnthropicProvider } from "./providers/anthropic.js";
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { CanonicalKernel as CanonicalKernelInstance, CanonicalRestoreCost } from "@deepstrike/wasm-kernel";
|
|
2
|
+
import type { Message } from "../types.js";
|
|
3
|
+
import { type InstalledCheckpoint, type KernelJournal } from "./kernel-journal.js";
|
|
4
|
+
import { type KernelObservation, type KernelRunnerAction } from "./kernel-step.js";
|
|
5
|
+
export declare const MAX_CHAIN_POSITION = 1000000000000;
|
|
6
|
+
export type CanonicalKernelInput = Record<string, unknown> & {
|
|
7
|
+
kind: string;
|
|
8
|
+
};
|
|
9
|
+
export interface CanonicalPlannedStep {
|
|
10
|
+
root_kind?: "agent" | "workflow";
|
|
11
|
+
focus?: Record<string, unknown>;
|
|
12
|
+
observations?: Array<Record<string, unknown>>;
|
|
13
|
+
disposition: {
|
|
14
|
+
kind: "effects";
|
|
15
|
+
effects?: Array<Record<string, unknown>>;
|
|
16
|
+
} | {
|
|
17
|
+
kind: "terminal";
|
|
18
|
+
terminal: Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface CanonicalTransitionOptions {
|
|
22
|
+
/** Caller-stable idempotency key. Generated once when omitted. */
|
|
23
|
+
inputId?: string;
|
|
24
|
+
/** Decimal-u64 host observation. Captured once when omitted and preserved across every retry. */
|
|
25
|
+
observedAtMs?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface CanonicalTransition {
|
|
28
|
+
inputJson: string;
|
|
29
|
+
stepSeq: number;
|
|
30
|
+
recordDigest: string;
|
|
31
|
+
plannedStep: CanonicalPlannedStep;
|
|
32
|
+
checkpointAdvice?: Record<string, unknown>;
|
|
33
|
+
replayed: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare function canonicalUnsupportedEffectResolution(effectId: string, effectKind: string): CanonicalKernelInput;
|
|
36
|
+
/** The only ABI-v3 planned-step → Node host-action projection. */
|
|
37
|
+
export declare function canonicalActionFromPlannedStep(plannedStep: CanonicalPlannedStep): KernelRunnerAction | null;
|
|
38
|
+
export declare class CanonicalKernelRejectedError extends Error {
|
|
39
|
+
readonly fault: Record<string, unknown>;
|
|
40
|
+
constructor(faultJson: string);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A record is already authoritative once the journal append returns. A later native commit failure
|
|
44
|
+
* is therefore a rebuild boundary, never an abort boundary.
|
|
45
|
+
*/
|
|
46
|
+
export declare class CanonicalKernelRebuildRequiredError extends Error {
|
|
47
|
+
constructor(message: string, options?: {
|
|
48
|
+
cause?: unknown;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* WASM's canonical durable staged-transition host.
|
|
53
|
+
*
|
|
54
|
+
* It owns no scheduler truth. Core prepares opaque record bytes; `KernelJournal` makes those bytes
|
|
55
|
+
* authoritative; only then may core commit and expose the planned effects/terminal to the runner.
|
|
56
|
+
*/
|
|
57
|
+
export declare class CanonicalKernelHost {
|
|
58
|
+
readonly kernel: CanonicalKernelInstance;
|
|
59
|
+
readonly journal: KernelJournal;
|
|
60
|
+
readonly operationId: string;
|
|
61
|
+
constructor(kernel: CanonicalKernelInstance, journal: KernelJournal, operationId: string);
|
|
62
|
+
transition(input: CanonicalKernelInput, options?: CanonicalTransitionOptions): Promise<CanonicalTransition>;
|
|
63
|
+
/** Restore the latest installed checkpoint and its authoritative record tail in place. */
|
|
64
|
+
restore(): Promise<CanonicalRestoreCost>;
|
|
65
|
+
/**
|
|
66
|
+
* Replay a crash-window outbound envelope with identical bytes (adjudication 5e.3).
|
|
67
|
+
* No-op when nothing is staged. Clears the stage after commit/replay/reject.
|
|
68
|
+
*/
|
|
69
|
+
drainOutboundEnvelope(): Promise<CanonicalTransition | undefined>;
|
|
70
|
+
/** Execute the full §12.3 install/ack/reclaim boundary. */
|
|
71
|
+
checkpoint(): Promise<InstalledCheckpoint>;
|
|
72
|
+
private transitionEnvelope;
|
|
73
|
+
}
|
|
74
|
+
export interface CanonicalRunnerRuntimeOptions {
|
|
75
|
+
maxContextTokens: number;
|
|
76
|
+
maxTurns?: number;
|
|
77
|
+
maxTotalTokens?: number;
|
|
78
|
+
maxWallMs?: number;
|
|
79
|
+
memoryBindingId?: string;
|
|
80
|
+
persistPayload?: (callId: string, content: string, previewBytes: number) => Promise<{
|
|
81
|
+
payloadRef: string;
|
|
82
|
+
digest: string;
|
|
83
|
+
originalSize: string;
|
|
84
|
+
preview: string;
|
|
85
|
+
}>;
|
|
86
|
+
}
|
|
87
|
+
export declare function sha256(value: string): string;
|
|
88
|
+
/** Small synchronous SHA-256 for Worker/browser hosts (no node:crypto). */
|
|
89
|
+
declare function syncSha256(value: string): string;
|
|
90
|
+
export { syncSha256 as sha256Hex };
|
|
91
|
+
/**
|
|
92
|
+
* Canonical operation runtime used by the WASM host.
|
|
93
|
+
* Every durable transition below is one of the canonical ABI's five input classes; no legacy
|
|
94
|
+
* envelope or synthesized host transaction reaches core or storage.
|
|
95
|
+
*/
|
|
96
|
+
export declare class CanonicalRunnerRuntime {
|
|
97
|
+
private readonly options;
|
|
98
|
+
private readonly host;
|
|
99
|
+
private readonly config;
|
|
100
|
+
private readonly initialContext;
|
|
101
|
+
private configured;
|
|
102
|
+
private started;
|
|
103
|
+
private turns;
|
|
104
|
+
private lastAction;
|
|
105
|
+
private readonly newMessages;
|
|
106
|
+
private readonly hostObservations;
|
|
107
|
+
private spawnedTasks;
|
|
108
|
+
private readonly memoryBindingId;
|
|
109
|
+
private payloadInlineThreshold;
|
|
110
|
+
private payloadPreviewBytes;
|
|
111
|
+
constructor(kernel: CanonicalKernelInstance, journal: KernelJournal, operationId: string, options: CanonicalRunnerRuntimeOptions);
|
|
112
|
+
get operationId(): string;
|
|
113
|
+
get journal(): KernelJournal;
|
|
114
|
+
turn(): number;
|
|
115
|
+
isTerminal(): boolean;
|
|
116
|
+
recoveryContentBytes(): number;
|
|
117
|
+
preservedRefs(): string[];
|
|
118
|
+
drainNewMessages(): Message[];
|
|
119
|
+
drainHostObservations(): KernelObservationLike[];
|
|
120
|
+
terminal(): Record<string, unknown> | undefined;
|
|
121
|
+
localSubagentsSpawned(): number;
|
|
122
|
+
restore(): Promise<void>;
|
|
123
|
+
resumeAction(): KernelRunnerAction | null;
|
|
124
|
+
startAgent(taskValue: Record<string, unknown>, runSpecValue?: Record<string, unknown>): Promise<KernelRunnerAction | null>;
|
|
125
|
+
startWorkflow(specValue: Record<string, unknown>): Promise<KernelRunnerAction | null>;
|
|
126
|
+
applyHostEvent(event: Record<string, unknown>): Promise<KernelRunnerAction | null>;
|
|
127
|
+
private ensureConfigured;
|
|
128
|
+
private commit;
|
|
129
|
+
private currentAction;
|
|
130
|
+
private pendingEffects;
|
|
131
|
+
private succeededEffect;
|
|
132
|
+
private failedEffect;
|
|
133
|
+
private pageOutResolution;
|
|
134
|
+
private canonicalSignal;
|
|
135
|
+
private canonicalCapabilityCommand;
|
|
136
|
+
private applyBootstrapEvent;
|
|
137
|
+
private featurePolicy;
|
|
138
|
+
private executionPolicy;
|
|
139
|
+
private mergeHostConfig;
|
|
140
|
+
}
|
|
141
|
+
export declare function canonicalKernelApply(runtime: CanonicalRunnerRuntime, pending: KernelObservationLike[], event: Record<string, unknown>): Promise<KernelObservationLike[]>;
|
|
142
|
+
export declare function canonicalKernelMaybeAction(runtime: CanonicalRunnerRuntime, pending: KernelObservationLike[], event: Record<string, unknown>): Promise<KernelRunnerAction | null>;
|
|
143
|
+
export declare function canonicalKernelAction(runtime: CanonicalRunnerRuntime, pending: KernelObservationLike[], event: Record<string, unknown>): Promise<KernelRunnerAction>;
|
|
144
|
+
export declare function canonicalStartAgent(runtime: CanonicalRunnerRuntime, pending: KernelObservationLike[], task: Record<string, unknown>, runSpec?: Record<string, unknown>): Promise<KernelRunnerAction>;
|
|
145
|
+
export declare function canonicalStartWorkflow(runtime: CanonicalRunnerRuntime, pending: KernelObservationLike[], spec: Record<string, unknown>): Promise<KernelRunnerAction | null>;
|
|
146
|
+
type KernelObservationLike = KernelObservation;
|