@desplega.ai/agent-swarm 1.104.0 → 1.105.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +1 -0
  2. package/dist/{actions-2expzt47.js → actions-45g8tvc8.js} +6 -6
  3. package/dist/{app-dr8hwx7z.js → app-18x5k1cj.js} +3 -3
  4. package/dist/{assistant-9rhgsw7v.js → assistant-ka281qe8.js} +9 -9
  5. package/dist/{boot-reembed-9kt97g1z.js → boot-reembed-f38vbxw8.js} +3 -3
  6. package/dist/{boot-reembed-3q1aywnz.js → boot-reembed-rp2gba79.js} +4 -4
  7. package/dist/{boot-scrub-logs-vskq108e.js → boot-scrub-logs-nsnc9f1a.js} +2 -2
  8. package/dist/{cli-v1syqkcb.js → cli-0e24r2b6.js} +2 -2
  9. package/dist/{cli-nzc0h54v.js → cli-0n4xxmy0.js} +1 -1
  10. package/dist/{cli-e7bwjntj.js → cli-0s37sw3k.js} +1 -1
  11. package/dist/{cli-23zk7xqy.js → cli-2hg6bj31.js} +4 -4
  12. package/dist/{cli-q5tshxd6.js → cli-4df7btj0.js} +1 -1
  13. package/dist/{cli-p4cj4vhc.js → cli-634jy7sa.js} +1 -1
  14. package/dist/{cli-7v4y3hyd.js → cli-7esh9fda.js} +1 -1
  15. package/dist/{cli-s42f54ja.js → cli-87fj1jk4.js} +1 -1
  16. package/dist/{cli-w1nfskkg.js → cli-8y7y1vmp.js} +2 -2
  17. package/dist/{cli-2hap19dv.js → cli-ba47wf2q.js} +3 -3
  18. package/dist/{cli-gj2n2ec1.js → cli-c4h8m0m3.js} +1 -1
  19. package/dist/{cli-5pf0b84v.js → cli-dd6tegmp.js} +2 -2
  20. package/dist/{cli-yjt8a36k.js → cli-ehcjr5vs.js} +3 -1
  21. package/dist/{cli-zghef0em.js → cli-gq7gvvrn.js} +1 -1
  22. package/dist/{cli-zaxksbgj.js → cli-gzmv1371.js} +5 -5
  23. package/dist/{cli-qvzgncd8.js → cli-sdf2qwkt.js} +26 -19
  24. package/dist/{cli-t9v14cnd.js → cli-sm9yseh1.js} +1 -1
  25. package/dist/{cli-54h5daha.js → cli-v2fb1fxf.js} +6 -6
  26. package/dist/{cli-d4z1csms.js → cli-vpwffend.js} +3 -3
  27. package/dist/{cli-0jw6j755.js → cli-wztagmpk.js} +1 -1
  28. package/dist/{cli-2g9jf9ek.js → cli-yd29d4n4.js} +1 -1
  29. package/dist/{cli-yvektv79.js → cli-yfyqsqzj.js} +1 -1
  30. package/dist/{cli-y9p3e94h.js → cli-yzr0qxx1.js} +3 -3
  31. package/dist/{cli-etvgz5x8.js → cli-zmta7t3y.js} +4 -4
  32. package/dist/cli.js +10 -8
  33. package/dist/{commands-wfrkef57.js → commands-tn8zj0an.js} +2 -2
  34. package/dist/{db-c42pxt7h.js → db-gtqymk7r.js} +2 -2
  35. package/dist/{handlers-n36zkfvx.js → handlers-5xdqk40d.js} +9 -9
  36. package/dist/{hook-gw3vhv6s.js → hook-gj6j6zwj.js} +1 -1
  37. package/dist/{http-59ygpn2h.js → http-4pceba9h.js} +144 -33
  38. package/dist/{index-xf6fp4y1.js → index-0rfp6wh2.js} +5 -5
  39. package/dist/{index-xz8vaa5c.js → index-as4evz9g.js} +10 -10
  40. package/dist/{index-881c1baf.js → index-paaw4xt5.js} +8 -8
  41. package/dist/{index-jca7jdpt.js → index-wf0q4k03.js} +6 -6
  42. package/dist/{keepalive-mj4302vw.js → keepalive-akbzjt41.js} +4 -4
  43. package/dist/{lead-qm0xjvkv.js → lead-g8v85nf4.js} +18 -18
  44. package/dist/{maintenance-xppxbe4t.js → maintenance-9yrzmrh8.js} +4 -4
  45. package/dist/{onboard-ejx6yxh8.js → onboard-v5bx0kpy.js} +2 -2
  46. package/dist/{otel-impl-zs5exkpk.js → otel-impl-530442da.js} +4510 -4465
  47. package/dist/{pricing-refresh-nqyf8bkb.js → pricing-refresh-dt289v11.js} +4 -4
  48. package/dist/{seed-pricing-w3x550cj.js → seed-pricing-183er9b3.js} +3 -3
  49. package/dist/{setup-7729ktfj.js → setup-tjgsvznx.js} +2 -2
  50. package/dist/{worker-4ttemwhw.js → worker-nxcxk5pb.js} +18 -18
  51. package/openapi.json +1 -1
  52. package/package.json +3 -1
  53. package/src/http/pages-public.ts +123 -2
  54. package/src/http/session-data.ts +16 -0
  55. package/src/otel-impl.ts +73 -0
  56. package/src/otel.ts +12 -0
  57. package/src/tests/otel-impl-secret-scrubbing.test.ts +101 -3
  58. package/src/tests/otel-session-cost-metrics.test.ts +281 -0
  59. package/src/tests/pages-authed-mode.test.ts +50 -0
