@desplega.ai/agent-swarm 1.71.2 → 1.72.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/openapi.json +994 -62
- package/package.json +2 -1
- package/src/be/budget-admission.ts +121 -0
- package/src/be/budget-refusal-notify.ts +145 -0
- package/src/be/db.ts +488 -5
- package/src/be/migrations/044_provider_meta.sql +2 -0
- package/src/be/migrations/046_budgets_and_pricing.sql +87 -0
- package/src/be/migrations/047_session_costs_cost_source.sql +16 -0
- package/src/cli.tsx +22 -1
- package/src/commands/claude-managed-setup.ts +687 -0
- package/src/commands/codex-login.ts +1 -1
- package/src/commands/runner.ts +175 -28
- package/src/commands/templates.ts +10 -6
- package/src/http/budgets.ts +219 -0
- package/src/http/index.ts +6 -0
- package/src/http/integrations.ts +134 -0
- package/src/http/poll.ts +161 -3
- package/src/http/pricing.ts +245 -0
- package/src/http/session-data.ts +54 -6
- package/src/http/tasks.ts +23 -2
- package/src/prompts/base-prompt.ts +103 -73
- package/src/prompts/session-templates.ts +43 -0
- package/src/providers/claude-adapter.ts +3 -1
- package/src/providers/claude-managed-adapter.ts +871 -0
- package/src/providers/claude-managed-models.ts +117 -0
- package/src/providers/claude-managed-swarm-events.ts +77 -0
- package/src/providers/codex-adapter.ts +3 -1
- package/src/providers/codex-skill-resolver.ts +10 -0
- package/src/providers/codex-swarm-events.ts +20 -161
- package/src/providers/devin-adapter.ts +894 -0
- package/src/providers/devin-api.ts +207 -0
- package/src/providers/devin-playbooks.ts +91 -0
- package/src/providers/devin-skill-resolver.ts +113 -0
- package/src/providers/index.ts +10 -1
- package/src/providers/pi-mono-adapter.ts +3 -1
- package/src/providers/swarm-events-shared.ts +262 -0
- package/src/providers/types.ts +26 -1
- package/src/tests/base-prompt.test.ts +199 -0
- package/src/tests/budget-admission.test.ts +338 -0
- package/src/tests/budget-claim-gate.test.ts +288 -0
- package/src/tests/budget-refusal-notification.test.ts +324 -0
- package/src/tests/budgets-routes.test.ts +331 -0
- package/src/tests/claude-managed-adapter.test.ts +1301 -0
- package/src/tests/claude-managed-setup.test.ts +325 -0
- package/src/tests/devin-adapter.test.ts +677 -0
- package/src/tests/devin-api.test.ts +339 -0
- package/src/tests/integrations-http.test.ts +211 -0
- package/src/tests/migration-046-budgets.test.ts +327 -0
- package/src/tests/pricing-routes.test.ts +315 -0
- package/src/tests/prompt-template-remaining.test.ts +4 -0
- package/src/tests/prompt-template-session.test.ts +2 -2
- package/src/tests/provider-adapter.test.ts +1 -1
- package/src/tests/runner-budget-refused.test.ts +271 -0
- package/src/tests/session-costs-codex-recompute.test.ts +386 -0
- package/src/tools/poll-task.ts +13 -2
- package/src/tools/task-action.ts +92 -2
- package/src/tools/templates.ts +29 -0
- package/src/types.ts +116 -0
- package/src/utils/budget-backoff.ts +34 -0
- package/src/utils/credentials.ts +4 -0
- package/src/utils/provider-metadata.ts +9 -0
- package/src/workflows/executors/raw-llm.ts +1 -1
- package/src/workflows/executors/validate.ts +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
-- 047_session_costs_cost_source.sql
|
|
2
|
+
-- Phase 6: track WHERE the recorded `totalCostUsd` came from for each session_costs row.
|
|
3
|
+
--
|
|
4
|
+
-- Adds a single column `costSource` to the `session_costs` table:
|
|
5
|
+
-- * 'harness' — value reported as-is by the harness (Claude / pi self-report,
|
|
6
|
+
-- or Codex worker fallback when no DB pricing rows exist).
|
|
7
|
+
-- * 'pricing-table' — value recomputed by the API from `pricing` rows
|
|
8
|
+
-- (Codex when DB pricing rows exist for all three token classes).
|
|
9
|
+
--
|
|
10
|
+
-- The `DEFAULT 'harness'` clause backfills every existing row to 'harness' — which
|
|
11
|
+
-- is the correct historical truth: prior to Phase 6 the API recorded whatever the
|
|
12
|
+
-- harness sent without recomputation. New writes from Phase 6 forward set the
|
|
13
|
+
-- column explicitly via `createSessionCost(...)`.
|
|
14
|
+
|
|
15
|
+
ALTER TABLE session_costs ADD COLUMN costSource TEXT NOT NULL DEFAULT 'harness'
|
|
16
|
+
CHECK (costSource IN ('harness', 'pricing-table'));
|
package/src/cli.tsx
CHANGED
|
@@ -270,6 +270,22 @@ const COMMAND_HELP: Record<
|
|
|
270
270
|
` ${binName} codex-login --api-url https://swarm.example.com --api-key <api-key>`,
|
|
271
271
|
].join("\n"),
|
|
272
272
|
},
|
|
273
|
+
"claude-managed-setup": {
|
|
274
|
+
usage: `${binName} claude-managed-setup [options]`,
|
|
275
|
+
description:
|
|
276
|
+
"Bootstrap Anthropic Managed Agents for the swarm: create the cloud environment, upload plugin/commands/*.md skills, create the managed agent, and persist the resulting IDs to swarm_config so deployed workers restore them at boot. Prompts interactively for ANTHROPIC_API_KEY when not set in env. Idempotent — re-run with --force to recreate.",
|
|
277
|
+
options: [
|
|
278
|
+
" --api-url <url> Swarm API URL (default: MCP_BASE_URL or http://localhost:3013)",
|
|
279
|
+
" --api-key <key> Swarm API key (default: API_KEY or 123123)",
|
|
280
|
+
" --force Recreate Anthropic-side resources even if already configured",
|
|
281
|
+
" -h, --help Show this help",
|
|
282
|
+
].join("\n"),
|
|
283
|
+
examples: [
|
|
284
|
+
` ${binName} claude-managed-setup`,
|
|
285
|
+
` ${binName} claude-managed-setup --force`,
|
|
286
|
+
` ${binName} claude-managed-setup --api-url https://swarm.example.com`,
|
|
287
|
+
].join("\n"),
|
|
288
|
+
},
|
|
273
289
|
};
|
|
274
290
|
|
|
275
291
|
function printHelp(command?: string) {
|
|
@@ -299,11 +315,12 @@ function printHelp(command?: string) {
|
|
|
299
315
|
["artifact", "Manage agent artifacts"],
|
|
300
316
|
["docs", "Open documentation (--open to launch in browser)"],
|
|
301
317
|
["codex-login", "Authenticate Codex via ChatGPT OAuth"],
|
|
318
|
+
["claude-managed-setup", "Bootstrap Anthropic Managed Agents (agent + env + skills)"],
|
|
302
319
|
["version", "Show version number"],
|
|
303
320
|
["help", "Show this help message"],
|
|
304
321
|
];
|
|
305
322
|
for (const entry of commands) {
|
|
306
|
-
console.log(` ${(entry[0] ?? "").padEnd(
|
|
323
|
+
console.log(` ${(entry[0] ?? "").padEnd(22)} ${entry[1] ?? ""}`);
|
|
307
324
|
}
|
|
308
325
|
console.log(`\nRun '${binName} <command> --help' for details on a specific command.\n`);
|
|
309
326
|
}
|
|
@@ -555,6 +572,10 @@ if (args.showHelp || args.command === "help" || args.command === undefined) {
|
|
|
555
572
|
const { runCodexLogin } = await import("./commands/codex-login");
|
|
556
573
|
const codexLoginArgs = process.argv.slice(process.argv.indexOf("codex-login") + 1);
|
|
557
574
|
await runCodexLogin(codexLoginArgs);
|
|
575
|
+
} else if (args.command === "claude-managed-setup") {
|
|
576
|
+
const { runClaudeManagedSetup } = await import("./commands/claude-managed-setup");
|
|
577
|
+
const setupArgs = process.argv.slice(process.argv.indexOf("claude-managed-setup") + 1);
|
|
578
|
+
await runClaudeManagedSetup(setupArgs);
|
|
558
579
|
} else {
|
|
559
580
|
render(<App args={args} />);
|
|
560
581
|
}
|