@stackbone/sdk 0.1.0-alpha.7 → 0.1.0-alpha.8

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/workflow.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { defineHook, sleep } from 'workflow';
2
2
  import { Client } from 'eve/client';
3
- import { A as AgentName, W as WorkflowTriggerOptions, a as WorkflowStartHandle, S as ScheduledWorkflow } from './workflow-scheduler-DXCNKDOS.cjs';
4
- export { b as AgentRegistry } from './workflow-scheduler-DXCNKDOS.cjs';
3
+ import { A as AgentName, S as ScheduledWorkflow, W as WorkflowName } from './agent-registry-BNXuj88Q.cjs';
4
+ export { a as AgentRegistry, b as StartWorkflowAndWaitOptions, c as StartWorkflowOptions, d as WorkflowRegistry, e as WorkflowStartHandle, s as startWorkflow, f as startWorkflowAndWait } from './agent-registry-BNXuj88Q.cjs';
5
5
  import { RagIngestOutput } from '@stackbone/rag-core';
6
6
  export { RagIngestInput, RagIngestOutput } from '@stackbone/rag-core';
7
7
  export { C as CallConnectorOptions, a as ConnectionAccessor, b as ConnectorCallError, c as ConnectorHandle, P as Principal, S as StackboneConnections, d as callConnector, e as connection } from './call-connector-CYDw_yG5.cjs';
