@deepstrike/wasm 0.2.72 → 0.2.73

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/agent.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { AgentCapabilityFilter } from "./runtime/types/agent.js";
2
2
  import type { Memory, WorkingMemory } from "./memory/index.js";
3
3
  import type { RegisteredTool } from "./tools/index.js";
4
+ import type { LLMProvider, StreamEvent } from "./types.js";
5
+ import { type RuntimeOptions } from "./runtime/runner.js";
4
6
  type JsonSchema = Record<string, unknown>;
5
7
  export interface MemoryReference {
6
8
  kind?: "durable";
@@ -118,6 +120,16 @@ export interface AgentOptions {
118
120
  outputSchema?: JsonSchema;
119
121
  metadata?: Record<string, unknown>;
120
122
  guardrails?: Guardrail[];
123
+ runtimeBinding?: {
124
+ provider?: LLMProvider;
125
+ providerFor?: (model: string) => LLMProvider | undefined;
126
+ runtimeOptions?: Partial<RuntimeOptions>;
127
+ };
128
+ }
129
+ export interface AgentRunResult {
130
+ output: string;
131
+ sessionId: string;
132
+ status: "completed" | "partial" | "failed" | "cancelled";
121
133
  }
122
134
  export declare class Agent {
123
135
  readonly name: string;
@@ -135,6 +147,14 @@ export declare class Agent {
135
147
  readonly outputSchema?: JsonSchema;
136
148
  readonly metadata?: Record<string, unknown>;
137
149
  readonly guardrails?: Guardrail[];
150
+ readonly runtimeBinding?: AgentOptions["runtimeBinding"];
138
151
  constructor(options: AgentOptions);
152
+ run(goal: string, options?: {
153
+ sessionId?: string;
154
+ maxTurns?: number;
155
+ }): Promise<AgentRunResult>;
156
+ stream(goal: string, options?: {
157
+ sessionId?: string;
158
+ }): AsyncIterable<StreamEvent>;
139
159
  }
140
160
  export {};
package/dist/agent.js CHANGED
@@ -1,3 +1,6 @@
1
+ import { RuntimeRunner } from "./runtime/runner.js";
2
+ import { LocalExecutionPlane } from "./runtime/execution-plane.js";
3
+ import { InMemorySessionLog } from "./runtime/session-log.js";
1
4
  export class Agent {
2
5
  name;
3
6
  description;
@@ -14,6 +17,7 @@ export class Agent {
14
17
  outputSchema;
15
18
  metadata;
16
19
  guardrails;
20
+ runtimeBinding;
17
21
  constructor(options) {
18
22
  this.name = options.name;
19
23
  this.description = options.description;
@@ -30,5 +34,45 @@ export class Agent {
30
34
  this.outputSchema = options.outputSchema;
31
35
  this.metadata = options.metadata;
32
36
  this.guardrails = options.guardrails;
37
+ this.runtimeBinding = options.runtimeBinding;
38
+ }
39
+ async run(goal, options = {}) {
40
+ const binding = this.runtimeBinding;
41
+ const provider = binding?.provider ?? (typeof this.model === "string" ? binding?.providerFor?.(this.model) : undefined);
42
+ if (!provider)
43
+ throw new Error(`agent "${this.name}" has no runtime provider binding`);
44
+ const runtime = new RuntimeRunner({
45
+ provider,
46
+ executionPlane: new LocalExecutionPlane(),
47
+ sessionLog: new InMemorySessionLog(),
48
+ maxTokens: 32_000,
49
+ agentId: this.name,
50
+ ...(this.instructions ? { systemPrompt: this.instructions } : {}),
51
+ ...(options.maxTurns !== undefined ? { maxTurns: options.maxTurns } : {}),
52
+ ...(binding?.runtimeOptions ?? {}),
53
+ });
54
+ const sessionId = options.sessionId ?? `session-${crypto.randomUUID()}`;
55
+ const events = [];
56
+ for await (const event of runtime.run({ sessionId, goal }))
57
+ events.push(event);
58
+ const output = events.filter(event => event.type === "text_delta").map(event => ("delta" in event ? String(event.delta) : "")).join("");
59
+ const failed = events.some(event => event.type === "error");
60
+ return { output, sessionId, status: failed ? "failed" : "completed" };
61
+ }
62
+ stream(goal, options = {}) {
63
+ const binding = this.runtimeBinding;
64
+ const provider = binding?.provider ?? (typeof this.model === "string" ? binding?.providerFor?.(this.model) : undefined);
65
+ if (!provider)
66
+ throw new Error(`agent "${this.name}" has no runtime provider binding`);
67
+ const runtime = new RuntimeRunner({
68
+ provider,
69
+ executionPlane: new LocalExecutionPlane(),
70
+ sessionLog: new InMemorySessionLog(),
71
+ maxTokens: 32_000,
72
+ agentId: this.name,
73
+ ...(this.instructions ? { systemPrompt: this.instructions } : {}),
74
+ ...(binding?.runtimeOptions ?? {}),
75
+ });
76
+ return runtime.run({ sessionId: options.sessionId ?? `session-${crypto.randomUUID()}`, goal });
33
77
  }
34
78
  }
package/dist/index.d.ts CHANGED
@@ -14,7 +14,7 @@ export type { AgentCapabilityFilter, AgentIdentity, AgentIsolation, AgentRunSpec
14
14
  export { workflowSpecToKernel, workflowNodeSpecToKernel, submitWorkflowNodesTool, startWorkflowTool, fanoutSynthesize, generateAndFilter, genEval, verifyRules } from "./runtime/types/agent.js";
15
15
  export { loopInstruction, classifyInstruction, judgeGoal, extractClassifyBranch, extractJudgeWinner, } from "./runtime/workflow-control-flow.js";
16
16
  export { Agent } from "./agent.js";
17
- export type { AgentMemory, AgentOptions, AgentToolDefinition, AgentRef, Guardrail, Handoff, Knowledge, KnowledgeSourceRef, MCPServer, McpTransport, MemoryReference, ModelRef, ModelRequirement, Skill, } from "./agent.js";
17
+ export type { AgentMemory, AgentOptions, AgentRunResult, AgentToolDefinition, AgentRef, Guardrail, Handoff, Knowledge, KnowledgeSourceRef, MCPServer, McpTransport, MemoryReference, ModelRef, ModelRequirement, Skill, } from "./agent.js";
18
18
  export { lowerAgent, normalizeAgent } from "./agent-ir.js";
19
19
  export type { AgentCapabilityIR, AgentDefinition, AgentLoweringInputs, AgentMemoryIR, AgentSpec, AgentToolIR, } from "./agent-ir.js";
20
20
  export { AnthropicProvider } from "./providers/anthropic.js";
@@ -1,4 +1,4 @@
1
- import type { ProviderProtocol, RenderedContext, ToolSchema } from "../types.js";
1
+ import type { GenerationProtocol, RenderedContext, ToolSchema } from "../types.js";
2
2
  export interface ProviderRequestEndpoint {
3
3
  id: string;
4
4
  protocol: string;
@@ -46,7 +46,7 @@ export interface ResolvedProviderRoute {
46
46
  request_fingerprint_scope?: "encoded_body" | "adapter_input";
47
47
  routeId: string;
48
48
  provider: string;
49
- protocol: ProviderProtocol;
49
+ protocol: GenerationProtocol;
50
50
  model: string;
51
51
  endpoint: ProviderRequestEndpoint;
52
52
  adapterVersion: string;
package/dist/types.d.ts CHANGED
@@ -221,7 +221,7 @@ export interface EntropyWatchOptions {
221
221
  * The framework creates and threads this object; providers may read/write it.
222
222
  */
223
223
  export type ProviderRunState = Record<string, unknown>;
224
- export type ProviderProtocol = "anthropic-messages" | "openai-chat" | "openai-responses" | "gemini";
224
+ export type GenerationProtocol = "anthropic-messages" | "openai-chat" | "openai-responses" | "gemini";
225
225
  /**
226
226
  * Cache_control placement strategy for the Anthropic protocol. Pass via
227
227
  * `extensions.cacheBreakpointStrategy` on any provider call (the runner threads
@@ -231,7 +231,7 @@ export type ProviderProtocol = "anthropic-messages" | "openai-chat" | "openai-re
231
231
  export type CacheBreakpointStrategy = "default" | "tools-only" | "system-only" | "frozen-prefix" | "none";
232
232
  export interface ProviderDescriptor {
233
233
  provider: string;
234
- protocol: ProviderProtocol;
234
+ protocol: GenerationProtocol;
235
235
  model: string;
236
236
  reasoning: {
237
237
  supported: boolean;
@@ -260,7 +260,7 @@ export interface PromptMeasurement {
260
260
  }
261
261
  export interface ProviderReplay {
262
262
  provider?: string;
263
- protocol: ProviderProtocol;
263
+ protocol: GenerationProtocol;
264
264
  model?: string;
265
265
  native_blocks?: Array<Record<string, unknown>>;
266
266
  reasoning_content?: string;
@@ -270,7 +270,7 @@ export interface ProviderReplay {
270
270
  }
271
271
  /** P3 §3.3 (D1) mirror of the node ProviderWireEvidence — SessionLog wire evidence bundle. */
272
272
  export interface ProviderWireEvidence {
273
- protocol: ProviderProtocol;
273
+ protocol: GenerationProtocol;
274
274
  /** → ProviderRequestPlan.fingerprint. Mandatory non-empty (G2). */
275
275
  request_fingerprint: string;
276
276
  response_id?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepstrike/wasm",
3
- "version": "0.2.72",
3
+ "version": "0.2.73",
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"
18
18
  },
19
19
  "dependencies": {
20
- "@deepstrike/wasm-kernel": "0.2.72"
20
+ "@deepstrike/wasm-kernel": "0.2.73"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/jest": "^30.0.0",