simple-agents-wasm 0.3.2 → 0.3.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simple-agents-wasm",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Browser-compatible SimpleAgents client for OpenAI-compatible providers",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -8,6 +8,17 @@ export class WasmClient {
8
8
  constructor(provider: string, config: any);
9
9
  runWorkflowYaml(workflow_path: string, _workflow_input: any): any;
10
10
  runWorkflowYamlString(yaml_text: string, workflow_input: any, workflow_options?: any | null): Promise<any>;
11
+ /**
12
+ * Run a YAML workflow from a YAML text string (new unified API alias).
13
+ *
14
+ * This is an alias for `runWorkflowYamlString` using the new naming convention.
15
+ * WASM cannot use file paths; pass the YAML document text directly.
16
+ *
17
+ * ```js
18
+ * const result = await client.runYamlString(yamlText, messages);
19
+ * ```
20
+ */
21
+ runYamlString(yaml_text: string, messages: any, options?: any | null): Promise<any>;
11
22
  streamEvents(model: string, prompt_or_messages: any, on_event: Function, options?: any | null): Promise<any>;
12
23
  }
13
24
 
@@ -26,6 +37,7 @@ export interface InitOutput {
26
37
  readonly wasmclient_new: (a: number, b: number, c: any) => [number, number, number];
27
38
  readonly wasmclient_runWorkflowYaml: (a: number, b: number, c: number, d: any) => [number, number, number];
28
39
  readonly wasmclient_runWorkflowYamlString: (a: number, b: number, c: number, d: any, e: number) => any;
40
+ readonly wasmclient_runYamlString: (a: number, b: number, c: number, d: any, e: number) => any;
29
41
  readonly wasmclient_streamEvents: (a: number, b: number, c: number, d: any, e: any, f: number) => any;
30
42
  readonly wasm_bindgen__convert__closures_____invoke__h9f53f643b01d7c8e: (a: number, b: number, c: any) => [number, number];
31
43
  readonly wasm_bindgen__convert__closures_____invoke__h05acb8c479b21d4b: (a: number, b: number, c: any, d: any) => void;
@@ -64,6 +64,26 @@ export class WasmClient {
64
64
  const ret = wasm.wasmclient_runWorkflowYamlString(this.__wbg_ptr, ptr0, len0, workflow_input, isLikeNone(workflow_options) ? 0 : addToExternrefTable0(workflow_options));
65
65
  return ret;
66
66
  }
67
+ /**
68
+ * Run a YAML workflow from a YAML text string (new unified API alias).
69
+ *
70
+ * This is an alias for `runWorkflowYamlString` using the new naming convention.
71
+ * WASM cannot use file paths; pass the YAML document text directly.
72
+ *
73
+ * ```js
74
+ * const result = await client.runYamlString(yamlText, messages);
75
+ * ```
76
+ * @param {string} yaml_text
77
+ * @param {any} messages
78
+ * @param {any | null} [options]
79
+ * @returns {Promise<any>}
80
+ */
81
+ runYamlString(yaml_text, messages, options) {
82
+ const ptr0 = passStringToWasm0(yaml_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
83
+ const len0 = WASM_VECTOR_LEN;
84
+ const ret = wasm.wasmclient_runYamlString(this.__wbg_ptr, ptr0, len0, messages, isLikeNone(options) ? 0 : addToExternrefTable0(options));
85
+ return ret;
86
+ }
67
87
  /**
68
88
  * @param {string} model
69
89
  * @param {any} prompt_or_messages
@@ -267,6 +287,10 @@ function __wbg_get_imports() {
267
287
  const ret = result;
268
288
  return ret;
269
289
  },
290
+ __wbg_isArray_4daec0bfe3d60230: function(arg0) {
291
+ const ret = Array.isArray(arg0);
292
+ return ret;
293
+ },
270
294
  __wbg_isArray_db61795ad004c139: function(arg0) {
271
295
  const ret = Array.isArray(arg0);
272
296
  return ret;
@@ -394,7 +418,7 @@ function __wbg_get_imports() {
394
418
  return ret;
395
419
  },
396
420
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
397
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 146, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
421
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 151, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
398
422
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h9f53f643b01d7c8e);
399
423
  return ret;
400
424
  },
Binary file
@@ -8,6 +8,7 @@ export const wasmclient_complete: (a: number, b: number, c: number, d: any, e: n
8
8
  export const wasmclient_new: (a: number, b: number, c: any) => [number, number, number];
9
9
  export const wasmclient_runWorkflowYaml: (a: number, b: number, c: number, d: any) => [number, number, number];
10
10
  export const wasmclient_runWorkflowYamlString: (a: number, b: number, c: number, d: any, e: number) => any;
11
+ export const wasmclient_runYamlString: (a: number, b: number, c: number, d: any, e: number) => any;
11
12
  export const wasmclient_streamEvents: (a: number, b: number, c: number, d: any, e: any, f: number) => any;
12
13
  export const wasm_bindgen__convert__closures_____invoke__h9f53f643b01d7c8e: (a: number, b: number, c: any) => [number, number];
13
14
  export const wasm_bindgen__convert__closures_____invoke__h05acb8c479b21d4b: (a: number, b: number, c: any, d: any) => void;
package/rust/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "simple-agents-wasm-rust"
3
- version = "0.3.2"
3
+ version = "0.3.3"
4
4
  edition = "2021"
5
5
  license = "MIT OR Apache-2.0"
6
6
 
package/rust/src/lib.rs CHANGED
@@ -2000,6 +2000,37 @@ impl WasmClient {
2000
2000
  "workflow file paths are not supported in browser runtime: {workflow_path}"
2001
2001
  )))
2002
2002
  }
2003
+
2004
+ /// Run a YAML workflow from a YAML text string (new unified API alias).
2005
+ ///
2006
+ /// This is an alias for `runWorkflowYamlString` using the new naming convention.
2007
+ /// WASM cannot use file paths; pass the YAML document text directly.
2008
+ ///
2009
+ /// ```js
2010
+ /// const result = await client.runYamlString(yamlText, messages);
2011
+ /// ```
2012
+ #[wasm_bindgen(js_name = runYamlString)]
2013
+ pub async fn run_yaml_string(
2014
+ &self,
2015
+ yaml_text: String,
2016
+ messages: JsValue,
2017
+ options: Option<JsValue>,
2018
+ ) -> Result<JsValue, JsValue> {
2019
+ // Build workflow input envelope from the messages arg
2020
+ let messages_value: serde_json::Value = if messages.is_array() || messages.is_object() {
2021
+ serde_wasm_bindgen::from_value(messages)
2022
+ .unwrap_or(serde_json::json!([]))
2023
+ } else if let Some(prompt) = messages.as_string() {
2024
+ serde_json::json!([{"role": "user", "content": prompt}])
2025
+ } else {
2026
+ serde_json::json!([])
2027
+ };
2028
+
2029
+ let input_js = serde_wasm_bindgen::to_value(&serde_json::json!({ "messages": messages_value }))
2030
+ .map_err(|_| js_error("failed to serialize messages input"))?;
2031
+
2032
+ self.run_workflow_yaml_string(yaml_text, input_js, options).await
2033
+ }
2003
2034
  }
2004
2035
 
2005
2036
  #[wasm_bindgen(js_name = supportsRustWasm)]