@warlock.js/devtools 5.59.0 → 5.60.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 (139) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/cjs/{app-versions-DfpPZOI2.cjs → app-versions-C_ZyzuvD.cjs} +1 -116
  3. package/cjs/app-versions-C_ZyzuvD.cjs.map +1 -0
  4. package/cjs/attach-D5aMqUnA.cjs +1342 -0
  5. package/cjs/attach-D5aMqUnA.cjs.map +1 -0
  6. package/cjs/{auth-B3wyjJnQ.cjs → auth-ChHh5E7j.cjs} +6 -6
  7. package/cjs/{auth-B3wyjJnQ.cjs.map → auth-ChHh5E7j.cjs.map} +1 -1
  8. package/cjs/{boot-nczSvJ_F.cjs → boot-Dg5YZGGR.cjs} +77 -14
  9. package/cjs/boot-Dg5YZGGR.cjs.map +1 -0
  10. package/cjs/{capture-CuyT8Vab.cjs → capture-CBgONYhk.cjs} +4 -4
  11. package/cjs/{capture-CuyT8Vab.cjs.map → capture-CBgONYhk.cjs.map} +1 -1
  12. package/cjs/{cascade-store-CuRRYzt_.cjs → cascade-store-DUT2Laha.cjs} +3 -3
  13. package/cjs/{cascade-store-CuRRYzt_.cjs.map → cascade-store-DUT2Laha.cjs.map} +1 -1
  14. package/cjs/{current-request-id-CeQhRz9Q.cjs → current-request-id-Badec-TH.cjs} +2 -2
  15. package/cjs/{current-request-id-CeQhRz9Q.cjs.map → current-request-id-Badec-TH.cjs.map} +1 -1
  16. package/cjs/{errors-BadbSDX8.cjs → errors-DNQ-g49I.cjs} +198 -1
  17. package/cjs/errors-DNQ-g49I.cjs.map +1 -0
  18. package/cjs/extract-8kaX_cUV.cjs +1103 -0
  19. package/cjs/extract-8kaX_cUV.cjs.map +1 -0
  20. package/cjs/{histogram-DTOGnNBW.cjs → histogram-CkoVizdf.cjs} +6 -6
  21. package/cjs/{histogram-DTOGnNBW.cjs.map → histogram-CkoVizdf.cjs.map} +1 -1
  22. package/cjs/{http-Biauhqi0.cjs → http-DCVCf44M.cjs} +25 -8
  23. package/cjs/http-DCVCf44M.cjs.map +1 -0
  24. package/cjs/index.cjs +1 -1
  25. package/cjs/{insights-BjJA6Ret.cjs → insights-CFof59kF.cjs} +3 -3
  26. package/cjs/{insights-BjJA6Ret.cjs.map → insights-CFof59kF.cjs.map} +1 -1
  27. package/cjs/migrations-BQdNOL5_.cjs +30 -0
  28. package/cjs/migrations-BQdNOL5_.cjs.map +1 -0
  29. package/cjs/{migrations-BP4cYTGo.cjs → models-DF1agAm4.cjs} +106 -24
  30. package/cjs/models-DF1agAm4.cjs.map +1 -0
  31. package/cjs/{process-panel-DskSA7Cm.cjs → process-panel-D3D9Y_dc.cjs} +4 -4
  32. package/cjs/{process-panel-DskSA7Cm.cjs.map → process-panel-D3D9Y_dc.cjs.map} +1 -1
  33. package/cjs/production/index.cjs +4 -4
  34. package/cjs/runs-DECWPGnq.cjs +390 -0
  35. package/cjs/runs-DECWPGnq.cjs.map +1 -0
  36. package/cjs/{server-D3XRbSSb.cjs → server-CC5DpObz.cjs} +8 -7
  37. package/cjs/{server-D3XRbSSb.cjs.map → server-CC5DpObz.cjs.map} +1 -1
  38. package/cjs/{src-QcNghoYN.cjs → src-VyOjEEAo.cjs} +178 -23
  39. package/cjs/src-VyOjEEAo.cjs.map +1 -0
  40. package/cjs/{store-CNFv3wVp.cjs → store-EFn4wp0T.cjs} +2 -2
  41. package/cjs/{stream-route-BqyAlfxQ.cjs → stream-route-DFHuIWgg.cjs} +107 -15
  42. package/cjs/stream-route-DFHuIWgg.cjs.map +1 -0
  43. package/esm/ai/attach.mjs +92 -0
  44. package/esm/ai/attach.mjs.map +1 -0
  45. package/esm/ai/options.mjs +31 -0
  46. package/esm/ai/options.mjs.map +1 -0
  47. package/esm/ai/reports/aggregate.mjs +330 -0
  48. package/esm/ai/reports/aggregate.mjs.map +1 -0
  49. package/esm/ai/reports/evaluate.mjs +108 -0
  50. package/esm/ai/reports/evaluate.mjs.map +1 -0
  51. package/esm/ai/reports/range.mjs +121 -0
  52. package/esm/ai/reports/range.mjs.map +1 -0
  53. package/esm/ai/reports/runs.d.mts +2 -0
  54. package/esm/ai/reports/runs.mjs +212 -0
  55. package/esm/ai/reports/runs.mjs.map +1 -0
  56. package/esm/ai/reports/service.mjs +132 -0
  57. package/esm/ai/reports/service.mjs.map +1 -0
  58. package/esm/ai/rollup/cascade-store.mjs +84 -0
  59. package/esm/ai/rollup/cascade-store.mjs.map +1 -0
  60. package/esm/ai/rollup/categories.mjs +67 -0
  61. package/esm/ai/rollup/categories.mjs.map +1 -0
  62. package/esm/ai/rollup/extract.mjs +225 -0
  63. package/esm/ai/rollup/extract.mjs.map +1 -0
  64. package/esm/ai/rollup/file-store.mjs +147 -0
  65. package/esm/ai/rollup/file-store.mjs.map +1 -0
  66. package/esm/ai/rollup/histogram.mjs +42 -0
  67. package/esm/ai/rollup/histogram.mjs.map +1 -0
  68. package/esm/ai/rollup/increment-error.mjs +19 -0
  69. package/esm/ai/rollup/increment-error.mjs.map +1 -0
  70. package/esm/ai/rollup/index.mjs +9 -0
  71. package/esm/ai/rollup/mapping.mjs +69 -0
  72. package/esm/ai/rollup/mapping.mjs.map +1 -0
  73. package/esm/ai/rollup/memory-store.mjs +26 -0
  74. package/esm/ai/rollup/memory-store.mjs.map +1 -0
  75. package/esm/ai/rollup/writer.mjs +113 -0
  76. package/esm/ai/rollup/writer.mjs.map +1 -0
  77. package/esm/ai/types.d.mts +29 -0
  78. package/esm/ai/types.d.mts.map +1 -0
  79. package/esm/devtools-connector.d.mts.map +1 -1
  80. package/esm/devtools-connector.mjs +54 -2
  81. package/esm/devtools-connector.mjs.map +1 -1
  82. package/esm/index.d.mts +3 -2
  83. package/esm/options.mjs +4 -0
  84. package/esm/options.mjs.map +1 -1
  85. package/esm/production/boot.mjs +69 -3
  86. package/esm/production/boot.mjs.map +1 -1
  87. package/esm/production/contracts.d.mts +371 -2
  88. package/esm/production/contracts.d.mts.map +1 -1
  89. package/esm/production/contracts.mjs +64 -2
  90. package/esm/production/contracts.mjs.map +1 -1
  91. package/esm/production/errors.mjs +8 -0
  92. package/esm/production/errors.mjs.map +1 -1
  93. package/esm/production/http/access.mjs +6 -0
  94. package/esm/production/http/access.mjs.map +1 -1
  95. package/esm/production/http/mount.mjs +13 -0
  96. package/esm/production/http/mount.mjs.map +1 -1
  97. package/esm/production/index.d.mts +2 -2
  98. package/esm/production/store/migrations.d.mts +1 -1
  99. package/esm/production/store/migrations.d.mts.map +1 -1
  100. package/esm/production/store/migrations.mjs +4 -2
  101. package/esm/production/store/migrations.mjs.map +1 -1
  102. package/esm/production/store/models/ai-rollup.migration.mjs +48 -0
  103. package/esm/production/store/models/ai-rollup.migration.mjs.map +1 -0
  104. package/esm/production/store/models/ai-rollup.model.mjs +13 -0
  105. package/esm/production/store/models/ai-rollup.model.mjs.map +1 -0
  106. package/esm/production/store/models/index.mjs +3 -1
  107. package/esm/server/ai-report-routes.mjs +72 -0
  108. package/esm/server/ai-report-routes.mjs.map +1 -0
  109. package/esm/server/ai-routes.mjs +22 -1
  110. package/esm/server/ai-routes.mjs.map +1 -1
  111. package/esm/server/index.mjs +2 -0
  112. package/esm/server/index.mjs.map +1 -1
  113. package/esm/sources/agent-trace-source.d.mts.map +1 -1
  114. package/esm/sources/agent-trace-source.mjs.map +1 -1
  115. package/esm/sources/ai-source.d.mts +2 -0
  116. package/esm/sources/ai-source.d.mts.map +1 -1
  117. package/esm/sources/ai-source.mjs +58 -17
  118. package/esm/sources/ai-source.mjs.map +1 -1
  119. package/esm/types.d.mts +13 -3
  120. package/esm/types.d.mts.map +1 -1
  121. package/llms-full.txt +56 -17
  122. package/package.json +8 -8
  123. package/skills/SKILL.md +56 -17
  124. package/ui/dashboard/assets/app.css +1 -1
  125. package/ui/dashboard/assets/app.js +12 -5
  126. package/ui/dashboard/build-info.json +7 -7
  127. package/cjs/ai-source-BdvMfyKw.cjs +0 -448
  128. package/cjs/ai-source-BdvMfyKw.cjs.map +0 -1
  129. package/cjs/app-versions-DfpPZOI2.cjs.map +0 -1
  130. package/cjs/boot-nczSvJ_F.cjs.map +0 -1
  131. package/cjs/errors-BadbSDX8.cjs.map +0 -1
  132. package/cjs/http-Biauhqi0.cjs.map +0 -1
  133. package/cjs/migrations-BP4cYTGo.cjs.map +0 -1
  134. package/cjs/options-B9FHbRAJ.cjs +0 -205
  135. package/cjs/options-B9FHbRAJ.cjs.map +0 -1
  136. package/cjs/panels-D1ITm-jc.cjs +0 -384
  137. package/cjs/panels-D1ITm-jc.cjs.map +0 -1
  138. package/cjs/src-QcNghoYN.cjs.map +0 -1
  139. package/cjs/stream-route-BqyAlfxQ.cjs.map +0 -1