@@ -71,85 +71,6 @@ declare function requestApproval<TPayload = unknown>(options: RequestApprovalOpt
71
71
  */
72
72
  declare function eveAgent(name: AgentName): Client;
73
73
 
74
- /**
75
- * Augmentable registry of the workspace's WORKFLOW names. By default it is empty,
76
- * so `startWorkflow(name, ...)` / `startWorkflowAndWait(name, ...)` accept any
77
- * `string` (today's behavior, validated only at runtime against the injected
78
- * name→ref registry). `stackbone dev` generates an ambient
79
- * `.stackbone/workflows.d.ts` from the project's `stackbone.config.ts` workflow
80
- * list and augments this interface so the names become a closed set:
81
- *
82
- * declare module '@stackbone/sdk/workflow' {
83
- * interface WorkflowRegistry {
84
- * onboarding: true;
85
- * qualifyLead: true;
86
- * }
87
- * }
88
- *
89
- * Once augmented, `startWorkflow('qualifyLead', ...)` is fine and
90
- * `startWorkflow('typo', ...)` is a compile error — the editor also autocompletes
91
- * the declared names. Mirrors the `AgentRegistry` augmentable-interface pattern
92
- * used for `eveAgent`.
93
- */
94
- interface WorkflowRegistry {
95
- }
96
- /**
97
- * The set of workflow names the trigger helpers accept, derived from the
98
- * augmentable `WorkflowRegistry`. The tuple wrap (`[X] extends [never]`) defeats
99
- * the conditional-type distributivity a bare `keyof WorkflowRegistry extends
100
- * never` would trigger:
101
- *
102
- * - empty registry -> `string` (today's loose behavior: any name, checked at
103
- * runtime when the workflow resolves it against the manifest);
104
- * - augmented registry -> the union of declared workflow names (typo = compile error).
105
- */
106
- type WorkflowName = [keyof WorkflowRegistry] extends [never] ? string : keyof WorkflowRegistry;
107
-
108
- /** Options for {@link startWorkflow}. See {@link WorkflowTriggerOptions}. */
109
- type StartWorkflowOptions = WorkflowTriggerOptions;
110
-
111
- /**
112
- * Start the workflow named `name` with its own independent run and return its
113
- * `{ runId }` immediately — fire-and-forget. The input is validated against the
114
- * target's declared input schema BEFORE the run is enqueued; a name that does
115
- * not resolve, or input that violates the schema, rejects without starting
116
- * anything.
117
- *
118
- * `name` is typed `WorkflowName` — a loose `string` by default, narrowed to the
119
- * workspace's declared workflow names once `stackbone dev` has generated
120
- * `.stackbone/workflows.d.ts` (see `workflow-registry.ts`), so a typo becomes a
121
- * compile error.
122
- *
123
- * MUST be called from inside a running workflow (the runtime binds the starter on
124
- * first dispatch); calling it elsewhere throws.
125
- *
126
- * DURABILITY: the enqueue runs in a `"use step"`, so once it completes a parent
127
- * restart resumes with the memoized `{ runId }` and does NOT re-enqueue. A crash
128
- * WHILE the step is mid-flight re-runs it (at-least-once) — the same shape the
129
- * eve-agent-from-step path has; for fire-and-forget fan-out this is acceptable.
130
- * Use {@link startWorkflowAndWait} when you need the child's result.
131
- */
132
- declare function startWorkflow(name: WorkflowName, input: unknown, opts?: StartWorkflowOptions): Promise<WorkflowStartHandle>;
133
-
134
- /** Options for {@link startWorkflowAndWait}. See {@link WorkflowTriggerOptions}. */
135
- type StartWorkflowAndWaitOptions = WorkflowTriggerOptions;
136
- /**
137
- * Start the workflow named `name` with its own independent run and durably wait
138
- * for it to finish, returning its terminal output (validated against the
139
- * target's declared output schema). Use this when one workflow needs another's
140
- * result to continue.
141
- *
142
- * The input is validated against the target's declared input schema BEFORE the
143
- * run is enqueued; a name that does not resolve, or input that violates the
144
- * schema, rejects without starting anything. `TOutput` lets the caller name the
145
- * expected output shape (defaults to `unknown`).
146
- *
147
- * `name` is typed `WorkflowName` — narrowed to the workspace's declared workflow
148
- * names once `stackbone dev` has generated `.stackbone/workflows.d.ts`. MUST be
149
- * called from inside a running workflow.
150
- */
151
- declare function startWorkflowAndWait<TOutput = unknown>(name: WorkflowName, input: unknown, opts?: StartWorkflowAndWaitOptions): Promise<TOutput>;
152
-
153
74
  /** Content the helper stages on the caller's behalf (text or raw bytes). */
154
75
  type IngestContent = string | Uint8Array;
155
76
  /** The two input shapes {@link ingestDocuments} accepts. */
@@ -204,4 +125,4 @@ declare function unschedule(name: WorkflowName): Promise<void>;
204
125
  */
205
126
  declare function listSchedules(): Promise<ScheduledWorkflow[]>;
206
127
 
207
- export { type ApprovalDecision, type ApprovalFallback, type IngestContent, type IngestDocumentsArgs, type IngestDocumentsOptions, type RequestApprovalOptions, ScheduledWorkflow, type StartWorkflowAndWaitOptions, type StartWorkflowOptions, WORKFLOW_HOOK_RESUME_KIND, type WorkflowName, type WorkflowRegistry, WorkflowStartHandle, eveAgent, ingestDocuments, listSchedules, requestApproval, scheduleWorkflow, startWorkflow, startWorkflowAndWait, unschedule };
128
+ export { type ApprovalDecision, type ApprovalFallback, type IngestContent, type IngestDocumentsArgs, type IngestDocumentsOptions, type RequestApprovalOptions, ScheduledWorkflow, WORKFLOW_HOOK_RESUME_KIND, WorkflowName, eveAgent, ingestDocuments, listSchedules, requestApproval, scheduleWorkflow, unschedule };
package/workflow.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { defineHook, sleep } from 'workflow';
2
2
  import { Client } from 'eve/client';
3
- import { A as AgentName, W as WorkflowTriggerOptions, a as WorkflowStartHandle, S as ScheduledWorkflow } from './workflow-scheduler-DXCNKDOS.js';
4
- export { b as AgentRegistry } from './workflow-scheduler-DXCNKDOS.js';
3
+ import { A as AgentName, S as ScheduledWorkflow, W as WorkflowName } from './agent-registry-BNXuj88Q.js';
4
+ export { a as AgentRegistry, b as StartWorkflowAndWaitOptions, c as StartWorkflowOptions, d as WorkflowRegistry, e as WorkflowStartHandle, s as startWorkflow, f as startWorkflowAndWait } from './agent-registry-BNXuj88Q.js';
5
5
  import { RagIngestOutput } from '@stackbone/rag-core';
6
6
  export { RagIngestInput, RagIngestOutput } from '@stackbone/rag-core';
7
7
  export { C as CallConnectorOptions, a as ConnectionAccessor, b as ConnectorCallError, c as ConnectorHandle, P as Principal, S as StackboneConnections, d as callConnector, e as connection } from './call-connector-CYDw_yG5.js';
@@ -71,85 +71,6 @@ declare function requestApproval<TPayload = unknown>(options: RequestApprovalOpt
71
71
  */
72
72
  declare function eveAgent(name: AgentName): Client;
73
73
 
74
- /**
75
- * Augmentable registry of the workspace's WORKFLOW names. By default it is empty,
76
- * so `startWorkflow(name, ...)` / `startWorkflowAndWait(name, ...)` accept any
77
- * `string` (today's behavior, validated only at runtime against the injected
78
- * name→ref registry). `stackbone dev` generates an ambient
79
- * `.stackbone/workflows.d.ts` from the project's `stackbone.config.ts` workflow
80
- * list and augments this interface so the names become a closed set:
81
- *
82
- * declare module '@stackbone/sdk/workflow' {
83
- * interface WorkflowRegistry {
84
- * onboarding: true;
85
- * qualifyLead: true;
86
- * }
87
- * }
88
- *
89
- * Once augmented, `startWorkflow('qualifyLead', ...)` is fine and
90
- * `startWorkflow('typo', ...)` is a compile error — the editor also autocompletes
91
- * the declared names. Mirrors the `AgentRegistry` augmentable-interface pattern
92
- * used for `eveAgent`.
93
- */
94
- interface WorkflowRegistry {
95
- }
96
- /**
97
- * The set of workflow names the trigger helpers accept, derived from the
98
- * augmentable `WorkflowRegistry`. The tuple wrap (`[X] extends [never]`) defeats
99
- * the conditional-type distributivity a bare `keyof WorkflowRegistry extends
100
- * never` would trigger:
101
- *
102
- * - empty registry -> `string` (today's loose behavior: any name, checked at
103
- * runtime when the workflow resolves it against the manifest);
104
- * - augmented registry -> the union of declared workflow names (typo = compile error).
105
- */
106
- type WorkflowName = [keyof WorkflowRegistry] extends [never] ? string : keyof WorkflowRegistry;
107
-
108
- /** Options for {@link startWorkflow}. See {@link WorkflowTriggerOptions}. */
109
- type StartWorkflowOptions = WorkflowTriggerOptions;
110
-
111
- /**
112
- * Start the workflow named `name` with its own independent run and return its
113
- * `{ runId }` immediately — fire-and-forget. The input is validated against the
114
- * target's declared input schema BEFORE the run is enqueued; a name that does
115
- * not resolve, or input that violates the schema, rejects without starting
116
- * anything.
117
- *
118
- * `name` is typed `WorkflowName` — a loose `string` by default, narrowed to the
119
- * workspace's declared workflow names once `stackbone dev` has generated
120
- * `.stackbone/workflows.d.ts` (see `workflow-registry.ts`), so a typo becomes a
121
- * compile error.
122
- *
123
- * MUST be called from inside a running workflow (the runtime binds the starter on
124
- * first dispatch); calling it elsewhere throws.
125
- *
126
- * DURABILITY: the enqueue runs in a `"use step"`, so once it completes a parent
127
- * restart resumes with the memoized `{ runId }` and does NOT re-enqueue. A crash
128
- * WHILE the step is mid-flight re-runs it (at-least-once) — the same shape the
129
- * eve-agent-from-step path has; for fire-and-forget fan-out this is acceptable.
130
- * Use {@link startWorkflowAndWait} when you need the child's result.
131
- */
132
- declare function startWorkflow(name: WorkflowName, input: unknown, opts?: StartWorkflowOptions): Promise<WorkflowStartHandle>;
133
-
134
- /** Options for {@link startWorkflowAndWait}. See {@link WorkflowTriggerOptions}. */
135
- type StartWorkflowAndWaitOptions = WorkflowTriggerOptions;
136
- /**
137
- * Start the workflow named `name` with its own independent run and durably wait
138
- * for it to finish, returning its terminal output (validated against the
139
- * target's declared output schema). Use this when one workflow needs another's
140
- * result to continue.
141
- *
142
- * The input is validated against the target's declared input schema BEFORE the
143
- * run is enqueued; a name that does not resolve, or input that violates the
144
- * schema, rejects without starting anything. `TOutput` lets the caller name the
145
- * expected output shape (defaults to `unknown`).
146
- *
147
- * `name` is typed `WorkflowName` — narrowed to the workspace's declared workflow
148
- * names once `stackbone dev` has generated `.stackbone/workflows.d.ts`. MUST be
149
- * called from inside a running workflow.
150
- */
151
- declare function startWorkflowAndWait<TOutput = unknown>(name: WorkflowName, input: unknown, opts?: StartWorkflowAndWaitOptions): Promise<TOutput>;
152
-
153
74
  /** Content the helper stages on the caller's behalf (text or raw bytes). */
154
75
  type IngestContent = string | Uint8Array;
155
76
  /** The two input shapes {@link ingestDocuments} accepts. */
@@ -204,4 +125,4 @@ declare function unschedule(name: WorkflowName): Promise<void>;
204
125
  */
205
126
  declare function listSchedules(): Promise<ScheduledWorkflow[]>;
206
127
 
207
- export { type ApprovalDecision, type ApprovalFallback, type IngestContent, type IngestDocumentsArgs, type IngestDocumentsOptions, type RequestApprovalOptions, ScheduledWorkflow, type StartWorkflowAndWaitOptions, type StartWorkflowOptions, WORKFLOW_HOOK_RESUME_KIND, type WorkflowName, type WorkflowRegistry, WorkflowStartHandle, eveAgent, ingestDocuments, listSchedules, requestApproval, scheduleWorkflow, startWorkflow, startWorkflowAndWait, unschedule };
128
+ export { type ApprovalDecision, type ApprovalFallback, type IngestContent, type IngestDocumentsArgs, type IngestDocumentsOptions, type RequestApprovalOptions, ScheduledWorkflow, WORKFLOW_HOOK_RESUME_KIND, WorkflowName, eveAgent, ingestDocuments, listSchedules, requestApproval, scheduleWorkflow, unschedule };
package/workflow.js CHANGED
@@ -16047,6 +16047,55 @@ var SecretsFacade = class {
16047
16047
  }
16048
16048
  }
16049
16049
  };
