@agent-surface/cli 0.9.1 → 0.11.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 (38) hide show
  1. package/README.md +64 -23
  2. package/dist/bin.js +75 -28
  3. package/dist/bin.js.map +1 -1
  4. package/dist/check-BYQ34OVQ.js +122 -0
  5. package/dist/check-BYQ34OVQ.js.map +1 -0
  6. package/dist/chunk-DYDSJM7R.js +170 -0
  7. package/dist/chunk-DYDSJM7R.js.map +1 -0
  8. package/dist/chunk-GXXKZTQB.js +553 -0
  9. package/dist/chunk-GXXKZTQB.js.map +1 -0
  10. package/dist/{chunk-S2LM3N6D.js → chunk-QIVOZAWX.js} +14 -12
  11. package/dist/chunk-QIVOZAWX.js.map +1 -0
  12. package/dist/chunk-RXX63JSL.js +298 -0
  13. package/dist/chunk-RXX63JSL.js.map +1 -0
  14. package/dist/collect.js +18 -1
  15. package/dist/collect.js.map +1 -1
  16. package/dist/index.d.ts +126 -1
  17. package/dist/init-LYYVXFEQ.js +141 -0
  18. package/dist/init-LYYVXFEQ.js.map +1 -0
  19. package/dist/ink-P23VKP4H.js +217 -0
  20. package/dist/ink-P23VKP4H.js.map +1 -0
  21. package/dist/inspect-3CBRKTDM.js +108 -0
  22. package/dist/inspect-3CBRKTDM.js.map +1 -0
  23. package/dist/snapshot-DJ22WCT4.js +59 -0
  24. package/dist/snapshot-DJ22WCT4.js.map +1 -0
  25. package/package.json +5 -4
  26. package/dist/check-7Z2VNN5R.js +0 -79
  27. package/dist/check-7Z2VNN5R.js.map +0 -1
  28. package/dist/chunk-KZUR4CAU.js +0 -84
  29. package/dist/chunk-KZUR4CAU.js.map +0 -1
  30. package/dist/chunk-ODUIFFPM.js +0 -104
  31. package/dist/chunk-ODUIFFPM.js.map +0 -1
  32. package/dist/chunk-S2LM3N6D.js.map +0 -1
  33. package/dist/ink-GCWDO4ML.js +0 -122
  34. package/dist/ink-GCWDO4ML.js.map +0 -1
  35. package/dist/inspect-SLYLBZAH.js +0 -204
  36. package/dist/inspect-SLYLBZAH.js.map +0 -1
  37. package/dist/snapshot-3D55FL63.js +0 -36
  38. package/dist/snapshot-3D55FL63.js.map +0 -1
