@nexalab/agent-sdk 0.1.0 → 0.1.6

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.
Files changed (85) hide show
  1. package/README.md +94 -6
  2. package/dist/file-storage.d.ts +3 -0
  3. package/dist/file-storage.d.ts.map +1 -1
  4. package/dist/file-storage.js +9 -0
  5. package/dist/file-storage.js.map +1 -1
  6. package/dist/guided-flows/define-flow.d.ts +4 -0
  7. package/dist/guided-flows/define-flow.d.ts.map +1 -0
  8. package/dist/guided-flows/define-flow.js +34 -0
  9. package/dist/guided-flows/define-flow.js.map +1 -0
  10. package/dist/guided-flows/errors.d.ts +11 -0
  11. package/dist/guided-flows/errors.d.ts.map +1 -0
  12. package/dist/guided-flows/errors.js +15 -0
  13. package/dist/guided-flows/errors.js.map +1 -0
  14. package/dist/guided-flows/events.d.ts +20 -0
  15. package/dist/guided-flows/events.d.ts.map +1 -0
  16. package/dist/guided-flows/events.js +17 -0
  17. package/dist/guided-flows/events.js.map +1 -0
  18. package/dist/guided-flows/index.d.ts +10 -0
  19. package/dist/guided-flows/index.d.ts.map +1 -0
  20. package/dist/guided-flows/index.js +6 -0
  21. package/dist/guided-flows/index.js.map +1 -0
  22. package/dist/guided-flows/persistence.d.ts +32 -0
  23. package/dist/guided-flows/persistence.d.ts.map +1 -0
  24. package/dist/guided-flows/persistence.js +37 -0
  25. package/dist/guided-flows/persistence.js.map +1 -0
  26. package/dist/guided-flows/requirements.d.ts +8 -0
  27. package/dist/guided-flows/requirements.d.ts.map +1 -0
  28. package/dist/guided-flows/requirements.js +21 -0
  29. package/dist/guided-flows/requirements.js.map +1 -0
  30. package/dist/guided-flows/runtime.d.ts +74 -0
  31. package/dist/guided-flows/runtime.d.ts.map +1 -0
  32. package/dist/guided-flows/runtime.js +423 -0
  33. package/dist/guided-flows/runtime.js.map +1 -0
  34. package/dist/guided-flows/state.d.ts +30 -0
  35. package/dist/guided-flows/state.d.ts.map +1 -0
  36. package/dist/guided-flows/state.js +84 -0
  37. package/dist/guided-flows/state.js.map +1 -0
  38. package/dist/guided-flows/steps.d.ts +12 -0
  39. package/dist/guided-flows/steps.d.ts.map +1 -0
  40. package/dist/guided-flows/steps.js +37 -0
  41. package/dist/guided-flows/steps.js.map +1 -0
  42. package/dist/guided-flows/tool-policy.d.ts +16 -0
  43. package/dist/guided-flows/tool-policy.d.ts.map +1 -0
  44. package/dist/guided-flows/tool-policy.js +33 -0
  45. package/dist/guided-flows/tool-policy.js.map +1 -0
  46. package/dist/guided-flows/types.d.ts +141 -0
  47. package/dist/guided-flows/types.d.ts.map +1 -0
  48. package/dist/guided-flows/types.js +2 -0
  49. package/dist/guided-flows/types.js.map +1 -0
  50. package/dist/hooks.d.ts +52 -0
  51. package/dist/hooks.d.ts.map +1 -1
  52. package/dist/hooks.js.map +1 -1
  53. package/dist/index.d.ts +1 -0
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +1 -0
  56. package/dist/index.js.map +1 -1
  57. package/dist/kernel.d.ts +23 -0
  58. package/dist/kernel.d.ts.map +1 -1
  59. package/dist/kernel.js +62 -4
  60. package/dist/kernel.js.map +1 -1
  61. package/dist/manifest.d.ts +3 -2
  62. package/dist/manifest.d.ts.map +1 -1
  63. package/dist/manifest.js +1 -0
  64. package/dist/manifest.js.map +1 -1
  65. package/dist/postgres-storage.d.ts +3 -0
  66. package/dist/postgres-storage.d.ts.map +1 -1
  67. package/dist/postgres-storage.js +9 -0
  68. package/dist/postgres-storage.js.map +1 -1
  69. package/dist/redis-storage.d.ts +3 -0
  70. package/dist/redis-storage.d.ts.map +1 -1
  71. package/dist/redis-storage.js +9 -0
  72. package/dist/redis-storage.js.map +1 -1
  73. package/dist/sessions.d.ts +5 -1
  74. package/dist/sessions.d.ts.map +1 -1
  75. package/dist/sessions.js +2 -2
  76. package/dist/sessions.js.map +1 -1
  77. package/dist/sqlite-storage.d.ts +3 -0
  78. package/dist/sqlite-storage.d.ts.map +1 -1
  79. package/dist/sqlite-storage.js +13 -1
  80. package/dist/sqlite-storage.js.map +1 -1
  81. package/dist/storage.d.ts +4 -0
  82. package/dist/storage.d.ts.map +1 -1
  83. package/dist/storage.js +8 -0
  84. package/dist/storage.js.map +1 -1
  85. package/package.json +21 -5
