@desplega.ai/agent-swarm 1.117.0 → 1.119.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 (122) hide show
  1. package/README.md +2 -0
  2. package/dist/{actions-7bnvhcgs.js → actions-cdhadphb.js} +5 -5
  3. package/dist/{app-976fykvr.js → app-w2067dt3.js} +3 -3
  4. package/dist/{artifact-0874w6js.js → artifact-x7e6f41t.js} +1 -1
  5. package/dist/{assistant-5drs03t0.js → assistant-cb02pb41.js} +8 -8
  6. package/dist/{boot-reembed-0zhftca3.js → boot-reembed-b18pndap.js} +4 -4
  7. package/dist/{boot-reembed-wce58xfv.js → boot-reembed-p00s3r7a.js} +3 -3
  8. package/dist/{boot-scrub-logs-vkd2vvxp.js → boot-scrub-logs-b9ym4xx3.js} +2 -2
  9. package/dist/{cli-m4p6c600.js → cli-06d436hx.js} +5 -5
  10. package/dist/{cli-9kk0xa5w.js → cli-06xdf1gz.js} +1 -1
  11. package/dist/{cli-jkp1gndy.js → cli-15m4y05s.js} +5 -5
  12. package/dist/{cli-yarjrgd5.js → cli-9ed8efw3.js} +1 -1
  13. package/dist/{cli-xcp5dmts.js → cli-9kbww4vb.js} +1 -1
  14. package/dist/{cli-f5cx2j92.js → cli-azvm6fss.js} +2 -2
  15. package/dist/{cli-vwhg6sbn.js → cli-bx96sw2z.js} +2 -2
  16. package/dist/{cli-t6n84nqv.js → cli-chs2zh28.js} +5 -4
  17. package/dist/{cli-hmw1vk30.js → cli-dqxwy0td.js} +1 -1
  18. package/dist/{cli-r06ed00c.js → cli-h1gg78hv.js} +234 -63
  19. package/dist/{cli-kfjs4fjw.js → cli-hyn69s0c.js} +1 -1
  20. package/dist/{cli-s5q026mr.js → cli-j12px91x.js} +756 -110
  21. package/dist/{cli-e0xv4nd4.js → cli-jy7w6z37.js} +10 -7
  22. package/dist/{cli-fep22bhf.js → cli-mxennm5t.js} +2 -2
  23. package/dist/{cli-xm2tyqfe.js → cli-ppwm8c6e.js} +11 -0
  24. package/dist/{cli-1987vgjc.js → cli-q7eev82n.js} +3 -3
  25. package/dist/{cli-rymspw51.js → cli-qcm02dkk.js} +1 -1
  26. package/dist/{cli-5ekf4gcj.js → cli-qf35kzka.js} +1 -1
  27. package/dist/{cli-z824vphk.js → cli-qw9seygs.js} +2 -2
  28. package/dist/{cli-w5axeg22.js → cli-txxvn1zb.js} +1 -1
  29. package/dist/{cli-q0yn57de.js → cli-vfq38b3e.js} +1 -1
  30. package/dist/{cli-6058t3w0.js → cli-vt51szy9.js} +1 -1
  31. package/dist/{cli-09j7m5v3.js → cli-x1m2hp0q.js} +51 -12
  32. package/dist/{cli-ndsyqqqk.js → cli-zcra7f1h.js} +2 -2
  33. package/dist/cli.js +10 -10
  34. package/dist/{commands-b3p0fjzd.js → commands-rn6frj4c.js} +2 -2
  35. package/dist/{db-6xw82vz3.js → db-kmemzvqt.js} +16 -2
  36. package/dist/{handlers-kwrk085v.js → handlers-mppa5zb3.js} +8 -8
  37. package/dist/{hook-e4wdztg5.js → hook-ej6457r1.js} +1 -1
  38. package/dist/{http-x7svk8q5.js → http-wv092d70.js} +451 -82
  39. package/dist/{index-aadhkkde.js → index-adgr531h.js} +10 -10
  40. package/dist/{index-zj38e3q2.js → index-bc90csfq.js} +9 -9
  41. package/dist/{index-qb6nfqmy.js → index-n6xq6x5d.js} +8 -8
  42. package/dist/{index-35tw5g2v.js → index-q1x8ttq6.js} +281 -24
  43. package/dist/{keepalive-enehyqc8.js → keepalive-yjx8f7cq.js} +4 -4
  44. package/dist/{lead-nmzd0ykq.js → lead-r01f3pft.js} +18 -18
  45. package/dist/{maintenance-staxb3xt.js → maintenance-tr5vvp93.js} +4 -4
  46. package/dist/{oauth-refresh-sweep-fqczcwxn.js → oauth-refresh-sweep-s2jrst63.js} +3 -3
  47. package/dist/{onboard-shmqj6ep.js → onboard-czarh0tp.js} +2 -2
  48. package/dist/{otel-impl-726bmdyc.js → otel-impl-3e0t0kga.js} +1 -1
  49. package/dist/{pricing-refresh-rzwka8rf.js → pricing-refresh-0dvbj3rq.js} +4 -4
  50. package/dist/{rbac-roles-chkhakmf.js → rbac-roles-1q4v9s52.js} +3 -3
  51. package/dist/{rbac-roles-j2k0h8sx.js → rbac-roles-thnb7h7j.js} +2 -2
  52. package/dist/{seed-pricing-vta6a1q3.js → seed-pricing-76xbxghj.js} +3 -3
  53. package/dist/{setup-yv9ctywz.js → setup-b134pfqr.js} +2 -2
  54. package/dist/{worker-7w6571j0.js → worker-e1ssyv77.js} +18 -18
  55. package/openapi.json +369 -4
  56. package/package.json +1 -1
  57. package/plugin/skills/pages/SKILL.md +7 -0
  58. package/src/artifact-sdk/browser-sdk.ts +12 -0
  59. package/src/assets/key.ts +115 -0
  60. package/src/be/asset-key-audit.ts +210 -0
  61. package/src/be/asset-key-auth.ts +44 -0
  62. package/src/be/db.ts +721 -152
  63. package/src/be/migrations/115_asset_namespace_keys.sql +400 -0
  64. package/src/be/migrations/116_favorite_principal_scope.sql +38 -0
  65. package/src/be/seed-scripts/catalog/complete-task.ts +26 -0
  66. package/src/be/seed-scripts/catalog/delegate.ts +36 -0
  67. package/src/be/seed-scripts/catalog/get-child-outputs.ts +51 -0
  68. package/src/be/seed-scripts/catalog/report-progress.ts +16 -0
  69. package/src/be/seed-scripts/catalog/swarm-overview.ts +21 -0
  70. package/src/be/seed-scripts/catalog/wait-for-task.ts +32 -0
  71. package/src/be/seed-scripts/index.ts +53 -0
  72. package/src/be/seed-skills/index.ts +7 -0
  73. package/src/commands/runner.ts +62 -6
  74. package/src/http/all-routes.ts +1 -0
  75. package/src/http/assets.ts +238 -0
  76. package/src/http/favorite-owner.ts +39 -0
  77. package/src/http/favorites.ts +17 -16
  78. package/src/http/index.ts +2 -0
  79. package/src/http/mcp-bridge.ts +3 -1
  80. package/src/http/mcp.ts +11 -2
  81. package/src/http/pages.ts +54 -13
  82. package/src/http/schedules.ts +44 -5
  83. package/src/http/stats.ts +3 -3
  84. package/src/http/tasks.ts +25 -1
  85. package/src/http/workflows.ts +52 -6
  86. package/src/prompts/base-prompt.ts +28 -5
  87. package/src/prompts/session-templates.ts +56 -0
  88. package/src/scheduler/scheduler.test.ts +1 -0
  89. package/src/scheduler/scheduler.ts +1 -0
  90. package/src/server.ts +26 -1
  91. package/src/tests/artifact-sdk.test.ts +9 -1
  92. package/src/tests/asset-key-api.test.ts +277 -0
  93. package/src/tests/asset-key-invariants.test.ts +233 -0
  94. package/src/tests/asset-key-mcp.test.ts +168 -0
  95. package/src/tests/asset-key-migration.test.ts +336 -0
  96. package/src/tests/asset-key-normalization.test.ts +68 -0
  97. package/src/tests/favorites.test.ts +37 -0
  98. package/src/tests/pool-affinity.test.ts +3 -1
  99. package/src/tests/prompt-template-session.test.ts +5 -4
  100. package/src/tests/script-connections.test.ts +2 -0
  101. package/src/tests/scripts-only-gating.test.ts +307 -0
  102. package/src/tests/seed-scripts.test.ts +2 -2
  103. package/src/tests/system-default-skills.test.ts +6 -0
  104. package/src/tests/ui-swarm-sdk.test.ts +81 -0
  105. package/src/tests/workflow-workspace.test.ts +2 -0
  106. package/src/tools/create-page.ts +32 -1
  107. package/src/tools/get-tasks.ts +11 -1
  108. package/src/tools/schedules/create-schedule.ts +14 -1
  109. package/src/tools/schedules/list-schedules.ts +8 -0
  110. package/src/tools/schedules/patch-schedule.ts +11 -1
  111. package/src/tools/schedules/update-schedule.ts +11 -1
  112. package/src/tools/send-task.ts +30 -0
  113. package/src/tools/task-action.ts +24 -0
  114. package/src/tools/workflows/create-workflow.ts +19 -1
  115. package/src/tools/workflows/list-workflows.ts +5 -3
  116. package/src/tools/workflows/patch-workflow.ts +7 -2
  117. package/src/tools/workflows/update-workflow.ts +6 -0
  118. package/src/types.ts +64 -2
  119. package/src/utils/scripts-only-mode.ts +5 -0
  120. package/src/workflows/executors/agent-task.ts +4 -1
  121. package/templates/skills/asset-namespaces/config.json +14 -0
  122. package/templates/skills/asset-namespaces/content.md +60 -0
