@habemus-papadum/aiui 0.1.0 → 0.2.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.
@@ -77,8 +77,9 @@ export declare function devtoolsExtensionDir(): string | undefined;
77
77
  /**
78
78
  * Rebuild the aiui-devtools-extension package so the auto-loaded panel is never stale.
79
79
  *
80
- * A full tsc of the extension is ~0.3s cheap enough to run on every launch
81
- * rather than tracking staleness. Best-effort by design: outside a dev
80
+ * A full tsc of the extension (plus the debug-ui esbuild bundle) is well
81
+ * under a second cheap enough to run on every launch rather than tracking
82
+ * staleness. Best-effort by design: outside a dev
82
83
  * checkout (no devtools package, no typescript) it silently does nothing, and
83
84
  * a failing compile warns loudly but never blocks the launch — whatever
84
85
  * `extension/js` already holds is what gets loaded.
@@ -0,0 +1,65 @@
1
+ /**
2
+ * OpenAI key preflight for `aiui claude`.
3
+ *
4
+ * Once the multimodal intent modality is the overlay's default, its speech
5
+ * transcription and correction-diff calls need an OpenAI key — and they run in
6
+ * the *channel* process, which inherits the environment `aiui claude` launches
7
+ * in. The adopted key story (see the multimodal-intent-graduation handoff) is
8
+ * deliberately narrow: the key comes from **`OPENAI_API_KEY` in the
9
+ * environment**, never from `config.json` (a shareable, eventually-committed
10
+ * file must not hold secrets) and never from an `aiui claude` flag.
11
+ *
12
+ * So the launcher's whole job is to *preflight* that env var and tell the user
13
+ * what it found — degradation, not refusal. A missing or rejected key never
14
+ * blocks the launch; the modality still mounts and transcription/correction
15
+ * fall back to mock/off. The most valuable case this catches is the one that
16
+ * bit the bench twice (see workbench field-notes, "Keys & config"): a **stale
17
+ * shell export** shadowing the real key, which surfaces as a confusing 401 deep
18
+ * in the pipeline rather than a clear message up front.
19
+ *
20
+ * We record only a {@link OpenAiKeyStatus} — never the key or any prefix of it —
21
+ * so the launch-info summary (and the DevTools panel that renders it) can
22
+ * explain a degraded pipeline without ever seeing the secret.
23
+ */
24
+ import type { OpenAiKeyStatus } from "@habemus-papadum/aiui-claude-channel";
25
+ export type { OpenAiKeyStatus };
26
+ export interface PreflightOptions {
27
+ /**
28
+ * Perform the authenticated network check. True only for interactive,
29
+ * non-CI launches (the same gate as the Chrome-for-Testing prompts). When
30
+ * false — CI or any non-interactive session — the check is skipped silently
31
+ * and a present key is reported as "unverified", never contacted.
32
+ */
33
+ verify?: boolean;
34
+ /** Injectable for tests; defaults to the process environment. */
35
+ env?: NodeJS.ProcessEnv;
36
+ /** Injectable for tests; defaults to global `fetch`. */
37
+ fetchImpl?: typeof fetch;
38
+ /** Network budget for the status check (default {@link DEFAULT_TIMEOUT_MS}). */
39
+ timeoutMs?: number;
40
+ }
41
+ /**
42
+ * Determine the status of `OPENAI_API_KEY` for this launch.
43
+ *
44
+ * Never throws, never prints, never returns the key. Absent env var →
45
+ * "missing". Present but `verify` off → "unverified" (no network touched).
46
+ * Present and verifying → a single `GET /v1/models` with the bearer, read for
47
+ * **status only**: 2xx → "valid", 401/403 → "invalid", anything else (5xx,
48
+ * 429, a network error, or the timeout) → "unverified" — a key we couldn't
49
+ * confirm is not a key we condemn.
50
+ */
51
+ export declare function preflightOpenAiKey(opts?: PreflightOptions): Promise<OpenAiKeyStatus>;
52
+ interface PreflightMessage {
53
+ level: "warn" | "note";
54
+ title: string;
55
+ detail: string;
56
+ }
57
+ /**
58
+ * The user-facing message for a preflight status, or `null` when there's
59
+ * nothing to say. A valid key is silent — the launcher's terminal stays quiet
60
+ * until something's actually wrong (the same posture as {@link printNote} &c).
61
+ * The copy is data (not printed here) so it can be unit-tested per case.
62
+ */
63
+ export declare function openAiPreflightMessage(status: OpenAiKeyStatus): PreflightMessage | null;
64
+ /** Print the preflight message for `status` (nothing, for a valid key). */
65
+ export declare function reportOpenAiPreflight(status: OpenAiKeyStatus): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@habemus-papadum/aiui",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "ai ui frontends",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -36,10 +36,10 @@
36
36
  "commander": "^15.0.0",
37
37
  "execa": "^9.6.1",
38
38
  "vite": "^6.4.3",
39
- "@habemus-papadum/aiui-claude-channel": "^0.1.0",
40
- "@habemus-papadum/aiui-devtools-extension": "^0.1.0",
41
- "@habemus-papadum/aiui-claude-plugin": "^0.1.0",
42
- "@habemus-papadum/aiui-util": "^0.1.0"
39
+ "@habemus-papadum/aiui-claude-plugin": "^0.2.0",
40
+ "@habemus-papadum/aiui-util": "^0.2.0",
41
+ "@habemus-papadum/aiui-claude-channel": "^0.2.0",
42
+ "@habemus-papadum/aiui-devtools-extension": "^0.2.0"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "tsc --emitDeclarationOnly -p tsconfig.json && vite build",
@@ -14,6 +14,7 @@
14
14
  "@habemus-papadum/aiui-dev-overlay": "__AIUI_VERSION_RANGE__"
15
15
  },
16
16
  "devDependencies": {
17
+ "@babel/core": "^7.29.7",
17
18
  "@habemus-papadum/aiui": "__AIUI_VERSION_RANGE__",
18
19
  "vite": "^6.4.1"
19
20
  }
@@ -6,6 +6,12 @@ import { defineConfig } from "vite";
6
6
  // message format the tool speaks, and bridges the channel port from
7
7
  // `aiui vite` (VITE_AIUI_PORT in this dev server's env) plus this app's source
8
8
  // root into the browser.
9
+ //
10
+ // `locator` turns on compile-time source stamping: every host JSX element gets
11
+ // data-source-loc = "src/…:line:col", and `cell()` call sites get their
12
+ // `{ name, loc }` identity injected — so anything you build here is legible to
13
+ // an agent (the `locate` tool) out of the box. It needs @babel/core (an
14
+ // optional peer, provided as a devDependency of this sandbox).
9
15
  export default defineConfig({
10
- plugins: [aiuiDevOverlay({ format: "text-concat" })],
16
+ plugins: [aiuiDevOverlay({ format: "text-concat", locator: { cellFactories: ["cell"] } })],
11
17
  });