@elevasis/sdk 1.50.0 → 1.52.0

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.
@@ -1,8 +1,20 @@
1
- import { ProcessingStageStatusSchema, ListBuilderStageKeySchema, zodToJsonSchema, LLMResponseParseError, errorToString, getErrorDetails, ExecutionError2, validateEntryPoint, validateTerminalSteps, validateStepReferences, logWorkflowStart, detectCycle, WorkflowStepError, logStepStart, validateTerminalOutput, logStepSuccess, determineNextStep, logStepFailure, logExecutionPath, logWorkflowSuccess, logWorkflowFailure, estimateTokens, validateTokenConfiguration, truncationCharBudget, buildIterationResponseSchema } from './chunk-YJDXRHNP.js';
1
+ import { ProcessingStageStatusSchema, ListBuilderStageKeySchema, zodToJsonSchema, LLMResponseParseError, errorToString, getErrorDetails, ExecutionError2, validateEntryPoint, validateTerminalSteps, validateStepReferences, WorkflowTimeoutError, WorkflowStalledError, WorkflowCancellationError, logWorkflowStart, detectCycle, WorkflowStepError, logStepStart, validateTerminalOutput, logStepSuccess, determineNextStep, logStepFailure, logExecutionPath, logWorkflowSuccess, logWorkflowFailure, estimateTokens, truncationCharBudget, buildIterationResponseSchema } from './chunk-XC57JNMA.js';
2
2
  import { workerData, parentPort } from 'worker_threads';
3
3
  import { z, ZodError } from 'zod';
4
4
  import { createHmac } from 'crypto';
5
5
 
6
+ // ../core/src/execution/engine/base/utils.ts
7
+ function abortKindFor(signal) {
8
+ if (!signal?.aborted) return null;
9
+ if (signal.reason === "timeout") return "timeout";
10
+ if (signal.reason === "stalled") return "stalled";
11
+ return "cancelled";
12
+ }
13
+
14
+ // ../core/src/platform/constants/timeouts.ts
15
+ var DEFAULT_TOOL_TIMEOUT = 18e5;
16
+ var DEFAULT_EXECUTION_TIMEOUT = 72e5;
17
+
6
18
  // ../core/src/execution/engine/workflow/workflow.ts
