@desplega.ai/agent-swarm 2.4.1 → 2.4.2

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 (109) hide show
  1. package/dist/{acp-adapter-zvzr538d.js → acp-adapter-dv7hmx4r.js} +1 -1
  2. package/dist/{actions-jhtqdw69.js → actions-51nc1gny.js} +16 -16
  3. package/dist/{amp-adapter-bd84rhs2.js → amp-adapter-abp5tdx8.js} +1 -1
  4. package/dist/{app-kreq1gwg.js → app-9h14qvr6.js} +3 -3
  5. package/dist/{assistant-3k22sbsq.js → assistant-wv1gz3mt.js} +17 -17
  6. package/dist/{boot-reembed-e53x6b9v.js → boot-reembed-6yn53ms9.js} +1 -1
  7. package/dist/{boot-reembed-f6z923ny.js → boot-reembed-7fcka4z5.js} +1 -1
  8. package/dist/{boot-scrub-sweep-0538vsb7.js → boot-scrub-sweep-pm1580ax.js} +2 -2
  9. package/dist/{boot-seeds-6wxqkfk2.js → boot-seeds-g5hfc1x8.js} +4 -4
  10. package/dist/{claude-adapter-gfts5044.js → claude-adapter-gf3kxhf0.js} +2 -2
  11. package/dist/{claude-sdk-session-56besmfz.js → claude-sdk-session-s2k1qd8y.js} +2 -2
  12. package/dist/{cli-tbhwrxpt.js → cli-02qm7src.js} +3 -3
  13. package/dist/{cli-3kh4kpqy.js → cli-0qvtffe9.js} +5 -5
  14. package/dist/{cli-p6argxh9.js → cli-10hhg0km.js} +6 -6
  15. package/dist/{cli-gf0kfg81.js → cli-239yjk27.js} +2 -2
  16. package/dist/{cli-kr2pmfqx.js → cli-5rk36sjf.js} +72 -59
  17. package/dist/{cli-nx462e4v.js → cli-7awf1fp8.js} +1 -1
  18. package/dist/{cli-jh0qcrga.js → cli-8sxqsbbq.js} +1 -1
  19. package/dist/{cli-axh29tyr.js → cli-8zwe9mpk.js} +5 -5
  20. package/dist/{cli-z1ew8vbq.js → cli-ahtpy9kf.js} +1 -1
  21. package/dist/{cli-3r448dqn.js → cli-bcj753sq.js} +3 -3
  22. package/dist/{cli-rqqsfz30.js → cli-d3qqdy4c.js} +82 -12
  23. package/dist/{cli-z071fb95.js → cli-efaqv1c7.js} +4 -4
  24. package/dist/{cli-s48yvzb8.js → cli-faypxz7q.js} +3 -3
  25. package/dist/{cli-m2qgh5sv.js → cli-ftyypbg5.js} +1 -1
  26. package/dist/{cli-6ncjvx55.js → cli-fyzjmseb.js} +1 -1
  27. package/dist/{cli-0bh477zn.js → cli-h38rjv87.js} +117 -9
  28. package/dist/{cli-3p8fqcnh.js → cli-h93c9vb3.js} +1 -1
  29. package/dist/{cli-rdq7tzwm.js → cli-hyfw2j1e.js} +8 -8
  30. package/dist/{cli-bn5kevnf.js → cli-n85dqg6d.js} +2 -2
  31. package/dist/{cli-fz9kewbh.js → cli-nmqdc2t3.js} +1 -1
  32. package/dist/{cli-vy0fay6k.js → cli-nn47d7e8.js} +10 -10
  33. package/dist/{cli-mfe7f7b5.js → cli-pkht5hap.js} +1 -1
  34. package/dist/{cli-xftrvxag.js → cli-r99kc9yq.js} +1 -1
  35. package/dist/{cli-p0rakbrk.js → cli-rdyw3mct.js} +1 -1
  36. package/dist/{cli-sjyetj21.js → cli-s6vr7r2d.js} +1 -1
  37. package/dist/{cli-k9z4zd4p.js → cli-saw9a6f6.js} +2 -2
  38. package/dist/{cli-ash6xxk7.js → cli-shvfedvm.js} +2 -2
  39. package/dist/{cli-syhq378v.js → cli-t30yj95q.js} +1 -1
  40. package/dist/{cli-kmqgmcnb.js → cli-y2x52gs2.js} +4 -4
  41. package/dist/{cli-471qk6s2.js → cli-y8n5k515.js} +14 -14
  42. package/dist/{cli-3tnpj2bh.js → cli-z4wd2ftv.js} +1 -1
  43. package/dist/cli.js +12 -12
  44. package/dist/{codex-adapter-p6rmm7vv.js → codex-adapter-ttygw382.js} +1 -1
  45. package/dist/{codex-session-runner-8vd5t9t0.js → codex-session-runner-60b58vv3.js} +1 -1
  46. package/dist/{commands-7ems2p13.js → commands-edmdwa4x.js} +2 -2
  47. package/dist/{controllers-connect-bg33ae53.js → controllers-connect-5fym8sw1.js} +16 -16
  48. package/dist/{db-ys2rbdft.js → db-2y0mgstc.js} +3 -3
  49. package/dist/{db-w505dwa8.js → db-nn0hcmx5.js} +5 -1
  50. package/dist/{dispatcher-0s0mckqr.js → dispatcher-0a9wwjcx.js} +15 -15
  51. package/dist/{external-channel-5b23fv8z.js → external-channel-zhvt95n3.js} +2 -2
  52. package/dist/{grok-adapter-q9fghe5q.js → grok-adapter-qnr1hp2y.js} +2 -2
  53. package/dist/{handlers-mqrym347.js → handlers-dkcarkd0.js} +18 -18
  54. package/dist/{heartbeat-tww6yx1w.js → heartbeat-gz97r7ac.js} +17 -17
  55. package/dist/{hook-dx0pkvar.js → hook-1mmdgjqs.js} +1 -1
  56. package/dist/{hook-pvmh9b6m.js → hook-x8rthca4.js} +1 -1
  57. package/dist/{http-k2ejbt05.js → http-r8f85xr9.js} +111 -65
  58. package/dist/{index-pqfwh9nn.js → index-5jecgp3n.js} +17 -17
  59. package/dist/{index-h2ek08d6.js → index-aex0eba9.js} +15 -15
  60. package/dist/{index-x5aktmp8.js → index-smxyk04s.js} +1 -1
  61. package/dist/{index-dgz61nff.js → index-vzvfqzfj.js} +15 -15
  62. package/dist/{index-2z710v4x.js → index-y7rbcrc1.js} +8 -8
  63. package/dist/{keepalive-nhvpw10z.js → keepalive-64c0f34c.js} +3 -3
  64. package/dist/{lead-jb6sf69z.js → lead-b1da0f97.js} +23 -23
  65. package/dist/{maintenance-agakc519.js → maintenance-mnxpar12.js} +1 -1
  66. package/dist/{oauth-refresh-sweep-4dcbhtn0.js → oauth-refresh-sweep-36hs2v4h.js} +2 -2
  67. package/dist/{onboard-4n2kwa4v.js → onboard-xes8de61.js} +2 -2
  68. package/dist/{otel-impl-tfa12080.js → otel-impl-fzc57kcq.js} +1 -1
  69. package/dist/{pricing-refresh-3cqx3f3x.js → pricing-refresh-1nek2w7b.js} +3 -3
  70. package/dist/{rbac-roles-y6zbfzve.js → rbac-roles-sqefb5hw.js} +2 -2
  71. package/dist/{rbac-roles-9fae5rnv.js → rbac-roles-ttyfaep2.js} +1 -1
  72. package/dist/{render-v2-emawjvc4.js → render-v2-vb527jwn.js} +3 -3
  73. package/dist/{resume-zhgts7h7.js → resume-jcdzg1bn.js} +5 -5
  74. package/dist/{session-access-cm823e06.js → session-access-zsp4wsp0.js} +4 -4
  75. package/dist/{setup-tkp99w1e.js → setup-1nb2zqd3.js} +1 -1
  76. package/dist/{work-objects-f722h263.js → work-objects-61w08fwr.js} +18 -18
  77. package/dist/{worker-p7f336rq.js → worker-c1e68hpa.js} +23 -23
  78. package/openapi.json +393 -1
  79. package/package.json +2 -2
  80. package/src/apps/catalog.generated.json +3 -2
  81. package/src/apps/definition.ts +152 -4
  82. package/src/apps/row-store.ts +19 -7
  83. package/src/apps/schema-migrate.ts +14 -6
  84. package/src/apps/script-types.ts +1 -0
  85. package/src/apps/sync.ts +20 -19
  86. package/src/be/db/tasks/read.ts +112 -0
  87. package/src/be/db.ts +2 -0
  88. package/src/be/swarm-config-guard.ts +15 -0
  89. package/src/http/apps.ts +15 -2
  90. package/src/http/status.ts +49 -43
  91. package/src/http/tasks.ts +47 -0
  92. package/src/providers/acp-targets.ts +1 -1
  93. package/src/providers/amp-adapter.ts +1 -1
  94. package/src/telemetry.ts +15 -3
  95. package/src/tests/app-row-tools.test.ts +25 -0
  96. package/src/tests/apps-json-column.test.ts +611 -0
  97. package/src/tests/apps-script-types.test.ts +2 -0
  98. package/src/tests/apps-sync-engine.test.ts +42 -0
  99. package/src/tests/db-task-read-contract.test.ts +4 -0
  100. package/src/tests/db-task-write-contract.test.ts +2 -0
  101. package/src/tests/docs-index-footprint.test.js +2 -2
  102. package/src/tests/runner-harness-telemetry-env.test.ts +6 -0
  103. package/src/tests/status.test.ts +158 -9
  104. package/src/tests/task-lineage.test.ts +180 -0
  105. package/src/tests/telemetry-init.test.ts +62 -5
  106. package/src/tests/user-token-rest-auth.test.ts +38 -0
  107. package/src/tools/app-rows.ts +5 -0
  108. package/templates/skills/apps/SKILL.md +3 -2
  109. package/templates/skills/apps/content.md +3 -2
