use-agentz 0.1.0 → 0.1.1

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.
@@ -4,25 +4,43 @@ var __getProtoOf = Object.getPrototypeOf;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
7
12
  var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
8
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
9
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
22
  for (let key of __getOwnPropNames(mod))
11
23
  if (!__hasOwnProp.call(to, key))
12
24
  __defProp(to, key, {
13
- get: () => mod[key],
25
+ get: __accessProp.bind(mod, key),
14
26
  enumerable: true
15
27
  });
28
+ if (canCache)
29
+ cache.set(mod, to);
16
30
  return to;
17
31
  };
18
32
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
+ var __returnValue = (v) => v;
34
+ function __exportSetter(name, newValue) {
35
+ this[name] = __returnValue.bind(null, newValue);
36
+ }
19
37
  var __export = (target, all) => {
20
38
  for (var name in all)
21
39
  __defProp(target, name, {
22
40
  get: all[name],
23
41
  enumerable: true,
24
42
  configurable: true,
25
- set: (newValue) => all[name] = () => newValue
43
+ set: __exportSetter.bind(all, name)
26
44
  });
27
45
  };
28
46
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
package/dist/ui/api.ts ADDED
@@ -0,0 +1,286 @@
1
+ /**
2
+ * Shared API contract types for the AgentZ UI server and its React SPA.
3
+ *
4
+ * Browser-safe module: it imports only types from the wizard/core layer, so the
5
+ * browser bundle never pulls node/bun runtime code in. Both
6
+ * `src/commands/ui.ts` (server) and `src/ui/web/*` (SPA) import from here so the
7
+ * wire shapes stay in one place.
8
+ */
9
+ import type { PreviewModel, WizardState } from "../wizard/shared.ts"
10
+ import type { ReasoningEffort, TierThinking } from "../core/types.ts"
11
+ import type { AgentOverride } from "../registry/config.ts"
12
+
13
+ export type { PreviewModel, WizardState }
14
+
15
+ /** Required non-simple header for POST /api/shutdown. */
16
+ export const SHUTDOWN_TOKEN_HEADER = "x-agentz-shutdown-token"
17
+
18
+ /** One selectable/installable catalog entry (preset, agent, skill, …). */
19
+ export interface CatalogItem {
20
+ name: string
21
+ label: string
22
+ description: string
23
+ }
24
+
25
+ /** One tier's derived model@effort display for a pack (from pack tier defs). */
26
+ export interface CatalogPackTier {
27
+ /** Tier name: cheap | normal | expert. */
28
+ tier: string
29
+ /** opencode model id, provider prefix stripped (e.g. "claude-opus-4.8"). */
30
+ model: string
31
+ /** Reasoning effort from the pack tier's thinking config, if any. */
32
+ effort?: string
33
+ }
34
+
35
+ /** A model pack with a human label + description + derived per-tier models. */
36
+ export interface CatalogPack {
37
+ id: string
38
+ label: string
39
+ description: string
40
+ /**
41
+ * Per-tier model@effort, DERIVED from the pack's TS tier definitions (never
42
+ * from prose). Canonical tier order (cheap, normal, expert); tiers the pack
43
+ * does not define are omitted. Lets the UI render the model chips so the
44
+ * description can stay use-case focused and never go stale.
45
+ */
46
+ tiers: CatalogPackTier[]
47
+ }
48
+
49
+ /** An MCP entry plus any declarative launch options it exposes. */
50
+ export interface CatalogMcp {
51
+ name: string
52
+ label: string
53
+ description: string
54
+ options: CatalogMcpOption[]
55
+ }
56
+
57
+ export interface CatalogMcpOption {
58
+ id: string
59
+ label: string
60
+ description?: string
61
+ default: boolean
62
+ }
63
+
64
+ /** GET /api/catalog — everything the UI can offer, with labels/descriptions. */
65
+ export interface CatalogResponse {
66
+ presets: CatalogItem[]
67
+ packs: CatalogPack[]
68
+ agents: CatalogItem[]
69
+ skills: CatalogItem[]
70
+ tools: CatalogItem[]
71
+ plugins: CatalogItem[]
72
+ commands: CatalogItem[]
73
+ mcps: CatalogMcp[]
74
+ /**
75
+ * Selectable language servers (opencode-only). Dependency-backed and
76
+ * excludable like plugins/mcps; installs a nested `lsp.<server>` entry.
77
+ */
78
+ lsps: CatalogItem[]
79
+ /**
80
+ * Selectable rule items (instruction-placement only). The agents-md rule is
81
+ * excluded server-side — it is controlled by the AGENTS.md mode toggle.
82
+ */
83
+ rules: CatalogItem[]
84
+ targets: { id: string; label: string; detected: boolean }[]
85
+ reasoningEfforts: ReasoningEffort[]
86
+ agentsModes: { value: string; label: string }[]
87
+ defaultPreset: string
88
+ defaultPack: string
89
+ }
90
+
91
+ /** GET /api/state — the current on-disk install, if any. */
92
+ export interface StateResponse {
93
+ /** True when an AgentZ config or lockfile already exists. */
94
+ installed: boolean
95
+ /** First recovered preset (back-compat; = presets[0] when preset-based). */
96
+ preset?: string | undefined
97
+ /**
98
+ * ALL presets recovered from the lock (multi-preset installs). Empty/absent
99
+ * when the install is not preset-based. The setup screen preselects these so
100
+ * the user can re-toggle any of them.
101
+ */
102
+ presets?: string[]
103
+ /**
104
+ * True when the install is preset-based (≥1 `preset:` ref is in the lock).
105
+ * When false the SPA shows a notice on the setup screen (no preset to
106
+ * preselect) but still lets the user pick presets for the existing project.
107
+ */
108
+ presetBased?: boolean
109
+ modelPack?: string
110
+ targets?: string[]
111
+ scope?: "project" | "user"
112
+ /**
113
+ * Template variable values from the on-disk AgentZ config's `vars`, carrying
114
+ * the per-tier model overrides (`model.cheap|normal|expert`)
115
+ * plus any non-model flags. Restored into the wizard so Modify/reinstall
116
+ * preserves tier overrides instead of silently dropping them.
117
+ */
118
+ vars?: Record<string, string | boolean>
119
+ /**
120
+ * Per-agent overrides from the on-disk AgentZ config (`agents`),
121
+ * keyed by agent id. Restored into the wizard so Modify/reinstall preserves
122
+ * existing per-agent model/effort overrides (the edge-case override path)
123
+ * instead of silently dropping them on round-trip.
124
+ */
125
+ agents?: Record<string, AgentOverride>
126
+ /**
127
+ * Per-tier thinking defaults from the on-disk AgentZ config's `tierThinking`.
128
+ * Restored into the wizard so Modify/reinstall preserves the
129
+ * per-tier reasoning-effort defaults instead of dropping them on round-trip.
130
+ */
131
+ tierThinking?: TierThinking
132
+ /** Count of locked items (for the current-install summary). */
133
+ lockedItems?: number
134
+ /** Refs currently in the lock (for display). */
135
+ lockedRefs?: string[]
136
+ /** Legacy-migration notes (e.g. a renamed/dropped model pack), if any. */
137
+ migrationNotes?: string[]
138
+ /**
139
+ * Lock refs (`type:name`) that are USER-ADDED extras — not covered by the
140
+ * recovered presets/pack closure. The setup screen restores these into the
141
+ * wizard's `extra` buckets so a subsequent sync-install does not delete them.
142
+ */
143
+ extras?: string[]
144
+ }
145
+
146
+ /**
147
+ * GET /api/state response while a UI server is running. `shutdownToken` exists
148
+ * only in this no-store response and the browser keeps it in memory only.
149
+ */
150
+ export interface SessionStateResponse extends StateResponse {
151
+ shutdownToken: string
152
+ }
153
+
154
+ /** POST /api/preview — request body is a full WizardState. */
155
+ export interface PreviewRequest {
156
+ state: WizardState
157
+ }
158
+ export interface PreviewResponse {
159
+ preview: PreviewModel
160
+ /**
161
+ * Rendered file previews for the opencode target, extracted from the planner
162
+ * dry-run: the merged `opencode.json` (always) and the AGENTS.md content
163
+ * (null when the AGENTS.md block is disabled). For the review <details> panels.
164
+ */
165
+ files: PreviewFiles
166
+ /**
167
+ * Projected file deletions if this selection is installed now: old lock items
168
+ * whose ref left the resolution closure (a deselection), refcount-safe against
169
+ * surviving items. Each entry is the owning lock `ref` + the project-relative
170
+ * `path`. Empty when the selection is unchanged (idempotence) — the review
171
+ * screen renders a "Deleted files" affordance only when this is non-empty.
172
+ */
173
+ deletions: { ref: string; path: string }[]
174
+ }
175
+
176
+ export interface PreviewFiles {
177
+ opencodeJson: string
178
+ agentsMd: string | null
179
+ }
180
+
181
+ /** One model offered by GET /api/models (the model-override picker). */
182
+ export interface ModelInfo {
183
+ id: string
184
+ name: string
185
+ reasoning: boolean
186
+ }
187
+
188
+ /** GET /api/models — tool-capable models, or empty (free-text fallback). */
189
+ export interface ModelsResponse {
190
+ models: ModelInfo[]
191
+ /** True when a model list is available (select); false = free-text only. */
192
+ available: boolean
193
+ /**
194
+ * True when the list was scoped to the opencode providers this install is
195
+ * connected to (auth.json + project provider config). False = showing the
196
+ * full models.dev catalog (no connected providers detected).
197
+ */
198
+ connected: boolean
199
+ }
200
+
201
+ /** One discovered project (monorepo support). */
202
+ export interface ProjectInfo {
203
+ /** Root-relative path ("" = the root project itself). */
204
+ path: string
205
+ /** Display label (basename, or "(root)"). */
206
+ label: string
207
+ }
208
+
209
+ /** GET /api/projects — the root plus any nested AgentZ projects. */
210
+ export interface ProjectsResponse {
211
+ projects: ProjectInfo[]
212
+ }
213
+
214
+ /** POST /api/install — request body is a full WizardState. */
215
+ export interface InstallRequest {
216
+ state: WizardState
217
+ }
218
+ export interface InstallResponse {
219
+ ok: boolean
220
+ /** Items installed. */
221
+ installed: number
222
+ /** Planner + install notes surfaced to the user. */
223
+ notes: string[]
224
+ /** Project-relative file actions, for the result screen. */
225
+ files: { path: string; status: string }[]
226
+ /** Path the config was written to (project-relative). */
227
+ configPath: string
228
+ }
229
+
230
+ /** Any error response body. */
231
+ export interface ApiError {
232
+ error: string
233
+ }
234
+
235
+ /** POST /api/shutdown — server acks, then stops itself shortly after. */
236
+ export interface ShutdownResponse {
237
+ ok: boolean
238
+ }
239
+
240
+ /* ================================================================== */
241
+ /* GET /api/graph — dependency graph (for a future designer viz) */
242
+ /* ================================================================== */
243
+
244
+ /**
245
+ * A node in the catalog dependency graph. `id` is the canonical `type:name`
246
+ * (e.g. `agent:developer`, `skill:caveman`); `type` is the item kind and
247
+ * `label` its human title. One node per distinct catalog item.
248
+ */
249
+ export interface GraphNode {
250
+ /** Canonical `type:name` identity (matches lock/dep refs). */
251
+ id: string
252
+ /** Item kind: preset | pack | group | agent | skill | tool | mcp | plugin | command | rule. */
253
+ type: string
254
+ /** Human title from the manifest. */
255
+ label: string
256
+ }
257
+
258
+ /**
259
+ * A directed edge `from → to` between two node ids, classified by why the
260
+ * relationship exists:
261
+ * - `dependency` — a manifest `dependencies` link (skill→skill, a tool paired
262
+ * with its skill, an agent's required skill, …). The resolver already walks
263
+ * these for install; the graph reuses them, it does not re-derive them.
264
+ * - `includes` — a preset pulling in each of its member items.
265
+ * - `extra` — a model pack pulling in its `meta.extras` items (extra
266
+ * reviewer agents + skills layered on top of a preset).
267
+ * - `group` — a skills group pulling in its member skills.
268
+ */
269
+ export interface GraphEdge {
270
+ /** Source node id (`type:name`). */
271
+ from: string
272
+ /** Target node id (`type:name`). */
273
+ to: string
274
+ kind: "dependency" | "includes" | "extra" | "group"
275
+ }
276
+
277
+ /**
278
+ * GET /api/graph (respects `?project=`) — the full catalog dependency graph as
279
+ * nodes + edges, for a future designer visualization. Read-only; the SPA does
280
+ * not consume it yet. Built from the same resolved registry manifests the
281
+ * installer uses (no re-invented resolution).
282
+ */
283
+ export interface GraphResponse {
284
+ nodes: GraphNode[]
285
+ edges: GraphEdge[]
286
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "use-agentz",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "AgentZ is a Bun-native AI agent setup builder.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -34,21 +34,21 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@modelcontextprotocol/sdk": "^1.29.0",
37
- "@opencode-ai/plugin": "^1.17.0",
37
+ "@opencode-ai/plugin": "^1.18.4",
38
38
  "@types/bun": "^1.3.14",
39
- "@types/react": "^19.0.0",
40
- "@types/react-dom": "^19.0.0",
39
+ "@types/react": "^19.2.17",
40
+ "@types/react-dom": "^19.2.3",
41
41
  "pdf-lib": "^1.17.1",
42
42
  "pptxgenjs": "^4.0.1",
43
- "typescript": "^5.9.3"
43
+ "typescript": "^7.0.2"
44
44
  },
45
45
  "dependencies": {
46
46
  "@base-ui-components/react": "^1.0.0-rc.0",
47
- "@clack/prompts": "^1.5.1",
47
+ "@clack/prompts": "^1.7.0",
48
48
  "confbox": "^0.2.4",
49
49
  "picocolors": "^1.1.1",
50
- "react": "^19.0.0",
51
- "react-dom": "^19.0.0",
50
+ "react": "^19.2.8",
51
+ "react-dom": "^19.2.8",
52
52
  "zod": "^4.4.3"
53
53
  }
54
54
  }