@desplega.ai/agent-swarm 1.93.0 → 1.95.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 (85) hide show
  1. package/README.md +2 -2
  2. package/openapi.json +180 -1
  3. package/package.json +4 -3
  4. package/src/be/db.ts +74 -9
  5. package/src/be/migrations/090_model_tiers.sql +2 -0
  6. package/src/be/migrations/091_seed_swarm_operations_metrics.sql +12 -0
  7. package/src/be/migrations/092_metrics_dashboard_combobox_filters.sql +68 -0
  8. package/src/be/migrations/093_slack_message_tracking.sql +6 -0
  9. package/src/be/migrations/094_mcp_extra_authorize_params.sql +4 -0
  10. package/src/be/migrations/runner.ts +52 -0
  11. package/src/be/modelsdev-cache.json +2060 -198
  12. package/src/be/scripts/boot-reembed.ts +74 -0
  13. package/src/be/scripts/db.ts +19 -3
  14. package/src/be/seed/index.ts +1 -1
  15. package/src/be/seed/registry.ts +2 -2
  16. package/src/be/seed/runner.ts +5 -5
  17. package/src/be/seed/types.ts +6 -1
  18. package/src/be/seed-pricing.ts +1 -0
  19. package/src/be/seed-scripts/index.ts +3 -2
  20. package/src/be/skill-sync.ts +4 -4
  21. package/src/be/swarm-config-guard.ts +8 -0
  22. package/src/commands/provider-credentials.ts +14 -8
  23. package/src/commands/runner.ts +84 -13
  24. package/src/http/index.ts +13 -2
  25. package/src/http/mcp-oauth.ts +14 -0
  26. package/src/http/metrics.ts +55 -6
  27. package/src/http/schedules.ts +16 -15
  28. package/src/http/script-runs.ts +7 -1
  29. package/src/http/scripts.ts +147 -1
  30. package/src/http/tasks.ts +7 -0
  31. package/src/model-tiers.ts +140 -0
  32. package/src/oauth/mcp-wrapper.ts +14 -0
  33. package/src/providers/claude-managed-models.ts +9 -0
  34. package/src/providers/codex-skill-resolver.ts +22 -8
  35. package/src/providers/opencode-adapter.ts +21 -2
  36. package/src/providers/pi-mono-adapter.ts +143 -26
  37. package/src/providers/types.ts +12 -0
  38. package/src/scheduler/scheduler.ts +22 -34
  39. package/src/server-user.ts +8 -2
  40. package/src/slack/responses.ts +39 -11
  41. package/src/slack/watcher.ts +121 -8
  42. package/src/tests/agents-list-model-display.test.ts +13 -0
  43. package/src/tests/aws-error-classifier.test.ts +148 -0
  44. package/src/tests/claude-managed-adapter.test.ts +12 -0
  45. package/src/tests/context-window.test.ts +7 -0
  46. package/src/tests/credential-check.test.ts +185 -46
  47. package/src/tests/harness-provider-resolution.test.ts +23 -0
  48. package/src/tests/http-api-integration.test.ts +19 -0
  49. package/src/tests/mcp-oauth-queries.test.ts +71 -1
  50. package/src/tests/mcp-oauth-wrapper.test.ts +109 -0
  51. package/src/tests/metrics-http.test.ts +137 -3
  52. package/src/tests/migration-046-budgets.test.ts +33 -0
  53. package/src/tests/migration-runner-regressions.test.ts +69 -0
  54. package/src/tests/model-control.test.ts +162 -46
  55. package/src/tests/opencode-adapter.test.ts +38 -1
  56. package/src/tests/pi-mono-adapter.test.ts +319 -0
  57. package/src/tests/provider-command-format.test.ts +12 -0
  58. package/src/tests/providers/pi-cost.test.ts +9 -0
  59. package/src/tests/runner-fallback-output.test.ts +50 -0
  60. package/src/tests/scripts-boot-reembed.test.ts +163 -0
  61. package/src/tests/scripts-embeddings.test.ts +90 -0
  62. package/src/tests/seed.test.ts +26 -1
  63. package/src/tests/session-costs-model-key-normalize.test.ts +2 -0
  64. package/src/tests/skill-fs-writer.test.ts +7 -1
  65. package/src/tests/skill-sync.test.ts +15 -3
  66. package/src/tests/slack-watcher.test.ts +66 -0
  67. package/src/tests/workflow-agent-task.test.ts +5 -2
  68. package/src/tests/workflow-validation-port-routing.test.ts +181 -0
  69. package/src/tools/mcp-servers/mcp-server-create.ts +7 -0
  70. package/src/tools/mcp-servers/mcp-server-update.ts +8 -0
  71. package/src/tools/memory-get.ts +11 -0
  72. package/src/tools/memory-search.ts +18 -0
  73. package/src/tools/schedules/create-schedule.ts +71 -70
  74. package/src/tools/schedules/update-schedule.ts +43 -31
  75. package/src/tools/send-task.ts +16 -5
  76. package/src/tools/task-action.ts +11 -3
  77. package/src/types.ts +30 -0
  78. package/src/utils/aws-error-classifier.ts +97 -0
  79. package/src/utils/context-window.ts +2 -0
  80. package/src/utils/credentials.test.ts +68 -0
  81. package/src/utils/credentials.ts +44 -3
  82. package/src/utils/pretty-print.ts +25 -10
  83. package/src/utils/skill-fs-writer.ts +11 -3
  84. package/src/workflows/engine.ts +3 -2
  85. package/src/workflows/executors/agent-task.ts +3 -1