@@ -10,14 +10,14 @@ import {
10
10
  } from "./cli-ftyf58xj.js";
11
11
  import {
12
12
  startPricingRefreshLoop
13
- } from "./cli-fep22bhf.js";
13
+ } from "./cli-mxennm5t.js";
14
14
  import {
15
15
  seedPricingFromModelsDev
16
- } from "./cli-q0yn57de.js";
16
+ } from "./cli-vfq38b3e.js";
17
17
  import {
18
18
  ensureRbacSeedsSynced,
19
19
  getUserGrant
20
- } from "./cli-kfjs4fjw.js";
20
+ } from "./cli-hyn69s0c.js";
21
21
  import {
22
22
  can,
23
23
  decideAdmission,
@@ -37,7 +37,7 @@ import {
37
37
  repointTrackerSyncBySwarmId,
38
38
  updateTrackerSync,
39
39
  updateTrackerSyncSwarmId
40
- } from "./cli-yarjrgd5.js";
40
+ } from "./cli-9ed8efw3.js";
41
41
  import {
42
42
  ZodFirstPartyTypeKind,
43
43
  objectType
@@ -47,7 +47,7 @@ import {
47
47
  ensure,
48
48
  require_dist,
49
49
  runScheduleNow
50
- } from "./cli-t6n84nqv.js";
50
+ } from "./cli-chs2zh28.js";
51
51
  import {
52
52
  TriggerSchemaError,
53
53
  applyDefinitionPatch,
@@ -61,7 +61,7 @@ import {
61
61
  startWorkflowExecution,
62
62
  validateDefinition,
63
63
  validateJsonSchema
64
- } from "./cli-e0xv4nd4.js";
64
+ } from "./cli-jy7w6z37.js";
65
65
  import {
66
66
  getApiKey
67
67
  } from "./cli-f14fvzag.js";
@@ -81,7 +81,7 @@ import {
81
81
  setScriptConnectionEnabled,
82
82
  upsertCredentialBinding,
83
83
  upsertScriptConnection
84
- } from "./cli-vwhg6sbn.js";
84
+ } from "./cli-bx96sw2z.js";
85
85
  import {
86
86
  CANDIDATE_SET_MULTIPLIER,
87
87
  computeScore,
@@ -93,7 +93,7 @@ import {
93
93
  isGraphExpansionEnabled,
94
94
  rerank,
95
95
  rowToCandidate
96
- } from "./cli-rymspw51.js";
96
+ } from "./cli-qcm02dkk.js";
97
97
  import {
98
98
  buildAuthorizationUrl,
99
99
  ensureToken,
@@ -101,17 +101,17 @@ import {
101
101
  getOAuthApp,
102
102
  getOAuthTokens,
103
103
  upsertOAuthApp
104
- } from "./cli-hmw1vk30.js";
104
+ } from "./cli-dqxwy0td.js";
105
105
  import {
106
106
  createAdditiveBuffer,
107
107
  extractSlackMessageText,
108
108
  parseSlackTs
109
- } from "./cli-9kk0xa5w.js";
109
+ } from "./cli-06xdf1gz.js";
110
110
  import {
111
111
  getSlackApp,
112
112
  startSlackApp,
113
113
  stopSlackApp
114
- } from "./cli-jkp1gndy.js";
114
+ } from "./cli-15m4y05s.js";
115
115
  import {
116
116
  findOrCreateUserByEmail,
117
117
  findUserByExternalId,
@@ -127,13 +127,13 @@ import {
127
127
  resolveIdentityByEmail,
128
128
  resolveUserByToken,
129
129
  unlinkIdentity
130
- } from "./cli-w5axeg22.js";
130
+ } from "./cli-txxvn1zb.js";
131
131
  import {
132
132
  markdownToSlack
133
133
  } from "./cli-ma04faw5.js";
