@desplega.ai/agent-swarm 1.136.0 → 1.138.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 +12 -3
- package/dist/acp-adapter-6nttxe2q.js +4787 -0
- package/dist/{actions-agcbc8nd.js → actions-z9dzgh3f.js} +7 -8
- package/dist/{app-g2s78xya.js → app-wb6bc7tt.js} +4 -5
- package/dist/{assistant-yd3jkb9d.js → assistant-08pd6pgy.js} +9 -10
- package/dist/{boot-reembed-6spqw4q0.js → boot-reembed-hstr4e2c.js} +4 -4
- package/dist/{boot-reembed-b22s9w5x.js → boot-reembed-y7p7qjbf.js} +5 -5
- package/dist/{boot-scrub-logs-6h3cqkc0.js → boot-scrub-logs-azbnxwhn.js} +3 -3
- package/dist/{claude-adapter-ng5y8zd7.js → claude-adapter-rwaq6eda.js} +10 -9
- package/dist/{claude-managed-adapter-5zr3n86v.js → claude-managed-adapter-vtseey1x.js} +3 -3
- package/dist/{cli-qckgdqmr.js → cli-005yr57a.js} +2 -2
- package/dist/{cli-54ht104h.js → cli-0cka8dnm.js} +3 -3
- package/dist/{cli-gpdtxzar.js → cli-23cpnqk9.js} +1 -1
- package/dist/{cli-qhfkxrpg.js → cli-2ypjdmqg.js} +223 -474
- package/dist/{cli-bnq8h7ea.js → cli-3719ggyf.js} +17 -10
- package/dist/cli-390sgxn5.js +257 -0
- package/dist/{cli-z6e8eqrm.js → cli-47esr8ht.js} +2 -2
- package/dist/{cli-jjhnma34.js → cli-4jaj24py.js} +248 -101
- package/dist/{cli-6gwgzdgw.js → cli-69377c2a.js} +5 -5
- package/dist/{cli-ads0hfw2.js → cli-6v4d8r8c.js} +205 -75
- package/dist/{cli-mgef08pc.js → cli-8rtyss6g.js} +1 -1
- package/dist/{cli-35jknh9e.js → cli-9w7vsmbm.js} +5 -5
- package/dist/{cli-m3z53bed.js → cli-b4zdc3x6.js} +1 -1
- package/dist/{cli-fpjmcbhz.js → cli-ba87cw29.js} +4 -4
- package/dist/{cli-4gzv54ss.js → cli-bzk75kdc.js} +43 -11
- package/dist/{cli-d5ygfv18.js → cli-cywkhzqs.js} +35 -11
- package/dist/{cli-0crn5kaz.js → cli-d62cd9qs.js} +16 -4
- package/dist/{cli-5bnz1t86.js → cli-f9skf1v7.js} +51 -7
- package/dist/{cli-06ghj6pe.js → cli-fytpjraz.js} +4 -4
- package/dist/{cli-j7qp8gtf.js → cli-h7c5dam1.js} +16 -11
- package/dist/{cli-4r4jkqep.js → cli-kkn46gfr.js} +9 -3
- package/dist/{cli-tmn19cdz.js → cli-kq9htgbr.js} +415 -62
- package/dist/{cli-8v57p983.js → cli-pkmqqxp8.js} +45 -69
- package/dist/{cli-84vrhesc.js → cli-qf34ej1d.js} +1 -1
- package/dist/{cli-v3qda694.js → cli-rnyttbh0.js} +0 -5
- package/dist/cli-rx5cxzn2.js +7 -0
- package/dist/{cli-cw70hymf.js → cli-s25avqg9.js} +2 -0
- package/dist/{cli-tee8w7tq.js → cli-s6t1qv67.js} +15 -10
- package/dist/{cli-68vayryq.js → cli-tb4csb08.js} +2 -2
- package/dist/{cli-y16cesaq.js → cli-vy48y9bx.js} +2 -2
- package/dist/{cli-3y553gws.js → cli-y294regh.js} +1 -1
- package/dist/{cli-spf767vc.js → cli-y43043ws.js} +1 -1
- package/dist/{cli-hz5hp6wn.js → cli-yh2eybyt.js} +1 -1
- package/dist/{cli-edwrx42s.js → cli-zmyxt25p.js} +5 -5
- package/dist/cli.js +40 -18
- package/dist/{codex-adapter-kw11ps3j.js → codex-adapter-yzep6mvb.js} +7 -6
- package/dist/{codex-session-runner-sffb69v7.js → codex-session-runner-25e8tn72.js} +7 -6
- package/dist/{commands-0xxp4tz8.js → commands-0vv72d6a.js} +3 -3
- package/dist/{db-0npp39zd.js → db-x61ncfa1.js} +19 -3
- package/dist/{google-generative-ai-6xxdj4t3.js → google-generative-ai-zyhy3dab.js} +1 -1
- package/dist/{google-vertex-zma18wb0.js → google-vertex-t25h65yd.js} +1 -1
- package/dist/{handlers-5p7a1jx6.js → handlers-fwdcaahf.js} +9 -10
- package/dist/{hook-jjpxn4se.js → hook-mpwfgynm.js} +6 -5
- package/dist/{hook-hpefr0a8.js → hook-x18504ja.js} +8 -7
- package/dist/{http-wfp33653.js → http-83m6qdds.js} +590 -192
- package/dist/{index-pe58mf1r.js → index-1nsdwvn5.js} +2 -1
- package/dist/{index-17h657rg.js → index-38f98ck3.js} +9 -9
- package/dist/{index-m2p7ctyh.js → index-7kxvtd38.js} +24 -12
- package/dist/{index-racb4wfq.js → index-a4naswjn.js} +23 -10
- package/dist/{index-p13cfsc2.js → index-agykc6k2.js} +2 -1
- package/dist/{index-zh66wm65.js → index-dawtzfhw.js} +22 -9
- package/dist/{keepalive-wxjd633a.js → keepalive-y0m8g5wn.js} +5 -5
- package/dist/{lead-359ec2z0.js → lead-ka18ef6a.js} +36 -36
- package/dist/{maintenance-rr03qjtb.js → maintenance-x585p56c.js} +5 -5
- package/dist/{oauth-refresh-sweep-jwj22yb8.js → oauth-refresh-sweep-kdm9vj7a.js} +4 -4
- package/dist/{onboard-asnhchcv.js → onboard-5v229nvt.js} +664 -248
- package/dist/{opencode-adapter-sx38y7f7.js → opencode-adapter-46nnmnvv.js} +3 -3
- package/dist/{otel-impl-54cra6mw.js → otel-impl-k47aj4sd.js} +73 -4
- package/dist/{pi-mono-adapter-29g7axgj.js → pi-mono-adapter-wawfj09v.js} +42 -40
- package/dist/{pricing-refresh-mkyy7c2y.js → pricing-refresh-ky2gjp05.js} +5 -5
- package/dist/{rbac-roles-kb3afm95.js → rbac-roles-0j0f7s8r.js} +4 -4
- package/dist/{rbac-roles-ak56tr75.js → rbac-roles-az4wc15e.js} +3 -3
- package/dist/{render-v2-434asg49.js → render-v2-seyxq61z.js} +4 -5
- package/dist/{seed-pricing-nbmd7ah8.js → seed-pricing-fev611hx.js} +4 -4
- package/dist/{setup-wh4qmjs4.js → setup-hy404zwh.js} +2 -2
- package/dist/{worker-j1d27tjv.js → worker-g1j5hn16.js} +36 -36
- package/openapi.json +197 -27
- package/package.json +9 -3
- package/src/be/db-client.ts +58 -5
- package/src/be/db-retention.ts +550 -121
- package/src/be/db.ts +367 -55
- package/src/be/memory/raters/retrieval.ts +40 -0
- package/src/be/migrations/140_approval_request_cancelled_status.sql +64 -0
- package/src/be/pricing-normalize.ts +3 -0
- package/src/be/script-connections.ts +26 -6
- package/src/be/seed-pricing.ts +18 -8
- package/src/be/swarm-config-guard.ts +33 -0
- package/src/cli.tsx +20 -1
- package/src/commands/onboard/compose-generator.ts +63 -7
- package/src/commands/onboard/env-generator.ts +32 -4
- package/src/commands/onboard/manifest.ts +4 -1
- package/src/commands/onboard/non-interactive.ts +159 -0
- package/src/commands/onboard/steps/generate.tsx +1 -34
- package/src/commands/onboard/steps/harness-credentials.tsx +181 -1
- package/src/commands/onboard/steps/harness.tsx +20 -6
- package/src/commands/onboard/steps/review.tsx +3 -2
- package/src/commands/onboard/types.ts +48 -1
- package/src/commands/onboard.tsx +18 -13
- package/src/commands/provider-credentials.ts +17 -3
- package/src/commands/runner.ts +1 -0
- package/src/heartbeat/heartbeat.ts +47 -7
- package/src/http/approval-requests.ts +53 -8
- package/src/http/index.ts +9 -1
- package/src/http/mcp-servers.ts +2 -0
- package/src/http/memory.ts +27 -1
- package/src/http/oauth-callback.ts +33 -0
- package/src/http/repos.ts +6 -0
- package/src/http/script-connections.ts +77 -0
- package/src/http/session-data.ts +5 -1
- package/src/http/stats.ts +21 -30
- package/src/http/tasks.ts +10 -0
- package/src/oauth/presets.ts +29 -0
- package/src/otel-impl.ts +96 -1
- package/src/otel.ts +34 -0
- package/src/prompts/memories.ts +2 -2
- package/src/providers/acp-adapter.ts +325 -0
- package/src/providers/acp-swarm-events.ts +113 -0
- package/src/providers/acp-targets.ts +103 -0
- package/src/providers/claude-managed-models.ts +17 -1
- package/src/providers/codex-adapter.ts +3 -3
- package/src/providers/codex-oauth/auth-json-fs.ts +2 -2
- package/src/providers/codex-oauth/home.ts +13 -0
- package/src/providers/index.ts +5 -1
- package/src/providers/types.ts +1 -1
- package/src/server-user.ts +1 -0
- package/src/slack/app.ts +5 -1
- package/src/tasks/worker-follow-up.ts +78 -7
- package/src/telemetry.ts +151 -0
- package/src/tests/acp-adapter.test.ts +192 -0
- package/src/tests/acp-swarm-events.test.ts +132 -0
- package/src/tests/agents-list-model-display.test.ts +20 -0
- package/src/tests/approval-cancellation-migration.test.ts +134 -0
- package/src/tests/approval-requests.test.ts +456 -2
- package/src/tests/apps-spike2.test.ts +4 -1
- package/src/tests/apps-sync-engine.test.ts +22 -18
- package/src/tests/claude-managed-adapter.test.ts +12 -0
- package/src/tests/codex-oauth-auth-json-fs.test.ts +19 -0
- package/src/tests/connection-embedded-auth.test.ts +4 -1
- package/src/tests/context-window.test.ts +2 -0
- package/src/tests/credential-check.test.ts +6 -0
- package/src/tests/db-client-busy-retry.test.ts +18 -0
- package/src/tests/db-client.test.ts +23 -0
- package/src/tests/db-retention-telemetry.test.ts +569 -0
- package/src/tests/db-retention.test.ts +456 -117
- package/src/tests/heartbeat.test.ts +140 -0
- package/src/tests/memory-http-recall-gating.test.ts +120 -13
- package/src/tests/memory-store.test.ts +41 -0
- package/src/tests/migration-046-budgets.test.ts +27 -5
- package/src/tests/oauth-presets.test.ts +17 -5
- package/src/tests/onboard-compose.test.ts +99 -0
- package/src/tests/onboard-env.test.ts +43 -0
- package/src/tests/onboard-manifest.test.ts +17 -1
- package/src/tests/onboard-non-interactive.test.ts +89 -0
- package/src/tests/pool-affinity.test.ts +100 -0
- package/src/tests/promote-draft-task-route.test.ts +32 -1
- package/src/tests/sandbox-spawn-test-helpers.ts +3 -0
- package/src/tests/sandboxed-process.test.ts +2 -2
- package/src/tests/schedule-target-type.test.ts +6 -3
- package/src/tests/script-connections-http.test.ts +4 -3
- package/src/tests/script-connections.test.ts +6 -1
- package/src/tests/script-workflows-runtime-e2e.test.ts +36 -28
- package/src/tests/scripts-external-api.test.ts +8 -5
- package/src/tests/scripts-http.test.ts +6 -3
- package/src/tests/scripts-mcp-e2e.test.ts +65 -60
- package/src/tests/scripts-retention.test.ts +6 -3
- package/src/tests/scripts-runtime-identity.test.ts +4 -2
- package/src/tests/scripts-runtime.test.ts +18 -16
- package/src/tests/session-costs-model-key-normalize.test.ts +2 -0
- package/src/tests/slack-read-boundaries.test.ts +3 -1
- package/src/tests/task-lifecycle-telemetry.test.ts +1 -0
- package/src/tests/task-tools-ctx.test.ts +88 -1
- package/src/tests/telemetry-init.test.ts +61 -0
- package/src/tests/tool-annotations.test.ts +4 -1
- package/src/tests/vendored-openapi.test.ts +15 -2
- package/src/tests/workflow-e2e.test.ts +4 -1
- package/src/tests/workflow-engine-v2.test.ts +5 -2
- package/src/tests/workflow-executors.test.ts +24 -19
- package/src/tests/workflow-http-v2.test.ts +17 -2
- package/src/tests/workflow-llm.test.ts +57 -0
- package/src/tests/workflow-retry-v2.test.ts +142 -1
- package/src/tests/workflow-swarm-script.test.ts +20 -17
- package/src/tools/get-task-details.ts +1 -0
- package/src/tools/mcp-servers/mcp-server-create.ts +7 -1
- package/src/tools/memory-search.ts +27 -2
- package/src/tools/send-task.ts +28 -10
- package/src/tools/task-action.ts +13 -5
- package/src/types.ts +31 -2
- package/src/utils/context-window.ts +2 -0
- package/src/workflows/approval-notifications.ts +72 -0
- package/src/workflows/checkpoint.ts +16 -9
- package/src/workflows/completed-step-routing.ts +31 -0
- package/src/workflows/engine.ts +59 -43
- package/src/workflows/executors/human-in-the-loop.ts +38 -4
- package/src/workflows/executors/raw-llm.ts +8 -6
- package/src/workflows/executors/validate.ts +6 -5
- package/src/workflows/executors/workflow-llm.ts +35 -0
- package/src/workflows/resume.ts +90 -13
- package/src/workflows/retry-poller.ts +8 -1
- package/vendored-openapi/README.md +4 -2
- package/vendored-openapi/manifest.json +33 -0
- package/vendored-openapi/microsoft-graph.json +781 -0
- package/dist/cli-5tnr64pm.js +0 -29
- package/dist/{anthropic-messages-pm7pp23c.js → anthropic-messages-tvgm75yc.js} +3 -3
- package/dist/{azure-openai-responses-cwesc845.js → azure-openai-responses-hed7waek.js} +4 -4
- package/dist/{cli-s9gpxh9q.js → cli-5kmzp1wx.js} +0 -0
- package/dist/{cli-s73zwwqn.js → cli-xjx3fbtn.js} +4 -4
- package/dist/{openai-codex-responses-xxca1qr1.js → openai-codex-responses-gv3n8rg0.js} +3 -3
- package/dist/{openai-completions-yzftqrft.js → openai-completions-dkrj9433.js} +8 -8
- package/dist/{openai-responses-e4dcwm9g.js → openai-responses-spk6t7kh.js} +11 -11
- package/dist/{openrouter-images-asqqnbvh.js → openrouter-images-71hthwh9.js} +3 -3
|
@@ -8,46 +8,16 @@ import {
|
|
|
8
8
|
REFERENCES_SOURCE_MAX_LENGTH,
|
|
9
9
|
sanitizeReferencesSource
|
|
10
10
|
} from "./cli-8p37s71j.js";
|
|
11
|
-
import {
|
|
12
|
-
AGENT_MAX_TASKS_CONFIG_KEY,
|
|
13
|
-
createTrackerAgentMapping,
|
|
14
|
-
createTrackerSync,
|
|
15
|
-
createTrackerSyncIfAbsent,
|
|
16
|
-
createWorkerTaskFollowUp,
|
|
17
|
-
deleteTrackerSync,
|
|
18
|
-
getAllTrackerSyncs,
|
|
19
|
-
getTrackerSync,
|
|
20
|
-
getTrackerSyncByExternalId,
|
|
21
|
-
hasTrackerDelivery,
|
|
22
|
-
markRuntimeInstanceOffline,
|
|
23
|
-
markTrackerDelivery,
|
|
24
|
-
reconcileAgentStatusFromRuntimes,
|
|
25
|
-
repointTrackerSyncBySwarmId,
|
|
26
|
-
resetAgentMaxTasksMirror,
|
|
27
|
-
touchRuntimeInstance,
|
|
28
|
-
updateTrackerSync,
|
|
29
|
-
updateTrackerSyncSwarmId,
|
|
30
|
-
upsertSwarmConfigWithPolicyMirror
|
|
31
|
-
} from "./cli-5bnz1t86.js";
|
|
32
|
-
import {
|
|
33
|
-
isMultiRuntimeEnabled
|
|
34
|
-
} from "./cli-qh4sqfws.js";
|
|
35
|
-
import {
|
|
36
|
-
calculateNextRun,
|
|
37
|
-
ensure,
|
|
38
|
-
require_dist,
|
|
39
|
-
runScheduleNow
|
|
40
|
-
} from "./cli-fpjmcbhz.js";
|
|
41
11
|
import {
|
|
42
12
|
startPricingRefreshLoop
|
|
43
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-47esr8ht.js";
|
|
44
14
|
import {
|
|
45
15
|
seedPricingFromModelsDev
|
|
46
|
-
} from "./cli-
|
|
16
|
+
} from "./cli-s6t1qv67.js";
|
|
47
17
|
import {
|
|
48
18
|
ensureRbacSeedsSynced,
|
|
49
19
|
getUserGrant
|
|
50
|
-
} from "./cli-
|
|
20
|
+
} from "./cli-y294regh.js";
|
|
51
21
|
import {
|
|
52
22
|
can,
|
|
53
23
|
decideAdmission,
|
|
@@ -74,7 +44,41 @@ import {
|
|
|
74
44
|
runSavedScriptAsAgent,
|
|
75
45
|
updateApp,
|
|
76
46
|
upgradeAppDefinition
|
|
77
|
-
} from "./cli-
|
|
47
|
+
} from "./cli-tb4csb08.js";
|
|
48
|
+
import {
|
|
49
|
+
AGENT_MAX_TASKS_CONFIG_KEY,
|
|
50
|
+
createTrackerAgentMapping,
|
|
51
|
+
createTrackerSync,
|
|
52
|
+
createTrackerSyncIfAbsent,
|
|
53
|
+
createWorkerTaskFollowUp,
|
|
54
|
+
deleteTrackerSync,
|
|
55
|
+
getAllTrackerSyncs,
|
|
56
|
+
getTrackerSync,
|
|
57
|
+
getTrackerSyncByExternalId,
|
|
58
|
+
hasTrackerDelivery,
|
|
59
|
+
markRuntimeInstanceOffline,
|
|
60
|
+
markTrackerDelivery,
|
|
61
|
+
reconcileAgentStatusFromRuntimes,
|
|
62
|
+
repointTrackerSyncBySwarmId,
|
|
63
|
+
resetAgentMaxTasksMirror,
|
|
64
|
+
touchRuntimeInstance,
|
|
65
|
+
updateTrackerSync,
|
|
66
|
+
updateTrackerSyncSwarmId,
|
|
67
|
+
upsertSwarmConfigWithPolicyMirror
|
|
68
|
+
} from "./cli-f9skf1v7.js";
|
|
69
|
+
import {
|
|
70
|
+
isMultiRuntimeEnabled
|
|
71
|
+
} from "./cli-qh4sqfws.js";
|
|
72
|
+
import {
|
|
73
|
+
ZodFirstPartyTypeKind,
|
|
74
|
+
objectType
|
|
75
|
+
} from "./cli-fad8m16k.js";
|
|
76
|
+
import {
|
|
77
|
+
calculateNextRun,
|
|
78
|
+
ensure,
|
|
79
|
+
require_dist,
|
|
80
|
+
runScheduleNow
|
|
81
|
+
} from "./cli-ba87cw29.js";
|
|
78
82
|
import {
|
|
79
83
|
TriggerSchemaError,
|
|
80
84
|
applyDefinitionPatch,
|
|
@@ -88,7 +92,7 @@ import {
|
|
|
88
92
|
startWorkflowExecution,
|
|
89
93
|
validateDefinition,
|
|
90
94
|
validateJsonSchema
|
|
91
|
-
} from "./cli-
|
|
95
|
+
} from "./cli-4jaj24py.js";
|
|
92
96
|
import {
|
|
93
97
|
ConnectionAuthInputSchema,
|
|
94
98
|
SCRIPT_LONG_TIMEOUT_HINT_MS,
|
|
@@ -107,7 +111,7 @@ import {
|
|
|
107
111
|
setScriptConnectionEnabled,
|
|
108
112
|
upsertCredentialBinding,
|
|
109
113
|
upsertScriptConnection
|
|
110
|
-
} from "./cli-
|
|
114
|
+
} from "./cli-3719ggyf.js";
|
|
111
115
|
import {
|
|
112
116
|
getApiKey
|
|
113
117
|
} from "./cli-f14fvzag.js";
|
|
@@ -122,7 +126,7 @@ import {
|
|
|
122
126
|
isGraphExpansionEnabled,
|
|
123
127
|
rerank,
|
|
124
128
|
rowToCandidate
|
|
125
|
-
} from "./cli-
|
|
129
|
+
} from "./cli-yh2eybyt.js";
|
|
126
130
|
import {
|
|
127
131
|
buildAuthorizationUrl,
|
|
128
132
|
createOAuthApp,
|
|
@@ -137,11 +141,7 @@ import {
|
|
|
137
141
|
listAuthorizationsForApp,
|
|
138
142
|
onAuthorizationRefreshed,
|
|
139
143
|
upsertOAuthApp
|
|
140
|
-
} from "./cli-
|
|
141
|
-
import {
|
|
142
|
-
ZodFirstPartyTypeKind,
|
|
143
|
-
objectType
|
|
144
|
-
} from "./cli-fad8m16k.js";
|
|
144
|
+
} from "./cli-b4zdc3x6.js";
|
|
145
145
|
import {
|
|
146
146
|
AgentFsProvider
|
|
147
147
|
} from "./cli-fhsz3twr.js";
|
|
@@ -149,7 +149,7 @@ import {
|
|
|
149
149
|
createAdditiveBuffer,
|
|
150
150
|
extractSlackMessageText,
|
|
151
151
|
parseSlackTs
|
|
152
|
-
} from "./cli-
|
|
152
|
+
} from "./cli-qf34ej1d.js";
|
|
153
153
|
import {
|
|
154
154
|
findOrCreateUserByEmail,
|
|
155
155
|
findUserByExternalId,
|
|
@@ -165,10 +165,10 @@ import {
|
|
|
165
165
|
resolveIdentityByEmail,
|
|
166
166
|
resolveUserByToken,
|
|
167
167
|
unlinkIdentity
|
|
168
|
-
} from "./cli-
|
|
168
|
+
} from "./cli-y43043ws.js";
|
|
169
169
|
import {
|
|
170
170
|
createTaskWithSiblingAwareness
|
|
171
|
-
} from "./cli-
|
|
171
|
+
} from "./cli-23cpnqk9.js";
|
|
172
172
|
import {
|
|
173
173
|
getAgentDisplayName,
|
|
174
174
|
getAgentEmoji,
|
|
@@ -177,7 +177,7 @@ import {
|
|
|
177
177
|
markdownToSlack,
|
|
178
178
|
startSlackApp,
|
|
179
179
|
stopSlackApp
|
|
180
|
-
} from "./cli-
|
|
180
|
+
} from "./cli-cywkhzqs.js";
|
|
181
181
|
import {
|
|
182
182
|
$OpenAPIRegistry,
|
|
183
183
|
$OpenApiGeneratorV31,
|
|
@@ -261,6 +261,7 @@ import {
|
|
|
261
261
|
deleteSwarmConfig,
|
|
262
262
|
deleteUser,
|
|
263
263
|
deleteWorkflow,
|
|
264
|
+
emitMcpServerConnectedTelemetry,
|
|
264
265
|
failTask,
|
|
265
266
|
findCompletedTaskInThread,
|
|
266
267
|
findExistingLinearTrackerContextWork,
|
|
@@ -422,7 +423,7 @@ import {
|
|
|
422
423
|
upsertPromptTemplate,
|
|
423
424
|
upsertService,
|
|
424
425
|
validateConfigValue
|
|
425
|
-
} from "./cli-
|
|
426
|
+
} from "./cli-kq9htgbr.js";
|
|
426
427
|
import {
|
|
427
428
|
generateDefaultClaudeMd,
|
|
428
429
|
generateDefaultIdentityMd,
|
|
@@ -454,17 +455,6 @@ import {
|
|
|
454
455
|
exports_zod,
|
|
455
456
|
init_zod
|
|
456
457
|
} from "./cli-s35981d0.js";
|
|
457
|
-
import {
|
|
458
|
-
init_secret_scrubber,
|
|
459
|
-
refreshSecretScrubberCache,
|
|
460
|
-
registerVolatileSecret,
|
|
461
|
-
scrubObject,
|
|
462
|
-
scrubSecrets
|
|
463
|
-
} from "./cli-mkq1rk7b.js";
|
|
464
|
-
import {
|
|
465
|
-
init_package,
|
|
466
|
-
package_default
|
|
467
|
-
} from "./cli-4r4jkqep.js";
|
|
468
458
|
import {
|
|
469
459
|
$ZodObject,
|
|
470
460
|
$ZodType,
|
|
@@ -506,6 +496,17 @@ import {
|
|
|
506
496
|
unknown,
|
|
507
497
|
uuid
|
|
508
498
|
} from "./cli-pqv5gvyf.js";
|
|
499
|
+
import {
|
|
500
|
+
init_package,
|
|
501
|
+
package_default
|
|
502
|
+
} from "./cli-kkn46gfr.js";
|
|
503
|
+
import {
|
|
504
|
+
init_secret_scrubber,
|
|
505
|
+
refreshSecretScrubberCache,
|
|
506
|
+
registerVolatileSecret,
|
|
507
|
+
scrubObject,
|
|
508
|
+
scrubSecrets
|
|
509
|
+
} from "./cli-mkq1rk7b.js";
|
|
509
510
|
import {
|
|
510
511
|
init_event_bus,
|
|
511
512
|
workflowEventBus
|
|
@@ -22956,7 +22957,7 @@ async function notifySlack(text) {
|
|
|
22956
22957
|
return;
|
|
22957
22958
|
}
|
|
22958
22959
|
try {
|
|
22959
|
-
const { getSlackApp: getSlackApp2 } = await import("./app-
|
|
22960
|
+
const { getSlackApp: getSlackApp2 } = await import("./app-wb6bc7tt.js");
|
|
22960
22961
|
const app = getSlackApp2();
|
|
22961
22962
|
if (!app) {
|
|
22962
22963
|
console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
|
|
@@ -23027,7 +23028,7 @@ async function deleteJiraWebhook(webhookId) {
|
|
|
23027
23028
|
console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
|
|
23028
23029
|
}
|
|
23029
23030
|
async function overwriteWebhookIds(next) {
|
|
23030
|
-
const { getDbClient: getDbClient2 } = await import("./db-
|
|
23031
|
+
const { getDbClient: getDbClient2 } = await import("./db-x61ncfa1.js");
|
|
23031
23032
|
await getDbClient2().transaction(async (tx) => {
|
|
23032
23033
|
const row = await tx.get("SELECT metadata FROM oauth_apps WHERE provider = 'jira'");
|
|
23033
23034
|
if (!row) {
|
|
@@ -96703,6 +96704,8 @@ var realWithSpanContext;
|
|
|
96703
96704
|
var realInjectTraceContext;
|
|
96704
96705
|
var realShutdown;
|
|
96705
96706
|
var realRecordSessionCost;
|
|
96707
|
+
var realRecordDbRetentionSweep;
|
|
96708
|
+
var realRecordDbRetentionStatement;
|
|
96706
96709
|
function isPollTracingEnabled() {
|
|
96707
96710
|
const v = (process.env.OTEL_TRACE_POLL ?? "").trim().toLowerCase();
|
|
96708
96711
|
return v === "1" || v === "true" || v === "yes" || v === "on";
|
|
@@ -96712,7 +96715,7 @@ async function initOtel(serviceRole = process.env.AGENT_ROLE || "api") {
|
|
|
96712
96715
|
return;
|
|
96713
96716
|
initialized6 = true;
|
|
96714
96717
|
try {
|
|
96715
|
-
const impl = await import("./otel-impl-
|
|
96718
|
+
const impl = await import("./otel-impl-k47aj4sd.js");
|
|
96716
96719
|
await impl.boot(serviceRole);
|
|
96717
96720
|
realWithSpan = impl.withSpan;
|
|
96718
96721
|
realStartSpan = impl.startSpan;
|
|
@@ -96721,6 +96724,8 @@ async function initOtel(serviceRole = process.env.AGENT_ROLE || "api") {
|
|
|
96721
96724
|
realInjectTraceContext = impl.injectTraceContext;
|
|
96722
96725
|
realShutdown = impl.shutdown;
|
|
96723
96726
|
realRecordSessionCost = impl.recordSessionCost;
|
|
96727
|
+
realRecordDbRetentionSweep = impl.recordDbRetentionSweep;
|
|
96728
|
+
realRecordDbRetentionStatement = impl.recordDbRetentionStatement;
|
|
96724
96729
|
console.log(`[OTel] enabled for ${impl.resolveServiceName(serviceRole)} (${serviceRole})`);
|
|
96725
96730
|
} catch (error) {
|
|
96726
96731
|
console.warn(`[OTel] disabled after initialization failure: ${error}`);
|
|
@@ -96761,6 +96766,16 @@ function recordSessionCost(m) {
|
|
|
96761
96766
|
return;
|
|
96762
96767
|
realRecordSessionCost(m);
|
|
96763
96768
|
}
|
|
96769
|
+
function recordDbRetentionSweep(m) {
|
|
96770
|
+
if (!otelConfigured() || !realRecordDbRetentionSweep)
|
|
96771
|
+
return;
|
|
96772
|
+
realRecordDbRetentionSweep(m);
|
|
96773
|
+
}
|
|
96774
|
+
function recordDbRetentionStatement(table, dryRun, durationMs) {
|
|
96775
|
+
if (!otelConfigured() || !realRecordDbRetentionStatement)
|
|
96776
|
+
return;
|
|
96777
|
+
realRecordDbRetentionStatement(table, dryRun, durationMs);
|
|
96778
|
+
}
|
|
96764
96779
|
|
|
96765
96780
|
// src/tools/utils.ts
|
|
96766
96781
|
init_secret_scrubber();
|
|
@@ -101464,7 +101479,8 @@ var looseRoutingAffinitySchema = looseObject({
|
|
|
101464
101479
|
sourceAgentId: string().optional(),
|
|
101465
101480
|
role: string().optional(),
|
|
101466
101481
|
harnessProvider: string().optional(),
|
|
101467
|
-
capabilities: array(string()).optional()
|
|
101482
|
+
capabilities: array(string()).optional(),
|
|
101483
|
+
leadOnly: boolean().optional()
|
|
101468
101484
|
});
|
|
101469
101485
|
var looseAgentTaskOutputSchema = looseObject({
|
|
101470
101486
|
id: string().optional(),
|
|
@@ -102645,6 +102661,35 @@ var OAUTH_PRESETS = [
|
|
|
102645
102661
|
"Notion has no OAuth scopes; capability is configured on the integration in Notion's developer settings.",
|
|
102646
102662
|
"owner=user is required to receive a user-scoped token and is set here."
|
|
102647
102663
|
]
|
|
102664
|
+
},
|
|
102665
|
+
{
|
|
102666
|
+
id: "microsoft",
|
|
102667
|
+
displayName: "Microsoft 365 (Graph)",
|
|
102668
|
+
provider: "microsoft",
|
|
102669
|
+
authorizeUrl: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
|
|
102670
|
+
tokenUrl: "https://login.microsoftonline.com/common/oauth2/v2.0/token",
|
|
102671
|
+
scopes: [
|
|
102672
|
+
"openid",
|
|
102673
|
+
"profile",
|
|
102674
|
+
"offline_access",
|
|
102675
|
+
"User.Read",
|
|
102676
|
+
"User.ReadBasic.All",
|
|
102677
|
+
"Channel.ReadBasic.All",
|
|
102678
|
+
"ChannelMessage.Read.All",
|
|
102679
|
+
"ChannelMessage.Send",
|
|
102680
|
+
"Chat.ReadWrite",
|
|
102681
|
+
"Mail.Read",
|
|
102682
|
+
"Mail.Send",
|
|
102683
|
+
"Files.Read"
|
|
102684
|
+
],
|
|
102685
|
+
scopeSeparator: " ",
|
|
102686
|
+
tokenAuthStyle: "body",
|
|
102687
|
+
tokenBodyFormat: "form",
|
|
102688
|
+
setupHints: [
|
|
102689
|
+
"Single-tenant apps must replace the common tenant segment in authorizeUrl and tokenUrl with their Microsoft Entra tenant ID by using the endpoint overrides.",
|
|
102690
|
+
"offline_access is required for Microsoft Entra to issue a refresh token and is included in this preset.",
|
|
102691
|
+
"An administrator may need to grant tenant-wide consent for the Teams read scopes before users can authorize the connection."
|
|
102692
|
+
]
|
|
102648
102693
|
}
|
|
102649
102694
|
];
|
|
102650
102695
|
function listOAuthPresets() {
|
|
@@ -104454,6 +104499,7 @@ var registerMcpServerCreateTool = (server) => {
|
|
|
104454
104499
|
headerConfigKeys: args.headerConfigKeys,
|
|
104455
104500
|
extraAuthorizeParams: args.extraAuthorizeParams
|
|
104456
104501
|
});
|
|
104502
|
+
await emitMcpServerConnectedTelemetry();
|
|
104457
104503
|
await installMcpServer(requestInfo.agentId, created.id);
|
|
104458
104504
|
return toolOk(`Created and installed MCP server "${created.name}" (${created.id}).`, {
|
|
104459
104505
|
data: { yourAgentId: requestInfo.agentId, server: created }
|
|
@@ -105214,6 +105260,29 @@ async function getLinksForMemory(memoryId, options = {}) {
|
|
|
105214
105260
|
|
|
105215
105261
|
// src/be/memory/raters/retrieval.ts
|
|
105216
105262
|
init_db();
|
|
105263
|
+
function dedupeMemoryDocumentIds(memories) {
|
|
105264
|
+
const documents = new Map;
|
|
105265
|
+
for (const memory of memories) {
|
|
105266
|
+
const identity = memory.sourcePath ?? memory.key;
|
|
105267
|
+
if (identity == null)
|
|
105268
|
+
continue;
|
|
105269
|
+
const documentKey = JSON.stringify([memory.agentId, memory.scope, identity]);
|
|
105270
|
+
if (!documents.has(documentKey))
|
|
105271
|
+
documents.set(documentKey, memory.id);
|
|
105272
|
+
}
|
|
105273
|
+
return [...documents.values()];
|
|
105274
|
+
}
|
|
105275
|
+
async function recordMemoryAccesses(memoryIds) {
|
|
105276
|
+
const ids = [...new Set(memoryIds)].filter(Boolean);
|
|
105277
|
+
if (ids.length === 0)
|
|
105278
|
+
return;
|
|
105279
|
+
const now = new Date().toISOString();
|
|
105280
|
+
await getDbClient().transaction(async (tx) => {
|
|
105281
|
+
for (const id of ids) {
|
|
105282
|
+
await tx.run("UPDATE agent_memory SET accessedAt = ?, accessCount = accessCount + 1 WHERE id = ?", [now, id]);
|
|
105283
|
+
}
|
|
105284
|
+
});
|
|
105285
|
+
}
|
|
105217
105286
|
async function recordRetrievals(taskId, agentId, results, sessionId, extras) {
|
|
105218
105287
|
if (!taskId || results.length === 0)
|
|
105219
105288
|
return;
|
|
@@ -105578,6 +105647,7 @@ var memorySearchOutputSchema = swarmToolOutputSchema({
|
|
|
105578
105647
|
retrievalSource: _enum(["vec", "fts", "hybrid", "fallback", "graph"]).optional(),
|
|
105579
105648
|
tags: array(string()).optional(),
|
|
105580
105649
|
createdAt: string().optional(),
|
|
105650
|
+
accessCount: number().int().optional(),
|
|
105581
105651
|
rateHint: string().optional()
|
|
105582
105652
|
})).optional()
|
|
105583
105653
|
});
|
|
@@ -105585,7 +105655,7 @@ var registerMemorySearchTool = (server) => {
|
|
|
105585
105655
|
createToolRegistrar(server)("memory-search", {
|
|
105586
105656
|
title: "Search memories",
|
|
105587
105657
|
description: "Search your accumulated memories using natural language. Returns summaries with IDs — use memory-get to retrieve full content.",
|
|
105588
|
-
annotations: { readOnlyHint:
|
|
105658
|
+
annotations: { readOnlyHint: false },
|
|
105589
105659
|
inputSchema: object({
|
|
105590
105660
|
query: string().min(1).describe("Natural language search query."),
|
|
105591
105661
|
intent: string().min(1).describe("Why you are searching for this memory. Required. E.g. 'looking for auth pattern to fix login bug'."),
|
|
@@ -105629,6 +105699,13 @@ var registerMemorySearchTool = (server) => {
|
|
|
105629
105699
|
console.error("[memory-search] recordRetrievals failed:", err.message);
|
|
105630
105700
|
}
|
|
105631
105701
|
}
|
|
105702
|
+
const consumedIds2 = dedupeMemoryDocumentIds(ranked);
|
|
105703
|
+
try {
|
|
105704
|
+
await recordMemoryAccesses(consumedIds2);
|
|
105705
|
+
} catch (err) {
|
|
105706
|
+
console.error("[memory-search] recordMemoryAccesses failed:", err.message);
|
|
105707
|
+
}
|
|
105708
|
+
const consumedIdSet2 = new Set(consumedIds2);
|
|
105632
105709
|
const inTaskContext = !!requestInfo.sourceTaskId;
|
|
105633
105710
|
const mapped2 = ranked.map((r) => ({
|
|
105634
105711
|
id: r.id,
|
|
@@ -105640,6 +105717,7 @@ var registerMemorySearchTool = (server) => {
|
|
|
105640
105717
|
retrievalSource: r.retrievalSource,
|
|
105641
105718
|
tags: r.tags,
|
|
105642
105719
|
createdAt: r.createdAt,
|
|
105720
|
+
accessCount: (r.accessCount ?? 0) + (consumedIdSet2.has(r.id) ? 1 : 0),
|
|
105643
105721
|
...inTaskContext && NUDGE_ELIGIBLE_SOURCES2.has(r.source) ? { rateHint: rateHintFor(r.id) } : {}
|
|
105644
105722
|
}));
|
|
105645
105723
|
return toolOk(`Found ${mapped2.length} memories matching "${query}".`, {
|
|
@@ -105653,6 +105731,13 @@ var registerMemorySearchTool = (server) => {
|
|
|
105653
105731
|
isLead,
|
|
105654
105732
|
source
|
|
105655
105733
|
});
|
|
105734
|
+
const consumedIds = dedupeMemoryDocumentIds(recent);
|
|
105735
|
+
try {
|
|
105736
|
+
await recordMemoryAccesses(consumedIds);
|
|
105737
|
+
} catch (err) {
|
|
105738
|
+
console.error("[memory-search] recordMemoryAccesses failed:", err.message);
|
|
105739
|
+
}
|
|
105740
|
+
const consumedIdSet = new Set(consumedIds);
|
|
105656
105741
|
const mapped = recent.map((r) => ({
|
|
105657
105742
|
id: r.id,
|
|
105658
105743
|
name: r.name,
|
|
@@ -105660,7 +105745,8 @@ var registerMemorySearchTool = (server) => {
|
|
|
105660
105745
|
source: r.source,
|
|
105661
105746
|
scope: r.scope,
|
|
105662
105747
|
tags: r.tags,
|
|
105663
|
-
createdAt: r.createdAt
|
|
105748
|
+
createdAt: r.createdAt,
|
|
105749
|
+
accessCount: (r.accessCount ?? 0) + (consumedIdSet.has(r.id) ? 1 : 0)
|
|
105664
105750
|
}));
|
|
105665
105751
|
return toolOk(`Embedding unavailable (no OPENAI_API_KEY). Showing ${mapped.length} most recent memories.`, {
|
|
105666
105752
|
details: renderResults(mapped),
|
|
@@ -109586,7 +109672,8 @@ var sendTaskInputSchema = object({
|
|
|
109586
109672
|
offerMode: boolean().default(false).describe("If true, offer the task instead of direct assign (agent must accept/reject)."),
|
|
109587
109673
|
taskType: string().max(50).optional().describe("Task type (e.g., 'bug', 'feature', 'review')."),
|
|
109588
109674
|
tags: array(string()).optional().describe("Tags for filtering (e.g., ['urgent', 'frontend'])."),
|
|
109589
|
-
requiredCapabilities: array(string()).optional().describe("Capabilities
|
|
109675
|
+
requiredCapabilities: array(string()).optional().describe("Capabilities required for pool routing."),
|
|
109676
|
+
leadOnly: boolean().default(false).describe("Structured authorization constraint for merge or other privileged work. Only Lead agents may be assigned, offered, or claim it; never inferred from task text."),
|
|
109590
109677
|
priority: number().int().min(0).max(100).optional().describe("Priority 0-100 (default: 50)."),
|
|
109591
109678
|
dependsOn: array(uuid()).optional().describe("Task IDs this task depends on."),
|
|
109592
109679
|
parentTaskId: uuid().optional().describe("Parent task ID for session continuity. Child task will resume the parent's Claude session. Auto-routes to the same worker unless agentId is explicitly provided."),
|
|
@@ -109642,6 +109729,7 @@ async function sendTaskHandler(ctx, {
|
|
|
109642
109729
|
taskType,
|
|
109643
109730
|
tags,
|
|
109644
109731
|
requiredCapabilities,
|
|
109732
|
+
leadOnly,
|
|
109645
109733
|
priority,
|
|
109646
109734
|
dependsOn,
|
|
109647
109735
|
dir,
|
|
@@ -109675,6 +109763,12 @@ async function sendTaskHandler(ctx, {
|
|
|
109675
109763
|
const normalizedModel = splitLegacyModelAlias({ model, modelTier });
|
|
109676
109764
|
const effectiveParentTaskId = parentTaskId ?? sourceTaskId;
|
|
109677
109765
|
const effectiveParentTask = effectiveParentTaskId ? await getTaskById(effectiveParentTaskId) : null;
|
|
109766
|
+
if (effectiveParentTask?.routingAffinityInvalid) {
|
|
109767
|
+
return toolErr("Cannot continue a task with an invalid routing affinity.", {
|
|
109768
|
+
data: { yourAgentId: creatorAgentId }
|
|
109769
|
+
});
|
|
109770
|
+
}
|
|
109771
|
+
const effectiveLeadOnly = leadOnly || effectiveParentTask?.routingAffinity?.leadOnly === true;
|
|
109678
109772
|
if (!overrideSlackContext) {
|
|
109679
109773
|
const inheritedContextKey = effectiveParentTask?.contextKey;
|
|
109680
109774
|
const routingCheck = checkSlackRoutingCoherence({
|
|
@@ -109776,7 +109870,7 @@ async function sendTaskHandler(ctx, {
|
|
|
109776
109870
|
slackUserId,
|
|
109777
109871
|
overrideSlackContext,
|
|
109778
109872
|
followUpConfig,
|
|
109779
|
-
routingAffinity: requiredCapabilities?.length ? { capabilities: requiredCapabilities } : undefined
|
|
109873
|
+
routingAffinity: effectiveLeadOnly || requiredCapabilities?.length ? { leadOnly: effectiveLeadOnly, capabilities: requiredCapabilities ?? [] } : undefined
|
|
109780
109874
|
});
|
|
109781
109875
|
await transferTrackerSyncToResumeChild({
|
|
109782
109876
|
parentTaskId: effectiveParentTaskId,
|
|
@@ -109796,10 +109890,10 @@ async function sendTaskHandler(ctx, {
|
|
|
109796
109890
|
message: `Agent with ID "${effectiveAgentId}" not found.`
|
|
109797
109891
|
};
|
|
109798
109892
|
}
|
|
109799
|
-
if (agent.isLead) {
|
|
109893
|
+
if (effectiveLeadOnly && !agent.isLead) {
|
|
109800
109894
|
return {
|
|
109801
109895
|
success: false,
|
|
109802
|
-
message: `
|
|
109896
|
+
message: `Lead-only task requires a Lead agent; "${agent.name}" is not a Lead.`
|
|
109803
109897
|
};
|
|
109804
109898
|
}
|
|
109805
109899
|
if (!offerMode && !await hasCapacity(effectiveAgentId)) {
|
|
@@ -109830,7 +109924,8 @@ async function sendTaskHandler(ctx, {
|
|
|
109830
109924
|
slackThreadTs,
|
|
109831
109925
|
slackUserId,
|
|
109832
109926
|
overrideSlackContext,
|
|
109833
|
-
followUpConfig
|
|
109927
|
+
followUpConfig,
|
|
109928
|
+
routingAffinity: effectiveLeadOnly || requiredCapabilities?.length ? { leadOnly: effectiveLeadOnly, capabilities: requiredCapabilities ?? [] } : undefined
|
|
109834
109929
|
});
|
|
109835
109930
|
await transferTrackerSyncToResumeChild({
|
|
109836
109931
|
parentTaskId: effectiveParentTaskId,
|
|
@@ -109863,7 +109958,8 @@ async function sendTaskHandler(ctx, {
|
|
|
109863
109958
|
slackThreadTs,
|
|
109864
109959
|
slackUserId,
|
|
109865
109960
|
overrideSlackContext,
|
|
109866
|
-
followUpConfig
|
|
109961
|
+
followUpConfig,
|
|
109962
|
+
routingAffinity: effectiveLeadOnly || requiredCapabilities?.length ? { leadOnly: effectiveLeadOnly, capabilities: requiredCapabilities ?? [] } : undefined
|
|
109867
109963
|
});
|
|
109868
109964
|
await transferTrackerSyncToResumeChild({
|
|
109869
109965
|
parentTaskId: effectiveParentTaskId,
|
|
@@ -113368,7 +113464,8 @@ var taskActionInputSchema = object({
|
|
|
113368
113464
|
model: string().trim().min(1).optional().describe("Concrete model override for the created task, interpreted by the claiming worker's harness/provider. This does not switch providers. Only used with 'create' action."),
|
|
113369
113465
|
modelTier: ModelTierSchema.optional().describe("Portable model tier for the created task: 'smol', 'regular', 'smart', or 'ultra'. Resolved when a worker claims/runs the task. Only used with 'create' action."),
|
|
113370
113466
|
effort: ReasoningEffortSchema.optional().describe("Reasoning effort for the created task: 'off', 'low', 'medium', 'high', 'xhigh', or 'max'. Only used with 'create' action."),
|
|
113371
|
-
requiredCapabilities: array(string()).optional().describe("Capabilities
|
|
113467
|
+
requiredCapabilities: array(string()).optional().describe("Capabilities required for pool routing."),
|
|
113468
|
+
leadOnly: boolean().default(false).describe("Structured authorization constraint: only Lead agents may claim this privileged task.")
|
|
113372
113469
|
});
|
|
113373
113470
|
var taskActionOutputSchema = swarmToolOutputSchema({
|
|
113374
113471
|
yourAgentId: string().optional(),
|
|
@@ -113418,7 +113515,8 @@ async function taskActionHandler(ctx, input) {
|
|
|
113418
113515
|
reason,
|
|
113419
113516
|
dir,
|
|
113420
113517
|
model,
|
|
113421
|
-
requiredCapabilities
|
|
113518
|
+
requiredCapabilities,
|
|
113519
|
+
leadOnly
|
|
113422
113520
|
} = input;
|
|
113423
113521
|
const normalizedModel = splitLegacyModelAlias({ model, modelTier: input.modelTier });
|
|
113424
113522
|
if (ctx.kind === "user") {
|
|
@@ -113504,7 +113602,7 @@ async function taskActionHandler(ctx, input) {
|
|
|
113504
113602
|
model: normalizedModel.model,
|
|
113505
113603
|
modelTier: normalizedModel.modelTier,
|
|
113506
113604
|
effort: input.effort,
|
|
113507
|
-
routingAffinity: requiredCapabilities?.length ? { capabilities: requiredCapabilities } : undefined
|
|
113605
|
+
routingAffinity: leadOnly || requiredCapabilities?.length ? { leadOnly, capabilities: requiredCapabilities ?? [] } : undefined
|
|
113508
113606
|
});
|
|
113509
113607
|
return {
|
|
113510
113608
|
success: true,
|
|
@@ -113548,7 +113646,7 @@ async function taskActionHandler(ctx, input) {
|
|
|
113548
113646
|
if (claimingAgent && !isAgentEligibleForTask(claimingAgent, existingTask)) {
|
|
113549
113647
|
return {
|
|
113550
113648
|
success: false,
|
|
113551
|
-
message: `Task "${taskId}" requires role "${existingTask.routingAffinity?.role ?? "(unspecified)"}"; yours is "${claimingAgent.role ?? "(unspecified)"}". Cannot claim.`
|
|
113649
|
+
message: existingTask.routingAffinity?.leadOnly ? `Task "${taskId}" is Lead-only; you are not authorized to claim it.` : `Task "${taskId}" requires role "${existingTask.routingAffinity?.role ?? "(unspecified)"}"; yours is "${claimingAgent.role ?? "(unspecified)"}". Cannot claim.`
|
|
113552
113650
|
};
|
|
113553
113651
|
}
|
|
113554
113652
|
const claimedTask = await claimTask(taskId, agentId);
|
|
@@ -115349,6 +115447,38 @@ async function createServer(opts = {}) {
|
|
|
115349
115447
|
return server;
|
|
115350
115448
|
}
|
|
115351
115449
|
|
|
115450
|
+
// src/prompts/memories.ts
|
|
115451
|
+
var SIMILARITY_THRESHOLD = 0.4;
|
|
115452
|
+
var RATE_TOOL_HINT = `
|
|
115453
|
+
|
|
115454
|
+
When a memory above genuinely helps you solve this task — or actively
|
|
115455
|
+
misleads you — call \`memory_rate\` with the memory id and useful=true/false.
|
|
115456
|
+
This trains the swarm to surface better memories next time. Use sparingly:
|
|
115457
|
+
2-5 ratings per task is plenty.`;
|
|
115458
|
+
function renderMemoriesPrompt(memories) {
|
|
115459
|
+
const useful = memories.filter((m) => m.similarity > SIMILARITY_THRESHOLD);
|
|
115460
|
+
if (useful.length === 0)
|
|
115461
|
+
return null;
|
|
115462
|
+
const memoryContext = useful.map((m) => `- **${m.name}** (id: ${m.id}): ${m.content.substring(0, 300)}`).join(`
|
|
115463
|
+
`);
|
|
115464
|
+
let prompt = `
|
|
115465
|
+
|
|
115466
|
+
### Relevant Past Knowledge
|
|
115467
|
+
|
|
115468
|
+
These memories from your previous sessions may be useful. Use \`memory-get\` with the memory ID to retrieve full details.
|
|
115469
|
+
|
|
115470
|
+
${memoryContext}
|
|
115471
|
+
`;
|
|
115472
|
+
if (isExplicitSelfRaterEnabled()) {
|
|
115473
|
+
prompt += RATE_TOOL_HINT;
|
|
115474
|
+
}
|
|
115475
|
+
return prompt;
|
|
115476
|
+
}
|
|
115477
|
+
function isExplicitSelfRaterEnabled() {
|
|
115478
|
+
const ratersEnabled = (process.env.MEMORY_RATERS ?? "").split(",").map((s) => s.trim()).filter(Boolean);
|
|
115479
|
+
return ratersEnabled.includes("explicit-self");
|
|
115480
|
+
}
|
|
115481
|
+
|
|
115352
115482
|
// src/utils/skill-fs-writer.ts
|
|
115353
115483
|
import { existsSync, mkdirSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
115354
115484
|
import { dirname as dirname2, join as join3 } from "node:path";
|
|
@@ -115488,4 +115618,4 @@ function writeSkillsToFilesystem(entries, harnessType = "all", home) {
|
|
|
115488
115618
|
return { synced, removed, errors };
|
|
115489
115619
|
}
|
|
115490
115620
|
|
|
115491
|
-
export { safeParseAsync2 as safeParseAsync, normalizeObjectSchema, getParseErrorMessage, DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, McpServer, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2 as handleIssue1, handleNote, handlePipeline, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, registerJiraWebhook, deleteJiraWebhook, isJiraEnabled, initJira, handleJiraWebhook, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, isLinearEnabled, initLinear, setCorsHeaders, parseQueryParams, getPathSegments, wireHttpSpanLifecycle, safeRequestUrlForLog, agentWithCapacity, parseBody, BODY_TOO_LARGE, enforceContentLengthCap, json, jsonError, triggerSchemaErrorResponse, deriveApiBaseUrl, httpServerSemconvAttributes, runtimeInstanceHeader, describeRequestRoute, route, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, mcpOverflowAuthError, isPollTracingEnabled, initOtel, withSpan, startSpan, withSpanContext, withRemoteContext, injectTraceContext, recordSessionCost, markScriptSdkRequestOrigin, toolErr, createToolRegistrar, userCtx, resolveTaskAuditUserId, resolveHttpAuditUserId, resolveHttpFavoriteOwner, handleApps, getUserCommsPrefs, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, executeReadOnlyQuery, assertSelectOnlyQuery, handleDbQuery, snapshotMetric, AssetKeyAuthorizationError, authorizeAssetKeyWrite, snapshotPage, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, scopedResourceScopeIdSchema, resolveScopedResourceId, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, reservedNamespaceError, refreshLinks, canReadMemory, getLinksForMemory, recordRetrievals, expandCandidatesWithGraph, indexMemoryContent, markKapsoMessageRead, sendKapsoReaction, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, mergeScheduleTiming, validateRecurringTiming, sendTaskOutputSchema, sendTaskHandler, parseSkillContent, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, ExplicitSelfDuplicateError, applyRating, shouldPersistAutomaticTaskMemory, guardTerminalTaskResultWrite, canClaim, emitBudgetRefusalSideEffects, taskActionInputSchema, taskActionOutputSchema, taskActionHandler, patchWorkflowDefinition, resolveScriptsOnlyMode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer, writeSkillsToFilesystem };
|
|
115621
|
+
export { safeParseAsync2 as safeParseAsync, normalizeObjectSchema, getParseErrorMessage, DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, McpServer, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2 as handleIssue1, handleNote, handlePipeline, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, registerJiraWebhook, deleteJiraWebhook, isJiraEnabled, initJira, handleJiraWebhook, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, isLinearEnabled, initLinear, setCorsHeaders, parseQueryParams, getPathSegments, wireHttpSpanLifecycle, safeRequestUrlForLog, agentWithCapacity, parseBody, BODY_TOO_LARGE, enforceContentLengthCap, json, jsonError, triggerSchemaErrorResponse, deriveApiBaseUrl, httpServerSemconvAttributes, runtimeInstanceHeader, describeRequestRoute, route, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, mcpOverflowAuthError, isPollTracingEnabled, initOtel, withSpan, startSpan, withSpanContext, withRemoteContext, injectTraceContext, recordSessionCost, recordDbRetentionSweep, recordDbRetentionStatement, markScriptSdkRequestOrigin, toolErr, createToolRegistrar, userCtx, resolveTaskAuditUserId, resolveHttpAuditUserId, resolveHttpFavoriteOwner, handleApps, getUserCommsPrefs, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, executeReadOnlyQuery, assertSelectOnlyQuery, handleDbQuery, snapshotMetric, AssetKeyAuthorizationError, authorizeAssetKeyWrite, snapshotPage, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, scopedResourceScopeIdSchema, resolveScopedResourceId, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, reservedNamespaceError, refreshLinks, canReadMemory, getLinksForMemory, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, expandCandidatesWithGraph, indexMemoryContent, markKapsoMessageRead, sendKapsoReaction, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, mergeScheduleTiming, validateRecurringTiming, sendTaskOutputSchema, sendTaskHandler, parseSkillContent, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, ExplicitSelfDuplicateError, applyRating, shouldPersistAutomaticTaskMemory, guardTerminalTaskResultWrite, canClaim, emitBudgetRefusalSideEffects, taskActionInputSchema, taskActionOutputSchema, taskActionHandler, patchWorkflowDefinition, resolveScriptsOnlyMode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer, SIMILARITY_THRESHOLD, renderMemoriesPrompt, writeSkillsToFilesystem };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAdditiveBuffer,
|
|
3
3
|
extractSlackMessageText
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-qf34ej1d.js";
|
|
5
5
|
import {
|
|
6
6
|
rewriteSlackMentions
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-vy48y9bx.js";
|
|
8
8
|
import {
|
|
9
9
|
createTaskWithSiblingAwareness
|
|
10
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-23cpnqk9.js";
|
|
11
11
|
import {
|
|
12
12
|
buildBufferFlushBlocks,
|
|
13
13
|
ensureSlackThreadTree,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
getSlackApp,
|
|
17
17
|
isSlackRenderV2Enabled,
|
|
18
18
|
registerTreeMessage
|
|
19
|
-
} from "./cli-
|
|
19
|
+
} from "./cli-cywkhzqs.js";
|
|
20
20
|
import {
|
|
21
21
|
createLogEntry,
|
|
22
22
|
getAgentById,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
init_steering,
|
|
30
30
|
requestSteering,
|
|
31
31
|
slackContextKey
|
|
32
|
-
} from "./cli-
|
|
32
|
+
} from "./cli-kq9htgbr.js";
|
|
33
33
|
import {
|
|
34
34
|
init_registry,
|
|
35
35
|
init_steering_enabled,
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
getExecutorRegistry,
|
|
3
3
|
handleScheduleTrigger,
|
|
4
4
|
startWorkflowExecution
|
|
5
|
-
} from "./cli-
|
|
5
|
+
} from "./cli-4jaj24py.js";
|
|
6
6
|
import {
|
|
7
7
|
buildScriptCredentialBindings,
|
|
8
8
|
getScript,
|
|
9
9
|
getScriptApiConnectionDescriptors,
|
|
10
10
|
getScriptMcpConnectionDescriptors,
|
|
11
11
|
runScript
|
|
12
|
-
} from "./cli-
|
|
12
|
+
} from "./cli-3719ggyf.js";
|
|
13
13
|
import {
|
|
14
14
|
createTaskWithSiblingAwareness
|
|
15
|
-
} from "./cli-
|
|
15
|
+
} from "./cli-23cpnqk9.js";
|
|
16
16
|
import {
|
|
17
17
|
getDbClient,
|
|
18
18
|
getDueScheduledTasks,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
scheduleContextKey,
|
|
26
26
|
telemetry,
|
|
27
27
|
updateScheduledTask
|
|
28
|
-
} from "./cli-
|
|
28
|
+
} from "./cli-kq9htgbr.js";
|
|
29
29
|
import {
|
|
30
30
|
__commonJS,
|
|
31
31
|
__require,
|