@arbidocs/sdk 0.5.147 → 0.5.149

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/index.cjs CHANGED
@@ -14703,6 +14703,42 @@ var Arbi = class {
14703
14703
  create: (body) => createWorkflow(this.requireClient(), body),
14704
14704
  update: (workflowId, body) => updateWorkflow(this.requireClient(), workflowId, body),
14705
14705
  delete: (workflowId) => deleteWorkflow(this.requireClient(), workflowId),
14706
+ /**
14707
+ * A saved workflow with its steps: its own workspace's key is deposited on this session first
14708
+ * (without switching), so the plan, stored encrypted under that key, is readable.
14709
+ */
14710
+ get: async (workflowId) => {
14711
+ const client = this.requireClient();
14712
+ const record = await getWorkflow(client, workflowId);
14713
+ if (!record.workspace_ext_id || record.plan || record.source_workflow_ext_id) return record;
14714
+ await this.primeOrFail(record.workspace_ext_id);
14715
+ return getWorkflow(client, workflowId);
14716
+ },
14717
+ /**
14718
+ * Start a saved workflow in `options.workspaceId` (absent: the current workspace): the run is a
14719
+ * thread there with a copy of the workflow's steps, and records the workflow it came from. The
14720
+ * workflow may live in another workspace (the skills workspace): the caller must be a member of
14721
+ * both, and both keys are deposited on this session first. `inputs` are the run's inputs,
14722
+ * checked against the workflow's declared ones (a 422 names each that does not fit).
14723
+ */
14724
+ start: async (workflowId, options = {}) => {
14725
+ const client = this.requireClient();
14726
+ const record = await getWorkflow(client, workflowId);
14727
+ if (record.workspace_ext_id) await this.primeOrFail(record.workspace_ext_id);
14728
+ const target = await this.requireTargetWorkspace(options.workspaceId);
14729
+ return this.recovering(
14730
+ () => createWork(
14731
+ client,
14732
+ {
14733
+ workflow_ext_id: workflowId,
14734
+ skill_inputs: options.inputs ?? null,
14735
+ auth_mode: "run_now_temp",
14736
+ ...options.title ? { title: options.title.slice(0, 60) } : {}
14737
+ },
14738
+ target
14739
+ )
14740
+ );
14741
+ },
14706
14742
  /** Fire a workflow now, as a test run. Resolves with the conversation it created and whether it started. */
14707
14743
  run: (workflowId) => runWorkflow(this.requireClient(), workflowId),
14708
14744
  /** A workflow's runs, newest first: what fired it, the task it created and how it went. */