@@ -1,4 +1,5 @@
1
- const require_app_versions = require("./app-versions-DfpPZOI2.cjs");
1
+ const require_app_versions = require("./app-versions-C_ZyzuvD.cjs");
2
+ const require_errors = require("./errors-DNQ-g49I.cjs");
2
3
  let _warlock_js_cascade = require("@warlock.js/cascade");
3
4
 
4
5
  //#region ../../packages/devtools/src/production/store/models/base.ts
@@ -23,6 +24,57 @@ var DevtoolsRowModel = class extends _warlock_js_cascade.Model {
23
24
  }
24
25
  };
25
26
 
27
+ //#endregion
28
+ //#region ../../packages/devtools/src/production/store/models/ai-rollup.model.ts
29
+ /** A row of `devtools_ai_rollups`: hourly AI counters per agent, model and provider. */
30
+ var DevtoolsAiRollupRow = class extends DevtoolsRowModel {
31
+ static {
32
+ this.table = "devtools_ai_rollups";
33
+ }
34
+ };
35
+
36
+ //#endregion
37
+ //#region ../../packages/devtools/src/production/store/models/ai-rollup.migration.ts
38
+ const DevtoolsAiRollupsMigration = (0, _warlock_js_cascade.migrate)(DevtoolsAiRollupRow, {
39
+ name: "devtoolsAiRollups",
40
+ up() {
41
+ this.createTableIfNotExists();
42
+ this.string("id", 64).primary().unique();
43
+ this.bigInteger("hour").index();
44
+ this.string("agent", 200).index();
45
+ this.string("model", 200).index();
46
+ this.string("provider", 100);
47
+ for (const column of [
48
+ "runs",
49
+ "completed",
50
+ "failed",
51
+ "incomplete",
52
+ "cancelled"
53
+ ]) this.integer(column).default(0);
54
+ for (const column of [
55
+ "input_tokens",
56
+ "output_tokens",
57
+ "cached_tokens",
58
+ "cache_write_tokens",
59
+ "reasoning_tokens"
60
+ ]) this.bigInteger(column).default(0);
61
+ this.double("cost_usd").default(0);
62
+ this.integer("priced_runs").default(0);
63
+ this.integer("unpriced_runs").default(0);
64
+ this.bigInteger("unpriced_tokens").default(0);
65
+ this.integer("fallback_runs").default(0);
66
+ this.integer("refusals").default(0);
67
+ for (const category of require_errors.DEVTOOLS_AI_ERROR_CATEGORIES) this.integer(`err_${category.replaceAll("-", "_")}`).default(0);
68
+ for (let index = 0; index <= require_errors.DEVTOOLS_AI_LATENCY_BUCKETS_MS.length; index++) this.integer(`lat_${index}`).default(0);
69
+ this.integer("latency_count").default(0);
70
+ this.double("latency_sum_ms").default(0);
71
+ this.bigInteger("updated_at");
72
+ },
73
+ down() {
74
+ this.dropTableIfExists();
75
+ }
76
+ });
77
+
26
78
  //#endregion
27
79
  //#region ../../packages/devtools/src/production/store/models/account.model.ts
28
80
  /** A row of `devtools_accounts`. */
