simple-agents-wasm 0.3.5 → 0.3.7

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 CHANGED
@@ -4,9 +4,10 @@ Browser-compatible SimpleAgents client for OpenAI-compatible providers.
4
4
 
5
5
  ## Status
6
6
 
7
- This package now loads a Rust-compiled WASM core (`rust/src/lib.rs`) for
8
- runtime execution when wasm artifacts are available. A JS fallback remains for
9
- non-wasm environments and local Node tests.
7
+ This package is Rust-WASM only. Runtime execution is provided by the
8
+ Rust-compiled core in `rust/src/lib.rs` and requires generated wasm artifacts.
9
+ If artifacts are missing or initialization fails, the package throws an
10
+ explicit backend-load error.
10
11
 
11
12
  ## Install
12
13
 
@@ -51,4 +52,4 @@ console.log(result.content);
51
52
  - step workflows (`steps` DSL)
52
53
  - graph workflows (`entry_node` + `nodes` + `edges`) with `llm_call`, `switch`, and `custom_worker`.
53
54
  - Graph `custom_worker` nodes call `workflowOptions.functions[handler]` and throw a runtime error when the handler is missing.
54
- - Use `hasRustBackend()` to check whether Rust wasm backend was loaded.
55
+ - Use `hasRustBackend()` to check whether the Rust wasm backend is available.
package/index.d.ts CHANGED
@@ -147,6 +147,30 @@ export interface WorkflowTraceConfig {
147
147
  tenant?: WorkflowTraceTenant;
148
148
  }
149
149
 
150
+ /**
151
+ * First argument to `workflow_options.functions` handlers for `custom_worker` nodes
152
+ * (Rust wasm graph runner). Matches the JSON object built in Rust.
153
+ */
154
+ export interface CustomWorkerArgs {
155
+ handler?: string;
156
+ handler_file?: string | null;
157
+ handler_lookup_key?: string;
158
+ nodeId?: string;
159
+ payload?: unknown;
160
+ }
161
+
162
+ /**
163
+ * Second argument to `custom_worker` handlers: live graph context (`input`, `nodes`, and
164
+ * optional `globals` / `trace` when the runner provides them).
165
+ */
166
+ export interface WorkflowGraphContext {
167
+ input?: Record<string, unknown>;
168
+ nodes?: Record<string, unknown>;
169
+ globals?: Record<string, unknown>;
170
+ trace?: Record<string, unknown>;
171
+ [key: string]: unknown;
172
+ }
173
+
150
174
  export interface WorkflowRunOptions {
151
175
  model?: string;
152
176
  telemetry?: WorkflowTelemetryConfig;
@@ -155,8 +179,8 @@ export interface WorkflowRunOptions {
155
179
  functions?: Record<
156
180
  string,
157
181
  (
158
- args: Record<string, unknown>,
159
- context: Record<string, unknown>
182
+ args: CustomWorkerArgs,
183
+ context: WorkflowGraphContext
160
184
  ) => unknown | Promise<unknown>
161
185
  >;
162
186
  }