@desplega.ai/agent-swarm 1.155.0 → 1.156.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/dist/{acp-adapter-wr8k9emt.js → acp-adapter-c1msptrw.js} +1 -1
- package/dist/{actions-fn65prvt.js → actions-wd41qtdc.js} +19 -18
- package/dist/{app-xxzqxp84.js → app-tz2qrnah.js} +7 -6
- package/dist/{assistant-y3mvz5hd.js → assistant-c3q1zj2t.js} +20 -19
- package/dist/{boot-reembed-mma39mkx.js → boot-reembed-0be1krkm.js} +9 -8
- package/dist/{boot-reembed-a52cz5xy.js → boot-reembed-r00j03f3.js} +8 -7
- package/dist/{boot-scrub-logs-88xcdng4.js → boot-scrub-logs-9j4hd0vw.js} +6 -5
- package/dist/{claude-adapter-6zp26gwf.js → claude-adapter-112w28qc.js} +11 -10
- package/dist/{claude-managed-setup-f5pmsyrp.js → claude-managed-setup-60g8aazx.js} +3 -1
- package/dist/{claude-sdk-session-ze81m2c1.js → claude-sdk-session-k7pb5kfz.js} +11 -10
- package/dist/{cli-nw6z69ye.js → cli-005pze6s.js} +1 -1
- package/dist/{cli-1n7d9wac.js → cli-08n8jxcw.js} +6 -4
- package/dist/{cli-3bh2bbga.js → cli-24w39x6n.js} +203 -26
- package/dist/{cli-jbzfb1np.js → cli-28wkjpdp.js} +2 -2
- package/dist/{cli-6265kmdz.js → cli-3gmcwfyx.js} +1 -1
- package/dist/{cli-4mwfhwwc.js → cli-7j2098n5.js} +2 -2
- package/dist/{cli-3361cns4.js → cli-7pgcpcrg.js} +1 -1
- package/dist/{cli-52r0n5f8.js → cli-7vj52450.js} +149 -64
- package/dist/{cli-qxmjs2tx.js → cli-865swy5p.js} +1 -1
- package/dist/{cli-y6m789kb.js → cli-90x9ewbz.js} +1 -1
- package/dist/{cli-08rnbjhh.js → cli-9pyah9c4.js} +118 -34
- package/dist/{cli-aa3m1yxe.js → cli-9w4ex8vh.js} +2 -2
- package/dist/{cli-e2fmyxrc.js → cli-b05d7szr.js} +5 -5
- package/dist/cli-cqt19wg6.js +92 -0
- package/dist/{cli-nmh0gdph.js → cli-cw9zck8j.js} +1 -1
- package/dist/{cli-dnpg5yrw.js → cli-ggm92wcn.js} +4 -4
- package/dist/{cli-fb79s4p1.js → cli-h0wdadsx.js} +2 -0
- package/dist/{cli-4jgxek08.js → cli-hc2fkhdv.js} +2 -2
- package/dist/{cli-fdtv576r.js → cli-jk26c1sz.js} +1 -1
- package/dist/{cli-chas5sza.js → cli-mx3bzbv8.js} +4 -4
- package/dist/{cli-cbm9ftfn.js → cli-n6zq3kbd.js} +1 -1
- package/dist/{cli-1fypa20m.js → cli-nbp6m6gp.js} +2 -2
- package/dist/{cli-085v29fc.js → cli-nyqza443.js} +4 -4
- package/dist/{cli-zf8pjpgb.js → cli-s8hpxeg4.js} +3 -3
- package/dist/{cli-hrgw5qfp.js → cli-szcyv1mm.js} +1 -1
- package/dist/{cli-1chr8hz0.js → cli-t1cd3mhp.js} +1 -1
- package/dist/{cli-798byan3.js → cli-tjmghmm5.js} +1 -1
- package/dist/{cli-s7zv7xdf.js → cli-tp0d7vzb.js} +5 -5
- package/dist/{cli-mnmh7mj3.js → cli-tt9k8r35.js} +1 -1
- package/dist/{cli-e7d20cty.js → cli-vhjwh6cz.js} +26 -6
- package/dist/{cli-tj253fr8.js → cli-xa4j64zh.js} +6 -6
- package/dist/{cli-6yegpc3a.js → cli-y8bfxjtw.js} +24 -20
- package/dist/{cli-dnp8dq8y.js → cli-y95wp3tg.js} +1 -1
- package/dist/cli.js +14 -14
- package/dist/{codex-adapter-cfgvs1qf.js → codex-adapter-g4tj1f2g.js} +6 -5
- package/dist/{codex-hook-afd466wk.js → codex-hook-9hptmdhj.js} +2 -2
- package/dist/{codex-login-vx7ghkzj.js → codex-login-x3jk4etn.js} +9 -7
- package/dist/{codex-session-runner-e7yz0j6n.js → codex-session-runner-ad8ha7zt.js} +6 -5
- package/dist/{commands-b3z94mtk.js → commands-z3gd8ppc.js} +6 -5
- package/dist/{db-v3bjpzv8.js → db-bezm97r9.js} +20 -5
- package/dist/{dispatcher-vnbkay7r.js → dispatcher-a97hc33y.js} +18 -17
- package/dist/{dsh-adapter-k0twh6xp.js → dsh-adapter-1dwg97zv.js} +2 -2
- package/dist/{handlers-1rh14gcx.js → handlers-wtdy1x02.js} +21 -20
- package/dist/{hook-75jr7mpw.js → hook-7edgmzng.js} +9 -8
- package/dist/{hook-7e7p62af.js → hook-fvs58a5b.js} +10 -9
- package/dist/{http-v8jp8dm9.js → http-phnf93hp.js} +9768 -8292
- package/dist/{index-2kqjb29c.js → index-1fktvwxc.js} +13 -12
- package/dist/{index-5j3q4qzr.js → index-50jxgw0d.js} +18 -17
- package/dist/{index-garnqc85.js → index-7jwk7nsm.js} +19 -18
- package/dist/{index-ma6jdv7m.js → index-7x131mmf.js} +18 -17
- package/dist/{index-gx3qt7sy.js → index-yp8rasxk.js} +8 -7
- package/dist/{keepalive-q593kbap.js → keepalive-nnz07ebd.js} +8 -7
- package/dist/{lead-xm2q0s04.js → lead-mg7qcgww.js} +27 -26
- package/dist/{maintenance-j8kgn90c.js → maintenance-ywmnqrpx.js} +9 -8
- package/dist/{oauth-refresh-sweep-htexfa1n.js → oauth-refresh-sweep-c63sqfs1.js} +7 -6
- package/dist/{onboard-621a6j39.js → onboard-2zj8sqkq.js} +2 -2
- package/dist/{otel-impl-vcxd9xr4.js → otel-impl-jgdfm26f.js} +1 -1
- package/dist/{pi-mono-adapter-hpqzw55z.js → pi-mono-adapter-2b7mw16r.js} +4 -3
- package/dist/{pricing-refresh-3ejja3b1.js → pricing-refresh-3whntb69.js} +8 -7
- package/dist/{rbac-roles-9m8q7svw.js → rbac-roles-3zptcc3p.js} +6 -5
- package/dist/{rbac-roles-9my9d5mf.js → rbac-roles-3zw68x72.js} +7 -6
- package/dist/{render-v2-19qtasfm.js → render-v2-dbvpyysc.js} +17 -6
- package/dist/{seed-pricing-rg67eyqm.js → seed-pricing-ncgxz1r2.js} +7 -6
- package/dist/{setup-m0jxmp5e.js → setup-qwx0j8z9.js} +2 -2
- package/dist/{work-objects-m0w74fxg.js → work-objects-sjbcmvep.js} +21 -20
- package/dist/{worker-2jyzjtfr.js → worker-xezqdkb7.js} +27 -26
- package/openapi.json +3293 -1031
- package/package.json +1 -1
- package/src/be/db.ts +335 -21
- package/src/be/memory/providers/openai-embedding.ts +4 -0
- package/src/be/migrations/162_slack_outcome_delivery_abandon.sql +14 -0
- package/src/be/migrations/164_usage_cover_index_and_key_plans.sql +22 -0
- package/src/be/onboarding.ts +689 -0
- package/src/be/swarm-config-guard.ts +11 -0
- package/src/commands/codex-login.ts +10 -8
- package/src/commands/provider-credentials.ts +10 -1
- package/src/commands/runner.ts +1 -0
- package/src/http/all-routes.ts +2 -0
- package/src/http/api-keys.ts +116 -3
- package/src/http/codex-oauth-device.ts +383 -0
- package/src/http/config.ts +16 -3
- package/src/http/index.ts +5 -1
- package/src/http/integrations.ts +23 -0
- package/src/http/onboarding.ts +319 -0
- package/src/http/session-data.ts +34 -4
- package/src/http/status.ts +11 -5
- package/src/http/trackers/jira.ts +6 -2
- package/src/http/trackers/linear.ts +6 -2
- package/src/http/usage-cache.ts +32 -0
- package/src/http/utils.ts +18 -2
- package/src/jira/oauth.ts +6 -2
- package/src/linear/oauth.ts +6 -2
- package/src/prompts/session-templates.ts +4 -4
- package/src/providers/codex-oauth/auth-json.ts +4 -1
- package/src/providers/codex-oauth/device.ts +105 -0
- package/src/providers/codex-oauth/flow.ts +13 -3
- package/src/providers/codex-oauth/storage.ts +1 -0
- package/src/scheduler/deferred-task-waits.ts +41 -6
- package/src/slack/manifest.ts +16 -0
- package/src/slack/render-v2.ts +228 -71
- package/src/slack/task-output.ts +32 -13
- package/src/tasks/worker-follow-up.ts +73 -0
- package/src/telemetry.ts +27 -0
- package/src/tests/base-prompt.test.ts +12 -5
- package/src/tests/codex-oauth-device.test.ts +515 -0
- package/src/tests/codex-oauth.test.ts +31 -0
- package/src/tests/config-internal-keys.test.ts +162 -0
- package/src/tests/cors-allowlist.test.ts +20 -0
- package/src/tests/db-task-read-contract.test.ts +9 -0
- package/src/tests/db-task-write-contract.test.ts +9 -0
- package/src/tests/deferred-wake-follow-up.test.ts +199 -0
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/dsh-adapter.test.ts +3 -2
- package/src/tests/entrypoint-acp-target-binary.test.ts +341 -0
- package/src/tests/onboarding.test.ts +800 -0
- package/src/tests/openai-embedding-provider.test.ts +56 -0
- package/src/tests/script-connections.test.ts +3 -0
- package/src/tests/session-costs.test.ts +113 -0
- package/src/tests/slack-manifest.test.ts +23 -0
- package/src/tests/slack-render-v2.test.ts +489 -10
- package/src/tests/slack-task-output.test.ts +45 -12
- package/src/tests/status.test.ts +62 -0
- package/src/tests/telemetry-init.test.ts +34 -0
- package/src/tools/defer-task.ts +4 -4
- package/src/tools/store-progress.ts +1 -1
- package/src/tools/swarm-config/delete-config.ts +6 -0
- package/src/tools/swarm-config/get-config.ts +2 -0
- package/src/tools/swarm-config/list-config.ts +8 -5
- package/src/tools/swarm-config/set-config.ts +8 -0
- package/src/types.ts +4 -0
- package/src/utils/credentials.ts +2 -0
- package/src/utils/subscription-plans.ts +138 -0
- package/templates/skills/scheduling/content.md +1 -1
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
normalizeAssetKey,
|
|
18
18
|
parseAssetKey,
|
|
19
19
|
parseModelTier
|
|
20
|
-
} from "./cli-
|
|
20
|
+
} from "./cli-h0wdadsx.js";
|
|
21
21
|
import {
|
|
22
22
|
IdentityFieldBudgetError,
|
|
23
23
|
checkIdentityFieldBudget,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
init_templates,
|
|
31
31
|
matchesDefaultClaudeMd,
|
|
32
32
|
matchesDefaultIdentityMd
|
|
33
|
-
} from "./cli-
|
|
33
|
+
} from "./cli-3gmcwfyx.js";
|
|
34
34
|
import {
|
|
35
35
|
configureDbResolver,
|
|
36
36
|
getAllTemplateDefinitions,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
init_steering_enabled,
|
|
41
41
|
isSteeringEnabled,
|
|
42
42
|
registerTemplate
|
|
43
|
-
} from "./cli-
|
|
43
|
+
} from "./cli-ggm92wcn.js";
|
|
44
44
|
import {
|
|
45
45
|
deriveProviderFromKeyType,
|
|
46
46
|
init_credentials
|
|
@@ -53,6 +53,11 @@ import {
|
|
|
53
53
|
activeModelBlock,
|
|
54
54
|
init_model_rate_limit_windows
|
|
55
55
|
} from "./cli-de1396j2.js";
|
|
56
|
+
import {
|
|
57
|
+
SUBSCRIPTION_KEY_TYPES,
|
|
58
|
+
estimateClaudePlan,
|
|
59
|
+
init_subscription_plans
|
|
60
|
+
} from "./cli-cqt19wg6.js";
|
|
56
61
|
import {
|
|
57
62
|
init_env_flag,
|
|
58
63
|
isEnvFlagEnabled
|
|
@@ -72,7 +77,7 @@ import {
|
|
|
72
77
|
import {
|
|
73
78
|
init_package,
|
|
74
79
|
package_default
|
|
75
|
-
} from "./cli-
|
|
80
|
+
} from "./cli-865swy5p.js";
|
|
76
81
|
import {
|
|
77
82
|
init_secret_scrubber,
|
|
78
83
|
registerVolatileSecret,
|
|
@@ -618,6 +623,17 @@ var init_telemetry = __esm(() => {
|
|
|
618
623
|
agent(event, props) {
|
|
619
624
|
track({ event: `agent.${event}`, properties: props });
|
|
620
625
|
},
|
|
626
|
+
onboarding(event, props) {
|
|
627
|
+
const installedAtMs = installedAt ? Date.parse(installedAt) : Number.NaN;
|
|
628
|
+
const secondsSinceInstall = Number.isFinite(installedAtMs) ? Math.max(0, Math.floor((Date.now() - installedAtMs) / 1000)) : undefined;
|
|
629
|
+
track({
|
|
630
|
+
event: `onboarding.${event}`,
|
|
631
|
+
properties: {
|
|
632
|
+
...props,
|
|
633
|
+
...secondsSinceInstall !== undefined ? { seconds_since_install: secondsSinceInstall } : {}
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
},
|
|
621
637
|
integration(event, props) {
|
|
622
638
|
const type = KNOWN_INTEGRATION_TYPES.has(props.type) ? props.type : "other";
|
|
623
639
|
const provider = props.provider ? integrationProviderEntry(props.provider)?.provider : undefined;
|
|
@@ -4328,6 +4344,12 @@ var init_task_tool_manifest = __esm(() => {
|
|
|
4328
4344
|
});
|
|
4329
4345
|
|
|
4330
4346
|
// src/be/swarm-config-guard.ts
|
|
4347
|
+
function isInternalConfigKey(key) {
|
|
4348
|
+
return INTERNAL_CONFIG_KEYS.has(key.toLowerCase());
|
|
4349
|
+
}
|
|
4350
|
+
function internalConfigKeyError(key) {
|
|
4351
|
+
return new Error(`Key '${key}' is managed by /api/onboarding`);
|
|
4352
|
+
}
|
|
4331
4353
|
function isReservedConfigKey(key) {
|
|
4332
4354
|
return RESERVED_KEYS.has(key.toUpperCase());
|
|
4333
4355
|
}
|
|
@@ -4405,7 +4427,7 @@ function validateConfigValue(key, value) {
|
|
|
4405
4427
|
const validator = VALIDATED_KEYS[key.toUpperCase()];
|
|
4406
4428
|
return validator ? validator(value) : null;
|
|
4407
4429
|
}
|
|
4408
|
-
var RESERVED_KEYS, BOOLEAN_LITERALS, MAX_DB_RETENTION_DAYS = 1e6, DB_RETENTION_TUNING_BOUNDS, VALIDATED_KEYS;
|
|
4430
|
+
var RESERVED_KEYS, INTERNAL_CONFIG_KEYS, BOOLEAN_LITERALS, MAX_DB_RETENTION_DAYS = 1e6, DB_RETENTION_TUNING_BOUNDS, VALIDATED_KEYS;
|
|
4409
4431
|
var init_swarm_config_guard = __esm(() => {
|
|
4410
4432
|
init_reaction_shortcode();
|
|
4411
4433
|
init_types();
|
|
@@ -4416,6 +4438,7 @@ var init_swarm_config_guard = __esm(() => {
|
|
|
4416
4438
|
"CORS_ALLOW_ANY_ORIGIN",
|
|
4417
4439
|
"EXTENSION_ALLOW_LEAD_ACTIVATION"
|
|
4418
4440
|
]);
|
|
4441
|
+
INTERNAL_CONFIG_KEYS = new Set(["onboarding_state"]);
|
|
4419
4442
|
BOOLEAN_LITERALS = ["true", "false", "1", "0"];
|
|
4420
4443
|
DB_RETENTION_TUNING_BOUNDS = {
|
|
4421
4444
|
DB_RETENTION_TICK_BUDGET_MS: { min: 1000, max: 300000 },
|
|
@@ -4589,6 +4612,7 @@ __export(exports_db, {
|
|
|
4589
4612
|
SKILL_FILE_LIMITS: () => SKILL_FILE_LIMITS,
|
|
4590
4613
|
UNATTRIBUTED_USER_ID: () => UNATTRIBUTED_USER_ID,
|
|
4591
4614
|
__resetSqliteVecExtensionPathCacheForTests: () => __resetSqliteVecExtensionPathCacheForTests,
|
|
4615
|
+
abandonSlackOutcomeDelivery: () => abandonSlackOutcomeDelivery,
|
|
4592
4616
|
acceptTask: () => acceptTask,
|
|
4593
4617
|
assignUnassignedTaskPending: () => assignUnassignedTaskPending,
|
|
4594
4618
|
autoEncryptLegacyPlaintextSecrets: () => autoEncryptLegacyPlaintextSecrets,
|
|
@@ -4783,6 +4807,7 @@ __export(exports_db, {
|
|
|
4783
4807
|
getLogsByAgentId: () => getLogsByAgentId,
|
|
4784
4808
|
getLogsByEventType: () => getLogsByEventType,
|
|
4785
4809
|
getLogsByTaskId: () => getLogsByTaskId,
|
|
4810
|
+
getLogsByTaskIdAndEventType: () => getLogsByTaskIdAndEventType,
|
|
4786
4811
|
getLogsByTaskIdChronological: () => getLogsByTaskIdChronological,
|
|
4787
4812
|
getMcpServerById: () => getMcpServerById,
|
|
4788
4813
|
getMcpServerByName: () => getMcpServerByName,
|
|
@@ -4810,6 +4835,7 @@ __export(exports_db, {
|
|
|
4810
4835
|
getPromptTemplateById: () => getPromptTemplateById,
|
|
4811
4836
|
getPromptTemplateHistory: () => getPromptTemplateHistory,
|
|
4812
4837
|
getPromptTemplates: () => getPromptTemplates,
|
|
4838
|
+
getReadyAgentCounts: () => getReadyAgentCounts,
|
|
4813
4839
|
getRecentBudgetRefusalNotifications: () => getRecentBudgetRefusalNotifications,
|
|
4814
4840
|
getRecentCompletedCount: () => getRecentCompletedCount,
|
|
4815
4841
|
getRecentFailedCount: () => getRecentFailedCount,
|
|
@@ -4882,6 +4908,7 @@ __export(exports_db, {
|
|
|
4882
4908
|
getUnassignedTasksCount: () => getUnassignedTasksCount,
|
|
4883
4909
|
getUnreadInboxMessages: () => getUnreadInboxMessages,
|
|
4884
4910
|
getUnreadMessages: () => getUnreadMessages,
|
|
4911
|
+
getUsageDataVersion: () => getUsageDataVersion,
|
|
4885
4912
|
getUserById: () => getUserById,
|
|
4886
4913
|
getWaitStateById: () => getWaitStateById,
|
|
4887
4914
|
getWaitStateByStepId: () => getWaitStateByStepId,
|
|
@@ -4913,6 +4940,7 @@ __export(exports_db, {
|
|
|
4913
4940
|
isExtensionAgent: () => isExtensionAgent,
|
|
4914
4941
|
isPendingSlackMessage: () => isPendingSlackMessage,
|
|
4915
4942
|
isPoolAffinityEnforcementEnabled: () => isPoolAffinityEnforcementEnabled,
|
|
4943
|
+
isSettledSlackMessage: () => isSettledSlackMessage,
|
|
4916
4944
|
isSqliteVecAvailable: () => isSqliteVecAvailable,
|
|
4917
4945
|
listAgentsWithCredStatusByProvider: () => listAgentsWithCredStatusByProvider,
|
|
4918
4946
|
listAllMetrics: () => listAllMetrics,
|
|
@@ -4956,6 +4984,7 @@ __export(exports_db, {
|
|
|
4956
4984
|
moveTaskFromBacklog: () => moveTaskFromBacklog,
|
|
4957
4985
|
moveTaskToBacklog: () => moveTaskToBacklog,
|
|
4958
4986
|
normalizeSkillFilePath: () => normalizeSkillFilePath,
|
|
4987
|
+
noteSlackOutcomeDeliveryFailure: () => noteSlackOutcomeDeliveryFailure,
|
|
4959
4988
|
overwriteTerminalTaskResultText: () => overwriteTerminalTaskResultText,
|
|
4960
4989
|
pauseTask: () => pauseTask,
|
|
4961
4990
|
postMessage: () => postMessage,
|
|
@@ -4992,6 +5021,7 @@ __export(exports_db, {
|
|
|
4992
5021
|
searchSkills: () => searchSkills,
|
|
4993
5022
|
setAgentHarnessProvider: () => setAgentHarnessProvider,
|
|
4994
5023
|
setApiKeyName: () => setApiKeyName,
|
|
5024
|
+
setApiKeyPlan: () => setApiKeyPlan,
|
|
4995
5025
|
setBudgetRefusalFollowUpTaskId: () => setBudgetRefusalFollowUpTaskId,
|
|
4996
5026
|
setFavorite: () => setFavorite,
|
|
4997
5027
|
setSlackMessageTracking: () => setSlackMessageTracking,
|
|
@@ -5110,6 +5140,9 @@ async function ensureSlackDelegationActivation() {
|
|
|
5110
5140
|
function isPendingSlackMessage(record) {
|
|
5111
5141
|
return record.ts.startsWith(PENDING_SLACK_MESSAGE_TS_PREFIX);
|
|
5112
5142
|
}
|
|
5143
|
+
function isSettledSlackMessage(record) {
|
|
5144
|
+
return !!record.finalizedAt || !!record.deliveryAbandonedAt;
|
|
5145
|
+
}
|
|
5113
5146
|
function rowToSlackMessage(row) {
|
|
5114
5147
|
return {
|
|
5115
5148
|
id: row.id,
|
|
@@ -5125,6 +5158,9 @@ function rowToSlackMessage(row) {
|
|
|
5125
5158
|
conclusionKind: row.conclusion_kind ?? undefined,
|
|
5126
5159
|
deferralResolvedAt: row.deferral_resolved_at ?? undefined,
|
|
5127
5160
|
deferralAbandonedAt: row.deferral_abandoned_at ?? undefined,
|
|
5161
|
+
deliveryAttempts: row.delivery_attempts,
|
|
5162
|
+
deliveryAbandonedAt: row.delivery_abandoned_at ?? undefined,
|
|
5163
|
+
deliveryLastError: row.delivery_last_error ?? undefined,
|
|
5128
5164
|
createdAt: row.created_at,
|
|
5129
5165
|
updatedAt: row.updated_at
|
|
5130
5166
|
};
|
|
@@ -5282,6 +5318,26 @@ async function markSlackDeferralResolved(id, options = {}) {
|
|
|
5282
5318
|
const now = new Date().toISOString();
|
|
5283
5319
|
await getDbClient().run("UPDATE slack_messages SET deferral_resolved_at = ?, deferral_abandoned_at = ? WHERE id = ?", [now, options.abandoned ? now : null, id]);
|
|
5284
5320
|
}
|
|
5321
|
+
async function noteSlackOutcomeDeliveryFailure(taskId, lastError) {
|
|
5322
|
+
const now = new Date().toISOString();
|
|
5323
|
+
const row = await getDbClient().get(`UPDATE slack_messages SET
|
|
5324
|
+
delivery_attempts = delivery_attempts + 1,
|
|
5325
|
+
delivery_last_error = ?,
|
|
5326
|
+
updated_at = ?
|
|
5327
|
+
WHERE task_id = ? AND kind = 'outcome' AND delivery_abandoned_at IS NULL
|
|
5328
|
+
RETURNING *`, [lastError.slice(0, 500), now, taskId]);
|
|
5329
|
+
return row ? rowToSlackMessage(row) : null;
|
|
5330
|
+
}
|
|
5331
|
+
async function abandonSlackOutcomeDelivery(taskId, lastError) {
|
|
5332
|
+
const now = new Date().toISOString();
|
|
5333
|
+
const row = await getDbClient().get(`UPDATE slack_messages SET
|
|
5334
|
+
delivery_abandoned_at = ?,
|
|
5335
|
+
delivery_last_error = ?,
|
|
5336
|
+
updated_at = ?
|
|
5337
|
+
WHERE task_id = ? AND kind = 'outcome' AND delivery_abandoned_at IS NULL
|
|
5338
|
+
RETURNING *`, [now, lastError.slice(0, 500), now, taskId]);
|
|
5339
|
+
return row ? rowToSlackMessage(row) : null;
|
|
5340
|
+
}
|
|
5285
5341
|
async function getSlackTreeMessages() {
|
|
5286
5342
|
const rows = await getDbClient().query(`SELECT tree.*
|
|
5287
5343
|
FROM slack_messages tree
|
|
@@ -5300,7 +5356,7 @@ async function getSlackTreeMessages() {
|
|
|
5300
5356
|
SELECT 1 FROM slack_messages outcome
|
|
5301
5357
|
WHERE outcome.kind = 'outcome'
|
|
5302
5358
|
AND outcome.task_id = task.id
|
|
5303
|
-
AND outcome.finalized_at IS NOT NULL
|
|
5359
|
+
AND (outcome.finalized_at IS NOT NULL OR outcome.delivery_abandoned_at IS NOT NULL)
|
|
5304
5360
|
)
|
|
5305
5361
|
)
|
|
5306
5362
|
OR
|
|
@@ -5326,7 +5382,7 @@ async function getSlackTreeMessages() {
|
|
|
5326
5382
|
AND outcome.thread_ts = tree.thread_ts
|
|
5327
5383
|
AND task.createdAt >= state.activated_at
|
|
5328
5384
|
AND (
|
|
5329
|
-
outcome.finalized_at IS NULL
|
|
5385
|
+
(outcome.finalized_at IS NULL AND outcome.delivery_abandoned_at IS NULL)
|
|
5330
5386
|
OR outcome.updated_at > tree.updated_at
|
|
5331
5387
|
)
|
|
5332
5388
|
)
|
|
@@ -6104,6 +6160,10 @@ async function getLogsByTaskId(taskId, limit = 200) {
|
|
|
6104
6160
|
const rows = await getDbClient().query("SELECT * FROM agent_log WHERE taskId = ? ORDER BY createdAt DESC LIMIT ?", [taskId, limit]);
|
|
6105
6161
|
return rows.map(rowToAgentLog);
|
|
6106
6162
|
}
|
|
6163
|
+
async function getLogsByTaskIdAndEventType(taskId, eventType) {
|
|
6164
|
+
const rows = await getDbClient().query("SELECT * FROM agent_log WHERE taskId = ? AND eventType = ? ORDER BY createdAt ASC", [taskId, eventType]);
|
|
6165
|
+
return rows.map(rowToAgentLog);
|
|
6166
|
+
}
|
|
6107
6167
|
async function getLogsByTaskIdChronological(taskId) {
|
|
6108
6168
|
const rows = await getDbClient().query("SELECT * FROM agent_log WHERE taskId = ? ORDER BY createdAt ASC", [taskId]);
|
|
6109
6169
|
return rows.map(rowToAgentLog);
|
|
@@ -7613,6 +7673,7 @@ async function getSessionCostsFiltered(opts) {
|
|
|
7613
7673
|
}
|
|
7614
7674
|
async function getSessionCostSummary(opts) {
|
|
7615
7675
|
const from = "FROM session_costs sc LEFT JOIN agent_tasks t ON t.id = sc.taskId";
|
|
7676
|
+
const fromHf = `${from} LEFT JOIN human_free_tasks hf ON hf.id = t.id`;
|
|
7616
7677
|
const conditions = [];
|
|
7617
7678
|
const params = [];
|
|
7618
7679
|
if (opts.startDate) {
|
|
@@ -7634,6 +7695,10 @@ async function getSessionCostSummary(opts) {
|
|
|
7634
7695
|
params.push(opts.userId);
|
|
7635
7696
|
}
|
|
7636
7697
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
7698
|
+
const classify = opts.userId !== undefined;
|
|
7699
|
+
const withHf = classify ? `WITH RECURSIVE ${HUMAN_FREE_TASKS_CTE}` : "";
|
|
7700
|
+
const scopedFrom = classify ? fromHf : from;
|
|
7701
|
+
const subscriptionSql = `t.credentialKeyType IN (${SUBSCRIPTION_KEY_TYPES.map((k) => `'${k}'`).join(", ")})`;
|
|
7637
7702
|
const totalsRow = await getDbClient().get(`WITH RECURSIVE ${HUMAN_FREE_TASKS_CTE}
|
|
7638
7703
|
SELECT
|
|
7639
7704
|
COALESCE(SUM(sc.totalCostUsd), 0) as totalCostUsd,
|
|
@@ -7649,8 +7714,10 @@ async function getSessionCostSummary(opts) {
|
|
|
7649
7714
|
THEN sc.totalCostUsd ELSE 0 END), 0) as attributableCostUsd,
|
|
7650
7715
|
COALESCE(SUM(CASE WHEN ${HUMAN_FREE_SQL}
|
|
7651
7716
|
THEN sc.totalCostUsd ELSE 0 END), 0) as excludedCostUsd,
|
|
7652
|
-
COUNT(DISTINCT CASE WHEN ${HUMAN_FREE_SQL} THEN t.id END) as excludedTaskCount
|
|
7653
|
-
|
|
7717
|
+
COUNT(DISTINCT CASE WHEN ${HUMAN_FREE_SQL} THEN t.id END) as excludedTaskCount,
|
|
7718
|
+
COALESCE(SUM(CASE WHEN ${subscriptionSql}
|
|
7719
|
+
THEN sc.totalCostUsd ELSE 0 END), 0) as subscriptionCostUsd
|
|
7720
|
+
${fromHf} ${where}`, params);
|
|
7654
7721
|
const totals = totalsRow ? {
|
|
7655
7722
|
...totalsRow,
|
|
7656
7723
|
avgCostPerSession: totalsRow.totalSessions > 0 ? totalsRow.totalCostUsd / totalsRow.totalSessions : 0
|
|
@@ -7666,25 +7733,28 @@ async function getSessionCostSummary(opts) {
|
|
|
7666
7733
|
attributedCostUsd: 0,
|
|
7667
7734
|
attributableCostUsd: 0,
|
|
7668
7735
|
excludedCostUsd: 0,
|
|
7669
|
-
excludedTaskCount: 0
|
|
7736
|
+
excludedTaskCount: 0,
|
|
7737
|
+
subscriptionCostUsd: 0
|
|
7670
7738
|
};
|
|
7671
7739
|
const groupBy = opts.groupBy ?? "both";
|
|
7672
7740
|
let daily = [];
|
|
7673
7741
|
if (groupBy === "day" || groupBy === "both") {
|
|
7674
|
-
daily = await getDbClient().query(
|
|
7742
|
+
daily = await getDbClient().query(`${withHf}
|
|
7675
7743
|
SELECT
|
|
7676
7744
|
DATE(sc.createdAt) as date,
|
|
7677
7745
|
COALESCE(SUM(sc.totalCostUsd), 0) as costUsd,
|
|
7678
7746
|
COALESCE(SUM(sc.inputTokens), 0) as inputTokens,
|
|
7679
7747
|
COALESCE(SUM(sc.outputTokens), 0) as outputTokens,
|
|
7680
|
-
COUNT(*) as sessions
|
|
7681
|
-
|
|
7748
|
+
COUNT(*) as sessions,
|
|
7749
|
+
COALESCE(SUM(CASE WHEN ${subscriptionSql} THEN sc.totalCostUsd ELSE 0 END), 0)
|
|
7750
|
+
as subscriptionCostUsd
|
|
7751
|
+
${scopedFrom} ${where}
|
|
7682
7752
|
GROUP BY DATE(sc.createdAt)
|
|
7683
7753
|
ORDER BY date ASC`, params);
|
|
7684
7754
|
}
|
|
7685
7755
|
let byAgent = [];
|
|
7686
7756
|
if (groupBy === "agent" || groupBy === "both") {
|
|
7687
|
-
byAgent = await getDbClient().query(
|
|
7757
|
+
byAgent = await getDbClient().query(`${withHf}
|
|
7688
7758
|
SELECT
|
|
7689
7759
|
sc.agentId as agentId,
|
|
7690
7760
|
COALESCE(SUM(sc.totalCostUsd), 0) as costUsd,
|
|
@@ -7692,7 +7762,7 @@ async function getSessionCostSummary(opts) {
|
|
|
7692
7762
|
COALESCE(SUM(sc.outputTokens), 0) as outputTokens,
|
|
7693
7763
|
COUNT(*) as sessions,
|
|
7694
7764
|
COALESCE(SUM(sc.durationMs), 0) as durationMs
|
|
7695
|
-
${
|
|
7765
|
+
${scopedFrom} ${where}
|
|
7696
7766
|
GROUP BY sc.agentId
|
|
7697
7767
|
ORDER BY costUsd DESC`, params);
|
|
7698
7768
|
}
|
|
@@ -7706,11 +7776,62 @@ async function getSessionCostSummary(opts) {
|
|
|
7706
7776
|
COALESCE(SUM(sc.outputTokens), 0) as outputTokens,
|
|
7707
7777
|
COUNT(DISTINCT sc.taskId) as tasks,
|
|
7708
7778
|
COALESCE(SUM(sc.durationMs), 0) as durationMs
|
|
7709
|
-
${
|
|
7779
|
+
${fromHf} ${where}
|
|
7710
7780
|
GROUP BY CASE WHEN ${HUMAN_FREE_SQL} THEN NULL ELSE t.requestedByUserId END
|
|
7711
7781
|
ORDER BY costUsd DESC`, params);
|
|
7712
7782
|
}
|
|
7713
|
-
|
|
7783
|
+
let byCredential = [];
|
|
7784
|
+
if (groupBy === "both") {
|
|
7785
|
+
const rows = await getDbClient().query(`${withHf}
|
|
7786
|
+
SELECT
|
|
7787
|
+
t.credentialKeyType as keyType,
|
|
7788
|
+
t.credentialKeySuffix as keySuffix,
|
|
7789
|
+
COALESCE(SUM(sc.totalCostUsd), 0) as costUsd,
|
|
7790
|
+
COALESCE(SUM(sc.inputTokens), 0) as inputTokens,
|
|
7791
|
+
COALESCE(SUM(sc.outputTokens), 0) as outputTokens,
|
|
7792
|
+
COUNT(*) as sessions,
|
|
7793
|
+
MIN(sc.createdAt) as firstSessionAt,
|
|
7794
|
+
MAX(sc.createdAt) as lastSessionAt
|
|
7795
|
+
${scopedFrom} ${where}
|
|
7796
|
+
GROUP BY t.credentialKeyType, t.credentialKeySuffix
|
|
7797
|
+
ORDER BY costUsd DESC`, params);
|
|
7798
|
+
const labels = await getCredentialLabels();
|
|
7799
|
+
byCredential = rows.map((row) => {
|
|
7800
|
+
const label = row.keyType && row.keySuffix ? labels.get(credentialKey(row.keyType, row.keySuffix)) : undefined;
|
|
7801
|
+
return {
|
|
7802
|
+
...row,
|
|
7803
|
+
name: label?.name ?? null,
|
|
7804
|
+
subscription: row.keyType !== null && SUBSCRIPTION_KEY_TYPES.includes(row.keyType),
|
|
7805
|
+
plan: label?.plan ?? null,
|
|
7806
|
+
planSource: label?.planSource ?? null
|
|
7807
|
+
};
|
|
7808
|
+
});
|
|
7809
|
+
}
|
|
7810
|
+
return { totals, daily, byAgent, byUser, byCredential };
|
|
7811
|
+
}
|
|
7812
|
+
function credentialKey(keyType, keySuffix) {
|
|
7813
|
+
return `${keyType}:${keySuffix}`;
|
|
7814
|
+
}
|
|
7815
|
+
async function getCredentialLabels() {
|
|
7816
|
+
const rows = await getDbClient().query(`SELECT keyType, keySuffix, name, plan, planSource FROM api_key_status
|
|
7817
|
+
ORDER BY CASE planSource WHEN 'manual' THEN 0 WHEN 'detected' THEN 1 WHEN 'estimated' THEN 2 ELSE 3 END,
|
|
7818
|
+
updatedAt DESC`);
|
|
7819
|
+
const labels = new Map;
|
|
7820
|
+
for (const row of rows) {
|
|
7821
|
+
const key = credentialKey(row.keyType, row.keySuffix);
|
|
7822
|
+
const seen = labels.get(key);
|
|
7823
|
+
if (!seen) {
|
|
7824
|
+
labels.set(key, { name: row.name, plan: row.plan, planSource: row.planSource });
|
|
7825
|
+
} else if (!seen.name && row.name) {
|
|
7826
|
+
seen.name = row.name;
|
|
7827
|
+
}
|
|
7828
|
+
}
|
|
7829
|
+
return labels;
|
|
7830
|
+
}
|
|
7831
|
+
async function getUsageDataVersion() {
|
|
7832
|
+
const row = await getDbClient().get(`SELECT COALESCE((SELECT MAX(rowid) FROM session_costs), 0) || ':' ||
|
|
7833
|
+
COALESCE((SELECT MAX(rowid) FROM agent_tasks), 0) as version`);
|
|
7834
|
+
return row?.version ?? "0:0";
|
|
7714
7835
|
}
|
|
7715
7836
|
async function getAttributionByPerson(opts) {
|
|
7716
7837
|
const conditions = ["t.requestedByUserId IS NOT NULL"];
|
|
@@ -7786,7 +7907,9 @@ async function getAttributionByPerson(opts) {
|
|
|
7786
7907
|
LEFT JOIN shipped_roots s ON s.rootId = t.id
|
|
7787
7908
|
GROUP BY t.requestedByUserId`, params);
|
|
7788
7909
|
const reachRows = await getDbClient().query(`WITH RECURSIVE report_tasks AS (
|
|
7789
|
-
|
|
7910
|
+
-- Only the columns read below: a task row carries its full prompt and output.
|
|
7911
|
+
SELECT t.id, t.agentId, t.vcsRepo, t.source, t.parentTaskId, t.requestedByUserId,
|
|
7912
|
+
t.requestedByUserIdInherited, t.taskType, t.tags, t.workflowRunId
|
|
7790
7913
|
FROM agent_tasks t
|
|
7791
7914
|
${where}
|
|
7792
7915
|
),
|
|
@@ -8419,7 +8542,7 @@ async function getInjectableGlobalConfigs() {
|
|
|
8419
8542
|
WHERE scope = 'global'
|
|
8420
8543
|
AND UPPER(key) NOT IN ('API_KEY', 'SECRETS_ENCRYPTION_KEY', 'CORS_ALLOW_ANY_ORIGIN', 'EXTENSION_ALLOW_LEAD_ACTIVATION')
|
|
8421
8544
|
ORDER BY key ASC`);
|
|
8422
|
-
return rows.map(rowToSwarmConfig);
|
|
8545
|
+
return rows.filter((row) => !isInternalConfigKey(row.key)).map(rowToSwarmConfig);
|
|
8423
8546
|
}
|
|
8424
8547
|
async function getSwarmConfigById(id) {
|
|
8425
8548
|
const row = await getDbClient().get("SELECT * FROM swarm_config WHERE id = ?", [
|
|
@@ -11069,7 +11192,7 @@ async function getAvailableKeyIndices(keyType, totalKeys, scope = "global", scop
|
|
|
11069
11192
|
earliestModelResetAt: earliestModelResetsAtSec !== undefined ? new Date(earliestModelResetsAtSec * 1000).toISOString() : null
|
|
11070
11193
|
};
|
|
11071
11194
|
}
|
|
11072
|
-
async function recordKeyUsage(keyType, keySuffix, keyIndex, taskId, scope = "global", scopeId = null) {
|
|
11195
|
+
async function recordKeyUsage(keyType, keySuffix, keyIndex, taskId, scope = "global", scopeId = null, plan = null) {
|
|
11073
11196
|
const now = new Date().toISOString();
|
|
11074
11197
|
const client = getDbClient();
|
|
11075
11198
|
const effectiveScopeId = scopeId ?? "";
|
|
@@ -11082,9 +11205,27 @@ async function recordKeyUsage(keyType, keySuffix, keyIndex, taskId, scope = "glo
|
|
|
11082
11205
|
totalUsageCount = totalUsageCount + 1,
|
|
11083
11206
|
keyIndex = excluded.keyIndex,
|
|
11084
11207
|
updatedAt = excluded.updatedAt`, [keyType, keySuffix, keyIndex, scope, effectiveScopeId, now, provider, now]);
|
|
11208
|
+
let planChanged = false;
|
|
11209
|
+
if (plan) {
|
|
11210
|
+
const result = await client.run(`UPDATE api_key_status SET plan = ?, planSource = 'detected'
|
|
11211
|
+
WHERE keyType = ? AND keySuffix = ? AND COALESCE(planSource, '') != 'manual'
|
|
11212
|
+
AND (plan IS NOT ? OR planSource IS NOT 'detected')`, [plan, keyType, keySuffix, plan]);
|
|
11213
|
+
planChanged = result.changes > 0;
|
|
11214
|
+
}
|
|
11085
11215
|
if (taskId) {
|
|
11086
11216
|
await client.run("UPDATE agent_tasks SET credentialKeySuffix = ?, credentialKeyType = ? WHERE id = ?", [keySuffix, keyType, taskId]);
|
|
11087
11217
|
}
|
|
11218
|
+
return { planChanged };
|
|
11219
|
+
}
|
|
11220
|
+
async function setApiKeyPlan(keyType, keySuffix, plan) {
|
|
11221
|
+
const now = new Date().toISOString();
|
|
11222
|
+
const result = plan ? await getDbClient().run(`UPDATE api_key_status SET plan = ?, planSource = 'manual', updatedAt = ?
|
|
11223
|
+
WHERE keyType = ? AND keySuffix = ?`, [plan, now, keyType, keySuffix]) : await getDbClient().run(`UPDATE api_key_status
|
|
11224
|
+
SET plan = CASE WHEN planSource = 'manual' THEN NULL ELSE plan END,
|
|
11225
|
+
planSource = CASE WHEN planSource = 'manual' THEN NULL ELSE planSource END,
|
|
11226
|
+
updatedAt = ?
|
|
11227
|
+
WHERE keyType = ? AND keySuffix = ?`, [now, keyType, keySuffix]);
|
|
11228
|
+
return result.changes > 0;
|
|
11088
11229
|
}
|
|
11089
11230
|
async function markKeyRateLimited(keyType, keySuffix, keyIndex, rateLimitedUntil, scope = "global", scopeId = null) {
|
|
11090
11231
|
const now = new Date().toISOString();
|
|
@@ -11116,14 +11257,15 @@ function mergeRateLimitWindowTelemetry(stored, reported) {
|
|
|
11116
11257
|
}
|
|
11117
11258
|
async function recordKeyRateLimitWindows(keyType, keySuffix, keyIndex, windows, scope = "global", scopeId = null) {
|
|
11118
11259
|
if (Object.keys(windows).length === 0)
|
|
11119
|
-
return;
|
|
11260
|
+
return { planChanged: false };
|
|
11120
11261
|
const now = new Date().toISOString();
|
|
11121
11262
|
const effectiveScopeId = scopeId ?? "";
|
|
11122
11263
|
const provider = deriveProviderFromKeyType(keyType);
|
|
11123
|
-
await getDbClient().transaction(async (tx) => {
|
|
11264
|
+
const merged = await getDbClient().transaction(async (tx) => {
|
|
11124
11265
|
const existing = await tx.get(`SELECT rateLimitWindows FROM api_key_status
|
|
11125
11266
|
WHERE keyType = ? AND keySuffix = ? AND scope = ? AND scopeId = ?`, [keyType, keySuffix, scope, effectiveScopeId]);
|
|
11126
|
-
const
|
|
11267
|
+
const mergedWindows = mergeRateLimitWindowTelemetry(parseRateLimitWindowsJson(existing?.rateLimitWindows), windows);
|
|
11268
|
+
const serialized = JSON.stringify(mergedWindows);
|
|
11127
11269
|
await tx.run(`INSERT INTO api_key_status (keyType, keySuffix, keyIndex, scope, scopeId, rateLimitWindows, provider, updatedAt)
|
|
11128
11270
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
11129
11271
|
ON CONFLICT(keyType, keySuffix, scope, scopeId)
|
|
@@ -11132,7 +11274,33 @@ async function recordKeyRateLimitWindows(keyType, keySuffix, keyIndex, windows,
|
|
|
11132
11274
|
keyIndex = excluded.keyIndex,
|
|
11133
11275
|
provider = excluded.provider,
|
|
11134
11276
|
updatedAt = excluded.updatedAt`, [keyType, keySuffix, keyIndex, scope, effectiveScopeId, serialized, provider, now]);
|
|
11277
|
+
return mergedWindows;
|
|
11135
11278
|
});
|
|
11279
|
+
const planChanged = keyType === "CLAUDE_CODE_OAUTH_TOKEN" && await refreshEstimatedClaudePlan(keySuffix, merged);
|
|
11280
|
+
return { planChanged };
|
|
11281
|
+
}
|
|
11282
|
+
async function refreshEstimatedClaudePlan(keySuffix, windows) {
|
|
11283
|
+
const week = windows.seven_day;
|
|
11284
|
+
if (!week?.utilization || !week.resetsAt)
|
|
11285
|
+
return false;
|
|
11286
|
+
const client = getDbClient();
|
|
11287
|
+
const stronger = await client.get(`SELECT 1 as found FROM api_key_status
|
|
11288
|
+
WHERE keyType = 'CLAUDE_CODE_OAUTH_TOKEN' AND keySuffix = ? AND planSource IN ('manual', 'detected')
|
|
11289
|
+
LIMIT 1`, [keySuffix]);
|
|
11290
|
+
if (stronger)
|
|
11291
|
+
return false;
|
|
11292
|
+
const windowStart = new Date((week.resetsAt - WEEK_SECONDS) * 1000).toISOString();
|
|
11293
|
+
const spend = await client.get(`SELECT COALESCE(SUM(sc.totalCostUsd), 0) as spendUsd
|
|
11294
|
+
FROM session_costs sc JOIN agent_tasks t ON t.id = sc.taskId
|
|
11295
|
+
WHERE t.credentialKeyType = 'CLAUDE_CODE_OAUTH_TOKEN' AND t.credentialKeySuffix = ?
|
|
11296
|
+
AND sc.createdAt >= ?`, [keySuffix, windowStart]);
|
|
11297
|
+
const plan = estimateClaudePlan(week.utilization, spend?.spendUsd ?? 0);
|
|
11298
|
+
if (!plan)
|
|
11299
|
+
return false;
|
|
11300
|
+
const result = await client.run(`UPDATE api_key_status SET plan = ?, planSource = 'estimated'
|
|
11301
|
+
WHERE keyType = 'CLAUDE_CODE_OAUTH_TOKEN' AND keySuffix = ?
|
|
11302
|
+
AND COALESCE(planSource, 'estimated') = 'estimated' AND plan IS NOT ?`, [plan, keySuffix, plan]);
|
|
11303
|
+
return result.changes > 0;
|
|
11136
11304
|
}
|
|
11137
11305
|
async function setApiKeyName(keyType, keySuffix, name, scope = "global", scopeId = null) {
|
|
11138
11306
|
const result = await getDbClient().run(`UPDATE api_key_status
|
|
@@ -11798,6 +11966,13 @@ async function getLiveAgentCounts(minutes = 5) {
|
|
|
11798
11966
|
workers_alive: row?.workers_alive ?? 0
|
|
11799
11967
|
};
|
|
11800
11968
|
}
|
|
11969
|
+
async function getReadyAgentCounts() {
|
|
11970
|
+
const row = await getDbClient().get(`SELECT SUM(CASE WHEN isLead = 1 THEN 1 ELSE 0 END) AS leads,
|
|
11971
|
+
SUM(CASE WHEN isLead = 0 THEN 1 ELSE 0 END) AS workers
|
|
11972
|
+
FROM agents
|
|
11973
|
+
WHERE status IN ('idle', 'busy') AND ${NOT_EXTENSION_AGENT_SQL}`);
|
|
11974
|
+
return { leads: row?.leads ?? 0, workers: row?.workers ?? 0 };
|
|
11975
|
+
}
|
|
11801
11976
|
async function getInstanceActivity() {
|
|
11802
11977
|
const { leads_alive, workers_alive } = await getLiveAgentCounts(5);
|
|
11803
11978
|
const tasksRow = await getDbClient().get(`SELECT COUNT(*) AS count FROM agent_tasks
|
|
@@ -12325,7 +12500,7 @@ END`, ELIGIBILITY_SCAN_BATCH_SIZE, ELIGIBILITY_SCAN_CAP, UNATTRIBUTED_USER_ID =
|
|
|
12325
12500
|
JOIN human_free_tasks parent ON child.parentTaskId = parent.id
|
|
12326
12501
|
WHERE child.requestedByUserId IS NULL
|
|
12327
12502
|
OR child.requestedByUserIdInherited = 1
|
|
12328
|
-
)`, HUMAN_FREE_SQL = "
|
|
12503
|
+
)`, HUMAN_FREE_SQL = "hf.id IS NOT NULL", ROOT_HUMAN_FREE_SQL = `(
|
|
12329
12504
|
COALESCE(t.taskType, '') IN ('heartbeat', 'heartbeat-checklist', 'boot-triage')
|
|
12330
12505
|
OR COALESCE(t.tags, '[]') LIKE '%"heartbeat"%'
|
|
12331
12506
|
OR (COALESCE(t.source, '') = 'schedule' AND t.requestedByUserId IS NULL)
|
|
@@ -12340,7 +12515,7 @@ END`, ELIGIBILITY_SCAN_BATCH_SIZE, ELIGIBILITY_SCAN_CAP, UNATTRIBUTED_USER_ID =
|
|
|
12340
12515
|
AND run.created_by IS NULL
|
|
12341
12516
|
)
|
|
12342
12517
|
)
|
|
12343
|
-
)`, SCHEDULE_TEMPLATE_PREVIEW_LENGTH = 280, RESERVED_CONFIG_PLACEHOLDER = "[reserved key stored in swarm_config; delete this row]", SKILL_FILE_LIMITS, BINARY_SKILL_FILE_PLACEHOLDER = "[binary file - not synced]", SKILL_SLIM_COLUMNS = "id, name, description, type, scope, ownerAgentId, sourceUrl, sourceRepo, sourcePath, sourceBranch, sourceHash, isComplex, allowedTools, model, effort, context, agent, disableModelInvocation, userInvocable, version, isEnabled, systemDefault, createdAt, lastUpdatedAt, lastFetchedAt, '' as content", KvTypeCollisionError;
|
|
12518
|
+
)`, SCHEDULE_TEMPLATE_PREVIEW_LENGTH = 280, RESERVED_CONFIG_PLACEHOLDER = "[reserved key stored in swarm_config; delete this row]", SKILL_FILE_LIMITS, BINARY_SKILL_FILE_PLACEHOLDER = "[binary file - not synced]", SKILL_SLIM_COLUMNS = "id, name, description, type, scope, ownerAgentId, sourceUrl, sourceRepo, sourcePath, sourceBranch, sourceHash, isComplex, allowedTools, model, effort, context, agent, disableModelInvocation, userInvocable, version, isEnabled, systemDefault, createdAt, lastUpdatedAt, lastFetchedAt, '' as content", WEEK_SECONDS, KvTypeCollisionError;
|
|
12344
12519
|
var init_db = __esm(() => {
|
|
12345
12520
|
init_package();
|
|
12346
12521
|
init_key();
|
|
@@ -12356,6 +12531,7 @@ var init_db = __esm(() => {
|
|
|
12356
12531
|
init_model_rate_limit_windows();
|
|
12357
12532
|
init_request_auth_context();
|
|
12358
12533
|
init_secret_scrubber();
|
|
12534
|
+
init_subscription_plans();
|
|
12359
12535
|
init_asset_key_audit();
|
|
12360
12536
|
init_crypto();
|
|
12361
12537
|
init_date_utils();
|
|
@@ -12412,6 +12588,7 @@ var init_db = __esm(() => {
|
|
|
12412
12588
|
maxTotalBytes: Number(process.env.SKILL_FILES_MAX_TOTAL_BYTES ?? 10 * 1024 * 1024),
|
|
12413
12589
|
maxFileBytes: Number(process.env.SKILL_FILES_MAX_FILE_BYTES ?? 500 * 1024)
|
|
12414
12590
|
};
|
|
12591
|
+
WEEK_SECONDS = 7 * 24 * 3600;
|
|
12415
12592
|
KvTypeCollisionError = class KvTypeCollisionError extends Error {
|
|
12416
12593
|
existingType;
|
|
12417
12594
|
constructor(existingType) {
|
|
@@ -12422,4 +12599,4 @@ var init_db = __esm(() => {
|
|
|
12422
12599
|
};
|
|
12423
12600
|
});
|
|
12424
12601
|
|
|
12425
|
-
export { slackContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, checkSlackRoutingCoherence, init_slack_routing, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, telemetry, emitIntegrationConnected, init_telemetry, HeartbeatExpiryError, init_heartbeat_expiry, beginRequestAuthScope, setRequestAuth, getRequestAuth, getCurrentRequestAuth, runWithoutRequestAuth, init_request_auth_context, auditAssetKeys, init_asset_key_audit, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, normalizeDate, normalizeDateRequired, init_date_utils, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, init_credential_broker, isInTransaction, init_db_client, getPromptTemplateDefaultDrift, init_default_drift, init_templates2 as init_templates, isSqliteVecAvailable, resolveSqliteVecExtensionPath, __resetSqliteVecExtensionPathCacheForTests, initDb, getDb, closeDb, getDbClient, updateAgentCredentialState, updateAgentCredentialMissing, createAgent, getAgentById, EXTENSION_AGENT_ROLE, NOT_EXTENSION_AGENT_SQL, isExtensionAgent, extensionAgentAssignmentError, ReservedAgentRoleError, reservedRoleViolation, ExtensionAgentAssignmentError, getAllAgents, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, isPoolAffinityEnforcementEnabled, buildRoutingAffinityFromAgent, isAgentEligibleForTask, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, getTaskById, getChildTasks, hasNonTerminalResumeChild, hasNonTerminalRerouteDecisionChild, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getPendingSlackRelayTasks, markSlackRelayAttempted, markSlackRelayDelivered, markFinalizedSlackRelaysDelivered, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getSlackTasksMissingTree, getInProgressTasksByContextKey, findExistingLinearTrackerContextWork, getLatestTaskByContextKey, getLatestScriptRunStepTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getLatestLeadTaskInThread, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, onTaskStarted, init_task_lifecycle_events, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, updateTaskClaudeSessionId, updateTaskTitle, completeTask, failTask, overwriteTerminalTaskResultText, cancelTask, supersedeTask, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, SteeringRequestError, isSteeringEnabled2 as isSteeringEnabled, getTaskSteeringFields, promotePendingSteeringForTask, markSteeringUndeliverable, requestSteering, init_steering, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, init_reaction_shortcode, parseTaskToolManifest, selectTaskTools, init_task_tool_manifest, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, validateConfigValue, init_swarm_config_guard, getSlackRenderV2ActivatedAt, ensureSlackRenderV2Activation, getSlackDelegationActivatedAt, ensureSlackDelegationActivation, isPendingSlackMessage, recordSlackMessage, reserveSlackMessage, bindSlackMessageTimestamp, updateSlackMessageRecord, markSlackTreeRendered, deleteSlackMessageRecord, getSlackTreeMessage, getSlackTreeMessageByThread, getSlackOutcomeMessage, getResolvableDeferralOutcomes, markSlackDeferralResolved, getSlackTreeMessages, getSlackMessageByChannelTs, getSlackTasksInThread, markTaskSlackReplySent, setSlackMessageTracking, updateTaskVcs, insertTaskAttachment, recordTaskPullRequestAttachments, getAssetKeyMappingByProvider, upsertAssetKeyMapping, getAssetKeyMapping, listAssetSummaries, moveAssetKey, deleteTaskAttachment, replaceTaskAttachment, getTaskAttachments, createSteeringMessage, getSteeringMessagesForTask, getSteeringMessageById, getPendingSteeringForTask, getPendingSteeringForAgent, markSteeringDelivered, markSteeringHandled, markSteeringPromoted, cancelPendingSteeringForTask, hasPendingSteering, getAgentWithTasks, getAllAgentsWithTasks, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, promoteDraftTask, refreshDraftTaskLease, promoteAbandonedDraftTasks, releaseStaleReviewingTasks, releaseStaleOfferedTasksForOfflineAgents, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, getUnassignedTaskIdsForAgent, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, UNATTRIBUTED_USER_ID, getSessionCostSummary, getAttributionByPerson, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, emitBuiltInIntegrationConnectedOnce, deleteSwarmConfig, deleteSwarmConfigByKey, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getStaleUnassignedAffinityTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, countWorkflowRuns, listWorkflowRunsPage, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, detachTaskFromWorkflowRunStep, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createAppVersion, getAppVersions, getAppVersion, createPage, getPage, getPageBySlug, getLatestPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, cancelPendingApprovalRequestsForRun, listCancelledApprovalRequestsForRun, listCancelledApprovalRequestsForStep, claimApprovalCancellationNotification, completeApprovalCancellationNotificationClaim, releaseApprovalCancellationNotificationClaim, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, emitMcpServerConnectedTelemetry, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, markKeyRateLimited, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listFavorites, listUserFavorites, getFavoriteItemIdSet, setFavorite, setUserFavorite, withFavoriteFlags, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, sweepExpiredKv, sweepExpiredKvPrefix, upsertKv, claimKv, deleteKv, KvTypeCollisionError, incrKv, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, updateScriptRunIfNotTerminal, updateScriptRunIfRunning, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db };
|
|
12602
|
+
export { slackContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, checkSlackRoutingCoherence, init_slack_routing, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, telemetry, emitIntegrationConnected, init_telemetry, HeartbeatExpiryError, init_heartbeat_expiry, beginRequestAuthScope, setRequestAuth, getRequestAuth, getCurrentRequestAuth, runWithoutRequestAuth, init_request_auth_context, auditAssetKeys, init_asset_key_audit, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, normalizeDate, normalizeDateRequired, init_date_utils, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, init_credential_broker, isInTransaction, init_db_client, getPromptTemplateDefaultDrift, init_default_drift, init_templates2 as init_templates, isSqliteVecAvailable, resolveSqliteVecExtensionPath, __resetSqliteVecExtensionPathCacheForTests, initDb, getDb, closeDb, getDbClient, updateAgentCredentialState, updateAgentCredentialMissing, createAgent, getAgentById, EXTENSION_AGENT_ROLE, NOT_EXTENSION_AGENT_SQL, isExtensionAgent, extensionAgentAssignmentError, ReservedAgentRoleError, reservedRoleViolation, ExtensionAgentAssignmentError, getAllAgents, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, isPoolAffinityEnforcementEnabled, buildRoutingAffinityFromAgent, isAgentEligibleForTask, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, getTaskById, getChildTasks, hasNonTerminalResumeChild, hasNonTerminalRerouteDecisionChild, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getPendingSlackRelayTasks, markSlackRelayAttempted, markSlackRelayDelivered, markFinalizedSlackRelaysDelivered, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getSlackTasksMissingTree, getInProgressTasksByContextKey, findExistingLinearTrackerContextWork, getLatestTaskByContextKey, getLatestScriptRunStepTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getLatestLeadTaskInThread, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, onTaskStarted, init_task_lifecycle_events, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, updateTaskClaudeSessionId, updateTaskTitle, completeTask, failTask, overwriteTerminalTaskResultText, cancelTask, supersedeTask, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, SteeringRequestError, isSteeringEnabled2 as isSteeringEnabled, getTaskSteeringFields, promotePendingSteeringForTask, markSteeringUndeliverable, requestSteering, init_steering, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, init_reaction_shortcode, parseTaskToolManifest, selectTaskTools, init_task_tool_manifest, isInternalConfigKey, internalConfigKeyError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, validateConfigValue, init_swarm_config_guard, getSlackRenderV2ActivatedAt, ensureSlackRenderV2Activation, getSlackDelegationActivatedAt, ensureSlackDelegationActivation, isPendingSlackMessage, isSettledSlackMessage, recordSlackMessage, reserveSlackMessage, bindSlackMessageTimestamp, updateSlackMessageRecord, markSlackTreeRendered, deleteSlackMessageRecord, getSlackTreeMessage, getSlackTreeMessageByThread, getSlackOutcomeMessage, getResolvableDeferralOutcomes, markSlackDeferralResolved, noteSlackOutcomeDeliveryFailure, abandonSlackOutcomeDelivery, getSlackTreeMessages, getSlackMessageByChannelTs, getSlackTasksInThread, markTaskSlackReplySent, setSlackMessageTracking, updateTaskVcs, insertTaskAttachment, recordTaskPullRequestAttachments, getAssetKeyMappingByProvider, upsertAssetKeyMapping, getAssetKeyMapping, listAssetSummaries, moveAssetKey, deleteTaskAttachment, replaceTaskAttachment, getTaskAttachments, createSteeringMessage, getSteeringMessagesForTask, getSteeringMessageById, getPendingSteeringForTask, getPendingSteeringForAgent, markSteeringDelivered, markSteeringHandled, markSteeringPromoted, cancelPendingSteeringForTask, hasPendingSteering, getAgentWithTasks, getAllAgentsWithTasks, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdAndEventType, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, promoteDraftTask, refreshDraftTaskLease, promoteAbandonedDraftTasks, releaseStaleReviewingTasks, releaseStaleOfferedTasksForOfflineAgents, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, getUnassignedTaskIdsForAgent, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, UNATTRIBUTED_USER_ID, getSessionCostSummary, getUsageDataVersion, getAttributionByPerson, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, emitBuiltInIntegrationConnectedOnce, deleteSwarmConfig, deleteSwarmConfigByKey, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getStaleUnassignedAffinityTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, countWorkflowRuns, listWorkflowRunsPage, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, detachTaskFromWorkflowRunStep, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createAppVersion, getAppVersions, getAppVersion, createPage, getPage, getPageBySlug, getLatestPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, cancelPendingApprovalRequestsForRun, listCancelledApprovalRequestsForRun, listCancelledApprovalRequestsForStep, claimApprovalCancellationNotification, completeApprovalCancellationNotificationClaim, releaseApprovalCancellationNotificationClaim, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, emitMcpServerConnectedTelemetry, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, setApiKeyPlan, markKeyRateLimited, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listFavorites, listUserFavorites, getFavoriteItemIdSet, setFavorite, setUserFavorite, withFavoriteFlags, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getReadyAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, sweepExpiredKv, sweepExpiredKvPrefix, upsertKv, claimKv, deleteKv, KvTypeCollisionError, incrKv, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, updateScriptRunIfNotTerminal, updateScriptRunIfRunning, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db };
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
getEmbeddingProvider,
|
|
5
5
|
init_embedding,
|
|
6
6
|
serializeEmbedding
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-08n8jxcw.js";
|
|
8
8
|
import {
|
|
9
9
|
getDbClient,
|
|
10
10
|
init_db
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-24w39x6n.js";
|
|
12
12
|
import {
|
|
13
13
|
init_secret_scrubber,
|
|
14
14
|
scrubSecrets
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runStopHookSessionSummarySubprocess
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-b05d7szr.js";
|
|
4
4
|
import {
|
|
5
5
|
fetchInstalledMcpServers
|
|
6
6
|
} from "./cli-tng3131n.js";
|
|
@@ -822,7 +822,7 @@ class ClaudeAdapter {
|
|
|
822
822
|
if (transport === "sdk" && isClaudeBridgeEffective(sourceEnv)) {
|
|
823
823
|
throw new Error("CLAUDE_TRANSPORT=sdk cannot run with an effective Claude Bridge configuration. Select CLI transport or disable the bridge.");
|
|
824
824
|
}
|
|
825
|
-
const claudeSdk = transport === "sdk" ? await import("./claude-sdk-session-
|
|
825
|
+
const claudeSdk = transport === "sdk" ? await import("./claude-sdk-session-k7pb5kfz.js") : undefined;
|
|
826
826
|
claudeSdk?.validateClaudeSdkAdditionalArgs([
|
|
827
827
|
...claudeBinaryArgv.slice(1),
|
|
828
828
|
...config.additionalArgs ?? []
|