134
134
  import {
135
135
  createTaskWithSiblingAwareness
136
- } from "./cli-5ekf4gcj.js";
136
+ } from "./cli-qf35kzka.js";
137
137
  import {
138
138
  getAppUrl,
139
139
  getMcpBaseUrl,
@@ -147,6 +147,7 @@ import {
147
147
  AgentSchema,
148
148
  AgentTaskSchema,
149
149
  AgentTaskStatusSchema,
150
+ AssetKeySchema,
150
151
  AttachmentInputSchema,
151
152
  BudgetRefusalCauseSchema,
152
153
  ChannelMessageSchema,
@@ -188,6 +189,7 @@ import {
188
189
  agentContextKey,
189
190
  agentmailContextKey,
190
191
  buildJiraContextKey,
192
+ canWriteAssetKey,
191
193
  cancelTask,
192
194
  checkDependencies,
193
195
  checkSlackRoutingCoherence,
@@ -306,6 +308,7 @@ import {
306
308
  init_context_key,
307
309
  init_db,
308
310
  init_defaults,
311
+ init_key,
309
312
  init_registry,
310
313
  init_request_auth_context,
311
314
  init_resolver,
@@ -332,7 +335,9 @@ import {
332
335
  maskSecrets,
333
336
  moveTaskFromBacklog,
334
337
  moveTaskToBacklog,
338
+ normalizeAssetKey,
335
339
  onTaskStarted,
340
+ parseAssetKey,
336
341
  postMessage,
337
342
  reassociateSessionLogs,
338
343
  recordBudgetRefusalNotification,
@@ -372,7 +377,7 @@ import {
372
377
  upsertService,
373
378
  upsertSwarmConfig,
374
379
  validateConfigValue
375
- } from "./cli-s5q026mr.js";
380
+ } from "./cli-j12px91x.js";
376
381
  import {
377
382
  init_zod
378
383
  } from "./cli-bw80ck94.js";
@@ -417,7 +422,7 @@ import {
417
422
  import {
418
423
  init_package,
419
424
  package_default
420
- } from "./cli-xcp5dmts.js";
425
+ } from "./cli-9kbww4vb.js";
421
426
  import {
422
427
  init_secret_scrubber,
423
428
  refreshSecretScrubberCache,
@@ -19705,7 +19710,7 @@ async function initOtel(serviceRole = process.env.AGENT_ROLE || "api") {
19705
19710
  return;
19706
19711
  initialized2 = true;
19707
19712
  try {
19708
- const impl = await import("./otel-impl-726bmdyc.js");
19713
+ const impl = await import("./otel-impl-3e0t0kga.js");
19709
19714
  await impl.boot(serviceRole);
19710
19715
  realWithSpan = impl.withSpan;
19711
19716
  realStartSpan = impl.startSpan;
@@ -20782,6 +20787,74 @@ var registerCreateMetricTool = (server) => {
20782
20787
 
20783
20788
  // src/tools/create-page.ts
20784
20789
  init_zod();
20790
+
20791
+ // src/be/asset-key-auth.ts
20792
+ init_key();
20793
+ class AssetKeyAuthorizationError extends Error {
20794
+ statusCode;
20795
+ constructor(message, statusCode) {
20796
+ super(message);
20797
+ this.name = "AssetKeyAuthorizationError";
20798
+ this.statusCode = statusCode;
20799
+ }
20800
+ }
20801
+ function authorizeAssetKeyWrite(input, trustedUserId) {
20802
+ let key;
20803
+ try {
20804
+ key = normalizeAssetKey(input);
20805
+ } catch (error) {
20806
+ throw new AssetKeyAuthorizationError(error instanceof Error ? error.message : "Invalid asset namespace key", 400);
20807
+ }
20808
+ const parsed = parseAssetKey(key);
20809
+ if (parsed.root === "shared")
20810
+ return key;
20811
+ if (!findUserById(parsed.userId)) {
20812
+ throw new AssetKeyAuthorizationError("Personal namespace user does not exist", 400);
20813
+ }
20814
+ if (!canWriteAssetKey(key, trustedUserId)) {
20815
+ throw new AssetKeyAuthorizationError("Personal namespace writes require the matching trusted user", 403);
20816
+ }
20817
+ return key;
20818
+ }
20819
+
20820
+ // src/be/audit-user.ts
20821
+ init_request_auth_context();
20822
+ init_db();
20823
+ function resolveTaskAuditUserId(sourceTaskId, callerAgentId) {
20824
+ if (!callerAgentId)
20825
+ return null;
20826
+ let resolvedSourceTaskId = sourceTaskId;
20827
+ if (!resolvedSourceTaskId) {
20828
+ const currentTask = getAgentCurrentTask(callerAgentId);
20829
+ if (currentTask)
20830
+ resolvedSourceTaskId = currentTask.id;
20831
+ }
20832
+ if (!resolvedSourceTaskId)
20833
+ return null;
20834
+ const task = getTaskById(resolvedSourceTaskId);
20835
+ if (!task)
20836
+ return null;
20837
+ if (task.agentId !== callerAgentId)
20838
+ return null;
20839
+ if (task.requestedByUserId)
20840
+ return task.requestedByUserId;
20841
+ if (task.slackUserId) {
20842
+ const user = findUserByExternalId("slack", task.slackUserId);
20843
+ if (user)
20844
+ return user.id;
20845
+ }
20846
+ return null;
20847
+ }
20848
+ function resolveHttpAuditUserId(req, callerAgentId) {
20849
+ const auth = getRequestAuth(req);
20850
+ if (auth?.kind === "user")
20851
+ return auth.userId;
20852
+ const header = req.headers["x-source-task-id"];
20853
+ const sourceTaskId = Array.isArray(header) ? header[0] : header;
20854
+ return resolveTaskAuditUserId(sourceTaskId, callerAgentId);
20855
+ }
20856
+
20857
+ // src/tools/create-page.ts
20785
20858
  init_db();
20786
20859
 
20787
20860
  // src/pages/version.ts
@@ -20833,6 +20906,7 @@ var registerCreatePageTool = (server) => {
20833
20906
  description: "Stores an HTML or JSON page in the swarm and returns shareable URLs. " + "Calls are upsert-by-(agent, slug): if you previously created a page " + "with the same slug, its prior state is snapshotted and the row is " + "updated. Use this for static reports, dashboards, or JSON action " + "specs that don't need a long-lived process.",
20834
20907
  annotations: { destructiveHint: false },
20835
20908
  inputSchema: object({
20909
+ key: AssetKeySchema.optional().describe("Logical namespace. Defaults to a shared/page:<id>/ resource key."),
20836
20910
  title: string().min(1).describe("Human-readable title shown in listings."),
20837
20911
  slug: string().min(1).optional().describe("URL slug. Defaults to the kebab-cased title. Same slug → updates the existing row."),
20838
20912
  body: string().min(1).describe("Full page body (HTML document or JSON-render spec, per contentType)."),
@@ -20845,6 +20919,7 @@ var registerCreatePageTool = (server) => {
20845
20919
  outputSchema: object({
20846
20920
  yourAgentId: string(),
20847
20921
  id: string(),
20922
+ key: AssetKeySchema.optional(),
20848
20923
  version: number(),
20849
20924
  app_url: string(),
20850
20925
  api_url: string()
@@ -20874,12 +20949,35 @@ var registerCreatePageTool = (server) => {
20874
20949
  }
20875
20950
  const needsCredentialsNames = input.needsCredentials?.map((c) => c.name);
20876
20951
  const existing = getPageBySlug(requestInfo.agentId, finalSlug);
20952
+ const trustedUserId = resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId);
20953
+ let assetKey;
20954
+ try {
20955
+ if (input.key !== undefined || !existing) {
20956
+ assetKey = input.key ? authorizeAssetKeyWrite(input.key, trustedUserId) : undefined;
20957
+ }
20958
+ } catch (error) {
20959
+ const msg = error instanceof Error ? error.message : String(error);
20960
+ return {
20961
+ content: [{ type: "text", text: msg }],
20962
+ structuredContent: {
20963
+ yourAgentId: requestInfo.agentId,
20964
+ id: existing?.id ?? "",
20965
+ version: 0,
20966
+ app_url: "",
20967
+ api_url: "",
20968
+ success: false,
20969
+ message: msg
20970
+ },
20971
+ isError: true
20972
+ };
20973
+ }
20877
20974
  let id;
20878
20975
  if (existing) {
20879
20976
  try {
20880
20977
  snapshotPage(existing.id, requestInfo.agentId);
20881
20978
  } catch {}
20882
20979
  const updated = updatePage(existing.id, {
20980
+ key: assetKey,
20883
20981
  title: input.title,
20884
20982
  description: input.description,
20885
20983
  contentType: input.contentType,
@@ -20908,6 +21006,7 @@ var registerCreatePageTool = (server) => {
20908
21006
  } else {
20909
21007
  try {
20910
21008
  const created = createPage({
21009
+ key: assetKey,
20911
21010
  agentId: requestInfo.agentId,
20912
21011
  slug: finalSlug,
20913
21012
  title: input.title,
@@ -20969,6 +21068,7 @@ var registerCreatePageTool = (server) => {
20969
21068
  structuredContent: {
20970
21069
  yourAgentId: requestInfo.agentId,
20971
21070
  id,
21071
+ key: fresh.key,
20972
21072
  version,
20973
21073
  app_url: appUrl,
20974
21074
  api_url: apiUrl
@@ -21825,6 +21925,7 @@ init_db();
21825
21925
  init_types();
21826
21926
  var TaskSummarySchema = object({
21827
21927
  id: string(),
21928
+ key: AssetKeySchema,
21828
21929
  agentId: string().nullable(),
21829
21930
  task: string().optional(),
21830
21931
  taskPreview: string().optional(),
@@ -21849,6 +21950,8 @@ var getTasksInputSchema = object({
21849
21950
  tags: array(string()).optional().describe("Filter by any matching tag."),
21850
21951
  search: string().optional().describe("Search in task description."),
21851
21952
  scheduleId: string().uuid().optional().describe("Filter by schedule ID to find tasks created by a specific schedule."),
21953
+ key: AssetKeySchema.optional().describe("Filter by exact logical namespace."),
21954
+ keyPrefix: AssetKeySchema.optional().describe("Filter by namespace subtree."),
21852
21955
  includeHeartbeat: boolean().optional().describe("Include heartbeat/system tasks in results (excluded by default)."),
21853
21956
  limit: number().int().min(1).max(100).optional().describe("Max tasks to return (default: 25, max: 100)."),
21854
21957
  includeFull: boolean().optional().describe("Return the full `task` text instead of a ~300-char `taskPreview`. Default false.")
@@ -21867,6 +21970,8 @@ async function getTasksHandler(ctx, {
21867
21970
  tags,
21868
21971
  search,
21869
21972
  scheduleId,
21973
+ key,
21974
+ keyPrefix,
21870
21975
  includeHeartbeat,
21871
21976
  limit,
21872
21977
  includeFull
@@ -21882,6 +21987,8 @@ async function getTasksHandler(ctx, {
21882
21987
  tags,
21883
21988
  search,
21884
21989
  scheduleId,
21990
+ key,
21991
+ keyPrefix,
21885
21992
  includeHeartbeat,
21886
21993
  limit,
21887
21994
  requestedByUserId: ctx.kind === "user" ? ctx.userId : undefined
@@ -21889,6 +21996,7 @@ async function getTasksHandler(ctx, {
21889
21996
  const tasks = includeFull ? getAllTasks(taskFilters) : getAllTasks(taskFilters, { slim: true });
21890
21997
  const taskSummaries = tasks.map((t) => ({
21891
21998
  id: t.id,
21999
+ key: t.key,
21892
22000
  agentId: t.agentId,
21893
22001
  ...includeFull ? { task: t.task } : { taskPreview: t.task },
21894
22002
  status: t.status,
@@ -21921,6 +22029,10 @@ async function getTasksHandler(ctx, {
21921
22029
  filters.push(`search='${search}'`);
21922
22030
  if (scheduleId)
21923
22031
  filters.push(`scheduleId='${scheduleId}'`);
22032
+ if (key)
22033
+ filters.push(`key='${key}'`);
22034
+ if (keyPrefix)
22035
+ filters.push(`keyPrefix='${keyPrefix}'`);
21924
22036
  const filterMsg = filters.length > 0 ? ` (${filters.join(", ")})` : "";
21925
22037
  const structuredContent = {
21926
22038
  yourAgentId: agentId,
@@ -26225,45 +26337,6 @@ var registerUpdateRepoTool = (server) => {
26225
26337
  };
26226
26338
  // src/tools/request-human-input.ts
26227
26339
  init_zod();
26228
-
26229
- // src/be/audit-user.ts
26230
- init_request_auth_context();
26231
- init_db();
26232
- function resolveTaskAuditUserId(sourceTaskId, callerAgentId) {
26233
- if (!callerAgentId)
26234
- return null;
26235
- let resolvedSourceTaskId = sourceTaskId;
26236
- if (!resolvedSourceTaskId) {
26237
- const currentTask = getAgentCurrentTask(callerAgentId);
26238
- if (currentTask)
26239
- resolvedSourceTaskId = currentTask.id;
26240
- }
26241
- if (!resolvedSourceTaskId)
26242
- return null;
26243
- const task = getTaskById(resolvedSourceTaskId);
26244
- if (!task)
26245
- return null;
26246
- if (task.agentId !== callerAgentId)
26247
- return null;
26248
- if (task.requestedByUserId)
26249
- return task.requestedByUserId;
26250
- if (task.slackUserId) {
26251
- const user = findUserByExternalId("slack", task.slackUserId);
26252
- if (user)
26253
- return user.id;
26254
- }
26255
- return null;
26256
- }
26257
- function resolveHttpAuditUserId(req, callerAgentId) {
26258
- const auth = getRequestAuth(req);
26259
- if (auth?.kind === "user")
26260
- return auth.userId;
26261
- const header = req.headers["x-source-task-id"];
26262
- const sourceTaskId = Array.isArray(header) ? header[0] : header;
26263
- return resolveTaskAuditUserId(sourceTaskId, callerAgentId);
26264
- }
26265
-
26266
- // src/tools/request-human-input.ts
26267
26340
  init_db();
26268
26341
  var QuestionSchema = object({
26269
26342
  id: string().describe("Unique ID for the question (used as key in responses)"),
@@ -26424,6 +26497,7 @@ var import_cron_parser = __toESM(require_dist(), 1);
26424
26497
  init_db();
26425
26498
  init_types();
26426
26499
  var createScheduleInputSchema = object({
26500
+ key: AssetKeySchema.optional().describe("Logical namespace. Defaults to a shared/schedule:<id>/ resource key."),
26427
26501
  name: string().min(1).max(100).describe("Unique name for the schedule (e.g., 'daily-cleanup')"),
26428
26502
  taskTemplate: string().min(1).optional().describe("The task description that will be created each time. Required when targetType is 'agent-task' (the default)."),
26429
26503
  targetType: ScheduledTaskTargetTypeSchema.default("agent-task").optional().describe("Execution target. Use 'workflow' + workflowId when the schedule only starts a workflow; " + "use 'script' + scriptName/scriptArgs when it only runs a catalog script; " + "use 'agent-task' only when a reasoning agent genuinely needs to be in the loop. " + "Do not create an agent-task whose taskTemplate just tells an agent to trigger a workflow or script."),
@@ -26457,6 +26531,7 @@ var registerCreateScheduleTool = (server) => {
26457
26531
  message: string(),
26458
26532
  schedule: object({
26459
26533
  id: string(),
26534
+ key: AssetKeySchema,
26460
26535
  name: string(),
26461
26536
  description: string().optional(),
26462
26537
  cronExpression: string().optional(),
@@ -26483,6 +26558,7 @@ var registerCreateScheduleTool = (server) => {
26483
26558
  }).optional()
26484
26559
  })
26485
26560
  }, async ({
26561
+ key,
26486
26562
  name,
26487
26563
  taskTemplate,
26488
26564
  targetType,
@@ -26685,7 +26761,9 @@ var registerCreateScheduleTool = (server) => {
26685
26761
  nextRunAt = calculateNextRun(tempSchedule, new Date);
26686
26762
  }
26687
26763
  const createdBy = resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId) ?? undefined;
26764
+ const assetKey = key ? authorizeAssetKeyWrite(key, createdBy) : undefined;
26688
26765
  const schedule = createScheduledTask({
26766
+ key: assetKey,
26689
26767
  name,
26690
26768
  taskTemplate,
26691
26769
  targetType,
@@ -26992,6 +27070,7 @@ var registerDeleteScheduleTool = (server) => {
26992
27070
  // src/tools/schedules/list-schedules.ts
26993
27071
  init_zod();
26994
27072
  init_db();
27073
+ init_types();
26995
27074
  var registerListSchedulesTool = (server) => {
26996
27075
  createToolRegistrar(server)("list-schedules", {
26997
27076
  title: "List Scheduled Tasks",
@@ -27000,6 +27079,8 @@ var registerListSchedulesTool = (server) => {
27000
27079
  inputSchema: object({
27001
27080
  enabled: boolean().optional().describe("Filter by enabled status"),
27002
27081
  name: string().optional().describe("Filter by name (partial match)"),
27082
+ key: AssetKeySchema.optional().describe("Filter by exact namespace."),
27083
+ keyPrefix: AssetKeySchema.optional().describe("Filter by namespace subtree."),
27003
27084
  scheduleType: _enum(["recurring", "one_time"]).optional().describe("Filter by schedule type"),
27004
27085
  hideCompleted: boolean().default(true).optional().describe("Hide completed one-time schedules (default: true)"),
27005
27086
  consecutiveErrorsMin: number().int().min(0).optional().describe("Only return schedules with at least this many consecutive errors."),
@@ -27012,6 +27093,7 @@ var registerListSchedulesTool = (server) => {
27012
27093
  message: string(),
27013
27094
  schedules: array(object({
27014
27095
  id: string(),
27096
+ key: AssetKeySchema,
27015
27097
  name: string(),
27016
27098
  description: string().optional(),
27017
27099
  cronExpression: string().optional(),
@@ -27039,6 +27121,8 @@ var registerListSchedulesTool = (server) => {
27039
27121
  }, async ({
27040
27122
  enabled: enabled2,
27041
27123
  name,
27124
+ key,
27125
+ keyPrefix,
27042
27126
  scheduleType,
27043
27127
  hideCompleted,
27044
27128
  consecutiveErrorsMin,
@@ -27060,6 +27144,8 @@ var registerListSchedulesTool = (server) => {
27060
27144
  const filters = {
27061
27145
  enabled: enabled2,
27062
27146
  name,
27147
+ key,
27148
+ keyPrefix,
27063
27149
  scheduleType,
27064
27150
  hideCompleted,
27065
27151
  consecutiveErrorsMin,
@@ -27130,6 +27216,7 @@ function validateRecurringTiming(merged) {
27130
27216
  // src/tools/schedules/patch-schedule.ts
27131
27217
  init_types();
27132
27218
  var patchScheduleInputSchema = object({
27219
+ key: AssetKeySchema.optional().describe("Move to a logical namespace."),
27133
27220
  scheduleId: string().uuid().optional().describe("Schedule ID to patch"),
27134
27221
  name: string().optional().describe("Schedule name to patch (alternative to ID)"),
27135
27222
  newName: string().min(1).max(100).optional().describe("New name for the schedule"),
@@ -27162,6 +27249,7 @@ var registerPatchScheduleTool = (server) => {
27162
27249
  message: string(),
27163
27250
  schedule: object({
27164
27251
  id: string(),
27252
+ key: AssetKeySchema,
27165
27253
  name: string(),
27166
27254
  description: string().optional(),
27167
27255
  cronExpression: string().optional(),
@@ -27188,6 +27276,7 @@ var registerPatchScheduleTool = (server) => {
27188
27276
  }).optional()
27189
27277
  })
27190
27278
  }, async ({
27279
+ key,
27191
27280
  scheduleId,
27192
27281
  name,
27193
27282
  newName,
@@ -27411,6 +27500,8 @@ var registerPatchScheduleTool = (server) => {
27411
27500
  }
27412
27501
  }
27413
27502
  const updatedBy = resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId) ?? undefined;
27503
+ if (key !== undefined)
27504
+ updateData.key = authorizeAssetKeyWrite(key, updatedBy);
27414
27505
  const updated = updateScheduledTask(schedule.id, { ...updateData, updatedBy });
27415
27506
  if (!updated) {
27416
27507
  return {
@@ -27553,6 +27644,7 @@ var import_cron_parser3 = __toESM(require_dist(), 1);
27553
27644
  init_db();
27554
27645
  init_types();
27555
27646
  var updateScheduleInputSchema = object({
27647
+ key: AssetKeySchema.optional().describe("Move to a logical namespace."),
27556
27648
  scheduleId: string().uuid().optional().describe("Schedule ID to update"),
27557
27649
  name: string().optional().describe("Schedule name to update (alternative to ID)"),
27558
27650
  newName: string().min(1).max(100).optional().describe("New name for the schedule"),
@@ -27585,6 +27677,7 @@ var registerUpdateScheduleTool = (server) => {
27585
27677
  message: string(),
27586
27678
  schedule: object({
27587
27679
  id: string(),
27680
+ key: AssetKeySchema,
27588
27681
  name: string(),
27589
27682
  description: string().optional(),
27590
27683
  cronExpression: string().optional(),
@@ -27611,6 +27704,7 @@ var registerUpdateScheduleTool = (server) => {
27611
27704
  }).optional()
27612
27705
  })
27613
27706
  }, async ({
27707
+ key,
27614
27708
  scheduleId,
27615
27709
  name,
27616
27710
  newName,
@@ -27834,6 +27928,8 @@ var registerUpdateScheduleTool = (server) => {
27834
27928
  }
27835
27929
  }
27836
27930
  const updatedBy = resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId) ?? undefined;
27931
+ if (key !== undefined)
27932
+ updateData.key = authorizeAssetKeyWrite(key, updatedBy);
27837
27933
  const updated = updateScheduledTask(schedule.id, { ...updateData, updatedBy });
27838
27934
  if (!updated) {
27839
27935
  return {
@@ -28667,6 +28763,7 @@ init_types();
28667
28763
  var sendTaskInputSchema = object({
28668
28764
  agentId: uuid().optional().describe("The agent to assign/offer task to. Omit to create unassigned task for pool."),
28669
28765
  task: string().min(1).describe("The task description to send."),
28766
+ key: AssetKeySchema.optional().describe("Logical namespace key. Child tasks inherit their parent namespace when provided."),
28670
28767
  offerMode: boolean().default(false).describe("If true, offer the task instead of direct assign (agent must accept/reject)."),
28671
28768
  taskType: string().max(50).optional().describe("Task type (e.g., 'bug', 'feature', 'review')."),
28672
28769
  tags: array(string()).optional().describe("Tags for filtering (e.g., ['urgent', 'frontend'])."),
@@ -28723,6 +28820,7 @@ function transferTrackerSyncToResumeChild(args) {
28723
28820
  async function sendTaskHandler(ctx, {
28724
28821
  agentId,
28725
28822
  task,
28823
+ key,
28726
28824
  offerMode,
28727
28825
  taskType,
28728
28826
  tags,
@@ -28802,6 +28900,19 @@ async function sendTaskHandler(ctx, {
28802
28900
  } else if (slackChannelId || slackThreadTs) {
28803
28901
  console.log(`[send-task] slack-context override: creatorAgentId=${creatorAgentId ?? "n/a"} slackChannelId=${slackChannelId ?? "n/a"} slackThreadTs=${slackThreadTs ?? "n/a"} parentTaskId=${effectiveParentTaskId ?? "n/a"}`);
28804
28902
  }
28903
+ let assetKey;
28904
+ try {
28905
+ const trustedUserId = ctx.kind === "user" ? ctx.userId : resolveTaskAuditUserId(sourceTaskId, creatorAgentId);
28906
+ const requestedKey = key ?? effectiveParentTask?.key;
28907
+ assetKey = requestedKey ? authorizeAssetKeyWrite(requestedKey, trustedUserId) : undefined;
28908
+ } catch (error) {
28909
+ const message = error instanceof AssetKeyAuthorizationError ? error.message : error instanceof Error ? error.message : String(error);
28910
+ return {
28911
+ isError: true,
28912
+ content: [{ type: "text", text: message }],
28913
+ structuredContent: { yourAgentId: creatorAgentId, success: false, message }
28914
+ };
28915
+ }
28805
28916
  let effectiveAgentId = agentId;
28806
28917
  if (effectiveParentTaskId && !agentId) {
28807
28918
  if (effectiveParentTask?.agentId) {
@@ -28865,6 +28976,7 @@ async function sendTaskHandler(ctx, {
28865
28976
  const finalTags = tags;
28866
28977
  if (!effectiveAgentId) {
28867
28978
  const newTask2 = createTaskExtended(task, {
28979
+ key: assetKey,
28868
28980
  creatorAgentId,
28869
28981
  requestedByUserId,
28870
28982
  sourceTaskId,
@@ -28918,6 +29030,7 @@ async function sendTaskHandler(ctx, {
28918
29030
  }
28919
29031
  if (offerMode) {
28920
29032
  const newTask2 = createTaskExtended(task, {
29033
+ key: assetKey,
28921
29034
  offeredTo: effectiveAgentId,
28922
29035
  creatorAgentId,
28923
29036
  requestedByUserId,
@@ -28950,6 +29063,7 @@ async function sendTaskHandler(ctx, {
28950
29063
  };
28951
29064
  }
28952
29065
  const newTask = createTaskExtended(task, {
29066
+ key: assetKey,
28953
29067
  agentId: effectiveAgentId,
28954
29068
  creatorAgentId,
28955
29069
  requestedByUserId,
@@ -34883,7 +34997,7 @@ async function notifySlack(text) {
34883
34997
  return;
34884
34998
  }
34885
34999
  try {
34886
- const { getSlackApp: getSlackApp2 } = await import("./app-976fykvr.js");
35000
+ const { getSlackApp: getSlackApp2 } = await import("./app-w2067dt3.js");
34887
35001
  const app = getSlackApp2();
34888
35002
  if (!app) {
34889
35003
  console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
@@ -34952,7 +35066,7 @@ async function deleteJiraWebhook(webhookId) {
34952
35066
  console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
34953
35067
  }
34954
35068
  async function overwriteWebhookIds(next) {
34955
- const { getDb: getDb2 } = await import("./db-6xw82vz3.js");
35069
+ const { getDb: getDb2 } = await import("./db-kmemzvqt.js");
34956
35070
  const db = getDb2();
34957
35071
  const txn = db.transaction(() => {
34958
35072
  const row = db.query("SELECT metadata FROM oauth_apps WHERE provider = 'jira'").get();
@@ -110096,6 +110210,7 @@ var TaskActionSchema = _enum([
110096
110210
  var taskActionInputSchema = object({
110097
110211
  action: TaskActionSchema.describe("The action to perform: 'create' creates an unassigned task, 'claim' takes a task from pool, 'release' returns task to pool, 'accept' accepts offered task, 'reject' declines offered task, 'to_backlog' moves task to backlog, 'from_backlog' moves task from backlog to pool."),
110098
110212
  task: string().min(1).optional().describe("Task description (required for 'create')."),
110213
+ key: AssetKeySchema.optional().describe("Logical namespace for a created task. Defaults to a shared/task:<id>/ resource key."),
110099
110214
  taskType: string().max(50).optional().describe("Task type (e.g., 'bug', 'feature')."),
110100
110215
  tags: array(string()).optional().describe("Tags for filtering (e.g., ['urgent', 'frontend'])."),
110101
110216
  priority: number().int().min(0).max(100).optional().describe("Priority 0-100, default 50."),
@@ -110155,6 +110270,7 @@ async function taskActionHandler(ctx, input) {
110155
110270
  const {
110156
110271
  action,
110157
110272
  task,
110273
+ key,
110158
110274
  taskType,
110159
110275
  tags,
110160
110276
  priority,
@@ -110226,6 +110342,15 @@ async function taskActionHandler(ctx, input) {
110226
110342
  };
110227
110343
  }
110228
110344
  const agentId = ctx.agentId;
110345
+ let assetKey;
110346
+ if (action === "create") {
110347
+ try {
110348
+ assetKey = key ? authorizeAssetKeyWrite(key, resolveTaskAuditUserId(ctx.sourceTaskId, agentId)) : undefined;
110349
+ } catch (error) {
110350
+ const message = error instanceof AssetKeyAuthorizationError ? error.message : error instanceof Error ? error.message : String(error);
110351
+ return taskActionCallResult({ success: false, message }, agentId);
110352
+ }
110353
+ }
110229
110354
  const txn = getDb().transaction(() => {
110230
110355
  switch (action) {
110231
110356
  case "create": {
@@ -110236,6 +110361,7 @@ async function taskActionHandler(ctx, input) {
110236
110361
  };
110237
110362
  }
110238
110363
  const newTask = createTaskExtended(task, {
110364
+ key: assetKey,
110239
110365
  creatorAgentId: agentId,
110240
110366
  taskType,
110241
110367
  tags,
@@ -111365,6 +111491,7 @@ var registerCreateWorkflowTool = (server) => {
111365
111491
  ` + "- WAIT NODE: type 'wait' pauses a workflow for a duration or until a named workflowEventBus event arrives. " + "See runbooks/workflows.md#wait-nodes for config shapes, ordering caveats, and built-in event names.",
111366
111492
  inputSchema: exports_external.object({
111367
111493
  name: exports_external.string().describe("Unique name for the workflow"),
111494
+ key: AssetKeySchema.optional().describe("Logical namespace. Defaults to a shared/workflow:<id>/ resource key."),
111368
111495
  description: exports_external.string().optional().describe("Description of what this workflow does"),
111369
111496
  definition: WorkflowDefinitionSchema.describe("The workflow definition with nodes (each node has id, type, config, and optional next/retry/validation)"),
111370
111497
  triggers: exports_external.array(TriggerConfigSchema).optional().describe("Optional trigger configurations (webhook, schedule). Webhook verification formats: legacy omitted verification, hmac-sha256, timestamped-hmac-sha256, token-equality."),
@@ -111380,7 +111507,18 @@ var registerCreateWorkflowTool = (server) => {
111380
111507
  message: exports_external.string(),
111381
111508
  workflow: exports_external.unknown().optional()
111382
111509
  })
111383
- }, async ({ name, description, definition, triggers, cooldown, input, dir, vcsRepo, triggerSchema }, requestInfo) => {
111510
+ }, async ({
111511
+ name,
111512
+ key,
111513
+ description,
111514
+ definition,
111515
+ triggers,
111516
+ cooldown,
111517
+ input,
111518
+ dir,
111519
+ vcsRepo,
111520
+ triggerSchema
111521
+ }, requestInfo) => {
111384
111522
  if (!requestInfo.agentId) {
111385
111523
  return {
111386
111524
  content: [{ type: "text", text: "Agent ID required." }],
@@ -111404,7 +111542,9 @@ var registerCreateWorkflowTool = (server) => {
111404
111542
  };
111405
111543
  }
111406
111544
  const createdBy = resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId) ?? undefined;
111545
+ const assetKey = key ? authorizeAssetKeyWrite(key, createdBy) : undefined;
111407
111546
  const workflow = createWorkflow({
111547
+ key: assetKey,
111408
111548
  name,
111409
111549
  description,
111410
111550
  definition,
@@ -111623,6 +111763,8 @@ var registerListWorkflowsTool = (server) => {
111623
111763
  description: "List all automation workflows, optionally filtered by enabled status. Returns SLIM rows WITHOUT the full `definition` (DAG) — each row carries a `nodeCount` instead. To inspect or patch a workflow's nodes/triggers, call `get-workflow` by id, or pass `includeFull: true` here.",
111624
111764
  inputSchema: exports_external.object({
111625
111765
  enabled: exports_external.boolean().optional().describe("Filter by enabled status (omit to return all)"),
111766
+ key: AssetKeySchema.optional().describe("Filter by exact namespace."),
111767
+ keyPrefix: AssetKeySchema.optional().describe("Filter by namespace subtree."),
111626
111768
  consecutiveErrorsMin: exports_external.number().int().min(0).optional().describe("Only return workflows with at least this many latest consecutive failed runs."),
111627
111769
  lastRunStatus: WorkflowRunStatusSchema.optional().describe("Only return workflows whose latest run has this status."),
111628
111770
  includeFull: exports_external.boolean().optional().describe("Return the full workflow `definition` + trigger config instead of slim rows. Default false — prefer `get-workflow` to fetch a single workflow in full.")
@@ -111632,9 +111774,9 @@ var registerListWorkflowsTool = (server) => {
111632
111774
  message: exports_external.string(),
111633
111775
  workflows: exports_external.array(exports_external.unknown())
111634
111776
  })
111635
- }, async ({ enabled: enabled2, consecutiveErrorsMin, lastRunStatus, includeFull }) => {
111777
+ }, async ({ enabled: enabled2, key, keyPrefix, consecutiveErrorsMin, lastRunStatus, includeFull }) => {
111636
111778
  try {
111637
- const filters = { enabled: enabled2, consecutiveErrorsMin, lastRunStatus };
111779
+ const filters = { enabled: enabled2, key, keyPrefix, consecutiveErrorsMin, lastRunStatus };
111638
111780
  const workflows = includeFull ? listWorkflows(filters) : listWorkflows(filters, { slim: true });
111639
111781
  return {
111640
111782
  content: [{ type: "text", text: `Found ${workflows.length} workflow(s).` }],
@@ -111663,6 +111805,7 @@ var registerPatchWorkflowTool = (server) => {
111663
111805
  description: "Partially update a workflow by creating, updating, or deleting individual nodes, " + "and/or by setting/clearing the trigger payload schema. " + "DAG operations are applied in order: delete → create → update. " + "`triggerSchema` is independent of DAG ops: pass an object to set/replace, " + "pass null to clear, or omit to leave unchanged. " + "Validator subset for `triggerSchema`: type, required, properties, enum, const, items. " + "Other JSON-Schema keywords are silently ignored. " + "Creates a version snapshot before applying changes.",
111664
111806
  inputSchema: exports_external.object({
111665
111807
  id: exports_external.string().uuid().describe("Workflow ID to patch"),
111808
+ key: AssetKeySchema.optional().describe("Move to a logical namespace."),
111666
111809
  update: exports_external.array(exports_external.object({
111667
111810
  nodeId: exports_external.string(),
111668
111811
  node: WorkflowNodePatchSchema
@@ -111688,7 +111831,7 @@ var registerPatchWorkflowTool = (server) => {
111688
111831
  nodesUpdated: exports_external.number().optional(),
111689
111832
  nodesDeleted: exports_external.number().optional()
111690
111833
  })
111691
- }, async ({ id, update, delete: del, create, onNodeFailure, triggerSchema }, requestInfo) => {
111834
+ }, async ({ id, key, update, delete: del, create, onNodeFailure, triggerSchema }, requestInfo) => {
111692
111835
  try {
111693
111836
  const existing = getWorkflow(id);
111694
111837
  if (!existing) {
@@ -111723,6 +111866,9 @@ var registerPatchWorkflowTool = (server) => {
111723
111866
  const updateArgs = {
111724
111867
  definition: patchResult.definition
111725
111868
  };
111869
+ if (key !== undefined) {
111870
+ updateArgs.key = authorizeAssetKeyWrite(key, updatedBy);
111871
+ }
111726
111872
  if (triggerSchema !== undefined) {
111727
111873
  updateArgs.triggerSchema = triggerSchema;
111728
111874
  }
@@ -111989,6 +112135,7 @@ var registerUpdateWorkflowTool = (server) => {
111989
112135
  description: "Update an existing workflow's name, description, definition, triggers, cooldown, input, triggerSchema, or enabled state. " + "Creates a version snapshot before applying changes. " + "TRIGGER SCHEMA: pass 'triggerSchema' as a JSON-Schema object to set/replace, or 'null' to clear. " + "Supported JSON-Schema keywords: type, required, properties, enum, const, items (recursive into arrays). " + "Other JSON-Schema keywords (oneOf/anyOf/$ref/pattern/format/additionalProperties) are silently ignored. " + "WEBHOOK VERIFICATION: webhook triggers use hmacSecret for all verification formats. " + "Omit verification for legacy HMAC-SHA256 over the raw body with fallback header scanning; " + "or set verification to { format: 'hmac-sha256', header }, { format: 'timestamped-hmac-sha256', header, toleranceSeconds? }, " + "or { format: 'token-equality', header }.",
111990
112136
  inputSchema: exports_external.object({
111991
112137
  id: exports_external.string().uuid().describe("Workflow ID to update"),
112138
+ key: AssetKeySchema.optional().describe("Move to a logical namespace."),
111992
112139
  name: exports_external.string().optional().describe("New name for the workflow"),
111993
112140
  description: exports_external.string().optional().describe("New description"),
111994
112141
  definition: WorkflowDefinitionSchema.optional().describe("New workflow definition"),
@@ -112008,6 +112155,7 @@ var registerUpdateWorkflowTool = (server) => {
112008
112155
  })
112009
112156
  }, async ({
112010
112157
  id,
112158
+ key,
112011
112159
  name,
112012
112160
  description,
112013
112161
  definition,
@@ -112046,7 +112194,9 @@ var registerUpdateWorkflowTool = (server) => {
112046
112194
  }
112047
112195
  const version = snapshotWorkflow(id, requestInfo.agentId);
112048
112196
  const updatedBy = resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId) ?? undefined;
112197
+ const assetKey = key === undefined ? undefined : authorizeAssetKeyWrite(key, updatedBy);
112049
112198
  const workflow = updateWorkflow(id, {
112199
+ key: assetKey,
112050
112200
  name,
112051
112201
  description,
112052
112202
  definition,
@@ -112087,6 +112237,15 @@ var registerUpdateWorkflowTool = (server) => {
112087
112237
  }
112088
112238
  });
112089
112239
  };
112240
+ // src/utils/scripts-only-mode.ts
112241
+ function resolveScriptsOnlyMode(opts) {
112242
+ if (opts.env)
112243
+ return opts.env === "true";
112244
+ if (opts.configValue)
112245
+ return opts.configValue === "true";
112246
+ return false;
112247
+ }
112248
+
112090
112249
  // src/server.ts
112091
112250
  var DEFAULT_CAPABILITIES = "core,task-pool,profiles,services,scheduling,memory,workflows,pages,metrics,kv";
112092
112251
  var CAPABILITIES = new Set((process.env.CAPABILITIES || DEFAULT_CAPABILITIES).split(",").map((s) => s.trim()));
@@ -112096,7 +112255,10 @@ function hasCapability(cap) {
112096
112255
  function getEnabledCapabilities() {
112097
112256
  return Array.from(CAPABILITIES);
112098
112257
  }
112099
- function createServer() {
112258
+ function isScriptsOnlyMcp() {
112259
+ return resolveScriptsOnlyMode({ env: process.env.SCRIPTS_ONLY_MCP });
112260
+ }
112261
+ function createServer(opts = {}) {
112100
112262
  initDb(process.env.DATABASE_PATH);
112101
112263
  seedPricingFromModelsDev();
112102
112264
  startPricingRefreshLoop();
@@ -112117,6 +112279,15 @@ function createServer() {
112117
112279
  logging: {}
112118
112280
  }
112119
112281
  });
112282
+ if (opts.scriptsOnly ?? isScriptsOnlyMcp()) {
112283
+ registerScriptSearchTool(server);
112284
+ registerScriptRunTool(server);
112285
+ registerScriptUpsertTool(server);
112286
+ registerScriptDeleteTool(server);
112287
+ registerScriptQueryTypesTool(server);
112288
+ registerScriptRunsTools(server);
112289
+ return server;
112290
+ }
112120
112291
  registerJoinSwarmTool(server);
112121
112292
  registerPollTaskTool(server);
112122
112293
  registerGetSwarmTool(server);
@@ -112398,4 +112569,4 @@ function writeSkillsToFilesystem(entries, harnessType = "all", home) {
112398
112569
  return { synced, removed, errors };
112399
112570
  }
112400
112571
 
112401
- export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, McpServer, isGitHubEnabled, initGitHub, verifyWebhookSignature, userCtx, isPollTracingEnabled, initOtel, withSpan, startSpan, withSpanContext, withRemoteContext, injectTraceContext, recordSessionCost, createToolRegistrar, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, setCorsHeaders, parseQueryParams, getPathSegments, safeRequestUrlForLog, agentWithCapacity, parseBody, BODY_TOO_LARGE, enforceContentLengthCap, json, jsonError, triggerSchemaErrorResponse, deriveApiBaseUrl, httpServerSemconvAttributes, describeRequestRoute, route, assertSelectOnlyQuery, executeReadOnlyQuery, handleDbQuery, snapshotMetric, snapshotPage, assertOAuthProviderIsNotReserved, assertOAuthAppUrlsSafe, scopedResourceScopeIdSchema, resolveScopedResourceId, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, storeLinks, refreshLinks, canReadMemory, getLinksForMemory, recordRetrievals, expandCandidatesWithGraph, markKapsoMessageRead, sendKapsoReaction, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, resolveTaskAuditUserId, resolveHttpAuditUserId, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, mergeScheduleTiming, validateRecurringTiming, sendTaskOutputSchema, sendTaskHandler, parseSkillContent, ExplicitSelfDuplicateError, applyRating, shouldPersistAutomaticTaskMemory, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, registerJiraWebhook, deleteJiraWebhook, isJiraEnabled, initJira, handleJiraWebhook, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, isLinearEnabled, initLinear, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, canClaim, emitBudgetRefusalSideEffects, taskActionInputSchema, taskActionOutputSchema, taskActionHandler, hasCapability, getEnabledCapabilities, createServer, writeSkillsToFilesystem };
112572
+ export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, McpServer, isGitHubEnabled, initGitHub, verifyWebhookSignature, userCtx, isPollTracingEnabled, initOtel, withSpan, startSpan, withSpanContext, withRemoteContext, injectTraceContext, recordSessionCost, createToolRegistrar, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, setCorsHeaders, parseQueryParams, getPathSegments, safeRequestUrlForLog, agentWithCapacity, parseBody, BODY_TOO_LARGE, enforceContentLengthCap, json, jsonError, triggerSchemaErrorResponse, deriveApiBaseUrl, httpServerSemconvAttributes, describeRequestRoute, route, assertSelectOnlyQuery, executeReadOnlyQuery, handleDbQuery, snapshotMetric, AssetKeyAuthorizationError, authorizeAssetKeyWrite, resolveTaskAuditUserId, resolveHttpAuditUserId, snapshotPage, assertOAuthProviderIsNotReserved, assertOAuthAppUrlsSafe, scopedResourceScopeIdSchema, resolveScopedResourceId, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, storeLinks, refreshLinks, canReadMemory, getLinksForMemory, recordRetrievals, expandCandidatesWithGraph, markKapsoMessageRead, sendKapsoReaction, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, mergeScheduleTiming, validateRecurringTiming, sendTaskOutputSchema, sendTaskHandler, parseSkillContent, ExplicitSelfDuplicateError, applyRating, shouldPersistAutomaticTaskMemory, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, registerJiraWebhook, deleteJiraWebhook, isJiraEnabled, initJira, handleJiraWebhook, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, isLinearEnabled, initLinear, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, canClaim, emitBudgetRefusalSideEffects, taskActionInputSchema, taskActionOutputSchema, taskActionHandler, resolveScriptsOnlyMode, hasCapability, getEnabledCapabilities, createServer, writeSkillsToFilesystem };