16050
+ function getWorkflowScheduler() {
16051
+ {
16052
+ throw new Error("No workflow scheduler is bound. `scheduleWorkflow` / `unschedule` / `listSchedules` can only be called inside a running workflow runtime \u2014 the runtime binds the scheduler on its first dispatch.");
16053
+ }
16054
+ }
16055
+ __name(getWorkflowScheduler, "getWorkflowScheduler");
16056
+
16057
+ // src/surfaces/agent-local/workflows/schedule-workflow.ts
16058
+ async function scheduleWorkflow(name, input, cron) {
16059
+ return getWorkflowScheduler().schedule(name, input, cron);
16060
+ }
16061
+ __name(scheduleWorkflow, "scheduleWorkflow");
16062
+ async function unschedule(name) {
16063
+ return getWorkflowScheduler().unschedule(name);
16064
+ }
16065
+ __name(unschedule, "unschedule");
16066
+ async function listSchedules() {
16067
+ return getWorkflowScheduler().listSchedules();
16068
+ }
16069
+ __name(listSchedules, "listSchedules");
16070
+ function getWorkflowStarter() {
16071
+ {
16072
+ throw new Error("No workflow starter is bound. `startWorkflow` / `startWorkflowAndWait` can only be called from inside a running workflow \u2014 the runtime binds the starter on its first dispatch.");
16073
+ }
16074
+ }
16075
+ __name(getWorkflowStarter, "getWorkflowStarter");
16076
+
16077
+ // src/surfaces/agent-local/workflows/start-workflow.ts
16078
+ async function startWorkflow(name, input, opts) {
16079
+ "use step";
16080
+ return getWorkflowStarter().start(name, input, opts);
16081
+ }
16082
+ __name(startWorkflow, "startWorkflow");
16083
+
16084
+ // src/surfaces/agent-local/workflows/start-workflow-and-wait.ts
16085
+ async function startWorkflowAndWait(name, input, opts) {
16086
+ "use step";
16087
+ return await getWorkflowStarter().startAndWait(name, input, opts);
16088
+ }
16089
+ __name(startWorkflowAndWait, "startWorkflowAndWait");
16090
+
16091
+ // src/surfaces/agent-local/workflows/workflows-accessor.ts
16092
+ var workflows = {
16093
+ start: startWorkflow,
16094
+ startAndWait: startWorkflowAndWait,
16095
+ schedule: scheduleWorkflow,
16096
+ unschedule,
16097
+ listSchedules
16098
+ };
16050
16099
  function agentRegistry() {
16051
16100
  const raw = process.env["AGENT_URLS"];
16052
16101
  if (!raw) {
@@ -17176,6 +17225,24 @@ var StackboneClient = class {
17176
17225
  return agent;
17177
17226
  }
17178
17227
  /**
17228
+ * Namespaced workflow trigger + schedule surface — `stackbone.workflows.start(...)`
17229
+ * / `.startAndWait(...)` / `.schedule(...)` / `.unschedule(...)` / `.listSchedules()`.
17230
+ * Start another workflow by name (fire-and-forget or durable sub-routine) and
17231
+ * manage dynamic cron triggers, all from inside a running workflow.
17232
+ *
17233
+ * These are peer-free shims over the ambient `WorkflowStarter` / `WorkflowScheduler`
17234
+ * the runtime injects on first dispatch — they import NO `workflow` / `eve` peer,
17235
+ * so (like `connection` / `agent`) they are wired directly onto the client and
17236
+ * pull nothing new into the main barrel. This is the namespaced form of the loose
17237
+ * `startWorkflow(...)` / `scheduleWorkflow(...)` exports (now `@deprecated`) on the
17238
+ * `@stackbone/sdk/workflow` subpath; both delegate to the same implementation, so
17239
+ * `start` / `startAndWait` keep their `"use step"` durability. The peer-bound
17240
+ * authoring API (`requestApproval` / `defineHook` / `sleep`) stays on that subpath.
17241
+ */
17242
+ get workflows() {
17243
+ return workflows;
17244
+ }
17245
+ /**
17179
17246
  * Pending surface — runtime not built. Every method returns
17180
17247
  * `not_implemented`. Mem0 is a third-party integration, not a Stackbone
17181
17248
  * Agent Protocol capability, so this surface is intentionally not gated.
@@ -17317,26 +17384,6 @@ function eveAgent(name) {
17317
17384
  });
17318
17385
  }
17319
17386
  __name(eveAgent, "eveAgent");
17320
- function getWorkflowStarter() {
17321
- {
17322
- throw new Error("No workflow starter is bound. `startWorkflow` / `startWorkflowAndWait` can only be called from inside a running workflow \u2014 the runtime binds the starter on its first dispatch.");
17323
- }
17324
- }
17325
- __name(getWorkflowStarter, "getWorkflowStarter");
17326
-
17327
- // src/surfaces/agent-local/workflows/start-workflow.ts
17328
- async function startWorkflow(name, input, opts) {
17329
- "use step";
17330
- return getWorkflowStarter().start(name, input, opts);
17331
- }
17332
- __name(startWorkflow, "startWorkflow");
17333
-
17334
- // src/surfaces/agent-local/workflows/start-workflow-and-wait.ts
17335
- async function startWorkflowAndWait(name, input, opts) {
17336
- "use step";
17337
- return await getWorkflowStarter().startAndWait(name, input, opts);
17338
- }
17339
- __name(startWorkflowAndWait, "startWorkflowAndWait");
17340
17387
 
17341
17388
  // src/surfaces/agent-local/workflows/ingest-documents.ts
17342
17389
  async function ingestDocuments(args, opts = {}) {
@@ -17366,26 +17413,6 @@ async function stageContent(collection, content, contentType) {
17366
17413
  return storageKey;
17367
17414
  }
17368
17415
  __name(stageContent, "stageContent");
17369
- function getWorkflowScheduler() {
17370
- {
17371
- throw new Error("No workflow scheduler is bound. `scheduleWorkflow` / `unschedule` / `listSchedules` can only be called inside a running workflow runtime \u2014 the runtime binds the scheduler on its first dispatch.");
17372
- }
17373
- }
17374
- __name(getWorkflowScheduler, "getWorkflowScheduler");
17375
-
17376
- // src/surfaces/agent-local/workflows/schedule-workflow.ts
17377
- async function scheduleWorkflow(name, input, cron) {
17378
- return getWorkflowScheduler().schedule(name, input, cron);
17379
- }
17380
- __name(scheduleWorkflow, "scheduleWorkflow");
17381
- async function unschedule(name) {
17382
- return getWorkflowScheduler().unschedule(name);
17383
- }
17384
- __name(unschedule, "unschedule");
17385
- async function listSchedules() {
17386
- return getWorkflowScheduler().listSchedules();
17387
- }
17388
- __name(listSchedules, "listSchedules");
17389
17416
 
17390
17417
  export { WORKFLOW_HOOK_RESUME_KIND, callConnector, connection, eveAgent, ingestDocuments, listSchedules, requestApproval, scheduleWorkflow, startWorkflow, startWorkflowAndWait, unschedule };
17391
17418
  //# sourceMappingURL=workflow.js.map