@spinabot/brigade 1.20.0 → 1.22.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 (40) hide show
  1. package/README.md +4 -3
  2. package/dist/agents/agent-loop.d.ts.map +1 -1
  3. package/dist/agents/agent-loop.js +38 -2
  4. package/dist/agents/agent-loop.js.map +1 -1
  5. package/dist/agents/memory/extract.d.ts.map +1 -1
  6. package/dist/agents/memory/extract.js +2 -0
  7. package/dist/agents/memory/extract.js.map +1 -1
  8. package/dist/buildstamp.json +1 -1
  9. package/dist/core/server.d.ts.map +1 -1
  10. package/dist/core/server.js +38 -1
  11. package/dist/core/server.js.map +1 -1
  12. package/dist/integrations/antigravity/transport.d.ts +29 -0
  13. package/dist/integrations/antigravity/transport.d.ts.map +1 -0
  14. package/dist/integrations/antigravity/transport.js +528 -0
  15. package/dist/integrations/antigravity/transport.js.map +1 -0
  16. package/dist/integrations/cli-login.d.ts +13 -0
  17. package/dist/integrations/cli-login.d.ts.map +1 -1
  18. package/dist/integrations/cli-login.js +29 -0
  19. package/dist/integrations/cli-login.js.map +1 -1
  20. package/dist/integrations/provider-discovery.d.ts +37 -0
  21. package/dist/integrations/provider-discovery.d.ts.map +1 -1
  22. package/dist/integrations/provider-discovery.js +102 -0
  23. package/dist/integrations/provider-discovery.js.map +1 -1
  24. package/dist/providers/catalog.d.ts +8 -1
  25. package/dist/providers/catalog.d.ts.map +1 -1
  26. package/dist/providers/catalog.js +29 -0
  27. package/dist/providers/catalog.js.map +1 -1
  28. package/dist/storage/boot.d.ts.map +1 -1
  29. package/dist/storage/boot.js +2 -1
  30. package/dist/storage/boot.js.map +1 -1
  31. package/dist/storage/convex/index.d.ts.map +1 -1
  32. package/dist/storage/convex/index.js +15 -4
  33. package/dist/storage/convex/index.js.map +1 -1
  34. package/dist/ui/onboard-storage-mode.js +30 -4
  35. package/dist/ui/onboard-storage-mode.js.map +1 -1
  36. package/dist/ui/onboarding.d.ts.map +1 -1
  37. package/dist/ui/onboarding.js +150 -32
  38. package/dist/ui/onboarding.js.map +1 -1
  39. package/package.json +1 -1
  40. package/scripts/convex-push.mjs +47 -29
@@ -1,15 +1,21 @@
1
1
  #!/usr/bin/env node
2
- // scripts/convex-push.mjs — deploy convex/ functions to the LOCAL backend.
2
+ // scripts/convex-push.mjs — deploy convex/ functions to the target backend.
3
3
  //
4
4
  // npm run convex:push
5
5
  //
6
- // Reads the admin key minted by convex-dev.mjs and runs `convex deploy`
7
- // against the self-hosted backend (default http://127.0.0.1:3210). Idempotent
8
- // run any time the functions or schema change. `npm run convex:dev` also
9
- // runs this automatically once the backend is up, so the deployed bundle can
10
- // no longer silently drift from the code (the exact production failure:
11
- // per-domain "Could not find public function 'auth:readAuthFile'" spam while
12
- // the gateway limps along half-broken).
6
+ // TWO targets, auto-detected:
7
+ // CLOUD — when CONVEX_DEPLOY_KEY is set (Convex dashboard → deployment →
8
+ // Settings "Deploy key"). Runs `convex deploy` against the cloud
9
+ // deployment the key belongs to. No admin key, no self-hosted env.
10
+ // SELF-HOSTED (default) reads the admin key minted by convex-dev.mjs and
11
+ // deploys to the local backend (default http://127.0.0.1:3210).
12
+ //
13
+ // Idempotent — run any time the functions or schema change. `npm run convex:dev`
14
+ // runs the self-hosted path automatically once the backend is up. WITHOUT a push,
15
+ // a fresh deployment has NO functions and every call fails with "Could not find
16
+ // public function 'health:ping'" — which the runtime otherwise surfaces as the
17
+ // misleading "backend unreachable". This is exactly why pointing Brigade at a
18
+ // *.convex.cloud URL "didn't work": the cloud deployment was empty.
13
19
 
14
20
  import { spawnSync } from "node:child_process";
15
21
  import { existsSync, readFileSync, readdirSync, rmSync } from "node:fs";
