@agent-surface/cli 0.15.0 → 0.16.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.
@@ -1,164 +0,0 @@
1
- import {
2
- createPresenter
3
- } from "./chunk-A5UCBF7D.js";
4
- import {
5
- UsageError,
6
- isPlain,
7
- loadInk,
8
- writeError
9
- } from "./chunk-GYYWHZPM.js";
10
- import {
11
- READING_SOURCE,
12
- authoredIds,
13
- catalogDetailParts,
14
- catalogRows,
15
- displayPath,
16
- extractCapabilities,
17
- findTsconfig
18
- } from "./chunk-NFK3XWWH.js";
19
-
20
- // src/commands/init.tsx
21
- import { existsSync, writeFileSync } from "fs";
22
- import { join } from "path";
23
- import { jsx } from "react/jsx-runtime";
24
- var CONFIG_NAME = "agent-surface.config.tsx";
25
- var ENTRY_CANDIDATES = [
26
- "src/main.tsx",
27
- "src/main.ts",
28
- "src/index.tsx",
29
- "src/App.tsx",
30
- "src/app/App.tsx",
31
- "app/root.tsx"
32
- ];
33
- function scaffold(entry) {
34
- const importPath = entry ? `./${entry.replace(/\.tsx?$/, ".js")}` : "./src/App.js";
35
- return `import { defineSurface } from "@agent-surface/cli";
36
- // TODO: point these at your own composition root \u2014 whatever \`main.tsx\` calls.
37
- // The config should *reuse* how the app builds itself, not restate it.
38
- import { App } from "${importPath}";
39
-
40
- export default defineSurface({
41
- mount: ({ user }) => {
42
- // TODO: build the app the way the app builds itself, and hand back the
43
- // registry it created plus the tree that registers into it.
44
- const app = createApp({ environment: "test", user });
45
- return { registry: app.registry, ui: <App app={app} />, app };
46
- },
47
-
48
- // Named prop bundles. Free-form \u2014 a user, a route, a feature flag; the CLI
49
- // never interprets them. Every scenario you leave out is a surface nothing
50
- // measures, which is what \`--depth full\` reports as unreached.
51
- scenarios: {
52
- default: { user: { id: "u_1", permissions: [] } },
53
- },
54
- });
55
- `;
56
- }
57
- async function runInit(options) {
58
- const configPath = join(options.cwd, CONFIG_NAME);
59
- if (existsSync(configPath)) {
60
- throw new UsageError(
61
- `${displayPath(configPath)} already exists \u2014 edit it, or delete it and re-run`
62
- );
63
- }
64
- const tsconfig = options.tsconfig ?? findTsconfig(options.cwd);
65
- if (!tsconfig) {
66
- throw new UsageError(
67
- `no tsconfig.json found from ${options.cwd} \u2014 agent-surface reads your TypeScript program to find registration call sites, and cannot do that without one`
68
- );
69
- }
70
- const present = await createPresenter(options);
71
- await present.wait(READING_SOURCE);
72
- const inventory = extractCapabilities({ root: options.cwd, tsconfig });
73
- const ids = authoredIds(inventory);
74
- const entry = ENTRY_CANDIDATES.find((candidate) => existsSync(join(options.cwd, candidate)));
75
- const parts = [
76
- {
77
- kind: "blocks",
78
- blocks: [
79
- {
80
- title: "SURFACE INIT",
81
- rows: [
82
- { label: "Tsconfig", text: displayPath(tsconfig) },
83
- { label: "Config", text: `${displayPath(configPath)} \u2014 to be written` }
84
- ]
85
- },
86
- { title: "STATIC CATALOG", rows: catalogRows(inventory) }
87
- ]
88
- },
89
- ...ids.size > 0 ? catalogDetailParts(inventory) : []
90
- ];
91
- if (ids.size === 0) {
92
- parts.push({
93
- kind: "note",
94
- lines: [
95
- "Nothing is annotated yet \u2014 that is the default, and it is the safe one: a capability",
96
- "exists only where someone wrote one. Start with `useAgentComponent` in a component",
97
- "that owns state worth acting on, then re-run this."
98
- ]
99
- });
100
- }
101
- parts.push({
102
- kind: "note",
103
- title: "SCAFFOLD",
104
- lines: [
105
- ` ${displayPath(configPath)}`,
106
- entry ? ` imports ./${entry}, which you will still have to wire into a mount()` : " no app entry found, so the import line is a placeholder you will have to point somewhere"
107
- ]
108
- });
109
- await present.emit(...parts);
110
- if (!options.yes) {
111
- const answered = await ask(options, `Write ${CONFIG_NAME}?`);
112
- if (!answered) {
113
- await present.emit({ kind: "note", lines: ["Nothing written."] });
114
- return 0;
115
- }
116
- }
117
- writeFileSync(configPath, scaffold(entry), "utf8");
118
- await present.emit(
119
- { kind: "note", lines: [`wrote ${displayPath(configPath)}`] },
120
- {
121
- kind: "steps",
122
- title: "NEXT STEPS",
123
- steps: [
124
- "fill in mount() \u2014 it should call your existing composition root",
125
- "`agent-surface inspect` to see what an agent can reach",
126
- "`agent-surface snapshot` to commit the baseline, then `check` in CI"
127
- ]
128
- }
129
- );
130
- return 0;
131
- }
132
- async function ask(options, question) {
133
- if (isPlain(options) || process.stdin.isTTY !== true) {
134
- writeError("");
135
- writeError("stdin is not a terminal, so there is nobody to ask \u2014 re-run with --yes to accept.");
136
- return false;
137
- }
138
- const ink = await loadInk();
139
- if (!ink) {
140
- writeError("");
141
- writeError("no interactive renderer available here \u2014 re-run with --yes to accept.");
142
- return false;
143
- }
144
- const { render } = await import("ink");
145
- return new Promise((resolve) => {
146
- const instance = render(
147
- /* @__PURE__ */ jsx(
148
- ink.Confirm,
149
- {
150
- question,
151
- onAnswer: (yes) => {
152
- instance.clear();
153
- instance.unmount();
154
- resolve(yes);
155
- }
156
- }
157
- )
158
- );
159
- });
160
- }
161
- export {
162
- runInit
163
- };
164
- //# sourceMappingURL=init-BVZR6CRS.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/init.tsx"],"sourcesContent":["import { existsSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { UsageError } from \"../analysis.js\";\nimport { authoredIds, extractCapabilities, findTsconfig } from \"../extract.js\";\nimport { isPlain, loadInk, writeError } from \"../output.js\";\nimport { createPresenter } from \"../render/present.js\";\nimport {\n catalogDetailParts,\n catalogRows,\n displayPath,\n READING_SOURCE,\n type ReportPart,\n} from \"../render/summary.js\";\n\nexport interface InitOptions {\n cwd: string;\n tsconfig?: string;\n yes?: boolean;\n plain?: boolean;\n}\n\nconst CONFIG_NAME = \"agent-surface.config.tsx\";\n\n/**\n * Where an app is usually assembled. `init` does not *probe* these — it cannot,\n * because a surface config needs a `mount()` that builds the app, and there is\n * no export a tool can import to get one. It names the likeliest file so the\n * scaffold's import line points somewhere real more often than not.\n */\nconst ENTRY_CANDIDATES = [\n \"src/main.tsx\",\n \"src/main.ts\",\n \"src/index.tsx\",\n \"src/App.tsx\",\n \"src/app/App.tsx\",\n \"app/root.tsx\",\n];\n\nfunction scaffold(entry: string | undefined): string {\n const importPath = entry ? `./${entry.replace(/\\.tsx?$/, \".js\")}` : \"./src/App.js\";\n return `import { defineSurface } from \"@agent-surface/cli\";\n// TODO: point these at your own composition root — whatever \\`main.tsx\\` calls.\n// The config should *reuse* how the app builds itself, not restate it.\nimport { App } from \"${importPath}\";\n\nexport default defineSurface({\n mount: ({ user }) => {\n // TODO: build the app the way the app builds itself, and hand back the\n // registry it created plus the tree that registers into it.\n const app = createApp({ environment: \"test\", user });\n return { registry: app.registry, ui: <App app={app} />, app };\n },\n\n // Named prop bundles. Free-form — a user, a route, a feature flag; the CLI\n // never interprets them. Every scenario you leave out is a surface nothing\n // measures, which is what \\`--depth full\\` reports as unreached.\n scenarios: {\n default: { user: { id: \"u_1\", permissions: [] } },\n },\n});\n`;\n}\n\n/**\n * `agent-surface init` — the on-ramp.\n *\n * It reads the codebase first and writes nothing before it has shown you what\n * it found. That order is the whole point: the number it prints is the one\n * every later command is relative to, and a scaffold that appears before the\n * summary asks you to accept a config for a codebase neither of you has looked\n * at yet.\n *\n * It mounts nothing and needs no config to exist — it is `--depth static` with\n * a file write on the end, and it says so in the same blocks `inspect --depth\n * static` uses, so the first report a reader ever sees is the one they will go\n * on seeing.\n */\nexport async function runInit(options: InitOptions): Promise<number> {\n const configPath = join(options.cwd, CONFIG_NAME);\n if (existsSync(configPath)) {\n throw new UsageError(\n `${displayPath(configPath)} already exists — edit it, or delete it and re-run`,\n );\n }\n\n const tsconfig = options.tsconfig ?? findTsconfig(options.cwd);\n if (!tsconfig) {\n throw new UsageError(\n `no tsconfig.json found from ${options.cwd} — agent-surface reads your TypeScript program ` +\n \"to find registration call sites, and cannot do that without one\",\n );\n }\n\n const present = await createPresenter(options);\n await present.wait(READING_SOURCE);\n const inventory = extractCapabilities({ root: options.cwd, tsconfig });\n const ids = authoredIds(inventory);\n const entry = ENTRY_CANDIDATES.find((candidate) => existsSync(join(options.cwd, candidate)));\n\n const parts: ReportPart[] = [\n {\n kind: \"blocks\",\n blocks: [\n {\n title: \"SURFACE INIT\",\n rows: [\n { label: \"Tsconfig\", text: displayPath(tsconfig) },\n { label: \"Config\", text: `${displayPath(configPath)} — to be written` },\n ],\n },\n { title: \"STATIC CATALOG\", rows: catalogRows(inventory) },\n ],\n },\n ...(ids.size > 0 ? catalogDetailParts(inventory) : []),\n ];\n\n if (ids.size === 0) {\n parts.push({\n kind: \"note\",\n lines: [\n \"Nothing is annotated yet — that is the default, and it is the safe one: a capability\",\n \"exists only where someone wrote one. Start with `useAgentComponent` in a component\",\n \"that owns state worth acting on, then re-run this.\",\n ],\n });\n }\n\n parts.push({\n kind: \"note\",\n title: \"SCAFFOLD\",\n lines: [\n ` ${displayPath(configPath)}`,\n entry\n ? ` imports ./${entry}, which you will still have to wire into a mount()`\n : \" no app entry found, so the import line is a placeholder you will have to point somewhere\",\n ],\n });\n await present.emit(...parts);\n\n if (!options.yes) {\n const answered = await ask(options, `Write ${CONFIG_NAME}?`);\n if (!answered) {\n await present.emit({ kind: \"note\", lines: [\"Nothing written.\"] });\n return 0;\n }\n }\n\n writeFileSync(configPath, scaffold(entry), \"utf8\");\n await present.emit(\n { kind: \"note\", lines: [`wrote ${displayPath(configPath)}`] },\n {\n kind: \"steps\",\n title: \"NEXT STEPS\",\n steps: [\n \"fill in mount() — it should call your existing composition root\",\n \"`agent-surface inspect` to see what an agent can reach\",\n \"`agent-surface snapshot` to commit the baseline, then `check` in CI\",\n ],\n },\n );\n return 0;\n}\n\n/**\n * There is no prompt to give when nothing is attached to answer it. Failing\n * with the flag that would have worked beats writing a file the caller never\n * agreed to, and beats hanging on a read that will never return.\n */\nasync function ask(options: InitOptions, question: string): Promise<boolean> {\n if (isPlain(options) || process.stdin.isTTY !== true) {\n writeError(\"\");\n writeError(\"stdin is not a terminal, so there is nobody to ask — re-run with --yes to accept.\");\n return false;\n }\n const ink = await loadInk();\n if (!ink) {\n writeError(\"\");\n writeError(\"no interactive renderer available here — re-run with --yes to accept.\");\n return false;\n }\n const { render } = await import(\"ink\");\n return new Promise<boolean>((resolve) => {\n const instance = render(\n <ink.Confirm\n question={question}\n onAnswer={(yes) => {\n instance.clear();\n instance.unmount();\n resolve(yes);\n }}\n />,\n );\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,qBAAqB;AAC1C,SAAS,YAAY;AAsLf;AAlKN,IAAM,cAAc;AAQpB,IAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,SAAS,OAAmC;AACnD,QAAM,aAAa,QAAQ,KAAK,MAAM,QAAQ,WAAW,KAAK,CAAC,KAAK;AACpE,SAAO;AAAA;AAAA;AAAA,uBAGc,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBjC;AAgBA,eAAsB,QAAQ,SAAuC;AACnE,QAAM,aAAa,KAAK,QAAQ,KAAK,WAAW;AAChD,MAAI,WAAW,UAAU,GAAG;AAC1B,UAAM,IAAI;AAAA,MACR,GAAG,YAAY,UAAU,CAAC;AAAA,IAC5B;AAAA,EACF;AAEA,QAAM,WAAW,QAAQ,YAAY,aAAa,QAAQ,GAAG;AAC7D,MAAI,CAAC,UAAU;AACb,UAAM,IAAI;AAAA,MACR,+BAA+B,QAAQ,GAAG;AAAA,IAE5C;AAAA,EACF;AAEA,QAAM,UAAU,MAAM,gBAAgB,OAAO;AAC7C,QAAM,QAAQ,KAAK,cAAc;AACjC,QAAM,YAAY,oBAAoB,EAAE,MAAM,QAAQ,KAAK,SAAS,CAAC;AACrE,QAAM,MAAM,YAAY,SAAS;AACjC,QAAM,QAAQ,iBAAiB,KAAK,CAAC,cAAc,WAAW,KAAK,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A,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAOA,eAAe,IAAI,SAAsB,UAAoC;AAC3E,MAAI,QAAQ,OAAO,KAAK,QAAQ,MAAM,UAAU,MAAM;AACpD,eAAW,EAAE;AACb,eAAW,wFAAmF;AAC9F,WAAO;AAAA,EACT;AACA,QAAM,MAAM,MAAM,QAAQ;AAC1B,MAAI,CAAC,KAAK;AACR,eAAW,EAAE;AACb,eAAW,4EAAuE;AAClF,WAAO;AAAA,EACT;AACA,QAAM,EAAE,OAAO,IAAI,MAAM,OAAO,KAAK;AACrC,SAAO,IAAI,QAAiB,CAAC,YAAY;AACvC,UAAM,WAAW;AAAA,MACf;AAAA,QAAC,IAAI;AAAA,QAAJ;AAAA,UACC;AAAA,UACA,UAAU,CAAC,QAAQ;AACjB,qBAAS,MAAM;AACf,qBAAS,QAAQ;AACjB,oBAAQ,GAAG;AAAA,UACb;AAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -1,345 +0,0 @@
1
- import {
2
- STATUS_WIDTH,
3
- flatRows,
4
- reportGrid,
5
- riskClause
6
- } from "./chunk-NFK3XWWH.js";
7
-
8
- // src/render/ink.tsx
9
- import { Box, Static, Text, useInput } from "ink";
10
- import Spinner from "ink-spinner";
11
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
- var OUTCOME = {
13
- expose: { mark: "\u25CF", color: "green", state: "callable" },
14
- disable: { mark: "\u25D0", color: "yellow", state: "disabled" },
15
- hide: { mark: "\u25CB", color: "red", state: "hidden" }
16
- };
17
- var STATUS_COLOR = {
18
- PASS: "green",
19
- WARN: "yellow",
20
- FAIL: "red",
21
- ERROR: "red"
22
- };
23
- var TONE_COLOR = { good: "green", warn: "yellow", bad: "red" };
24
- var NONE = "\u2014";
25
- function widthsFor(headers, rows) {
26
- return headers.map(
27
- (header, column) => Math.max(header.length, ...rows.map((row) => (row[column] ?? "").length))
28
- );
29
- }
30
- function pad(value, width) {
31
- return value.padEnd(width);
32
- }
33
- function Confirm({
34
- question,
35
- onAnswer
36
- }) {
37
- useInput((input, key) => {
38
- if (key.return || input.toLowerCase() === "y") onAnswer(true);
39
- else if (key.escape || input.toLowerCase() === "n" || key.ctrl && input === "c") {
40
- onAnswer(false);
41
- }
42
- });
43
- return /* @__PURE__ */ jsxs(Box, { marginTop: 1, children: [
44
- /* @__PURE__ */ jsx(Text, { bold: true, children: question }),
45
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: " (Y/n) " })
46
- ] });
47
- }
48
- function Loading({ label }) {
49
- return /* @__PURE__ */ jsxs(Text, { children: [
50
- /* @__PURE__ */ jsx(Text, { color: "cyan", children: /* @__PURE__ */ jsx(Spinner, { type: "dots" }) }),
51
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: ` ${label}\u2026` })
52
- ] });
53
- }
54
- function Row({ row, width, statuses }) {
55
- return /* @__PURE__ */ jsxs(Box, { children: [
56
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: pad(row.label, width) }),
57
- statuses ? /* @__PURE__ */ jsx(Text, { bold: true, color: row.status ? STATUS_COLOR[row.status] : void 0, children: pad(row.status ?? "", STATUS_WIDTH) }) : null,
58
- /* @__PURE__ */ jsx(Text, { color: row.tone ? TONE_COLOR[row.tone] : void 0, wrap: "wrap", children: row.text })
59
- ] });
60
- }
61
- function Report({
62
- blocks,
63
- labelWidth
64
- }) {
65
- const grid = reportGrid(blocks, labelWidth);
66
- const drawn = blocks.filter((block) => block.title || block.rows.length > 0);
67
- return /* @__PURE__ */ jsx(
68
- Static,
69
- {
70
- items: drawn.map((block, index) => ({ key: block.title ?? `block-${index}`, block, index })),
71
- children: ({ key, block, index }) => /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: index === 0 ? 0 : 1, children: [
72
- block.title ? /* @__PURE__ */ jsx(Text, { bold: true, children: block.title }) : null,
73
- block.rows.map((row) => /* @__PURE__ */ jsx(Row, { row, width: grid.label, statuses: grid.statuses }, row.label))
74
- ] }, key)
75
- }
76
- );
77
- }
78
- function Grid({ headers, rows }) {
79
- const widths = widthsFor(
80
- headers,
81
- rows.map((row) => row.cells)
82
- );
83
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
84
- /* @__PURE__ */ jsx(Box, { children: headers.map((header, column) => /* @__PURE__ */ jsx(Text, { dimColor: true, bold: true, children: column === headers.length - 1 ? header : `${pad(header, widths[column])} ` }, header)) }),
85
- rows.map((row, index) => /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
86
- /* @__PURE__ */ jsx(Box, { children: row.cells.map((cell, column) => /* @__PURE__ */ jsx(Text, { bold: column === 0, children: column === headers.length - 1 ? cell : `${pad(cell, widths[column])} ` }, `${column}`)) }),
87
- row.note ? /* @__PURE__ */ jsx(Box, { paddingLeft: 4, children: /* @__PURE__ */ jsx(Text, { dimColor: true, wrap: "wrap", children: `\u2937 ${row.note}` }) }) : null
88
- ] }, `${row.cells[0]}-${index}`))
89
- ] });
90
- }
91
- function Table({
92
- title,
93
- lead,
94
- headers,
95
- rows
96
- }) {
97
- return /* @__PURE__ */ jsx(Static, { items: [{ key: title }], children: (block) => /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
98
- /* @__PURE__ */ jsx(Text, { bold: true, children: title }),
99
- lead ? /* @__PURE__ */ jsx(Text, { dimColor: true, wrap: "wrap", children: lead }) : null,
100
- /* @__PURE__ */ jsx(Grid, { headers, rows })
101
- ] }, block.key) });
102
- }
103
- function Note({
104
- title,
105
- lines,
106
- muted
107
- }) {
108
- return /* @__PURE__ */ jsx(Static, { items: [{ key: title ?? lines[0] ?? "note" }], children: (block) => /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
109
- title ? /* @__PURE__ */ jsx(Text, { bold: true, children: title }) : null,
110
- lines.map((line, index) => /* @__PURE__ */ jsx(Text, { dimColor: muted === true, children: line }, `${index}`))
111
- ] }, block.key) });
112
- }
113
- function Steps({ title, steps }) {
114
- return /* @__PURE__ */ jsx(Static, { items: [{ key: title }], children: (block) => /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
115
- /* @__PURE__ */ jsx(Text, { bold: true, children: title }),
116
- steps.map((step, index) => /* @__PURE__ */ jsxs(Box, { paddingLeft: 2, children: [
117
- /* @__PURE__ */ jsx(Text, { color: "cyan", children: `${index + 1}. ` }),
118
- /* @__PURE__ */ jsx(Text, { wrap: "wrap", children: step })
119
- ] }, `${index}`))
120
- ] }, block.key) });
121
- }
122
- function Findings({ sections }) {
123
- return /* @__PURE__ */ jsx(
124
- Static,
125
- {
126
- items: sections.map((section, index) => ({ key: `${section.title}-${index}`, section, index })),
127
- children: ({ key, section, index }) => /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: index === 0 ? 0 : 1, children: [
128
- /* @__PURE__ */ jsxs(Box, { children: [
129
- /* @__PURE__ */ jsx(
130
- Text,
131
- {
132
- backgroundColor: section.tone === "notice" ? "yellow" : "red",
133
- color: "black",
134
- bold: true,
135
- children: ` ${section.title} `
136
- }
137
- ),
138
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: ` ${section.gloss}${section.count > 0 ? ` ${section.count}` : ""}` })
139
- ] }),
140
- section.headers && section.rows ? /* @__PURE__ */ jsx(Grid, { headers: section.headers, rows: section.rows }) : null,
141
- (section.lines ?? []).map((line, index2) => /* @__PURE__ */ jsx(Box, { paddingLeft: 2, children: /* @__PURE__ */ jsx(Text, { children: line }) }, `${index2}`)),
142
- section.hint ? /* @__PURE__ */ jsx(Box, { paddingLeft: 2, children: /* @__PURE__ */ jsx(Text, { color: "cyan", wrap: "wrap", children: `\u2192 ${section.hint}` }) }) : null
143
- ] }, key)
144
- }
145
- );
146
- }
147
- function PolicyLine({
148
- policy
149
- }) {
150
- const vote = policy.discovery?.decision;
151
- const color = vote === "hide" ? "red" : vote === "disable" ? "yellow" : "green";
152
- return /* @__PURE__ */ jsxs(Box, { paddingLeft: 6, children: [
153
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "policy " }),
154
- /* @__PURE__ */ jsx(Text, { bold: true, children: policy.name }),
155
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: ` (${policy.scope}${policy.phases.length ? `, ${policy.phases.join("/")}` : ""}) ` }),
156
- vote ? /* @__PURE__ */ jsxs(Text, { color, children: [
157
- vote,
158
- policy.discovery?.decision === "disable" ? ` \u2014 ${policy.discovery.reason}` : ""
159
- ] }) : /* @__PURE__ */ jsx(Text, { dimColor: true, children: "no discovery hook" }),
160
- policy.threw ? /* @__PURE__ */ jsx(Text, { color: "red", bold: true, children: " THREW" }) : null,
161
- policy.confirmationEscalation ? /* @__PURE__ */ jsx(Text, { color: "magenta", children: " escalates-confirmation" }) : null
162
- ] });
163
- }
164
- function Capability({ row }) {
165
- const outcome = OUTCOME[row.outcome];
166
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
167
- /* @__PURE__ */ jsxs(Box, { children: [
168
- /* @__PURE__ */ jsx(Text, { color: outcome.color, children: ` ${outcome.mark} ` }),
169
- /* @__PURE__ */ jsx(Text, { bold: true, children: row.name }),
170
- row.tags.length > 0 ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: ` ${row.tags.join(" \xB7 ")}` }) : null
171
- ] }),
172
- /* @__PURE__ */ jsx(Box, { paddingLeft: 4, children: /* @__PURE__ */ jsx(Text, { dimColor: true, wrap: "wrap", children: row.description }) }),
173
- row.reason ? /* @__PURE__ */ jsx(Box, { paddingLeft: 4, children: /* @__PURE__ */ jsx(Text, { color: "yellow", wrap: "wrap", children: `\u2937 ${row.reason}` }) }) : null,
174
- row.policies ? row.policies.length > 0 ? row.policies.map((policy, index) => /* @__PURE__ */ jsx(PolicyLine, { policy }, `${policy.name}-${index}`)) : [
175
- /* @__PURE__ */ jsx(Box, { paddingLeft: 6, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: "policies: none" }) }, "none")
176
- ] : null,
177
- row.policies && row.availability && !row.availability.available ? /* @__PURE__ */ jsx(Box, { paddingLeft: 6, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: `availability: unavailable${row.availability.reason ? ` \u2014 ${row.availability.reason}` : ""}` }) }) : null,
178
- row.schemas?.input !== void 0 ? /* @__PURE__ */ jsx(Box, { paddingLeft: 6, children: /* @__PURE__ */ jsx(Text, { dimColor: true, wrap: "wrap", children: `input: ${JSON.stringify(row.schemas.input)}` }) }) : null,
179
- row.schemas?.output !== void 0 ? /* @__PURE__ */ jsx(Box, { paddingLeft: 6, children: /* @__PURE__ */ jsx(Text, { dimColor: true, wrap: "wrap", children: `output: ${JSON.stringify(row.schemas.output)}` }) }) : null
180
- ] });
181
- }
182
- function Group({ group }) {
183
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
184
- /* @__PURE__ */ jsxs(Box, { children: [
185
- /* @__PURE__ */ jsx(Text, { backgroundColor: "blueBright", color: "black", bold: true, children: ` ${group.heading} ` }),
186
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: ` ${group.rows.length}` })
187
- ] }),
188
- group.rows.map((row) => /* @__PURE__ */ jsx(Capability, { row }, `${row.capabilityId}-${row.name}`))
189
- ] });
190
- }
191
- function Header({ view }) {
192
- const risk = riskClause(flatRows(view));
193
- return /* @__PURE__ */ jsxs(Box, { children: [
194
- /* @__PURE__ */ jsx(Text, { bold: true, children: view.scenario }),
195
- view.route ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: ` ${view.route}` }) : null,
196
- view.scope && view.scope.length > 0 ? /* @__PURE__ */ jsx(Text, { color: "cyan", children: ` scope ${view.scope.join(" ")}` }) : null,
197
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: " \xB7 " }),
198
- /* @__PURE__ */ jsx(Text, { color: "green", children: `${view.counts.callable} callable` }),
199
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: ", " }),
200
- /* @__PURE__ */ jsx(Text, { color: "yellow", children: `${view.counts.disabled} visible-disabled` }),
201
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: ", " }),
202
- /* @__PURE__ */ jsx(Text, { color: "red", children: `${view.counts.hidden} hidden` }),
203
- view.rejections.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
204
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: ", " }),
205
- /* @__PURE__ */ jsx(Text, { color: "magenta", children: `${view.rejections.length} registration${view.rejections.length === 1 ? "" : "s"} rejected` })
206
- ] }) : null,
207
- risk ? /* @__PURE__ */ jsxs(Fragment, { children: [
208
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: " \xB7 " }),
209
- /* @__PURE__ */ jsx(Text, { color: "magenta", children: risk })
210
- ] }) : null
211
- ] });
212
- }
213
- function Rejections({ view }) {
214
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
215
- /* @__PURE__ */ jsxs(Box, { children: [
216
- /* @__PURE__ */ jsx(Text, { backgroundColor: "magenta", color: "black", bold: true, children: " rejected during mount " }),
217
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: ` ${view.rejections.length}` })
218
- ] }),
219
- view.rejections.map((rejection) => /* @__PURE__ */ jsxs(Box, { children: [
220
- /* @__PURE__ */ jsx(Text, { color: "magenta", children: " ! " }),
221
- /* @__PURE__ */ jsx(Text, { bold: true, children: `${rejection.componentType} (${rejection.instanceId})` }),
222
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: rejection.reason === "duplicate" ? " duplicate \u2014 an earlier registration holds this key" : " guard \u2014 onRegister rejected this registration" })
223
- ] }, `${rejection.componentType}@${rejection.instanceId}-${rejection.reason}`))
224
- ] });
225
- }
226
- function Empty({ view }) {
227
- if (view.counts.hidden > 0) {
228
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
229
- /* @__PURE__ */ jsxs(Text, { dimColor: true, wrap: "wrap", children: [
230
- `Nothing is callable here \u2014 all ${view.counts.hidden} registered capabilities were hidden by policy. `,
231
- "The surface is empty by decision, not because nothing was annotated."
232
- ] }),
233
- view.explained ? null : /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Re-run with --explain to see which policy hid them." })
234
- ] });
235
- }
236
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
237
- /* @__PURE__ */ jsx(Text, { dimColor: true, wrap: "wrap", children: "Nothing is registered for this scenario \u2014 the agent has no surface here. That is the default: capabilities exist only where they were explicitly annotated." }),
238
- view.explained ? null : /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Re-run with --explain to see whether a policy hid it." })
239
- ] });
240
- }
241
- var HEADERS = ["CAPABILITY", "KIND", "EFFECT", "STATE", "FLAGS"];
242
- function cellsFor(row) {
243
- return [
244
- row.path,
245
- row.kind,
246
- row.effect ?? NONE,
247
- OUTCOME[row.outcome].state,
248
- row.flags.length > 0 ? row.flags.join(" \xB7 ") : NONE
249
- ];
250
- }
251
- function TableRow({
252
- row,
253
- cells,
254
- widths
255
- }) {
256
- const outcome = OUTCOME[row.outcome];
257
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
258
- /* @__PURE__ */ jsxs(Box, { children: [
259
- /* @__PURE__ */ jsx(Text, { bold: true, children: `${pad(cells[0], widths[0])} ` }),
260
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: `${pad(cells[1], widths[1])} ` }),
261
- /* @__PURE__ */ jsx(Text, { children: `${pad(cells[2], widths[2])} ` }),
262
- /* @__PURE__ */ jsx(Text, { color: outcome.color, children: `${pad(cells[3], widths[3])} ` }),
263
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: cells[4] })
264
- ] }),
265
- row.reason ? /* @__PURE__ */ jsx(Box, { paddingLeft: 4, children: /* @__PURE__ */ jsx(Text, { color: "yellow", wrap: "wrap", children: `\u2937 ${row.reason}` }) }) : null
266
- ] });
267
- }
268
- function CapabilityTable({ rows }) {
269
- const cells = rows.map(cellsFor);
270
- const widths = widthsFor(HEADERS, cells);
271
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
272
- /* @__PURE__ */ jsx(Box, { children: HEADERS.map((header, column) => /* @__PURE__ */ jsx(Text, { dimColor: true, bold: true, children: column === HEADERS.length - 1 ? header : `${pad(header, widths[column])} ` }, header)) }),
273
- rows.map((row, index) => /* @__PURE__ */ jsx(
274
- TableRow,
275
- {
276
- row,
277
- cells: cells[index],
278
- widths
279
- },
280
- `${row.capabilityId}-${index}`
281
- ))
282
- ] });
283
- }
284
- function Part({
285
- part,
286
- labelWidth
287
- }) {
288
- switch (part.kind) {
289
- case "blocks":
290
- return /* @__PURE__ */ jsx(Report, { blocks: part.blocks, ...labelWidth ? { labelWidth } : {} });
291
- case "table":
292
- return /* @__PURE__ */ jsx(
293
- Table,
294
- {
295
- title: part.title,
296
- ...part.lead ? { lead: part.lead } : {},
297
- headers: part.headers,
298
- rows: part.rows
299
- }
300
- );
301
- case "findings":
302
- return /* @__PURE__ */ jsx(Findings, { sections: part.sections });
303
- case "surface":
304
- return /* @__PURE__ */ jsx(Surface, { view: part.view, ...part.detail ? { detail: true } : {} });
305
- case "note":
306
- return /* @__PURE__ */ jsx(
307
- Note,
308
- {
309
- ...part.title ? { title: part.title } : {},
310
- ...part.muted ? { muted: true } : {},
311
- lines: part.lines
312
- }
313
- );
314
- case "steps":
315
- return /* @__PURE__ */ jsx(Steps, { title: part.title, steps: part.steps });
316
- }
317
- }
318
- function Surface({
319
- view,
320
- detail
321
- }) {
322
- const populated = view.groups.filter((group) => group.rows.length > 0);
323
- const rows = flatRows(view);
324
- const blocks = [
325
- { key: "__header" },
326
- ...detail ? populated.map((group) => ({ key: group.heading, group })) : rows.length > 0 ? [{ key: "__table", rows }] : []
327
- ];
328
- return /* @__PURE__ */ jsx(Static, { items: blocks, children: (block) => block.group ? /* @__PURE__ */ jsx(Group, { group: block.group }, block.key) : block.rows ? /* @__PURE__ */ jsx(CapabilityTable, { rows: block.rows }, block.key) : /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
329
- /* @__PURE__ */ jsx(Header, { view }),
330
- view.rejections.length > 0 ? /* @__PURE__ */ jsx(Rejections, { view }) : null,
331
- rows.length === 0 ? /* @__PURE__ */ jsx(Empty, { view }) : null
332
- ] }, block.key) });
333
- }
334
- export {
335
- Confirm,
336
- Findings,
337
- Loading,
338
- Note,
339
- Part,
340
- Report,
341
- Steps,
342
- Surface,
343
- Table
344
- };
345
- //# sourceMappingURL=ink-ZCQ26EY4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/render/ink.tsx"],"sourcesContent":["import type { ReactElement } from \"react\";\nimport { Box, Static, Text, useInput } from \"ink\";\nimport Spinner from \"ink-spinner\";\nimport type { CapabilityRow, CapabilityGroup, SurfaceView } from \"./model.js\";\nimport { flatRows } from \"./model.js\";\nimport {\n reportGrid,\n riskClause,\n STATUS_WIDTH,\n type FindingSection,\n type ReportBlock,\n type ReportPart,\n type ReportRow,\n type TableRow,\n} from \"./summary.js\";\n\nconst OUTCOME = {\n expose: { mark: \"●\", color: \"green\" as const, state: \"callable\" },\n disable: { mark: \"◐\", color: \"yellow\" as const, state: \"disabled\" },\n hide: { mark: \"○\", color: \"red\" as const, state: \"hidden\" },\n};\n\nconst STATUS_COLOR = {\n PASS: \"green\",\n WARN: \"yellow\",\n FAIL: \"red\",\n ERROR: \"red\",\n} as const;\n\nconst TONE_COLOR = { good: \"green\", warn: \"yellow\", bad: \"red\" } as const;\n\nconst NONE = \"—\";\n\n/**\n * Same column widths as the plain renderer computes, and for the same reason:\n * from the content, never from the terminal. A TTY table that reflows on resize\n * and a piped table that does not would be two different renderings of one view\n * model, which is exactly what this file exists to prevent.\n */\nfunction widthsFor(headers: string[], rows: string[][]): number[] {\n return headers.map((header, column) =>\n Math.max(header.length, ...rows.map((row) => (row[column] ?? \"\").length)),\n );\n}\n\nfunction pad(value: string, width: number): string {\n return value.padEnd(width);\n}\n\n/**\n * `init`'s one question. Enter accepts, because the answer this asks for is the\n * one the summary above it has already made the case for — and because a\n * scaffold is the least destructive thing this package writes.\n */\nexport function Confirm({\n question,\n onAnswer,\n}: {\n question: string;\n onAnswer: (yes: boolean) => void;\n}): ReactElement {\n useInput((input, key) => {\n if (key.return || input.toLowerCase() === \"y\") onAnswer(true);\n else if (key.escape || input.toLowerCase() === \"n\" || (key.ctrl && input === \"c\")) {\n onAnswer(false);\n }\n });\n return (\n <Box marginTop={1}>\n <Text bold>{question}</Text>\n <Text dimColor>{\" (Y/n) \"}</Text>\n </Box>\n );\n}\n\nexport function Loading({ label }: { label: string }): ReactElement {\n return (\n <Text>\n <Text color=\"cyan\">\n <Spinner type=\"dots\" />\n </Text>\n <Text dimColor>{` ${label}…`}</Text>\n </Text>\n );\n}\n\n/** One `label STATUS text` row, coloured by whichever of the two it carries. */\nfunction Row({ row, width, statuses }: { row: ReportRow; width: number; statuses: boolean }): ReactElement {\n return (\n <Box>\n <Text dimColor>{pad(row.label, width)}</Text>\n {statuses ? (\n <Text bold color={row.status ? STATUS_COLOR[row.status] : undefined}>\n {pad(row.status ?? \"\", STATUS_WIDTH)}\n </Text>\n ) : null}\n <Text color={row.tone ? TONE_COLOR[row.tone] : undefined} wrap=\"wrap\">\n {row.text}\n </Text>\n </Box>\n );\n}\n\n/**\n * The labelled blocks a report is built from — the run header, the catalog\n * summary, the closing verdict. Same rows the plain renderer prints, same\n * widths from the same `reportGrid`, with the status word and the tone carrying\n * colour on a terminal.\n */\nexport function Report({\n blocks,\n labelWidth,\n}: {\n blocks: ReportBlock[];\n labelWidth?: number;\n}): ReactElement {\n const grid = reportGrid(blocks, labelWidth);\n // An empty, untitled block is dropped rather than painted, exactly as the\n // plain renderer drops it — otherwise the same report carries a blank line in\n // the terminal that a CI log does not have.\n const drawn = blocks.filter((block) => block.title || block.rows.length > 0);\n // Ink prints a newline of its own after each painted frame, so only the\n // blocks *within* one frame ask for the blank line above them. A margin on\n // the first would double it, which reads as a missing block rather than as\n // breathing room.\n return (\n <Static\n items={drawn.map((block, index) => ({ key: block.title ?? `block-${index}`, block, index }))}\n >\n {({ key, block, index }) => (\n <Box key={key} flexDirection=\"column\" marginTop={index === 0 ? 0 : 1}>\n {block.title ? <Text bold>{block.title}</Text> : null}\n {block.rows.map((row) => (\n <Row key={row.label} row={row} width={grid.label} statuses={grid.statuses} />\n ))}\n </Box>\n )}\n </Static>\n );\n}\n\nfunction Grid({ headers, rows }: { headers: string[]; rows: TableRow[] }): ReactElement {\n const widths = widthsFor(\n headers,\n rows.map((row) => row.cells),\n );\n return (\n <Box flexDirection=\"column\">\n <Box>\n {headers.map((header, column) => (\n <Text key={header} dimColor bold>\n {column === headers.length - 1 ? header : `${pad(header, widths[column]!)} `}\n </Text>\n ))}\n </Box>\n {rows.map((row, index) => (\n <Box key={`${row.cells[0]}-${index}`} flexDirection=\"column\">\n <Box>\n {row.cells.map((cell, column) => (\n <Text key={`${column}`} bold={column === 0}>\n {column === headers.length - 1 ? cell : `${pad(cell, widths[column]!)} `}\n </Text>\n ))}\n </Box>\n {row.note ? (\n <Box paddingLeft={4}>\n <Text dimColor wrap=\"wrap\">{`⤷ ${row.note}`}</Text>\n </Box>\n ) : null}\n </Box>\n ))}\n </Box>\n );\n}\n\nexport function Table({\n title,\n lead,\n headers,\n rows,\n}: {\n title: string;\n lead?: string;\n headers: string[];\n rows: TableRow[];\n}): ReactElement {\n return (\n <Static items={[{ key: title }]}>\n {(block) => (\n <Box key={block.key} flexDirection=\"column\">\n <Text bold>{title}</Text>\n {lead ? (\n <Text dimColor wrap=\"wrap\">\n {lead}\n </Text>\n ) : null}\n <Grid headers={headers} rows={rows} />\n </Box>\n )}\n </Static>\n );\n}\n\n/**\n * Lines that are neither a grid nor a finding: a closing hint, a list of keys\n * to copy. Never wrapped, and dimmed only where the part says so — an allowlist\n * key is read by selecting it, and a reflowed or greyed-out one is a key nobody\n * pastes.\n */\nexport function Note({\n title,\n lines,\n muted,\n}: {\n title?: string;\n lines: string[];\n muted?: boolean;\n}): ReactElement {\n return (\n <Static items={[{ key: title ?? lines[0] ?? \"note\" }]}>\n {(block) => (\n <Box key={block.key} flexDirection=\"column\">\n {title ? <Text bold>{title}</Text> : null}\n {lines.map((line, index) => (\n <Text key={`${index}`} dimColor={muted === true}>\n {line}\n </Text>\n ))}\n </Box>\n )}\n </Static>\n );\n}\n\n/** The commands that clear a report, in the order worth running them. */\nexport function Steps({ title, steps }: { title: string; steps: string[] }): ReactElement {\n return (\n <Static items={[{ key: title }]}>\n {(block) => (\n <Box key={block.key} flexDirection=\"column\">\n <Text bold>{title}</Text>\n {steps.map((step, index) => (\n <Box key={`${index}`} paddingLeft={2}>\n <Text color=\"cyan\">{`${index + 1}. `}</Text>\n <Text wrap=\"wrap\">{step}</Text>\n </Box>\n ))}\n </Box>\n )}\n </Static>\n );\n}\n\n/**\n * Findings. The heading says what it is, the gloss why it matters, and the hint\n * what to do — printed with the finding rather than left to be inferred.\n */\nexport function Findings({ sections }: { sections: FindingSection[] }): ReactElement {\n return (\n <Static\n items={sections.map((section, index) => ({ key: `${section.title}-${index}`, section, index }))}\n >\n {({ key, section, index }) => (\n <Box key={key} flexDirection=\"column\" marginTop={index === 0 ? 0 : 1}>\n <Box>\n <Text\n backgroundColor={section.tone === \"notice\" ? \"yellow\" : \"red\"}\n color=\"black\"\n bold\n >{` ${section.title} `}</Text>\n <Text dimColor>{` ${section.gloss}${section.count > 0 ? ` ${section.count}` : \"\"}`}</Text>\n </Box>\n {section.headers && section.rows ? (\n <Grid headers={section.headers} rows={section.rows} />\n ) : null}\n {(section.lines ?? []).map((line, index) => (\n <Box key={`${index}`} paddingLeft={2}>\n <Text>{line}</Text>\n </Box>\n ))}\n {section.hint ? (\n <Box paddingLeft={2}>\n <Text color=\"cyan\" wrap=\"wrap\">{`→ ${section.hint}`}</Text>\n </Box>\n ) : null}\n </Box>\n )}\n </Static>\n );\n}\n\nfunction PolicyLine({\n policy,\n}: {\n policy: NonNullable<CapabilityRow[\"policies\"]>[number];\n}): ReactElement {\n const vote = policy.discovery?.decision;\n const color = vote === \"hide\" ? \"red\" : vote === \"disable\" ? \"yellow\" : \"green\";\n return (\n <Box paddingLeft={6}>\n <Text dimColor>policy </Text>\n <Text bold>{policy.name}</Text>\n <Text dimColor>{` (${policy.scope}${policy.phases.length ? `, ${policy.phases.join(\"/\")}` : \"\"}) `}</Text>\n {vote ? (\n <Text color={color}>\n {vote}\n {policy.discovery?.decision === \"disable\" ? ` — ${policy.discovery.reason}` : \"\"}\n </Text>\n ) : (\n <Text dimColor>no discovery hook</Text>\n )}\n {policy.threw ? <Text color=\"red\" bold>{\" THREW\"}</Text> : null}\n {policy.confirmationEscalation ? (\n <Text color=\"magenta\">{\" escalates-confirmation\"}</Text>\n ) : null}\n </Box>\n );\n}\n\nfunction Capability({ row }: { row: CapabilityRow }): ReactElement {\n const outcome = OUTCOME[row.outcome];\n return (\n <Box flexDirection=\"column\" marginTop={1}>\n <Box>\n <Text color={outcome.color}>{` ${outcome.mark} `}</Text>\n <Text bold>{row.name}</Text>\n {row.tags.length > 0 ? <Text dimColor>{` ${row.tags.join(\" · \")}`}</Text> : null}\n </Box>\n <Box paddingLeft={4}>\n <Text dimColor wrap=\"wrap\">\n {row.description}\n </Text>\n </Box>\n {row.reason ? (\n <Box paddingLeft={4}>\n <Text color=\"yellow\" wrap=\"wrap\">{`⤷ ${row.reason}`}</Text>\n </Box>\n ) : null}\n {row.policies\n ? row.policies.length > 0\n ? row.policies.map((policy, index) => (\n <PolicyLine key={`${policy.name}-${index}`} policy={policy} />\n ))\n : [\n <Box key=\"none\" paddingLeft={6}>\n <Text dimColor>policies: none</Text>\n </Box>,\n ]\n : null}\n {row.policies && row.availability && !row.availability.available ? (\n <Box paddingLeft={6}>\n <Text dimColor>{`availability: unavailable${\n row.availability.reason ? ` — ${row.availability.reason}` : \"\"\n }`}</Text>\n </Box>\n ) : null}\n {row.schemas?.input !== undefined ? (\n <Box paddingLeft={6}>\n <Text dimColor wrap=\"wrap\">{`input: ${JSON.stringify(row.schemas.input)}`}</Text>\n </Box>\n ) : null}\n {row.schemas?.output !== undefined ? (\n <Box paddingLeft={6}>\n <Text dimColor wrap=\"wrap\">{`output: ${JSON.stringify(row.schemas.output)}`}</Text>\n </Box>\n ) : null}\n </Box>\n );\n}\n\nfunction Group({ group }: { group: CapabilityGroup }): ReactElement {\n return (\n <Box flexDirection=\"column\" marginTop={1}>\n <Box>\n <Text backgroundColor=\"blueBright\" color=\"black\" bold>{` ${group.heading} `}</Text>\n <Text dimColor>{` ${group.rows.length}`}</Text>\n </Box>\n {group.rows.map((row) => (\n <Capability key={`${row.capabilityId}-${row.name}`} row={row} />\n ))}\n </Box>\n );\n}\n\n/**\n * The header states everything the counts are relative to (`AS-CLI-007`): the\n * scenario, the route, and the scope when one is active — a scope filters both\n * projections, so an unqualified count reads as a claim about the whole surface.\n * `hidden` is unconditional here for the same reason it is in plain text.\n */\nfunction Header({ view }: { view: SurfaceView }): ReactElement {\n // What the surface can do, not just how much of it there is: \"one of these\n // deletes a device\" is the part a reader needs before they read anything else.\n const risk = riskClause(flatRows(view));\n return (\n <Box>\n <Text bold>{view.scenario}</Text>\n {view.route ? <Text dimColor>{` ${view.route}`}</Text> : null}\n {view.scope && view.scope.length > 0 ? (\n <Text color=\"cyan\">{` scope ${view.scope.join(\" \")}`}</Text>\n ) : null}\n <Text dimColor>{\" · \"}</Text>\n <Text color=\"green\">{`${view.counts.callable} callable`}</Text>\n <Text dimColor>{\", \"}</Text>\n <Text color=\"yellow\">{`${view.counts.disabled} visible-disabled`}</Text>\n <Text dimColor>{\", \"}</Text>\n <Text color=\"red\">{`${view.counts.hidden} hidden`}</Text>\n {view.rejections.length > 0 ? (\n <>\n <Text dimColor>{\", \"}</Text>\n <Text color=\"magenta\">\n {`${view.rejections.length} registration${\n view.rejections.length === 1 ? \"\" : \"s\"\n } rejected`}\n </Text>\n </>\n ) : null}\n {risk ? (\n <>\n <Text dimColor>{\" · \"}</Text>\n <Text color=\"magenta\">{risk}</Text>\n </>\n ) : null}\n </Box>\n );\n}\n\n/**\n * Rejected registrations (`AS-CLI-006`). A dead handle leaves no trace in either\n * projection, so without this block a copy-pasted component `type` removes a\n * capability and prints nothing anywhere.\n */\nfunction Rejections({ view }: { view: SurfaceView }): ReactElement {\n return (\n <Box flexDirection=\"column\" marginTop={1}>\n <Box>\n <Text backgroundColor=\"magenta\" color=\"black\" bold>\n {\" rejected during mount \"}\n </Text>\n <Text dimColor>{` ${view.rejections.length}`}</Text>\n </Box>\n {view.rejections.map((rejection) => (\n <Box key={`${rejection.componentType}@${rejection.instanceId}-${rejection.reason}`}>\n <Text color=\"magenta\">{\" ! \"}</Text>\n <Text bold>{`${rejection.componentType} (${rejection.instanceId})`}</Text>\n <Text dimColor>\n {rejection.reason === \"duplicate\"\n ? \" duplicate — an earlier registration holds this key\"\n : \" guard — onRegister rejected this registration\"}\n </Text>\n </Box>\n ))}\n </Box>\n );\n}\n\nfunction Empty({ view }: { view: SurfaceView }): ReactElement {\n if (view.counts.hidden > 0) {\n return (\n <Box flexDirection=\"column\" marginTop={1}>\n <Text dimColor wrap=\"wrap\">\n {`Nothing is callable here — all ${view.counts.hidden} registered capabilities were hidden by policy. `}\n The surface is empty by decision, not because nothing was annotated.\n </Text>\n {view.explained ? null : (\n <Text dimColor>Re-run with --explain to see which policy hid them.</Text>\n )}\n </Box>\n );\n }\n return (\n <Box flexDirection=\"column\" marginTop={1}>\n <Text dimColor wrap=\"wrap\">\n Nothing is registered for this scenario — the agent has no surface here. That is the\n default: capabilities exist only where they were explicitly annotated.\n </Text>\n {view.explained ? null : (\n <Text dimColor>Re-run with --explain to see whether a policy hid it.</Text>\n )}\n </Box>\n );\n}\n\nconst HEADERS = [\"CAPABILITY\", \"KIND\", \"EFFECT\", \"STATE\", \"FLAGS\"];\n\nfunction cellsFor(row: CapabilityRow): string[] {\n return [\n row.path,\n row.kind,\n row.effect ?? NONE,\n OUTCOME[row.outcome].state,\n row.flags.length > 0 ? row.flags.join(\" · \") : NONE,\n ];\n}\n\nfunction TableRow({\n row,\n cells,\n widths,\n}: {\n row: CapabilityRow;\n cells: string[];\n widths: number[];\n}): ReactElement {\n const outcome = OUTCOME[row.outcome];\n return (\n <Box flexDirection=\"column\">\n <Box>\n <Text bold>{`${pad(cells[0]!, widths[0]!)} `}</Text>\n <Text dimColor>{`${pad(cells[1]!, widths[1]!)} `}</Text>\n <Text>{`${pad(cells[2]!, widths[2]!)} `}</Text>\n <Text color={outcome.color}>{`${pad(cells[3]!, widths[3]!)} `}</Text>\n <Text dimColor>{cells[4]!}</Text>\n </Box>\n {row.reason ? (\n <Box paddingLeft={4}>\n <Text color=\"yellow\" wrap=\"wrap\">{`⤷ ${row.reason}`}</Text>\n </Box>\n ) : null}\n </Box>\n );\n}\n\n/**\n * One capability per line, aligned — the scanning view, and the default. The\n * grouped paragraphs below stay for `--detail`, `--explain` and `--schemas`,\n * whose payloads (policy chains, JSON Schemas) cannot live in a table cell.\n */\nfunction CapabilityTable({ rows }: { rows: CapabilityRow[] }): ReactElement {\n const cells = rows.map(cellsFor);\n const widths = widthsFor(HEADERS, cells);\n return (\n <Box flexDirection=\"column\" marginTop={1}>\n <Box>\n {HEADERS.map((header, column) => (\n <Text key={header} dimColor bold>\n {column === HEADERS.length - 1 ? header : `${pad(header, widths[column]!)} `}\n </Text>\n ))}\n </Box>\n {rows.map((row, index) => (\n <TableRow\n key={`${row.capabilityId}-${index}`}\n row={row}\n cells={cells[index]!}\n widths={widths}\n />\n ))}\n </Box>\n );\n}\n\ntype Block = { key: string; group?: CapabilityGroup; rows?: CapabilityRow[] };\n\n/**\n * One part of a report, drawn.\n *\n * This switch is the only place the terminal UI learns what a report can\n * contain, and it is the same list `renderPartPlain` switches on — so a part\n * that renders here renders there, and neither can grow a shape the other has\n * never heard of.\n */\nexport function Part({\n part,\n labelWidth,\n}: {\n part: ReportPart;\n labelWidth?: number;\n}): ReactElement {\n switch (part.kind) {\n case \"blocks\":\n return <Report blocks={part.blocks} {...(labelWidth ? { labelWidth } : {})} />;\n case \"table\":\n return (\n <Table\n title={part.title}\n {...(part.lead ? { lead: part.lead } : {})}\n headers={part.headers}\n rows={part.rows}\n />\n );\n case \"findings\":\n return <Findings sections={part.sections} />;\n case \"surface\":\n return <Surface view={part.view} {...(part.detail ? { detail: true } : {})} />;\n case \"note\":\n return (\n <Note\n {...(part.title ? { title: part.title } : {})}\n {...(part.muted ? { muted: true } : {})}\n lines={part.lines}\n />\n );\n case \"steps\":\n return <Steps title={part.title} steps={part.steps} />;\n }\n}\n\nexport function Surface({\n view,\n detail,\n}: {\n view: SurfaceView;\n detail?: boolean;\n}): ReactElement {\n const populated = view.groups.filter((group) => group.rows.length > 0);\n const rows = flatRows(view);\n\n // Everything goes through <Static>, header included. Ink paints static output\n // once, permanently, above the live frame — and erases the live frame on\n // unmount. A one-shot render that leaves anything outside <Static> therefore\n // prints it and then wipes it, which is exactly what happened to this header.\n const blocks: Block[] = [\n { key: \"__header\" },\n ...(detail\n ? populated.map((group) => ({ key: group.heading, group }))\n : rows.length > 0\n ? [{ key: \"__table\", rows }]\n : []),\n ];\n\n return (\n <Static items={blocks}>\n {(block) =>\n block.group ? (\n <Group key={block.key} group={block.group} />\n ) : block.rows ? (\n <CapabilityTable key={block.key} rows={block.rows} />\n ) : (\n <Box key={block.key} flexDirection=\"column\">\n <Header view={view} />\n {view.rejections.length > 0 ? <Rejections view={view} /> : null}\n {rows.length === 0 ? <Empty view={view} /> : null}\n </Box>\n )\n }\n </Static>\n );\n}\n\n"],"mappings":";;;;;;;;AACA,SAAS,KAAK,QAAQ,MAAM,gBAAgB;AAC5C,OAAO,aAAa;AAkEhB,SAoVI,UAnVF,KADF;AApDJ,IAAM,UAAU;AAAA,EACd,QAAQ,EAAE,MAAM,UAAK,OAAO,SAAkB,OAAO,WAAW;AAAA,EAChE,SAAS,EAAE,MAAM,UAAK,OAAO,UAAmB,OAAO,WAAW;AAAA,EAClE,MAAM,EAAE,MAAM,UAAK,OAAO,OAAgB,OAAO,SAAS;AAC5D;AAEA,IAAM,eAA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