@desplega.ai/agent-swarm 1.146.0 → 1.147.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.
- package/README.md +1 -1
- package/dist/{acp-adapter-jnq4612m.js → acp-adapter-9n319wqc.js} +42 -4
- package/dist/{actions-s41xcn3f.js → actions-2vxqvpr9.js} +9 -8
- package/dist/{app-j8bfw3f6.js → app-w066xfy0.js} +6 -5
- package/dist/assistant-kt31dj2h.js +236 -0
- package/dist/{boot-reembed-jxdz46jp.js → boot-reembed-az5rassp.js} +7 -6
- package/dist/{boot-reembed-x1476agm.js → boot-reembed-j3mm3rfz.js} +8 -7
- package/dist/{boot-scrub-logs-rab9h5bt.js → boot-scrub-logs-b6h54817.js} +4 -4
- package/dist/{claude-adapter-ep6qekbm.js → claude-adapter-w1z04ann.js} +8 -6
- package/dist/{claude-managed-setup-w619jncn.js → claude-managed-setup-f5pmsyrp.js} +24 -3
- package/dist/{claude-sdk-session-0wp3qrcy.js → claude-sdk-session-f0cc1kec.js} +8 -6
- package/dist/{cli-bafd6xnf.js → cli-0b6y7kxm.js} +1 -1
- package/dist/{cli-jyy3e193.js → cli-12fz972k.js} +4 -4
- package/dist/{cli-pzfc7j7g.js → cli-1th1728g.js} +2 -2
- package/dist/{cli-68h2mfrn.js → cli-3tgwnf43.js} +3 -3
- package/dist/{cli-q3qr220d.js → cli-4nr988h6.js} +1 -1
- package/dist/{cli-m4xsy03s.js → cli-53s590z8.js} +1 -1
- package/dist/{cli-c8q7292f.js → cli-54wwve05.js} +5 -4
- package/dist/{cli-rymrjneb.js → cli-719k9j2c.js} +2 -2
- package/dist/{cli-zn65x0w8.js → cli-89xfd7f9.js} +21 -47
- package/dist/{cli-506z6jqa.js → cli-8v0g1yc8.js} +1 -1
- package/dist/cli-9d8ntetj.js +42 -0
- package/dist/{cli-dhg6j8h3.js → cli-atcve9y8.js} +826 -737
- package/dist/{cli-46yck6nj.js → cli-b5bq9crk.js} +14 -31
- package/dist/cli-d8brzxjb.js +190 -0
- package/dist/{cli-a960nkfb.js → cli-de14znh8.js} +2 -2
- package/dist/{cli-s8sbe32s.js → cli-dttph1bw.js} +2 -2
- package/dist/cli-ep19k3mb.js +19 -0
- package/dist/{cli-d9pnxgth.js → cli-f146mn5s.js} +7 -50
- package/dist/{cli-qar1f940.js → cli-f7dsy61y.js} +5 -3
- package/dist/{cli-d4xqde2b.js → cli-ftht3zzj.js} +2780 -2587
- package/dist/{cli-pmwbdw36.js → cli-hbv0kq6w.js} +2 -2
- package/dist/{cli-fhsz3twr.js → cli-jsp14b6c.js} +171 -1
- package/dist/{cli-2zvtzevh.js → cli-kpv03zhj.js} +13 -11
- package/dist/{cli-a9bn9svs.js → cli-m8yrsg97.js} +2 -2
- package/dist/cli-m9sxbkhm.js +779 -0
- package/dist/cli-mmemxxdc.js +823 -0
- package/dist/{cli-6xwhtc64.js → cli-n8508nre.js} +1 -1
- package/dist/{cli-q0qq1sxw.js → cli-p1d5b073.js} +37 -2
- package/dist/{cli-yqeb27t1.js → cli-rw51bq3j.js} +13 -10
- package/dist/{cli-zww3vcnm.js → cli-smby5m17.js} +7 -6
- package/dist/{cli-ah5hjk49.js → cli-tzvk9haz.js} +94 -372
- package/dist/{cli-yxwe913z.js → cli-w9kb3bk1.js} +1 -1
- package/dist/{cli-skd674mt.js → cli-y6b6fb76.js} +25 -3
- package/dist/{cli-3k2g3kg2.js → cli-yz3djrm0.js} +9 -9
- package/dist/{cli-4secrq32.js → cli-zhjmqxzh.js} +1 -1
- package/dist/cli.js +13 -13
- package/dist/{codex-adapter-d6qajxj3.js → codex-adapter-zw4dwsx7.js} +2 -2
- package/dist/{codex-hook-n7m5k7cr.js → codex-hook-bw8p5nh4.js} +2 -2
- package/dist/{codex-session-runner-v9krqe4x.js → codex-session-runner-k981s65v.js} +2 -2
- package/dist/{commands-923wsas7.js → commands-sykrxx7e.js} +4 -4
- package/dist/{db-m1hy4zh5.js → db-sfbsc8wt.js} +6 -4
- package/dist/handlers-0aspcejm.js +603 -0
- package/dist/{hook-ee4hff56.js → hook-4nvqj2sb.js} +7 -5
- package/dist/{hook-bxe3bkdy.js → hook-hxccs7m5.js} +24 -49
- package/dist/{http-a8rx91me.js → http-y06z517d.js} +223 -92
- package/dist/{index-697zfzv1.js → index-hssww7kj.js} +15 -14
- package/dist/{index-3x9g3nbg.js → index-k8znfx0z.js} +13 -12
- package/dist/{index-1j9va48r.js → index-tce1rss4.js} +371 -110
- package/dist/{index-jj4q3x59.js → index-x5j894zf.js} +14 -13
- package/dist/{keepalive-sds4e4ce.js → keepalive-w733ax66.js} +6 -6
- package/dist/{lead-ggq6szk8.js → lead-75bjqa9d.js} +29 -27
- package/dist/{maintenance-093p41d4.js → maintenance-w4f1zjck.js} +8 -7
- package/dist/{oauth-refresh-sweep-dvzq4ckj.js → oauth-refresh-sweep-wdetky26.js} +5 -5
- package/dist/{onboard-ydr9tzw5.js → onboard-bb5net8s.js} +2 -2
- package/dist/{otel-impl-zx3tdf3j.js → otel-impl-0w7c14ap.js} +1 -1
- package/dist/{pi-mono-adapter-dtkz4e7j.js → pi-mono-adapter-2has4gnp.js} +12 -2
- package/dist/{pricing-refresh-7e6pqnzp.js → pricing-refresh-9nzsrgcq.js} +6 -6
- package/dist/{rbac-roles-p2rh6d0r.js → rbac-roles-r3hqjp09.js} +5 -5
- package/dist/{rbac-roles-0dv1wt0w.js → rbac-roles-z1jrffbt.js} +4 -4
- package/dist/{registry-9kdck5ye.js → registry-v5wytg0s.js} +1 -2
- package/dist/{render-v2-4k3jt4r2.js → render-v2-vbr89fnb.js} +6 -5
- package/dist/{seed-pricing-2cc1qmcd.js → seed-pricing-g62hy1pk.js} +7 -5
- package/dist/{setup-c5yss30k.js → setup-gnfqnptp.js} +2 -2
- package/dist/{worker-7srgeqcr.js → worker-kznxp4qm.js} +29 -27
- package/openapi.json +263 -12
- package/package.json +1 -1
- package/plugin/commands/start-worker.md +4 -9
- package/plugin/pi-skills/start-worker/SKILL.md +4 -9
- package/src/be/db/agents.ts +556 -0
- package/src/be/db/context-versions.ts +117 -0
- package/src/be/db/runtime.ts +406 -0
- package/src/be/db/tasks/read.ts +1167 -0
- package/src/be/db/tasks/write.ts +953 -0
- package/src/be/db.ts +583 -3428
- package/src/be/migrations/147_scheduled_tasks_parent_task.sql +7 -0
- package/src/be/migrations/148_pages_svg.sql +123 -0
- package/src/be/migrations/149_session_tokens.sql +24 -0
- package/src/be/scripts/typecheck.ts +1 -0
- package/src/be/seed-pricing.ts +13 -8
- package/src/be/seed-scripts/catalog/ops-catalog-audit.inline.ts +1 -1
- package/src/be/seed-scripts/catalog/ops-catalog-audit.ts +1 -1
- package/src/be/seed-scripts/catalog/star-history-refresh.ts +101 -0
- package/src/be/seed-scripts/catalog/star-history-renderer.ts +119 -0
- package/src/be/seed-scripts/index.ts +17 -0
- package/src/be/seed-skills/index.ts +14 -0
- package/src/be/swarm-config-guard.ts +1 -1
- package/src/be/task-attachment-store.ts +70 -0
- package/src/be/users.ts +77 -0
- package/src/commands/attachments-section.ts +37 -0
- package/src/commands/claude-managed-setup.ts +45 -3
- package/src/commands/claude-md-session.ts +408 -0
- package/src/commands/context-preamble.ts +15 -3
- package/src/commands/profile-sync.ts +205 -5
- package/src/commands/provider-credentials.ts +60 -27
- package/src/commands/runner.ts +63 -58
- package/src/commands/templates.ts +25 -2
- package/src/hooks/hook.ts +26 -67
- package/src/http/agents.ts +40 -1
- package/src/http/auth.ts +13 -1
- package/src/http/fs.ts +21 -51
- package/src/http/mcp.ts +32 -0
- package/src/http/pages-public.ts +20 -4
- package/src/http/poll.ts +4 -0
- package/src/http/repos.ts +3 -3
- package/src/http/sessions.ts +82 -0
- package/src/http/tasks.ts +10 -2
- package/src/prompts/session-templates.ts +4 -2
- package/src/providers/acp-adapter.ts +42 -6
- package/src/providers/pi-mono-adapter.ts +23 -6
- package/src/scheduler/scheduler.test.ts +49 -2
- package/src/scheduler/scheduler.ts +4 -0
- package/src/scripts-runtime/sdk-allowlist.ts +1 -0
- package/src/scripts-runtime/types/stdlib.d.ts +8 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +8 -0
- package/src/server.ts +2 -0
- package/src/slack/assistant.ts +87 -46
- package/src/slack/handlers.test.ts +1 -3
- package/src/slack/handlers.ts +102 -87
- package/src/slack/inbound-files.ts +466 -0
- package/src/slack/templates.ts +14 -0
- package/src/tasks/task-terminal-effects.ts +158 -0
- package/src/tests/acp-adapter.test.ts +327 -192
- package/src/tests/budget-claim-gate.test.ts +1 -0
- package/src/tests/build-pi-skills.test.ts +5 -7
- package/src/tests/claude-managed-setup.test.ts +52 -4
- package/src/tests/claude-md-session.test.ts +603 -0
- package/src/tests/codex-skill-resolver.test.ts +19 -0
- package/src/tests/context-versioning.test.ts +107 -0
- package/src/tests/credential-check.test.ts +157 -14
- package/src/tests/db-agents.test.ts +91 -0
- package/src/tests/db-context-versions.test.ts +37 -0
- package/src/tests/db-extraction-contract.test.ts +45 -0
- package/src/tests/db-runtime.test.ts +70 -0
- package/src/tests/db-task-read-contract.test.ts +624 -0
- package/src/tests/db-task-write-contract.test.ts +653 -0
- package/src/tests/db-tasks-read.test.ts +183 -0
- package/src/tests/db-tasks-write.test.ts +230 -0
- package/src/tests/defer-task.test.ts +389 -0
- package/src/tests/docs-index-footprint.test.js +2 -2
- package/src/tests/e2e-visuals-stage.test.ts +151 -0
- package/src/tests/file-lock.test.ts +144 -0
- package/src/tests/fixtures/file-lock-holder.ts +13 -0
- package/src/tests/fixtures/hold-file-lock.ts +25 -0
- package/src/tests/heartbeat-expiry.test.ts +188 -0
- package/src/tests/http-api-integration.test.ts +78 -1
- package/src/tests/pages-public-html.test.ts +43 -0
- package/src/tests/pages-svg-migration.test.ts +42 -0
- package/src/tests/preload.ts +4 -1
- package/src/tests/profile-sync-warning.test.ts +16 -0
- package/src/tests/profile-sync.test.ts +126 -0
- package/src/tests/prompt-template-session.test.ts +20 -4
- package/src/tests/provider-registration.test.ts +93 -0
- package/src/tests/rbac-e2e-helpers.test.ts +53 -0
- package/src/tests/rbac-e2e-helpers.ts +19 -2
- package/src/tests/routing-affinity-inventory.test.ts +1 -1
- package/src/tests/runner-attachments-section.test.ts +22 -2
- package/src/tests/runner-context-preamble.test.ts +30 -0
- package/src/tests/runner-deployment-resume.test.ts +107 -0
- package/src/tests/runner-repo-autostash.test.ts +12 -0
- package/src/tests/script-connections.test.ts +4 -0
- package/src/tests/seed-scripts.test.ts +2 -2
- package/src/tests/session-tokens.test.ts +279 -0
- package/src/tests/slack-file-tools-attachments.test.ts +408 -0
- package/src/tests/slack-inbound-files.test.ts +847 -0
- package/src/tests/star-history-refresh.test.ts +102 -0
- package/src/tests/swarm-repos.test.ts +20 -0
- package/src/tests/tool-annotations.test.ts +4 -3
- package/src/tests/ui-logs-parser.test.ts +176 -0
- package/src/tools/create-page.ts +4 -2
- package/src/tools/defer-task.ts +239 -0
- package/src/tools/repos/update-repo.ts +2 -2
- package/src/tools/schedules/create-schedule.ts +1 -0
- package/src/tools/schedules/list-schedules.ts +1 -0
- package/src/tools/schedules/patch-schedule.ts +1 -0
- package/src/tools/schedules/update-schedule.ts +1 -0
- package/src/tools/slack-download-file.ts +60 -29
- package/src/tools/slack-read.ts +73 -32
- package/src/tools/store-progress.ts +16 -146
- package/src/tools/tool-config.ts +1 -0
- package/src/tools/utils.ts +21 -0
- package/src/types.ts +37 -4
- package/src/utils/acp-session-token.ts +56 -0
- package/src/utils/file-lock.ts +111 -0
- package/src/utils/heartbeat-expiry.ts +78 -0
- package/src/utils/request-auth-context.ts +2 -0
- package/src/utils/task-attachment-links.ts +22 -0
- package/templates/skills/code-quality/content.md +8 -5
- package/templates/skills/download-task-attachment/content.md +2 -1
- package/{plugin/pi-skills → templates/skills}/review-offered-task/SKILL.md +5 -5
- package/templates/skills/review-offered-task/config.json +14 -0
- package/{plugin/commands/review-offered-task.md → templates/skills/review-offered-task/content.md} +3 -8
- package/templates/skills/scheduling/content.md +4 -0
- package/templates/skills/slack-interaction/content.md +2 -2
- package/templates/skills/work-on-task/SKILL.md +16 -0
- package/templates/skills/work-on-task/config.json +14 -0
- package/templates/skills/work-on-task/content.md +11 -0
- package/dist/assistant-dx3ew4d8.js +0 -212
- package/dist/cli-00kyrp1a.js +0 -317
- package/dist/cli-n1q8q14d.js +0 -177
- package/dist/cli-ss6vybmt.js +0 -269
- package/dist/handlers-e9vp2fr8.js +0 -592
- package/plugin/commands/work-on-task.md +0 -39
- package/plugin/pi-skills/work-on-task/SKILL.md +0 -39
|
@@ -182,7 +182,7 @@ import {
|
|
|
182
182
|
warnIfCorsAllowsAnyOrigin,
|
|
183
183
|
wireHttpSpanLifecycle,
|
|
184
184
|
writeSkillsToFilesystem
|
|
185
|
-
} from "./cli-
|
|
185
|
+
} from "./cli-atcve9y8.js";
|
|
186
186
|
import"./cli-8fc8de14.js";
|
|
187
187
|
import {
|
|
188
188
|
Anthropic
|
|
@@ -201,16 +201,16 @@ import {
|
|
|
201
201
|
import {
|
|
202
202
|
calculateNextRun,
|
|
203
203
|
dispatchScheduleTarget
|
|
204
|
-
} from "./cli-
|
|
204
|
+
} from "./cli-smby5m17.js";
|
|
205
205
|
import {
|
|
206
206
|
getModelsCatalog
|
|
207
|
-
} from "./cli-
|
|
207
|
+
} from "./cli-m8yrsg97.js";
|
|
208
208
|
import {
|
|
209
209
|
normalizeModelKey
|
|
210
|
-
} from "./cli-
|
|
210
|
+
} from "./cli-rw51bq3j.js";
|
|
211
211
|
import {
|
|
212
212
|
getUserGrant
|
|
213
|
-
} from "./cli-
|
|
213
|
+
} from "./cli-8v0g1yc8.js";
|
|
214
214
|
import {
|
|
215
215
|
can,
|
|
216
216
|
clearAuditSink,
|
|
@@ -227,12 +227,12 @@ import {
|
|
|
227
227
|
scriptSdkTypesWithGeneratedApis,
|
|
228
228
|
scriptStdlibTypesWithGeneratedApis,
|
|
229
229
|
typecheckScript
|
|
230
|
-
} from "./cli-
|
|
230
|
+
} from "./cli-54wwve05.js";
|
|
231
231
|
import {
|
|
232
232
|
collectScriptReferences,
|
|
233
233
|
getApp,
|
|
234
234
|
listAppRecords
|
|
235
|
-
} from "./cli-
|
|
235
|
+
} from "./cli-de14znh8.js";
|
|
236
236
|
import {
|
|
237
237
|
require_dist
|
|
238
238
|
} from "./cli-qgm2pfpq.js";
|
|
@@ -240,7 +240,7 @@ import {
|
|
|
240
240
|
checkHeartbeatChecklist,
|
|
241
241
|
runHeartbeatSweep,
|
|
242
242
|
stopHeartbeat
|
|
243
|
-
} from "./cli-
|
|
243
|
+
} from "./cli-12fz972k.js";
|
|
244
244
|
import {
|
|
245
245
|
AGENT_MAX_TASKS_CONFIG_KEY,
|
|
246
246
|
createResumeFollowUp,
|
|
@@ -255,7 +255,7 @@ import {
|
|
|
255
255
|
touchRuntimeInstance,
|
|
256
256
|
upsertRuntimeInstance,
|
|
257
257
|
upsertSwarmConfigWithPolicyMirror
|
|
258
|
-
} from "./cli-
|
|
258
|
+
} from "./cli-f7dsy61y.js";
|
|
259
259
|
import {
|
|
260
260
|
isMultiRuntimeEnabled
|
|
261
261
|
} from "./cli-07jd68a1.js";
|
|
@@ -278,7 +278,7 @@ import {
|
|
|
278
278
|
startWorkflowExecution,
|
|
279
279
|
validateJsonSchema,
|
|
280
280
|
verifyHmacSignature
|
|
281
|
-
} from "./cli-
|
|
281
|
+
} from "./cli-yz3djrm0.js";
|
|
282
282
|
import"./cli-1ebpar1q.js";
|
|
283
283
|
import {
|
|
284
284
|
deriveCodexKeySuffix,
|
|
@@ -363,11 +363,11 @@ import {
|
|
|
363
363
|
upsertScriptByName,
|
|
364
364
|
upsertScriptConnection,
|
|
365
365
|
validateDefinition
|
|
366
|
-
} from "./cli-
|
|
366
|
+
} from "./cli-3tgwnf43.js";
|
|
367
367
|
import"./cli-epan13p1.js";
|
|
368
368
|
import {
|
|
369
369
|
searchScripts
|
|
370
|
-
} from "./cli-
|
|
370
|
+
} from "./cli-hbv0kq6w.js";
|
|
371
371
|
import {
|
|
372
372
|
CANDIDATE_SET_MULTIPLIER,
|
|
373
373
|
getEmbeddingProvider,
|
|
@@ -375,7 +375,7 @@ import {
|
|
|
375
375
|
init_constants as init_constants2,
|
|
376
376
|
init_reranker,
|
|
377
377
|
rerank
|
|
378
|
-
} from "./cli-
|
|
378
|
+
} from "./cli-1th1728g.js";
|
|
379
379
|
import {
|
|
380
380
|
detachedProcessGroup,
|
|
381
381
|
forceTerminateProcessGroup,
|
|
@@ -386,7 +386,7 @@ import {
|
|
|
386
386
|
import {
|
|
387
387
|
getApiKey
|
|
388
388
|
} from "./cli-f14fvzag.js";
|
|
389
|
-
import"./cli-
|
|
389
|
+
import"./cli-m9sxbkhm.js";
|
|
390
390
|
import {
|
|
391
391
|
acquireOAuthRefreshLock,
|
|
392
392
|
buildAuthorizationUrl,
|
|
@@ -410,19 +410,20 @@ import {
|
|
|
410
410
|
updateAuthorizationIdentity,
|
|
411
411
|
updateOAuthAppById,
|
|
412
412
|
upsertAuthorization
|
|
413
|
-
} from "./cli-
|
|
413
|
+
} from "./cli-zhjmqxzh.js";
|
|
414
414
|
import"./cli-fad8m16k.js";
|
|
415
415
|
import"./cli-aehm1rbq.js";
|
|
416
416
|
import"./cli-bsakbbkm.js";
|
|
417
|
+
import"./cli-51tf7ac3.js";
|
|
417
418
|
import {
|
|
418
|
-
|
|
419
|
-
|
|
419
|
+
MAX_TASK_ATTACHMENT_BYTES,
|
|
420
|
+
recordTaskAttachmentUpload
|
|
421
|
+
} from "./cli-mmemxxdc.js";
|
|
420
422
|
import {
|
|
421
423
|
FilesError,
|
|
424
|
+
getFileStorageProvider,
|
|
422
425
|
normalizeFilesError
|
|
423
|
-
} from "./cli-
|
|
424
|
-
import"./cli-51tf7ac3.js";
|
|
425
|
-
import"./cli-ss6vybmt.js";
|
|
426
|
+
} from "./cli-jsp14b6c.js";
|
|
426
427
|
import {
|
|
427
428
|
findUserById,
|
|
428
429
|
fingerprintApiKey,
|
|
@@ -430,18 +431,20 @@ import {
|
|
|
430
431
|
linkIdentity,
|
|
431
432
|
listUserEvents,
|
|
432
433
|
listUserTokens,
|
|
434
|
+
mintSessionToken,
|
|
433
435
|
mintToken,
|
|
434
436
|
recordIdentityEvent,
|
|
435
437
|
recordUnmappedIdentity,
|
|
436
438
|
renderIdentity,
|
|
437
439
|
resolveIdentity,
|
|
438
440
|
resolveUserByToken,
|
|
441
|
+
revokeSessionToken,
|
|
439
442
|
revokeToken,
|
|
440
443
|
unlinkIdentity
|
|
441
|
-
} from "./cli-
|
|
444
|
+
} from "./cli-p1d5b073.js";
|
|
442
445
|
import {
|
|
443
446
|
createTaskWithSiblingAwareness
|
|
444
|
-
} from "./cli-
|
|
447
|
+
} from "./cli-53s590z8.js";
|
|
445
448
|
import {
|
|
446
449
|
ensure,
|
|
447
450
|
getSlackApp,
|
|
@@ -457,8 +460,9 @@ import {
|
|
|
457
460
|
withRemoteContext,
|
|
458
461
|
withSpan,
|
|
459
462
|
withSpanContext
|
|
460
|
-
} from "./cli-
|
|
463
|
+
} from "./cli-b5bq9crk.js";
|
|
461
464
|
import"./cli-q51yprfq.js";
|
|
465
|
+
import"./cli-9d8ntetj.js";
|
|
462
466
|
import"./cli-yatxqynm.js";
|
|
463
467
|
import {
|
|
464
468
|
ActiveSessionSchema,
|
|
@@ -498,6 +502,7 @@ import {
|
|
|
498
502
|
EventSourceSchema,
|
|
499
503
|
EventStatusSchema,
|
|
500
504
|
FavoriteItemTypeSchema,
|
|
505
|
+
HeartbeatExpiryError,
|
|
501
506
|
InboxItemStateSchema,
|
|
502
507
|
InboxItemStatusSchema,
|
|
503
508
|
InboxItemTypeSchema,
|
|
@@ -528,7 +533,7 @@ import {
|
|
|
528
533
|
PromptTemplateSchema,
|
|
529
534
|
ProviderNameSchema,
|
|
530
535
|
ReasoningEffortSchema,
|
|
531
|
-
|
|
536
|
+
RepoGuidelinesInputSchema,
|
|
532
537
|
RepoHooksSchema,
|
|
533
538
|
ResumeReasonSchema,
|
|
534
539
|
RuntimeInstanceSchema,
|
|
@@ -567,6 +572,7 @@ import {
|
|
|
567
572
|
UserCommsPrefsSchema,
|
|
568
573
|
UserFavoriteSchema,
|
|
569
574
|
UserSchema,
|
|
575
|
+
VersionableFieldSchema,
|
|
570
576
|
WorkflowDefinitionSchema,
|
|
571
577
|
WorkflowEdgeSchema,
|
|
572
578
|
WorkflowNodePatchSchema,
|
|
@@ -750,6 +756,7 @@ import {
|
|
|
750
756
|
init_date_utils,
|
|
751
757
|
init_db,
|
|
752
758
|
init_default_drift,
|
|
759
|
+
init_heartbeat_expiry,
|
|
753
760
|
init_request_auth_context,
|
|
754
761
|
init_steering,
|
|
755
762
|
init_swarm_config_guard,
|
|
@@ -758,7 +765,6 @@ import {
|
|
|
758
765
|
init_types,
|
|
759
766
|
insertActiveSession,
|
|
760
767
|
insertPricingRow,
|
|
761
|
-
insertTaskAttachment,
|
|
762
768
|
installMcpServer,
|
|
763
769
|
installSkill,
|
|
764
770
|
isReservedConfigKey,
|
|
@@ -855,12 +861,12 @@ import {
|
|
|
855
861
|
upsertSwarmConfig,
|
|
856
862
|
validateConfigValue,
|
|
857
863
|
withFavoriteFlags
|
|
858
|
-
} from "./cli-
|
|
864
|
+
} from "./cli-ftht3zzj.js";
|
|
859
865
|
import {
|
|
860
866
|
IDENTITY_FIELD_BUDGETS,
|
|
861
867
|
IdentityFieldBudgetError,
|
|
862
868
|
init_identity_field_budget
|
|
863
|
-
} from "./cli-
|
|
869
|
+
} from "./cli-y6b6fb76.js";
|
|
864
870
|
import {
|
|
865
871
|
getAllTemplateDefinitions,
|
|
866
872
|
getTemplateDefinition,
|
|
@@ -871,7 +877,7 @@ import {
|
|
|
871
877
|
interpolate,
|
|
872
878
|
isSteeringEnabled,
|
|
873
879
|
resolveTemplate
|
|
874
|
-
} from "./cli-
|
|
880
|
+
} from "./cli-kpv03zhj.js";
|
|
875
881
|
import {
|
|
876
882
|
MAX_PROFILE_FILE_LENGTH,
|
|
877
883
|
getAppUrl,
|
|
@@ -900,7 +906,7 @@ import {
|
|
|
900
906
|
import {
|
|
901
907
|
init_package,
|
|
902
908
|
package_default
|
|
903
|
-
} from "./cli-
|
|
909
|
+
} from "./cli-w9kb3bk1.js";
|
|
904
910
|
import {
|
|
905
911
|
init_secret_scrubber,
|
|
906
912
|
registerVolatileSecret,
|
|
@@ -2254,6 +2260,7 @@ var SDK_TOOL_NAME_MAP = {
|
|
|
2254
2260
|
task_list: "get-tasks",
|
|
2255
2261
|
task_get: "get-task-details",
|
|
2256
2262
|
task_storeProgress: "store-progress",
|
|
2263
|
+
task_defer: "defer-task",
|
|
2257
2264
|
task_poll: "poll-task",
|
|
2258
2265
|
task_send: "send-task",
|
|
2259
2266
|
task_cancel: "cancel-task",
|
|
@@ -3449,6 +3456,7 @@ init_db();
|
|
|
3449
3456
|
init_telemetry();
|
|
3450
3457
|
init_types();
|
|
3451
3458
|
init_constants();
|
|
3459
|
+
init_heartbeat_expiry();
|
|
3452
3460
|
init_identity_field_budget();
|
|
3453
3461
|
init_secret_scrubber();
|
|
3454
3462
|
function singleHeaderValue(req, name) {
|
|
@@ -3709,6 +3717,7 @@ var listAgentRuntimeInstances = route({
|
|
|
3709
3717
|
404: { description: "Agent not found" }
|
|
3710
3718
|
}
|
|
3711
3719
|
});
|
|
3720
|
+
var ContentHashSchema = exports_external.string().regex(/^[0-9a-f]{64}$/, "sha256 hex");
|
|
3712
3721
|
var ProfileSyncRejectionSchema = exports_external.object({
|
|
3713
3722
|
field: exports_external.enum(["soulMd", "identityMd", "claudeMd", "toolsMd"]),
|
|
3714
3723
|
diskSize: exports_external.number().int(),
|
|
@@ -3737,7 +3746,8 @@ var updateAgentProfileRoute = route({
|
|
|
3737
3746
|
avatar: AgentAvatarSchema.nullable().optional(),
|
|
3738
3747
|
changeSource: exports_external.string().optional(),
|
|
3739
3748
|
changedByAgentId: exports_external.string().optional(),
|
|
3740
|
-
changeReason: exports_external.string().optional()
|
|
3749
|
+
changeReason: exports_external.string().optional(),
|
|
3750
|
+
expectedHashes: exports_external.partialRecord(VersionableFieldSchema, ContentHashSchema).optional()
|
|
3741
3751
|
}),
|
|
3742
3752
|
responses: {
|
|
3743
3753
|
200: { description: "Profile updated", schema: AgentWithCapacitySchema },
|
|
@@ -4024,6 +4034,7 @@ async function handleAgentsRest(req, res, pathSegments, queryParams, _myAgentId)
|
|
|
4024
4034
|
changedByAgentId: body.changedByAgentId ?? null,
|
|
4025
4035
|
changeReason: body.changeReason ?? null
|
|
4026
4036
|
} : undefined;
|
|
4037
|
+
const conflicts = [];
|
|
4027
4038
|
let agent;
|
|
4028
4039
|
try {
|
|
4029
4040
|
agent = await updateAgentProfile(parsed.params.id, {
|
|
@@ -4037,8 +4048,15 @@ async function handleAgentsRest(req, res, pathSegments, queryParams, _myAgentId)
|
|
|
4037
4048
|
toolsMd: body.toolsMd,
|
|
4038
4049
|
heartbeatMd: body.heartbeatMd,
|
|
4039
4050
|
...body.avatar !== undefined ? { avatar: body.avatar } : {}
|
|
4040
|
-
}, versionMeta
|
|
4051
|
+
}, versionMeta, {
|
|
4052
|
+
expectedHashes: body.expectedHashes,
|
|
4053
|
+
onConflict: (conflict) => conflicts.push(conflict)
|
|
4054
|
+
});
|
|
4041
4055
|
} catch (error) {
|
|
4056
|
+
if (error instanceof HeartbeatExpiryError) {
|
|
4057
|
+
jsonError(res, error.message, 400);
|
|
4058
|
+
return true;
|
|
4059
|
+
}
|
|
4042
4060
|
if (error instanceof IdentityFieldBudgetError) {
|
|
4043
4061
|
if (versionMeta?.changeSource === "self_edit" || versionMeta?.changeSource === "session_sync") {
|
|
4044
4062
|
try {
|
|
@@ -4072,10 +4090,25 @@ async function handleAgentsRest(req, res, pathSegments, queryParams, _myAgentId)
|
|
|
4072
4090
|
jsonError(res, "Agent not found", 404);
|
|
4073
4091
|
return true;
|
|
4074
4092
|
}
|
|
4093
|
+
for (const conflict of conflicts) {
|
|
4094
|
+
try {
|
|
4095
|
+
await createEvent({
|
|
4096
|
+
category: "system",
|
|
4097
|
+
event: "system.profile_sync_conflict",
|
|
4098
|
+
status: "skipped",
|
|
4099
|
+
source: "api",
|
|
4100
|
+
agentId: parsed.params.id,
|
|
4101
|
+
data: { ...conflict, changeSource: versionMeta?.changeSource ?? null }
|
|
4102
|
+
});
|
|
4103
|
+
} catch (eventError) {
|
|
4104
|
+
const message = eventError instanceof Error ? eventError.message : String(eventError);
|
|
4105
|
+
console.error(scrubSecrets(`[profile-sync] Failed to persist conflict event: ${message}`));
|
|
4106
|
+
}
|
|
4107
|
+
}
|
|
4075
4108
|
if (versionMeta?.changeSource === "self_edit" || versionMeta?.changeSource === "session_sync") {
|
|
4076
4109
|
try {
|
|
4077
4110
|
for (const field of Object.keys(IDENTITY_FIELD_BUDGETS)) {
|
|
4078
|
-
if (body[field] === undefined)
|
|
4111
|
+
if (body[field] === undefined || conflicts.some((c) => c.field === field))
|
|
4079
4112
|
continue;
|
|
4080
4113
|
await createEvent({
|
|
4081
4114
|
category: "system",
|
|
@@ -6465,7 +6498,6 @@ async function handleFavorites(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
6465
6498
|
// src/http/fs.ts
|
|
6466
6499
|
init_zod();
|
|
6467
6500
|
init_db();
|
|
6468
|
-
import { createHash as createHash2 } from "node:crypto";
|
|
6469
6501
|
init_types();
|
|
6470
6502
|
|
|
6471
6503
|
// src/utils/content-disposition.ts
|
|
@@ -6479,7 +6511,6 @@ function attachmentContentDisposition(filename) {
|
|
|
6479
6511
|
// src/http/fs.ts
|
|
6480
6512
|
init_request_auth_context();
|
|
6481
6513
|
init_secret_scrubber();
|
|
6482
|
-
var MAX_UPLOAD_BYTES = 50 * 1024 * 1024;
|
|
6483
6514
|
var SLOW_UPLOAD_LOG_MS = 3000;
|
|
6484
6515
|
var taskParams = exports_external.object({ taskId: exports_external.uuid() });
|
|
6485
6516
|
var attachmentParams = exports_external.object({ taskId: exports_external.uuid(), attachmentId: exports_external.uuid() });
|
|
@@ -6734,7 +6765,7 @@ async function handleFs(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
6734
6765
|
return sendDelete(res, attachment);
|
|
6735
6766
|
}
|
|
6736
6767
|
if (uploadTaskFileRoute.match(req.method, pathSegments)) {
|
|
6737
|
-
if (enforceContentLengthCap(req, res,
|
|
6768
|
+
if (enforceContentLengthCap(req, res, MAX_TASK_ATTACHMENT_BYTES) === BODY_TOO_LARGE)
|
|
6738
6769
|
return true;
|
|
6739
6770
|
const parsed = await uploadTaskFileRoute.parse(req, res, pathSegments, queryParams);
|
|
6740
6771
|
if (!parsed)
|
|
@@ -6768,9 +6799,9 @@ async function handleFs(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
6768
6799
|
return false;
|
|
6769
6800
|
}
|
|
6770
6801
|
async function sendUpload(req, res, taskId, query, agentId) {
|
|
6771
|
-
const body = await readRawBody(req,
|
|
6802
|
+
const body = await readRawBody(req, MAX_TASK_ATTACHMENT_BYTES);
|
|
6772
6803
|
if (body === BODY_TOO_LARGE) {
|
|
6773
|
-
jsonError(res, `Payload too large (max ${
|
|
6804
|
+
jsonError(res, `Payload too large (max ${MAX_TASK_ATTACHMENT_BYTES} bytes)`, 413);
|
|
6774
6805
|
return true;
|
|
6775
6806
|
}
|
|
6776
6807
|
const provider = getFileStorageProvider();
|
|
@@ -6794,38 +6825,21 @@ async function sendUpload(req, res, taskId, query, agentId) {
|
|
|
6794
6825
|
}
|
|
6795
6826
|
return sendProviderError(res, error);
|
|
6796
6827
|
}
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
mimeType: uploaded.contentType ?? contentType,
|
|
6813
|
-
sizeBytes: uploaded.sizeBytes ?? body.byteLength,
|
|
6814
|
-
sha256: uploaded.sha256 ?? createHash2("sha256").update(body).digest("hex"),
|
|
6815
|
-
intent: query.intent,
|
|
6816
|
-
description: query.description,
|
|
6817
|
-
isPrimary: query.isPrimary === "true",
|
|
6818
|
-
createdBy: auth?.kind === "user" ? auth.userId : undefined
|
|
6819
|
-
});
|
|
6820
|
-
uploadTaskFileRoute.respond(res, 201, attachment);
|
|
6821
|
-
} catch (error) {
|
|
6822
|
-
try {
|
|
6823
|
-
await provider.delete(scope);
|
|
6824
|
-
} catch (cleanupError) {
|
|
6825
|
-
console.warn(scrubSecrets(`[fs] upload metadata insert failed and blob cleanup failed: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`));
|
|
6826
|
-
}
|
|
6827
|
-
throw error;
|
|
6828
|
-
}
|
|
6828
|
+
const auth = getCurrentRequestAuth();
|
|
6829
|
+
const attachment = await recordTaskAttachmentUpload({
|
|
6830
|
+
provider,
|
|
6831
|
+
scope,
|
|
6832
|
+
uploaded,
|
|
6833
|
+
sizeBytes: body.byteLength,
|
|
6834
|
+
sha256: uploaded.sha256 ?? new Bun.CryptoHasher("sha256").update(body).digest("hex"),
|
|
6835
|
+
contentType,
|
|
6836
|
+
agentId,
|
|
6837
|
+
intent: query.intent,
|
|
6838
|
+
description: query.description,
|
|
6839
|
+
isPrimary: query.isPrimary === "true",
|
|
6840
|
+
createdBy: auth?.kind === "user" ? auth.userId : undefined
|
|
6841
|
+
});
|
|
6842
|
+
uploadTaskFileRoute.respond(res, 201, attachment);
|
|
6829
6843
|
return true;
|
|
6830
6844
|
}
|
|
6831
6845
|
async function sendDownload(res, attachment) {
|
|
@@ -8963,6 +8977,7 @@ class StreamableHTTPServerTransport {
|
|
|
8963
8977
|
|
|
8964
8978
|
// src/http/mcp.ts
|
|
8965
8979
|
init_db();
|
|
8980
|
+
init_request_auth_context();
|
|
8966
8981
|
var DEFAULT_MCP_TRANSPORT_IDLE_TIMEOUT_MS = 2 * 60 * 60 * 1000;
|
|
8967
8982
|
function markMcpTransportActivity(sessionActivity, sessionId, now = Date.now()) {
|
|
8968
8983
|
if (sessionId) {
|
|
@@ -8999,6 +9014,25 @@ function unauthorized(res, message = "Unauthorized") {
|
|
|
8999
9014
|
res.end(JSON.stringify({ error: message }));
|
|
9000
9015
|
return true;
|
|
9001
9016
|
}
|
|
9017
|
+
function forbidden2(res, message) {
|
|
9018
|
+
res.writeHead(403, { "Content-Type": "application/json" });
|
|
9019
|
+
res.end(JSON.stringify({ error: message }));
|
|
9020
|
+
return true;
|
|
9021
|
+
}
|
|
9022
|
+
function validateAgentTokenIdentity(req, res) {
|
|
9023
|
+
const auth = getRequestAuth(req);
|
|
9024
|
+
if (!auth || auth.kind !== "agent")
|
|
9025
|
+
return;
|
|
9026
|
+
const agentId = headerValue(req.headers["x-agent-id"]);
|
|
9027
|
+
const taskId = headerValue(req.headers["x-source-task-id"]);
|
|
9028
|
+
if (!agentId || agentId !== auth.agentId) {
|
|
9029
|
+
return forbidden2(res, "X-Agent-ID does not match session token");
|
|
9030
|
+
}
|
|
9031
|
+
if (!taskId || taskId !== auth.taskId) {
|
|
9032
|
+
return forbidden2(res, "X-Source-Task-Id does not match session token");
|
|
9033
|
+
}
|
|
9034
|
+
return;
|
|
9035
|
+
}
|
|
9002
9036
|
function headerValue(value) {
|
|
9003
9037
|
return Array.isArray(value) ? value[0] : value;
|
|
9004
9038
|
}
|
|
@@ -9030,6 +9064,9 @@ async function handleMcp(req, res, transports, sessionActivity = {}, sessionAgen
|
|
|
9030
9064
|
if (req.url !== "/mcp") {
|
|
9031
9065
|
return false;
|
|
9032
9066
|
}
|
|
9067
|
+
const tokenIdentityMismatch = validateAgentTokenIdentity(req, res);
|
|
9068
|
+
if (tokenIdentityMismatch)
|
|
9069
|
+
return true;
|
|
9033
9070
|
const agentMismatch = validateBoundAgent(req, res, sessionId, sessionAgents);
|
|
9034
9071
|
if (agentMismatch)
|
|
9035
9072
|
return true;
|
|
@@ -13572,13 +13609,13 @@ var publicPageRoute = route({
|
|
|
13572
13609
|
method: "get",
|
|
13573
13610
|
path: "/p/{id}",
|
|
13574
13611
|
pattern: ["p", null],
|
|
13575
|
-
summary: "Render a page (HTML inline; JSON redirects to SPA)",
|
|
13612
|
+
summary: "Render a page (HTML/SVG inline; JSON redirects to SPA)",
|
|
13576
13613
|
tags: ["Pages"],
|
|
13577
13614
|
params: exports_external.object({ id: exports_external.string() }),
|
|
13578
13615
|
responses: {
|
|
13579
13616
|
200: {
|
|
13580
|
-
description: "Rendered HTML page",
|
|
13581
|
-
unstructured: "Serves the page's
|
|
13617
|
+
description: "Rendered HTML page or raw SVG image",
|
|
13618
|
+
unstructured: "Serves raw image/svg+xml bytes, the page's agent-authored HTML body (SDK-injected) or, for ?print=1 on a JSON-content page, a standalone printable HTML document — not a JSON shape"
|
|
13582
13619
|
},
|
|
13583
13620
|
302: { description: "Redirect to SPA for JSON content" },
|
|
13584
13621
|
401: { description: "Page requires an authenticated session" },
|
|
@@ -13925,6 +13962,20 @@ async function handlePagesPublic(req, res, pathSegments, queryParams) {
|
|
|
13925
13962
|
await bumpViewCount(page.id);
|
|
13926
13963
|
return true;
|
|
13927
13964
|
}
|
|
13965
|
+
if (page.contentType === "image/svg+xml") {
|
|
13966
|
+
const headers3 = {
|
|
13967
|
+
"Content-Type": "image/svg+xml",
|
|
13968
|
+
"Cache-Control": page.authMode === "public" ? "public, max-age=1800" : "private, no-store",
|
|
13969
|
+
"X-Content-Type-Options": "nosniff",
|
|
13970
|
+
"Content-Security-Policy": "default-src 'none'; style-src 'unsafe-inline'; sandbox"
|
|
13971
|
+
};
|
|
13972
|
+
if (inlineSetCookie)
|
|
13973
|
+
headers3["Set-Cookie"] = inlineSetCookie;
|
|
13974
|
+
res.writeHead(200, headers3);
|
|
13975
|
+
res.end(page.body);
|
|
13976
|
+
await bumpViewCount(page.id);
|
|
13977
|
+
return true;
|
|
13978
|
+
}
|
|
13928
13979
|
const wantsPrint = queryParams.get("print") === "1";
|
|
13929
13980
|
if (page.contentType === "application/json") {
|
|
13930
13981
|
if (wantsPrint) {
|
|
@@ -14107,11 +14158,13 @@ var PollTriggerAttachmentSchema = TaskAttachmentSchema.pick({
|
|
|
14107
14158
|
sizeBytes: true
|
|
14108
14159
|
});
|
|
14109
14160
|
var PollRequestedBySchema = UserSchema.pick({
|
|
14161
|
+
id: true,
|
|
14110
14162
|
name: true,
|
|
14111
14163
|
email: true,
|
|
14112
14164
|
role: true,
|
|
14113
14165
|
notes: true
|
|
14114
14166
|
}).extend({
|
|
14167
|
+
id: exports_external.string().optional(),
|
|
14115
14168
|
comms: UserCommsPrefsSchema.optional()
|
|
14116
14169
|
});
|
|
14117
14170
|
var PollTaskOfferedTriggerSchema = exports_external.object({
|
|
@@ -14178,6 +14231,7 @@ async function buildTriggerRequestedBy(task) {
|
|
|
14178
14231
|
const user = task.requestedByUserId ? await getUserById(task.requestedByUserId) : undefined;
|
|
14179
14232
|
if (user) {
|
|
14180
14233
|
return {
|
|
14234
|
+
id: user.id,
|
|
14181
14235
|
name: user.name,
|
|
14182
14236
|
email: user.email,
|
|
14183
14237
|
role: user.role,
|
|
@@ -14503,13 +14557,13 @@ init_zod();
|
|
|
14503
14557
|
init_db();
|
|
14504
14558
|
init_types();
|
|
14505
14559
|
init_secret_scrubber();
|
|
14506
|
-
import { createHash as
|
|
14560
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
14507
14561
|
function apiKeyFingerprint2(req) {
|
|
14508
14562
|
const authHeader = req.headers.authorization;
|
|
14509
14563
|
const providedKey = authHeader?.startsWith("Bearer ") ? authHeader.slice(7) : "";
|
|
14510
14564
|
if (!providedKey)
|
|
14511
14565
|
return "";
|
|
14512
|
-
const digest =
|
|
14566
|
+
const digest = createHash2("sha256").update(providedKey).digest("hex").slice(0, 8);
|
|
14513
14567
|
return scrubSecrets(digest);
|
|
14514
14568
|
}
|
|
14515
14569
|
var PricingTriplePathParams = exports_external.object({
|
|
@@ -15164,7 +15218,7 @@ var createRepo = route({
|
|
|
15164
15218
|
defaultBranch: exports_external.string().optional(),
|
|
15165
15219
|
autoClone: exports_external.boolean().optional(),
|
|
15166
15220
|
hooks: RepoHooksSchema.optional(),
|
|
15167
|
-
guidelines:
|
|
15221
|
+
guidelines: RepoGuidelinesInputSchema.nullable().optional()
|
|
15168
15222
|
}),
|
|
15169
15223
|
responses: {
|
|
15170
15224
|
201: { description: "Repo created", schema: SwarmRepoSchema },
|
|
@@ -15186,7 +15240,7 @@ var updateRepo = route({
|
|
|
15186
15240
|
defaultBranch: exports_external.string().optional(),
|
|
15187
15241
|
autoClone: exports_external.boolean().optional(),
|
|
15188
15242
|
hooks: RepoHooksSchema.nullable().optional(),
|
|
15189
|
-
guidelines:
|
|
15243
|
+
guidelines: RepoGuidelinesInputSchema.nullable().optional()
|
|
15190
15244
|
}),
|
|
15191
15245
|
responses: {
|
|
15192
15246
|
200: { description: "Repo updated", schema: SwarmRepoSchema },
|
|
@@ -20055,6 +20109,7 @@ init_zod();
|
|
|
20055
20109
|
init_db();
|
|
20056
20110
|
init_steering();
|
|
20057
20111
|
init_types();
|
|
20112
|
+
init_request_auth_context();
|
|
20058
20113
|
var AgentTaskSummarySchema = AgentTaskSchema.pick({
|
|
20059
20114
|
id: true,
|
|
20060
20115
|
key: true,
|
|
@@ -20094,6 +20149,50 @@ var TaskWithSteeringSchema = AgentTaskSchema.extend({
|
|
|
20094
20149
|
isLeadTask: exports_external.boolean(),
|
|
20095
20150
|
supportedSteerModes: exports_external.array(SteerModeSchema)
|
|
20096
20151
|
});
|
|
20152
|
+
var MAX_SESSION_TOKEN_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
20153
|
+
var mintSessionTokenRoute = route({
|
|
20154
|
+
method: "post",
|
|
20155
|
+
path: "/api/sessions/tokens",
|
|
20156
|
+
pattern: ["api", "sessions", "tokens"],
|
|
20157
|
+
summary: "Mint an ephemeral session token for an ACP provider session",
|
|
20158
|
+
description: "Returns a short-lived aseph_ bearer for use by the ACP adapter in place of the full " + "operator key. The token expires at the requested TTL and is actively revoked when the " + "session ends. Only the operator key may mint session tokens.",
|
|
20159
|
+
tags: ["Sessions"],
|
|
20160
|
+
body: exports_external.object({
|
|
20161
|
+
agentId: exports_external.string().min(1),
|
|
20162
|
+
taskId: exports_external.string().min(1),
|
|
20163
|
+
ttlMs: exports_external.number().int().positive().max(MAX_SESSION_TOKEN_TTL_MS)
|
|
20164
|
+
}),
|
|
20165
|
+
responses: {
|
|
20166
|
+
200: {
|
|
20167
|
+
description: "Minted token plaintext (returned once) and its stable token ID",
|
|
20168
|
+
schema: exports_external.object({
|
|
20169
|
+
tokenId: exports_external.string(),
|
|
20170
|
+
plaintext: exports_external.string()
|
|
20171
|
+
})
|
|
20172
|
+
},
|
|
20173
|
+
400: { description: "Validation error" },
|
|
20174
|
+
401: { description: "Unauthorized" }
|
|
20175
|
+
},
|
|
20176
|
+
auth: { apiKey: true },
|
|
20177
|
+
rbac: { ungated: "operator-only: minting is gated on the full operator key in auth middleware" }
|
|
20178
|
+
});
|
|
20179
|
+
var revokeSessionTokenRoute = route({
|
|
20180
|
+
method: "delete",
|
|
20181
|
+
path: "/api/sessions/tokens/{tokenId}",
|
|
20182
|
+
pattern: ["api", "sessions", "tokens", null],
|
|
20183
|
+
summary: "Revoke an ephemeral session token",
|
|
20184
|
+
description: "Revokes an aseph_ bearer token by ID. No-op if already revoked.",
|
|
20185
|
+
tags: ["Sessions"],
|
|
20186
|
+
params: exports_external.object({ tokenId: exports_external.string() }),
|
|
20187
|
+
responses: {
|
|
20188
|
+
204: { description: "Token revoked (or was already revoked)" },
|
|
20189
|
+
401: { description: "Unauthorized" }
|
|
20190
|
+
},
|
|
20191
|
+
auth: { apiKey: true },
|
|
20192
|
+
rbac: {
|
|
20193
|
+
ungated: "operator-only: revocation is gated on the full operator key in auth middleware"
|
|
20194
|
+
}
|
|
20195
|
+
});
|
|
20097
20196
|
var listSessions = route({
|
|
20098
20197
|
method: "get",
|
|
20099
20198
|
path: "/api/sessions",
|
|
@@ -20144,6 +20243,32 @@ var getSession = route({
|
|
|
20144
20243
|
auth: { apiKey: true }
|
|
20145
20244
|
});
|
|
20146
20245
|
async function handleSessions(req, res, pathSegments, queryParams) {
|
|
20246
|
+
if (mintSessionTokenRoute.match(req.method, pathSegments)) {
|
|
20247
|
+
if (getRequestAuth(req)?.kind !== "operator") {
|
|
20248
|
+
jsonError(res, "Unauthorized", 401);
|
|
20249
|
+
return true;
|
|
20250
|
+
}
|
|
20251
|
+
const parsed = await mintSessionTokenRoute.parse(req, res, pathSegments, queryParams);
|
|
20252
|
+
if (!parsed)
|
|
20253
|
+
return true;
|
|
20254
|
+
const { agentId, taskId, ttlMs } = parsed.body;
|
|
20255
|
+
const token = await mintSessionToken(agentId, taskId, ttlMs);
|
|
20256
|
+
mintSessionTokenRoute.respond(res, 200, { tokenId: token.tokenId, plaintext: token.plaintext });
|
|
20257
|
+
return true;
|
|
20258
|
+
}
|
|
20259
|
+
if (revokeSessionTokenRoute.match(req.method, pathSegments)) {
|
|
20260
|
+
if (getRequestAuth(req)?.kind !== "operator") {
|
|
20261
|
+
jsonError(res, "Unauthorized", 401);
|
|
20262
|
+
return true;
|
|
20263
|
+
}
|
|
20264
|
+
const parsed = await revokeSessionTokenRoute.parse(req, res, pathSegments, queryParams);
|
|
20265
|
+
if (!parsed)
|
|
20266
|
+
return true;
|
|
20267
|
+
await revokeSessionToken(parsed.params.tokenId);
|
|
20268
|
+
res.writeHead(204);
|
|
20269
|
+
res.end();
|
|
20270
|
+
return true;
|
|
20271
|
+
}
|
|
20147
20272
|
if (listSessions.match(req.method, pathSegments)) {
|
|
20148
20273
|
const parsed = await listSessions.parse(req, res, pathSegments, queryParams);
|
|
20149
20274
|
if (!parsed)
|
|
@@ -22148,7 +22273,9 @@ var listPausedTasks = route({
|
|
|
22148
22273
|
responses: {
|
|
22149
22274
|
200: {
|
|
22150
22275
|
description: "Paused task list",
|
|
22151
|
-
schema: exports_external.object({
|
|
22276
|
+
schema: exports_external.object({
|
|
22277
|
+
tasks: exports_external.array(AgentTaskSchema.extend({ attachments: exports_external.array(TaskAttachmentSchema) }))
|
|
22278
|
+
})
|
|
22152
22279
|
}
|
|
22153
22280
|
}
|
|
22154
22281
|
});
|
|
@@ -22854,7 +22981,11 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
22854
22981
|
return true;
|
|
22855
22982
|
}
|
|
22856
22983
|
const pausedTasks = await getPausedTasksForAgent(myAgentId);
|
|
22857
|
-
|
|
22984
|
+
const tasks = await Promise.all(pausedTasks.map(async (task) => ({
|
|
22985
|
+
...task,
|
|
22986
|
+
attachments: await getTaskAttachments(task.id)
|
|
22987
|
+
})));
|
|
22988
|
+
listPausedTasks.respond(res, 200, { tasks });
|
|
22858
22989
|
return true;
|
|
22859
22990
|
}
|
|
22860
22991
|
if (pauseTaskRoute.match(req.method, pathSegments)) {
|
|
@@ -26373,7 +26504,7 @@ async function shutdown() {
|
|
|
26373
26504
|
sessionsProcessed: getServerSessionsProcessed()
|
|
26374
26505
|
});
|
|
26375
26506
|
if (hasCapability("scheduling")) {
|
|
26376
|
-
const { stopScheduler } = await import("./index-
|
|
26507
|
+
const { stopScheduler } = await import("./index-x5j894zf.js");
|
|
26377
26508
|
stopScheduler();
|
|
26378
26509
|
}
|
|
26379
26510
|
stopHeartbeat();
|
|
@@ -26381,7 +26512,7 @@ async function shutdown() {
|
|
|
26381
26512
|
await stopScriptRunSupervisor();
|
|
26382
26513
|
await stopSlackApp();
|
|
26383
26514
|
if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
|
|
26384
|
-
const { stopOAuthKeepalive } = await import("./keepalive-
|
|
26515
|
+
const { stopOAuthKeepalive } = await import("./keepalive-w733ax66.js");
|
|
26385
26516
|
await stopOAuthKeepalive();
|
|
26386
26517
|
}
|
|
26387
26518
|
stopOAuthPendingGc();
|
|
@@ -26448,15 +26579,15 @@ try {
|
|
|
26448
26579
|
console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
|
|
26449
26580
|
}
|
|
26450
26581
|
try {
|
|
26451
|
-
const { seedPricingFromModelsDev } = await import("./seed-pricing-
|
|
26582
|
+
const { seedPricingFromModelsDev } = await import("./seed-pricing-g62hy1pk.js");
|
|
26452
26583
|
seedPricingFromModelsDev();
|
|
26453
|
-
const { startPricingRefreshLoop } = await import("./pricing-refresh-
|
|
26584
|
+
const { startPricingRefreshLoop } = await import("./pricing-refresh-9nzsrgcq.js");
|
|
26454
26585
|
startPricingRefreshLoop();
|
|
26455
26586
|
} catch (err) {
|
|
26456
26587
|
console.error("[startup] Failed to seed pricing rows:", err);
|
|
26457
26588
|
}
|
|
26458
26589
|
try {
|
|
26459
|
-
const { ensureRbacSeedsSynced } = await import("./rbac-roles-
|
|
26590
|
+
const { ensureRbacSeedsSynced } = await import("./rbac-roles-r3hqjp09.js");
|
|
26460
26591
|
ensureRbacSeedsSynced();
|
|
26461
26592
|
} catch (err) {
|
|
26462
26593
|
console.error("[startup] Failed to sync RBAC seed rows:", err);
|
|
@@ -26464,7 +26595,7 @@ try {
|
|
|
26464
26595
|
throw err;
|
|
26465
26596
|
}
|
|
26466
26597
|
try {
|
|
26467
|
-
const { runAllSeeders } = await import("./index-
|
|
26598
|
+
const { runAllSeeders } = await import("./index-tce1rss4.js");
|
|
26468
26599
|
await runAllSeeders({ scriptEmbeddingMode: "skip" });
|
|
26469
26600
|
} catch (err) {
|
|
26470
26601
|
console.error("[startup] Failed to seed built-in entities:", err);
|
|
@@ -26505,36 +26636,36 @@ httpServer.listen(port, async () => {
|
|
|
26505
26636
|
await initWorkflows();
|
|
26506
26637
|
await startScriptRunSupervisor(getMcpBaseUrl());
|
|
26507
26638
|
if (hasCapability("scheduling")) {
|
|
26508
|
-
const { startScheduler } = await import("./index-
|
|
26509
|
-
const { getExecutorRegistry: getExecutorRegistry2 } = await import("./index-
|
|
26639
|
+
const { startScheduler } = await import("./index-x5j894zf.js");
|
|
26640
|
+
const { getExecutorRegistry: getExecutorRegistry2 } = await import("./index-k8znfx0z.js");
|
|
26510
26641
|
const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
|
|
26511
26642
|
startScheduler(getExecutorRegistry2(), intervalMs, {
|
|
26512
26643
|
runId: globalState.__runId
|
|
26513
26644
|
});
|
|
26514
26645
|
}
|
|
26515
26646
|
if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
|
|
26516
|
-
const { startHeartbeat } = await import("./index-
|
|
26647
|
+
const { startHeartbeat } = await import("./index-hssww7kj.js");
|
|
26517
26648
|
const heartbeatMs = Number(process.env.HEARTBEAT_INTERVAL_MS) || 90000;
|
|
26518
26649
|
startHeartbeat(heartbeatMs);
|
|
26519
26650
|
}
|
|
26520
26651
|
if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
|
|
26521
|
-
const { startOAuthKeepalive } = await import("./keepalive-
|
|
26652
|
+
const { startOAuthKeepalive } = await import("./keepalive-w733ax66.js");
|
|
26522
26653
|
startOAuthKeepalive();
|
|
26523
26654
|
}
|
|
26524
26655
|
if (process.env.OAUTH_REFRESH_SWEEP_DISABLE !== "true") {
|
|
26525
|
-
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-
|
|
26656
|
+
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-wdetky26.js");
|
|
26526
26657
|
startOAuthRefreshSweep();
|
|
26527
26658
|
}
|
|
26528
26659
|
startOAuthPendingGc();
|
|
26529
26660
|
await startMemoryGc();
|
|
26530
26661
|
await startDbRetention();
|
|
26531
|
-
import("./boot-reembed-
|
|
26662
|
+
import("./boot-reembed-az5rassp.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
|
|
26532
26663
|
console.error("[boot-reembed] startup backfill failed (non-fatal):", err);
|
|
26533
26664
|
});
|
|
26534
|
-
import("./boot-reembed-
|
|
26665
|
+
import("./boot-reembed-j3mm3rfz.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
|
|
26535
26666
|
console.error("[boot-reembed-scripts] startup backfill failed (non-fatal):", err);
|
|
26536
26667
|
});
|
|
26537
|
-
import("./boot-scrub-logs-
|
|
26668
|
+
import("./boot-scrub-logs-b6h54817.js").then(({ runBootScrubLogs }) => runBootScrubLogs()).catch((err) => {
|
|
26538
26669
|
console.error("[boot-scrub-logs] startup scrub failed (non-fatal):", err);
|
|
26539
26670
|
});
|
|
26540
26671
|
}).on("error", (err) => {
|