@desplega.ai/agent-swarm 1.124.0 → 1.125.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.
Files changed (101) hide show
  1. package/dist/{actions-z3d0fk7z.js → actions-3aky6er5.js} +6 -5
  2. package/dist/{app-q2rc9tdr.js → app-xbt4n4mt.js} +4 -3
  3. package/dist/{assistant-3stjq7fz.js → assistant-ncftbs9t.js} +12 -10
  4. package/dist/{boot-reembed-v6r1df32.js → boot-reembed-00cxm1mj.js} +5 -4
  5. package/dist/{boot-reembed-5867whnb.js → boot-reembed-5xxzva12.js} +4 -3
  6. package/dist/{boot-scrub-logs-8b8jegk3.js → boot-scrub-logs-9cmcq6ez.js} +3 -2
  7. package/dist/{cli-0925phzv.js → cli-0w3mk6r2.js} +1 -1
  8. package/dist/{cli-zxb72ctk.js → cli-3x5aphbt.js} +2 -2
  9. package/dist/{cli-exfs8aym.js → cli-3y8xyp0b.js} +7 -1
  10. package/dist/{cli-2yr6edr7.js → cli-4xft7caa.js} +4 -4
  11. package/dist/{cli-kk58tg33.js → cli-5a4nmfrn.js} +12 -10
  12. package/dist/{cli-5jn6wnd9.js → cli-88r31vx9.js} +2 -2
  13. package/dist/{cli-sqv6c9b8.js → cli-8bkwn1wv.js} +11 -9
  14. package/dist/{cli-p0zgv8pj.js → cli-8vzddbs7.js} +2 -1
  15. package/dist/{cli-qf7acvyr.js → cli-94796kxr.js} +2 -2
  16. package/dist/{cli-wn3m6q54.js → cli-dbmh9yqn.js} +7 -5
  17. package/dist/{cli-p0ec4vv6.js → cli-ff8b5cbe.js} +1 -1
  18. package/dist/{cli-y43n987v.js → cli-gbx122ge.js} +1 -1
  19. package/dist/{cli-ykthjw29.js → cli-jcavqvh7.js} +20 -24
  20. package/dist/cli-k1py8264.js +1129 -0
  21. package/dist/{cli-qwsagsmg.js → cli-k5c6jfzn.js} +1 -1
  22. package/dist/{cli-gkvf8d83.js → cli-n02497b2.js} +5 -3
  23. package/dist/{cli-vm20sh8d.js → cli-nqq9tthd.js} +9 -7
  24. package/dist/{cli-jp4mdj9d.js → cli-pqtrhrss.js} +2 -2
  25. package/dist/{cli-gzjsamwc.js → cli-q92pr3rt.js} +1 -1
  26. package/dist/{cli-mmk5vagg.js → cli-qzy21svh.js} +2 -2
  27. package/dist/{cli-dq2ssyf0.js → cli-refygp3c.js} +5 -5
  28. package/dist/{cli-perb20ma.js → cli-tar44ekp.js} +1 -1
  29. package/dist/{cli-h89g0qrd.js → cli-v292k2fv.js} +1 -1
  30. package/dist/{cli-mcez7z4p.js → cli-vvbwy286.js} +1 -1
  31. package/dist/{cli-x268say8.js → cli-wbcsjpyv.js} +366 -68
  32. package/dist/cli-wdrrgv4m.js +22 -0
  33. package/dist/{cli-3z4q09tn.js → cli-yr11vvst.js} +32 -1127
  34. package/dist/{cli-92bqgbgy.js → cli-zhp3t49e.js} +4 -2
  35. package/dist/cli.js +23 -10
  36. package/dist/{codex-adapter-vcseqpwf.js → codex-adapter-mqczt8xv.js} +1 -1
  37. package/dist/codex-hook-emq42pfq.js +106 -0
  38. package/dist/{codex-session-runner-jec9e9t1.js → codex-session-runner-mrwz1h50.js} +1 -1
  39. package/dist/{commands-sda76yn8.js → commands-7dbx98fp.js} +5 -3
  40. package/dist/{db-vn9e4rqj.js → db-r5705rk8.js} +7 -2
  41. package/dist/{handlers-xfja18ac.js → handlers-8kj038es.js} +12 -10
  42. package/dist/{hook-2medrp47.js → hook-2590fnyk.js} +1 -1
  43. package/dist/{http-937pyjfc.js → http-8yej35d0.js} +77 -55
  44. package/dist/{index-vah60vxp.js → index-hy73j39b.js} +8 -7
  45. package/dist/{index-knqczmnm.js → index-kgay2v5w.js} +11 -10
  46. package/dist/{index-gw4en7jg.js → index-v3n4hb3w.js} +10 -9
  47. package/dist/{index-2bqd2q9v.js → index-x1n3tybc.js} +12 -11
  48. package/dist/{keepalive-20rd6hxh.js → keepalive-q8yg6d6r.js} +6 -5
  49. package/dist/{lead-7w2k3a49.js → lead-yxtt169p.js} +23 -21
  50. package/dist/{maintenance-p3x918yw.js → maintenance-70cskw5t.js} +5 -4
  51. package/dist/{oauth-refresh-sweep-shm0nzm4.js → oauth-refresh-sweep-90h9rzx8.js} +5 -4
  52. package/dist/{onboard-py9dnf54.js → onboard-20reqz6j.js} +2 -2
  53. package/dist/{otel-impl-7yjkfg68.js → otel-impl-vja8f9mm.js} +1 -1
  54. package/dist/{pricing-refresh-3snb6370.js → pricing-refresh-34mbexgm.js} +5 -4
  55. package/dist/{rbac-roles-gqxdp8st.js → rbac-roles-s1qnewkt.js} +5 -4
  56. package/dist/{rbac-roles-5e72bbpk.js → rbac-roles-sa59eyp4.js} +4 -3
  57. package/dist/{seed-pricing-bg42d7h2.js → seed-pricing-p5fnj0qd.js} +4 -3
  58. package/dist/{setup-nzk3kbbq.js → setup-p9yq3mb2.js} +2 -2
  59. package/dist/{worker-0p1jdzkm.js → worker-21zrq8cd.js} +23 -21
  60. package/openapi.json +1 -1
  61. package/package.json +2 -1
  62. package/src/be/db.ts +30 -0
  63. package/src/cli.tsx +12 -0
  64. package/src/commands/runner.ts +11 -23
  65. package/src/hooks/codex-hook.ts +157 -0
  66. package/src/http/kv.ts +37 -8
  67. package/src/http/mcp-bridge.ts +3 -2
  68. package/src/kv-overflow.ts +20 -0
  69. package/src/prompts/steering-delivery.ts +32 -0
  70. package/src/providers/codex-adapter.ts +20 -4
  71. package/src/providers/types.ts +8 -0
  72. package/src/script-workflows/harness.ts +5 -1
  73. package/src/script-workflows/workflow-ctx.ts +6 -7
  74. package/src/scripts-runtime/eval-harness.ts +11 -2
  75. package/src/scripts-runtime/extract-args-schema.ts +5 -1
  76. package/src/scripts-runtime/response-limit.ts +50 -0
  77. package/src/scripts-runtime/swarm-sdk.ts +3 -4
  78. package/src/tests/claude-adapter-binary.test.ts +64 -32
  79. package/src/tests/codex-steering-hook.test.ts +224 -0
  80. package/src/tests/kv-http.test.ts +35 -1
  81. package/src/tests/kv-storage.test.ts +45 -0
  82. package/src/tests/kv-tool.test.ts +51 -0
  83. package/src/tests/run-bun-tests.test.ts +171 -0
  84. package/src/tests/scripts-mcp-e2e.test.ts +105 -1
  85. package/src/tests/scripts-runtime.test.ts +33 -0
  86. package/src/tests/sdk-allowlist.test.ts +27 -1
  87. package/src/tests/slack-read-boundaries.test.ts +229 -0
  88. package/src/tests/steering-core.test.ts +19 -19
  89. package/src/tests/steering-transport.test.ts +21 -3
  90. package/src/tests/store-progress-attachments-handler.test.ts +45 -10
  91. package/src/tests/swarm-tool-result-gate.test.ts +300 -21
  92. package/src/tests/tool-output-agent-id.test.ts +9 -3
  93. package/src/tests/tool-registrar-no-input.test.ts +6 -0
  94. package/src/tools/kv/kv-get.ts +10 -0
  95. package/src/tools/kv/kv-list.ts +7 -0
  96. package/src/tools/kv/kv-read-auth.ts +13 -0
  97. package/src/tools/kv/kv-write-auth.ts +4 -0
  98. package/src/tools/steer-task.ts +1 -1
  99. package/src/tools/store-progress.ts +24 -7
  100. package/src/tools/utils.ts +403 -43
  101. package/src/types.ts +7 -1