@@ -1,204 +0,0 @@
1
- import {
2
- renderSurfacePlain
3
- } from "./chunk-KZUR4CAU.js";
4
- import {
5
- createSurfaceRunner,
6
- isPlain,
7
- loadInk,
8
- paint,
9
- transient,
10
- write
11
- } from "./chunk-S2LM3N6D.js";
12
- import "./chunk-ODUIFFPM.js";
13
-
14
- // src/render/model.ts
15
- function leafOf(capabilityId) {
16
- const withoutPlane = capabilityId.replace(/^(view|domain):/, "");
17
- const dot = withoutPlane.lastIndexOf(".");
18
- return dot === -1 ? withoutPlane : withoutPlane.slice(dot + 1);
19
- }
20
- function observationTags() {
21
- return ["observation"];
22
- }
23
- function actionTags(action) {
24
- const tags = [action.effect];
25
- if (action.idempotent) tags.push("idempotent");
26
- if (action.reversible) tags.push("reversible");
27
- if (action.confirmation !== "never") tags.push(`confirmation:${action.confirmation}`);
28
- return tags;
29
- }
30
- function procedureTags(procedure) {
31
- const tags = [procedure.effect];
32
- if (procedure.confirmation !== "never") tags.push(`confirmation:${procedure.confirmation}`);
33
- for (const field of procedure.boundFields) {
34
- tags.push(`${field.path} bound${field.locked ? "+locked" : ""}`);
35
- }
36
- return tags;
37
- }
38
- function explanationIndex(explanation) {
39
- const index = /* @__PURE__ */ new Map();
40
- for (const capability of explanation.capabilities) {
41
- index.set(`${capability.capabilityId}\0${capability.registrationId}`, capability);
42
- }
43
- return index;
44
- }
45
- function buildView(result, options = {}) {
46
- const { snapshot, explanation } = result;
47
- const index = explanationIndex(explanation);
48
- const groups = [];
49
- const counts = { callable: 0, disabled: 0, hidden: 0 };
50
- const enrich = (row, capabilityId, registrationId) => {
51
- const explained = index.get(`${capabilityId}\0${registrationId}`);
52
- if (options.explain && explained) {
53
- row.policies = explained.policies;
54
- row.availability = explained.availability;
55
- }
56
- return row;
57
- };
58
- for (const component of snapshot.components) {
59
- const rows = [];
60
- for (const observation of component.observations) {
61
- rows.push(
62
- enrich(
63
- rowFor(observation, "observation", observationTags(), options, {
64
- input: void 0,
65
- output: observation.outputSchema
66
- }),
67
- observation.capabilityId,
68
- component.registrationId
69
- )
70
- );
71
- }
72
- for (const action of component.actions) {
73
- rows.push(
74
- enrich(
75
- rowFor(action, "action", actionTags(action), options, {
76
- input: action.inputSchema,
77
- output: action.outputSchema
78
- }),
79
- action.capabilityId,
80
- component.registrationId
81
- )
82
- );
83
- }
84
- groups.push({
85
- heading: component.instanceId === "default" ? component.type : `${component.type}@${component.instanceId}`,
86
- rows
87
- });
88
- }
89
- if (snapshot.procedures.length > 0) {
90
- groups.push({
91
- heading: "authoritative (domain)",
92
- rows: snapshot.procedures.map(
93
- (procedure) => enrich(
94
- {
95
- capabilityId: procedure.procedureId,
96
- name: procedure.procedureId.replace(/^domain:/, ""),
97
- kind: "procedure",
98
- plane: "domain",
99
- outcome: procedure.available ? "expose" : "disable",
100
- description: procedure.description,
101
- ...procedure.unavailableReason ? { reason: procedure.unavailableReason } : {},
102
- tags: procedureTags(procedure),
103
- ...options.schemas ? { schemas: { input: procedure.inputSchema, output: procedure.outputSchema } } : {}
104
- },
105
- procedure.procedureId,
106
- procedure.registrationId
107
- )
108
- )
109
- });
110
- }
111
- if (options.explain) {
112
- const hidden = explanation.capabilities.filter((c) => c.outcome === "hide");
113
- if (hidden.length > 0) {
114
- groups.push({
115
- heading: "hidden by policy (absent from the snapshot)",
116
- rows: hidden.map((capability) => ({
117
- capabilityId: capability.capabilityId,
118
- name: leafOf(capability.capabilityId),
119
- kind: capability.kind,
120
- plane: capability.plane,
121
- outcome: "hide",
122
- description: capability.description,
123
- tags: [`${capability.component.type}@${capability.component.instanceId}`],
124
- policies: capability.policies,
125
- availability: capability.availability
126
- }))
127
- });
128
- }
129
- }
130
- for (const capability of explanation.capabilities) {
131
- if (capability.outcome === "expose") counts.callable += 1;
132
- else if (capability.outcome === "disable") counts.disabled += 1;
133
- else counts.hidden += 1;
134
- }
135
- return {
136
- scenario: result.scenario,
137
- ...snapshot.route?.path ? { route: snapshot.route.path } : {},
138
- groups,
139
- counts,
140
- explained: options.explain === true
141
- };
142
- }
143
- function rowFor(descriptor, kind, tags, options, schemas) {
144
- return {
145
- capabilityId: descriptor.capabilityId,
146
- name: descriptor.name,
147
- kind,
148
- plane: "view",
149
- outcome: descriptor.available ? "expose" : "disable",
150
- description: descriptor.description,
151
- ...descriptor.unavailableReason ? { reason: descriptor.unavailableReason } : {},
152
- tags,
153
- ...options.schemas ? { schemas } : {}
154
- };
155
- }
156
-
157
- // src/commands/inspect.tsx
158
- import { jsx } from "react/jsx-runtime";
159
- function jsonFor(result, explain) {
160
- return {
161
- scenario: result.scenario,
162
- snapshot: result.snapshot,
163
- ...explain ? { explanation: result.explanation } : {}
164
- };
165
- }
166
- async function runInspect(options) {
167
- const runner = await createSurfaceRunner(options.configPath);
168
- const ink = isPlain(options) ? null : await loadInk();
169
- try {
170
- const scenarios = options.scenario ? [options.scenario] : runner.scenarioNames;
171
- const collected = [];
172
- for (const [index, scenario] of scenarios.entries()) {
173
- const stop = ink ? await transient(/* @__PURE__ */ jsx(ink.Loading, { label: `mounting ${scenario}\u2026` })) : void 0;
174
- let result;
175
- try {
176
- result = await runner.collect({
177
- scenario,
178
- ...options.scope ? { scope: options.scope } : {}
179
- });
180
- } finally {
181
- stop?.();
182
- }
183
- if (options.json) {
184
- collected.push(jsonFor(result, options.explain === true));
185
- continue;
186
- }
187
- const view = buildView(result, {
188
- ...options.explain ? { explain: true } : {},
189
- ...options.schemas ? { schemas: true } : {}
190
- });
191
- if (ink) await paint(/* @__PURE__ */ jsx(ink.Surface, { view }));
192
- else write(index === 0 ? renderSurfacePlain(view) : `
193
- ${renderSurfacePlain(view)}`);
194
- }
195
- if (options.json) write(JSON.stringify({ scenarios: collected }, null, 2));
196
- return 0;
197
- } finally {
198
- await runner.close();
199
- }
200
- }
201
- export {
202
- runInspect
203
- };
204
- //# sourceMappingURL=inspect-SLYLBZAH.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/render/model.ts","../src/commands/inspect.tsx"],"sourcesContent":["import type {\n AgentActionDescriptor,\n AgentObservationDescriptor,\n AgentProcedureDescriptor,\n AgentSurfaceSnapshot,\n} from \"@agent-surface/core\";\nimport type { CapabilityExplanation, SurfaceExplanation } from \"@agent-surface/core/explain\";\nimport type { CollectResult } from \"../collect.js\";\n\n/**\n * One view model, two renderers. The Ink UI and the plain-text fallback both\n * consume this, so `--plain` can never drift into showing something different\n * from what a TTY shows.\n */\nexport interface CapabilityRow {\n capabilityId: string;\n /** Leaf name — the group heading already carries the rest of the id. */\n name: string;\n kind: \"observation\" | \"action\" | \"procedure\";\n plane: \"view\" | \"domain\";\n outcome: \"expose\" | \"disable\" | \"hide\";\n description: string;\n reason?: string;\n tags: string[];\n policies?: CapabilityExplanation[\"policies\"];\n availability?: CapabilityExplanation[\"availability\"];\n schemas?: { input?: unknown; output?: unknown };\n}\n\nexport interface CapabilityGroup {\n heading: string;\n rows: CapabilityRow[];\n}\n\nexport interface SurfaceView {\n scenario: string;\n route?: string;\n groups: CapabilityGroup[];\n counts: { callable: number; disabled: number; hidden: number };\n explained: boolean;\n}\n\nexport interface ViewOptions {\n explain?: boolean;\n schemas?: boolean;\n}\n\nfunction leafOf(capabilityId: string): string {\n const withoutPlane = capabilityId.replace(/^(view|domain):/, \"\");\n const dot = withoutPlane.lastIndexOf(\".\");\n return dot === -1 ? withoutPlane : withoutPlane.slice(dot + 1);\n}\n\nfunction observationTags(): string[] {\n return [\"observation\"];\n}\n\nfunction actionTags(action: AgentActionDescriptor): string[] {\n const tags: string[] = [action.effect];\n if (action.idempotent) tags.push(\"idempotent\");\n if (action.reversible) tags.push(\"reversible\");\n if (action.confirmation !== \"never\") tags.push(`confirmation:${action.confirmation}`);\n return tags;\n}\n\nfunction procedureTags(procedure: AgentProcedureDescriptor): string[] {\n const tags: string[] = [procedure.effect];\n if (procedure.confirmation !== \"never\") tags.push(`confirmation:${procedure.confirmation}`);\n for (const field of procedure.boundFields) {\n tags.push(`${field.path} bound${field.locked ? \"+locked\" : \"\"}`);\n }\n return tags;\n}\n\nfunction explanationIndex(explanation: SurfaceExplanation): Map<string, CapabilityExplanation> {\n const index = new Map<string, CapabilityExplanation>();\n for (const capability of explanation.capabilities) {\n // Keyed by id + registration so two instances of one component stay apart.\n index.set(`${capability.capabilityId}\u0000${capability.registrationId}`, capability);\n }\n return index;\n}\n\nexport function buildView(result: CollectResult, options: ViewOptions = {}): SurfaceView {\n const { snapshot, explanation } = result;\n const index = explanationIndex(explanation);\n const groups: CapabilityGroup[] = [];\n const counts = { callable: 0, disabled: 0, hidden: 0 };\n\n const enrich = (\n row: CapabilityRow,\n capabilityId: string,\n registrationId: string,\n ): CapabilityRow => {\n const explained = index.get(`${capabilityId}\u0000${registrationId}`);\n if (options.explain && explained) {\n row.policies = explained.policies;\n row.availability = explained.availability;\n }\n return row;\n };\n\n for (const component of snapshot.components) {\n const rows: CapabilityRow[] = [];\n\n for (const observation of component.observations) {\n rows.push(\n enrich(\n rowFor(observation, \"observation\", observationTags(), options, {\n input: undefined,\n output: observation.outputSchema,\n }),\n observation.capabilityId,\n component.registrationId,\n ),\n );\n }\n for (const action of component.actions) {\n rows.push(\n enrich(\n rowFor(action, \"action\", actionTags(action), options, {\n input: action.inputSchema,\n output: action.outputSchema,\n }),\n action.capabilityId,\n component.registrationId,\n ),\n );\n }\n\n groups.push({\n heading:\n component.instanceId === \"default\"\n ? component.type\n : `${component.type}@${component.instanceId}`,\n rows,\n });\n }\n\n if (snapshot.procedures.length > 0) {\n groups.push({\n heading: \"authoritative (domain)\",\n rows: snapshot.procedures.map((procedure) =>\n enrich(\n {\n capabilityId: procedure.procedureId,\n name: procedure.procedureId.replace(/^domain:/, \"\"),\n kind: \"procedure\",\n plane: \"domain\",\n outcome: procedure.available ? \"expose\" : \"disable\",\n description: procedure.description,\n ...(procedure.unavailableReason ? { reason: procedure.unavailableReason } : {}),\n tags: procedureTags(procedure),\n ...(options.schemas\n ? { schemas: { input: procedure.inputSchema, output: procedure.outputSchema } }\n : {}),\n },\n procedure.procedureId,\n procedure.registrationId,\n ),\n ),\n });\n }\n\n // Hidden capabilities exist only in the explanation — that is the whole point\n // of it. They get their own group so nobody mistakes them for callable.\n if (options.explain) {\n const hidden = explanation.capabilities.filter((c) => c.outcome === \"hide\");\n if (hidden.length > 0) {\n groups.push({\n heading: \"hidden by policy (absent from the snapshot)\",\n rows: hidden.map((capability) => ({\n capabilityId: capability.capabilityId,\n name: leafOf(capability.capabilityId),\n kind: capability.kind,\n plane: capability.plane,\n outcome: \"hide\" as const,\n description: capability.description,\n tags: [`${capability.component.type}@${capability.component.instanceId}`],\n policies: capability.policies,\n availability: capability.availability,\n })),\n });\n }\n }\n\n for (const capability of explanation.capabilities) {\n if (capability.outcome === \"expose\") counts.callable += 1;\n else if (capability.outcome === \"disable\") counts.disabled += 1;\n else counts.hidden += 1;\n }\n\n return {\n scenario: result.scenario,\n ...(snapshot.route?.path ? { route: snapshot.route.path } : {}),\n groups,\n counts,\n explained: options.explain === true,\n };\n}\n\nfunction rowFor(\n descriptor: AgentObservationDescriptor | AgentActionDescriptor,\n kind: \"observation\" | \"action\",\n tags: string[],\n options: ViewOptions,\n schemas: { input?: unknown; output?: unknown },\n): CapabilityRow {\n return {\n capabilityId: descriptor.capabilityId,\n name: descriptor.name,\n kind,\n plane: \"view\",\n outcome: descriptor.available ? \"expose\" : \"disable\",\n description: descriptor.description,\n ...(descriptor.unavailableReason ? { reason: descriptor.unavailableReason } : {}),\n tags,\n ...(options.schemas ? { schemas } : {}),\n };\n}\n","import { createSurfaceRunner } from \"../load.js\";\nimport { buildView } from \"../render/model.js\";\nimport { renderSurfacePlain } from \"../render/plain.js\";\nimport { isPlain, loadInk, paint, transient, write } from \"../output.js\";\nimport type { CollectResult } from \"../collect.js\";\n\nexport interface InspectOptions {\n configPath: string;\n scenario?: string;\n scope?: string[];\n explain?: boolean;\n schemas?: boolean;\n json?: boolean;\n plain?: boolean;\n}\n\nfunction jsonFor(result: CollectResult, explain: boolean): Record<string, unknown> {\n return {\n scenario: result.scenario,\n snapshot: result.snapshot,\n ...(explain ? { explanation: result.explanation } : {}),\n };\n}\n\n/**\n * Renders the live surface. A bare `inspect` covers every scenario the config\n * defines, the same way bare `snapshot` and `check` do — a config lists the\n * contexts worth looking at, and picking one of them by `Object.keys` order\n * made the default silently depend on the order they happened to be written in.\n */\nexport async function runInspect(options: InspectOptions): Promise<number> {\n const runner = await createSurfaceRunner(options.configPath);\n // `null` when Ink cannot run here (React 18 host), which is a fallback to\n // plain text rather than a failed command — see loadInk().\n const ink = isPlain(options) ? null : await loadInk();\n try {\n const scenarios = options.scenario ? [options.scenario] : runner.scenarioNames;\n const collected: Array<Record<string, unknown>> = [];\n\n for (const [index, scenario] of scenarios.entries()) {\n const stop = ink\n ? await transient(<ink.Loading label={`mounting ${scenario}…`} />)\n : undefined;\n\n let result;\n try {\n result = await runner.collect({\n scenario,\n ...(options.scope ? { scope: options.scope } : {}),\n });\n } finally {\n stop?.();\n }\n\n // Each scenario is mounted and rendered before the next one is mounted,\n // so a slow config prints as it goes instead of after the last mount.\n // `--json` is the exception: one document, so it has to be complete.\n if (options.json) {\n collected.push(jsonFor(result, options.explain === true));\n continue;\n }\n\n const view = buildView(result, {\n ...(options.explain ? { explain: true } : {}),\n ...(options.schemas ? { schemas: true } : {}),\n });\n\n if (ink) await paint(<ink.Surface view={view} />);\n else write(index === 0 ? renderSurfacePlain(view) : `\\n${renderSurfacePlain(view)}`);\n }\n\n if (options.json) write(JSON.stringify({ scenarios: collected }, null, 2));\n return 0;\n } finally {\n await runner.close();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA+CA,SAAS,OAAO,cAA8B;AAC5C,QAAM,eAAe,aAAa,QAAQ,mBAAmB,EAAE;AAC/D,QAAM,MAAM,aAAa,YAAY,GAAG;AACxC,SAAO,QAAQ,KAAK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AAM,KAAK,UAAU,EAAE,WAAW,UAAU,GAAG,MAAM,CAAC,CAAC;AACzE,WAAO;AAAA,EACT,UAAE;AACA,UAAM,OAAO,MAAM;AAAA,EACrB;AACF;","names":[]}
@@ -1,36 +0,0 @@
1
- import {
2
- createSurfaceRunner,
3
- write
4
- } from "./chunk-S2LM3N6D.js";
5
- import {
6
- baselineDirFor,
7
- baselinePath,
8
- normalize,
9
- writeBaseline
10
- } from "./chunk-ODUIFFPM.js";
11
-
12
- // src/commands/snapshot.ts
13
- import { relative } from "path";
14
- async function runSnapshot(options) {
15
- const runner = await createSurfaceRunner(options.configPath);
16
- try {
17
- const scenarios = options.scenario ? [options.scenario] : runner.scenarioNames;
18
- const dir = baselineDirFor(options.configPath, options.baselineDir ?? runner.config.baselineDir);
19
- for (const scenario of scenarios) {
20
- const result = await runner.collect({
21
- scenario,
22
- ...options.scope ? { scope: options.scope } : {}
23
- });
24
- const path = baselinePath(dir, scenario);
25
- writeBaseline(path, normalize(result.snapshot));
26
- write(`wrote ${relative(process.cwd(), path)}`);
27
- }
28
- return 0;
29
- } finally {
30
- await runner.close();
31
- }
32
- }
33
- export {
34
- runSnapshot
35
- };
36
- //# sourceMappingURL=snapshot-3D55FL63.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/snapshot.ts"],"sourcesContent":["import { relative } from \"node:path\";\nimport { createSurfaceRunner } from \"../load.js\";\nimport { baselineDirFor, baselinePath, normalize, writeBaseline } from \"../baseline.js\";\nimport { write } from \"../output.js\";\n\nexport interface SnapshotOptions {\n configPath: string;\n scenario?: string;\n scope?: string[];\n baselineDir?: string;\n}\n\n/** Writes (or refreshes) the committed baseline `check` compares against. */\nexport async function runSnapshot(options: SnapshotOptions): Promise<number> {\n const runner = await createSurfaceRunner(options.configPath);\n try {\n const scenarios = options.scenario ? [options.scenario] : runner.scenarioNames;\n const dir = baselineDirFor(options.configPath, options.baselineDir ?? runner.config.baselineDir);\n\n for (const scenario of scenarios) {\n const result = await runner.collect({\n scenario,\n ...(options.scope ? { scope: options.scope } : {}),\n });\n const path = baselinePath(dir, scenario);\n writeBaseline(path, normalize(result.snapshot));\n write(`wrote ${relative(process.cwd(), path)}`);\n }\n return 0;\n } finally {\n await runner.close();\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,gBAAgB;AAazB,eAAsB,YAAY,SAA2C;AAC3E,QAAM,SAAS,MAAM,oBAAoB,QAAQ,UAAU;AAC3D,MAAI;AACF,UAAM,YAAY,QAAQ,WAAW,CAAC,QAAQ,QAAQ,IAAI,OAAO;AACjE,UAAM,MAAM,eAAe,QAAQ,YAAY,QAAQ,eAAe,OAAO,OAAO,WAAW;AAE/F,eAAW,YAAY,WAAW;AAChC,YAAM,SAAS,MAAM,OAAO,QAAQ;AAAA,QAClC;AAAA,QACA,GAAI,QAAQ,QAAQ,EAAE,OAAO,QAAQ,MAAM,IAAI,CAAC;AAAA,MAClD,CAAC;AACD,YAAM,OAAO,aAAa,KAAK,QAAQ;AACvC,oBAAc,MAAM,UAAU,OAAO,QAAQ,CAAC;AAC9C,YAAM,SAAS,SAAS,QAAQ,IAAI,GAAG,IAAI,CAAC,EAAE;AAAA,IAChD;AACA,WAAO;AAAA,EACT,UAAE;AACA,UAAM,OAAO,MAAM;AAAA,EACrB;AACF;","names":[]}