@deepstrike/sdk 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.
Files changed (41) hide show
  1. package/README.md +83 -60
  2. package/dist/harness/manifest.d.ts +1 -1
  3. package/dist/harness/manifest.js +43 -29
  4. package/dist/index.d.ts +5 -7
  5. package/dist/index.js +3 -3
  6. package/dist/kernel.d.ts +61 -31
  7. package/dist/runtime/canonical-kernel-step.d.ts +143 -0
  8. package/dist/runtime/canonical-kernel-step.js +1444 -0
  9. package/dist/runtime/execution-plane.d.ts +0 -3
  10. package/dist/runtime/execution-plane.js +0 -24
  11. package/dist/runtime/facade.js +3 -0
  12. package/dist/runtime/kernel-event-log.js +7 -13
  13. package/dist/runtime/kernel-journal.d.ts +264 -0
  14. package/dist/runtime/kernel-journal.js +741 -0
  15. package/dist/runtime/kernel-primitives-dashboard.d.ts +0 -2
  16. package/dist/runtime/kernel-primitives-dashboard.js +1 -8
  17. package/dist/runtime/kernel-step.d.ts +29 -109
  18. package/dist/runtime/kernel-step.js +47 -317
  19. package/dist/runtime/os-snapshot.d.ts +2 -2
  20. package/dist/runtime/os-snapshot.js +2 -6
  21. package/dist/runtime/payload-store.d.ts +16 -0
  22. package/dist/runtime/payload-store.js +80 -0
  23. package/dist/runtime/runner.d.ts +80 -119
  24. package/dist/runtime/runner.js +706 -779
  25. package/dist/runtime/session-log.d.ts +34 -32
  26. package/dist/runtime/session-log.js +21 -131
  27. package/dist/runtime/session-repair.d.ts +2 -36
  28. package/dist/runtime/session-repair.js +2 -47
  29. package/dist/runtime/sub-agent-orchestrator.d.ts +1 -1
  30. package/dist/runtime/sub-agent-orchestrator.js +42 -40
  31. package/dist/types/agent.d.ts +31 -19
  32. package/dist/types/agent.js +31 -42
  33. package/dist/workflow/public.d.ts +1 -1
  34. package/dist/workflow/public.js +1 -1
  35. package/package.json +2 -2
  36. package/dist/runtime/kernel-rebuild.d.ts +0 -13
  37. package/dist/runtime/kernel-rebuild.js +0 -75
  38. package/dist/runtime/kernel-transaction-log.d.ts +0 -61
  39. package/dist/runtime/kernel-transaction-log.js +0 -149
  40. package/dist/runtime/large-result-spool.d.ts +0 -93
  41. package/dist/runtime/large-result-spool.js +0 -214
@@ -0,0 +1,143 @@
1
+ import type { CanonicalKernelInstance, CanonicalRestoreCost } from "../kernel.js";
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
+ * Node'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
+ /**
88
+ * Canonical operation runtime used by the Node host.
89
+ * Every durable transition below is one of the canonical ABI's five input classes; no legacy
90
+ * envelope or synthesized host transaction reaches core or storage.
91
+ */
92
+ export declare class CanonicalRunnerRuntime {
93
+ private readonly options;
94
+ private readonly host;
95
+ private readonly config;
96
+ private readonly initialContext;
97
+ private configured;
98
+ private started;
99
+ private turns;
100
+ private lastAction;
101
+ private readonly newMessages;
102
+ private readonly hostObservations;
103
+ private spawnedTasks;
104
+ private readonly memoryBindingId;
105
+ private payloadInlineThreshold;
106
+ private payloadPreviewBytes;
107
+ constructor(kernel: CanonicalKernelInstance, journal: KernelJournal, operationId: string, options: CanonicalRunnerRuntimeOptions);
108
+ get operationId(): string;
109
+ get journal(): KernelJournal;
110
+ turn(): number;
111
+ isTerminal(): boolean;
112
+ recoveryContentBytes(): number;
113
+ preservedRefs(): string[];
114
+ drainNewMessages(): Message[];
115
+ drainHostObservations(): KernelObservationLike[];
116
+ terminal(): Record<string, unknown> | undefined;
117
+ localSubagentsSpawned(): number;
118
+ restore(): Promise<void>;
119
+ resumeAction(): KernelRunnerAction | null;
120
+ startAgent(taskValue: Record<string, unknown>, runSpecValue?: Record<string, unknown>): Promise<KernelRunnerAction | null>;
121
+ startWorkflow(specValue: Record<string, unknown>): Promise<KernelRunnerAction | null>;
122
+ applyHostEvent(event: Record<string, unknown>): Promise<KernelRunnerAction | null>;
123
+ private ensureConfigured;
124
+ private commit;
125
+ private currentAction;
126
+ private pendingEffects;
127
+ private succeededEffect;
128
+ private failedEffect;
129
+ private pageOutResolution;
130
+ private canonicalSignal;
131
+ private canonicalCapabilityCommand;
132
+ private applyBootstrapEvent;
133
+ private featurePolicy;
134
+ private executionPolicy;
135
+ private mergeHostConfig;
136
+ }
137
+ export declare function canonicalKernelApply(runtime: CanonicalRunnerRuntime, pending: KernelObservationLike[], event: Record<string, unknown>): Promise<KernelObservationLike[]>;
138
+ export declare function canonicalKernelMaybeAction(runtime: CanonicalRunnerRuntime, pending: KernelObservationLike[], event: Record<string, unknown>): Promise<KernelRunnerAction | null>;
139
+ export declare function canonicalKernelAction(runtime: CanonicalRunnerRuntime, pending: KernelObservationLike[], event: Record<string, unknown>): Promise<KernelRunnerAction>;
140
+ export declare function canonicalStartAgent(runtime: CanonicalRunnerRuntime, pending: KernelObservationLike[], task: Record<string, unknown>, runSpec?: Record<string, unknown>): Promise<KernelRunnerAction>;
141
+ export declare function canonicalStartWorkflow(runtime: CanonicalRunnerRuntime, pending: KernelObservationLike[], spec: Record<string, unknown>): Promise<KernelRunnerAction | null>;
142
+ type KernelObservationLike = KernelObservation;
143
+ export {};