@@ -36,6 +36,56 @@ const BASELINE_TABLES = [
36
36
  "context_versions",
37
37
  ];
38
38
 
39
+ // 090 was renumbered after being applied in production (2026-06-10): PR #722
40
+ // shipped the metrics seed as 090_seed_swarm_operations_metrics; PR #719 then
41
+ // took 090 for model tiers and renumbered the seed to 091. Databases that
42
+ // applied seed-as-090 recorded version 90 with the seed's checksum, so the
43
+ // runner skipped 090_model_tiers forever and task inserts crashed on the
44
+ // missing modelTier column. Detect that exact history and repair it in place:
45
+ // apply the missing ALTERs and repoint row 90 at 090_model_tiers. No-op on
46
+ // fresh databases and on histories where 090_model_tiers applied normally.
47
+ const SEED_APPLIED_AS_090_CHECKSUM =
48
+ "8ca4a05263b42d115b419f468bf5113caa5b7ee4363177568897513549224b01";
49
+
50
+ function repairRenumberedModelTiers(db: Database, migrations: Migration[]): void {
51
+ const modelTiers = migrations.find((m) => m.name === "090_model_tiers");
52
+ if (!modelTiers) return;
53
+
54
+ const row = db
55
+ .prepare<AppliedMigration, []>(
56
+ "SELECT version, name, checksum FROM _migrations WHERE version = 90",
57
+ )
58
+ .get();
59
+ if (
60
+ !row ||
61
+ row.name !== "090_seed_swarm_operations_metrics" ||
62
+ row.checksum !== SEED_APPLIED_AS_090_CHECKSUM
63
+ ) {
64
+ return;
65
+ }
66
+
67
+ console.warn(
68
+ "[migrations] Repairing renumbered migration 090: applying 090_model_tiers over seed-as-090 history",
69
+ );
70
+
71
+ db.transaction(() => {
72
+ for (const table of ["agent_tasks", "scheduled_tasks"]) {
73
+ const hasColumn = db
74
+ .prepare<{ n: number }, [string]>(
75
+ "SELECT COUNT(*) AS n FROM pragma_table_info(?) WHERE name = 'modelTier'",
76
+ )
77
+ .get(table);
78
+ if (!hasColumn?.n) {
79
+ db.run(`ALTER TABLE ${table} ADD COLUMN modelTier TEXT`);
80
+ }
81
+ }
82
+ db.run("UPDATE _migrations SET name = ?, checksum = ? WHERE version = 90", [
83
+ modelTiers.name,
84
+ modelTiers.checksum,
85
+ ]);
86
+ })();
87
+ }
88
+
39
89
  function shouldBootstrapInitialMigration(db: Database): boolean {
40
90
  const rows = db
41
91
  .prepare<{ name: string }, []>(
@@ -107,6 +157,8 @@ export function runMigrations(db: Database): void {
107
157
  return;
108
158
  }
109
159
 
160
+ repairRenumberedModelTiers(db, migrations);
161
+
110
162
  // 3. Get applied migrations
111
163
  const applied = new Map<number, AppliedMigration>();
112
164
  const rows = db