@@ -105,7 +105,7 @@ import {
105
105
  import {
106
106
  init_package,
107
107
  package_default
108
- } from "./cli-ash6xxk7.js";
108
+ } from "./cli-shvfedvm.js";
109
109
  import {
110
110
  realtimeBus,
111
111
  init_bus
@@ -2533,6 +2533,7 @@ var init_request_auth_context = __esm(() => {
2533
2533
 
2534
2534
  // src/telemetry.ts
2535
2535
  import { randomUUID } from "node:crypto";
2536
+ import { existsSync } from "node:fs";
2536
2537
  function setTelemetryIngestObserver(observer) {
2537
2538
  ingestObserver = observer;
2538
2539
  }
@@ -2718,13 +2719,20 @@ function isCloudDeployment() {
2718
2719
  const raw = process.env.SWARM_CLOUD;
2719
2720
  return raw === "true" || raw === "1";
2720
2721
  }
2721
- function getTelemetryEnvironment() {
2722
+ function getTelemetryEnvironment(packageRoot = new URL("../", import.meta.url)) {
2722
2723
  const explicit = process.env.DESPLEGA_TELEMETRY_ENV?.trim();
2723
2724
  if (explicit)
2724
2725
  return explicit;
2725
2726
  if (getNodeEnv() === "test")
2726
2727
  return "test";
2727
- return "production";
2728
+ if (cachedIsGitCheckout === undefined) {
2729
+ try {
2730
+ cachedIsGitCheckout = existsSync(new URL(".git", packageRoot));
2731
+ } catch {
2732
+ cachedIsGitCheckout = false;
2733
+ }
2734
+ }
2735
+ return cachedIsGitCheckout ? "development" : "production";
2728
2736
  }
2729
2737
  function track(options) {
2730
2738
  emit(options.event, options.properties, options.metadata, options.actor);
@@ -2813,7 +2821,7 @@ function emitIntegrationConnected(type, providerSlug, firstOfType) {
2813
2821
  }, { userId: getCurrentRequestUserId() ?? null });
2814
2822
  return true;
2815
2823
  }
2816
- var TELEMETRY_ENDPOINT = "https://proxy.desplega.sh/v1/events", PRODUCT = "agent-swarm", TIMEOUT_MS = 5000, installationId = null, installedAt = null, ingestObserver = null, cachedOrgId, cachedOrgDomain, roleResolver = null, functionResolver = null, identityReloader = null, lastIdentityLoadAt = 0, source = "unknown", cachedIsCloud = false, cachedIsE2b = false, cachedHasEmbedding = false, cachedHasSlackChannel = false, cachedHasEmailChannel = false, cachedInstallMethod = "manual", cachedInstallPreset, CLOUD_HOST_EXACT, CLOUD_HOST_SUFFIXES, KNOWN_INSTALL_METHODS, KNOWN_INSTALL_PRESETS, KNOWN_INTEGRATION_TYPES, INTEGRATION_PROVIDERS, ORG_IDENTITY_RETRY_MS = 60000, ORG_IDENTITY_REFRESH_MS, telemetry;
2824
+ var TELEMETRY_ENDPOINT = "https://proxy.desplega.sh/v1/events", PRODUCT = "agent-swarm", TIMEOUT_MS = 5000, installationId = null, installedAt = null, ingestObserver = null, cachedOrgId, cachedOrgDomain, roleResolver = null, functionResolver = null, identityReloader = null, lastIdentityLoadAt = 0, source = "unknown", cachedIsCloud = false, cachedIsE2b = false, cachedHasEmbedding = false, cachedHasSlackChannel = false, cachedHasEmailChannel = false, cachedInstallMethod = "manual", cachedInstallPreset, CLOUD_HOST_EXACT, CLOUD_HOST_SUFFIXES, KNOWN_INSTALL_METHODS, KNOWN_INSTALL_PRESETS, KNOWN_INTEGRATION_TYPES, INTEGRATION_PROVIDERS, ORG_IDENTITY_RETRY_MS = 60000, ORG_IDENTITY_REFRESH_MS, cachedIsGitCheckout, telemetry;
2817
2825
  var init_telemetry = __esm(() => {
2818
2826
  init_package();
2819
2827
  init_config();
@@ -3526,7 +3534,7 @@ var init_secrets_cipher = () => {};
3526
3534
 
3527
3535
  // src/be/crypto/key-bootstrap.ts
3528
3536
  import { randomBytes as randomBytes3 } from "node:crypto";
3529
- import { existsSync, readFileSync, writeFileSync } from "node:fs";
3537
+ import { existsSync as existsSync2, readFileSync, writeFileSync } from "node:fs";
3530
3538
  import path from "node:path";
3531
3539
  function keyGenerationHelp() {
3532
3540
  return [
@@ -3565,7 +3573,7 @@ function resolveEncryptionKey(dbPath, options = {}) {
3565
3573
  }
3566
3574
  const envKeyFile = process.env[ENV_KEY_FILE];
3567
3575
  if (envKeyFile && envKeyFile.length > 0) {
3568
- if (!existsSync(envKeyFile)) {
3576
+ if (!existsSync2(envKeyFile)) {
3569
3577
  throw new Error(`Invalid encryption key at env:${ENV_KEY_FILE} (${envKeyFile}): file does not exist`);
3570
3578
  }
3571
3579
  const content = readFileSync(envKeyFile, "utf8");
@@ -3576,7 +3584,7 @@ function resolveEncryptionKey(dbPath, options = {}) {
3576
3584
  throw new Error(`In-memory database requires ${ENV_KEY} or ${ENV_KEY_FILE} to be set explicitly`);
3577
3585
  }
3578
3586
  const keyFilePath = path.join(path.dirname(dbPath), KEY_FILENAME);
3579
- if (existsSync(keyFilePath)) {
3587
+ if (existsSync2(keyFilePath)) {
3580
3588
  const content = readFileSync(keyFilePath, "utf8");
3581
3589
  cachedKey = decodeAndValidate(`file:${keyFilePath}`, content);
3582
3590
  return cachedKey;
@@ -4829,7 +4837,7 @@ var init_runtime = __esm(() => {
4829
4837
  // src/telemetry-identity.ts
4830
4838
  async function loadUserRole(userId) {
4831
4839
  try {
4832
- const { getUserGrant } = await import("./rbac-roles-y6zbfzve.js");
4840
+ const { getUserGrant } = await import("./rbac-roles-sqefb5hw.js");
4833
4841
  const grant = await getUserGrant(userId);
4834
4842
  const role = grant.grantsAll ? "admin" : "member";
4835
4843
  const user = await getDbClient2().get("SELECT json_extract(metadata, '$.jobFunction') AS jobFunction FROM users WHERE id = ? AND json_valid(metadata)", [userId]);
@@ -5854,6 +5862,61 @@ async function getChildTasks2(parentTaskId) {
5854
5862
  const rows = await getDbClient2().query(`SELECT * FROM agent_tasks WHERE parentTaskId = ? ORDER BY createdAt ASC, rowid ASC`, [parentTaskId]);
5855
5863
  return rows.map(rowToAgentTask);
5856
5864
  }
5865
+ function rowToTaskLineageNode(row) {
5866
+ return { ...rowToAgentTaskSummary(row), workflowRunId: row.workflowRunId ?? undefined };
5867
+ }
5868
+ async function getTaskLineage2(taskId, limits = {}) {
5869
+ const maxNodes = limits.maxNodes ?? TASK_LINEAGE_LIMITS2.maxNodes;
5870
+ const maxDepth = limits.maxDepth ?? TASK_LINEAGE_LIMITS2.maxDepth;
5871
+ const maxAncestors = limits.maxAncestors ?? TASK_LINEAGE_LIMITS2.maxAncestors;
5872
+ const db = getDbClient2();
5873
+ const path = await db.query(`WITH RECURSIVE up(id, parentTaskId, hops) AS (
5874
+ SELECT id, parentTaskId, 0 FROM agent_tasks WHERE id = ?
5875
+ UNION ALL
5876
+ SELECT t.id, t.parentTaskId, up.hops + 1 FROM agent_tasks t
5877
+ JOIN up ON t.id = up.parentTaskId
5878
+ WHERE up.hops < ?
5879
+ )
5880
+ SELECT id, parentTaskId, hops FROM up ORDER BY hops`, [taskId, maxAncestors]);
5881
+ if (path.length === 0)
5882
+ return null;
5883
+ const top = path[path.length - 1];
5884
+ let truncated = top.hops === maxAncestors && top.parentTaskId !== null;
5885
+ const descendants = (startId) => db.query(`WITH RECURSIVE down(id, depth) AS (
5886
+ SELECT ?, 0
5887
+ UNION ALL
5888
+ SELECT t.id, down.depth + 1 FROM down
5889
+ JOIN agent_tasks t ON t.parentTaskId = down.id
5890
+ WHERE down.depth < ?
5891
+ ORDER BY 2
5892
+ LIMIT ?
5893
+ )
5894
+ SELECT ${LINEAGE_COLUMNS} FROM down
5895
+ CROSS JOIN agent_tasks ON agent_tasks.id = down.id
5896
+ ORDER BY down.depth, agent_tasks.createdAt, agent_tasks.rowid`, [startId, maxDepth, maxNodes + 1]);
5897
+ const byId = new Map;
5898
+ const add = (rows) => {
5899
+ for (const row of rows) {
5900
+ if (!byId.has(row.id))
5901
+ byId.set(row.id, rowToTaskLineageNode(row));
5902
+ }
5903
+ };
5904
+ const ownSubtree = await descendants(taskId);
5905
+ const fromRoot = top.id === taskId ? ownSubtree : await descendants(top.id);
5906
+ add(fromRoot.slice(0, maxNodes));
5907
+ add(ownSubtree.slice(0, maxNodes));
5908
+ const missing = path.map((row) => row.id).filter((id) => !byId.has(id));
5909
+ if (missing.length > 0) {
5910
+ add(await db.query(`SELECT ${LINEAGE_COLUMNS} FROM agent_tasks WHERE id IN (${missing.map(() => "?").join(", ")})`, missing));
5911
+ }
5912
+ if (!truncated) {
5913
+ const ids = [...byId.keys()];
5914
+ const list = ids.map(() => "?").join(", ");
5915
+ const omitted = await db.get(`SELECT 1 FROM agent_tasks WHERE parentTaskId IN (${list}) AND id NOT IN (${list}) LIMIT 1`, [...ids, ...ids]);
5916
+ truncated = omitted !== undefined && omitted !== null;
5917
+ }
5918
+ return { rootTaskId: top.id, tasks: [...byId.values()], truncated };
5919
+ }
5857
5920
  async function hasNonTerminalResumeChild2(parentId) {
5858
5921
  const row = await getDbClient2().get(`SELECT 1 FROM agent_tasks
5859
5922
  WHERE parentTaskId = ?
@@ -6539,7 +6602,7 @@ async function findRecentCancelledTaskInThread2(channelId, threadTs, windowMinut
6539
6602
  LIMIT 1`, [channelId, threadTs, since]);
6540
6603
  return row ? rowToAgentTask(row) : null;
6541
6604
  }
6542
- var dependencies2, TASK_PREVIEW_LENGTH = 300, TASK_PREVIEW_BYTES, TASK_PREVIEW_SQL, taskPreviewDecoder, LIST_COLUMNS, SUPERSEDED_RESUME_REPAIR_WINDOW_MS2, NEVER_STARTED_TASK_STATUSES, findTaskByGitHub2, CHAT_RELAY_ELIGIBLE_SQL = `(obligation.last_attempt_at IS NULL
6605
+ var dependencies2, TASK_PREVIEW_LENGTH = 300, TASK_PREVIEW_BYTES, TASK_PREVIEW_SQL, taskPreviewDecoder, LIST_COLUMNS, TASK_LINEAGE_LIMITS2, LINEAGE_COLUMNS, SUPERSEDED_RESUME_REPAIR_WINDOW_MS2, NEVER_STARTED_TASK_STATUSES, findTaskByGitHub2, CHAT_RELAY_ELIGIBLE_SQL = `(obligation.last_attempt_at IS NULL
6543
6606
  OR (julianday(?) - julianday(obligation.last_attempt_at)) * 86400000.0 >=
6544
6607
  CASE WHEN obligation.attempt_count >= 8 THEN 600000
6545
6608
  ELSE 3000 * (1 << obligation.attempt_count) END)`, LINEAR_TRACKER_CONTEXT_KEY_PREFIX = "task:trackers:linear:";
@@ -6569,6 +6632,9 @@ var init_read = __esm(() => {
6569
6632
  agent_tasks.title, agent_tasks.status, agent_tasks.createdAt, agent_tasks.lastUpdatedAt,
6570
6633
  agent_tasks.finishedAt, agent_tasks.peakContextTokens`
6571
6634
  };
6635
+ TASK_LINEAGE_LIMITS2 = { maxNodes: 500, maxDepth: 30, maxAncestors: 50 };
6636
+ LINEAGE_COLUMNS = `${LIST_COLUMNS.slim}, agent_tasks.workflowRunId,
6637
+ (SELECT SUM(totalCostUsd) FROM session_costs WHERE session_costs.taskId = agent_tasks.id) AS totalCostUsd`;
6572
6638
  SUPERSEDED_RESUME_REPAIR_WINDOW_MS2 = 24 * 60 * 60 * 1000;
6573
6639
  NEVER_STARTED_TASK_STATUSES = [
6574
6640
  "draft",
@@ -8279,7 +8345,7 @@ function validateConfigValue(key, value) {
8279
8345
  function validateExportToEnv(key, exportToEnv) {
8280
8346
  return exportToEnv === true && isEnvExportRestrictedKey(key) ? envExportRestrictedError(key) : null;
8281
8347
  }
8282
- var TEAMS_SDK_ENV_KEYS, RESERVED_KEYS, API_ONLY_CONFIG_KEYS, INTERNAL_CONFIG_KEYS, BOOLEAN_LITERALS, MAX_DB_RETENTION_DAYS = 1e6, DB_RETENTION_TUNING_BOUNDS, validateControllerTokenTtlDays, validateControllerGraceSec, VALIDATED_KEYS;
8348
+ var TEAMS_SDK_ENV_KEYS, RESERVED_KEYS, API_ONLY_CONFIG_KEYS, INTERNAL_CONFIG_KEYS, BOOLEAN_LITERALS, MAX_DB_RETENTION_DAYS = 1e6, DB_RETENTION_TUNING_BOUNDS, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS, validateControllerTokenTtlDays, validateControllerGraceSec, VALIDATED_KEYS;
8283
8349
  var init_swarm_config_guard = __esm(() => {
8284
8350
  init_schema();
8285
8351
  init_telemetry_ranking();
@@ -8321,6 +8387,7 @@ var init_swarm_config_guard = __esm(() => {
8321
8387
  DB_RETENTION_CATCHUP_INTERVAL_MS: { min: 5000, max: 3600000 },
8322
8388
  DB_RETENTION_MAX_STATEMENT_MS: { min: 25, max: 5000 }
8323
8389
  };
8390
+ APPS_JSON_COLUMN_MAX_BYTES_BOUNDS = { min: 1024, max: 16777216 };
8324
8391
  validateControllerTokenTtlDays = boundedIntegerValidators(["RUNTIME_CONTROLLER_TOKEN_TTL_DAYS"], 1, 3650).RUNTIME_CONTROLLER_TOKEN_TTL_DAYS;
8325
8392
  validateControllerGraceSec = boundedIntegerValidators(["RUNTIME_CONTROLLER_GRACE_SEC"], 0, 86400).RUNTIME_CONTROLLER_GRACE_SEC;
8326
8393
  VALIDATED_KEYS = {
@@ -8525,6 +8592,7 @@ var init_swarm_config_guard = __esm(() => {
8525
8592
  "SLACK_TREE_STALL_MIN"
8526
8593
  ], 1),
8527
8594
  ...boundedIntegerValidatorsFor(DB_RETENTION_TUNING_BOUNDS),
8595
+ ...boundedIntegerValidators(["APPS_JSON_COLUMN_MAX_BYTES"], APPS_JSON_COLUMN_MAX_BYTES_BOUNDS.min, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS.max),
8528
8596
  ...boundedIntegerValidators([
8529
8597
  "SESSION_LOG_RETENTION_DAYS",
8530
8598
  "AGENT_LOG_RETENTION_DAYS",
@@ -19017,7 +19085,7 @@ async function loadSecretRegistry() {
19017
19085
  result.failed += 1;
19018
19086
  }
19019
19087
  try {
19020
- const { loadRuntimeControllerSecrets } = await import("./db-ys2rbdft.js");
19088
+ const { loadRuntimeControllerSecrets } = await import("./db-2y0mgstc.js");
19021
19089
  const loaded = await loadRuntimeControllerSecrets();
19022
19090
  result.runtimeController = loaded.count;
19023
19091
  result.failed += loaded.failed;
@@ -19341,6 +19409,7 @@ __export(exports_db, {
19341
19409
  SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS: () => SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS2,
19342
19410
  SKILL_FILE_LIMITS: () => SKILL_FILE_LIMITS2,
19343
19411
  SUPERSEDED_RESUME_REPAIR_WINDOW_MS: () => SUPERSEDED_RESUME_REPAIR_WINDOW_MS2,
19412
+ TASK_LINEAGE_LIMITS: () => TASK_LINEAGE_LIMITS2,
19344
19413
  UNATTRIBUTED_USER_ID: () => UNATTRIBUTED_USER_ID2,
19345
19414
  __resetSqliteVecExtensionPathCacheForTests: () => __resetSqliteVecExtensionPathCacheForTests2,
19346
19415
  abandonSlackOutcomeDelivery: () => abandonSlackOutcomeDelivery2,
@@ -19642,6 +19711,7 @@ __export(exports_db, {
19642
19711
  getTaskAttachments: () => getTaskAttachments2,
19643
19712
  getTaskById: () => getTaskById2,
19644
19713
  getTaskByWorkflowRunStepId: () => getTaskByWorkflowRunStepId2,
19714
+ getTaskLineage: () => getTaskLineage2,
19645
19715
  getTaskStats: () => getTaskStats2,
19646
19716
  getTasksByAgentId: () => getTasksByAgentId2,
19647
19717
  getTasksByStatus: () => getTasksByStatus2,
@@ -27605,4 +27675,4 @@ var init_db3 = __esm(() => {
27605
27675
  };
27606
27676
  });
27607
27677
 
27608
- export { slackContextKey, chatSdkContextKey, chatThreadOfContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, azureDevOpsWorkItemContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, checkSlackRoutingCoherence, init_slack_routing, init_catalog, catalog_default, COMPANY_TEAM_SIZES, COMPANY_USE_CASES, USER_FUNCTIONS, init_company_profile, mapTriggerSurface, init_telemetry_context, TELEMETRY_PROXY_ORIGIN, normalizeOrgWebsite, orgLogoUrl, isFilledOrgLogoUrl, init_org_website, beginRequestAuthScope, setRequestAuth, getRequestAuth, getCurrentRequestAuth, runWithoutRequestAuth, getCurrentRequestUserId, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, setTelemetryFunctionResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, assertUrlSafe, parseEgressAllowlist, init_egress_guard, init_credential_broker, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, init_scrub_json, sealJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates, init_templates2, isSqliteVecAvailable2, resolveSqliteVecExtensionPath2, __resetSqliteVecExtensionPathCacheForTests2, initDb2, getDb2, closeDb2, getDbClient2, init_runtime, cachedUserRole, cachedUserFunction, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, CODEX_AUTH_WATCH_NAMESPACE, codexAuthBenchMarkerKey, isCodexAuthFailureReason, init_codex_auth_failure, isEnvExportRestrictedKey, init_config_env_export, MASKED_SECRET_VALUE, init_config_secrets, HeartbeatExpiryError, init_heartbeat_expiry, isRuntimePoolsEnabled, init_runtime_pools_flag, normalizeDate, normalizeDateRequired, init_date_utils, rowToAgent, updateAgentCredentialState2, updateAgentCredentialMissing2, createAgent2, getAgentById2, EXTENSION_AGENT_ROLE2, NOT_EXTENSION_AGENT_SQL2, isExtensionAgent2, extensionAgentAssignmentError2, ReservedAgentRoleError2, reservedRoleViolation2, ExtensionAgentAssignmentError2, getAllAgents2, getAgentStatusCounts2, getLeadAgent2, updateAgentStatus2, updateAgentMaxTasks2, updateAgentProvider2, setAgentHarnessProvider2, updateAgentCredStatus2, listAgentsWithCredStatusByProvider2, getAgentHarnessProviders2, updateAgentActivity2, MAX_EMPTY_POLLS2, incrementEmptyPollCount2, resetEmptyPollCount2, shouldBlockPolling2, deleteAgent2, getActiveTaskCount2, hasCapacity2, getRemainingCapacity2, updateAgentStatusFromCapacity2, isPoolAffinityEnforcementEnabled2, buildRoutingAffinityFromAgent2, isAgentEligibleForTask2, getAgentDailyTaskCounts2, init_agents, listApprovalRequestSummaries2, getPendingApprovalVoteState2, recordApprovalVotes2, computeContentHash2, createContextVersion2, getLatestContextVersion2, getContextVersion2, getContextVersionHistory2, vcsRepoName, vcsRepoUrlMatches, init_vcs_repo_match, rowToAgentTask, getTaskById2, getChildTasks2, hasNonTerminalResumeChild2, SUPERSEDED_RESUME_REPAIR_WINDOW_MS2, getSupersededTasksWithoutResume2, getSupersededTasksWithUnsettledDependents2, hasNonTerminalRerouteDecisionChild2, getTasksByAgentId2, getAgentCurrentTask2, getTasksByStatus2, findTaskByVcs2, findTaskByGitHub2, readableSessionCondition, getAllTasks2, getTasksCount2, getTaskStats2, getCompletedSlackTasks2, getPendingSlackRelayTasks2, markSlackRelayAttempted2, markSlackRelayDelivered2, markFinalizedSlackRelaysDelivered2, getPendingChatRelayTasks2, giveUpStaleChatRelays2, markChatRelayAttempted2, recordChatRelayError2, markChatRelayDelivered2, markChatRelayGivenUp2, getRecentlyFinishedWorkerTasks2, markTasksNotified2, resetTasksNotified2, getInProgressSlackTasks2, getSlackTasksMissingTree2, getInProgressTasksByContextKey2, isLinearTrackerContextKey2, findExistingLinearTrackerContextWork2, getLatestTaskByContextKey2, getLatestScriptRunStepTaskByContextKey2, getAgentWorkingOnThread2, getLatestActiveTaskInThread2, getLatestLeadTaskInThread2, getAgentWorkingOnContextKey2, getLatestActiveTaskByContextKey2, getLatestLeadTaskByContextKey2, getMostRecentTaskInThread2, findCompletedTaskInThread2, findRecentCancelledTaskInThread2, init_read, MODEL_PROFILE_CONFIG_KEY, listModelProfiles, getModelProfileByName, createModelProfile, updateModelProfile, modelProfileReferences, modelProfileRefError, deleteModelProfile, getAgentDefaultProfileName, repoModelOverrideKeys, taskProfileError, init_model_profiles, setHumanFreeQueueListener, drainHumanFreeReclassifyQueue, init_human_free, onTaskStarted, init_task_lifecycle_events, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, createTask2, getPendingTaskForAgent2, assignUnassignedTaskPending2, startTask2, updateTaskClaudeSessionId2, recordTaskProviderIfUnset2, updateTaskTitle2, completeTask2, failTask2, overwriteTerminalTaskResultText2, cancelTask2, supersedeTask2, settleSupersededTaskDependents2, backfillSupersedeTaskResumeTaskId2, pauseTask2, resumeTask2, getPausedTasksForAgent2, getOrphanedInProgressTasksForAgent2, resetOrphanedInProgressTasksForAgent2, getRecentlyCancelledTasksForAgent2, deleteTask2, updateTaskProgress2, getChildWorkflowRunId, getWorkflowRunParent, getWorkflowRunLineage, getSettledChildRunParentSteps, init_workflow_runs, CHAT_SDK_ADAPTER_NAMES, CHAT_SDK_ADAPTER_SCHEMAS, ChatSdkAdaptersDraftSchema, firstIssueText, isAdapterEntryEnabled, init_schema, TELEMETRY_RANKING_KEY, PUBLIC_RANKING_ENABLED_KEY, RANKING_CATEGORIES, readTelemetryRanking, rankingFormSchema, buildListing, init_telemetry_ranking, resolveQuickJSPoolSize, init_quickjs_pool_config, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, completedStatusIcon, init_reaction_shortcode, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain, parseEnabledTools, init_enabled_tools, parseTaskToolManifest, CHAT_TASK_ONLY_TOOLS, isChatSdkTask, selectTaskTools, init_task_tool_manifest, tierConfigKey, init_model_tier_keys, isApiOnlyConfigKey, isInternalConfigKey, internalConfigKeyError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, validateRuntimeTokenTtlHours, validateControllerTokenTtlDays, validateControllerGraceSec, validateConfigValue, validateExportToEnv, init_swarm_config_guard, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, OpenAI2, init_openai, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants, LONGTERM_ROOT, MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE, MEMORY_KEY_MAX_LENGTH, isLongtermKey, longtermKeyError, isConsolidatedKey, consolidatedKeyMessage, resolveStoreKey, init_key_paths, computeScore, rerank, init_reranker, rowToCandidate, init_sqlite_store, getEmbeddingProvider2, resetEmbeddingProvider2, getMemoryStore2, init_memory, embeddingProvider, embedScript, searchScripts, reembedAllScripts, init_embeddings, upsertScriptByName, getScript, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db2, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, STEERING_MOVED_ERROR, SteeringRequestError, isSteeringEnabled, getTaskSteeringFields, getTaskSteeringFieldsForTasks, promotePendingSteeringForTask, markSteeringUndeliverable, carryUnhandledSteering, requestSteering, init_steering, WorkflowReplayStateError, init_workflow_replay, SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS2, refreshActiveSessionOnActivity2, getActiveSessionById, init_active_sessions, recordKeySeatMismatch2, getScriptRunExecutionArgs2, getSlackRenderV2ActivatedAt2, ensureSlackRenderV2Activation2, getSlackDelegationActivatedAt2, ensureSlackDelegationActivation2, isPendingSlackMessage2, isSettledSlackMessage2, recordSlackMessage2, reserveSlackMessage2, bindSlackMessageTimestamp2, updateSlackMessageRecord2, markSlackTreeRendered2, deleteSlackMessageRecord2, getSlackTreeMessage2, getSlackTreeMessageByThread2, getSlackOutcomeMessage2, getResolvableDeferralOutcomes2, markSlackDeferralResolved2, noteSlackOutcomeDeliveryFailure2, abandonSlackOutcomeDelivery2, getSlackTreeMessages2, getSlackMessageByChannelTs2, getSlackTasksInThread2, listSlackThreadsAwaitingHuman2, isSlackThreadAwaitingHuman2, markTaskSlackReplySent2, setSlackMessageTracking2, updateTaskVcs2, insertTaskAttachment2, recordTaskPullRequestAttachments2, getAssetKeyMappingByProvider2, upsertAssetKeyMapping2, getAssetKeyMapping2, listAssetSummaries2, moveAssetKey2, deleteTaskAttachment2, replaceTaskAttachment2, getTaskAttachments2, createSteeringMessage2, getSteeringMessagesForTask2, getSteeringMessageById2, getPendingSteeringForTask2, getPendingSteeringForAgent2, markSteeringDelivered2, markSteeringHandled2, markSteeringPromoted2, cancelPendingSteeringForTask2, hasPendingSteering2, getAgentWithTasks2, getAllAgentsWithTasks2, createLogEntry2, getLogsByAgentId2, getLogsByTaskId2, getLogsByTaskIdAndEventType2, getLogsByTaskIdChronological2, getLogsByEventType2, getAllLogs2, findRecentSimilarTasks2, createTaskExtended2, claimTask2, releaseTask2, acceptTask2, rejectTask2, moveTaskToBacklog2, moveTaskFromBacklog2, promoteDraftTask2, refreshDraftTaskLease2, promoteAbandonedDraftTasks2, releaseStaleReviewingTasks2, releaseStaleOfferedTasksForOfflineAgents2, getOfferedTasksForAgent2, claimOfferedTask2, getUnassignedTasksCount2, getUnassignedTaskIds2, getUnassignedTaskIdsForAgent2, checkDependencies2, getDependentTasks2, cascadeFailDependents2, updateAgentProfile2, updateAgentName2, createChannel2, getMessageById2, getChannelById2, getChannelByName2, getAllChannels2, deleteChannel2, postMessage2, getChannelMessages2, updateReadState2, getLastReadAt2, getUnreadMessages2, getMentionsForAgent2, getInboxSummary2, claimMentions2, releaseMentionProcessing2, releaseStaleMentionProcessing2, createService2, getServiceById2, getServiceByAgentAndName2, getServicesByAgentId2, getAllServices2, updateServiceStatus2, deleteService2, upsertService2, deleteServicesByAgentId2, createSessionLogs2, getSessionLogsByTaskId2, getSessionLogsBySession2, createSessionCost2, getSessionCostsByTaskId2, getSessionCostsByAgentId2, getAllSessionCosts2, getSessionCostsFiltered2, UNATTRIBUTED_USER_ID2, getSessionCostSummary2, getAttributionByPerson2, getDashboardCostSummary2, createInboxMessage2, getInboxMessageById2, getUnreadInboxMessages2, claimInboxMessages2, markInboxMessageRead2, markInboxMessageResponded2, markInboxMessageDelegated2, releaseStaleProcessingInbox2, getConcurrentContext2, getScheduledTasks2, getScheduledTaskById2, getScheduledTaskByName2, createScheduledTask2, updateScheduledTask2, deleteScheduledTask2, getDueScheduledTasks2, autoEncryptLegacyPlaintextSecrets2, maskSecrets2, getSwarmConfigs2, getInjectableGlobalConfigs2, getSwarmConfigById2, getSwarmConfigLookupById2, upsertSwarmConfig2, emitBuiltInIntegrationConnectedOnce2, deleteSwarmConfig2, deleteSwarmConfigByKey2, getResolvedConfig2, getSwarmRepos2, getSwarmRepoById2, getSwarmRepoByName2, getSwarmRepoByUrl2, createSwarmRepo2, updateSwarmRepo2, deleteSwarmRepo2, getAgentMailInboxMapping2, getAgentMailInboxMappingsByAgent2, getAllAgentMailInboxMappings2, createAgentMailInboxMapping2, deleteAgentMailInboxMapping2, findTaskByAgentMailThread2, insertActiveSession2, deleteActiveSession2, deleteActiveSessionById2, getActiveSessions2, heartbeatActiveSession2, cleanupStaleSessions2, cleanupAgentSessions2, updateActiveSessionProviderSessionId2, getActiveSessionForTask2, reassociateSessionLogs2, getStalledInProgressTasks2, getStalePinnedResumes2, failPendingResumeIfUnclaimed2, getIdleWorkersWithCapacity2, getUnassignedPoolTasks2, getStaleUnassignedAffinityTasks2, getRecentFailedTasks2, getRecentCompletedCount2, getRecentFailedCount2, createWorkflow2, getWorkflow2, listWorkflows2, updateWorkflow2, deleteWorkflow2, getWorkflowsByScheduleId2, createWorkflowRun2, getWorkflowRun2, updateWorkflowRun2, listWorkflowRuns2, countWorkflowRuns2, listWorkflowRunsPage2, createWorkflowRunStep2, getWorkflowRunStep2, updateWorkflowRunStep2, getWorkflowRunStepsByRunId2, getStuckWorkflowRuns2, getLastSuccessfulRun2, getLastRunStart2, getRetryableSteps2, getCompletedStepNodeIds2, getTaskByWorkflowRunStepId2, detachTaskFromWorkflowRunStep2, getStepByIdempotencyKey2, getStepCountForNode2, getLatestStepForNode2, getCurrentStepForNode2, createWorkflowVersion2, getWorkflowVersions2, getWorkflowVersion2, createAppVersion2, getAppVersions2, getAppVersion2, createPage2, getPage2, getPageBySlug2, getLatestPageBySlug2, listPagesByAgent2, listAllPages2, countAllPages2, countPagesByAgent2, updatePage2, deletePage2, incrementPageViewCount2, createPageVersion2, getPageVersions2, getPageVersion2, createMetric2, getMetric2, getMetricBySlug2, listMetricsByAgent2, listAllMetrics2, countAllMetrics2, countMetricsByAgent2, updateMetric2, deleteMetric2, createMetricVersion2, getMetricVersions2, getMetricVersion2, getPromptTemplates2, getPromptTemplateById2, upsertPromptTemplate2, deletePromptTemplate2, resetPromptTemplateToDefault2, getPromptTemplateHistory2, resolvePromptTemplate2, checkoutPromptTemplate2, getAllChannelActivityCursors2, getChannelActivityCursor2, upsertChannelActivityCursor2, createApprovalRequest2, getApprovalRequestById2, resolveApprovalRequest2, cancelApprovalRequestById2, cancelPendingApprovalRequestsForRun2, listCancelledApprovalRequestsForRun2, listCancelledApprovalRequestsForStep2, claimApprovalCancellationNotification2, completeApprovalCancellationNotificationClaim2, releaseApprovalCancellationNotificationClaim2, updateApprovalRequestNotifications2, listApprovalRequests2, getStuckApprovalRuns2, getApprovalRequestByStepId2, getExpiredPendingApprovals2, getStaleApprovalRequests2, createWaitState2, getWaitStateById2, getWaitStateByStepId2, getDueWaitStates2, getPendingEventWaitNames2, getPendingWaitsByEvent2, resolveWaitState2, getStuckWaitRuns2, SKILL_FILE_LIMITS2, normalizeSkillFilePath2, createSkill2, updateSkill2, listSkillFileManifest2, getSkillFiles2, getSkillFile2, upsertSkillFile2, upsertSkillFiles2, deleteSkillFile2, deleteSkill2, getSkillById2, getSkillByName2, listSkills2, searchSkills2, installSkill2, getSystemDefaultSkills2, installSystemDefaultSkillsForAgent2, uninstallSkill2, getAgentSkills2, toggleAgentSkill2, createMcpServer2, emitMcpServerConnectedTelemetry2, updateMcpServer2, deleteMcpServer2, getMcpServerById2, getMcpServerByName2, listMcpServers2, installMcpServer2, uninstallMcpServer2, getAgentMcpServers2, createContextSnapshot2, getContextSnapshotsByTaskId2, getContextSnapshotsBySessionId2, getContextSummaryByTaskId2, getAvailableKeyIndices2, recordKeyUsage2, setApiKeyPlan2, markKeyRateLimited2, recordKeyAuthFailure2, recordKeyRateLimitWindows2, setApiKeyName2, clearKeyRateLimit2, getKeyStatuses2, getKeyCostSummary2, getUserById2, getAllUsers2, createUser2, updateUser2, deleteUser2, listInboxState2, upsertInboxState2, listFavorites2, listUserFavorites2, getFavoriteItemIdSet2, setFavorite2, setUserFavorite2, withFavoriteFlags2, listTaskTemplates2, getRootTaskChain2, listRecentSessions2, countSessions2, getBudget2, getBudgets2, upsertBudget2, deleteBudget2, getAllPricingRows2, getPricingRows2, getActivePricingRow2, insertPricingRow2, deletePricingRow2, getDailySpendForAgent2, getDailySpendGlobal2, getDailySpendForUser2, recordBudgetRefusalNotification2, getBudgetRefusalNotification2, getRecentBudgetRefusalNotifications2, hasBudgetRefusalNotificationToday2, setBudgetRefusalFollowUpTaskId2, getLiveAgentCounts2, getReadyAgentCounts2, getInstanceActivity2, getSwarmMetrics2, hasFirstCompletedTask2, getKv2, sweepExpiredKv2, sweepExpiredKvPrefix2, upsertKv2, claimKv2, deleteKv2, KvTypeCollisionError2, incrKv2, kvPrefixUpperBound2, listKv2, countKv2, createScriptRun2, recordInlineScriptRun2, getScriptRun2, getScriptRunByIdempotencyKey2, listScriptRuns2, countScriptRuns2, countActiveScriptRuns2, updateScriptRun2, updateScriptRunIfNotTerminal2, updateScriptRunIfRunning2, getRunningScriptRuns2, getScriptRunJournalStep2, upsertScriptRunJournalStep2, listScriptRunJournalSteps2, countScriptRunJournalSteps2, countScriptRunJournalAgentTaskSteps2, exports_db, init_db3 };
27678
+ export { slackContextKey, chatSdkContextKey, chatThreadOfContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, azureDevOpsWorkItemContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, checkSlackRoutingCoherence, init_slack_routing, init_catalog, catalog_default, COMPANY_TEAM_SIZES, COMPANY_USE_CASES, USER_FUNCTIONS, init_company_profile, mapTriggerSurface, init_telemetry_context, TELEMETRY_PROXY_ORIGIN, normalizeOrgWebsite, orgLogoUrl, isFilledOrgLogoUrl, init_org_website, beginRequestAuthScope, setRequestAuth, getRequestAuth, getCurrentRequestAuth, runWithoutRequestAuth, getCurrentRequestUserId, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, setTelemetryFunctionResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, assertUrlSafe, parseEgressAllowlist, init_egress_guard, init_credential_broker, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, init_scrub_json, sealJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates, init_templates2, isSqliteVecAvailable2, resolveSqliteVecExtensionPath2, __resetSqliteVecExtensionPathCacheForTests2, initDb2, getDb2, closeDb2, getDbClient2, init_runtime, cachedUserRole, cachedUserFunction, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, CODEX_AUTH_WATCH_NAMESPACE, codexAuthBenchMarkerKey, isCodexAuthFailureReason, init_codex_auth_failure, isEnvExportRestrictedKey, init_config_env_export, MASKED_SECRET_VALUE, init_config_secrets, HeartbeatExpiryError, init_heartbeat_expiry, isRuntimePoolsEnabled, init_runtime_pools_flag, normalizeDate, normalizeDateRequired, init_date_utils, rowToAgent, updateAgentCredentialState2, updateAgentCredentialMissing2, createAgent2, getAgentById2, EXTENSION_AGENT_ROLE2, NOT_EXTENSION_AGENT_SQL2, isExtensionAgent2, extensionAgentAssignmentError2, ReservedAgentRoleError2, reservedRoleViolation2, ExtensionAgentAssignmentError2, getAllAgents2, getAgentStatusCounts2, getLeadAgent2, updateAgentStatus2, updateAgentMaxTasks2, updateAgentProvider2, setAgentHarnessProvider2, updateAgentCredStatus2, listAgentsWithCredStatusByProvider2, getAgentHarnessProviders2, updateAgentActivity2, MAX_EMPTY_POLLS2, incrementEmptyPollCount2, resetEmptyPollCount2, shouldBlockPolling2, deleteAgent2, getActiveTaskCount2, hasCapacity2, getRemainingCapacity2, updateAgentStatusFromCapacity2, isPoolAffinityEnforcementEnabled2, buildRoutingAffinityFromAgent2, isAgentEligibleForTask2, getAgentDailyTaskCounts2, init_agents, listApprovalRequestSummaries2, getPendingApprovalVoteState2, recordApprovalVotes2, computeContentHash2, createContextVersion2, getLatestContextVersion2, getContextVersion2, getContextVersionHistory2, vcsRepoName, vcsRepoUrlMatches, init_vcs_repo_match, rowToAgentTask, getTaskById2, getChildTasks2, TASK_LINEAGE_LIMITS2, getTaskLineage2, hasNonTerminalResumeChild2, SUPERSEDED_RESUME_REPAIR_WINDOW_MS2, getSupersededTasksWithoutResume2, getSupersededTasksWithUnsettledDependents2, hasNonTerminalRerouteDecisionChild2, getTasksByAgentId2, getAgentCurrentTask2, getTasksByStatus2, findTaskByVcs2, findTaskByGitHub2, readableSessionCondition, getAllTasks2, getTasksCount2, getTaskStats2, getCompletedSlackTasks2, getPendingSlackRelayTasks2, markSlackRelayAttempted2, markSlackRelayDelivered2, markFinalizedSlackRelaysDelivered2, getPendingChatRelayTasks2, giveUpStaleChatRelays2, markChatRelayAttempted2, recordChatRelayError2, markChatRelayDelivered2, markChatRelayGivenUp2, getRecentlyFinishedWorkerTasks2, markTasksNotified2, resetTasksNotified2, getInProgressSlackTasks2, getSlackTasksMissingTree2, getInProgressTasksByContextKey2, isLinearTrackerContextKey2, findExistingLinearTrackerContextWork2, getLatestTaskByContextKey2, getLatestScriptRunStepTaskByContextKey2, getAgentWorkingOnThread2, getLatestActiveTaskInThread2, getLatestLeadTaskInThread2, getAgentWorkingOnContextKey2, getLatestActiveTaskByContextKey2, getLatestLeadTaskByContextKey2, getMostRecentTaskInThread2, findCompletedTaskInThread2, findRecentCancelledTaskInThread2, init_read, MODEL_PROFILE_CONFIG_KEY, listModelProfiles, getModelProfileByName, createModelProfile, updateModelProfile, modelProfileReferences, modelProfileRefError, deleteModelProfile, getAgentDefaultProfileName, repoModelOverrideKeys, taskProfileError, init_model_profiles, setHumanFreeQueueListener, drainHumanFreeReclassifyQueue, init_human_free, onTaskStarted, init_task_lifecycle_events, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, createTask2, getPendingTaskForAgent2, assignUnassignedTaskPending2, startTask2, updateTaskClaudeSessionId2, recordTaskProviderIfUnset2, updateTaskTitle2, completeTask2, failTask2, overwriteTerminalTaskResultText2, cancelTask2, supersedeTask2, settleSupersededTaskDependents2, backfillSupersedeTaskResumeTaskId2, pauseTask2, resumeTask2, getPausedTasksForAgent2, getOrphanedInProgressTasksForAgent2, resetOrphanedInProgressTasksForAgent2, getRecentlyCancelledTasksForAgent2, deleteTask2, updateTaskProgress2, getChildWorkflowRunId, getWorkflowRunParent, getWorkflowRunLineage, getSettledChildRunParentSteps, init_workflow_runs, CHAT_SDK_ADAPTER_NAMES, CHAT_SDK_ADAPTER_SCHEMAS, ChatSdkAdaptersDraftSchema, firstIssueText, isAdapterEntryEnabled, init_schema, TELEMETRY_RANKING_KEY, PUBLIC_RANKING_ENABLED_KEY, RANKING_CATEGORIES, readTelemetryRanking, rankingFormSchema, buildListing, init_telemetry_ranking, resolveQuickJSPoolSize, init_quickjs_pool_config, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, completedStatusIcon, init_reaction_shortcode, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain, parseEnabledTools, init_enabled_tools, parseTaskToolManifest, CHAT_TASK_ONLY_TOOLS, isChatSdkTask, selectTaskTools, init_task_tool_manifest, tierConfigKey, init_model_tier_keys, isApiOnlyConfigKey, isInternalConfigKey, internalConfigKeyError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS, validateRuntimeTokenTtlHours, validateControllerTokenTtlDays, validateControllerGraceSec, validateConfigValue, validateExportToEnv, init_swarm_config_guard, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, OpenAI2, init_openai, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants, LONGTERM_ROOT, MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE, MEMORY_KEY_MAX_LENGTH, isLongtermKey, longtermKeyError, isConsolidatedKey, consolidatedKeyMessage, resolveStoreKey, init_key_paths, computeScore, rerank, init_reranker, rowToCandidate, init_sqlite_store, getEmbeddingProvider2, resetEmbeddingProvider2, getMemoryStore2, init_memory, embeddingProvider, embedScript, searchScripts, reembedAllScripts, init_embeddings, upsertScriptByName, getScript, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db2, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, STEERING_MOVED_ERROR, SteeringRequestError, isSteeringEnabled, getTaskSteeringFields, getTaskSteeringFieldsForTasks, promotePendingSteeringForTask, markSteeringUndeliverable, carryUnhandledSteering, requestSteering, init_steering, WorkflowReplayStateError, init_workflow_replay, SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS2, refreshActiveSessionOnActivity2, getActiveSessionById, init_active_sessions, recordKeySeatMismatch2, getScriptRunExecutionArgs2, getSlackRenderV2ActivatedAt2, ensureSlackRenderV2Activation2, getSlackDelegationActivatedAt2, ensureSlackDelegationActivation2, isPendingSlackMessage2, isSettledSlackMessage2, recordSlackMessage2, reserveSlackMessage2, bindSlackMessageTimestamp2, updateSlackMessageRecord2, markSlackTreeRendered2, deleteSlackMessageRecord2, getSlackTreeMessage2, getSlackTreeMessageByThread2, getSlackOutcomeMessage2, getResolvableDeferralOutcomes2, markSlackDeferralResolved2, noteSlackOutcomeDeliveryFailure2, abandonSlackOutcomeDelivery2, getSlackTreeMessages2, getSlackMessageByChannelTs2, getSlackTasksInThread2, listSlackThreadsAwaitingHuman2, isSlackThreadAwaitingHuman2, markTaskSlackReplySent2, setSlackMessageTracking2, updateTaskVcs2, insertTaskAttachment2, recordTaskPullRequestAttachments2, getAssetKeyMappingByProvider2, upsertAssetKeyMapping2, getAssetKeyMapping2, listAssetSummaries2, moveAssetKey2, deleteTaskAttachment2, replaceTaskAttachment2, getTaskAttachments2, createSteeringMessage2, getSteeringMessagesForTask2, getSteeringMessageById2, getPendingSteeringForTask2, getPendingSteeringForAgent2, markSteeringDelivered2, markSteeringHandled2, markSteeringPromoted2, cancelPendingSteeringForTask2, hasPendingSteering2, getAgentWithTasks2, getAllAgentsWithTasks2, createLogEntry2, getLogsByAgentId2, getLogsByTaskId2, getLogsByTaskIdAndEventType2, getLogsByTaskIdChronological2, getLogsByEventType2, getAllLogs2, findRecentSimilarTasks2, createTaskExtended2, claimTask2, releaseTask2, acceptTask2, rejectTask2, moveTaskToBacklog2, moveTaskFromBacklog2, promoteDraftTask2, refreshDraftTaskLease2, promoteAbandonedDraftTasks2, releaseStaleReviewingTasks2, releaseStaleOfferedTasksForOfflineAgents2, getOfferedTasksForAgent2, claimOfferedTask2, getUnassignedTasksCount2, getUnassignedTaskIds2, getUnassignedTaskIdsForAgent2, checkDependencies2, getDependentTasks2, cascadeFailDependents2, updateAgentProfile2, updateAgentName2, createChannel2, getMessageById2, getChannelById2, getChannelByName2, getAllChannels2, deleteChannel2, postMessage2, getChannelMessages2, updateReadState2, getLastReadAt2, getUnreadMessages2, getMentionsForAgent2, getInboxSummary2, claimMentions2, releaseMentionProcessing2, releaseStaleMentionProcessing2, createService2, getServiceById2, getServiceByAgentAndName2, getServicesByAgentId2, getAllServices2, updateServiceStatus2, deleteService2, upsertService2, deleteServicesByAgentId2, createSessionLogs2, getSessionLogsByTaskId2, getSessionLogsBySession2, createSessionCost2, getSessionCostsByTaskId2, getSessionCostsByAgentId2, getAllSessionCosts2, getSessionCostsFiltered2, UNATTRIBUTED_USER_ID2, getSessionCostSummary2, getAttributionByPerson2, getDashboardCostSummary2, createInboxMessage2, getInboxMessageById2, getUnreadInboxMessages2, claimInboxMessages2, markInboxMessageRead2, markInboxMessageResponded2, markInboxMessageDelegated2, releaseStaleProcessingInbox2, getConcurrentContext2, getScheduledTasks2, getScheduledTaskById2, getScheduledTaskByName2, createScheduledTask2, updateScheduledTask2, deleteScheduledTask2, getDueScheduledTasks2, autoEncryptLegacyPlaintextSecrets2, maskSecrets2, getSwarmConfigs2, getInjectableGlobalConfigs2, getSwarmConfigById2, getSwarmConfigLookupById2, upsertSwarmConfig2, emitBuiltInIntegrationConnectedOnce2, deleteSwarmConfig2, deleteSwarmConfigByKey2, getResolvedConfig2, getSwarmRepos2, getSwarmRepoById2, getSwarmRepoByName2, getSwarmRepoByUrl2, createSwarmRepo2, updateSwarmRepo2, deleteSwarmRepo2, getAgentMailInboxMapping2, getAgentMailInboxMappingsByAgent2, getAllAgentMailInboxMappings2, createAgentMailInboxMapping2, deleteAgentMailInboxMapping2, findTaskByAgentMailThread2, insertActiveSession2, deleteActiveSession2, deleteActiveSessionById2, getActiveSessions2, heartbeatActiveSession2, cleanupStaleSessions2, cleanupAgentSessions2, updateActiveSessionProviderSessionId2, getActiveSessionForTask2, reassociateSessionLogs2, getStalledInProgressTasks2, getStalePinnedResumes2, failPendingResumeIfUnclaimed2, getIdleWorkersWithCapacity2, getUnassignedPoolTasks2, getStaleUnassignedAffinityTasks2, getRecentFailedTasks2, getRecentCompletedCount2, getRecentFailedCount2, createWorkflow2, getWorkflow2, listWorkflows2, updateWorkflow2, deleteWorkflow2, getWorkflowsByScheduleId2, createWorkflowRun2, getWorkflowRun2, updateWorkflowRun2, listWorkflowRuns2, countWorkflowRuns2, listWorkflowRunsPage2, createWorkflowRunStep2, getWorkflowRunStep2, updateWorkflowRunStep2, getWorkflowRunStepsByRunId2, getStuckWorkflowRuns2, getLastSuccessfulRun2, getLastRunStart2, getRetryableSteps2, getCompletedStepNodeIds2, getTaskByWorkflowRunStepId2, detachTaskFromWorkflowRunStep2, getStepByIdempotencyKey2, getStepCountForNode2, getLatestStepForNode2, getCurrentStepForNode2, createWorkflowVersion2, getWorkflowVersions2, getWorkflowVersion2, createAppVersion2, getAppVersions2, getAppVersion2, createPage2, getPage2, getPageBySlug2, getLatestPageBySlug2, listPagesByAgent2, listAllPages2, countAllPages2, countPagesByAgent2, updatePage2, deletePage2, incrementPageViewCount2, createPageVersion2, getPageVersions2, getPageVersion2, createMetric2, getMetric2, getMetricBySlug2, listMetricsByAgent2, listAllMetrics2, countAllMetrics2, countMetricsByAgent2, updateMetric2, deleteMetric2, createMetricVersion2, getMetricVersions2, getMetricVersion2, getPromptTemplates2, getPromptTemplateById2, upsertPromptTemplate2, deletePromptTemplate2, resetPromptTemplateToDefault2, getPromptTemplateHistory2, resolvePromptTemplate2, checkoutPromptTemplate2, getAllChannelActivityCursors2, getChannelActivityCursor2, upsertChannelActivityCursor2, createApprovalRequest2, getApprovalRequestById2, resolveApprovalRequest2, cancelApprovalRequestById2, cancelPendingApprovalRequestsForRun2, listCancelledApprovalRequestsForRun2, listCancelledApprovalRequestsForStep2, claimApprovalCancellationNotification2, completeApprovalCancellationNotificationClaim2, releaseApprovalCancellationNotificationClaim2, updateApprovalRequestNotifications2, listApprovalRequests2, getStuckApprovalRuns2, getApprovalRequestByStepId2, getExpiredPendingApprovals2, getStaleApprovalRequests2, createWaitState2, getWaitStateById2, getWaitStateByStepId2, getDueWaitStates2, getPendingEventWaitNames2, getPendingWaitsByEvent2, resolveWaitState2, getStuckWaitRuns2, SKILL_FILE_LIMITS2, normalizeSkillFilePath2, createSkill2, updateSkill2, listSkillFileManifest2, getSkillFiles2, getSkillFile2, upsertSkillFile2, upsertSkillFiles2, deleteSkillFile2, deleteSkill2, getSkillById2, getSkillByName2, listSkills2, searchSkills2, installSkill2, getSystemDefaultSkills2, installSystemDefaultSkillsForAgent2, uninstallSkill2, getAgentSkills2, toggleAgentSkill2, createMcpServer2, emitMcpServerConnectedTelemetry2, updateMcpServer2, deleteMcpServer2, getMcpServerById2, getMcpServerByName2, listMcpServers2, installMcpServer2, uninstallMcpServer2, getAgentMcpServers2, createContextSnapshot2, getContextSnapshotsByTaskId2, getContextSnapshotsBySessionId2, getContextSummaryByTaskId2, getAvailableKeyIndices2, recordKeyUsage2, setApiKeyPlan2, markKeyRateLimited2, recordKeyAuthFailure2, recordKeyRateLimitWindows2, setApiKeyName2, clearKeyRateLimit2, getKeyStatuses2, getKeyCostSummary2, getUserById2, getAllUsers2, createUser2, updateUser2, deleteUser2, listInboxState2, upsertInboxState2, listFavorites2, listUserFavorites2, getFavoriteItemIdSet2, setFavorite2, setUserFavorite2, withFavoriteFlags2, listTaskTemplates2, getRootTaskChain2, listRecentSessions2, countSessions2, getBudget2, getBudgets2, upsertBudget2, deleteBudget2, getAllPricingRows2, getPricingRows2, getActivePricingRow2, insertPricingRow2, deletePricingRow2, getDailySpendForAgent2, getDailySpendGlobal2, getDailySpendForUser2, recordBudgetRefusalNotification2, getBudgetRefusalNotification2, getRecentBudgetRefusalNotifications2, hasBudgetRefusalNotificationToday2, setBudgetRefusalFollowUpTaskId2, getLiveAgentCounts2, getReadyAgentCounts2, getInstanceActivity2, getSwarmMetrics2, hasFirstCompletedTask2, getKv2, sweepExpiredKv2, sweepExpiredKvPrefix2, upsertKv2, claimKv2, deleteKv2, KvTypeCollisionError2, incrKv2, kvPrefixUpperBound2, listKv2, countKv2, createScriptRun2, recordInlineScriptRun2, getScriptRun2, getScriptRunByIdempotencyKey2, listScriptRuns2, countScriptRuns2, countActiveScriptRuns2, updateScriptRun2, updateScriptRunIfNotTerminal2, updateScriptRunIfRunning2, getRunningScriptRuns2, getScriptRunJournalStep2, upsertScriptRunJournalStep2, listScriptRunJournalSteps2, countScriptRunJournalSteps2, countScriptRunJournalAgentTaskSteps2, exports_db, init_db3 };
@@ -9,16 +9,16 @@ import {
9
9
  init_active_sessions,
10
10
  getSteeringMessageById2,
11
11
  init_db3
12
- } from "./cli-rqqsfz30.js";
12
+ } from "./cli-d3qqdy4c.js";
13
13
  import {
14
14
  getUserGrant2,
15
15
  init_rbac_roles
16
- } from "./cli-nx462e4v.js";
16
+ } from "./cli-7awf1fp8.js";
17
17
  import {
18
18
  findUserById,
19
19
  findUserByExternalId,
20
20
  init_users
21
- } from "./cli-fz9kewbh.js";
21
+ } from "./cli-nmqdc2t3.js";
22
22
  import {
23
23
  isRbacEnabled,
24
24
  init_rbac
@@ -502,7 +502,7 @@ function route(def) {
502
502
  try {
503
503
  const rawBody = def.body ? await parseBody(req, def.maxBodyBytes) : undefined;
504
504
  if (def.session && "bodyTaskIds" in def.session) {
505
- const { bodySessionDenial } = await import("./session-access-cm823e06.js");
505
+ const { bodySessionDenial } = await import("./session-access-zsp4wsp0.js");
506
506
  const denial = await bodySessionDenial(req, def.session.bodyTaskIds(rawBody));
507
507
  if (denial) {
508
508
  jsonError(res, denial, 403);
@@ -7,14 +7,14 @@ import {
7
7
  tierConfigKey,
8
8
  init_model_tier_keys,
9
9
  init_db3
10
- } from "./cli-rqqsfz30.js";
10
+ } from "./cli-d3qqdy4c.js";
11
11
  import {
12
12
  ensureRbacSeedsSynced2,
13
13
  init_rbac_roles
14
- } from "./cli-nx462e4v.js";
14
+ } from "./cli-7awf1fp8.js";
15
15
  import {
16
16
  seedPricingFromModelsDev
17
- } from "./cli-3p8fqcnh.js";
17
+ } from "./cli-h93c9vb3.js";
18
18
  import {
19
19
  MODEL_TIERS,
20
20
  DEFAULT_MODEL_TIER_MAP,
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  normalizeOrgWebsite,
6
6
  init_org_website
7
- } from "./cli-rqqsfz30.js";
7
+ } from "./cli-d3qqdy4c.js";
8
8
 
9
9
  // src/utils/lead-monitor-channels.ts
10
10
  function isLeadChannelMonitoringEnabled(env = process.env) {
@@ -2,7 +2,7 @@ import {
2
2
  isGrokOpenRouterModel,
3
3
  grokTargetProfile,
4
4
  ACPAdapter2
5
- } from "./cli-3tnpj2bh.js";
5
+ } from "./cli-z4wd2ftv.js";
6
6
  import {
7
7
  getOpenRouterBaseUrl,
8
8
  getOpenRouterAttributionHeaders,
@@ -19,6 +19,7 @@ import {
19
19
  init_quickjs_pool_config,
20
20
  isApiOnlyConfigKey,
21
21
  isInternalConfigKey,
22
+ APPS_JSON_COLUMN_MAX_BYTES_BOUNDS,
22
23
  init_swarm_config_guard,
23
24
  getOAuthApp,
24
25
  getOAuthAppById,
@@ -38,14 +39,14 @@ import {
38
39
  getResolvedConfig2,
39
40
  getMcpServerById2,
40
41
  init_db3
41
- } from "./cli-rqqsfz30.js";
42
+ } from "./cli-d3qqdy4c.js";
42
43
  import {
43
44
  generateRandomCodeVerifier,
44
45
  generateRandomState,
45
46
  calculatePKCECodeChallenge,
46
47
  oauthAppRowToProviderConfig,
47
48
  ensureAuthorizationTokenOrThrow
48
- } from "./cli-sjyetj21.js";
49
+ } from "./cli-s6vr7r2d.js";
49
50
  import {
50
51
  detachedProcessGroup,
51
52
  registerProcessGroup,
@@ -178553,6 +178554,9 @@ async function runSavedScriptAsAgent(args, deps = {}) {
178553
178554
  return output;
178554
178555
  }
178555
178556
 
178557
+ // src/apps/definition.ts
178558
+ init_swarm_config_guard();
178559
+
178556
178560
  // src/scripts-runtime/quickjs-compat.ts
178557
178561
  var import_typescript3 = __toESM(require_typescript2(), 1);
178558
178562
  var UNSUPPORTED_GLOBALS = new Set([
@@ -180098,7 +180102,7 @@ var catalog_generated_default = {
180098
180102
  }
180099
180103
  },
180100
180104
  Table: {
180101
- description: 'Data table. Bind `data`/`loading`/`error` to a named query (`/queries/<name>/...`). `rowActions` chains receive `{ "$row": "<col>" }` (or `{ "$row": "" }` for the whole row) and `{ "$rowIndex": true }`. Destructive row actions always confirm via a dialog; override the copy with `confirm: { title, description, confirmLabel }`. `search` (case-insensitive substring across every listed column) and `filters` (per-column equality, `null`/`""` disables one; an array means "one of", which is what a multiple `Chips` writes, and an empty array disables it) narrow the polled rows client-side — bind them to a `SearchInput` / `Select` via `/ui/<id>/value`, or pin a constant (e.g. `"filters": { "pinned": true }`). Columns take `pinned: "left"|"right"` to survive horizontal scroll; `pagination` pages large row sets (auto past 200 rows); `density: "compact"` tightens row height. Column kinds: `status` (lifecycle values like pending/in_progress/completed/failed get the dashboard status icon, anything else a `tones` pill), `user` / `agent` (avatar + name), `relative` (smart time with the exact time on hover), `duration` (ms → 1m 23s), `progress` (bar, `max` default 100), `copy` (value + copy button), `switch` (runs the column\'s `onChange` chain with `$row` set to the new value; read-only without it), `link` (http(s) URL, opens in a new tab). Columns also take `align`, `truncate: "middle"` (ids, paths), a header `icon` and `tooltip` (a row field shown on hover). `onRowClick` runs a chain with `$row` when a row is clicked — pair it with `app.navigate` + a Drawer and bind `selectedId` to the drawer param to highlight the open row. `rowId` names the id field (default `id`). Below 768px the table renders as a phone list (`mobile: "list"`, fields picked by `mobileFields: { title, subtitle?, meta?, status? }`); `mobile: "scroll"` keeps the grid. `emptyState: { icon?, title, body? }` replaces the empty message. Row actions take `icon` and `placement: "menu"` (collected into a More menu).',
180105
+ description: 'Data table. Bind `data`/`loading`/`error` to a named query (`/queries/<name>/...`). `rowActions` chains receive `{ "$row": "<col>" }` (or `{ "$row": "" }` for the whole row) and `{ "$rowIndex": true }`. Destructive row actions always confirm via a dialog; override the copy with `confirm: { title, description, confirmLabel }`. `search` (case-insensitive substring across every listed column) and `filters` (per-column equality, `null`/`""` disables one; an array means "one of", which is what a multiple `Chips` writes, and an empty array disables it) narrow the polled rows client-side — bind them to a `SearchInput` / `Select` via `/ui/<id>/value`, or pin a constant (e.g. `"filters": { "pinned": true }`). Columns take `pinned: "left"|"right"` to survive horizontal scroll; `pagination` pages large row sets (auto past 200 rows); `density: "compact"` tightens row height. Column kinds: `status` (lifecycle values like pending/in_progress/completed/failed get the dashboard status icon, anything else a `tones` pill), `user` / `agent` (avatar + name), `relative` (smart time with the exact time on hover), `duration` (ms → 1m 23s), `progress` (bar, `max` default 100), `copy` (value + copy button), `switch` (runs the column\'s `onChange` chain with `$row` set to the new value; read-only without it), `link` (http(s) URL, opens in a new tab), `json` (compact single-line `JSON.stringify` preview, truncated). Columns also take `align`, `truncate: "middle"` (ids, paths), a header `icon` and `tooltip` (a row field shown on hover). `onRowClick` runs a chain with `$row` when a row is clicked — pair it with `app.navigate` + a Drawer and bind `selectedId` to the drawer param to highlight the open row. `rowId` names the id field (default `id`). Below 768px the table renders as a phone list (`mobile: "list"`, fields picked by `mobileFields: { title, subtitle?, meta?, status? }`); `mobile: "scroll"` keeps the grid. `emptyState: { icon?, title, body? }` replaces the empty message. Row actions take `icon` and `placement: "menu"` (collected into a More menu).',
180102
180106
  props: {
180103
180107
  $schema: "http://json-schema.org/draft-07/schema#",
180104
180108
  type: "object",
@@ -180142,7 +180146,8 @@ var catalog_generated_default = {
180142
180146
  "progress",
180143
180147
  "copy",
180144
180148
  "switch",
180145
- "link"
180149
+ "link",
180150
+ "json"
180146
180151
  ]
180147
180152
  },
180148
180153
  tones: {
@@ -182525,11 +182530,55 @@ async function resolveSyncRunAs(script) {
182525
182530
  var AppNameSchema = string2().regex(/^[a-z][a-zA-Z0-9_]{0,39}$/, {
182526
182531
  message: "must start with a lowercase letter and contain only letters, numbers, or underscores"
182527
182532
  });
182528
- var ColumnKindSchema = _enum2(["string", "number", "boolean", "date", "enum"]);
182533
+ var ColumnKindSchema = _enum2(["string", "number", "boolean", "date", "enum", "json"]);
182534
+ var ScalarColumnKindSchema = ColumnKindSchema.exclude(["json"]);
182529
182535
  var ISO_8601_PREFIX = /^\d{4}-\d{2}-\d{2}(?:T.*)?$/;
182530
182536
  function isIso8601Date(value) {
182531
182537
  return ISO_8601_PREFIX.test(value) && !Number.isNaN(Date.parse(value));
182532
182538
  }
182539
+ var DEFAULT_JSON_COLUMN_MAX_BYTES = 256 * 1024;
182540
+ function jsonColumnMaxBytes(env = process.env) {
182541
+ const raw = env.APPS_JSON_COLUMN_MAX_BYTES?.trim();
182542
+ if (!raw || !/^\d+$/.test(raw))
182543
+ return DEFAULT_JSON_COLUMN_MAX_BYTES;
182544
+ const value = Number(raw);
182545
+ const { min, max } = APPS_JSON_COLUMN_MAX_BYTES_BOUNDS;
182546
+ return Number.isSafeInteger(value) && value >= min && value <= max ? value : DEFAULT_JSON_COLUMN_MAX_BYTES;
182547
+ }
182548
+ function jsonColumnSizeLabel(bytes = jsonColumnMaxBytes()) {
182549
+ return bytes % 1024 === 0 ? `${bytes / 1024}KB` : `${bytes} bytes`;
182550
+ }
182551
+ function jsonColumnValueIssue(value) {
182552
+ let nonFinite = false;
182553
+ let serialized;
182554
+ try {
182555
+ serialized = JSON.stringify(value, (_key, entry) => {
182556
+ if (typeof entry === "number" && !Number.isFinite(entry))
182557
+ nonFinite = true;
182558
+ return entry;
182559
+ });
182560
+ } catch {
182561
+ return "unserializable";
182562
+ }
182563
+ if (serialized === undefined)
182564
+ return "unserializable";
182565
+ if (nonFinite)
182566
+ return "non-finite";
182567
+ return Buffer.byteLength(serialized, "utf8") > jsonColumnMaxBytes() ? "oversized" : null;
182568
+ }
182569
+ function isValidColumnValue(column, value) {
182570
+ if (column.kind === "string")
182571
+ return typeof value === "string";
182572
+ if (column.kind === "number")
182573
+ return typeof value === "number" && Number.isFinite(value);
182574
+ if (column.kind === "boolean")
182575
+ return typeof value === "boolean";
182576
+ if (column.kind === "date")
182577
+ return typeof value === "string" && isIso8601Date(value);
182578
+ if (column.kind === "json")
182579
+ return jsonColumnValueIssue(value) === null;
182580
+ return typeof value === "string" && Boolean(column.enum?.includes(value));
182581
+ }
182533
182582
  var SourceTransformSchema = _enum2(["slug", "lower", "upper", "cents", "date-parse"]);
182534
182583
  var TRANSFORM_COLUMN_KIND = {
182535
182584
  slug: "string",
@@ -182548,10 +182597,19 @@ var ColumnDefSchema = object2({
182548
182597
  required: boolean().optional(),
182549
182598
  enum: array2(string2()).optional(),
182550
182599
  index: boolean().optional(),
182551
- default: union2([string2(), number2(), boolean()]).optional(),
182600
+ default: union2([
182601
+ string2(),
182602
+ number2(),
182603
+ boolean(),
182604
+ record2(string2(), unknown()),
182605
+ array2(unknown())
182606
+ ]).optional(),
182552
182607
  hidden: boolean().optional(),
182553
182608
  source: ColumnSourceBindingSchema.optional()
182554
182609
  }).superRefine((column, ctx) => {
182610
+ if (column.kind === "json" && column.index) {
182611
+ ctx.addIssue({ code: "custom", path: ["index"], message: "json columns cannot be indexed" });
182612
+ }
182555
182613
  if (column.kind === "enum") {
182556
182614
  if (!column.enum || column.enum.length === 0) {
182557
182615
  ctx.addIssue({ code: "custom", path: ["enum"], message: "enum values are required" });
@@ -182569,6 +182627,23 @@ var ColumnDefSchema = object2({
182569
182627
  }
182570
182628
  if (column.default === undefined)
182571
182629
  return;
182630
+ if (column.kind === "json") {
182631
+ const issue = jsonColumnValueIssue(column.default);
182632
+ if (issue === "unserializable") {
182633
+ ctx.addIssue({
182634
+ code: "custom",
182635
+ path: ["default"],
182636
+ message: "json column default must be JSON-serializable"
182637
+ });
182638
+ } else if (issue === "non-finite") {
182639
+ ctx.addIssue({
182640
+ code: "custom",
182641
+ path: ["default"],
182642
+ message: "json column default contains a non-finite number"
182643
+ });
182644
+ }
182645
+ return;
182646
+ }
182572
182647
  const valid = column.kind === "string" && typeof column.default === "string" || column.kind === "number" && typeof column.default === "number" && Number.isFinite(column.default) || column.kind === "boolean" && typeof column.default === "boolean" || column.kind === "date" && typeof column.default === "string" && isIso8601Date(column.default) || column.kind === "enum" && typeof column.default === "string" && Boolean(column.enum?.includes(column.default));
182573
182648
  if (!valid) {
182574
182649
  ctx.addIssue({
@@ -182579,7 +182654,7 @@ var ColumnDefSchema = object2({
182579
182654
  }
182580
182655
  });
182581
182656
  var UserConfigFieldSchema = object2({
182582
- kind: ColumnKindSchema,
182657
+ kind: ScalarColumnKindSchema,
182583
182658
  default: union2([string2(), number2(), boolean()]).optional(),
182584
182659
  enum: array2(string2()).optional(),
182585
182660
  label: string2().optional(),
@@ -182699,7 +182774,7 @@ var AppPageSchema = object2({
182699
182774
  params: record2(AppNameSchema, AppPageParamSchema).optional()
182700
182775
  }).strict();
182701
182776
  var ElementPropDefSchema = object2({
182702
- kind: ColumnKindSchema,
182777
+ kind: ScalarColumnKindSchema,
182703
182778
  required: boolean().optional(),
182704
182779
  enum: array2(string2()).min(1).optional(),
182705
182780
  default: union2([string2(), number2(), boolean()]).optional()
@@ -182821,6 +182896,14 @@ var AppDefinitionSchema = object2({
182821
182896
  });
182822
182897
  continue;
182823
182898
  }
182899
+ if (columnDefinition.kind === "json") {
182900
+ ctx.addIssue({
182901
+ code: "custom",
182902
+ path: ["queries", queryName, "filter", column],
182903
+ message: "json columns cannot be filtered"
182904
+ });
182905
+ continue;
182906
+ }
182824
182907
  if (typeof value === "object")
182825
182908
  continue;
182826
182909
  const valid = columnDefinition.kind === "string" && typeof value === "string" || columnDefinition.kind === "number" && typeof value === "number" && Number.isFinite(value) || columnDefinition.kind === "boolean" && typeof value === "boolean" || columnDefinition.kind === "date" && typeof value === "string" && isIso8601Date(value) || columnDefinition.kind === "enum" && typeof value === "string" && Boolean(columnDefinition.enum?.includes(value));
@@ -182839,6 +182922,12 @@ var AppDefinitionSchema = object2({
182839
182922
  path: ["queries", queryName, "sort", "column"],
182840
182923
  message: `unknown or hidden column "${sortColumn}"`
182841
182924
  });
182925
+ } else if (sortColumn && model.columns[sortColumn]?.kind === "json") {
182926
+ ctx.addIssue({
182927
+ code: "custom",
182928
+ path: ["queries", queryName, "sort", "column"],
182929
+ message: "json columns cannot be sorted"
182930
+ });
182842
182931
  }
182843
182932
  }
182844
182933
  });
@@ -183085,6 +183174,22 @@ function syncActionIssues(name, action, models) {
183085
183174
  }
183086
183175
  return [{ path: `actions.${name}`, message: "no model declares a source to sync" }];
183087
183176
  }
183177
+ function jsonColumnDefaultSizeIssues(definition) {
183178
+ const issues = [];
183179
+ for (const [modelName, model] of Object.entries(definition.models)) {
183180
+ for (const [columnName, column] of Object.entries(model.columns)) {
183181
+ if (column.kind !== "json" || column.default === undefined)
183182
+ continue;
183183
+ if (jsonColumnValueIssue(column.default) === "oversized") {
183184
+ issues.push({
183185
+ path: `models.${modelName}.columns.${columnName}.default`,
183186
+ message: `json column default exceeds the ${jsonColumnSizeLabel()} size limit`
183187
+ });
183188
+ }
183189
+ }
183190
+ }
183191
+ return issues;
183192
+ }
183088
183193
  async function parseAppDefinition(input, elementContext = {}) {
183089
183194
  if (isMergePatchObject(input) && Object.hasOwn(input, "page")) {
183090
183195
  return {
@@ -183116,6 +183221,7 @@ async function parseAppDefinition(input, elementContext = {}) {
183116
183221
  if (!parsed.success)
183117
183222
  return { success: false, issues: appDefinitionIssues(parsed.error) };
183118
183223
  const issues = [
183224
+ ...jsonColumnDefaultSizeIssues(parsed.data),
183119
183225
  ...Object.keys(parsed.data.pages).flatMap((pageName) => validatePage(parsed.data, catalog_generated_default, pageName)),
183120
183226
  ...crossPageDefinitionIssues(parsed.data, catalog_generated_default),
183121
183227
  ...await elementDefinitionIssues(parsed.data, catalog_generated_default, elementContext)
@@ -183478,6 +183584,8 @@ function commentSafe(value) {
183478
183584
  return value.replace(/[\r\n\u2028\u2029]+/g, " ").replace(/\*\//g, "").trim().slice(0, 80);
183479
183585
  }
183480
183586
  function tsTypeForColumn(column) {
183587
+ if (column.kind === "json")
183588
+ return "unknown";
183481
183589
  if (column.kind !== "enum")
183482
183590
  return column.kind === "date" ? "string" : column.kind;
183483
183591
  return column.enum?.map((value) => JSON.stringify(value)).join(" | ") || "string";
@@ -184818,4 +184926,4 @@ function parseSkillContent(content) {
184818
184926
  };
184819
184927
  }
184820
184928
 
184821
- export { require_dist2, isInvalidClientError, publicEndpointSsrfOptions, mcpOAuthSsrfOptions, discoverProtectedResourceMetadata, discoverAuthorizationServerMetadata, normalizeTokenEndpointAuthMethod, resolveAdvertisedTokenEndpointAuthMethod, authMethodForStoredClient, selectDcrTokenEndpointAuthMethod, registerClient, buildAuthorizeUrl, exchangeCodeForTokens, refreshMcpToken, revokeMcpToken, computeExpiresAt, getMcpOAuthToken, findReusableMcpOAuthClient, invalidateMcpOAuthClient, upsertMcpOAuthToken, applyMcpOAuthRefresh, markMcpOAuthTokenStatus, deleteMcpOAuthToken, insertMcpOAuthPending, consumeMcpOAuthPending, gcMcpOAuthPending, setMcpServerAuthMethod, ensureMcpToken, callMcpServerTool, resolveSqlDsn, runReadOnlyQuery, listVendoredOpenapiEntries, ConnectionAuthInputSchema, SqlDsnInputSchema, connectionAuthSummary, listRelationalCredentialBindings, getCredentialBindingById, findCredentialBindingByIdentity, upsertCredentialBinding, disableCredentialBinding, listScriptConnections, listScriptConnectionsAsync, getScriptConnectionById, ScriptConnectionConflictError, connectionAuthInputFromFlat, upsertScriptConnection, refreshScriptConnection, setScriptConnectionEnabled, deleteScriptConnection, getScriptApiConnectionDescriptors, getScriptMcpConnectionDescriptors, getScriptApiTypes, getScriptMcpTypes, oauthAppToProviderConfig, getOAuthProviderConfig, getOAuthBindingTokenStatus, buildScriptCredentialBindingsWithFailures, buildSandboxedCommand, sandboxSpawnEnv, createCappedStreamState, snapshotCapped, readStreamCapped, writeBareImportShim, MIN_SCRIPT_WALL_CLOCK_MS, SCRIPT_LONG_TIMEOUT_HINT_MS, MAX_SCRIPT_WALL_CLOCK_MS, DEFAULT_SCRIPT_RESOURCES, require_typescript2, checkImportAllowlist, validateScriptImports, runScript, extractScriptSignature, extractArgsJsonSchema, getSavedScriptOwnerAgentId, runSavedScriptAsAgent, checkQuickJSCompat, quickJSCompatWarnings, resolveSyncRunAs, AppNameSchema, ColumnKindSchema, isIso8601Date, SYSTEM_COLUMN_KINDS, SORTABLE_SYSTEM_DATE_COLUMNS, AppElementsSchema, AppDefinitionSchema, collectScriptReferences, scriptCompatWarnings, parseAppDefinition, applyAppDefinitionPatch, upgradeAppDefinition, decodeAppDefinition, appDefinitionNeedsRepair, createApp, getApp, listApps, listAppRecords, updateApp, deleteApp, getScriptAppTypes, SCRIPT_SDK_TYPES, scriptSdkTypesWithGeneratedApis, SCRIPT_STDLIB_MODULE_TYPES, scriptStdlibTypesWithGeneratedApis, typecheckWithAmbient, typecheckScript, parseSkillContent };
184929
+ export { require_dist2, isInvalidClientError, publicEndpointSsrfOptions, mcpOAuthSsrfOptions, discoverProtectedResourceMetadata, discoverAuthorizationServerMetadata, normalizeTokenEndpointAuthMethod, resolveAdvertisedTokenEndpointAuthMethod, authMethodForStoredClient, selectDcrTokenEndpointAuthMethod, registerClient, buildAuthorizeUrl, exchangeCodeForTokens, refreshMcpToken, revokeMcpToken, computeExpiresAt, getMcpOAuthToken, findReusableMcpOAuthClient, invalidateMcpOAuthClient, upsertMcpOAuthToken, applyMcpOAuthRefresh, markMcpOAuthTokenStatus, deleteMcpOAuthToken, insertMcpOAuthPending, consumeMcpOAuthPending, gcMcpOAuthPending, setMcpServerAuthMethod, ensureMcpToken, callMcpServerTool, resolveSqlDsn, runReadOnlyQuery, listVendoredOpenapiEntries, ConnectionAuthInputSchema, SqlDsnInputSchema, connectionAuthSummary, listRelationalCredentialBindings, getCredentialBindingById, findCredentialBindingByIdentity, upsertCredentialBinding, disableCredentialBinding, listScriptConnections, listScriptConnectionsAsync, getScriptConnectionById, ScriptConnectionConflictError, connectionAuthInputFromFlat, upsertScriptConnection, refreshScriptConnection, setScriptConnectionEnabled, deleteScriptConnection, getScriptApiConnectionDescriptors, getScriptMcpConnectionDescriptors, getScriptApiTypes, getScriptMcpTypes, oauthAppToProviderConfig, getOAuthProviderConfig, getOAuthBindingTokenStatus, buildScriptCredentialBindingsWithFailures, buildSandboxedCommand, sandboxSpawnEnv, createCappedStreamState, snapshotCapped, readStreamCapped, writeBareImportShim, MIN_SCRIPT_WALL_CLOCK_MS, SCRIPT_LONG_TIMEOUT_HINT_MS, MAX_SCRIPT_WALL_CLOCK_MS, DEFAULT_SCRIPT_RESOURCES, require_typescript2, checkImportAllowlist, validateScriptImports, runScript, extractScriptSignature, extractArgsJsonSchema, getSavedScriptOwnerAgentId, runSavedScriptAsAgent, checkQuickJSCompat, quickJSCompatWarnings, resolveSyncRunAs, AppNameSchema, ScalarColumnKindSchema, isIso8601Date, jsonColumnSizeLabel, jsonColumnValueIssue, isValidColumnValue, SYSTEM_COLUMN_KINDS, SORTABLE_SYSTEM_DATE_COLUMNS, AppElementsSchema, AppDefinitionSchema, collectScriptReferences, scriptCompatWarnings, parseAppDefinition, applyAppDefinitionPatch, upgradeAppDefinition, decodeAppDefinition, appDefinitionNeedsRepair, createApp, getApp, listApps, listAppRecords, updateApp, deleteApp, getScriptAppTypes, SCRIPT_SDK_TYPES, scriptSdkTypesWithGeneratedApis, SCRIPT_STDLIB_MODULE_TYPES, scriptStdlibTypesWithGeneratedApis, typecheckWithAmbient, typecheckScript, parseSkillContent };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getDb2,
3
3
  init_db3
4
- } from "./cli-rqqsfz30.js";
4
+ } from "./cli-d3qqdy4c.js";
5
5
  import {
6
6
  openAICompatibleProviderIds,
7
7
  withRegistryCatalogSections,