@@ -279,6 +331,8 @@ const DevtoolsStateMigration = (0, _warlock_js_cascade.migrate)(DevtoolsStateRow
279
331
  var models_exports = /* @__PURE__ */ require_app_versions.__exportAll({
280
332
  DevtoolsAccountRow: () => DevtoolsAccountRow,
281
333
  DevtoolsAccountsMigration: () => DevtoolsAccountsMigration,
334
+ DevtoolsAiRollupRow: () => DevtoolsAiRollupRow,
335
+ DevtoolsAiRollupsMigration: () => DevtoolsAiRollupsMigration,
282
336
  DevtoolsAuditMigration: () => DevtoolsAuditMigration,
283
337
  DevtoolsAuditRow: () => DevtoolsAuditRow,
284
338
  DevtoolsInviteRow: () => DevtoolsInviteRow,
@@ -297,30 +351,58 @@ var models_exports = /* @__PURE__ */ require_app_versions.__exportAll({
297
351
  });
298
352
 
299
353
  //#endregion
300
- //#region ../../packages/devtools/src/production/store/migrations.ts
301
- /**
302
- * The migrations of the production monitor's tables/collections:
303
- * `devtools_accounts`, `devtools_sessions`, `devtools_invites`,
304
- * `devtools_audit`, `devtools_state`, `devtools_samples`, `devtools_reports`,
305
- * `devtools_shares`.
306
- * An app lists them in `warlock.config.ts > database.migrations`.
307
- */
308
- const devtoolsMigrations = [
309
- DevtoolsAccountsMigration,
310
- DevtoolsSessionsMigration,
311
- DevtoolsInvitesMigration,
312
- DevtoolsAuditMigration,
313
- DevtoolsStateMigration,
314
- DevtoolsSamplesMigration,
315
- DevtoolsReportsMigration,
316
- DevtoolsSharesMigration
317
- ];
318
-
319
- //#endregion
320
- Object.defineProperty(exports, "devtoolsMigrations", {
354
+ Object.defineProperty(exports, "DevtoolsAccountsMigration", {
355
+ enumerable: true,
356
+ get: function () {
357
+ return DevtoolsAccountsMigration;
358
+ }
359
+ });
360
+ Object.defineProperty(exports, "DevtoolsAiRollupsMigration", {
361
+ enumerable: true,
362
+ get: function () {
363
+ return DevtoolsAiRollupsMigration;
364
+ }
365
+ });
366
+ Object.defineProperty(exports, "DevtoolsAuditMigration", {
367
+ enumerable: true,
368
+ get: function () {
369
+ return DevtoolsAuditMigration;
370
+ }
371
+ });
372
+ Object.defineProperty(exports, "DevtoolsInvitesMigration", {
373
+ enumerable: true,
374
+ get: function () {
375
+ return DevtoolsInvitesMigration;
376
+ }
377
+ });
378
+ Object.defineProperty(exports, "DevtoolsReportsMigration", {
379
+ enumerable: true,
380
+ get: function () {
381
+ return DevtoolsReportsMigration;
382
+ }
383
+ });
384
+ Object.defineProperty(exports, "DevtoolsSamplesMigration", {
385
+ enumerable: true,
386
+ get: function () {
387
+ return DevtoolsSamplesMigration;
388
+ }
389
+ });
390
+ Object.defineProperty(exports, "DevtoolsSessionsMigration", {
391
+ enumerable: true,
392
+ get: function () {
393
+ return DevtoolsSessionsMigration;
394
+ }
395
+ });
396
+ Object.defineProperty(exports, "DevtoolsSharesMigration", {
397
+ enumerable: true,
398
+ get: function () {
399
+ return DevtoolsSharesMigration;
400
+ }
401
+ });
402
+ Object.defineProperty(exports, "DevtoolsStateMigration", {
321
403
  enumerable: true,
322
404
  get: function () {
323
- return devtoolsMigrations;
405
+ return DevtoolsStateMigration;
324
406
  }
325
407
  });
326
408
  Object.defineProperty(exports, "models_exports", {
@@ -329,4 +411,4 @@ Object.defineProperty(exports, "models_exports", {
329
411
  return models_exports;
330
412
  }
331
413
  });
332
- //# sourceMappingURL=migrations-BP4cYTGo.cjs.map
414
+ //# sourceMappingURL=models-DF1agAm4.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models-DF1agAm4.cjs","names":["Model","migrate","DEVTOOLS_AI_ERROR_CATEGORIES","DEVTOOLS_AI_LATENCY_BUCKETS_MS","migrate","migrate","migrate","migrate","migrate","migrate","migrate","migrate"],"sources":["../../../../../../../packages/devtools/src/production/store/models/base.ts","../../../../../../../packages/devtools/src/production/store/models/ai-rollup.model.ts","../../../../../../../packages/devtools/src/production/store/models/ai-rollup.migration.ts","../../../../../../../packages/devtools/src/production/store/models/account.model.ts","../../../../../../../packages/devtools/src/production/store/models/account.migration.ts","../../../../../../../packages/devtools/src/production/store/models/audit.model.ts","../../../../../../../packages/devtools/src/production/store/models/audit.migration.ts","../../../../../../../packages/devtools/src/production/store/models/invite.model.ts","../../../../../../../packages/devtools/src/production/store/models/invite.migration.ts","../../../../../../../packages/devtools/src/production/store/models/report.model.ts","../../../../../../../packages/devtools/src/production/store/models/report.migration.ts","../../../../../../../packages/devtools/src/production/store/models/sample.model.ts","../../../../../../../packages/devtools/src/production/store/models/sample.migration.ts","../../../../../../../packages/devtools/src/production/store/models/session.model.ts","../../../../../../../packages/devtools/src/production/store/models/session.migration.ts","../../../../../../../packages/devtools/src/production/store/models/share.model.ts","../../../../../../../packages/devtools/src/production/store/models/share.migration.ts","../../../../../../../packages/devtools/src/production/store/models/state.model.ts","../../../../../../../packages/devtools/src/production/store/models/state.migration.ts","../../../../../../../packages/devtools/src/production/store/models/index.ts"],"sourcesContent":["import { Model } from \"@warlock.js/cascade\";\n\n/**\n * Settings shared by the monitor's tables. Ids are supplied by the store\n * (random uuids, or `\"state\"`), times are plain epoch-millisecond columns the\n * store writes itself, and a removal is always permanent: sessions, invites\n * and samples must not be copied into a trash table.\n */\nexport abstract class DevtoolsRowModel extends Model {\n public static autoGenerateId = false;\n\n public static createdAtColumn = false as const;\n\n public static updatedAtColumn = false as const;\n\n public static deleteStrategy = \"permanent\" as const;\n}\n","import { DevtoolsRowModel } from \"./base\";\n\n/** A row of `devtools_ai_rollups`: hourly AI counters per agent, model and provider. */\nexport class DevtoolsAiRollupRow extends DevtoolsRowModel {\n public static table = \"devtools_ai_rollups\";\n}\n","import { migrate } from \"@warlock.js/cascade\";\nimport { DEVTOOLS_AI_ERROR_CATEGORIES, DEVTOOLS_AI_LATENCY_BUCKETS_MS } from \"../../contracts\";\nimport { DevtoolsAiRollupRow } from \"./ai-rollup.model\";\n\nexport const DevtoolsAiRollupsMigration = migrate(DevtoolsAiRollupRow, {\n name: \"devtoolsAiRollups\",\n up() {\n this.createTableIfNotExists();\n\n // The id is `rollupId(key)`; `unique` also covers MongoDB, which ignores primary keys.\n this.string(\"id\", 64).primary().unique();\n\n this.bigInteger(\"hour\").index();\n this.string(\"agent\", 200).index();\n this.string(\"model\", 200).index();\n this.string(\"provider\", 100);\n\n for (const column of [\"runs\", \"completed\", \"failed\", \"incomplete\", \"cancelled\"]) {\n this.integer(column).default(0);\n }\n\n for (const column of [\n \"input_tokens\",\n \"output_tokens\",\n \"cached_tokens\",\n \"cache_write_tokens\",\n \"reasoning_tokens\",\n ]) {\n this.bigInteger(column).default(0);\n }\n\n this.double(\"cost_usd\").default(0);\n this.integer(\"priced_runs\").default(0);\n this.integer(\"unpriced_runs\").default(0);\n this.bigInteger(\"unpriced_tokens\").default(0);\n this.integer(\"fallback_runs\").default(0);\n this.integer(\"refusals\").default(0);\n\n for (const category of DEVTOOLS_AI_ERROR_CATEGORIES) {\n this.integer(`err_${category.replaceAll(\"-\", \"_\")}`).default(0);\n }\n\n for (let index = 0; index <= DEVTOOLS_AI_LATENCY_BUCKETS_MS.length; index++) {\n this.integer(`lat_${index}`).default(0);\n }\n\n this.integer(\"latency_count\").default(0);\n this.double(\"latency_sum_ms\").default(0);\n this.bigInteger(\"updated_at\");\n },\n down() {\n this.dropTableIfExists();\n },\n});\n","import { DevtoolsRowModel } from \"./base\";\n\n/** A row of `devtools_accounts`. */\nexport class DevtoolsAccountRow extends DevtoolsRowModel {\n public static table = \"devtools_accounts\";\n}\n","import { migrate } from \"@warlock.js/cascade\";\nimport { DevtoolsAccountRow } from \"./account.model\";\n\nexport const DevtoolsAccountsMigration = migrate(DevtoolsAccountRow, {\n name: \"devtoolsAccounts\",\n up() {\n this.createTableIfNotExists();\n\n // The id is a string the store supplies; `unique` also covers MongoDB,\n // which ignores primary keys.\n this.string(\"id\", 64).primary().unique();\n\n this.string(\"email\", 320).unique();\n this.string(\"role\", 16);\n this.text(\"password_hash\");\n this.string(\"password_source\", 32);\n this.boolean(\"must_change_password\").default(false);\n this.text(\"totp_secret\").nullable();\n this.bigInteger(\"totp_enabled_at\").nullable();\n this.bigInteger(\"totp_last_step\").nullable();\n this.json(\"recovery_codes\");\n this.json(\"passkeys\");\n this.bigInteger(\"failures_reset_at\").nullable();\n this.bigInteger(\"created_at\");\n this.bigInteger(\"updated_at\");\n this.bigInteger(\"last_login_at\").nullable();\n this.string(\"created_by\", 64).nullable();\n this.integer(\"version\").default(1);\n },\n down() {\n this.dropTableIfExists();\n },\n});\n","import { DevtoolsRowModel } from \"./base\";\n\n/** A row of `devtools_audit`. */\nexport class DevtoolsAuditRow extends DevtoolsRowModel {\n public static table = \"devtools_audit\";\n}\n","import { migrate } from \"@warlock.js/cascade\";\nimport { DevtoolsAuditRow } from \"./audit.model\";\n\nexport const DevtoolsAuditMigration = migrate(DevtoolsAuditRow, {\n name: \"devtoolsAudit\",\n up() {\n this.createTableIfNotExists();\n\n // The id is a string the store supplies; `unique` also covers MongoDB,\n // which ignores primary keys.\n this.string(\"id\", 64).primary().unique();\n\n this.string(\"type\", 64);\n this.bigInteger(\"occurred_at\").index();\n this.string(\"account_id\", 64).nullable();\n this.string(\"email\", 320).nullable();\n this.string(\"ip\", 64).nullable();\n // The per-IP sign-in limit counts by this: the address, or its /64 for IPv6.\n this.string(\"ip_bucket\", 64).nullable();\n this.string(\"user_agent\", 255).nullable();\n this.json(\"detail\");\n this.string(\"ref\", 16);\n\n this.index([\"type\", \"occurred_at\"]);\n this.index([\"ip_bucket\", \"occurred_at\"]);\n this.index([\"account_id\", \"occurred_at\"]);\n },\n down() {\n this.dropTableIfExists();\n },\n});\n","import { DevtoolsRowModel } from \"./base\";\n\n/** A row of `devtools_invites`. */\nexport class DevtoolsInviteRow extends DevtoolsRowModel {\n public static table = \"devtools_invites\";\n}\n","import { migrate } from \"@warlock.js/cascade\";\nimport { DevtoolsInviteRow } from \"./invite.model\";\n\nexport const DevtoolsInvitesMigration = migrate(DevtoolsInviteRow, {\n name: \"devtoolsInvites\",\n up() {\n this.createTableIfNotExists();\n\n // The id is a string the store supplies; `unique` also covers MongoDB,\n // which ignores primary keys.\n this.string(\"id\", 64).primary().unique();\n\n this.string(\"token_hash\", 64).unique();\n this.string(\"email\", 320);\n this.string(\"role\", 16);\n this.string(\"created_by\", 64).nullable();\n this.bigInteger(\"created_at\");\n this.bigInteger(\"expires_at\").index();\n this.bigInteger(\"used_at\").nullable();\n this.string(\"account_id\", 64).nullable();\n },\n down() {\n this.dropTableIfExists();\n },\n});\n","import { DevtoolsRowModel } from \"./base\";\n\n/** A row of `devtools_reports`. */\nexport class DevtoolsReportRow extends DevtoolsRowModel {\n public static table = \"devtools_reports\";\n}\n","import { migrate } from \"@warlock.js/cascade\";\nimport { DevtoolsReportRow } from \"./report.model\";\n\nexport const DevtoolsReportsMigration = migrate(DevtoolsReportRow, {\n name: \"devtoolsReports\",\n up() {\n this.createTableIfNotExists();\n\n // The id is a string the store supplies; `unique` also covers MongoDB,\n // which ignores primary keys.\n this.string(\"id\", 64).primary().unique();\n\n this.bigInteger(\"seen_at\").index();\n // JSON text, up to 256 KB.\n this.longText(\"data\");\n },\n down() {\n this.dropTableIfExists();\n },\n});\n","import { DevtoolsRowModel } from \"./base\";\n\n/** A row of `devtools_samples`. */\nexport class DevtoolsSampleRow extends DevtoolsRowModel {\n public static table = \"devtools_samples\";\n}\n","import { migrate } from \"@warlock.js/cascade\";\nimport { DevtoolsSampleRow } from \"./sample.model\";\n\nexport const DevtoolsSamplesMigration = migrate(DevtoolsSampleRow, {\n name: \"devtoolsSamples\",\n up() {\n this.createTableIfNotExists();\n\n // The id is a string the store supplies; `unique` also covers MongoDB,\n // which ignores primary keys.\n this.string(\"id\", 64).primary().unique();\n\n this.string(\"instance\", 128).index();\n this.bigInteger(\"started_at\").index();\n this.integer(\"status\").nullable().index();\n this.string(\"method\", 16);\n this.text(\"path\");\n this.json(\"summary\");\n // JSON text: request data may hold keys MongoDB cannot store as field names.\n this.longText(\"detail\").nullable();\n },\n down() {\n this.dropTableIfExists();\n },\n});\n","import { DevtoolsRowModel } from \"./base\";\n\n/** A row of `devtools_sessions`. */\nexport class DevtoolsSessionRow extends DevtoolsRowModel {\n public static table = \"devtools_sessions\";\n}\n","import { migrate } from \"@warlock.js/cascade\";\nimport { DevtoolsSessionRow } from \"./session.model\";\n\nexport const DevtoolsSessionsMigration = migrate(DevtoolsSessionRow, {\n name: \"devtoolsSessions\",\n up() {\n this.createTableIfNotExists();\n\n // The id is a string the store supplies; `unique` also covers MongoDB,\n // which ignores primary keys.\n this.string(\"id\", 64).primary().unique();\n\n this.string(\"token_hash\", 64).unique();\n this.string(\"account_id\", 64).index();\n this.string(\"stage\", 32);\n this.string(\"csrf_secret\", 128);\n this.bigInteger(\"created_at\");\n this.bigInteger(\"last_seen_at\");\n this.bigInteger(\"expires_at\").index();\n this.string(\"ip\", 64).nullable();\n this.string(\"user_agent\", 255).nullable();\n this.text(\"pending_totp_secret\").nullable();\n this.text(\"challenge\").nullable();\n this.bigInteger(\"challenge_expires_at\").nullable();\n this.integer(\"version\").default(1);\n },\n down() {\n this.dropTableIfExists();\n },\n});\n","import { DevtoolsRowModel } from \"./base\";\n\n/** A row of `devtools_shares`. */\nexport class DevtoolsShareRow extends DevtoolsRowModel {\n public static table = \"devtools_shares\";\n}\n","import { migrate } from \"@warlock.js/cascade\";\nimport { DevtoolsShareRow } from \"./share.model\";\n\nexport const DevtoolsSharesMigration = migrate(DevtoolsShareRow, {\n name: \"devtoolsShares\",\n up() {\n this.createTableIfNotExists();\n\n // The id is a string the store supplies; `unique` also covers MongoDB,\n // which ignores primary keys.\n this.string(\"id\", 64).primary().unique();\n\n this.string(\"token_hash\", 64).unique();\n this.string(\"panel\", 64);\n this.string(\"label\", 80);\n this.string(\"created_by\", 64).nullable();\n this.bigInteger(\"created_at\");\n this.bigInteger(\"expires_at\").index();\n this.bigInteger(\"revoked_at\").nullable();\n this.bigInteger(\"last_used_at\").nullable();\n this.integer(\"uses\").default(0);\n },\n down() {\n this.dropTableIfExists();\n },\n});\n","import { DevtoolsRowModel } from \"./base\";\n\n/** A row of `devtools_state`. */\nexport class DevtoolsStateRow extends DevtoolsRowModel {\n public static table = \"devtools_state\";\n}\n","import { migrate } from \"@warlock.js/cascade\";\nimport { DevtoolsStateRow } from \"./state.model\";\n\nexport const DevtoolsStateMigration = migrate(DevtoolsStateRow, {\n name: \"devtoolsState\",\n up() {\n this.createTableIfNotExists();\n\n // The id is a string the store supplies; `unique` also covers MongoDB,\n // which ignores primary keys.\n this.string(\"id\", 64).primary().unique();\n\n this.boolean(\"disabled\").default(false);\n this.string(\"disabled_path_hash\", 64).nullable();\n this.bigInteger(\"disabled_at\").nullable();\n this.string(\"disabled_by\", 64).nullable();\n this.bigInteger(\"locked_until\").nullable();\n this.bigInteger(\"failures_reset_at\").nullable();\n this.bigInteger(\"updated_at\");\n this.integer(\"version\").default(0);\n },\n down() {\n this.dropTableIfExists();\n },\n});\n","export { DevtoolsRowModel } from \"./base\";\nexport { DevtoolsAiRollupsMigration } from \"./ai-rollup.migration\";\nexport { DevtoolsAiRollupRow } from \"./ai-rollup.model\";\nexport { DevtoolsAccountsMigration } from \"./account.migration\";\nexport { DevtoolsAccountRow } from \"./account.model\";\nexport { DevtoolsAuditMigration } from \"./audit.migration\";\nexport { DevtoolsAuditRow } from \"./audit.model\";\nexport { DevtoolsInvitesMigration } from \"./invite.migration\";\nexport { DevtoolsInviteRow } from \"./invite.model\";\nexport { DevtoolsReportsMigration } from \"./report.migration\";\nexport { DevtoolsReportRow } from \"./report.model\";\nexport { DevtoolsSamplesMigration } from \"./sample.migration\";\nexport { DevtoolsSampleRow } from \"./sample.model\";\nexport { DevtoolsSessionsMigration } from \"./session.migration\";\nexport { DevtoolsSessionRow } from \"./session.model\";\nexport { DevtoolsSharesMigration } from \"./share.migration\";\nexport { DevtoolsShareRow } from \"./share.model\";\nexport { DevtoolsStateMigration } from \"./state.migration\";\nexport { DevtoolsStateRow } from \"./state.model\";\n"],"mappings":";;;;;;;;;;;AAQA,IAAsB,mBAAtB,cAA+CA,0BAAM;;wBACpB;;;yBAEC;;;yBAEA;;;wBAED;;AACjC;;;;;ACbA,IAAa,sBAAb,cAAyC,iBAAiB;;eAClC;;AACxB;;;;ACDA,MAAa,iCAA6BC,6BAAQ,qBAAqB;CACrE,MAAM;CACN,KAAK;EACH,KAAK,uBAAuB;EAG5B,KAAK,OAAO,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO;EAEvC,KAAK,WAAW,MAAM,CAAC,CAAC,MAAM;EAC9B,KAAK,OAAO,SAAS,GAAG,CAAC,CAAC,MAAM;EAChC,KAAK,OAAO,SAAS,GAAG,CAAC,CAAC,MAAM;EAChC,KAAK,OAAO,YAAY,GAAG;EAE3B,KAAK,MAAM,UAAU;GAAC;GAAQ;GAAa;GAAU;GAAc;EAAW,GAC5E,KAAK,QAAQ,MAAM,CAAC,CAAC,QAAQ,CAAC;E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,CAAC,OAAO;EACrC,KAAK,OAAO,SAAS,EAAE;EACvB,KAAK,OAAO,SAAS,EAAE;EACvB,KAAK,OAAO,cAAc,EAAE,CAAC,CAAC,SAAS;EACvC,KAAK,WAAW,YAAY;EAC5B,KAAK,WAAW,YAAY,CAAC,CAAC,MAAM;EACpC,KAAK,WAAW,YAAY,CAAC,CAAC,SAAS;EACvC,KAAK,WAAW,cAAc,CAAC,CAAC,SAAS;EACzC,KAAK,QAAQ,MAAM,CAAC,CAAC,QAAQ,CAAC;CAChC;CACA,OAAO;EACL,KAAK,kBAAkB;CACzB;AACF,CAAC;;;;;ACtBD,IAAa,mBAAb,cAAsC,iBAAiB;;eAC/B;;AACxB;;;;ACFA,MAAa,6BAAyBC,6BAAQ,kBAAkB;CAC9D,MAAM;CACN,KAAK;EACH,KAAK,uBAAuB;EAI5B,KAAK,OAAO,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO;EAEvC,KAAK,QAAQ,UAAU,CAAC,CAAC,QAAQ,KAAK;EACtC,KAAK,OAAO,sBAAsB,EAAE,CAAC,CAAC,SAAS;EAC/C,KAAK,WAAW,aAAa,CAAC,CAAC,SAAS;EACxC,KAAK,OAAO,eAAe,EAAE,CAAC,CAAC,SAAS;EACxC,KAAK,WAAW,cAAc,CAAC,CAAC,SAAS;EACzC,KAAK,WAAW,mBAAmB,CAAC,CAAC,SAAS;EAC9C,KAAK,WAAW,YAAY;EAC5B,KAAK,QAAQ,SAAS,CAAC,CAAC,QAAQ,CAAC;CACnC;CACA,OAAO;EACL,KAAK,kBAAkB;CACzB;AACF,CAAC"}
@@ -1,5 +1,5 @@
1
- const require_app_versions = require("./app-versions-DfpPZOI2.cjs");
2
- const require_ai_source = require("./ai-source-BdvMfyKw.cjs");
1
+ const require_app_versions = require("./app-versions-C_ZyzuvD.cjs");
2
+ const require_runs = require("./runs-DECWPGnq.cjs");
3
3
  let node_path = require("node:path");
4
4
  node_path = require_app_versions.__toESM(node_path, 1);
5
5
 
@@ -24,7 +24,7 @@ function processesDevtoolsPanel(processPanel) {
24
24
  return {
25
25
  id: "processes",
26
26
  title: "Processes",
27
- view: node_path.default.join(require_ai_source.resolveUiRoot(), "panels", "processes.js"),
27
+ view: node_path.default.join(require_runs.resolveUiRoot(), "panels", "processes.js"),
28
28
  routes: [{
29
29
  path: "",
30
30
  handler: async () => processPanel ? await processPanel.list() : []
@@ -45,4 +45,4 @@ Object.defineProperty(exports, "processesDevtoolsPanel", {
45
45
  return processesDevtoolsPanel;
46
46
  }
47
47
  });
48
- //# sourceMappingURL=process-panel-DskSA7Cm.cjs.map
48
+ //# sourceMappingURL=process-panel-D3D9Y_dc.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"process-panel-DskSA7Cm.cjs","names":["path","resolveUiRoot"],"sources":["../../../../../../../packages/devtools/src/process-panel.ts"],"sourcesContent":["import path from \"node:path\";\nimport type { DevtoolsPanel } from \"./types\";\nimport { resolveUiRoot } from \"./ui-root\";\n\n/** Structural contract keeps process supervision an optional application feature. */\nexport type ProcessPanel = { list(): Promise<readonly unknown[]> };\n\n/** Load app-owned generated registration only when devtools boots in development. */\nexport async function loadProcessPanel(): Promise<ProcessPanel | undefined> {\n const core = await import(\"@warlock.js/core\");\n if (!(\"srcPath\" in core)) return undefined;\n const { srcPath } = core;\n const { existsSync } = await import(\"node:fs\");\n const { pathToFileURL } = await import(\"node:url\");\n const file = srcPath(\"app/processes/devtools.ts\");\n if (!existsSync(file)) return undefined;\n const module: { processPanel?: ProcessPanel } = await import(pathToFileURL(file).href);\n return module.processPanel;\n}\n\n/**\n * The built-in **Processes** tab, registered like any other panel:\n * `GET <path>/api/processes` lists the app's supervised processes (an empty\n * list without a registration) and `ui/panels/processes.js` renders them.\n */\nexport function processesDevtoolsPanel(processPanel?: ProcessPanel): DevtoolsPanel {\n return {\n id: \"processes\",\n title: \"Processes\",\n view: path.join(resolveUiRoot(), \"panels\", \"processes.js\"),\n routes: [{ path: \"\", handler: async () => (processPanel ? await processPanel.list() : []) }],\n };\n}\n"],"mappings":";;;;;;;AAQA,eAAsB,mBAAsD;CAC1E,MAAM,OAAO,MAAM,OAAO;CAC1B,IAAI,EAAE,aAAa,OAAO,OAAO;CACjC,MAAM,EAAE,YAAY;CACpB,MAAM,EAAE,eAAe,MAAM,OAAO;CACpC,MAAM,EAAE,kBAAkB,MAAM,OAAO;CACvC,MAAM,OAAO,QAAQ,2BAA2B;CAChD,IAAI,CAAC,WAAW,IAAI,GAAG,OAAO;CAE9B,QAAO,MAD+C,OAAO,cAAc,IAAI,CAAC,CAAC,MACpE,CAAC;AAChB;;;;;;AAOA,SAAgB,uBAAuB,cAA4C;CACjF,OAAO;EACL,IAAI;EACJ,OAAO;EACP,MAAMA,kBAAK,KAAKC,gCAAc,GAAG,UAAU,cAAc;EACzD,QAAQ,CAAC;GAAE,MAAM;GAAI,SAAS,YAAa,eAAe,MAAM,aAAa,KAAK,IAAI,CAAC;EAAG,CAAC;CAC7F;AACF"}
1
+ {"version":3,"file":"process-panel-D3D9Y_dc.cjs","names":["path","resolveUiRoot"],"sources":["../../../../../../../packages/devtools/src/process-panel.ts"],"sourcesContent":["import path from \"node:path\";\nimport type { DevtoolsPanel } from \"./types\";\nimport { resolveUiRoot } from \"./ui-root\";\n\n/** Structural contract keeps process supervision an optional application feature. */\nexport type ProcessPanel = { list(): Promise<readonly unknown[]> };\n\n/** Load app-owned generated registration only when devtools boots in development. */\nexport async function loadProcessPanel(): Promise<ProcessPanel | undefined> {\n const core = await import(\"@warlock.js/core\");\n if (!(\"srcPath\" in core)) return undefined;\n const { srcPath } = core;\n const { existsSync } = await import(\"node:fs\");\n const { pathToFileURL } = await import(\"node:url\");\n const file = srcPath(\"app/processes/devtools.ts\");\n if (!existsSync(file)) return undefined;\n const module: { processPanel?: ProcessPanel } = await import(pathToFileURL(file).href);\n return module.processPanel;\n}\n\n/**\n * The built-in **Processes** tab, registered like any other panel:\n * `GET <path>/api/processes` lists the app's supervised processes (an empty\n * list without a registration) and `ui/panels/processes.js` renders them.\n */\nexport function processesDevtoolsPanel(processPanel?: ProcessPanel): DevtoolsPanel {\n return {\n id: \"processes\",\n title: \"Processes\",\n view: path.join(resolveUiRoot(), \"panels\", \"processes.js\"),\n routes: [{ path: \"\", handler: async () => (processPanel ? await processPanel.list() : []) }],\n };\n}\n"],"mappings":";;;;;;;AAQA,eAAsB,mBAAsD;CAC1E,MAAM,OAAO,MAAM,OAAO;CAC1B,IAAI,EAAE,aAAa,OAAO,OAAO;CACjC,MAAM,EAAE,YAAY;CACpB,MAAM,EAAE,eAAe,MAAM,OAAO;CACpC,MAAM,EAAE,kBAAkB,MAAM,OAAO;CACvC,MAAM,OAAO,QAAQ,2BAA2B;CAChD,IAAI,CAAC,WAAW,IAAI,GAAG,OAAO;CAE9B,QAAO,MAD+C,OAAO,cAAc,IAAI,CAAC,CAAC,MACpE,CAAC;AAChB;;;;;;AAOA,SAAgB,uBAAuB,cAA4C;CACjF,OAAO;EACL,IAAI;EACJ,OAAO;EACP,MAAMA,kBAAK,KAAKC,2BAAc,GAAG,UAAU,cAAc;EACzD,QAAQ,CAAC;GAAE,MAAM;GAAI,SAAS,YAAa,eAAe,MAAM,aAAa,KAAK,IAAI,CAAC;EAAG,CAAC;CAC7F;AACF"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_errors = require("../errors-BadbSDX8.cjs");
3
- const require_migrations = require("../migrations-BP4cYTGo.cjs");
2
+ const require_errors = require("../errors-DNQ-g49I.cjs");
3
+ const require_migrations = require("../migrations-BQdNOL5_.cjs");
4
4
  let _warlock_js_core = require("@warlock.js/core");
5
5
 
6
6
  //#region ../../packages/devtools/src/production/cli/actions.ts
@@ -173,7 +173,7 @@ async function exitWith(code) {
173
173
  /** The store of the app's database, or the exit code of the error that stopped it. */
174
174
  async function openStore() {
175
175
  try {
176
- const { createCascadeStore } = await Promise.resolve().then(() => require("../cascade-store-CuRRYzt_.cjs"));
176
+ const { createCascadeStore } = await Promise.resolve().then(() => require("../cascade-store-DUT2Laha.cjs"));
177
177
  return { store: await createCascadeStore() };
178
178
  } catch (error) {
179
179
  return { code: reportStoreError(io, error) };
@@ -213,7 +213,7 @@ function registerDevtoolsCommands() {
213
213
  const email = resolveAdminEmail(options.email, process.env);
214
214
  const opened = await openStore();
215
215
  if (!opened.store) return exitWith(opened.code);
216
- const [{ hashPassword }, { generateTemporaryPassword }] = await Promise.all([import("@warlock.js/core"), Promise.resolve().then(() => require("../auth-B3wyjJnQ.cjs"))]);
216
+ const [{ hashPassword }, { generateTemporaryPassword }] = await Promise.all([import("@warlock.js/core"), Promise.resolve().then(() => require("../auth-ChHh5E7j.cjs"))]);
217
217
  await exitWith(await runResetAdmin({
218
218
  store: opened.store,
219
219
  now: Date.now,
@@ -0,0 +1,390 @@
1
+ const require_app_versions = require("./app-versions-C_ZyzuvD.cjs");
2
+ const require_errors = require("./errors-DNQ-g49I.cjs");
3
+ const require_extract = require("./extract-8kaX_cUV.cjs");
4
+ let node_fs = require("node:fs");
5
+ let node_path = require("node:path");
6
+ node_path = require_app_versions.__toESM(node_path, 1);
7
+ let node_url = require("node:url");
8
+
9
+ //#region ../../packages/devtools/src/ui-root.ts
10
+ let cachedUiRoot;
11
+ /**
12
+ * Whether `dir` is this package's root: it has the built dashboard
13
+ * (`ui/dashboard/index.html`) or, before the first build, the Processes panel
14
+ * view (`ui/panels/processes.js`), beside a `package.json` named
15
+ * `@warlock.js/devtools`.
16
+ */
17
+ function isPackageRoot(dir) {
18
+ const hasUi = (0, node_fs.existsSync)(node_path.default.join(dir, "ui", "dashboard", "index.html")) || (0, node_fs.existsSync)(node_path.default.join(dir, "ui", "panels", "processes.js"));
19
+ const packageJson = node_path.default.join(dir, "package.json");
20
+ if (!hasUi || !(0, node_fs.existsSync)(packageJson)) return false;
21
+ try {
22
+ return JSON.parse((0, node_fs.readFileSync)(packageJson, "utf8")).name === "@warlock.js/devtools";
23
+ } catch {
24
+ return false;
25
+ }
26
+ }
27
+ /**
28
+ * Locate this package's `ui/` directory by walking up from the current
29
+ * module's directory. Works from `src/` in development and from the built
30
+ * `esm/`/`cjs/` output, since both sit beside `ui/` and `package.json` at
31
+ * the package root.
32
+ */
33
+ function resolveUiRoot() {
34
+ if (cachedUiRoot) return cachedUiRoot;
35
+ let dir = node_path.default.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
36
+ while (true) {
37
+ if (isPackageRoot(dir)) {
38
+ cachedUiRoot = node_path.default.join(dir, "ui");
39
+ return cachedUiRoot;
40
+ }
41
+ const parent = node_path.default.dirname(dir);
42
+ if (parent === dir) throw new Error("Could not locate the devtools UI directory: no ancestor of this module has ui/dashboard/index.html or ui/panels/processes.js beside a package.json named @warlock.js/devtools.");
43
+ dir = parent;
44
+ }
45
+ }
46
+
47
+ //#endregion
48
+ //#region ../../packages/devtools/src/sources/agent-trace-source.ts
49
+ /**
50
+ * Key `@warlock.js/ai` publishes its agent trace store under on
51
+ * `globalThis`. Reading the store from the registry, not by importing the
52
+ * package, keeps devtools free of an AI dependency and shares one store
53
+ * even when two copies of the package are installed.
54
+ */
55
+ const AGENT_TRACES_KEY = Symbol.for("@warlock.js/ai.agentTraces");
56
+ const AGENT_TRACE_INSTALL_GUIDANCE = "No agent traces yet. Install @warlock.js/ai 5.38 or newer and run an agent in development (agents record traces by default there; `trace: true` turns it on elsewhere), then reload.";
57
+ /** One list row for a trace. */
58
+ function summarizeAgentTrace(trace, requestId) {
59
+ let toolCalls = 0;
60
+ let refusals = 0;
61
+ for (const turn of trace.turns) {
62
+ toolCalls += turn.toolCalls.length;
63
+ refusals += turn.toolCalls.filter((call) => call.refusal !== void 0).length;
64
+ }
65
+ return {
66
+ runId: trace.runId,
67
+ agent: trace.agent,
68
+ status: trace.status,
69
+ startedAt: trace.startedAt,
70
+ durationMs: trace.durationMs,
71
+ model: `${trace.model.provider}/${trace.model.name}`,
72
+ turns: trace.turns.length,
73
+ toolCalls,
74
+ refusals,
75
+ usage: {
76
+ input: trace.usage.input,
77
+ output: trace.usage.output
78
+ },
79
+ cost: trace.cost,
80
+ ...requestId ? { requestId } : {}
81
+ };
82
+ }
83
+ const MAX_REQUEST_LINKS = 500;
84
+ /**
85
+ * Attach to the shared agent trace store. The store is looked up lazily on
86
+ * every call, so it works whichever of devtools and `@warlock.js/ai` loads
87
+ * first. Runs are linked to the HTTP request that was active when the
88
+ * store first reported them.
89
+ */
90
+ async function attachAgentTraceSource() {
91
+ const { currentRequestId } = await Promise.resolve().then(() => require("./current-request-id-Badec-TH.cjs")).then((n) => n.current_request_id_exports);
92
+ const listeners = /* @__PURE__ */ new Set();
93
+ const requestIds = /* @__PURE__ */ new Map();
94
+ let attachedStore;
95
+ let detach;
96
+ const findStore = () => {
97
+ const store = globalThis[AGENT_TRACES_KEY];
98
+ return store && typeof store.list === "function" ? store : void 0;
99
+ };
100
+ const ensureAttached = () => {
101
+ const store = findStore();
102
+ if (store && store !== attachedStore) {
103
+ detach?.();
104
+ attachedStore = store;
105
+ detach = store.subscribe((event) => {
106
+ let requestId = requestIds.get(event.runId);
107
+ if (!requestId) {
108
+ requestId = currentRequestId();
109
+ if (requestId) {
110
+ requestIds.set(event.runId, requestId);
111
+ if (requestIds.size > MAX_REQUEST_LINKS) {
112
+ const oldest = requestIds.keys().next();
113
+ if (!oldest.done) requestIds.delete(oldest.value);
114
+ }
115
+ }
116
+ }
117
+ for (const listener of listeners) try {
118
+ listener({
119
+ ...event,
120
+ ...requestId ? { requestId } : {}
121
+ });
122
+ } catch {}
123
+ });
124
+ }
125
+ return store;
126
+ };
127
+ ensureAttached();
128
+ return {
129
+ available: () => ensureAttached() !== void 0,
130
+ list(filter) {
131
+ const store = ensureAttached();
132
+ if (!store) return [];
133
+ return store.list().map((trace) => summarizeAgentTrace(trace, requestIds.get(trace.runId))).filter((run) => filter?.requestId === void 0 || run.requestId === filter.requestId);
134
+ },
135
+ get: (runId) => ensureAttached()?.get(runId),
136
+ subscribe(listener) {
137
+ ensureAttached();
138
+ listeners.add(listener);
139
+ return () => {
140
+ listeners.delete(listener);
141
+ };
142
+ },
143
+ dispose() {
144
+ detach?.();
145
+ detach = void 0;
146
+ attachedStore = void 0;
147
+ listeners.clear();
148
+ requestIds.clear();
149
+ }
150
+ };
151
+ }
152
+
153
+ //#endregion
154
+ //#region ../../packages/devtools/src/ai/reports/runs.ts
155
+ const DEFAULT_LIMIT = 200;
156
+ const MAX_LIMIT = 1e3;
157
+ const GROUP_TRACE_IDS = 50;
158
+ const MESSAGE_LIMIT = 300;
159
+ const STATUSES = /* @__PURE__ */ new Set([
160
+ "completed",
161
+ "failed",
162
+ "cancelled",
163
+ "incomplete",
164
+ "max-iterations",
165
+ "awaiting-input",
166
+ "awaiting-approval"
167
+ ]);
168
+ const TYPES = /* @__PURE__ */ new Set([
169
+ "tool",
170
+ "callback",
171
+ "agent",
172
+ "workflow",
173
+ "supervisor",
174
+ "team",
175
+ "orchestrator",
176
+ "batch",
177
+ "planner",
178
+ "image",
179
+ "speech",
180
+ "transcription",
181
+ "video",
182
+ "realtime"
183
+ ]);
184
+ /** The model identity a span reports, as `provider/model`. */
185
+ function modelOf(span) {
186
+ const model = span.attributes?.["agent.model.name"];
187
+ const provider = span.attributes?.["agent.model.provider"];
188
+ if (typeof model !== "string") return null;
189
+ return typeof provider === "string" ? `${provider}/${model}` : model;
190
+ }
191
+ /** A span's own priced cost, else the sum of its children (a wrapper root carries tokens but no cost). */
192
+ function spanCost(span, totalCost) {
193
+ const own = totalCost(span.usage);
194
+ if (own !== void 0 && own > 0) return own;
195
+ let sum;
196
+ for (const child of span.children) {
197
+ const cost = spanCost(child, totalCost);
198
+ if (cost !== void 0) sum = (sum ?? 0) + cost;
199
+ }
200
+ return sum;
201
+ }
202
+ /** One Runs row for a content-free trace. */
203
+ function toAiRunRow(trace, options) {
204
+ const models = /* @__PURE__ */ new Set();
205
+ let toolCalls = 0;
206
+ let retries = 0;
207
+ let incomplete = false;
208
+ const visit = (span) => {
209
+ const model = modelOf(span);
210
+ if (model !== null) models.add(model);
211
+ if (span.type === "tool") toolCalls += 1;
212
+ const spanRetries = span.attributes?.retries;
213
+ if (typeof spanRetries === "number") retries += spanRetries;
214
+ incomplete ||= span.status === "incomplete" || span.error?.type === "AgentIncompleteError" || span.error?.type === "AGENT_INCOMPLETE";
215
+ span.children.forEach(visit);
216
+ };
217
+ visit(trace.root);
218
+ const { usage } = trace;
219
+ return {
220
+ traceId: trace.traceId,
221
+ requestId: trace.requestId ?? null,
222
+ sessionId: trace.sessionId ?? null,
223
+ name: trace.root.name,
224
+ type: trace.root.type,
225
+ status: trace.root.status,
226
+ startedAt: trace.startedAt,
227
+ duration: trace.duration,
228
+ usage: {
229
+ input: usage.input,
230
+ output: usage.output,
231
+ total: usage.total,
232
+ cachedTokens: usage.cachedTokens ?? null,
233
+ cacheWriteTokens: usage.cacheWriteTokens ?? null,
234
+ inputIncludesCache: usage.inputIncludesCache ?? null
235
+ },
236
+ cost: spanCost(trace.root, options.totalCost) ?? null,
237
+ models: [...models],
238
+ promptKey: options.helpers.tracePromptKey(trace) ?? null,
239
+ toolCalls,
240
+ retries,
241
+ incomplete
242
+ };
243
+ }
244
+ function parseList(value, allowed) {
245
+ if (value === void 0 || value === "") return void 0;
246
+ const items = value.split(",").map((item) => item.trim()).filter(Boolean);
247
+ if (items.some((item) => !allowed.has(item))) throw new require_errors.DevtoolsApiError("input.invalid");
248
+ return items;
249
+ }
250
+ function parseLimit(value) {
251
+ if (value === void 0 || value === "") return DEFAULT_LIMIT;
252
+ const limit = /^\d{1,5}$/.test(value) ? Number(value) : NaN;
253
+ if (!Number.isInteger(limit) || limit < 1 || limit > MAX_LIMIT) throw new require_errors.DevtoolsApiError("input.invalid");
254
+ return limit;
255
+ }
256
+ /**
257
+ * Filters (Panoptic's `filterTraces` rules), groups (`groupBySession`,
258
+ * `groupByPrompt`, `groupByType`) and summarises the stored traces. A bad
259
+ * `limit`, `groupBy` or status throws `DevtoolsApiError("input.invalid")`.
260
+ */
261
+ function listAiRuns(traces, query, options) {
262
+ const { helpers, totalCost } = options;
263
+ const limit = parseLimit(query.limit);
264
+ const statuses = parseList(query.status, STATUSES);
265
+ const types = parseList(query.type, TYPES);
266
+ const groupBy = query.groupBy;
267
+ if (groupBy !== void 0 && groupBy !== "" && ![
268
+ "session",
269
+ "prompt",
270
+ "type"
271
+ ].includes(groupBy)) throw new require_errors.DevtoolsApiError("input.invalid");
272
+ const requestId = query.requestId?.trim();
273
+ const matching = helpers.filterTraces(requestId ? traces.filter((trace) => trace.requestId === requestId) : [...traces], {
274
+ ...query.q?.trim() ? { text: query.q.trim() } : {},
275
+ ...statuses ? { statuses } : {},
276
+ ...types ? { types } : {},
277
+ ...query.session ? { sessionId: query.session } : {},
278
+ ...query.prompt ? { promptKey: query.prompt } : {}
279
+ }).sort((a, b) => Date.parse(b.startedAt) - Date.parse(a.startedAt) || 0);
280
+ const rows = matching.map((trace) => toAiRunRow(trace, {
281
+ totalCost,
282
+ helpers
283
+ }));
284
+ const rowOf = new Map(matching.map((trace, index) => [trace, rows[index]]));
285
+ const durations = matching.map((trace) => trace.duration);
286
+ const summarise = (key, members) => {
287
+ const memberRows = members.map((trace) => rowOf.get(trace));
288
+ return {
289
+ key,
290
+ label: key,
291
+ runs: members.length,
292
+ failed: members.filter((trace) => trace.root.status === "failed").length,
293
+ estimatedCostUsd: memberRows.reduce((sum, row) => sum + (row?.cost ?? 0), 0),
294
+ p95Ms: members.length > 0 ? helpers.percentile(members.map((trace) => trace.duration), 95) : null,
295
+ traceIds: members.slice(0, GROUP_TRACE_IDS).map((trace) => trace.traceId)
296
+ };
297
+ };
298
+ let groups = null;
299
+ if (groupBy === "session") groups = helpers.groupBySession(matching).map((group) => summarise(group.sessionId, group.traces));
300
+ else if (groupBy === "prompt") groups = helpers.groupByPrompt(matching).map((group) => summarise(group.promptKey, group.traces));
301
+ else if (groupBy === "type") groups = helpers.groupByType(matching).map((group) => summarise(group.type, group.traces));
302
+ return {
303
+ available: true,
304
+ runs: rows.slice(0, limit),
305
+ groups,
306
+ stats: {
307
+ count: matching.length,
308
+ failed: matching.filter((trace) => trace.root.status === "failed").length,
309
+ estimatedCostUsd: rows.reduce((sum, row) => sum + (row.cost ?? 0), 0),
310
+ unpricedRuns: matching.filter((trace) => require_extract.traceToRollupDeltas(trace, totalCost).some((delta) => delta.unpricedRuns > 0)).length,
311
+ p50Ms: durations.length > 0 ? helpers.percentile(durations, 50) : null,
312
+ p95Ms: durations.length > 0 ? helpers.percentile(durations, 95) : null
313
+ },
314
+ capacity: options.capacity
315
+ };
316
+ }
317
+ const FAILED_STATUSES = /* @__PURE__ */ new Set([
318
+ "failed",
319
+ "incomplete",
320
+ "max-iterations"
321
+ ]);
322
+ /**
323
+ * The newest failed model spans (the same spans the rollups count as runs)
324
+ * of the stored traces, at most `limit`, newest first (Errors page,
325
+ * development). `model` is `provider/model` as the Models page keys it.
326
+ * With a filter, only failures that ended inside its range and match its
327
+ * agent, provider and model are listed.
328
+ */
329
+ function recentAiFailures(traces, limit, filter) {
330
+ const failures = [];
331
+ for (const trace of traces) {
332
+ const visit = (span) => {
333
+ if (require_extract.isAiModelSpan(span) && FAILED_STATUSES.has(span.status)) {
334
+ const parsedEnd = Date.parse(span.endedAt);
335
+ const endedAt = Number.isNaN(parsedEnd) ? Date.parse(trace.endedAt) || 0 : parsedEnd;
336
+ const names = require_extract.aiRollupNamesOf(span);
337
+ if (!filter || endedAt >= filter.from && endedAt < filter.to && (filter.agent === void 0 || names.agent === filter.agent) && (filter.provider === void 0 || names.provider === filter.provider) && (filter.model === void 0 || names.provider === filter.model.provider && names.model === filter.model.model)) {
338
+ const message = span.error?.message;
339
+ failures.push({
340
+ traceId: trace.traceId,
341
+ agent: span.name,
342
+ model: typeof span.attributes?.["agent.model.name"] === "string" ? `${names.provider}/${names.model}` : null,
343
+ status: span.status,
344
+ category: require_extract.classifyAiError(span.status, span.error?.type),
345
+ code: span.error?.type ?? null,
346
+ message: typeof message === "string" ? message.slice(0, MESSAGE_LIMIT) : null,
347
+ endedAt,
348
+ requestId: trace.requestId ?? null
349
+ });
350
+ }
351
+ }
352
+ span.children.forEach(visit);
353
+ };
354
+ visit(trace.root);
355
+ }
356
+ return failures.sort((a, b) => b.endedAt - a.endedAt).slice(0, Math.max(0, limit));
357
+ }
358
+
359
+ //#endregion
360
+ Object.defineProperty(exports, "AGENT_TRACE_INSTALL_GUIDANCE", {
361
+ enumerable: true,
362
+ get: function () {
363
+ return AGENT_TRACE_INSTALL_GUIDANCE;
364
+ }
365
+ });
366
+ Object.defineProperty(exports, "attachAgentTraceSource", {
367
+ enumerable: true,
368
+ get: function () {
369
+ return attachAgentTraceSource;
370
+ }
371
+ });
372
+ Object.defineProperty(exports, "listAiRuns", {
373
+ enumerable: true,
374
+ get: function () {
375
+ return listAiRuns;
376
+ }
377
+ });
378
+ Object.defineProperty(exports, "recentAiFailures", {
379
+ enumerable: true,
380
+ get: function () {
381
+ return recentAiFailures;
382
+ }
383
+ });
384
+ Object.defineProperty(exports, "resolveUiRoot", {
385
+ enumerable: true,
386
+ get: function () {
387
+ return resolveUiRoot;
388
+ }
389
+ });
390
+ //# sourceMappingURL=runs-DECWPGnq.cjs.map