7
19
  var Workflow = class {
8
20
  config;
@@ -26,6 +38,33 @@ var Workflow = class {
26
38
  validateTerminalSteps(this.steps, this.config.resourceId);
27
39
  validateStepReferences(this.steps);
28
40
  }
41
+ /**
42
+ * Build the error for an aborted execution, or `null` when the signal has not fired.
43
+ *
44
+ * Mirrors `Agent.abortErrorFor`, sharing its `abortKindFor` classification so a cancelled workflow and
45
+ * a cancelled agent are described the same way, and differing only in the error family -- these carry
46
+ * `category: 'workflow'`, which is what the `execution_errors` row and the API response report.
47
+ *
48
+ * @returns `null` when the signal is not aborted -- callers throw only when this returns non-null.
49
+ */
50
+ abortErrorFor(signal, stepId, executionPath) {
51
+ const kind = abortKindFor(signal);
52
+ if (!kind) return null;
53
+ if (kind === "timeout") {
54
+ return new WorkflowTimeoutError(`Workflow execution exceeded timeout (${DEFAULT_EXECUTION_TIMEOUT}ms)`, {
55
+ timeout: DEFAULT_EXECUTION_TIMEOUT,
56
+ stepId,
57
+ executionPath
58
+ });
59
+ }
60
+ if (kind === "stalled") {
61
+ return new WorkflowStalledError("Execution stalled: no heartbeat received within threshold", {
62
+ stepId,
63
+ executionPath
64
+ });
65
+ }
66
+ return new WorkflowCancellationError("Execution cancelled by user", { stepId, executionPath });
67
+ }
29
68
  /**
30
69
  * Execute the workflow with graph-based flow control
31
70
  * Context is required for execution tracking, logging, and organization isolation
@@ -40,6 +79,8 @@ var Workflow = class {
40
79
  let currentData = validated;
41
80
  let currentStepId = this.entryPoint;
42
81
  while (currentStepId !== null) {
82
+ const abortError = this.abortErrorFor(context.signal, currentStepId, executionPath);
83
+ if (abortError) throw abortError;
43
84
  detectCycle(visited, executionPath, currentStepId);
44
85
  visited.add(currentStepId);
45
86
  executionPath.push(currentStepId);
@@ -585,7 +626,6 @@ function withSynthesizedMessage(nextActions, message) {
585
626
  return [{ type: "message", text }, ...nextActions];
586
627
  }
587
628
  async function callLLMForAgentIteration(adapter, request) {
588
- validateTokenConfiguration(request.model, request.constraints.maxOutputTokens);
589
629
  const messages = buildAgentMessages(
590
630
  request.systemPrompt,
591
631
  request.memory,
@@ -648,7 +688,6 @@ async function callLLMForAgentIteration(adapter, request) {
648
688
  }
649
689
  }
650
690
  async function callLLMForAgentCompletion(adapter, request) {
651
- validateTokenConfiguration(request.model, request.constraints.maxOutputTokens);
652
691
  const messages = buildAgentMessages(
653
692
  request.systemPrompt,
654
693
  request.memory,
@@ -793,10 +832,23 @@ var ToolingError = class extends ExecutionError2 {
793
832
  }
794
833
  return "warning";
795
834
  }
835
+ /**
836
+ * Set by `withRetry` on the error it throws once its own attempts are spent.
837
+ *
838
+ * Without it the error type says only what KIND of failure happened, never whether anything has
839
+ * already been tried, so a retryable classification survives being retried. Nesting one
840
+ * `withRetry` inside another then multiplies: the integration path wraps `adapter.call` in one
841
+ * and 54 adapter fetch modules wrap their own request in another, and a persistent provider
842
+ * failure made 16 requests where the policy says 4.
843
+ */
844
+ retryExhausted = false;
796
845
  /**
797
846
  * Check if error is retryable
798
847
  */
799
848
  isRetryable() {
849
+ if (this.retryExhausted) {
850
+ return false;
851
+ }
800
852
  return [
801
853
  "service_unavailable",
802
854
  "rate_limit_exceeded",
@@ -827,10 +879,6 @@ function cancelled(message, details) {
827
879
  return new ToolingError("cancelled", message, details);
828
880
  }
829
881
 
830
- // ../core/src/platform/constants/timeouts.ts
831
- var DEFAULT_TOOL_TIMEOUT = 18e5;
832
- var DEFAULT_EXECUTION_TIMEOUT = 72e5;
833
-
834
882
  // ../core/src/execution/engine/agent/memory/truncation.ts
835
883
  var CLOSING_BRACKET_RESERVE = 32;
836
884
  var DANGLING_KEY_WITH_COLON = /,?\s*"(?:[^"\\]|\\.)*"\s*:\s*$/;
@@ -1172,6 +1220,37 @@ var AgentNoProgressError = class extends AgentError {
1172
1220
  }
1173
1221
  };
1174
1222
 
1223
+ // ../core/src/platform/utils/concurrency.ts
1224
+ async function allSettledWithConcurrency(items, limit, task) {
1225
+ if (items.length === 0) return [];
1226
+ const bound = Math.max(1, Math.floor(limit));
1227
+ if (bound >= items.length) {
1228
+ return Promise.allSettled(items.map((item, index) => task(item, index)));
1229
+ }
1230
+ const results = new Array(items.length);
1231
+ let cursor = 0;
1232
+ const worker = async () => {
1233
+ while (cursor < items.length) {
1234
+ const index = cursor++;
1235
+ try {
1236
+ results[index] = { status: "fulfilled", value: await task(items[index], index) };
1237
+ } catch (reason) {
1238
+ results[index] = { status: "rejected", reason };
1239
+ }
1240
+ }
1241
+ };
1242
+ await Promise.all(Array.from({ length: bound }, worker));
1243
+ return results;
1244
+ }
1245
+
1246
+ // ../core/src/platform/constants/limits.ts
1247
+ var MAX_SESSION_MEMORY_KEYS = 25;
1248
+ var MAX_MEMORY_TOKENS = 32e3;
1249
+ var MAX_SESSION_MEMORY_TOKENS = 8e3;
1250
+ var MAX_SINGLE_ENTRY_TOKENS = 2e3;
1251
+ var MAX_TOOL_RESULT_TOKENS = 4e3;
1252
+ var MAX_CONCURRENT_TOOL_CALLS = 8;
1253
+
1175
1254
  // ../core/src/execution/engine/agent/actions/processor.ts