@@ -13,22 +13,22 @@ import {
13
13
  ensure,
14
14
  require_dist,
15
15
  runScheduleNow
16
- } from "./cli-2yr6edr7.js";
16
+ } from "./cli-4xft7caa.js";
17
17
  import {
18
18
  startPricingRefreshLoop
19
- } from "./cli-qf7acvyr.js";
19
+ } from "./cli-94796kxr.js";
20
20
  import {
21
21
  seedPricingFromModelsDev
22
- } from "./cli-gzjsamwc.js";
22
+ } from "./cli-q92pr3rt.js";
23
23
  import {
24
24
  ensureRbacSeedsSynced,
25
25
  getUserGrant
26
- } from "./cli-zxb72ctk.js";
26
+ } from "./cli-3x5aphbt.js";
27
27
  import {
28
28
  can,
29
29
  decideAdmission,
30
30
  isRbacEnabled
31
- } from "./cli-y43n987v.js";
31
+ } from "./cli-gbx122ge.js";
32
32
  import {
33
33
  createTrackerAgentMapping,
34
34
  createTrackerSync,
@@ -43,7 +43,7 @@ import {
43
43
  repointTrackerSyncBySwarmId,
44
44
  updateTrackerSync,
45
45
  updateTrackerSyncSwarmId
46
- } from "./cli-gkvf8d83.js";
46
+ } from "./cli-n02497b2.js";
47
47
  import {
48
48
  TriggerSchemaError,
49
49
  applyDefinitionPatch,
@@ -57,7 +57,7 @@ import {
57
57
  startWorkflowExecution,
58
58
  validateDefinition,
59
59
  validateJsonSchema
60
- } from "./cli-kk58tg33.js";
60
+ } from "./cli-5a4nmfrn.js";
61
61
  import {
62
62
  getApiKey
63
63
  } from "./cli-f14fvzag.js";
@@ -67,7 +67,7 @@ import {
67
67
  ensureToken,
68
68
  ensureTokenOrThrow,
69
69
  onAuthorizationRefreshed
70
- } from "./cli-h89g0qrd.js";
70
+ } from "./cli-v292k2fv.js";
71
71
  import {
72
72
  ConnectionAuthInputSchema,
73
73
  assertUrlSafe,
@@ -82,7 +82,7 @@ import {
82
82
  setScriptConnectionEnabled,
83
83
  upsertCredentialBinding,
84
84
  upsertScriptConnection
85
- } from "./cli-wn3m6q54.js";
85
+ } from "./cli-dbmh9yqn.js";
86
86
  import {
87
87
  CANDIDATE_SET_MULTIPLIER,
88
88
  computeScore,
@@ -94,7 +94,7 @@ import {
94
94
  isGraphExpansionEnabled,
95
95
  rerank,
96
96
  rowToCandidate
97
- } from "./cli-p0ec4vv6.js";
97
+ } from "./cli-ff8b5cbe.js";
98
98
  import {
99
99
  createOAuthApp,
100
100
  getAuthorizationById,
@@ -104,7 +104,7 @@ import {
104
104
  getOAuthTokens,
105
105
  listAuthorizationsForApp,
106
106
  upsertOAuthApp
107
- } from "./cli-mcez7z4p.js";
107
+ } from "./cli-vvbwy286.js";
108
108
  import {
109
109
  ZodFirstPartyTypeKind,
110
110
  objectType
@@ -113,7 +113,7 @@ import {
113
113
  createAdditiveBuffer,
114
114
  extractSlackMessageText,
115
115
  parseSlackTs
116
- } from "./cli-92bqgbgy.js";
116
+ } from "./cli-zhp3t49e.js";
117
117
  import {
118
118
  findOrCreateUserByEmail,
119
119
  findUserByExternalId,
@@ -129,15 +129,15 @@ import {
129
129
  resolveIdentityByEmail,
130
130
  resolveUserByToken,
131
131
  unlinkIdentity
132
- } from "./cli-0925phzv.js";
132
+ } from "./cli-0w3mk6r2.js";
133
133
  import {
134
134
  createTaskWithSiblingAwareness
135
- } from "./cli-qwsagsmg.js";
135
+ } from "./cli-k5c6jfzn.js";
136
136
  import {
137
137
  getSlackApp,
138
138
  startSlackApp,
139
139
  stopSlackApp
140
- } from "./cli-dq2ssyf0.js";
140
+ } from "./cli-refygp3c.js";
141
141
  import {
142
142
  markdownToSlack
143
143
  } from "./cli-5ncdb7ff.js";
