@warlock.js/ai 4.1.7 → 4.1.9
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/cjs/index.cjs +86 -86
- package/esm/agent/agent-config.type.d.mts +1 -1
- package/esm/agent/agent-input-builder.mjs +1 -1
- package/esm/agent/agent-log-event.mjs +1 -1
- package/esm/agent/agent-stream.d.mts +1 -1
- package/esm/agent/agent-stream.mjs +1 -1
- package/esm/agent/agent-to-stream-event.mjs +1 -1
- package/esm/agent/agent.d.mts +1 -1
- package/esm/agent/agent.mjs +1 -1
- package/esm/agent/json-stream-guard.mjs +1 -1
- package/esm/ai.d.mts +1 -1
- package/esm/ai.mjs +1 -1
- package/esm/config.d.mts +1 -1
- package/esm/config.mjs +1 -1
- package/esm/contracts/agent/agent-options.type.d.mts +1 -1
- package/esm/contracts/agent/agent.contract.d.mts +1 -1
- package/esm/contracts/attachment.type.d.mts +1 -1
- package/esm/contracts/content-part.type.d.mts +1 -1
- package/esm/contracts/conversation-message.type.d.mts +1 -1
- package/esm/contracts/embedder.contract.d.mts +1 -1
- package/esm/contracts/end.type.d.mts +1 -1
- package/esm/contracts/end.type.mjs +1 -1
- package/esm/contracts/events/agent-events.type.d.mts +1 -1
- package/esm/contracts/events/complete-event.type.d.mts +1 -1
- package/esm/contracts/events/event-identity.type.d.mts +1 -1
- package/esm/contracts/events/event-map.type.d.mts +1 -1
- package/esm/contracts/events/supervisor-events.type.d.mts +1 -1
- package/esm/contracts/events/usage-event.type.d.mts +1 -1
- package/esm/contracts/events/workflow-events.type.d.mts +1 -1
- package/esm/contracts/executable.contract.d.mts +1 -1
- package/esm/contracts/finish-reason.type.d.mts +1 -1
- package/esm/contracts/middleware/middleware-context.type.d.mts +1 -1
- package/esm/contracts/middleware/middleware-state.type.d.mts +1 -1
- package/esm/contracts/middleware/middleware.contract.d.mts +1 -1
- package/esm/contracts/model-tool-call-request.type.d.mts +1 -1
- package/esm/contracts/model.contract.d.mts +1 -1
- package/esm/contracts/placeholders.type.d.mts +1 -1
- package/esm/contracts/result/agent-result.type.d.mts +1 -1
- package/esm/contracts/result/attempt-entry.type.d.mts +1 -1
- package/esm/contracts/result/base-report.type.d.mts +1 -1
- package/esm/contracts/result/base-report.type.mjs +1 -1
- package/esm/contracts/result/base-result.type.d.mts +1 -1
- package/esm/contracts/result/execute-result.type.d.mts +1 -1
- package/esm/contracts/result/execution-report.type.d.mts +1 -1
- package/esm/contracts/result/llm-trip.type.d.mts +1 -1
- package/esm/contracts/result/model-pricing.type.d.mts +1 -1
- package/esm/contracts/result/session-send-result.type.d.mts +1 -1
- package/esm/contracts/result/step-result.type.d.mts +1 -1
- package/esm/contracts/result/supervisor-result.type.d.mts +1 -1
- package/esm/contracts/result/tool-call.type.d.mts +1 -1
- package/esm/contracts/result/usage.type.d.mts +1 -1
- package/esm/contracts/result/workflow-result.type.d.mts +1 -1
- package/esm/contracts/sdk-adapter.contract.d.mts +1 -1
- package/esm/contracts/stream/stream-event.type.d.mts +1 -1
- package/esm/contracts/stream/stream.contract.d.mts +1 -1
- package/esm/contracts/streaming-tool-guard-config.type.d.mts +1 -1
- package/esm/contracts/supervisor/ack-entry.type.d.mts +1 -1
- package/esm/contracts/supervisor/classifier-context.type.d.mts +1 -1
- package/esm/contracts/supervisor/dispatch-context.type.d.mts +1 -1
- package/esm/contracts/supervisor/evaluate-context.type.d.mts +1 -1
- package/esm/contracts/supervisor/intent-entry.type.d.mts +1 -1
- package/esm/contracts/supervisor/iteration-snapshot.type.d.mts +1 -1
- package/esm/contracts/supervisor/next.type.d.mts +1 -1
- package/esm/contracts/supervisor/route-context.type.d.mts +1 -1
- package/esm/contracts/supervisor/router-entry.type.d.mts +1 -1
- package/esm/contracts/supervisor/supervisor-config.type.d.mts +1 -1
- package/esm/contracts/supervisor/supervisor-execute-options.type.d.mts +1 -1
- package/esm/contracts/supervisor/supervisor-input.type.d.mts +1 -1
- package/esm/contracts/supervisor/supervisor-snapshot.type.d.mts +1 -1
- package/esm/contracts/supervisor/supervisor-stream-event.type.d.mts +1 -1
- package/esm/contracts/supervisor/supervisor.contract.d.mts +1 -1
- package/esm/contracts/system-prompt.contract.d.mts +1 -1
- package/esm/contracts/tool.contract.d.mts +1 -1
- package/esm/contracts/workflow/next-step-result.type.d.mts +1 -1
- package/esm/contracts/workflow/retry-config.type.d.mts +1 -1
- package/esm/contracts/workflow/step.contract.d.mts +1 -1
- package/esm/contracts/workflow/workflow-context.type.d.mts +1 -1
- package/esm/contracts/workflow/workflow-snapshot.type.d.mts +1 -1
- package/esm/contracts/workflow/workflow.contract.d.mts +1 -1
- package/esm/errors/agent-cancelled-error.d.mts +1 -1
- package/esm/errors/agent-cancelled-error.mjs +1 -1
- package/esm/errors/agent-execution-error.d.mts +1 -1
- package/esm/errors/agent-execution-error.mjs +1 -1
- package/esm/errors/agent-max-trips-error.d.mts +1 -1
- package/esm/errors/agent-max-trips-error.mjs +1 -1
- package/esm/errors/ai-error.d.mts +1 -1
- package/esm/errors/ai-error.mjs +1 -1
- package/esm/errors/budget-exceeded-error.d.mts +1 -1
- package/esm/errors/budget-exceeded-error.mjs +1 -1
- package/esm/errors/content-filter-error.d.mts +1 -1
- package/esm/errors/content-filter-error.mjs +1 -1
- package/esm/errors/context-length-exceeded-error.d.mts +1 -1
- package/esm/errors/context-length-exceeded-error.mjs +1 -1
- package/esm/errors/error-category.type.d.mts +1 -1
- package/esm/errors/error-code.type.d.mts +1 -1
- package/esm/errors/guardrail-violation-error.d.mts +1 -1
- package/esm/errors/guardrail-violation-error.mjs +1 -1
- package/esm/errors/invalid-request-error.d.mts +1 -1
- package/esm/errors/invalid-request-error.mjs +1 -1
- package/esm/errors/max-iterations-error.d.mts +1 -1
- package/esm/errors/max-iterations-error.mjs +1 -1
- package/esm/errors/max-steps-exceeded-error.d.mts +1 -1
- package/esm/errors/max-steps-exceeded-error.mjs +1 -1
- package/esm/errors/provider-auth-error.d.mts +1 -1
- package/esm/errors/provider-auth-error.mjs +1 -1
- package/esm/errors/provider-error.d.mts +1 -1
- package/esm/errors/provider-error.mjs +1 -1
- package/esm/errors/provider-rate-limit-error.d.mts +1 -1
- package/esm/errors/provider-rate-limit-error.mjs +1 -1
- package/esm/errors/provider-timeout-error.d.mts +1 -1
- package/esm/errors/provider-timeout-error.mjs +1 -1
- package/esm/errors/quota-exceeded-error.d.mts +1 -1
- package/esm/errors/quota-exceeded-error.mjs +1 -1
- package/esm/errors/routing-error.d.mts +1 -1
- package/esm/errors/routing-error.mjs +1 -1
- package/esm/errors/schema-validation-error.d.mts +1 -1
- package/esm/errors/schema-validation-error.mjs +1 -1
- package/esm/errors/step-failed-error.d.mts +1 -1
- package/esm/errors/step-failed-error.mjs +1 -1
- package/esm/errors/supervisor-cancelled-error.d.mts +1 -1
- package/esm/errors/supervisor-cancelled-error.mjs +1 -1
- package/esm/errors/supervisor-drift-error.d.mts +1 -1
- package/esm/errors/supervisor-drift-error.mjs +1 -1
- package/esm/errors/supervisor-failed-error.d.mts +1 -1
- package/esm/errors/supervisor-failed-error.mjs +1 -1
- package/esm/errors/supervisor-routing-error.d.mts +1 -1
- package/esm/errors/supervisor-routing-error.mjs +1 -1
- package/esm/errors/tool-execution-error.d.mts +1 -1
- package/esm/errors/tool-execution-error.mjs +1 -1
- package/esm/errors/workflow-cancelled-error.d.mts +1 -1
- package/esm/errors/workflow-cancelled-error.mjs +1 -1
- package/esm/errors/workflow-drift-error.d.mts +1 -1
- package/esm/errors/workflow-drift-error.mjs +1 -1
- package/esm/errors/workflow-error.d.mts +1 -1
- package/esm/errors/workflow-error.mjs +1 -1
- package/esm/middleware/builtins/budget.d.mts +1 -1
- package/esm/middleware/builtins/budget.mjs +1 -1
- package/esm/middleware/builtins/guardrail.d.mts +1 -1
- package/esm/middleware/builtins/guardrail.mjs +1 -1
- package/esm/middleware/builtins/semantic-cache.d.mts +1 -1
- package/esm/middleware/builtins/semantic-cache.mjs +1 -1
- package/esm/middleware/helpers/compose.d.mts +1 -1
- package/esm/middleware/helpers/compose.mjs +1 -1
- package/esm/middleware/helpers/for-tool.d.mts +1 -1
- package/esm/middleware/helpers/for-tool.mjs +1 -1
- package/esm/middleware/pipeline.d.mts +1 -1
- package/esm/middleware/pipeline.mjs +1 -1
- package/esm/middleware/utils/extract-user-text.d.mts +1 -1
- package/esm/middleware/utils/extract-user-text.mjs +1 -1
- package/esm/middleware/utils/namespaced-state.d.mts +1 -1
- package/esm/middleware/utils/namespaced-state.mjs +1 -1
- package/esm/mock/mock-agent.d.mts +1 -1
- package/esm/mock/mock-agent.mjs +1 -1
- package/esm/mock/mock-config.type.d.mts +1 -1
- package/esm/mock/mock-model.d.mts +1 -1
- package/esm/mock/mock-model.mjs +1 -1
- package/esm/mock/mock-sdk.d.mts +1 -1
- package/esm/mock/mock-sdk.mjs +1 -1
- package/esm/supervisor/as-tool.d.mts +1 -1
- package/esm/supervisor/as-tool.mjs +1 -1
- package/esm/supervisor/cancellation.d.mts +1 -1
- package/esm/supervisor/cancellation.mjs +1 -1
- package/esm/supervisor/decide.mjs +1 -1
- package/esm/supervisor/emitter.d.mts +1 -1
- package/esm/supervisor/emitter.mjs +1 -1
- package/esm/supervisor/entries.d.mts +1 -1
- package/esm/supervisor/entries.mjs +1 -1
- package/esm/supervisor/execution.d.mts +1 -1
- package/esm/supervisor/execution.mjs +1 -1
- package/esm/supervisor/router-prompt.d.mts +1 -1
- package/esm/supervisor/router-prompt.mjs +1 -1
- package/esm/supervisor/signature.d.mts +1 -1
- package/esm/supervisor/signature.mjs +1 -1
- package/esm/supervisor/snapshot.d.mts +1 -1
- package/esm/supervisor/snapshot.mjs +1 -1
- package/esm/supervisor/supervisor-stream.d.mts +1 -1
- package/esm/supervisor/supervisor-stream.mjs +1 -1
- package/esm/supervisor/supervisor.d.mts +1 -1
- package/esm/supervisor/supervisor.mjs +1 -1
- package/esm/system-prompt/instruction.d.mts +1 -1
- package/esm/system-prompt/instruction.mjs +1 -1
- package/esm/system-prompt/persona.d.mts +1 -1
- package/esm/system-prompt/persona.mjs +1 -1
- package/esm/system-prompt/render-placeholders.d.mts +1 -1
- package/esm/system-prompt/render-placeholders.mjs +1 -1
- package/esm/system-prompt/system-prompt.d.mts +1 -1
- package/esm/system-prompt/system-prompt.mjs +1 -1
- package/esm/tool/tool.d.mts +1 -1
- package/esm/tool/tool.mjs +1 -1
- package/esm/utils/compute-cost.d.mts +1 -1
- package/esm/utils/compute-cost.mjs +1 -1
- package/esm/utils/extract-json-payload.d.mts +1 -1
- package/esm/utils/extract-json-payload.mjs +1 -1
- package/esm/utils/generate-run-id.d.mts +1 -1
- package/esm/utils/generate-run-id.mjs +1 -1
- package/esm/utils/json-schema.d.mts +1 -1
- package/esm/utils/json-schema.mjs +1 -1
- package/esm/utils/prepare-attachment-part.d.mts +1 -1
- package/esm/utils/prepare-attachment-part.mjs +1 -1
- package/esm/utils/resolve-attachment.d.mts +1 -1
- package/esm/utils/resolve-attachment.mjs +1 -1
- package/esm/utils/safe-json-parse.d.mts +1 -1
- package/esm/utils/safe-json-parse.mjs +1 -1
- package/esm/utils/stamp-report-lineage.d.mts +1 -1
- package/esm/utils/stamp-report-lineage.mjs +1 -1
- package/esm/utils/token-count.d.mts +1 -1
- package/esm/utils/token-count.mjs +1 -1
- package/esm/workflow/as-tool.mjs +1 -1
- package/esm/workflow/cancellation.mjs +1 -1
- package/esm/workflow/emitter.mjs +1 -1
- package/esm/workflow/engine.mjs +1 -1
- package/esm/workflow/retry.mjs +1 -1
- package/esm/workflow/router.mjs +1 -1
- package/esm/workflow/run-scoped-emitter.mjs +1 -1
- package/esm/workflow/signature.d.mts +1 -1
- package/esm/workflow/signature.mjs +1 -1
- package/esm/workflow/snapshot.mjs +1 -1
- package/esm/workflow/state.mjs +1 -1
- package/esm/workflow/step-runner.mjs +1 -1
- package/esm/workflow/step.d.mts +1 -1
- package/esm/workflow/step.mjs +1 -1
- package/esm/workflow/workflow.d.mts +1 -1
- package/esm/workflow/workflow.mjs +1 -1
- package/package.json +3 -3
package/cjs/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@ let _warlock_js_logger = require("@warlock.js/logger");
|
|
|
3
3
|
let node_fs_promises = require("node:fs/promises");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
|
|
6
|
-
//#region
|
|
6
|
+
//#region ../@warlock.js/ai/src/errors/ai-error.ts
|
|
7
7
|
/**
|
|
8
8
|
* Base class for every error thrown (or surfaced via `result.error`) by
|
|
9
9
|
* `@warlock.js/ai` and its provider adapter packages.
|
|
@@ -69,7 +69,7 @@ var AIError = class extends Error {
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
//#endregion
|
|
72
|
-
//#region
|
|
72
|
+
//#region ../@warlock.js/ai/src/errors/agent-execution-error.ts
|
|
73
73
|
/**
|
|
74
74
|
* Base for agent runtime failures that aren't schema / tool / provider
|
|
75
75
|
* problems — runtime-structural issues inside the trip loop or
|
|
@@ -100,7 +100,7 @@ var AgentExecutionError = class extends AIError {
|
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
//#endregion
|
|
103
|
-
//#region
|
|
103
|
+
//#region ../@warlock.js/ai/src/errors/agent-cancelled-error.ts
|
|
104
104
|
/**
|
|
105
105
|
* Agent run was cancelled via `AbortSignal` before it could finish.
|
|
106
106
|
* Between-trip cancellation is guaranteed; mid-trip cancellation is
|
|
@@ -139,7 +139,7 @@ var AgentCancelledError = class extends AgentExecutionError {
|
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
//#endregion
|
|
142
|
-
//#region
|
|
142
|
+
//#region ../@warlock.js/ai/src/errors/agent-max-trips-error.ts
|
|
143
143
|
/**
|
|
144
144
|
* Runaway-loop hard guard: the agent's trip loop ran `maxTrips` round
|
|
145
145
|
* trips to the model without the model issuing a natural stop. The
|
|
@@ -176,7 +176,7 @@ var AgentMaxTripsError = class extends AgentExecutionError {
|
|
|
176
176
|
};
|
|
177
177
|
|
|
178
178
|
//#endregion
|
|
179
|
-
//#region
|
|
179
|
+
//#region ../@warlock.js/ai/src/errors/budget-exceeded-error.ts
|
|
180
180
|
/**
|
|
181
181
|
* A user- or framework-configured budget was exceeded mid-execution.
|
|
182
182
|
*
|
|
@@ -203,7 +203,7 @@ var BudgetExceededError = class extends AIError {
|
|
|
203
203
|
};
|
|
204
204
|
|
|
205
205
|
//#endregion
|
|
206
|
-
//#region
|
|
206
|
+
//#region ../@warlock.js/ai/src/errors/provider-error.ts
|
|
207
207
|
/**
|
|
208
208
|
* Any failure that originated from the model provider (OpenAI, Azure,
|
|
209
209
|
* OpenRouter, local gateway). Base class for the provider subclasses
|
|
@@ -241,7 +241,7 @@ var ProviderError = class extends AIError {
|
|
|
241
241
|
};
|
|
242
242
|
|
|
243
243
|
//#endregion
|
|
244
|
-
//#region
|
|
244
|
+
//#region ../@warlock.js/ai/src/errors/content-filter-error.ts
|
|
245
245
|
/**
|
|
246
246
|
* Response (or request) was blocked by the provider's safety filter.
|
|
247
247
|
* Not retryable with the same input — reshape the prompt or lean on
|
|
@@ -265,7 +265,7 @@ var ContentFilterError = class extends ProviderError {
|
|
|
265
265
|
};
|
|
266
266
|
|
|
267
267
|
//#endregion
|
|
268
|
-
//#region
|
|
268
|
+
//#region ../@warlock.js/ai/src/errors/context-length-exceeded-error.ts
|
|
269
269
|
/**
|
|
270
270
|
* The request's prompt (messages + tools + schema) exceeded the
|
|
271
271
|
* model's context window. Not retryable without shortening the input.
|
|
@@ -292,7 +292,7 @@ var ContextLengthExceededError = class extends ProviderError {
|
|
|
292
292
|
};
|
|
293
293
|
|
|
294
294
|
//#endregion
|
|
295
|
-
//#region
|
|
295
|
+
//#region ../@warlock.js/ai/src/errors/guardrail-violation-error.ts
|
|
296
296
|
/**
|
|
297
297
|
* A guardrail middleware rejected the prompt or response mid-execution.
|
|
298
298
|
*
|
|
@@ -329,7 +329,7 @@ var GuardrailViolationError = class extends AIError {
|
|
|
329
329
|
};
|
|
330
330
|
|
|
331
331
|
//#endregion
|
|
332
|
-
//#region
|
|
332
|
+
//#region ../@warlock.js/ai/src/errors/invalid-request-error.ts
|
|
333
333
|
/**
|
|
334
334
|
* Provider rejected the request as malformed — bad model name,
|
|
335
335
|
* unsupported feature, missing required field, image attached to a
|
|
@@ -356,7 +356,7 @@ var InvalidRequestError = class extends ProviderError {
|
|
|
356
356
|
};
|
|
357
357
|
|
|
358
358
|
//#endregion
|
|
359
|
-
//#region
|
|
359
|
+
//#region ../@warlock.js/ai/src/errors/supervisor-failed-error.ts
|
|
360
360
|
/**
|
|
361
361
|
* Base class for every supervisor-specific failure surfaced from
|
|
362
362
|
* `supervisor.execute()` / `supervisor.resume()` / authoring-time
|
|
@@ -395,7 +395,7 @@ var SupervisorFailedError = class extends AIError {
|
|
|
395
395
|
};
|
|
396
396
|
|
|
397
397
|
//#endregion
|
|
398
|
-
//#region
|
|
398
|
+
//#region ../@warlock.js/ai/src/errors/max-iterations-error.ts
|
|
399
399
|
/**
|
|
400
400
|
* Hard-cap guard: the supervisor ran `maxIterations` loop turns
|
|
401
401
|
* without reaching a terminal decision (`END`, `satisfied: true`, or
|
|
@@ -423,7 +423,7 @@ var MaxIterationsError = class extends SupervisorFailedError {
|
|
|
423
423
|
};
|
|
424
424
|
|
|
425
425
|
//#endregion
|
|
426
|
-
//#region
|
|
426
|
+
//#region ../@warlock.js/ai/src/errors/workflow-error.ts
|
|
427
427
|
/**
|
|
428
428
|
* Base class for all workflow-specific failures. Subclasses carry
|
|
429
429
|
* precise codes; this base catches everything `workflow.execute()`
|
|
@@ -437,7 +437,7 @@ var WorkflowError = class extends AIError {
|
|
|
437
437
|
};
|
|
438
438
|
|
|
439
439
|
//#endregion
|
|
440
|
-
//#region
|
|
440
|
+
//#region ../@warlock.js/ai/src/errors/max-steps-exceeded-error.ts
|
|
441
441
|
/**
|
|
442
442
|
* Runaway-loop hard guard: workflow executed more step transitions
|
|
443
443
|
* than `maxSteps` allows. Terminates the workflow immediately.
|
|
@@ -454,7 +454,7 @@ var MaxStepsExceededError = class extends WorkflowError {
|
|
|
454
454
|
};
|
|
455
455
|
|
|
456
456
|
//#endregion
|
|
457
|
-
//#region
|
|
457
|
+
//#region ../@warlock.js/ai/src/errors/provider-auth-error.ts
|
|
458
458
|
/**
|
|
459
459
|
* Provider rejected the credential — missing / invalid / expired API
|
|
460
460
|
* key or insufficient permissions on the underlying account. Not
|
|
@@ -476,7 +476,7 @@ var ProviderAuthError = class extends ProviderError {
|
|
|
476
476
|
};
|
|
477
477
|
|
|
478
478
|
//#endregion
|
|
479
|
-
//#region
|
|
479
|
+
//#region ../@warlock.js/ai/src/errors/provider-rate-limit-error.ts
|
|
480
480
|
/**
|
|
481
481
|
* Provider refused the call because the account (or key, or window)
|
|
482
482
|
* is over its rate-limit or quota. Retryable after `retryAfter`
|
|
@@ -503,7 +503,7 @@ var ProviderRateLimitError = class extends ProviderError {
|
|
|
503
503
|
};
|
|
504
504
|
|
|
505
505
|
//#endregion
|
|
506
|
-
//#region
|
|
506
|
+
//#region ../@warlock.js/ai/src/errors/provider-timeout-error.ts
|
|
507
507
|
/**
|
|
508
508
|
* Provider call timed out — either at the transport layer (socket
|
|
509
509
|
* connection) or on the server side (request exceeded the provider's
|
|
@@ -525,7 +525,7 @@ var ProviderTimeoutError = class extends ProviderError {
|
|
|
525
525
|
};
|
|
526
526
|
|
|
527
527
|
//#endregion
|
|
528
|
-
//#region
|
|
528
|
+
//#region ../@warlock.js/ai/src/errors/quota-exceeded-error.ts
|
|
529
529
|
/**
|
|
530
530
|
* Provider refused the call because the account has exhausted its
|
|
531
531
|
* paid quota (monthly credit, billing cap, subscription tier limit).
|
|
@@ -561,7 +561,7 @@ var QuotaExceededError = class extends ProviderError {
|
|
|
561
561
|
};
|
|
562
562
|
|
|
563
563
|
//#endregion
|
|
564
|
-
//#region
|
|
564
|
+
//#region ../@warlock.js/ai/src/errors/routing-error.ts
|
|
565
565
|
/**
|
|
566
566
|
* `nextStep` returned an invalid `goto`, or the `nextStep` callback
|
|
567
567
|
* itself threw. Routing is authoritative and has no recovery path —
|
|
@@ -580,7 +580,7 @@ var RoutingError = class extends WorkflowError {
|
|
|
580
580
|
};
|
|
581
581
|
|
|
582
582
|
//#endregion
|
|
583
|
-
//#region
|
|
583
|
+
//#region ../@warlock.js/ai/src/errors/schema-validation-error.ts
|
|
584
584
|
/**
|
|
585
585
|
* A `StandardSchemaV1` validation call returned issues, or the input
|
|
586
586
|
* was not valid JSON before validation could even run.
|
|
@@ -613,7 +613,7 @@ var SchemaValidationError = class extends AIError {
|
|
|
613
613
|
};
|
|
614
614
|
|
|
615
615
|
//#endregion
|
|
616
|
-
//#region
|
|
616
|
+
//#region ../@warlock.js/ai/src/errors/step-failed-error.ts
|
|
617
617
|
/**
|
|
618
618
|
* A workflow step exhausted its retries (or was not retried) and
|
|
619
619
|
* terminated with an error. `cause` carries the last underlying error.
|
|
@@ -628,7 +628,7 @@ var StepFailedError = class extends WorkflowError {
|
|
|
628
628
|
};
|
|
629
629
|
|
|
630
630
|
//#endregion
|
|
631
|
-
//#region
|
|
631
|
+
//#region ../@warlock.js/ai/src/errors/supervisor-cancelled-error.ts
|
|
632
632
|
/**
|
|
633
633
|
* Supervisor run was cancelled via `AbortSignal` before it could
|
|
634
634
|
* finish. Between-iteration cancellation is guaranteed; mid-iteration
|
|
@@ -653,7 +653,7 @@ var SupervisorCancelledError = class extends SupervisorFailedError {
|
|
|
653
653
|
};
|
|
654
654
|
|
|
655
655
|
//#endregion
|
|
656
|
-
//#region
|
|
656
|
+
//#region ../@warlock.js/ai/src/errors/supervisor-drift-error.ts
|
|
657
657
|
/**
|
|
658
658
|
* `supervisor.resume(runId)` loaded a snapshot whose structural
|
|
659
659
|
* fingerprint does not match the current supervisor definition
|
|
@@ -679,7 +679,7 @@ var SupervisorDriftError = class extends SupervisorFailedError {
|
|
|
679
679
|
};
|
|
680
680
|
|
|
681
681
|
//#endregion
|
|
682
|
-
//#region
|
|
682
|
+
//#region ../@warlock.js/ai/src/errors/supervisor-routing-error.ts
|
|
683
683
|
/**
|
|
684
684
|
* A `route` callback or router agent returned a value that doesn't
|
|
685
685
|
* resolve to a configured agent key, a `string[]` of configured keys,
|
|
@@ -714,7 +714,7 @@ var SupervisorRoutingError = class extends SupervisorFailedError {
|
|
|
714
714
|
};
|
|
715
715
|
|
|
716
716
|
//#endregion
|
|
717
|
-
//#region
|
|
717
|
+
//#region ../@warlock.js/ai/src/errors/tool-execution-error.ts
|
|
718
718
|
/**
|
|
719
719
|
* A registered tool's `execute()` threw during dispatch — the tool
|
|
720
720
|
* code itself failed (not its input schema). The model's request was
|
|
@@ -742,7 +742,7 @@ var ToolExecutionError = class extends AIError {
|
|
|
742
742
|
};
|
|
743
743
|
|
|
744
744
|
//#endregion
|
|
745
|
-
//#region
|
|
745
|
+
//#region ../@warlock.js/ai/src/errors/workflow-cancelled-error.ts
|
|
746
746
|
/**
|
|
747
747
|
* Workflow was cancelled via `AbortSignal` before it could finish.
|
|
748
748
|
* `cancelledAt` is ISO timestamp at abort; `reason` carries the
|
|
@@ -761,7 +761,7 @@ var WorkflowCancelledError = class extends WorkflowError {
|
|
|
761
761
|
};
|
|
762
762
|
|
|
763
763
|
//#endregion
|
|
764
|
-
//#region
|
|
764
|
+
//#region ../@warlock.js/ai/src/errors/workflow-drift-error.ts
|
|
765
765
|
/**
|
|
766
766
|
* `workflow.resume(runId)` found a snapshot whose structural signature
|
|
767
767
|
* doesn't match the current workflow definition. Thrown without
|
|
@@ -781,7 +781,7 @@ var WorkflowDriftError = class extends WorkflowError {
|
|
|
781
781
|
};
|
|
782
782
|
|
|
783
783
|
//#endregion
|
|
784
|
-
//#region
|
|
784
|
+
//#region ../@warlock.js/ai/src/middleware/utils/extract-user-text.ts
|
|
785
785
|
/**
|
|
786
786
|
* Pull the text a content-inspection middleware should care about
|
|
787
787
|
* from the outbound message list.
|
|
@@ -819,7 +819,7 @@ function extractUserText(messages) {
|
|
|
819
819
|
}
|
|
820
820
|
|
|
821
821
|
//#endregion
|
|
822
|
-
//#region
|
|
822
|
+
//#region ../@warlock.js/ai/src/middleware/utils/namespaced-state.ts
|
|
823
823
|
/**
|
|
824
824
|
* Typed accessor over `ctx.state` for a single namespace key. Wraps
|
|
825
825
|
* the raw `Map<string, unknown>` so middleware authors stop typing
|
|
@@ -877,7 +877,7 @@ function namespacedState(ctx, namespace) {
|
|
|
877
877
|
}
|
|
878
878
|
|
|
879
879
|
//#endregion
|
|
880
|
-
//#region
|
|
880
|
+
//#region ../@warlock.js/ai/src/middleware/builtins/budget.ts
|
|
881
881
|
function breach(limit, actual, unit, name) {
|
|
882
882
|
throw new BudgetExceededError(`budget "${name}" exceeded — ${actual} ${unit} (cap: ${limit})`, {
|
|
883
883
|
limit,
|
|
@@ -971,7 +971,7 @@ function budget(options) {
|
|
|
971
971
|
}
|
|
972
972
|
|
|
973
973
|
//#endregion
|
|
974
|
-
//#region
|
|
974
|
+
//#region ../@warlock.js/ai/src/middleware/builtins/guardrail.ts
|
|
975
975
|
/**
|
|
976
976
|
* Pre/post content guardrail for an agent run.
|
|
977
977
|
*
|
|
@@ -1041,7 +1041,7 @@ function guardrail(options) {
|
|
|
1041
1041
|
}
|
|
1042
1042
|
|
|
1043
1043
|
//#endregion
|
|
1044
|
-
//#region
|
|
1044
|
+
//#region ../@warlock.js/ai/src/config.ts
|
|
1045
1045
|
const aiConfig = {};
|
|
1046
1046
|
/**
|
|
1047
1047
|
* Set or extend process-wide AI configuration. Merges over existing
|
|
@@ -1082,7 +1082,7 @@ function resolveDefaultStore() {
|
|
|
1082
1082
|
}
|
|
1083
1083
|
|
|
1084
1084
|
//#endregion
|
|
1085
|
-
//#region
|
|
1085
|
+
//#region ../@warlock.js/ai/src/middleware/builtins/semantic-cache.ts
|
|
1086
1086
|
const DEFAULT_NAMESPACE = "ai.cache";
|
|
1087
1087
|
/**
|
|
1088
1088
|
* Build a stable fingerprint for a prompt covering the full message
|
|
@@ -1226,7 +1226,7 @@ function toSyntheticResponse(response) {
|
|
|
1226
1226
|
}
|
|
1227
1227
|
|
|
1228
1228
|
//#endregion
|
|
1229
|
-
//#region
|
|
1229
|
+
//#region ../@warlock.js/ai/src/middleware/helpers/compose.ts
|
|
1230
1230
|
/**
|
|
1231
1231
|
* Flatten one or more middleware sources into a single ordered
|
|
1232
1232
|
* array suitable for `agent({ middleware: [...] })`.
|
|
@@ -1276,7 +1276,7 @@ function composeMiddleware(...sources) {
|
|
|
1276
1276
|
}
|
|
1277
1277
|
|
|
1278
1278
|
//#endregion
|
|
1279
|
-
//#region
|
|
1279
|
+
//#region ../@warlock.js/ai/src/middleware/helpers/for-tool.ts
|
|
1280
1280
|
/**
|
|
1281
1281
|
* Scope a middleware's `tool`-level hooks to only fire for a
|
|
1282
1282
|
* specific tool name (or a set of names). `execute` and `trip`
|
|
@@ -1354,7 +1354,7 @@ function forTool(toolNames, middleware) {
|
|
|
1354
1354
|
}
|
|
1355
1355
|
|
|
1356
1356
|
//#endregion
|
|
1357
|
-
//#region
|
|
1357
|
+
//#region ../@warlock.js/ai/src/middleware/pipeline.ts
|
|
1358
1358
|
const LOG_MODULE$1 = "ai.middleware";
|
|
1359
1359
|
/**
|
|
1360
1360
|
* Run an inner async operation through a stack of agent middlewares
|
|
@@ -1452,7 +1452,7 @@ async function runPipeline(middlewares, level, context, inner, logger) {
|
|
|
1452
1452
|
}
|
|
1453
1453
|
|
|
1454
1454
|
//#endregion
|
|
1455
|
-
//#region
|
|
1455
|
+
//#region ../@warlock.js/ai/src/utils/compute-cost.ts
|
|
1456
1456
|
/**
|
|
1457
1457
|
* Compute a per-channel USD cost breakdown for a single `Usage` against
|
|
1458
1458
|
* a model's pricing table. Returns `undefined` when no pricing is
|
|
@@ -1537,7 +1537,7 @@ function sumOptional(parent, child) {
|
|
|
1537
1537
|
}
|
|
1538
1538
|
|
|
1539
1539
|
//#endregion
|
|
1540
|
-
//#region
|
|
1540
|
+
//#region ../@warlock.js/ai/src/utils/extract-json-payload.ts
|
|
1541
1541
|
/**
|
|
1542
1542
|
* Strip markdown code fences from an LLM response before JSON parsing.
|
|
1543
1543
|
*
|
|
@@ -1574,7 +1574,7 @@ function extractJsonPayload(text) {
|
|
|
1574
1574
|
}
|
|
1575
1575
|
|
|
1576
1576
|
//#endregion
|
|
1577
|
-
//#region
|
|
1577
|
+
//#region ../@warlock.js/ai/src/utils/generate-run-id.ts
|
|
1578
1578
|
/**
|
|
1579
1579
|
* Generates a stable, human-readable run id for any execution node
|
|
1580
1580
|
* (tool invocation, agent run, workflow run, supervisor run). Format:
|
|
@@ -1595,7 +1595,7 @@ function generateRunId(prefix) {
|
|
|
1595
1595
|
}
|
|
1596
1596
|
|
|
1597
1597
|
//#endregion
|
|
1598
|
-
//#region
|
|
1598
|
+
//#region ../@warlock.js/ai/src/utils/json-schema.ts
|
|
1599
1599
|
/**
|
|
1600
1600
|
* Best-effort JSON Schema extraction from a Standard Schema instance.
|
|
1601
1601
|
*
|
|
@@ -1682,7 +1682,7 @@ function extractFromCandidateKeys(schemaRecord) {
|
|
|
1682
1682
|
}
|
|
1683
1683
|
|
|
1684
1684
|
//#endregion
|
|
1685
|
-
//#region
|
|
1685
|
+
//#region ../@warlock.js/ai/src/utils/resolve-attachment.ts
|
|
1686
1686
|
const REMOTE_URL_PATTERN = /^https?:\/\//i;
|
|
1687
1687
|
/**
|
|
1688
1688
|
* Normalize a user-supplied `Attachment` (or bare `AttachmentSource`)
|
|
@@ -1750,7 +1750,7 @@ function resolveSource(source) {
|
|
|
1750
1750
|
}
|
|
1751
1751
|
|
|
1752
1752
|
//#endregion
|
|
1753
|
-
//#region
|
|
1753
|
+
//#region ../@warlock.js/ai/src/utils/prepare-attachment-part.ts
|
|
1754
1754
|
const IMAGE_EXTENSIONS_TO_MEDIA_TYPE = {
|
|
1755
1755
|
".png": "image/png",
|
|
1756
1756
|
".jpg": "image/jpeg",
|
|
@@ -1882,7 +1882,7 @@ function stripQuery(path) {
|
|
|
1882
1882
|
}
|
|
1883
1883
|
|
|
1884
1884
|
//#endregion
|
|
1885
|
-
//#region
|
|
1885
|
+
//#region ../@warlock.js/ai/src/utils/safe-json-parse.ts
|
|
1886
1886
|
/**
|
|
1887
1887
|
* Parse a JSON string, returning a caller-supplied fallback when the input
|
|
1888
1888
|
* is empty or malformed instead of throwing. Useful at provider boundaries
|
|
@@ -1902,7 +1902,7 @@ function safeJsonParse(data, defaultValue) {
|
|
|
1902
1902
|
}
|
|
1903
1903
|
|
|
1904
1904
|
//#endregion
|
|
1905
|
-
//#region
|
|
1905
|
+
//#region ../@warlock.js/ai/src/contracts/result/base-report.type.ts
|
|
1906
1906
|
/**
|
|
1907
1907
|
* Wire-format version stamped on every root `BaseReport`. Bumped only
|
|
1908
1908
|
* when we make a BREAKING change to the report shape (field removed,
|
|
@@ -1917,7 +1917,7 @@ function safeJsonParse(data, defaultValue) {
|
|
|
1917
1917
|
const REPORT_SCHEMA_VERSION = 1;
|
|
1918
1918
|
|
|
1919
1919
|
//#endregion
|
|
1920
|
-
//#region
|
|
1920
|
+
//#region ../@warlock.js/ai/src/utils/stamp-report-lineage.ts
|
|
1921
1921
|
/**
|
|
1922
1922
|
* Walk a freshly-built report tree and stamp lineage fields onto
|
|
1923
1923
|
* every node:
|
|
@@ -1960,7 +1960,7 @@ function walk(node, rootRunId, parentRunId, sessionId) {
|
|
|
1960
1960
|
}
|
|
1961
1961
|
|
|
1962
1962
|
//#endregion
|
|
1963
|
-
//#region
|
|
1963
|
+
//#region ../@warlock.js/ai/src/utils/token-count.ts
|
|
1964
1964
|
/**
|
|
1965
1965
|
* Approximate the number of tokens in a string.
|
|
1966
1966
|
*
|
|
@@ -1976,7 +1976,7 @@ function approximateTokenCount(text) {
|
|
|
1976
1976
|
}
|
|
1977
1977
|
|
|
1978
1978
|
//#endregion
|
|
1979
|
-
//#region
|
|
1979
|
+
//#region ../@warlock.js/ai/src/agent/agent-input-builder.ts
|
|
1980
1980
|
/**
|
|
1981
1981
|
* Assemble the seed conversation for an agent execution. Runs exactly
|
|
1982
1982
|
* once per run — subsequent trips append to the same message list.
|
|
@@ -2079,7 +2079,7 @@ function resolveStructuredOutput(params) {
|
|
|
2079
2079
|
}
|
|
2080
2080
|
|
|
2081
2081
|
//#endregion
|
|
2082
|
-
//#region
|
|
2082
|
+
//#region ../@warlock.js/ai/src/agent/agent-log-event.ts
|
|
2083
2083
|
/**
|
|
2084
2084
|
* Structured logging for agent lifecycle events. Mirrors
|
|
2085
2085
|
* `Execution.emit`'s call sites without touching class state — the
|
|
@@ -2178,7 +2178,7 @@ function logAgentEvent(logger, ctx, event, payload) {
|
|
|
2178
2178
|
}
|
|
2179
2179
|
|
|
2180
2180
|
//#endregion
|
|
2181
|
-
//#region
|
|
2181
|
+
//#region ../@warlock.js/ai/src/agent/agent-stream.ts
|
|
2182
2182
|
function createAgentStream() {
|
|
2183
2183
|
const queue = [];
|
|
2184
2184
|
const pending = [];
|
|
@@ -2258,7 +2258,7 @@ function createAgentStream() {
|
|
|
2258
2258
|
}
|
|
2259
2259
|
|
|
2260
2260
|
//#endregion
|
|
2261
|
-
//#region
|
|
2261
|
+
//#region ../@warlock.js/ai/src/agent/agent-to-stream-event.ts
|
|
2262
2262
|
/**
|
|
2263
2263
|
* Map an internal `AgentEventMap` entry into the public `StreamEvent`
|
|
2264
2264
|
* shape. Event names are the same dot-notation strings on both sides;
|
|
@@ -2342,7 +2342,7 @@ function agentEventToStreamEvent(event, payload) {
|
|
|
2342
2342
|
}
|
|
2343
2343
|
|
|
2344
2344
|
//#endregion
|
|
2345
|
-
//#region
|
|
2345
|
+
//#region ../@warlock.js/ai/src/agent/json-stream-guard.ts
|
|
2346
2346
|
/**
|
|
2347
2347
|
* Default cap on bytes accumulated in a single suspect buffer before
|
|
2348
2348
|
* the guard gives up, flushes as text, and resets to pass-through.
|
|
@@ -2740,7 +2740,7 @@ function readObject(envelope, key) {
|
|
|
2740
2740
|
}
|
|
2741
2741
|
|
|
2742
2742
|
//#endregion
|
|
2743
|
-
//#region
|
|
2743
|
+
//#region ../@warlock.js/ai/src/agent/agent.ts
|
|
2744
2744
|
const LOG_MODULE = "ai.agent";
|
|
2745
2745
|
/**
|
|
2746
2746
|
* Detect abort-flavored errors surfaced by SDK HTTP layers — the
|
|
@@ -3691,7 +3691,7 @@ function resolveToolAction(tool, input) {
|
|
|
3691
3691
|
}
|
|
3692
3692
|
|
|
3693
3693
|
//#endregion
|
|
3694
|
-
//#region
|
|
3694
|
+
//#region ../@warlock.js/ai/src/tool/tool.ts
|
|
3695
3695
|
/**
|
|
3696
3696
|
* Degraded `ToolContext` supplied when no caller threads one through
|
|
3697
3697
|
* (`tool.invoke(input)` standalone, batch scripts, tests). Per
|
|
@@ -3868,7 +3868,7 @@ function tool(contract) {
|
|
|
3868
3868
|
}
|
|
3869
3869
|
|
|
3870
3870
|
//#endregion
|
|
3871
|
-
//#region
|
|
3871
|
+
//#region ../@warlock.js/ai/src/supervisor/as-tool.ts
|
|
3872
3872
|
/**
|
|
3873
3873
|
* Wrap a `SupervisorContract` as a `ToolContract` so an outer agent
|
|
3874
3874
|
* can invoke it from its tool-call loop. Mirrors
|
|
@@ -3942,7 +3942,7 @@ function coerceInput(value) {
|
|
|
3942
3942
|
}
|
|
3943
3943
|
|
|
3944
3944
|
//#endregion
|
|
3945
|
-
//#region
|
|
3945
|
+
//#region ../@warlock.js/ai/src/supervisor/emitter.ts
|
|
3946
3946
|
/**
|
|
3947
3947
|
* Three-tier supervisor event emitter — factory (definition) → instance
|
|
3948
3948
|
* → per-execution. Mirrors `WorkflowEmitter` structurally; the only
|
|
@@ -3987,7 +3987,7 @@ function invoke$1(handler, payload) {
|
|
|
3987
3987
|
}
|
|
3988
3988
|
|
|
3989
3989
|
//#endregion
|
|
3990
|
-
//#region
|
|
3990
|
+
//#region ../@warlock.js/ai/src/supervisor/entries.ts
|
|
3991
3991
|
/**
|
|
3992
3992
|
* Validate and normalize the `intents` map into resolved entries.
|
|
3993
3993
|
* Runs at factory time — throws `SupervisorFailedError` on the first
|
|
@@ -4188,7 +4188,7 @@ function isWorkflowResult(raw) {
|
|
|
4188
4188
|
}
|
|
4189
4189
|
|
|
4190
4190
|
//#endregion
|
|
4191
|
-
//#region
|
|
4191
|
+
//#region ../@warlock.js/ai/src/contracts/end.type.ts
|
|
4192
4192
|
/**
|
|
4193
4193
|
* Framework-global termination sentinel. Emitted by any primitive
|
|
4194
4194
|
* whose control flow is routed through JSON-serializable strings —
|
|
@@ -4233,7 +4233,7 @@ function isWorkflowResult(raw) {
|
|
|
4233
4233
|
const END = "__warlock:end__";
|
|
4234
4234
|
|
|
4235
4235
|
//#endregion
|
|
4236
|
-
//#region
|
|
4236
|
+
//#region ../@warlock.js/ai/src/supervisor/cancellation.ts
|
|
4237
4237
|
/**
|
|
4238
4238
|
* Build a `SupervisorCancelledError` from an `AbortSignal`. Extracts a
|
|
4239
4239
|
* human-readable reason from `signal.reason` whether it was a string,
|
|
@@ -4250,7 +4250,7 @@ function createCancelledError(signal) {
|
|
|
4250
4250
|
}
|
|
4251
4251
|
|
|
4252
4252
|
//#endregion
|
|
4253
|
-
//#region
|
|
4253
|
+
//#region ../@warlock.js/ai/src/supervisor/router-prompt.ts
|
|
4254
4254
|
/**
|
|
4255
4255
|
* Build the per-turn user message the supervisor feeds to the router
|
|
4256
4256
|
* agent. Carries everything the LLM needs to make a routing decision:
|
|
@@ -4298,7 +4298,7 @@ function safeStringify$1(value) {
|
|
|
4298
4298
|
}
|
|
4299
4299
|
|
|
4300
4300
|
//#endregion
|
|
4301
|
-
//#region
|
|
4301
|
+
//#region ../@warlock.js/ai/src/supervisor/decide.ts
|
|
4302
4302
|
/**
|
|
4303
4303
|
* Unified dispatch decision entry — calls either the `route` callback
|
|
4304
4304
|
* or the `router` agent based on the supervisor's configured mode and
|
|
@@ -4561,7 +4561,7 @@ function wrapRouteError(supervisorName, thrown) {
|
|
|
4561
4561
|
}
|
|
4562
4562
|
|
|
4563
4563
|
//#endregion
|
|
4564
|
-
//#region
|
|
4564
|
+
//#region ../@warlock.js/ai/src/supervisor/snapshot.ts
|
|
4565
4565
|
/**
|
|
4566
4566
|
* Resolve the effective snapshot store: the supervisor's own
|
|
4567
4567
|
* `snapshotStore` field wins; absent that, fall back to the global
|
|
@@ -4631,7 +4631,7 @@ function snapshotKey(runId) {
|
|
|
4631
4631
|
}
|
|
4632
4632
|
|
|
4633
4633
|
//#endregion
|
|
4634
|
-
//#region
|
|
4634
|
+
//#region ../@warlock.js/ai/src/supervisor/execution.ts
|
|
4635
4635
|
const DEFAULT_MAX_ITERATIONS = 10;
|
|
4636
4636
|
const LOG_MODULE_BASE$1 = "ai.supervisor";
|
|
4637
4637
|
/**
|
|
@@ -6482,7 +6482,7 @@ async function validateOutput(schema, value) {
|
|
|
6482
6482
|
}
|
|
6483
6483
|
|
|
6484
6484
|
//#endregion
|
|
6485
|
-
//#region
|
|
6485
|
+
//#region ../@warlock.js/ai/src/supervisor/signature.ts
|
|
6486
6486
|
/**
|
|
6487
6487
|
* Deterministic structural fingerprint of a supervisor definition.
|
|
6488
6488
|
* Persisted on every snapshot so `resume()` can detect drift between
|
|
@@ -6569,7 +6569,7 @@ function hash$1(input) {
|
|
|
6569
6569
|
}
|
|
6570
6570
|
|
|
6571
6571
|
//#endregion
|
|
6572
|
-
//#region
|
|
6572
|
+
//#region ../@warlock.js/ai/src/supervisor/supervisor-stream.ts
|
|
6573
6573
|
/**
|
|
6574
6574
|
* Factory mirroring `createAgentStream`. Returns a paired
|
|
6575
6575
|
* `{ controller, stream }` — the `SupervisorExecution` pushes events
|
|
@@ -6656,7 +6656,7 @@ function createSupervisorStream() {
|
|
|
6656
6656
|
}
|
|
6657
6657
|
|
|
6658
6658
|
//#endregion
|
|
6659
|
-
//#region
|
|
6659
|
+
//#region ../@warlock.js/ai/src/supervisor/supervisor.ts
|
|
6660
6660
|
/**
|
|
6661
6661
|
* `ai.supervisor(config)` — construct a `SupervisorContract`. Validates
|
|
6662
6662
|
* the config at author time (throws `SupervisorFailedError` on bad
|
|
@@ -6782,7 +6782,7 @@ function generateRunId$2() {
|
|
|
6782
6782
|
}
|
|
6783
6783
|
|
|
6784
6784
|
//#endregion
|
|
6785
|
-
//#region
|
|
6785
|
+
//#region ../@warlock.js/ai/src/system-prompt/render-placeholders.ts
|
|
6786
6786
|
const PLACEHOLDER_PATTERN = /\{\{\s*([^{}]+?)\s*\}\}/g;
|
|
6787
6787
|
/**
|
|
6788
6788
|
* Render a template string against a placeholders map, supporting dot-path
|
|
@@ -6838,7 +6838,7 @@ function lookupPath(source, path) {
|
|
|
6838
6838
|
}
|
|
6839
6839
|
|
|
6840
6840
|
//#endregion
|
|
6841
|
-
//#region
|
|
6841
|
+
//#region ../@warlock.js/ai/src/system-prompt/instruction.ts
|
|
6842
6842
|
/**
|
|
6843
6843
|
* Concrete `InstructionContract` — a reusable directive block.
|
|
6844
6844
|
*
|
|
@@ -6891,7 +6891,7 @@ function instruction(text) {
|
|
|
6891
6891
|
}
|
|
6892
6892
|
|
|
6893
6893
|
//#endregion
|
|
6894
|
-
//#region
|
|
6894
|
+
//#region ../@warlock.js/ai/src/system-prompt/persona.ts
|
|
6895
6895
|
/**
|
|
6896
6896
|
* Concrete `PersonaContract` — a reusable "who the agent is" block.
|
|
6897
6897
|
*
|
|
@@ -6944,7 +6944,7 @@ function persona(text) {
|
|
|
6944
6944
|
}
|
|
6945
6945
|
|
|
6946
6946
|
//#endregion
|
|
6947
|
-
//#region
|
|
6947
|
+
//#region ../@warlock.js/ai/src/system-prompt/system-prompt.ts
|
|
6948
6948
|
/**
|
|
6949
6949
|
* Concrete `SystemPromptContract` — an immutable layered prompt builder.
|
|
6950
6950
|
*
|
|
@@ -7076,7 +7076,7 @@ function systemPrompt(input) {
|
|
|
7076
7076
|
}
|
|
7077
7077
|
|
|
7078
7078
|
//#endregion
|
|
7079
|
-
//#region
|
|
7079
|
+
//#region ../@warlock.js/ai/src/workflow/step.ts
|
|
7080
7080
|
/**
|
|
7081
7081
|
* `ai.step(def)` — pass-through factory used for authoring. Returns
|
|
7082
7082
|
* the definition object verbatim so the workflow engine can read it
|
|
@@ -7108,7 +7108,7 @@ function validate$1(def) {
|
|
|
7108
7108
|
}
|
|
7109
7109
|
|
|
7110
7110
|
//#endregion
|
|
7111
|
-
//#region
|
|
7111
|
+
//#region ../@warlock.js/ai/src/workflow/as-tool.ts
|
|
7112
7112
|
/**
|
|
7113
7113
|
* Wrap a `WorkflowInstance` as a `ToolContract` so an agent can invoke
|
|
7114
7114
|
* it inside its tool-call loop. Closes the agent-calls-workflow
|
|
@@ -7157,7 +7157,7 @@ function asTool$1(workflowInstance, options) {
|
|
|
7157
7157
|
}
|
|
7158
7158
|
|
|
7159
7159
|
//#endregion
|
|
7160
|
-
//#region
|
|
7160
|
+
//#region ../@warlock.js/ai/src/workflow/emitter.ts
|
|
7161
7161
|
/**
|
|
7162
7162
|
* Three-tier workflow event emitter — factory (definition) → instance →
|
|
7163
7163
|
* per-execution. All matching handlers fire, in layer order. Handler
|
|
@@ -7195,7 +7195,7 @@ function invoke(handler, payload) {
|
|
|
7195
7195
|
}
|
|
7196
7196
|
|
|
7197
7197
|
//#endregion
|
|
7198
|
-
//#region
|
|
7198
|
+
//#region ../@warlock.js/ai/src/workflow/cancellation.ts
|
|
7199
7199
|
/**
|
|
7200
7200
|
* Build a `WorkflowCancelledError` from an `AbortSignal`, extracting
|
|
7201
7201
|
* a human-readable reason from `signal.reason` (string | Error | any).
|
|
@@ -7234,7 +7234,7 @@ function sleep(ms, signal) {
|
|
|
7234
7234
|
}
|
|
7235
7235
|
|
|
7236
7236
|
//#endregion
|
|
7237
|
-
//#region
|
|
7237
|
+
//#region ../@warlock.js/ai/src/workflow/router.ts
|
|
7238
7238
|
/**
|
|
7239
7239
|
* Resolve the next step to run after `step` completes. Tries
|
|
7240
7240
|
* step-level `nextStep` first, then workflow-level, then falls
|
|
@@ -7285,7 +7285,7 @@ function nextDeclaredStep(definition, currentName) {
|
|
|
7285
7285
|
}
|
|
7286
7286
|
|
|
7287
7287
|
//#endregion
|
|
7288
|
-
//#region
|
|
7288
|
+
//#region ../@warlock.js/ai/src/workflow/run-scoped-emitter.ts
|
|
7289
7289
|
/**
|
|
7290
7290
|
* Bind a factory-scoped `WorkflowEmitter` to one run's identity.
|
|
7291
7291
|
*
|
|
@@ -7315,7 +7315,7 @@ function runScopedEmitter(emitter, identity) {
|
|
|
7315
7315
|
}
|
|
7316
7316
|
|
|
7317
7317
|
//#endregion
|
|
7318
|
-
//#region
|
|
7318
|
+
//#region ../@warlock.js/ai/src/workflow/snapshot.ts
|
|
7319
7319
|
/**
|
|
7320
7320
|
* Resolve the effective snapshot store: the workflow's own
|
|
7321
7321
|
* `snapshotStore` field wins; absent that, fall back to the global
|
|
@@ -7379,7 +7379,7 @@ async function loadSnapshotForResume$1(params) {
|
|
|
7379
7379
|
}
|
|
7380
7380
|
|
|
7381
7381
|
//#endregion
|
|
7382
|
-
//#region
|
|
7382
|
+
//#region ../@warlock.js/ai/src/workflow/state.ts
|
|
7383
7383
|
/**
|
|
7384
7384
|
* Deep-clone workflow state. Uses `structuredClone` — handles Date,
|
|
7385
7385
|
* Map, Set, ArrayBuffer, nested objects, arrays, primitives. Throws
|
|
@@ -7411,7 +7411,7 @@ function deepFreeze(value) {
|
|
|
7411
7411
|
}
|
|
7412
7412
|
|
|
7413
7413
|
//#endregion
|
|
7414
|
-
//#region
|
|
7414
|
+
//#region ../@warlock.js/ai/src/workflow/retry.ts
|
|
7415
7415
|
const DEFAULT_BACKOFF_CAP_MS = 3e4;
|
|
7416
7416
|
function resolveBackoff(attempt, backoff) {
|
|
7417
7417
|
const value = (() => {
|
|
@@ -7441,7 +7441,7 @@ function resolveRetryConfig(step, workflowDefault) {
|
|
|
7441
7441
|
}
|
|
7442
7442
|
|
|
7443
7443
|
//#endregion
|
|
7444
|
-
//#region
|
|
7444
|
+
//#region ../@warlock.js/ai/src/workflow/step-runner.ts
|
|
7445
7445
|
/**
|
|
7446
7446
|
* Narrow an `executionResult` to an `AgentResult` when the step ran
|
|
7447
7447
|
* an agent. Custom `run` steps return arbitrary values, so the
|
|
@@ -7800,7 +7800,7 @@ async function validateSchema(schema, value) {
|
|
|
7800
7800
|
}
|
|
7801
7801
|
|
|
7802
7802
|
//#endregion
|
|
7803
|
-
//#region
|
|
7803
|
+
//#region ../@warlock.js/ai/src/workflow/engine.ts
|
|
7804
7804
|
const DEFAULT_MAX_STEPS = 100;
|
|
7805
7805
|
const DEFAULT_LOOP_WARN = 5;
|
|
7806
7806
|
const LOG_MODULE_BASE = "ai.workflow";
|
|
@@ -8143,7 +8143,7 @@ async function validateWorkflowOutput(schema, value) {
|
|
|
8143
8143
|
}
|
|
8144
8144
|
|
|
8145
8145
|
//#endregion
|
|
8146
|
-
//#region
|
|
8146
|
+
//#region ../@warlock.js/ai/src/workflow/signature.ts
|
|
8147
8147
|
function stepFingerprint(step) {
|
|
8148
8148
|
const tag = step.parallel ? "parallel" : step.agent ? "agent" : step.run ? "run" : "empty";
|
|
8149
8149
|
const agentName = step.agent?.name;
|
|
@@ -8175,7 +8175,7 @@ function computeSignature(definition) {
|
|
|
8175
8175
|
}
|
|
8176
8176
|
|
|
8177
8177
|
//#endregion
|
|
8178
|
-
//#region
|
|
8178
|
+
//#region ../@warlock.js/ai/src/workflow/workflow.ts
|
|
8179
8179
|
/**
|
|
8180
8180
|
* `ai.workflow(def)` — construct a `WorkflowInstance`. Validates the
|
|
8181
8181
|
* definition, computes a stable structural signature, and wires up the
|
|
@@ -8281,7 +8281,7 @@ function generateRunId$1() {
|
|
|
8281
8281
|
}
|
|
8282
8282
|
|
|
8283
8283
|
//#endregion
|
|
8284
|
-
//#region
|
|
8284
|
+
//#region ../@warlock.js/ai/src/ai.ts
|
|
8285
8285
|
/**
|
|
8286
8286
|
* Top-level `ai` namespace — holds built-in factories and user-registered SDK adapters.
|
|
8287
8287
|
*
|
|
@@ -8329,7 +8329,7 @@ const ai = {
|
|
|
8329
8329
|
};
|
|
8330
8330
|
|
|
8331
8331
|
//#endregion
|
|
8332
|
-
//#region
|
|
8332
|
+
//#region ../@warlock.js/ai/src/mock/mock-model.ts
|
|
8333
8333
|
/**
|
|
8334
8334
|
* Deterministic in-memory `ModelContract` implementation for tests.
|
|
8335
8335
|
*
|
|
@@ -8477,7 +8477,7 @@ var MockModel = class {
|
|
|
8477
8477
|
};
|
|
8478
8478
|
|
|
8479
8479
|
//#endregion
|
|
8480
|
-
//#region
|
|
8480
|
+
//#region ../@warlock.js/ai/src/mock/mock-sdk.ts
|
|
8481
8481
|
/**
|
|
8482
8482
|
* Creates a mock SDK adapter for testing — no HTTP calls, fully configurable.
|
|
8483
8483
|
*
|
|
@@ -8509,7 +8509,7 @@ function MockSDK(config = {}) {
|
|
|
8509
8509
|
}
|
|
8510
8510
|
|
|
8511
8511
|
//#endregion
|
|
8512
|
-
//#region
|
|
8512
|
+
//#region ../@warlock.js/ai/src/mock/mock-agent.ts
|
|
8513
8513
|
/**
|
|
8514
8514
|
* Test helper that wires `MockSDK` → mock model → `agent()` in one call.
|
|
8515
8515
|
*
|