@@ -21,12 +27,9 @@ const DATA_DIR = join(ROOT, ".convex-data");
21
27
 
22
28
  // Pre-clean: compiled .js/.js.map artifacts INSIDE convex/ make the bundler
23
29
  // fail with "Two output files share the same path" (it treats both the .ts
24
- // and the stray .js as entry points). Historically the convex CLI's own
25
- // deploy-time typecheck planted them (no convex/tsconfig.json emitting
26
- // mode fixed by the noEmit tsconfig now in that folder), so pushes broke
27
- // the NEXT push. Sweep them before every deploy as a belt-and-suspenders so
28
- // no future emitter can re-break deploys. `_generated/` is the CLI's own
29
- // output and is exempt.
30
+ // and the stray .js as entry points). Sweep them before every deploy so no
31
+ // future emitter can re-break deploys. `_generated/` is the CLI's own output
32
+ // and is exempt (readdir is non-recursive).
30
33
  const convexDir = join(ROOT, "convex");
31
34
  let cleaned = 0;
32
35
  for (const name of readdirSync(convexDir)) {
@@ -38,28 +41,43 @@ for (const name of readdirSync(convexDir)) {
38
41
  if (cleaned > 0) {
39
42
  console.log(`▌ Removed ${cleaned} stray compiled artifact(s) from convex/ (deploy-breaking).`);
40
43
  }
41
- const keyFile = join(DATA_DIR, "admin-key.txt");
42
- const url = process.env.CONVEX_SELF_HOSTED_URL?.trim() || "http://127.0.0.1:3210";
43
44
 
44
- if (!existsSync(keyFile) && !process.env.CONVEX_SELF_HOSTED_ADMIN_KEY) {
45
- console.error(
46
- "✖ No admin key found (.convex-data/admin-key.txt). Start the backend once first: npm run convex:dev",
47
- );
48
- process.exit(1);
45
+ const deployKey = process.env.CONVEX_DEPLOY_KEY?.trim();
46
+
47
+ let env;
48
+ let target;
49
+ if (deployKey) {
50
+ // CLOUD: the deploy key encodes the deployment, so `convex deploy` resolves
51
+ // the URL from it. Crucially, DO NOT pass CONVEX_SELF_HOSTED_* — setting them
52
+ // forces the CLI into self-hosted mode and it would ignore the deploy key.
53
+ env = { ...process.env, CONVEX_DEPLOY_KEY: deployKey };
54
+ delete env.CONVEX_SELF_HOSTED_URL;
55
+ delete env.CONVEX_SELF_HOSTED_ADMIN_KEY;
56
+ target = "Convex Cloud (via deploy key)";
57
+ } else {
58
+ // SELF-HOSTED (local backend).
59
+ const keyFile = join(DATA_DIR, "admin-key.txt");
60
+ const url = process.env.CONVEX_SELF_HOSTED_URL?.trim() || "http://127.0.0.1:3210";
61
+ if (!existsSync(keyFile) && !process.env.CONVEX_SELF_HOSTED_ADMIN_KEY) {
62
+ console.error(
63
+ "✖ No Convex target. Either:\n" +
64
+ " • CLOUD — set CONVEX_DEPLOY_KEY (Convex dashboard → deployment → Settings → Deploy key), or\n" +
65
+ " • SELF-HOSTED — start the local backend once: npm run convex:dev",
66
+ );
67
+ process.exit(1);
68
+ }
69
+ const adminKey =
70
+ process.env.CONVEX_SELF_HOSTED_ADMIN_KEY?.trim() || readFileSync(keyFile, "utf8").trim();
71
+ env = { ...process.env, CONVEX_SELF_HOSTED_URL: url, CONVEX_SELF_HOSTED_ADMIN_KEY: adminKey };
72
+ target = url;
49
73
  }
50
- const adminKey =
51
- process.env.CONVEX_SELF_HOSTED_ADMIN_KEY?.trim() || readFileSync(keyFile, "utf8").trim();
52
74
 
53
- console.log(`▌ Pushing convex/ functions → ${url}`);
75
+ console.log(`▌ Pushing convex/ functions → ${target}`);
54
76
  const res = spawnSync("npx", ["convex", "deploy", "--yes"], {
55
77
  cwd: ROOT,
56
78
  stdio: "inherit",
57
79
  shell: true, // resolves npx.cmd on Windows
58
- env: {
59
- ...process.env,
60
- CONVEX_SELF_HOSTED_URL: url,
61
- CONVEX_SELF_HOSTED_ADMIN_KEY: adminKey,
62
- },
80
+ env,
63
81
  });
64
82
  if (res.status === 0) {
65
83
  console.log("✓ Convex functions are up to date.");