@cairnvibe/indexer 0.2.3 → 0.2.4

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.
@@ -36,12 +36,17 @@ const WRAPPER_COMPONENT_NAME = "CairnCopilot";
36
36
  function wrapperSource(voice) {
37
37
  // Real bug this closes: choosing voice during `cairn setup` used to save a
38
38
  // DEEPGRAM_API_KEY that nothing ever read — the generated wrapper never
39
- // passed speakEndpoint/transcribeEndpoint, so the widget had no way to
40
- // know voice existed regardless of whether a valid key was configured.
41
- // These routes only exist when ensure-transpile.ts's sibling in setup.ts
42
- // asked init.ts to scaffold them (voice: true) — never reference them here
43
- // unwired to a real backend route.
44
- const voiceProps = voice ? '\n speakEndpoint="/api/copilot/speak"\n transcribeEndpoint="/api/copilot/transcribe"' : "";
39
+ // passed speakEndpoint/transcribeEndpoint/realtimeUrl, so the widget had
40
+ // no way to know voice existed regardless of whether a valid key was
41
+ // configured. These routes only exist when setup.ts asked init.ts to
42
+ // scaffold them (voice: true) — never reference them here unwired to a
43
+ // real backend. realtimeUrl points at the port `cairn-realtime --with`
44
+ // (setup.ts rewrites the dev script to start it alongside next dev) —
45
+ // without that, a widget with realtimeUrl set just fails to connect,
46
+ // which reads as "voice doesn't work" with no clue why.
47
+ const voiceProps = voice
48
+ ? '\n speakEndpoint="/api/copilot/speak"\n transcribeEndpoint="/api/copilot/transcribe"\n realtimeUrl="ws://localhost:3010"'
49
+ : "";
45
50
  return `"use client";
46
51
 
47
52
  import { Copilot } from "@cairnvibe/sdk";
package/dist/manifest.js CHANGED
@@ -27,6 +27,28 @@ function assembleManifest(rootDir, facts, l2, l3) {
27
27
  conflicts: l2.conflicts,
28
28
  };
29
29
  }
30
+ const MUTATING_METHODS = new Set(["POST", "PUT", "PATCH", "DELETE"]);
31
+ /**
32
+ * Turns l1-scan's traced `"POST /api/items/${id}"`-shaped string into
33
+ * structured, executable data — this is what lets a `do` action actually
34
+ * run (verb-executor.ts) instead of only ever describing itself. Only
35
+ * real mutating methods count as an action; `"navigate ..."` (a Link) and
36
+ * a bare GET aren't "do" material — see ApiCallSchema's doc comment in
37
+ * @cairnvibe/core for the safety reasoning (bounded to calls a human
38
+ * developer already wrote and shipped, nothing invented at runtime).
39
+ */
40
+ function parseApiCall(handlerCall) {
41
+ if (!handlerCall)
42
+ return null;
43
+ const spaceIndex = handlerCall.indexOf(" ");
44
+ if (spaceIndex === -1)
45
+ return null;
46
+ const method = handlerCall.slice(0, spaceIndex);
47
+ const url = handlerCall.slice(spaceIndex + 1);
48
+ if (!MUTATING_METHODS.has(method) || !url)
49
+ return null;
50
+ return { method: method, url };
51
+ }
30
52
  function toManifestElement(el, elDesc, baseEvidence) {
31
53
  const evidence = [baseEvidence];
32
54
  if (el.handlerCall)
@@ -41,6 +63,7 @@ function toManifestElement(el, elDesc, baseEvidence) {
41
63
  does: elDesc?.does ?? "Unknown — no description generated for this element.",
42
64
  confidence: elDesc?.confidence ?? 0,
43
65
  evidence,
66
+ apiCall: parseApiCall(el.handlerCall),
44
67
  };
45
68
  }
46
69
  function elementFallbackSelector(el) {
package/dist/setup.js CHANGED
@@ -295,5 +295,24 @@ async function runSetup(dir) {
295
295
  console.log((0, ui_1.dim)("(--if-configured means a build with no key set yet skips this step instead of failing the whole build —"));
296
296
  console.log((0, ui_1.dim)(" set the same key as an environment variable on whatever platform you deploy to.)"));
297
297
  }
298
+ // 8. Wire the realtime voice relay into the normal dev workflow — the
299
+ // other real half of "voice was completely unwired." realtimeUrl on the
300
+ // widget (wired above) just fails to connect if nothing's actually
301
+ // listening on that port; found live, and indistinguishable from "voice
302
+ // doesn't work" with zero indication that a whole separate process needs
303
+ // to be running. `cairn-realtime --with "<original dev command>"` runs
304
+ // both from the one command a project's dev workflow already uses,
305
+ // instead of a second terminal nobody remembers to open. Wraps whatever
306
+ // `dev` already does (a custom server, Turbopack, anything) rather than
307
+ // replacing it — the realtime relay runs alongside it, not instead of it.
308
+ if (wantsVoice && pkg?.scripts?.dev && !pkg.scripts.dev.includes("cairn-realtime")) {
309
+ const pkgPath = node_path_1.default.join(absDir, "package.json");
310
+ const fresh = JSON.parse(node_fs_1.default.readFileSync(pkgPath, "utf8"));
311
+ const originalDev = fresh.scripts.dev;
312
+ fresh.scripts.dev = `cairn-realtime --port 3010 --with ${JSON.stringify(originalDev)}`;
313
+ node_fs_1.default.writeFileSync(pkgPath, JSON.stringify(fresh, null, 2) + "\n");
314
+ console.log((0, ui_1.green)('✓ wired the realtime voice relay into `npm run dev` — it now starts alongside your app automatically.'));
315
+ console.log((0, ui_1.dim)("(a missing/invalid Deepgram key skips voice only, never blocks your app's own dev server from starting.)"));
316
+ }
298
317
  console.log(`\n${(0, ui_1.bold)("Done.")} \`npm run dev\` and ask it something.`);
299
318
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cairnvibe/indexer",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Cairn's analyzer and installer (the `cairn` CLI) — scans Next.js source or crawls any running app, and scaffolds the backend either way.",
5
5
  "license": "MIT",
6
6
  "publishConfig": { "access": "public" },