1176
1255
  function normalizeSessionMessages(actions, sessionCapable) {
1177
1256
  if (!sessionCapable) {
@@ -1233,7 +1312,11 @@ async function processActions(iterationContext, response) {
1233
1312
  }
1234
1313
  let shouldComplete = completeRequested && toolCalls.length === 0;
1235
1314
  if (toolCalls.length > 0) {
1236
- const settled = await Promise.allSettled(toolCalls.map((action) => executeToolCall(iterationContext, action)));
1315
+ const settled = await allSettledWithConcurrency(
1316
+ toolCalls,
1317
+ MAX_CONCURRENT_TOOL_CALLS,
1318
+ (action) => executeToolCall(iterationContext, action)
1319
+ );
1237
1320
  settled.forEach((outcome, index) => {
1238
1321
  if (outcome.status === "rejected") {
1239
1322
  const action = toolCalls[index];
@@ -1401,13 +1484,6 @@ function sanitizeUserInput(input) {
1401
1484
  };
1402
1485
  }
1403
1486
 
1404
- // ../core/src/platform/constants/limits.ts
1405
- var MAX_SESSION_MEMORY_KEYS = 25;
1406
- var MAX_MEMORY_TOKENS = 32e3;
1407
- var MAX_SESSION_MEMORY_TOKENS = 8e3;
1408
- var MAX_SINGLE_ENTRY_TOKENS = 2e3;
1409
- var MAX_TOOL_RESULT_TOKENS = 4e3;
1410
-
1411
1487
  // ../core/src/execution/engine/agent/memory/manager.ts
1412
1488
  var ENVELOPE_FULL_RESULT_WINDOW = 3;
1413
1489
  function parseIfJson(content2) {
@@ -2117,15 +2193,20 @@ var Agent = class {
2117
2193
  * between-iteration check (which never has an error, only the signal) and `wrapAndLogError`
2118
2194
  * (which has both) agree on the same classification.
2119
2195
  *
2196
+ * The reason-reading itself lives in `abortKindFor` so `Workflow.execute` can classify an abort the
2197
+ * same way without borrowing this method's `Agent*` error family -- those carry `category: 'agent'`,
2198
+ * which is written straight through to the `execution_errors` row.
2199
+ *
2120
2200
  * @returns `null` when the signal is not aborted -- callers throw only when this returns non-null.
2121
2201
  */
2122
2202
  abortErrorFor(signal, iteration) {
2123
- if (!signal?.aborted) return null;
2124
- if (signal.reason === "timeout") {
2203
+ const kind = abortKindFor(signal);
2204
+ if (!kind) return null;
2205
+ if (kind === "timeout") {
2125
2206
  const timeout = this.config.constraints?.timeout ?? DEFAULT_EXECUTION_TIMEOUT;
2126
2207
  return new AgentTimeoutError(`Agent execution exceeded timeout (${timeout}ms)`, { timeout, iteration });
2127
2208
  }
2128
- if (signal.reason === "stalled") {
2209
+ if (kind === "stalled") {
2129
2210
  return new AgentStalledError("Execution stalled: no heartbeat received within threshold", { iteration });
2130
2211
  }
2131
2212
  return new AgentCancellationError("Execution cancelled by user", { iteration });
@@ -2549,7 +2630,7 @@ function handleToolResult(msg) {
2549
2630
  const code = msg.code ?? "unknown_error";
2550
2631
  pending.reject(new PlatformToolError(msg.error, code, RETRYABLE_CODES.has(code)));
2551
2632
  } else {
2552
- pending.resolve(msg.result);
2633
+ pending.resolve(msg.result, msg.usage);
2553
2634
  }
2554
2635
  }
2555
2636
  function handleCredentialResult(msg) {
@@ -2566,6 +2647,45 @@ function handleCredentialResult(msg) {
2566
2647
  });
2567
2648
  }
2568
2649
  }
2650
+ async function sendToolCall(options) {
2651
+ if (!parentPort) {
2652
+ throw new PlatformToolError("platform.call() can only be used inside a worker thread", "service_unavailable", false);
2653
+ }
2654
+ const id = `tc_${++callCounter}_${Date.now()}`;
2655
+ const message = {
2656
+ type: "tool-call",
2657
+ id,
2658
+ tool: options.tool,
2659
+ method: options.method,
2660
+ params: options.params ?? {},
2661
+ credential: options.credential
2662
+ };
2663
+ return new Promise((resolve, reject) => {
2664
+ const timeoutMs = 18e5;
2665
+ const timeoutLabel = "1800s";
2666
+ const timer = setTimeout(() => {
2667
+ pendingCalls.delete(id);
2668
+ reject(
2669
+ new PlatformToolError(
2670
+ `Platform tool call timed out after ${timeoutLabel}: ${options.tool}.${options.method}`,
2671
+ "timeout_error",
2672
+ true
2673
+ )
2674
+ );
2675
+ }, timeoutMs);
2676
+ pendingCalls.set(id, {
2677
+ resolve: (value, usage) => {
2678
+ clearTimeout(timer);
2679
+ resolve({ result: value, usage });
2680
+ },
2681
+ reject: (error) => {
2682
+ clearTimeout(timer);
2683
+ reject(error);
2684
+ }
2685
+ });
2686
+ parentPort.postMessage(message);
2687
+ });
2688
+ }
2569
2689
  var platform = {
2570
2690
  /**
2571
2691
  * Call a platform tool from the worker thread.
@@ -2578,47 +2698,24 @@ var platform = {
2578
2698
  * @throws PlatformToolError on failure (with code and retryable fields)
2579
2699
  */
2580
2700
  async call(options) {
2581
- if (!parentPort) {
2582
- throw new PlatformToolError(
2583
- "platform.call() can only be used inside a worker thread",
2584
- "service_unavailable",
2585
- false
2586
- );
2587
- }
2588
- const id = `tc_${++callCounter}_${Date.now()}`;
2589
- const message = {
2590
- type: "tool-call",
2591
- id,
2592
- tool: options.tool,
2593
- method: options.method,
2594
- params: options.params ?? {},
2595
- credential: options.credential
2596
- };
2597
- return new Promise((resolve, reject) => {
2598
- const timeoutMs = 18e5;
2599
- const timeoutLabel = "1800s";
2600
- const timer = setTimeout(() => {
2601
- pendingCalls.delete(id);
2602
- reject(
2603
- new PlatformToolError(
2604
- `Platform tool call timed out after ${timeoutLabel}: ${options.tool}.${options.method}`,
2605
- "timeout_error",
2606
- true
2607
- )
2608
- );
2609
- }, timeoutMs);
2610
- pendingCalls.set(id, {
2611
- resolve: (value) => {
2612
- clearTimeout(timer);
2613
- resolve(value);
2614
- },
2615
- reject: (error) => {
2616
- clearTimeout(timer);
2617
- reject(error);
2618
- }
2619
- });
2620
- parentPort.postMessage(message);
2621
- });
2701
+ const { result } = await sendToolCall(options);
2702
+ return result;
2703
+ },
2704
+ /**
2705
+ * Call a platform tool and also surface any `usage` (token/cost) metadata the parent attached
2706
+ * to the response -- e.g. the `llm` tool's real provider usage from the API-side
2707
+ * `dispatchToolCall` in `tool-dispatcher.ts`. Bare `result` is unchanged from `call()`; `usage` is `undefined` whenever the
2708
+ * parent's response didn't carry one, exactly like today's `call()` behavior for that result.
2709
+ *
2710
+ * @param options.tool - Tool name (e.g., 'llm')
2711
+ * @param options.method - Method name (e.g., 'generate')
2712
+ * @param options.params - Method parameters
2713
+ * @param options.credential - Credential name (required for integration tools)
2714
+ * @returns Promise resolving to `{ result, usage }`
2715
+ * @throws PlatformToolError on failure (with code and retryable fields)
2716
+ */
2717
+ async callWithUsage(options) {
2718
+ return sendToolCall(options);
2622
2719
  },
2623
2720
  /**
2624
2721
  * Request raw credential access from the platform.
@@ -2673,7 +2770,7 @@ var PostMessageLLMAdapter = class {
2673
2770
  this.model = model;
2674
2771
  }
2675
2772
  async generate(request) {
2676
- const result = await platform.call({
2773
+ const { result, usage } = await platform.callWithUsage({
2677
2774
  tool: "llm",
2678
2775
  method: "generate",
2679
2776
  params: {
@@ -2689,7 +2786,17 @@ var PostMessageLLMAdapter = class {
2689
2786
  maxOutputTokens: request.maxOutputTokens
2690
2787
  }
2691
2788
  });
2692
- return { output: result };
2789
+ return {
2790
+ output: result,
2791
+ ...usage && {
2792
+ usage: {
2793
+ inputTokens: usage.inputTokens,
2794
+ outputTokens: usage.outputTokens,
2795
+ totalTokens: usage.inputTokens + usage.outputTokens
2796
+ }
2797
+ },
2798
+ ...usage?.cost !== void 0 && { cost: usage.cost }
2799
+ };
2693
2800
  }
2694
2801
  };
2695
2802
  function createPostMessageAdapterFactory() {
@@ -4349,11 +4456,27 @@ function startWorker(org) {
4349
4456
  throw new Error("Agent did not produce memory snapshot");
4350
4457
  }
4351
4458
  const durationMs = Date.now() - startTime;
4352
- console.log(`[SDK-WORKER] Agent '${resourceId}' completed (${durationMs}ms)`);
4459
+ const stopReason = agentInstance.getStopReason();
4460
+ const budgetExhausted = stopReason === "budget_exhausted";
4461
+ if (budgetExhausted) {
4462
+ console.warn(`[SDK-WORKER] Agent '${resourceId}' exhausted its iteration budget (${durationMs}ms)`);
4463
+ } else {
4464
+ console.log(`[SDK-WORKER] Agent '${resourceId}' completed (${durationMs}ms)`);
4465
+ }
4353
4466
  parentPort.postMessage({
4354
4467
  type: "result",
4355
- status: "completed",
4468
+ status: budgetExhausted ? "failed" : "completed",
4469
+ ...budgetExhausted ? {
4470
+ error: "Agent stopped without completing: iteration budget exhausted. Any output below was synthesized from partial work.",
4471
+ errorName: "AgentBudgetExhaustedError",
4472
+ errorCode: "agent_budget_exhausted"
4473
+ } : {},
4356
4474
  output,
4475
+ stopReason,
4476
+ // Whether the agent emitted an assistant message this turn. `Agent` has tracked this for
4477
+ // the `agent-turn-silent` detector, which logged to a sink nothing reads; carrying it lets
4478
+ // a silent turn be seen where the turn is recorded.
4479
+ hasSpoken: agentInstance.hasSpoken(),
4357
4480
  memorySnapshot,
4358
4481
  logs,
4359
4482
  metrics: { durationMs }
@@ -4367,6 +4490,10 @@ function startWorker(org) {
4367
4490
  type: "result",
4368
4491
  status: "failed",
4369
4492
  ...serializedError,
4493
+ // Carried on the throwing path too: a turn that failed after the agent had already
4494
+ // stopped for its own reason is a different diagnosis from one that failed mid-iteration,
4495
+ // and `stopReason` is the only thing that separates them.
4496
+ ...agentInstance ? { stopReason: agentInstance.getStopReason(), hasSpoken: agentInstance.hasSpoken() } : {},
4370
4497
  ...memorySnapshot ? { memorySnapshot } : {},
4371
4498
  logs,
4372
4499
  metrics: { durationMs }
@@ -4610,6 +4610,41 @@ var WorkflowValidationError = class extends ExecutionError2 {
4610
4610
  super(message, context);
4611
4611
  }
4612
4612
  };
4613
+ var WorkflowTimeoutError = class extends ExecutionError2 {
4614
+ type = "workflow_timeout_error";
4615
+ severity = "critical";
4616
+ category = "workflow";
4617
+ constructor(message, context) {
4618
+ super(message, context);
4619
+ }
4620
+ /** The ceiling was reached, so a retry has no budget to run in. */
4621
+ isRetryable() {
4622
+ return false;
4623
+ }
4624
+ };
4625
+ var WorkflowStalledError = class extends ExecutionError2 {
4626
+ type = "workflow_stalled_error";
4627
+ severity = "critical";
4628
+ category = "workflow";
4629
+ constructor(message, context) {
4630
+ super(message, context);
4631
+ }
4632
+ isRetryable() {
4633
+ return false;
4634
+ }
4635
+ };
4636
+ var WorkflowCancellationError = class extends ExecutionError2 {
4637
+ type = "workflow_cancellation_error";
4638
+ severity = "warning";
4639
+ category = "workflow";
4640
+ constructor(message, context) {
4641
+ super(message, context);
4642
+ }
4643
+ /** The user asked for this. Retrying would override an explicit instruction. */
4644
+ isRetryable() {
4645
+ return false;
4646
+ }
4647
+ };
4613
4648
 
4614
4649
  // ../core/src/execution/engine/workflow/utils.ts
4615
4650
  function validateEntryPoint(steps, entryPoint) {
@@ -5377,11 +5412,6 @@ function validateAgentGrammar(orgName, agentId, agent, mode) {
5377
5412
  function validateAgentCheapAssertions(orgName, agentId, agent, mode) {
5378
5413
  const issues = [];
5379
5414
  const config = agent.config;
5380
- if (config.sessionCapable && config.securityLevel === "none") {
5381
- issues.push(
5382
- `securityLevel: 'none' on a sessionCapable agent -- a session agent takes untrusted user input and must run with prompt-injection defenses ('standard' or 'hardened').`
5383
- );
5384
- }
5385
5415
  if (!isStubDefinition(agent) && !config.systemPrompt.trim()) {
5386
5416
  issues.push(`systemPrompt is empty -- an agent with no behavioural instructions cannot be deployed.`);
5387
5417
  }
@@ -5660,6 +5690,48 @@ function validateHumanCheckpoints(orgName, humanCheckpoints, allInternalIds, val
5660
5690
  });
5661
5691
  }
5662
5692
 
5693
+ // ../core/src/execution/engine/base/redaction.ts
5694
+ function normalizeKey(key) {
5695
+ return key.toLowerCase().replace(/[_\-.\s]/g, "");
5696
+ }
5697
+ var SECRET_PATTERNS = [
5698
+ "apikey",
5699
+ "secret",
5700
+ "password",
5701
+ "passphrase",
5702
+ "token",
5703
+ "credential",
5704
+ "privatekey",
5705
+ "accesskey",
5706
+ "authorization",
5707
+ "bearer"
5708
+ ];
5709
+ var SECRET_PLURAL_EXCEPTIONS = /* @__PURE__ */ new Set([
5710
+ "refreshtokens",
5711
+ "accesstokens",
5712
+ "apitokens",
5713
+ "authtokens",
5714
+ "bearertokens",
5715
+ "sessiontokens",
5716
+ "bypasstokens",
5717
+ "validtokens"
5718
+ ]);
5719
+ function isTokenCountKey(normalized) {
5720
+ if (SECRET_PLURAL_EXCEPTIONS.has(normalized)) return false;
5721
+ if (normalized.endsWith("tokens")) return true;
5722
+ return ["tokenbudget", "tokenlimit", "tokencount", "tokenusage"].some((k) => normalized.includes(k));
5723
+ }
5724
+ function isSecretKey(key) {
5725
+ const normalized = normalizeKey(key);
5726
+ if (isTokenCountKey(normalized)) return false;
5727
+ return SECRET_PATTERNS.some((pattern) => normalized.includes(pattern));
5728
+ }
5729
+ function redactSecretValue(value) {
5730
+ if (typeof value !== "string") return "[REDACTED]";
5731
+ if (value.length <= 7) return "[REDACTED]";
5732
+ return value.substring(0, 7) + "...";
5733
+ }
5734
+
5663
5735
  // ../core/src/execution/engine/base/serialization.ts
5664
5736
  function serializeDefinition(definition, options) {
5665
5737
  const opts = {
@@ -5697,7 +5769,7 @@ function serializeObject(obj, ctx) {
5697
5769
  for (const [key, val] of Object.entries(obj)) {
5698
5770
  if (typeof val === "function") continue;
5699
5771
  if (ctx.redactSecrets && isSecretKey(key)) {
5700
- result[key] = redactSecret(val);
5772
+ result[key] = redactSecretValue(val);
5701
5773
  continue;
5702
5774
  }
5703
5775
  if (key === "steps" && isWorkflowStepsRecord(val)) {
@@ -5783,18 +5855,6 @@ function isToolObject(value) {
5783
5855
  function isNextConfigObject(value) {
5784
5856
  return value && typeof value === "object" && "type" in value && (value.type === StepType2.LINEAR || value.type === StepType2.CONDITIONAL);
5785
5857
  }
5786
- function isSecretKey(key) {
5787
- const lower = key.toLowerCase();
5788
- const whitelist = ["maxtokens", "memorytokens", "inputtokens", "outputtokens"];
5789
- if (whitelist.some((w) => lower.includes(w))) return false;
5790
- const patterns = ["apikey", "secret", "password", "token", "credential"];
5791
- return patterns.some((p) => lower.includes(p));
5792
- }
5793
- function redactSecret(value) {
5794
- if (typeof value !== "string") return "[REDACTED]";
5795
- if (value.length <= 7) return "[REDACTED]";
5796
- return value.substring(0, 7) + "...";
5797
- }
5798
5858
 
5799
5859
  // ../core/src/platform/registry/serialization.ts
5800
5860
  function summarizeSystem(system) {
@@ -7898,4 +7958,4 @@ function defineWorkflowConfig(resourceId, descriptors, actionRegistry = []) {
7898
7958
  }
7899
7959
  var ListBuilderStageKeySchema = z.string().min(1);
7900
7960
 
7901
- export { ActivityEventSchema, BuildPlanSnapshotStepSchema, ContractRefResolutionError, CrmStageKeySchema, CrmStateKeySchema, EmailSchema, ExecutionError, ExecutionError2, LLMResponseParseError, ListBuilderStageKeySchema, ProcessingStageStatusSchema, ProspectingBuildTemplateSchema, RegistryValidationError, ResourceRegistry, StepType, ToolingError, WorkflowStepError, bindResourceDescriptor, buildIterationResponseSchema, compileBusinessOntologyValidationIndex, concurrentPool, createLeadGenStageValidators, defineContract, defineResource, defineResourceOntology, defineResources, defineStep, defineTopology, defineTopologyRelationship, defineWorkflow, defineWorkflowConfig, deriveActions, detectCycle, determineNextStep, diagnosticOutput, errorToString, estimateTokens, getErrorDetails, integrationInput, isBuiltInReadinessProfile, isZodType, logExecutionPath, logStepFailure, logStepStart, logStepSuccess, logWorkflowFailure, logWorkflowStart, logWorkflowSuccess, lookupReadinessProfile, parseTopologyNodeRef, registerReadinessProfile, resolveContractRef, runDiagnostic, splitName, topologyRef, topologyRelationship, truncationCharBudget, validateDeclaredSystemInterfaceReadiness, validateDeploymentSpec, validateEntryPoint, validateRelationships, validateResourceGovernance, validateStepReferences, validateTerminalOutput, validateTerminalSteps, validateTokenConfiguration, zodToJsonSchema };
7961
+ export { ActivityEventSchema, BuildPlanSnapshotStepSchema, ContractRefResolutionError, CrmStageKeySchema, CrmStateKeySchema, EmailSchema, ExecutionError, ExecutionError2, LLMResponseParseError, ListBuilderStageKeySchema, ProcessingStageStatusSchema, ProspectingBuildTemplateSchema, RegistryValidationError, ResourceRegistry, StepType, ToolingError, WorkflowCancellationError, WorkflowStalledError, WorkflowStepError, WorkflowTimeoutError, bindResourceDescriptor, buildIterationResponseSchema, compileBusinessOntologyValidationIndex, concurrentPool, createLeadGenStageValidators, defineContract, defineResource, defineResourceOntology, defineResources, defineStep, defineTopology, defineTopologyRelationship, defineWorkflow, defineWorkflowConfig, deriveActions, detectCycle, determineNextStep, diagnosticOutput, errorToString, estimateTokens, getErrorDetails, integrationInput, isBuiltInReadinessProfile, isZodType, logExecutionPath, logStepFailure, logStepStart, logStepSuccess, logWorkflowFailure, logWorkflowStart, logWorkflowSuccess, lookupReadinessProfile, parseTopologyNodeRef, registerReadinessProfile, resolveContractRef, runDiagnostic, splitName, topologyRef, topologyRelationship, truncationCharBudget, validateDeclaredSystemInterfaceReadiness, validateDeploymentSpec, validateEntryPoint, validateRelationships, validateResourceGovernance, validateStepReferences, validateTerminalOutput, validateTerminalSteps, zodToJsonSchema };