@@ -0,0 +1,423 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { runNativeToolLoop } from "../native-tool-loop.js";
3
+ import { namespaceKey } from "../tenancy.js";
4
+ import { parseStructuredOutput, structuredOutputInstruction } from "../structured-output.js";
5
+ import { GuidedFlowOutputValidationError } from "./errors.js";
6
+ import { applyConfirmationReset, applyStatePatch, buildModelPatchSchema } from "./state.js";
7
+ import { diffRequirements, evaluateRequirements } from "./requirements.js";
8
+ import { missingCollectFields, resolveActiveStep } from "./steps.js";
9
+ import { missingRequiredBeforeExitTools, missingRequiredTools, resolveStepTools } from "./tool-policy.js";
10
+ import { publishFlowEvent } from "./events.js";
11
+ const ONGOING_STATUSES = ["active", "waiting_for_user", "waiting_for_tool", "waiting_for_approval"];
12
+ function isOngoing(status) {
13
+ return ONGOING_STATUSES.includes(status);
14
+ }
15
+ /**
16
+ * Drives Guided Flow turns. Constructed once per agent (by `kernel.ts` when
17
+ * `config.flows?.length`) and never streamed — `runStream()` in
18
+ * `openai-agent.ts` is untouched; internally this still uses the same
19
+ * `runNativeToolLoop`/`ModelHarness` contracts, just called directly rather
20
+ * than through `agent.run()`'s normal path.
21
+ */
22
+ export class GuidedFlowRuntime {
23
+ options;
24
+ constructor(options) {
25
+ this.options = options;
26
+ }
27
+ flowById(id) {
28
+ return this.options.flows.find((flow) => flow.id === id);
29
+ }
30
+ requireFlow(id) {
31
+ const flow = this.flowById(id);
32
+ if (!flow)
33
+ throw new Error(`GuidedFlowRuntime: unknown flow id "${id}".`);
34
+ return flow;
35
+ }
36
+ soleFlow() {
37
+ if (this.options.flows.length !== 1) {
38
+ throw new Error("GuidedFlowRuntime: a flowId must be specified when an agent has more than one flow.");
39
+ }
40
+ return this.options.flows[0];
41
+ }
42
+ key(tenant, sessionId) {
43
+ return tenant && (tenant.tenantId || tenant.userId) ? namespaceKey(tenant, sessionId) : sessionId;
44
+ }
45
+ async selectFlow(input) {
46
+ const key = this.key(input.tenant, input.sessionId);
47
+ for (const flow of this.options.flows) {
48
+ const existing = await this.options.store.getFlowState(key, flow.id);
49
+ if (existing && isOngoing(existing.status))
50
+ return flow;
51
+ }
52
+ if (input.explicitFlow)
53
+ return this.flowById(input.explicitFlow);
54
+ if (this.options.flowSelector) {
55
+ const id = await this.options.flowSelector({ text: input.text, flows: this.options.flows });
56
+ if (id)
57
+ return this.flowById(id);
58
+ }
59
+ if (this.options.flows.length === 1)
60
+ return this.options.flows[0];
61
+ const lowered = input.text.toLowerCase();
62
+ for (const flow of this.options.flows) {
63
+ const triggers = flow.config.triggers;
64
+ if (!triggers)
65
+ continue;
66
+ const phrases = [...(triggers.examples ?? []), ...(triggers.intents ?? [])];
67
+ if (phrases.some((phrase) => lowered.includes(phrase.toLowerCase())))
68
+ return flow;
69
+ }
70
+ return undefined;
71
+ }
72
+ async runTurn(input) {
73
+ const flow = await this.selectFlow(input);
74
+ if (!flow)
75
+ return { handled: false };
76
+ const driven = await this.driveFlow(flow, input);
77
+ return { handled: true, ...driven };
78
+ }
79
+ async driveFlow(flow, input) {
80
+ const config = flow.config;
81
+ const key = this.key(input.tenant, input.sessionId);
82
+ const taskId = randomUUID();
83
+ const runId = randomUUID();
84
+ const now = () => new Date().toISOString();
85
+ const existing = await this.options.store.getFlowState(key, flow.id);
86
+ let record = existing ?? {
87
+ flowId: flow.id,
88
+ flowVersion: flow.version,
89
+ sessionId: key,
90
+ status: "active",
91
+ state: { ...config.initialState },
92
+ completedRequirementIds: [],
93
+ missingRequirementIds: [],
94
+ stepToolLog: {},
95
+ startedAt: now(),
96
+ updatedAt: now()
97
+ };
98
+ if (!existing) {
99
+ await this.options.hooks.fire("beforeFlowStart", { flowId: flow.id, sessionId: key, context: { taskId, runId } });
100
+ await publishFlowEvent(this.options.events, { type: "flow.started", flowId: flow.id, sessionId: key, taskId, runId, payload: { state: record.state } });
101
+ await this.options.hooks.fire("afterFlowStart", { flowId: flow.id, sessionId: key, context: { taskId, runId } });
102
+ }
103
+ else if (existing.status === "cancelled") {
104
+ record = { ...existing, status: "active" };
105
+ await publishFlowEvent(this.options.events, { type: "flow.resumed", flowId: flow.id, sessionId: key, taskId, runId, payload: { state: record.state } });
106
+ }
107
+ let state = record.state;
108
+ const previousStepId = record.currentStepId;
109
+ const stepToolLog = { ...record.stepToolLog };
110
+ let requirements = evaluateRequirements(config, state);
111
+ let step = resolveActiveStep(config, state);
112
+ await this.announceStepChange(flow, key, previousStepId, step?.id, taskId, runId);
113
+ // --- Extraction sub-call: pull a Zod-validated partial state patch out of free text ---
114
+ const modelPatchSchema = buildModelPatchSchema(config.stateSchema, config.protectedFields);
115
+ let modelPatch = {};
116
+ try {
117
+ const extraction = await this.options.client.complete({
118
+ providerId: this.options.providerId,
119
+ model: this.options.model,
120
+ messages: [
121
+ {
122
+ role: "system",
123
+ content: `${buildGuidedInstructions(config, step, state, this.options.skills)}\n\n${structuredOutputInstruction(modelPatchSchema, "StatePatch")}\nOnly include fields the user explicitly provided in their latest message. Omit fields that are unknown, already known, or not mentioned.`
124
+ },
125
+ ...input.messages,
126
+ { role: "user", content: input.text }
127
+ ]
128
+ });
129
+ const parsed = parseStructuredOutput(modelPatchSchema, extraction.text);
130
+ if (parsed.ok)
131
+ modelPatch = parsed.data;
132
+ else {
133
+ await publishFlowEvent(this.options.events, {
134
+ type: "flow.validation.failed",
135
+ flowId: flow.id,
136
+ sessionId: key,
137
+ taskId,
138
+ runId,
139
+ payload: { stage: "extraction", reason: parsed.error }
140
+ });
141
+ }
142
+ }
143
+ catch (error) {
144
+ await publishFlowEvent(this.options.events, {
145
+ type: "flow.validation.failed",
146
+ flowId: flow.id,
147
+ sessionId: key,
148
+ taskId,
149
+ runId,
150
+ payload: { stage: "extraction", reason: error instanceof Error ? error.message : String(error) }
151
+ });
152
+ }
153
+ ({ state, requirements, step } = await this.applyPatch(flow, key, taskId, runId, config, state, { set: modelPatch, source: "model" }, requirements));
154
+ // --- Tool-scoped reply pass: never offers tools beyond the active step's policy ---
155
+ const effectiveTools = resolveStepTools(this.options.toolRegistrations, step?.tools);
156
+ const maxRounds = 6;
157
+ const loopInput = {
158
+ client: this.options.client,
159
+ providerId: this.options.providerId,
160
+ model: this.options.model,
161
+ messages: [
162
+ { role: "system", content: buildGuidedInstructions(config, step, state, this.options.skills) },
163
+ ...input.messages,
164
+ { role: "user", content: input.text }
165
+ ],
166
+ tools: effectiveTools,
167
+ taskId,
168
+ runId,
169
+ maxRounds,
170
+ onEvent: (event) => this.forwardNativeEvent(flow, key, taskId, runId, event)
171
+ };
172
+ const native = this.options.harness ? await this.options.harness.run(loopInput) : await runNativeToolLoop(loopInput);
173
+ const activeStepId = step?.id;
174
+ if (activeStepId)
175
+ stepToolLog[activeStepId] = stepToolLog[activeStepId] ?? [];
176
+ let pendingApproval = false;
177
+ for (const toolResult of native.toolResults) {
178
+ if (toolResult.result.status === "pending_approval")
179
+ pendingApproval = true;
180
+ if (toolResult.result.status === "ok" && activeStepId) {
181
+ stepToolLog[activeStepId] = [...(stepToolLog[activeStepId] ?? []), toolResult.tool.id];
182
+ }
183
+ const binding = config.tools?.bindings?.[toolResult.tool.id];
184
+ if (binding) {
185
+ const patch = binding.applyResult({ result: toolResult.result, state });
186
+ if (patch) {
187
+ ({ state, requirements, step } = await this.applyPatch(flow, key, taskId, runId, config, state, patch, requirements));
188
+ }
189
+ }
190
+ }
191
+ // Don't let the resolved step silently skip past one whose requiredBeforeExit tools haven't run yet.
192
+ let finalStep = resolveActiveStep(config, state);
193
+ if (activeStepId && finalStep?.id !== activeStepId) {
194
+ const previousStepDef = config.steps.find((candidate) => candidate.id === activeStepId);
195
+ const stillMissing = missingRequiredBeforeExitTools(previousStepDef?.tools, stepToolLog[activeStepId] ?? []);
196
+ if (stillMissing.length)
197
+ finalStep = previousStepDef;
198
+ }
199
+ step = finalStep;
200
+ await this.announceStepChange(flow, key, activeStepId, step?.id, taskId, runId);
201
+ requirements = evaluateRequirements(config, state);
202
+ const missingRequirementIds = requirements.filter((requirement) => !requirement.satisfied).map((requirement) => requirement.id);
203
+ const completedRequirementIds = requirements.filter((requirement) => requirement.satisfied).map((requirement) => requirement.id);
204
+ const stepRequiredMissing = missingRequiredTools(step?.tools, activeStepId ? stepToolLog[activeStepId] ?? [] : []);
205
+ const isComplete = requirements.every((requirement) => requirement.satisfied) && stepRequiredMissing.length === 0 && config.completion({ state, requirements });
206
+ let output;
207
+ let status;
208
+ let completedAt = record.completedAt;
209
+ if (isComplete) {
210
+ await this.options.hooks.fire("beforeFlowComplete", { flowId: flow.id, sessionId: key, state, context: { taskId, runId } });
211
+ const mapped = config.mapOutput({ state });
212
+ const validated = config.outputSchema.safeParse(mapped);
213
+ if (!validated.success) {
214
+ await publishFlowEvent(this.options.events, {
215
+ type: "flow.validation.failed",
216
+ flowId: flow.id,
217
+ sessionId: key,
218
+ taskId,
219
+ runId,
220
+ payload: { stage: "output", reason: validated.error.message }
221
+ });
222
+ await this.options.hooks.fire("onFlowError", { flowId: flow.id, sessionId: key, error: validated.error, context: { taskId, runId } });
223
+ throw new GuidedFlowOutputValidationError(`Guided flow "${flow.id}" satisfied completion() but mapOutput() failed outputSchema validation: ${validated.error.message}`, { flowId: flow.id, cause: validated.error });
224
+ }
225
+ output = validated.data;
226
+ status = "completed";
227
+ completedAt = now();
228
+ await this.options.hooks.fire("afterFlowComplete", { flowId: flow.id, sessionId: key, output, context: { taskId, runId } });
229
+ await publishFlowEvent(this.options.events, { type: "flow.completed", flowId: flow.id, sessionId: key, taskId, runId, payload: { output: output } });
230
+ }
231
+ else if (pendingApproval) {
232
+ status = "waiting_for_approval";
233
+ await publishFlowEvent(this.options.events, { type: "flow.waiting_for_approval", flowId: flow.id, sessionId: key, taskId, runId, payload: {} });
234
+ }
235
+ else if (native.rounds >= maxRounds && native.toolCalls.length > 0) {
236
+ status = "waiting_for_tool";
237
+ }
238
+ else {
239
+ status = "waiting_for_user";
240
+ await publishFlowEvent(this.options.events, { type: "flow.waiting_for_user", flowId: flow.id, sessionId: key, taskId, runId, payload: {} });
241
+ }
242
+ const updated = {
243
+ flowId: flow.id,
244
+ flowVersion: flow.version,
245
+ sessionId: key,
246
+ status,
247
+ ...(step ? { currentStepId: step.id } : {}),
248
+ state: state,
249
+ completedRequirementIds,
250
+ missingRequirementIds,
251
+ stepToolLog,
252
+ ...(record.startedAt ? { startedAt: record.startedAt } : {}),
253
+ updatedAt: now(),
254
+ ...(completedAt ? { completedAt } : {}),
255
+ ...(output !== undefined ? { output: output } : {})
256
+ };
257
+ await this.options.store.saveFlowState(updated);
258
+ return {
259
+ text: native.text,
260
+ ...(output !== undefined ? { output } : {}),
261
+ state: state,
262
+ flow: {
263
+ id: flow.id,
264
+ version: flow.version,
265
+ status,
266
+ ...(step ? { currentStepId: step.id } : {}),
267
+ completedRequirementIds,
268
+ missingRequirementIds,
269
+ ...(updated.startedAt ? { startedAt: updated.startedAt } : {}),
270
+ updatedAt: updated.updatedAt,
271
+ ...(completedAt ? { completedAt } : {})
272
+ }
273
+ };
274
+ }
275
+ async applyPatch(flow, key, taskId, runId, config, state, patch, previousRequirements) {
276
+ await this.options.hooks.fire("beforeFlowStatePatch", { flowId: flow.id, sessionId: key, patch, context: { taskId, runId } });
277
+ const applied = applyStatePatch(config, state, patch);
278
+ const confirmationResult = applyConfirmationReset(config, applied.state, applied.changedKeys);
279
+ const nextState = confirmationResult.state;
280
+ const changedKeys = confirmationResult.reset && config.confirmation ? [...applied.changedKeys, String(config.confirmation.stateField)] : applied.changedKeys;
281
+ if (changedKeys.length) {
282
+ await publishFlowEvent(this.options.events, {
283
+ type: "flow.state.updated",
284
+ flowId: flow.id,
285
+ sessionId: key,
286
+ taskId,
287
+ runId,
288
+ payload: { changedKeys, source: patch.source }
289
+ });
290
+ }
291
+ await this.options.hooks.fire("afterFlowStatePatch", { flowId: flow.id, sessionId: key, state: nextState, context: { taskId, runId } });
292
+ const requirements = evaluateRequirements(config, nextState);
293
+ const diff = diffRequirements(previousRequirements, requirements);
294
+ for (const id of diff.newlySatisfied) {
295
+ await publishFlowEvent(this.options.events, { type: "flow.requirement.satisfied", flowId: flow.id, sessionId: key, taskId, runId, payload: { requirementId: id } });
296
+ }
297
+ for (const id of diff.newlyInvalidated) {
298
+ await publishFlowEvent(this.options.events, { type: "flow.requirement.invalidated", flowId: flow.id, sessionId: key, taskId, runId, payload: { requirementId: id } });
299
+ }
300
+ return { state: nextState, requirements, step: resolveActiveStep(config, nextState) };
301
+ }
302
+ async announceStepChange(flow, key, previousStepId, nextStepId, taskId, runId) {
303
+ if (previousStepId === nextStepId)
304
+ return;
305
+ if (previousStepId) {
306
+ await this.options.hooks.fire("afterFlowStep", { flowId: flow.id, sessionId: key, stepId: previousStepId, context: { taskId, runId } });
307
+ await publishFlowEvent(this.options.events, { type: "flow.step.exited", flowId: flow.id, sessionId: key, stepId: previousStepId, taskId, runId, payload: {} });
308
+ }
309
+ if (nextStepId) {
310
+ await this.options.hooks.fire("beforeFlowStep", { flowId: flow.id, sessionId: key, stepId: nextStepId, context: { taskId, runId } });
311
+ await publishFlowEvent(this.options.events, { type: "flow.step.entered", flowId: flow.id, sessionId: key, stepId: nextStepId, taskId, runId, payload: {} });
312
+ }
313
+ }
314
+ forwardNativeEvent(flow, key, taskId, runId, event) {
315
+ if (event.type === "native.tool.started") {
316
+ void publishFlowEvent(this.options.events, { type: "flow.tool.requested", flowId: flow.id, sessionId: key, taskId, runId, payload: { toolId: event.toolId } });
317
+ }
318
+ if (event.type === "native.tool.completed") {
319
+ void publishFlowEvent(this.options.events, {
320
+ type: "flow.tool.completed",
321
+ flowId: flow.id,
322
+ sessionId: key,
323
+ taskId,
324
+ runId,
325
+ payload: { toolId: event.toolId, status: event.result.status }
326
+ });
327
+ }
328
+ }
329
+ async cancel(sessionId, flowId, tenant) {
330
+ const flow = flowId ? this.requireFlow(flowId) : this.soleFlow();
331
+ const key = this.key(tenant, sessionId);
332
+ const record = await this.options.store.getFlowState(key, flow.id);
333
+ if (!record)
334
+ return;
335
+ const now = new Date().toISOString();
336
+ await this.options.store.saveFlowState({ ...record, status: "cancelled", cancelledAt: now, updatedAt: now });
337
+ await publishFlowEvent(this.options.events, { type: "flow.cancelled", flowId: flow.id, sessionId: key, payload: {} });
338
+ }
339
+ async resume(sessionId, flowId, tenant) {
340
+ const flow = flowId ? this.requireFlow(flowId) : this.soleFlow();
341
+ const key = this.key(tenant, sessionId);
342
+ const record = await this.options.store.getFlowState(key, flow.id);
343
+ if (!record)
344
+ return undefined;
345
+ const updated = { ...record, status: record.status === "completed" ? record.status : "active", updatedAt: new Date().toISOString() };
346
+ await this.options.store.saveFlowState(updated);
347
+ await publishFlowEvent(this.options.events, { type: "flow.resumed", flowId: flow.id, sessionId: key, payload: {} });
348
+ return updated;
349
+ }
350
+ async reset(sessionId, flowId, tenant) {
351
+ const flow = flowId ? this.requireFlow(flowId) : this.soleFlow();
352
+ const key = this.key(tenant, sessionId);
353
+ const now = new Date().toISOString();
354
+ await this.options.store.saveFlowState({
355
+ flowId: flow.id,
356
+ flowVersion: flow.version,
357
+ sessionId: key,
358
+ status: "idle",
359
+ state: { ...flow.config.initialState },
360
+ completedRequirementIds: [],
361
+ missingRequirementIds: [],
362
+ stepToolLog: {},
363
+ startedAt: now,
364
+ updatedAt: now
365
+ });
366
+ }
367
+ async patchState(sessionId, flowId, patch, tenant) {
368
+ const flow = this.requireFlow(flowId);
369
+ const config = flow.config;
370
+ const key = this.key(tenant, sessionId);
371
+ const now = new Date().toISOString();
372
+ const record = (await this.options.store.getFlowState(key, flow.id)) ?? {
373
+ flowId: flow.id,
374
+ flowVersion: flow.version,
375
+ sessionId: key,
376
+ status: "active",
377
+ state: { ...config.initialState },
378
+ completedRequirementIds: [],
379
+ missingRequirementIds: [],
380
+ stepToolLog: {},
381
+ startedAt: now,
382
+ updatedAt: now
383
+ };
384
+ const taskId = randomUUID();
385
+ const runId = randomUUID();
386
+ const requirements = evaluateRequirements(config, record.state);
387
+ const step = resolveActiveStep(config, record.state);
388
+ const applied = await this.applyPatch(flow, key, taskId, runId, config, record.state, { ...patch, source: "system" }, requirements);
389
+ const updated = {
390
+ ...record,
391
+ state: applied.state,
392
+ ...(applied.step ? { currentStepId: applied.step.id } : {}),
393
+ completedRequirementIds: applied.requirements.filter((requirement) => requirement.satisfied).map((requirement) => requirement.id),
394
+ missingRequirementIds: applied.requirements.filter((requirement) => !requirement.satisfied).map((requirement) => requirement.id),
395
+ updatedAt: new Date().toISOString()
396
+ };
397
+ await this.options.store.saveFlowState(updated);
398
+ return updated;
399
+ }
400
+ async getState(sessionId, flowId, tenant) {
401
+ const flow = flowId ? this.requireFlow(flowId) : this.soleFlow();
402
+ const key = this.key(tenant, sessionId);
403
+ return this.options.store.getFlowState(key, flow.id);
404
+ }
405
+ }
406
+ function buildGuidedInstructions(config, step, state, skills) {
407
+ const known = Object.entries(state)
408
+ .filter(([, value]) => value !== undefined && value !== null && value !== "")
409
+ .map(([key, value]) => `${key}: ${JSON.stringify(value)}`);
410
+ const missing = missingCollectFields(step, state);
411
+ const stepSkills = (step?.skills ?? [])
412
+ .map((id) => skills.find((skill) => skill.id === id))
413
+ .filter((skill) => Boolean(skill));
414
+ const lines = [
415
+ `You are guiding the user through the "${config.name}" flow. Goal: ${config.goal}`,
416
+ known.length ? `Known so far: ${known.join(", ")}.` : "Nothing is known about the user yet.",
417
+ missing.length ? `Still missing: ${missing.join(", ")}. Ask only for what's missing — never re-ask for known fields.` : "",
418
+ step?.instructions ? `Current step instructions: ${step.instructions}` : "",
419
+ ...stepSkills.map((skill) => `Skill "${skill.id}": ${skill.instructions}`)
420
+ ];
421
+ return lines.filter(Boolean).join("\n");
422
+ }
423
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/guided-flows/runt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GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,KAAK,CAAC,EAAE,MAAM,KAAK,CAAC,YAAY,EAAE,CAAC;KAC3E,CAAC;IACF,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { z } from "zod";
2
+ import type { FlowPatchSource, FlowStatePatch, GuidedFlowConfig } from "./types.js";
3
+ export type ApplyPatchResult<TState> = {
4
+ state: TState;
5
+ changedKeys: string[];
6
+ droppedKeys: string[];
7
+ };
8
+ /**
9
+ * Applies a `FlowStatePatch` to `state`, enforcing two code-level invariants:
10
+ * - only fields declared on `stateSchema` are ever written (unknown keys dropped);
11
+ * - `protectedFields` may only be written by an allow-listed `FlowPatchSource`
12
+ * (e.g. a model-sourced patch can never set a tool-reserved field like `orderId`).
13
+ */
14
+ export declare function applyStatePatch<TStateSchema extends z.AnyZodObject, TOutputSchema extends z.ZodTypeAny>(config: GuidedFlowConfig<TStateSchema, TOutputSchema>, state: z.infer<TStateSchema>, patch: FlowStatePatch<z.infer<TStateSchema>>): ApplyPatchResult<z.infer<TStateSchema>>;
15
+ /**
16
+ * Code-enforced confirmation reset: if a `confirmation.resetOnChange` field
17
+ * actually changed this turn and the flow was previously confirmed, force
18
+ * `confirmed` back to `false`. Never relies on the model remembering to ask again.
19
+ */
20
+ export declare function applyConfirmationReset<TStateSchema extends z.AnyZodObject, TOutputSchema extends z.ZodTypeAny>(config: GuidedFlowConfig<TStateSchema, TOutputSchema>, state: z.infer<TStateSchema>, changedKeys: string[]): {
21
+ state: z.infer<TStateSchema>;
22
+ reset: boolean;
23
+ };
24
+ /**
25
+ * Builds the Zod schema the extraction sub-call must satisfy: a `.partial()` of
26
+ * `stateSchema` with any field whose `protectedFields` allow-list excludes
27
+ * `"model"` omitted entirely, so the model is never even prompted to guess it.
28
+ */
29
+ export declare function buildModelPatchSchema<TStateSchema extends z.AnyZodObject>(stateSchema: TStateSchema, protectedFields: Partial<Record<string, FlowPatchSource[]>> | undefined): z.ZodTypeAny;
30
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/guided-flows/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEpF,MAAM,MAAM,gBAAgB,CAAC,MAAM,IAAI;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,YAAY,SAAS,CAAC,CAAC,YAAY,EAAE,aAAa,SAAS,CAAC,CAAC,UAAU,EACrG,MAAM,EAAE,gBAAgB,CAAC,YAAY,EAAE,aAAa,CAAC,EACrD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,EAC5B,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,GAC3C,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CA8CzC;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,SAAS,CAAC,CAAC,YAAY,EAAE,aAAa,SAAS,CAAC,CAAC,UAAU,EAC5G,MAAM,EAAE,gBAAgB,CAAC,YAAY,EAAE,aAAa,CAAC,EACrD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,EAC5B,WAAW,EAAE,MAAM,EAAE,GACpB;IAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAWlD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,SAAS,CAAC,CAAC,YAAY,EACvE,WAAW,EAAE,YAAY,EACzB,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC,GAAG,SAAS,GACtE,CAAC,CAAC,UAAU,CAOd"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Applies a `FlowStatePatch` to `state`, enforcing two code-level invariants:
3
+ * - only fields declared on `stateSchema` are ever written (unknown keys dropped);
4
+ * - `protectedFields` may only be written by an allow-listed `FlowPatchSource`
5
+ * (e.g. a model-sourced patch can never set a tool-reserved field like `orderId`).
6
+ */
7
+ export function applyStatePatch(config, state, patch) {
8
+ const protectedFields = (config.protectedFields ?? {});
9
+ const next = { ...state };
10
+ const changedKeys = [];
11
+ const droppedKeys = [];
12
+ if (patch.set) {
13
+ const shape = config.stateSchema.shape;
14
+ const setValues = patch.set;
15
+ for (const key of Object.keys(setValues)) {
16
+ const fieldSchema = shape[key];
17
+ if (!fieldSchema) {
18
+ droppedKeys.push(key);
19
+ continue;
20
+ }
21
+ const allowedSources = protectedFields[key];
22
+ if (allowedSources && !allowedSources.includes(patch.source)) {
23
+ droppedKeys.push(key);
24
+ continue;
25
+ }
26
+ const parsed = fieldSchema.safeParse(setValues[key]);
27
+ if (!parsed.success) {
28
+ droppedKeys.push(key);
29
+ continue;
30
+ }
31
+ if (next[key] !== parsed.data)
32
+ changedKeys.push(key);
33
+ next[key] = parsed.data;
34
+ }
35
+ }
36
+ if (patch.unset) {
37
+ for (const rawKey of patch.unset) {
38
+ const key = String(rawKey);
39
+ const allowedSources = protectedFields[key];
40
+ if (allowedSources && !allowedSources.includes(patch.source)) {
41
+ droppedKeys.push(key);
42
+ continue;
43
+ }
44
+ if (key in next) {
45
+ changedKeys.push(key);
46
+ delete next[key];
47
+ }
48
+ }
49
+ }
50
+ return { state: next, changedKeys, droppedKeys };
51
+ }
52
+ /**
53
+ * Code-enforced confirmation reset: if a `confirmation.resetOnChange` field
54
+ * actually changed this turn and the flow was previously confirmed, force
55
+ * `confirmed` back to `false`. Never relies on the model remembering to ask again.
56
+ */
57
+ export function applyConfirmationReset(config, state, changedKeys) {
58
+ const confirmation = config.confirmation;
59
+ const resetOnChange = confirmation?.resetOnChange;
60
+ if (!confirmation || !resetOnChange || !resetOnChange.length)
61
+ return { state, reset: false };
62
+ const touchedMaterialField = resetOnChange.some((field) => changedKeys.includes(String(field)));
63
+ const stateField = String(confirmation.stateField);
64
+ const currentlyConfirmed = Boolean(state[stateField]);
65
+ if (touchedMaterialField && currentlyConfirmed) {
66
+ return { state: { ...state, [stateField]: false }, reset: true };
67
+ }
68
+ return { state, reset: false };
69
+ }
70
+ /**
71
+ * Builds the Zod schema the extraction sub-call must satisfy: a `.partial()` of
72
+ * `stateSchema` with any field whose `protectedFields` allow-list excludes
73
+ * `"model"` omitted entirely, so the model is never even prompted to guess it.
74
+ */
75
+ export function buildModelPatchSchema(stateSchema, protectedFields) {
76
+ const omit = {};
77
+ for (const [key, sources] of Object.entries(protectedFields ?? {})) {
78
+ if (sources && !sources.includes("model"))
79
+ omit[key] = true;
80
+ }
81
+ const partial = stateSchema.partial();
82
+ return Object.keys(omit).length ? partial.omit(omit) : partial;
83
+ }
84
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/guided-flows/state.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAqD,EACrD,KAA4B,EAC5B,KAA4C;IAE5C,MAAM,eAAe,GAAG,CAAC,MAAM,CAAC,eAAe,IAAI,EAAE,CAAkD,CAAC;IACxG,MAAM,IAAI,GAA4B,EAAE,GAAI,KAAiC,EAAE,CAAC;IAChF,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,IAAI,KAAK,CAAC,GAAG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jC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,WAAyB,EACzB,eAAuE;IAEvE,MAAM,IAAI,GAAyB,EAAE,CAAC;IACtC,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,IAAI,EAAE,CAAC,EAAE,CAAC;QACnE,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAC9D,CAAC;IACD,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,EAAE,CAAC;IACtC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AACjE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { z } from "zod";
2
+ import type { GuidedFlowConfig, GuidedFlowStep } from "./types.js";
3
+ /**
4
+ * Resolves the active step for the current `state`: the first step (in
5
+ * declared order) whose `when` predicate passes (branches that don't apply
6
+ * are skipped, never entered) and that isn't already satisfied. This is a
7
+ * pure function of `state`, never a model decision.
8
+ */
9
+ export declare function resolveActiveStep<TStateSchema extends z.AnyZodObject, TOutputSchema extends z.ZodTypeAny>(config: GuidedFlowConfig<TStateSchema, TOutputSchema>, state: z.infer<TStateSchema>): GuidedFlowStep<z.infer<TStateSchema>> | undefined;
10
+ export declare function isStepSatisfied<TState>(step: GuidedFlowStep<TState>, state: TState): boolean;
11
+ export declare function missingCollectFields<TState>(step: GuidedFlowStep<TState> | undefined, state: TState): string[];
12
+ //# sourceMappingURL=steps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../src/guided-flows/steps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEnE;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,SAAS,CAAC,CAAC,YAAY,EAAE,aAAa,SAAS,CAAC,CAAC,UAAU,EACvG,MAAM,EAAE,gBAAgB,CAAC,YAAY,EAAE,aAAa,CAAC,EACrD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,GAC3B,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,GAAG,SAAS,CAOnD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAO5F;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAQ9G"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Resolves the active step for the current `state`: the first step (in
3
+ * declared order) whose `when` predicate passes (branches that don't apply
4
+ * are skipped, never entered) and that isn't already satisfied. This is a
5
+ * pure function of `state`, never a model decision.
6
+ */
7
+ export function resolveActiveStep(config, state) {
8
+ for (const step of config.steps) {
9
+ if (step.when && !step.when({ state }))
10
+ continue;
11
+ if (isStepSatisfied(step, state))
12
+ continue;
13
+ return step;
14
+ }
15
+ return undefined;
16
+ }
17
+ export function isStepSatisfied(step, state) {
18
+ if (step.exit)
19
+ return Boolean(step.exit({ state }));
20
+ if (!step.collect || step.collect.length === 0)
21
+ return false;
22
+ return step.collect.every((field) => {
23
+ const value = state[String(field)];
24
+ return value !== undefined && value !== null && value !== "";
25
+ });
26
+ }
27
+ export function missingCollectFields(step, state) {
28
+ if (!step?.collect)
29
+ return [];
30
+ return step.collect
31
+ .map(String)
32
+ .filter((field) => {
33
+ const value = state[field];
34
+ return value === undefined || value === null || value === "";
35
+ });
36
+ }
37
+ //# sourceMappingURL=steps.js.map