@@ -296,7 +296,6 @@ import {
296
296
  getSwarmRepos,
297
297
  getTaskAttachments,
298
298
  getTaskById,
299
- getTemplateDefinition,
300
299
  getUnassignedTasksCount,
301
300
  getUnreadMessages,
302
301
  getUserById,
@@ -313,25 +312,19 @@ import {
313
312
  init_credential_broker,
314
313
  init_db,
315
314
  init_defaults,
316
- init_env_flag,
317
315
  init_key,
318
- init_registry,
319
316
  init_request_auth_context,
320
- init_resolver,
321
317
  init_slack_routing,
322
318
  init_steering,
323
319
  init_swarm_config_guard,
324
320
  init_task_lifecycle_events,
325
- init_template,
326
321
  init_types,
327
322
  insertTaskAttachment,
328
323
  installMcpServer,
329
324
  installSkill,
330
- interpolate,
331
325
  isAgentEligibleForTask,
332
- isEnvFlagEnabled,
333
326
  isReservedConfigKey,
334
- isSteeringEnabled1 as isSteeringEnabled,
327
+ isSteeringEnabled,
335
328
  isTerminalTaskStatus,
336
329
  linearContextKey,
337
330
  listKv,
@@ -348,25 +341,23 @@ import {
348
341
  normalizeAssetKey,
349
342
  onTaskStarted,
350
343
  parseAssetKey,
351
- parseEnvFlag,
352
344
  placeholderForConfigKey,
353
345
  postMessage,
354
346
  reassociateSessionLogs,
355
347
  recordBudgetRefusalNotification,
356
- registerTemplate,
357
348
  rejectTask,
358
349
  releaseMentionProcessing,
359
350
  releaseTask,
360
351
  requestSteering,
361
352
  reservedKeyError,
362
353
  resetEmptyPollCount,
363
- resolveTemplate,
364
354
  searchSkills,
365
355
  setBudgetRefusalFollowUpTaskId,
366
356
  setRequestAuth,
367
357
  shouldBlockPolling,
368
358
  splitLegacyModelAlias,
369
359
  startTask,
360
+ sweepExpiredKvPrefix,
370
361
  uninstallMcpServer,
371
362
  uninstallSkill,
372
363
  updateAgentName,
@@ -390,11 +381,23 @@ import {
390
381
  upsertService,
391
382
  upsertSwarmConfig,
392
383
  validateConfigValue
393
- } from "./cli-3z4q09tn.js";
384
+ } from "./cli-yr11vvst.js";
385
+ import {
386
+ getTemplateDefinition,
387
+ init_env_flag,
388
+ init_registry,
389
+ init_resolver,
390
+ init_template,
391
+ interpolate,
392
+ isEnvFlagEnabled,
393
+ parseEnvFlag,
394
+ registerTemplate,
395
+ resolveTemplate
396
+ } from "./cli-k1py8264.js";
394
397
  import {
395
398
  init_package,
396
399
  package_default
397
- } from "./cli-p0zgv8pj.js";
400
+ } from "./cli-8vzddbs7.js";
398
401
  import {
399
402
  init_secret_scrubber,
400
403
  refreshSecretScrubberCache,
@@ -22851,7 +22854,7 @@ async function notifySlack(text) {
22851
22854
  return;
22852
22855
  }
22853
22856
  try {
22854
- const { getSlackApp: getSlackApp2 } = await import("./app-q2rc9tdr.js");
22857
+ const { getSlackApp: getSlackApp2 } = await import("./app-xbt4n4mt.js");
22855
22858
  const app = getSlackApp2();
22856
22859
  if (!app) {
22857
22860
  console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
@@ -22920,7 +22923,7 @@ async function deleteJiraWebhook(webhookId) {
22920
22923
  console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
22921
22924
  }
22922
22925
  async function overwriteWebhookIds(next) {
22923
- const { getDb: getDb2 } = await import("./db-vn9e4rqj.js");
22926
+ const { getDb: getDb2 } = await import("./db-r5705rk8.js");
22924
22927
  const db = getDb2();
22925
22928
  const txn = db.transaction(() => {
22926
22929
  const row = db.query("SELECT metadata FROM oauth_apps WHERE provider = 'jira'").get();
@@ -97786,6 +97789,22 @@ init_db();
97786
97789
 
97787
97790
  // src/tools/utils.ts
97788
97791
  init_zod();
97792
+ init_db();
97793
+
97794
+ // src/kv-overflow.ts
97795
+ var MCP_OVERFLOW_NAMESPACE = "mcp:overflow";
97796
+ function mcpOverflowNamespace(agentId) {
97797
+ return `${MCP_OVERFLOW_NAMESPACE}:${agentId}`;
97798
+ }
97799
+ function mcpOverflowAuthError(namespace, agentId) {
97800
+ if (namespace !== MCP_OVERFLOW_NAMESPACE && !namespace.startsWith(`${MCP_OVERFLOW_NAMESPACE}:`)) {
97801
+ return null;
97802
+ }
97803
+ if (agentId && namespace === mcpOverflowNamespace(agentId)) {
97804
+ return null;
97805
+ }
97806
+ return "access to another agent's MCP overflow namespace is forbidden";
97807
+ }
97789
97808
 
97790
97809
  // src/otel.ts
97791
97810
  function otelConfigured() {
@@ -97816,7 +97835,7 @@ async function initOtel(serviceRole = process.env.AGENT_ROLE || "api") {
97816
97835
  return;
97817
97836
  initialized6 = true;
97818
97837
  try {
97819
- const impl = await import("./otel-impl-7yjkfg68.js");
97838
+ const impl = await import("./otel-impl-vja8f9mm.js");
97820
97839
  await impl.boot(serviceRole);
97821
97840
  realWithSpan = impl.withSpan;
97822
97841
  realStartSpan = impl.startSpan;
@@ -97868,6 +97887,11 @@ function recordSessionCost(m) {
97868
97887
 
97869
97888
  // src/tools/utils.ts
97870
97889
  init_secret_scrubber();
97890
+ var scriptSdkRequestOrigins = new WeakSet;
97891
+ function markScriptSdkRequestOrigin(meta2) {
97892
+ scriptSdkRequestOrigins.add(meta2);
97893
+ return meta2;
97894
+ }
97871
97895
  var getRequestInfo = (req) => {
97872
97896
  const agentIdHeader = req.requestInfo?.headers?.["x-agent-id"];
97873
97897
  const sourceTaskIdHeader = req.requestInfo?.headers?.["x-source-task-id"];
@@ -97894,7 +97918,8 @@ var getRequestInfo = (req) => {
97894
97918
  sessionId: req.sessionId || undefined,
97895
97919
  agentId,
97896
97920
  sourceTaskId,
97897
- contextKey
97921
+ contextKey,
97922
+ callOrigin: scriptSdkRequestOrigins.has(req) ? "script-sdk" : "mcp"
97898
97923
  };
97899
97924
  };
97900
97925
  var PREVIEW_LIMIT = 500;
@@ -97929,11 +97954,19 @@ function toolResultAttributes(result) {
97929
97954
  }
97930
97955
  var toolOk = (message, extras = {}) => ({ ok: true, message, ...extras });
97931
97956
  var toolErr = (message, extras = {}) => ({ ok: false, message, ...extras });
97957
+ var swarmToolTruncationSchema = looseObject({
97958
+ truncated: literal(true),
97959
+ fullValueAt: string(),
97960
+ originalBytes: number(),
97961
+ limitBytes: number(),
97962
+ retrieval: string()
97963
+ });
97932
97964
  var swarmToolEnvelopeShape = {
97933
97965
  success: boolean(),
97934
97966
  message: string(),
97935
97967
  details: string().optional(),
97936
- nudge: string().optional()
97968
+ nudge: string().optional(),
97969
+ truncation: swarmToolTruncationSchema.optional()
97937
97970
  };
97938
97971
  var swarmToolOutputSchema = (dataShape) => looseObject({ ...swarmToolEnvelopeShape, ...dataShape ?? {} });
97939
97972
  var SCRIPT_AUTHORING_NUDGE = "Scripts must `export default async function (args, ctx)` — args FIRST, ctx second; run script-query-types (no name) for the full ctx/SDK type surface, and see the `swarm-scripts` skill for authoring patterns.";
@@ -97955,15 +97988,20 @@ var NUDGES = {
97955
97988
  return;
97956
97989
  const results = r.data?.results;
97957
97990
  return Array.isArray(results) && results.some((entry) => Boolean(entry?.rateHint)) ? "Rate memories that help or mislead you with memory_rate." : undefined;
97991
+ },
97992
+ "kv-get": (r) => {
97993
+ if (!r.ok)
97994
+ return;
97995
+ const entry = r.data?.entry;
97996
+ if (!entry)
97997
+ return;
97998
+ const rendered = typeof entry.value === "string" ? entry.value : JSON.stringify(entry.value) ?? "";
97999
+ return rendered.length > MCP_RESULT_WIRE_LIMIT_BYTES ? "Large value — your harness may truncate this result; to filter or aggregate it, process it in a script via ctx.swarm.kv_get instead." : undefined;
97958
98000
  }
97959
98001
  };
97960
- var DETAILS_CAP = 8000;
97961
- function truncateForText(text) {
97962
- if (text.length <= DETAILS_CAP)
97963
- return text;
97964
- return `${text.slice(0, DETAILS_CAP)}
97965
- … [truncated ${text.length - DETAILS_CAP} chars]`;
97966
- }
98002
+ var MCP_RESULT_WIRE_LIMIT_BYTES = 1e4;
98003
+ var MCP_OVERFLOW_TTL_MS = 24 * 60 * 60 * 1000;
98004
+ var MCP_PROSE_PREVIEW_CHARS = 1200;
97967
98005
  var scrubMiddleware = (result) => result.allowSecretEgress ? result : scrubObject(result);
97968
98006
  var nudgeMiddleware = (result, ctx) => {
97969
98007
  if (result.nudge)
@@ -97971,21 +98009,10 @@ var nudgeMiddleware = (result, ctx) => {
97971
98009
  const nudge = NUDGES[ctx.toolName]?.(result);
97972
98010
  return nudge ? { ...result, nudge } : result;
97973
98011
  };
97974
- var FINALIZE_PIPELINE = [scrubMiddleware, nudgeMiddleware];
97975
- function finalizeSwarmToolResult(toolName, result) {
97976
- let r = result;
97977
- if (!r.message?.trim()) {
97978
- console.warn(`[mcp] tool ${toolName} returned an empty message — every tool must summarize`);
97979
- r = {
97980
- ...r,
97981
- message: r.ok ? "Tool call succeeded (no message provided)." : "Tool call failed (no message provided)."
97982
- };
97983
- }
97984
- for (const middleware of FINALIZE_PIPELINE)
97985
- r = middleware(r, { toolName });
97986
- const explicitDetails = r.details?.trim() ? truncateForText(r.details.trim()) : undefined;
97987
- const dataFallback = !explicitDetails && r.data && Object.keys(r.data).length > 0 ? truncateForText(JSON.stringify(r.data, null, 2)) : undefined;
97988
- const text = [r.message, explicitDetails ?? dataFallback, r.nudge].filter((part) => Boolean(part?.trim())).join(`
98012
+ function composeWireResult(r) {
98013
+ const normalizedDetails = r.details?.trim() || undefined;
98014
+ const dataFallback = !normalizedDetails && r.data && Object.keys(r.data).length > 0 ? JSON.stringify(r.data, null, 2) : undefined;
98015
+ const text = [r.message, r.nudge, normalizedDetails ?? dataFallback].filter((part) => Boolean(part?.trim())).join(`
97989
98016
 
97990
98017
  `);
97991
98018
  const structuredContent = {
@@ -97993,16 +98020,252 @@ function finalizeSwarmToolResult(toolName, result) {
97993
98020
  success: r.ok,
97994
98021
  message: r.message
97995
98022
  };
97996
- if (explicitDetails)
97997
- structuredContent.details = explicitDetails;
98023
+ if (normalizedDetails)
98024
+ structuredContent.details = normalizedDetails;
97998
98025
  if (r.nudge)
97999
98026
  structuredContent.nudge = r.nudge;
98027
+ if (r.truncation)
98028
+ structuredContent.truncation = r.truncation;
98000
98029
  return {
98001
98030
  content: [{ type: "text", text }],
98002
98031
  structuredContent,
98003
98032
  isError: !r.ok
98004
98033
  };
98005
98034
  }
98035
+ function overflowKey(toolName, value) {
98036
+ const safeToolName = toolName.replace(/[^a-zA-Z0-9._-]/g, "-").slice(0, 80);
98037
+ const hash = new Bun.CryptoHasher("sha256").update(value).digest("hex");
98038
+ return `v1/${safeToolName}/${hash}`;
98039
+ }
98040
+ function overflowRetrieval(namespace, key) {
98041
+ return `kv-get(${JSON.stringify({ namespace, key })}) returns the full value ` + `(your harness may truncate it); to filter or aggregate it instead, ` + `process it in a script via ctx.swarm.kv_get.`;
98042
+ }
98043
+ function canonicalOverflowPayload(toolName, result) {
98044
+ const safe = result.allowSecretEgress ? scrubObject(result) : result;
98045
+ return JSON.stringify({
98046
+ version: 1,
98047
+ toolName,
98048
+ outcome: {
98049
+ ok: safe.ok,
98050
+ message: safe.message,
98051
+ ...safe.details ? { details: safe.details } : {},
98052
+ ...safe.data ? { data: safe.data } : {},
98053
+ ...safe.nudge ? { nudge: safe.nudge } : {}
98054
+ }
98055
+ });
98056
+ }
98057
+ var CTX_CONTROL_EXEMPT_TOOLS = new Set(["kv-get"]);
98058
+ function cloneResultData(value) {
98059
+ if (Array.isArray(value))
98060
+ return value.map(cloneResultData);
98061
+ if (!value || typeof value !== "object")
98062
+ return value;
98063
+ return Object.fromEntries(Object.entries(value).map(([key, child]) => [
98064
+ key,
98065
+ cloneResultData(child)
98066
+ ]));
98067
+ }
98068
+ function collectArrayTargets(value, path, targets, parent, key) {
98069
+ if (Array.isArray(value)) {
98070
+ if (parent !== undefined && key !== undefined && value.length > 0) {
98071
+ targets.push({ path, parent, key, originalItems: value.slice() });
98072
+ }
98073
+ return;
98074
+ }
98075
+ if (!value || typeof value !== "object")
98076
+ return;
98077
+ for (const [childKey, child] of Object.entries(value)) {
98078
+ collectArrayTargets(child, `${path}.${childKey}`, targets, value, childKey);
98079
+ }
98080
+ }
98081
+ function setArrayLength(target, length) {
98082
+ target.parent[target.key] = target.originalItems.slice(0, length);
98083
+ }
98084
+ function currentArrayLength(target) {
98085
+ const value = target.parent[target.key];
98086
+ return Array.isArray(value) ? value.length : 0;
98087
+ }
98088
+ function pruneBranchesWithoutArrays(value) {
98089
+ if (Array.isArray(value))
98090
+ return true;
98091
+ if (!value || typeof value !== "object")
98092
+ return false;
98093
+ let containsArray = false;
98094
+ for (const [key, child] of Object.entries(value)) {
98095
+ if (pruneBranchesWithoutArrays(child)) {
98096
+ containsArray = true;
98097
+ } else {
98098
+ delete value[key];
98099
+ }
98100
+ }
98101
+ return containsArray;
98102
+ }
98103
+ function arrayTruncationMessage(message, targets) {
98104
+ const truncatedTargets = targets.filter((target) => currentArrayLength(target) < target.originalItems.length);
98105
+ if (truncatedTargets.length === 1) {
98106
+ const [target] = truncatedTargets;
98107
+ if (target) {
98108
+ const kept = currentArrayLength(target);
98109
+ const original = target.originalItems.length;
98110
+ const originalCount = new RegExp(`\\b${original}\\b`);
98111
+ if (originalCount.test(message)) {
98112
+ const rewritten = message.replace(originalCount, String(kept)).replace(/\.\s*$/, "");
98113
+ return `${rewritten} (truncated from ${original}; ${target.path} shortened in this bounded response).`;
98114
+ }
98115
+ }
98116
+ }
98117
+ const summaries = truncatedTargets.map((target) => `${currentArrayLength(target)} of ${target.originalItems.length} ${target.path} item(s)`);
98118
+ if (summaries.length === 0)
98119
+ return message;
98120
+ return `${message} Returned ${summaries.join(", ")} in this bounded response.`;
98121
+ }
98122
+ function arrayPreservingOverflowResult(result, data, targets, truncation, pointer) {
98123
+ const normalizedDetails = result.details?.trim() || undefined;
98124
+ const details = normalizedDetails ? `${normalizedDetails.slice(0, MCP_PROSE_PREVIEW_CHARS)}
98125
+ … [truncated ${Math.max(normalizedDetails.length - MCP_PROSE_PREVIEW_CHARS, 0)} chars]
98126
+ ${pointer}` : `JSON payload truncated in place:
98127
+ ${JSON.stringify(data, null, 2)}
98128
+ ${pointer}`;
98129
+ return {
98130
+ ok: result.ok,
98131
+ message: arrayTruncationMessage(result.message, targets),
98132
+ details,
98133
+ data,
98134
+ nudge: result.nudge,
98135
+ truncation
98136
+ };
98137
+ }
98138
+ function truncateArraysInPlace(result, truncation, pointer) {
98139
+ if (!result.data)
98140
+ return;
98141
+ const data = cloneResultData(result.data);
98142
+ const targets = [];
98143
+ collectArrayTargets(data, "data", targets);
98144
+ if (targets.length === 0)
98145
+ return;
98146
+ targets.sort((a, b) => Buffer.byteLength(JSON.stringify(b.originalItems), "utf8") - Buffer.byteLength(JSON.stringify(a.originalItems), "utf8"));
98147
+ const render = () => arrayPreservingOverflowResult(result, data, targets, truncation, pointer);
98148
+ const fits = () => Buffer.byteLength(JSON.stringify(composeWireResult(render())), "utf8") <= MCP_RESULT_WIRE_LIMIT_BYTES;
98149
+ for (const target of targets) {
98150
+ setArrayLength(target, 0);
98151
+ if (!fits())
98152
+ continue;
98153
+ let low = 0;
98154
+ let high = target.originalItems.length;
98155
+ while (low < high) {
98156
+ const mid = Math.ceil((low + high) / 2);
98157
+ setArrayLength(target, mid);
98158
+ if (fits())
98159
+ low = mid;
98160
+ else
98161
+ high = mid - 1;
98162
+ }
98163
+ setArrayLength(target, low);
98164
+ return render();
98165
+ }
98166
+ if (fits())
98167
+ return render();
98168
+ pruneBranchesWithoutArrays(data);
98169
+ if (!fits())
98170
+ return;
98171
+ for (const target of targets) {
98172
+ let low = 0;
98173
+ let high = target.originalItems.length;
98174
+ while (low < high) {
98175
+ const mid = Math.ceil((low + high) / 2);
98176
+ setArrayLength(target, mid);
98177
+ if (fits())
98178
+ low = mid;
98179
+ else
98180
+ high = mid - 1;
98181
+ }
98182
+ setArrayLength(target, low);
98183
+ }
98184
+ return render();
98185
+ }
98186
+ var ctxControlMiddleware = (result, ctx) => {
98187
+ if (ctx.callOrigin === "script-sdk")
98188
+ return result;
98189
+ if (CTX_CONTROL_EXEMPT_TOOLS.has(ctx.toolName))
98190
+ return result;
98191
+ const fullWire = composeWireResult(result);
98192
+ const fullWireJson = JSON.stringify(fullWire);
98193
+ const fullWireBytes = Buffer.byteLength(fullWireJson, "utf8");
98194
+ if (fullWireBytes <= MCP_RESULT_WIRE_LIMIT_BYTES) {
98195
+ return result;
98196
+ }
98197
+ let fullValueAt;
98198
+ let retrieval;
98199
+ if (ctx.agentId) {
98200
+ const storedValue = canonicalOverflowPayload(ctx.toolName, result);
98201
+ const key = overflowKey(ctx.toolName, storedValue);
98202
+ const namespace = mcpOverflowNamespace(ctx.agentId);
98203
+ fullValueAt = `kv://${namespace}/${key}`;
98204
+ retrieval = overflowRetrieval(namespace, key);
98205
+ const expiresAt = Date.now() + MCP_OVERFLOW_TTL_MS;
98206
+ sweepExpiredKvPrefix(MCP_OVERFLOW_NAMESPACE);
98207
+ upsertKv({
98208
+ namespace,
98209
+ key,
98210
+ value: storedValue,
98211
+ valueType: "string",
98212
+ expiresAt
98213
+ });
98214
+ } else {
98215
+ fullValueAt = "unavailable: authenticated agent identity required";
98216
+ retrieval = "Retry the tool with an authenticated X-Agent-ID to retain the full value.";
98217
+ }
98218
+ const truncation = {
98219
+ truncated: true,
98220
+ fullValueAt,
98221
+ originalBytes: fullWireBytes,
98222
+ limitBytes: MCP_RESULT_WIRE_LIMIT_BYTES,
98223
+ retrieval
98224
+ };
98225
+ const pointer = `Full value: ${fullValueAt}
98226
+ Retrieval: ${retrieval}
98227
+ ` + `Truncation: ${JSON.stringify(truncation)}`;
98228
+ const arrayPreservingResult = truncateArraysInPlace(result, truncation, pointer);
98229
+ if (arrayPreservingResult)
98230
+ return arrayPreservingResult;
98231
+ const normalizedDetails = result.details?.trim() || undefined;
98232
+ const details = normalizedDetails ? `${normalizedDetails.slice(0, MCP_PROSE_PREVIEW_CHARS)}
98233
+ … [truncated ${Math.max(normalizedDetails.length - MCP_PROSE_PREVIEW_CHARS, 0)} chars]
98234
+ ${pointer}` : `JSON payload omitted because the composed result exceeded ${MCP_RESULT_WIRE_LIMIT_BYTES} bytes.
98235
+ ${pointer}`;
98236
+ return {
98237
+ ok: result.ok,
98238
+ message: result.message,
98239
+ details,
98240
+ nudge: result.nudge,
98241
+ truncation
98242
+ };
98243
+ };
98244
+ var FINALIZE_PIPELINE = [
98245
+ scrubMiddleware,
98246
+ nudgeMiddleware,
98247
+ ctxControlMiddleware
98248
+ ];
98249
+ function finalizeSwarmToolResult(toolName, result, requestInfo = {
98250
+ agentId: undefined
98251
+ }) {
98252
+ let r = result;
98253
+ if (!r.message?.trim()) {
98254
+ console.warn(`[mcp] tool ${toolName} returned an empty message — every tool must summarize`);
98255
+ r = {
98256
+ ...r,
98257
+ message: r.ok ? "Tool call succeeded (no message provided)." : "Tool call failed (no message provided)."
98258
+ };
98259
+ }
98260
+ for (const middleware of FINALIZE_PIPELINE) {
98261
+ r = middleware(r, {
98262
+ toolName,
98263
+ agentId: requestInfo.agentId,
98264
+ callOrigin: requestInfo.callOrigin ?? "mcp"
98265
+ });
98266
+ }
98267
+ return composeWireResult(r);
98268
+ }
98006
98269
  var createToolRegistrar = (server) => {
98007
98270
  return (name, config, cb) => {
98008
98271
  if (config.inputSchema === undefined) {
@@ -98010,7 +98273,7 @@ var createToolRegistrar = (server) => {
98010
98273
  const requestInfo = getRequestInfo(meta2);
98011
98274
  return withSpan("mcp.tool", async (span) => {
98012
98275
  const outcome = await cb(requestInfo, meta2);
98013
- const result = finalizeSwarmToolResult(name, outcome);
98276
+ const result = finalizeSwarmToolResult(name, outcome, requestInfo);
98014
98277
  span.setAttributes(toolResultAttributes(result));
98015
98278
  return result;
98016
98279
  }, toolRequestAttributes(name, requestInfo));
@@ -98020,7 +98283,7 @@ var createToolRegistrar = (server) => {
98020
98283
  const requestInfo = getRequestInfo(meta2);
98021
98284
  return withSpan(`mcp.tool ${name}`, async (span) => {
98022
98285
  const outcome = await cb(args, requestInfo, meta2);
98023
- const result = finalizeSwarmToolResult(name, outcome);
98286
+ const result = finalizeSwarmToolResult(name, outcome, requestInfo);
98024
98287
  span.setAttributes(toolResultAttributes(result));
98025
98288
  return result;
98026
98289
  }, toolRequestAttributes(name, requestInfo, args));
@@ -100251,6 +100514,9 @@ init_types();
100251
100514
  // src/tools/kv/kv-write-auth.ts
100252
100515
  init_db();
100253
100516
  function kvWriteAuthError(namespace, info) {
100517
+ const overflowAuthErr = mcpOverflowAuthError(namespace, info.agentId);
100518
+ if (overflowAuthErr)
100519
+ return overflowAuthErr;
100254
100520
  if (namespace.startsWith("task:page:")) {
100255
100521
  return "task:page:* writes require a page-proxy request, not an MCP call";
100256
100522
  }
@@ -100334,6 +100600,13 @@ var registerKvDeleteTool = (server) => {
100334
100600
  init_zod();
100335
100601
  init_db();
100336
100602
  init_types();
100603
+
100604
+ // src/tools/kv/kv-read-auth.ts
100605
+ function kvReadAuthError(namespace, info) {
100606
+ return mcpOverflowAuthError(namespace, info.agentId);
100607
+ }
100608
+
100609
+ // src/tools/kv/kv-get.ts
100337
100610
  var kvEntryOutputSchema = looseObject({
100338
100611
  namespace: string().optional(),
100339
100612
  key: string().optional(),
@@ -100367,6 +100640,12 @@ var registerKvGetTool = (server) => {
100367
100640
  if ("error" in resolved) {
100368
100641
  return toolErr(resolved.error, { data: { yourAgentId: requestInfo.agentId } });
100369
100642
  }
100643
+ const authErr = kvReadAuthError(resolved.namespace, { agentId: requestInfo.agentId });
100644
+ if (authErr) {
100645
+ return toolErr(authErr, {
100646
+ data: { yourAgentId: requestInfo.agentId, namespace: resolved.namespace }
100647
+ });
100648
+ }
100370
100649
  const entry = getKv(resolved.namespace, key);
100371
100650
  return toolOk(entry ? `Found "${key}" in "${resolved.namespace}".` : `No entry for "${key}" in "${resolved.namespace}".`, {
100372
100651
  details: entry ? renderKvEntry(entry) : undefined,
@@ -100480,6 +100759,12 @@ var registerKvListTool = (server) => {
100480
100759
  if ("error" in resolved) {
100481
100760
  return toolErr(resolved.error, { data: { yourAgentId: requestInfo.agentId } });
100482
100761
  }
100762
+ const authErr = kvReadAuthError(resolved.namespace, { agentId: requestInfo.agentId });
100763
+ if (authErr) {
100764
+ return toolErr(authErr, {
100765
+ data: { yourAgentId: requestInfo.agentId, namespace: resolved.namespace }
100766
+ });
100767
+ }
100483
100768
  const effectiveLimit = Math.min(limit ?? 100, MAX_KV_LIST_LIMIT);
100484
100769
  const effectivePrefix = prefix && prefix.length > 0 ? prefix : undefined;
100485
100770
  const entries = listKv(resolved.namespace, {
@@ -104826,17 +105111,17 @@ var scriptToolOutputSchema = swarmToolOutputSchema({
104826
105111
  status: number().optional(),
104827
105112
  data: unknown().optional()
104828
105113
  });
104829
- var DETAILS_CAP2 = 16000;
105114
+ var DETAILS_CAP = 16000;
104830
105115
  function stripAnsi(text) {
104831
105116
  return text.replace(/\x1b\[[0-9;]*m/g, "");
104832
105117
  }
104833
105118
  function capDetails(text) {
104834
105119
  if (!text)
104835
105120
  return;
104836
- if (text.length <= DETAILS_CAP2)
105121
+ if (text.length <= DETAILS_CAP)
104837
105122
  return text;
104838
- return `${text.slice(0, DETAILS_CAP2)}
104839
- … [truncated ${text.length - DETAILS_CAP2} chars]`;
105123
+ return `${text.slice(0, DETAILS_CAP)}
105124
+ … [truncated ${text.length - DETAILS_CAP} chars]`;
104840
105125
  }
104841
105126
  function isRecord(value) {
104842
105127
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -107898,7 +108183,7 @@ async function steerTaskHandler(ctx, { taskId, message, mode = "queue", onUnsupp
107898
108183
  var registerSteerTaskTool = (server) => {
107899
108184
  createToolRegistrar(server)("steer-task", {
107900
108185
  title: "Steer Task",
107901
- description: 'Send a message to a task that is already running. `mode:"steer"` is honored on pi and claude-managed; claude, devin and opencode support queue only; codex always promotes the message to a follow-up task. Pass `onUnsupported:"fail"` to get an error instead of a downgrade.',
108186
+ description: 'Send a message to a task that is already running. `mode:"steer"` is honored on pi and claude-managed; claude, devin, opencode and codex support queue only (codex delivery lands at the next tool-call boundary via its lifecycle hooks). Pass `onUnsupported:"fail"` to get an error instead of a downgrade.',
107902
108187
  annotations: { destructiveHint: true },
107903
108188
  inputSchema: steerTaskInputSchema,
107904
108189
  outputSchema: steerTaskOutputSchema
@@ -108180,7 +108465,11 @@ var shouldPersistTaskCompletionMemory = shouldPersistAutomaticTaskMemory;
108180
108465
  // src/tools/store-progress.ts
108181
108466
  init_types();
108182
108467
  var storeProgressOutputSchema = swarmToolOutputSchema({
108183
- task: looseAgentTaskOutputSchema.optional(),
108468
+ task: looseObject({
108469
+ id: string(),
108470
+ status: AgentTaskStatusSchema,
108471
+ finishedAt: string().optional()
108472
+ }).optional(),
108184
108473
  yourAgentId: string().optional(),
108185
108474
  wasNoOp: boolean().optional().describe("True when the call was a no-op because the task was already in a terminal state (completed/failed/cancelled). First-call-wins.")
108186
108475
  });
@@ -108459,8 +108748,17 @@ ${taskContent}`,
108459
108748
  console.warn(`[store-progress] Failed to create follow-up task: ${err}`);
108460
108749
  }
108461
108750
  }
108462
- const { success, message, ...rest } = result;
108463
- const data = { yourAgentId: requestInfo.agentId, ...rest };
108751
+ const { success, message } = result;
108752
+ const task = result.task ? {
108753
+ id: result.task.id,
108754
+ status: result.task.status,
108755
+ ...result.task.finishedAt ? { finishedAt: result.task.finishedAt } : {}
108756
+ } : undefined;
108757
+ const data = {
108758
+ yourAgentId: requestInfo.agentId,
108759
+ ...task ? { task } : {},
108760
+ ..."wasNoOp" in result && result.wasNoOp ? { wasNoOp: true } : {}
108761
+ };
108464
108762
  return success ? toolOk(message, { data }) : toolErr(message, { data });
108465
108763
  });
108466
108764
  };
@@ -111057,4 +111355,4 @@ function writeSkillsToFilesystem(entries, harnessType = "all", home) {
111057
111355
  return { synced, removed, errors };
111058
111356
  }
111059
111357
 
111060
- export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, McpServer, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2 as handleIssue1, handleNote, handlePipeline, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, registerJiraWebhook, deleteJiraWebhook, isJiraEnabled, initJira, handleJiraWebhook, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, isLinearEnabled, initLinear, setCorsHeaders, parseQueryParams, getPathSegments, safeRequestUrlForLog, agentWithCapacity, parseBody, BODY_TOO_LARGE, enforceContentLengthCap, json, jsonError, triggerSchemaErrorResponse, deriveApiBaseUrl, httpServerSemconvAttributes, describeRequestRoute, route, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, isPollTracingEnabled, initOtel, withSpan, startSpan, withSpanContext, withRemoteContext, injectTraceContext, recordSessionCost, toolErr, createToolRegistrar, userCtx, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, assertSelectOnlyQuery, executeReadOnlyQuery, handleDbQuery, snapshotMetric, AssetKeyAuthorizationError, authorizeAssetKeyWrite, resolveTaskAuditUserId, resolveHttpAuditUserId, snapshotPage, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, scopedResourceScopeIdSchema, resolveScopedResourceId, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, storeLinks, refreshLinks, canReadMemory, getLinksForMemory, recordRetrievals, expandCandidatesWithGraph, markKapsoMessageRead, sendKapsoReaction, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, mergeScheduleTiming, validateRecurringTiming, sendTaskOutputSchema, sendTaskHandler, parseSkillContent, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, ExplicitSelfDuplicateError, applyRating, shouldPersistAutomaticTaskMemory, canClaim, emitBudgetRefusalSideEffects, taskActionInputSchema, taskActionOutputSchema, taskActionHandler, resolveScriptsOnlyMode, hasCapability, getEnabledCapabilities, createServer, writeSkillsToFilesystem };
111358
+ export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, McpServer, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2 as handleIssue1, handleNote, handlePipeline, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, registerJiraWebhook, deleteJiraWebhook, isJiraEnabled, initJira, handleJiraWebhook, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, isLinearEnabled, initLinear, setCorsHeaders, parseQueryParams, getPathSegments, safeRequestUrlForLog, agentWithCapacity, parseBody, BODY_TOO_LARGE, enforceContentLengthCap, json, jsonError, triggerSchemaErrorResponse, deriveApiBaseUrl, httpServerSemconvAttributes, describeRequestRoute, route, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, mcpOverflowAuthError, isPollTracingEnabled, initOtel, withSpan, startSpan, withSpanContext, withRemoteContext, injectTraceContext, recordSessionCost, markScriptSdkRequestOrigin, toolErr, createToolRegistrar, userCtx, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, assertSelectOnlyQuery, executeReadOnlyQuery, handleDbQuery, snapshotMetric, AssetKeyAuthorizationError, authorizeAssetKeyWrite, resolveTaskAuditUserId, resolveHttpAuditUserId, snapshotPage, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, scopedResourceScopeIdSchema, resolveScopedResourceId, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, storeLinks, refreshLinks, canReadMemory, getLinksForMemory, recordRetrievals, expandCandidatesWithGraph, markKapsoMessageRead, sendKapsoReaction, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, mergeScheduleTiming, validateRecurringTiming, sendTaskOutputSchema, sendTaskHandler, parseSkillContent, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, ExplicitSelfDuplicateError, applyRating, shouldPersistAutomaticTaskMemory, canClaim, emitBudgetRefusalSideEffects, taskActionInputSchema, taskActionOutputSchema, taskActionHandler, resolveScriptsOnlyMode, hasCapability, getEnabledCapabilities, createServer, writeSkillsToFilesystem };