@@ -4,11 +4,11 @@ import {
4
4
  getNextResumeGeneration,
5
5
  getResumeGeneration,
6
6
  repointTrackerSyncBySwarmId
7
- } from "./cli-s42f54ja.js";
7
+ } from "./cli-87fj1jk4.js";
8
8
  import {
9
9
  getExecutorRegistry,
10
10
  recoverIncompleteRuns
11
- } from "./cli-54h5daha.js";
11
+ } from "./cli-v2fb1fxf.js";
12
12
  import {
13
13
  assignUnassignedTaskPending,
14
14
  backfillSupersedeTaskResumeTaskId,
@@ -43,7 +43,7 @@ import {
43
43
  resolveTemplate,
44
44
  supersedeTask,
45
45
  updateAgentStatus
46
- } from "./cli-0jw6j755.js";
46
+ } from "./cli-wztagmpk.js";
47
47
 
48
48
  // src/heartbeat/heartbeat.ts
49
49
  init_db();
@@ -25,7 +25,7 @@ import {
25
25
  import {
26
26
  init_package,
27
27
  package_default
28
- } from "./cli-yjt8a36k.js";
28
+ } from "./cli-ehcjr5vs.js";
29
29
  import {
30
30
  init_secret_scrubber,
31
31
  scrubSecrets
@@ -3,7 +3,7 @@ import {
3
3
  init_date_utils,
4
4
  init_db,
5
5
  normalizeDateRequired
6
- } from "./cli-0jw6j755.js";
6
+ } from "./cli-wztagmpk.js";
7
7
 
8
8
  // src/be/db-queries/oauth.ts
9
9
  init_date_utils();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getDb,
3
3
  init_db
4
- } from "./cli-0jw6j755.js";
4
+ } from "./cli-wztagmpk.js";
5
5
 
6
6
  // src/be/users.ts
7
7
  init_db();
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  handleScheduleTrigger
3
- } from "./cli-zghef0em.js";
3
+ } from "./cli-gq7gvvrn.js";
4
4
  import {
5
5
  createTaskWithSiblingAwareness,
6
6
  scheduleContextKey
7
- } from "./cli-e7bwjntj.js";
7
+ } from "./cli-0s37sw3k.js";
8
8
  import {
9
9
  getDb,
10
10
  getDueScheduledTasks,
@@ -13,7 +13,7 @@ import {
13
13
  init_telemetry,
14
14
  telemetry,
15
15
  updateScheduledTask
16
- } from "./cli-0jw6j755.js";
16
+ } from "./cli-wztagmpk.js";
17
17
  import {
18
18
  __commonJS,
19
19
  __require,
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  createAdditiveBuffer,
3
3
  extractSlackMessageText
4
- } from "./cli-nzc0h54v.js";
4
+ } from "./cli-0n4xxmy0.js";
5
5
  import {
6
6
  getSlackApp,
7
7
  registerTreeMessage
8
- } from "./cli-zaxksbgj.js";
8
+ } from "./cli-gzmv1371.js";
9
9
  import {
10
10
  buildBufferFlushBlocks
11
11
  } from "./cli-z92pkwzn.js";
12
12
  import {
13
13
  createTaskWithSiblingAwareness,
14
14
  slackContextKey
15
- } from "./cli-e7bwjntj.js";
15
+ } from "./cli-0s37sw3k.js";
16
16
  import {
17
17
  getLatestActiveTaskInThread,
18
18
  getLeadAgent,
@@ -20,7 +20,7 @@ import {
20
20
  init_db,
21
21
  init_registry,
22
22
  registerTemplate
23
- } from "./cli-0jw6j755.js";
23
+ } from "./cli-wztagmpk.js";
24
24
 
25
25
  // src/slack/event-dedup.ts
26
26
  var DEFAULT_TTL_MS = 300000;
package/dist/cli.js CHANGED
@@ -62,7 +62,7 @@ var import_react = __toESM(require_react(), 1);
62
62
  // package.json
63
63
  var package_default = {
64
64
  name: "@desplega.ai/agent-swarm",
65
- version: "1.104.0",
65
+ version: "1.105.0",
66
66
  description: "Multi-agent orchestration for Claude Code, Codex, Gemini CLI, and other AI coding assistants",
67
67
  license: "MIT",
68
68
  author: "desplega.sh <contact@desplega.sh>",
@@ -186,8 +186,10 @@ var package_default = {
186
186
  "@opencode-ai/sdk": "^1.17.11",
187
187
  "@openfort/openfort-node": "^0.9.1",
188
188
  "@opentelemetry/api": "^1.9.1",
189
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.218.0",
189
190
  "@opentelemetry/exporter-trace-otlp-http": "^0.218.0",
190
191
  "@opentelemetry/resources": "^2.7.1",
192
+ "@opentelemetry/sdk-metrics": "^2.7.1",
191
193
  "@opentelemetry/sdk-node": "^0.218.0",
192
194
  "@opentelemetry/semantic-conventions": "^1.41.1",
193
195
  "@slack/bolt": "^4.6.0",
@@ -616,7 +618,7 @@ function McpServer({ port, apiKey, dbPath }) {
616
618
  if (dbPath) {
617
619
  process.env.DATABASE_PATH = dbPath;
618
620
  }
619
- import("./http-59ygpn2h.js").then(() => {
621
+ import("./http-4pceba9h.js").then(() => {
620
622
  setStatus("running");
621
623
  }).catch((err) => {
622
624
  setStatus("error");
@@ -702,7 +704,7 @@ function WorkerRunner({
702
704
  }) {
703
705
  const { exit } = use_app_default();
704
706
  import_react.useEffect(() => {
705
- import("./worker-4ttemwhw.js").then(({ runWorker }) => runWorker({
707
+ import("./worker-nxcxk5pb.js").then(({ runWorker }) => runWorker({
706
708
  prompt: prompt || undefined,
707
709
  yolo,
708
710
  systemPrompt: systemPrompt || undefined,
@@ -719,7 +721,7 @@ function WorkerRunner({
719
721
  function LeadRunner({ prompt, yolo, systemPrompt, systemPromptFile, additionalArgs }) {
720
722
  const { exit } = use_app_default();
721
723
  import_react.useEffect(() => {
722
- import("./lead-qm0xjvkv.js").then(({ runLead }) => runLead({
724
+ import("./lead-g8v85nf4.js").then(({ runLead }) => runLead({
723
725
  prompt: prompt || undefined,
724
726
  yolo,
725
727
  systemPrompt: systemPrompt || undefined,
@@ -759,8 +761,8 @@ function LazyComponent({
759
761
  }
760
762
  return import_react.createElement(Component, props);
761
763
  }
762
- var loadOnboard = () => import("./onboard-ejx6yxh8.js").then(({ Onboard }) => Onboard);
763
- var loadConnect = () => import("./setup-7729ktfj.js").then(({ Setup }) => Setup);
764
+ var loadOnboard = () => import("./onboard-v5bx0kpy.js").then(({ Onboard }) => Onboard);
765
+ var loadConnect = () => import("./setup-tjgsvznx.js").then(({ Setup }) => Setup);
764
766
  function UnknownCommand({ command }) {
765
767
  const { exit } = use_app_default();
766
768
  import_react.useEffect(() => {
@@ -873,7 +875,7 @@ ${binName} docs \u2014 v${package_default.version}
873
875
  }
874
876
  process.exit(0);
875
877
  } else if (args.command === "hook") {
876
- const { runHook } = await import("./hook-gw3vhv6s.js");
878
+ const { runHook } = await import("./hook-gj6j6zwj.js");
877
879
  await runHook();
878
880
  } else if (args.command === "artifact") {
879
881
  const artifactArgs = process.argv.slice(process.argv.indexOf("artifact") + 1);
@@ -893,7 +895,7 @@ ${binName} docs \u2014 v${package_default.version}
893
895
  printHelp("scripts");
894
896
  process.exit(scriptsArgs[0] === "reembed" || args.showHelp ? 0 : 1);
895
897
  }
896
- const { runScriptsMaintenanceCommand } = await import("./maintenance-xppxbe4t.js");
898
+ const { runScriptsMaintenanceCommand } = await import("./maintenance-9yrzmrh8.js");
897
899
  await runScriptsMaintenanceCommand(scriptsArgs);
898
900
  console.log("Scripts re-embedded.");
899
901
  } else if (args.command === "codex-login") {
@@ -2,11 +2,11 @@ import {
2
2
  getAllAgents,
3
3
  getAllTasks,
4
4
  init_db
5
- } from "./cli-0jw6j755.js";
5
+ } from "./cli-wztagmpk.js";
6
6
  import"./cli-z2zcxes1.js";
7
7
  import"./cli-q21d49ac.js";
8
8
  import"./cli-anrj584m.js";
9
- import"./cli-yjt8a36k.js";
9
+ import"./cli-ehcjr5vs.js";
10
10
  import"./cli-3pp1362w.js";
11
11
  import"./cli-p9swy5t3.js";
12
12
 
@@ -376,11 +376,11 @@ import {
376
376
  upsertSkillFile,
377
377
  upsertSkillFiles,
378
378
  upsertSwarmConfig
379
- } from "./cli-0jw6j755.js";
379
+ } from "./cli-wztagmpk.js";
380
380
  import"./cli-z2zcxes1.js";
381
381
  import"./cli-q21d49ac.js";
382
382
  import"./cli-anrj584m.js";
383
- import"./cli-yjt8a36k.js";
383
+ import"./cli-ehcjr5vs.js";
384
384
  import"./cli-3pp1362w.js";
385
385
  import"./cli-p9swy5t3.js";
386
386
  init_db();
@@ -3,24 +3,24 @@ import {
3
3
  getBufferMessageCount,
4
4
  instantFlush,
5
5
  wasEventSeen
6
- } from "./cli-etvgz5x8.js";
6
+ } from "./cli-zmta7t3y.js";
7
7
  import {
8
8
  extractSlackMessageText,
9
9
  extractTaskFromMessage,
10
10
  hasOtherUserMention,
11
11
  routeMessage
12
- } from "./cli-nzc0h54v.js";
12
+ } from "./cli-0n4xxmy0.js";
13
13
  import {
14
14
  registerTreeMessage
15
- } from "./cli-zaxksbgj.js";
15
+ } from "./cli-gzmv1371.js";
16
16
  import"./cli-fete3y1e.js";
17
17
  import"./cli-b0p7rfnd.js";
18
18
  import {
19
19
  enrichSlackUserEmail,
20
20
  resolveSlackUserId
21
- } from "./cli-2hap19dv.js";
22
- import"./cli-gj2n2ec1.js";
23
- import"./cli-yvektv79.js";
21
+ } from "./cli-ba47wf2q.js";
22
+ import"./cli-c4h8m0m3.js";
23
+ import"./cli-yfyqsqzj.js";
24
24
  import {
25
25
  buildTreeBlocks
26
26
  } from "./cli-z92pkwzn.js";
@@ -28,7 +28,7 @@ import"./cli-dh55d5fg.js";
28
28
  import {
29
29
  createTaskWithSiblingAwareness,
30
30
  slackContextKey
31
- } from "./cli-e7bwjntj.js";
31
+ } from "./cli-0s37sw3k.js";
32
32
  import {
33
33
  getAgentById,
34
34
  getAgentWorkingOnThread,
@@ -38,11 +38,11 @@ import {
38
38
  init_db,
39
39
  init_resolver,
40
40
  resolveTemplate
41
- } from "./cli-0jw6j755.js";
41
+ } from "./cli-wztagmpk.js";
42
42
  import"./cli-z2zcxes1.js";
43
43
  import"./cli-q21d49ac.js";
44
44
  import"./cli-anrj584m.js";
45
- import"./cli-yjt8a36k.js";
45
+ import"./cli-ehcjr5vs.js";
46
46
  import"./cli-3pp1362w.js";
47
47
  import"./cli-e15jhafb.js";
48
48
  import {
@@ -30,7 +30,7 @@ import"./cli-anrj584m.js";
30
30
  import {
31
31
  init_package,
32
32
  package_default
33
- } from "./cli-yjt8a36k.js";
33
+ } from "./cli-ehcjr5vs.js";
34
34
  import"./cli-3pp1362w.js";
35
35
  import"./cli-xw7p4wkq.js";
36
36
  import"./cli-4wgngmwv.js";
@@ -79,6 +79,7 @@ import {
79
79
  parseQueryParams,
80
80
  parseSkillContent,
81
81
  recordRetrievals,
82
+ recordSessionCost,
82
83
  registerJiraWebhook,
83
84
  reloadGlobalConfigsAndIntegrations,
84
85
  resolveHttpAuditUserId,
@@ -106,7 +107,7 @@ import {
106
107
  withRemoteContext,
107
108
  withSpanContext,
108
109
  writeSkillsToFilesystem
109
- } from "./cli-qvzgncd8.js";
110
+ } from "./cli-sdf2qwkt.js";
110
111
  import {
111
112
  BROWSER_SDK_JS,
112
113
  SWARM_UI_JS
@@ -129,27 +130,27 @@ import {
129
130
  generateRandomState,
130
131
  getOAuthApp,
131
132
  getOAuthTokens
132
- } from "./cli-2g9jf9ek.js";
133
- import"./cli-w1nfskkg.js";
133
+ } from "./cli-yd29d4n4.js";
134
+ import"./cli-8y7y1vmp.js";
134
135
  import {
135
136
  normalizeModelKey
136
- } from "./cli-7v4y3hyd.js";
137
+ } from "./cli-7esh9fda.js";
137
138
  import {
138
139
  SCRIPT_STDLIB_TYPES,
139
140
  extractArgsJsonSchema,
140
141
  extractScriptSignature,
141
142
  scriptSdkTypesWithGeneratedApis,
142
143
  typecheckScript
143
- } from "./cli-t9v14cnd.js";
144
+ } from "./cli-sm9yseh1.js";
144
145
  import {
145
146
  checkHeartbeatChecklist,
146
147
  runHeartbeatSweep,
147
148
  stopHeartbeat
148
- } from "./cli-d4z1csms.js";
149
+ } from "./cli-vpwffend.js";
149
150
  import {
150
151
  createResumeFollowUp,
151
152
  createWorkerTaskFollowUp
152
- } from "./cli-s42f54ja.js";
153
+ } from "./cli-87fj1jk4.js";
153
154
  import {
154
155
  RawLlmConfigSchema,
155
156
  buildScriptCredentialBindings,
@@ -160,7 +161,7 @@ import {
160
161
  retryFailedRun,
161
162
  runScript,
162
163
  snapshotWorkflow
163
- } from "./cli-54h5daha.js";
164
+ } from "./cli-v2fb1fxf.js";
164
165
  import {
165
166
  getApiKey
166
167
  } from "./cli-f14fvzag.js";
@@ -173,10 +174,10 @@ import {
173
174
  listScriptVersions,
174
175
  listScripts,
175
176
  upsertScriptByName
176
- } from "./cli-v1syqkcb.js";
177
+ } from "./cli-0e24r2b6.js";
177
178
  import {
178
179
  searchScripts
179
- } from "./cli-5pf0b84v.js";
180
+ } from "./cli-dd6tegmp.js";
180
181
  import {
181
182
  CANDIDATE_SET_MULTIPLIER,
182
183
  getEmbeddingProvider,
@@ -184,7 +185,7 @@ import {
184
185
  init_constants,
185
186
  init_reranker,
186
187
  rerank
187
- } from "./cli-p4cj4vhc.js";
188
+ } from "./cli-634jy7sa.js";
188
189
  import"./cli-3j01d33e.js";
189
190
  import"./cli-fad8m16k.js";
190
191
  import {
@@ -193,7 +194,7 @@ import {
193
194
  ensure,
194
195
  initialize,
195
196
  require_dist
196
- } from "./cli-y9p3e94h.js";
197
+ } from "./cli-yzr0qxx1.js";
197
198
  import {
198
199
  TriggerSchemaError,
199
200
  WebhookError,
@@ -205,18 +206,18 @@ import {
205
206
  validateDefinition,
206
207
  validateJsonSchema,
207
208
  verifyHmacSignature
208
- } from "./cli-zghef0em.js";
209
- import"./cli-nzc0h54v.js";
209
+ } from "./cli-gq7gvvrn.js";
210
+ import"./cli-0n4xxmy0.js";
210
211
  import {
211
212
  getSlackApp,
212
213
  startSlackApp,
213
214
  stopSlackApp
214
- } from "./cli-zaxksbgj.js";
215
+ } from "./cli-gzmv1371.js";
215
216
  import"./cli-fete3y1e.js";
216
217
  import"./cli-b0p7rfnd.js";
217
218
  import {
218
219
  recordUnmappedIdentity
219
- } from "./cli-gj2n2ec1.js";
220
+ } from "./cli-c4h8m0m3.js";
220
221
  import {
221
222
  findOrCreateUserByEmail,
222
223
  findUserByExternalId,
@@ -230,7 +231,7 @@ import {
230
231
  resolveUserByToken,
231
232
  revokeToken,
232
233
  unlinkIdentity
233
- } from "./cli-yvektv79.js";
234
+ } from "./cli-yfyqsqzj.js";
234
235
  import"./cli-z92pkwzn.js";
235
236
  import {
236
237
  getAppUrl,
@@ -243,7 +244,7 @@ import {
243
244
  createTaskWithSiblingAwareness,
244
245
  gitlabContextKey,
245
246
  pageContextKey
246
- } from "./cli-e7bwjntj.js";
247
+ } from "./cli-0s37sw3k.js";
247
248
  import {
248
249
  AgentCredStatusSchema,
249
250
  AgentLatestModelSchema,
@@ -536,7 +537,7 @@ import {
536
537
  upsertSkillFiles,
537
538
  upsertSwarmConfig,
538
539
  validateConfigValue
539
- } from "./cli-0jw6j755.js";
540
+ } from "./cli-wztagmpk.js";
540
541
  import"./cli-z2zcxes1.js";
541
542
  import {
542
543
  init_zod
@@ -551,7 +552,7 @@ import {
551
552
  import {
552
553
  init_package,
553
554
  package_default
554
- } from "./cli-yjt8a36k.js";
555
+ } from "./cli-ehcjr5vs.js";
555
556
  import {
556
557
  init_secret_scrubber,
557
558
  registerVolatileSecret,
@@ -9076,6 +9077,86 @@ function injectBrowserSdk(html) {
9076
9077
  }
9077
9078
  return injection + html;
9078
9079
  }
9080
+ var PRINT_AUTOTRIGGER_SCRIPT = `<script>
9081
+ (function () {
9082
+ function print() { setTimeout(function () { window.print(); }, 400); }
9083
+ window.addEventListener("load", function () {
9084
+ var fonts = document.fonts;
9085
+ if (fonts && fonts.ready && typeof fonts.ready.then === "function") {
9086
+ fonts.ready.then(print, print);
9087
+ } else {
9088
+ print();
9089
+ }
9090
+ });
9091
+ })();
9092
+ </script>`;
9093
+ function escapeHtml(value) {
9094
+ return value.replace(/[&<>"']/g, (char) => {
9095
+ switch (char) {
9096
+ case "&":
9097
+ return "&amp;";
9098
+ case "<":
9099
+ return "&lt;";
9100
+ case ">":
9101
+ return "&gt;";
9102
+ case '"':
9103
+ return "&quot;";
9104
+ default:
9105
+ return "&#39;";
9106
+ }
9107
+ });
9108
+ }
9109
+ function printableJsonPageHtml(page) {
9110
+ let body = page.body;
9111
+ try {
9112
+ body = JSON.stringify(JSON.parse(page.body), null, 2);
9113
+ } catch {}
9114
+ const description = page.description ? `<p class="description">${escapeHtml(page.description)}</p>` : "";
9115
+ return `<!doctype html>
9116
+ <html>
9117
+ <head>
9118
+ <meta charset="utf-8">
9119
+ <title>${escapeHtml(page.title)}</title>
9120
+ <style>
9121
+ body {
9122
+ color: #111827;
9123
+ font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
9124
+ line-height: 1.5;
9125
+ margin: 0;
9126
+ padding: 24px;
9127
+ }
9128
+ h1 {
9129
+ font-size: 24px;
9130
+ line-height: 1.2;
9131
+ margin: 0 0 8px;
9132
+ }
9133
+ .description {
9134
+ color: #4b5563;
9135
+ margin: 0 0 20px;
9136
+ }
9137
+ pre {
9138
+ background: #f8fafc;
9139
+ border: 1px solid #e5e7eb;
9140
+ border-radius: 6px;
9141
+ color: #111827;
9142
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
9143
+ font-size: 11px;
9144
+ line-height: 1.45;
9145
+ margin: 0;
9146
+ overflow-wrap: anywhere;
9147
+ padding: 16px;
9148
+ white-space: pre-wrap;
9149
+ }
9150
+ </style>
9151
+ </head>
9152
+ <body>
9153
+ <h1>${escapeHtml(page.title)}</h1>
9154
+ ${description}
9155
+ <pre>${escapeHtml(body)}</pre>
9156
+ ${PRINT_AUTOTRIGGER_SCRIPT}
9157
+ </body>
9158
+ </html>`;
9159
+ }
9079
9160
  function stripJsonSuffix(idSegment) {
9080
9161
  return idSegment.endsWith(".json") ? idSegment.slice(0, -".json".length) : null;
9081
9162
  }
@@ -9257,7 +9338,22 @@ async function handlePagesPublic(req, res, pathSegments, queryParams) {
9257
9338
  bumpViewCount(page.id);
9258
9339
  return true;
9259
9340
  }
9341
+ const wantsPrint = queryParams.get("print") === "1";
9260
9342
  if (page.contentType === "application/json") {
9343
+ if (wantsPrint) {
9344
+ const headers4 = {
9345
+ "Content-Type": "text/html; charset=utf-8",
9346
+ "Cache-Control": "no-store",
9347
+ "Content-Security-Policy": buildCsp(),
9348
+ "X-Content-Type-Options": "nosniff"
9349
+ };
9350
+ if (inlineSetCookie)
9351
+ headers4["Set-Cookie"] = inlineSetCookie;
9352
+ res.writeHead(200, headers4);
9353
+ res.end(printableJsonPageHtml(page));
9354
+ bumpViewCount(page.id);
9355
+ return true;
9356
+ }
9261
9357
  const headers3 = { Location: `${getAppBaseUrl2()}/pages/${page.id}` };
9262
9358
  if (inlineSetCookie)
9263
9359
  headers3["Set-Cookie"] = inlineSetCookie;
@@ -9265,7 +9361,7 @@ async function handlePagesPublic(req, res, pathSegments, queryParams) {
9265
9361
  res.end();
9266
9362
  return true;
9267
9363
  }
9268
- const html = injectBrowserSdk(page.body);
9364
+ const html = injectBrowserSdk(page.body) + (wantsPrint ? PRINT_AUTOTRIGGER_SCRIPT : "");
9269
9365
  const headers2 = {
9270
9366
  "Content-Type": "text/html; charset=utf-8",
9271
9367
  "Cache-Control": "no-store",
@@ -12025,6 +12121,21 @@ async function handleSessionData(req, res, pathSegments, queryParams, _myAgentId
12025
12121
  isError: parsed.body.isError ?? false,
12026
12122
  costSource
12027
12123
  });
12124
+ recordSessionCost({
12125
+ totalCostUsd,
12126
+ harness: parsed.body.provider ?? "unknown",
12127
+ model,
12128
+ costSource,
12129
+ isError: parsed.body.isError ?? false,
12130
+ tokens: {
12131
+ input: inputTokens,
12132
+ output: outputTokens,
12133
+ cacheRead: cachedInputTokens,
12134
+ cacheWrite: parsed.body.cacheWriteTokens ?? 0,
12135
+ reasoning: parsed.body.reasoningOutputTokens ?? 0,
12136
+ thinking: parsed.body.thinkingTokens ?? 0
12137
+ }
12138
+ });
12028
12139
  incrementServerSessionsProcessed();
12029
12140
  json(res, { success: true, cost }, 201);
12030
12141
  } catch (error) {
@@ -17131,14 +17242,14 @@ async function shutdown() {
17131
17242
  sessionsProcessed: getServerSessionsProcessed()
17132
17243
  });
17133
17244
  if (hasCapability("scheduling")) {
17134
- const { stopScheduler } = await import("./index-xf6fp4y1.js");
17245
+ const { stopScheduler } = await import("./index-0rfp6wh2.js");
17135
17246
  stopScheduler();
17136
17247
  }
17137
17248
  stopHeartbeat();
17138
17249
  stopScriptRunSupervisor();
17139
17250
  await stopSlackApp();
17140
17251
  if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
17141
- const { stopOAuthKeepalive } = await import("./keepalive-mj4302vw.js");
17252
+ const { stopOAuthKeepalive } = await import("./keepalive-akbzjt41.js");
17142
17253
  await stopOAuthKeepalive();
17143
17254
  }
17144
17255
  stopMcpOAuthPendingGc();
@@ -17190,15 +17301,15 @@ try {
17190
17301
  throw err;
17191
17302
  }
17192
17303
  try {
17193
- const { seedPricingFromModelsDev } = await import("./seed-pricing-w3x550cj.js");
17304
+ const { seedPricingFromModelsDev } = await import("./seed-pricing-183er9b3.js");
17194
17305
  seedPricingFromModelsDev();
17195
- const { startPricingRefreshLoop } = await import("./pricing-refresh-nqyf8bkb.js");
17306
+ const { startPricingRefreshLoop } = await import("./pricing-refresh-dt289v11.js");
17196
17307
  startPricingRefreshLoop();
17197
17308
  } catch (err) {
17198
17309
  console.error("[startup] Failed to seed pricing rows:", err);
17199
17310
  }
17200
17311
  try {
17201
- const { runAllSeeders } = await import("./index-jca7jdpt.js");
17312
+ const { runAllSeeders } = await import("./index-wf0q4k03.js");
17202
17313
  await runAllSeeders({ scriptEmbeddingMode: "skip" });
17203
17314
  } catch (err) {
17204
17315
  console.error("[startup] Failed to seed built-in entities:", err);
@@ -17231,31 +17342,31 @@ httpServer.listen(port, async () => {
17231
17342
  initWorkflows();
17232
17343
  startScriptRunSupervisor(getMcpBaseUrl());
17233
17344
  if (hasCapability("scheduling")) {
17234
- const { startScheduler } = await import("./index-xf6fp4y1.js");
17235
- const { getExecutorRegistry: getExecutorRegistry2 } = await import("./index-881c1baf.js");
17345
+ const { startScheduler } = await import("./index-0rfp6wh2.js");
17346
+ const { getExecutorRegistry: getExecutorRegistry2 } = await import("./index-paaw4xt5.js");
17236
17347
  const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
17237
17348
  startScheduler(getExecutorRegistry2(), intervalMs, {
17238
17349
  runId: globalState.__runId
17239
17350
  });
17240
17351
  }
17241
17352
  if (process.env.HEARTBEAT_DISABLE !== "true") {
17242
- const { startHeartbeat } = await import("./index-xz8vaa5c.js");
17353
+ const { startHeartbeat } = await import("./index-as4evz9g.js");
17243
17354
  const heartbeatMs = Number(process.env.HEARTBEAT_INTERVAL_MS) || 90000;
17244
17355
  startHeartbeat(heartbeatMs);
17245
17356
  }
17246
17357
  if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
17247
- const { startOAuthKeepalive } = await import("./keepalive-mj4302vw.js");
17358
+ const { startOAuthKeepalive } = await import("./keepalive-akbzjt41.js");
17248
17359
  startOAuthKeepalive();
17249
17360
  }
17250
17361
  startMcpOAuthPendingGc();
17251
17362
  startMemoryGc();
17252
- import("./boot-reembed-9kt97g1z.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
17363
+ import("./boot-reembed-f38vbxw8.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
17253
17364
  console.error("[boot-reembed] startup backfill failed (non-fatal):", err);
17254
17365
  });
17255
- import("./boot-reembed-3q1aywnz.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
17366
+ import("./boot-reembed-rp2gba79.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
17256
17367
  console.error("[boot-reembed-scripts] startup backfill failed (non-fatal):", err);
17257
17368
  });
17258
- import("./boot-scrub-logs-vskq108e.js").then(({ runBootScrubLogs }) => runBootScrubLogs()).catch((err) => {
17369
+ import("./boot-scrub-logs-nsnc9f1a.js").then(({ runBootScrubLogs }) => runBootScrubLogs()).catch((err) => {
17259
17370
  console.error("[boot-scrub-logs] startup scrub failed (non-fatal):", err);
17260
17371
  });
17261
17372
  }).on("error", (err) => {
@@ -3,14 +3,14 @@ import {
3
3
  runScheduleNow,
4
4
  startScheduler,
5
5
  stopScheduler
6
- } from "./cli-y9p3e94h.js";
7
- import"./cli-zghef0em.js";
8
- import"./cli-e7bwjntj.js";
9
- import"./cli-0jw6j755.js";
6
+ } from "./cli-yzr0qxx1.js";
7
+ import"./cli-gq7gvvrn.js";
8
+ import"./cli-0s37sw3k.js";
9
+ import"./cli-wztagmpk.js";
10
10
  import"./cli-z2zcxes1.js";
11
11
  import"./cli-q21d49ac.js";
12
12
  import"./cli-anrj584m.js";
13
- import"./cli-yjt8a36k.js";
13
+ import"./cli-ehcjr5vs.js";
14
14
  import"./cli-3pp1362w.js";
15
15
  import"./cli-p9swy5t3.js";
16
16
  export {