@usenaive-sdk/blueprints 0.9.0 → 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.
package/dist/index.d.ts CHANGED
@@ -1,829 +1,8 @@
1
+ import { P as ProjectConfig, A as AppDecl, a as AgentDecl } from './define-DiOsp5oY.js';
2
+ export { B as BLUEPRINTS, b as BlueprintRefusal, C as CredentialDecl, c as CrewPerClientDecl, D as DefineInput, I as IdentityDecl, S as ScheduleDecl, d as SkillDecl, T as TaskDecl, e as Template, f as TemplateChoice, V as VaultDecl, g as chooseTemplate, h as defineProject, p as parseProject } from './define-DiOsp5oY.js';
1
3
  import { z } from 'zod';
2
4
  import { VettaClient } from '@usenaive-sdk/vetta';
3
5
 
4
- /**
5
- * Blueprints and their templates.
6
- *
7
- * A **blueprint** is the machine: screens, `/api/*`, the store, build and deploy, the approval
8
- * flow — or, for a data-only blueprint, none of those. It is one repository, and it is shared across
9
- * its templates. A **template** is DATA — the crew and its prompts, the tool allow-lists and its
10
- * schedules. What a blueprint's own screens print per template is the blueprint's business, and
11
- * the engine never reads it (ADR-0903). One repo carries every template its blueprint has, so
12
- * switching is an edit plus `naive up`: never a re-clone, never a new app.
13
- *
14
- * The pair is checked here and refused at define time (`define.ts`), in the author's own
15
- * vocabulary, for the same reason every other refusal is: a wrong pair discovered at apply time is
16
- * discovered against a half-provisioned organization.
17
- */
18
-
19
- /**
20
- * The data module a blueprint repo exports, one per template it carries. Everything here is data:
21
- * nothing in it is a function, a component or a route, because those are the blueprint's and are
22
- * shared. `agents` is the config's own `agents` shape, so a template declares a crew exactly as a
23
- * hand-written config would — prompts, tool allow-lists and schedules included.
24
- */
25
- interface Template {
26
- /** Spelled exactly as `defineProject({ template })` and `naive template --template` name it. */
27
- name: string;
28
- /** One line for the operator: what this crew does. */
29
- description: string;
30
- agents: AgentDecl[];
31
- }
32
- /**
33
- * Every blueprint and the templates it carries. `agency` defaults to `blank` — a working agency
34
- * with no specialism is a safe thing to get by accident. `media` has NO default on purpose: its
35
- * three crews spend money in different ways — a long-form piece renders a minute-plus of video
36
- * where a clip only cuts one — so defaulting any of them is a bill the operator did not choose.
37
- * `web` carries one crew today, so `publisher` is its default for the reason `blank` is
38
- * `agency`'s: the only thing you can get is the thing you meant.
39
- */
40
- declare const BLUEPRINTS: Record<string, {
41
- templates: readonly string[];
42
- default?: string;
43
- }>;
44
- /** Resolved (a default may have filled it in), or the refusal's own words for the caller to raise. */
45
- type TemplateChoice = {
46
- ok: true;
47
- template: string | undefined;
48
- } | {
49
- ok: false;
50
- message: string;
51
- };
52
- /** The one place a `blueprint` / `template` pair is judged — `defineProject` and the CLI share it. */
53
- declare function chooseTemplate(blueprint: string | undefined, template: string | undefined): TemplateChoice;
54
-
55
- /**
56
- * A config that loaded but refuses itself. A distinct class so the loader can tell "the author's
57
- * declaration is wrong" apart from "the module could not be evaluated" — the two failure modes the
58
- * old `naive up` collapsed into one, silently.
59
- */
60
- declare class BlueprintRefusal extends Error {
61
- readonly name = "BlueprintRefusal";
62
- }
63
- declare const AppDeclSchema: z.ZodObject<{
64
- name: z.ZodString;
65
- type: z.ZodEnum<{
66
- frontend_only: "frontend_only";
67
- fullstack: "fullstack";
68
- }>;
69
- description: z.ZodOptional<z.ZodString>;
70
- deploy_dir: z.ZodOptional<z.ZodString>;
71
- mcp: z.ZodOptional<z.ZodString>;
72
- env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
73
- from_env: z.ZodString;
74
- }, z.core.$strip>, z.ZodObject<{
75
- generate: z.ZodLiteral<true>;
76
- }, z.core.$strip>]>>>;
77
- required: z.ZodOptional<z.ZodBoolean>;
78
- migrations: z.ZodOptional<z.ZodArray<z.ZodString>>;
79
- buckets: z.ZodOptional<z.ZodArray<z.ZodObject<{
80
- name: z.ZodString;
81
- public: z.ZodDefault<z.ZodBoolean>;
82
- }, z.core.$strip>>>;
83
- }, z.core.$strip>;
84
- /**
85
- * A cron on the agent — a platform deployment (§12) minus what `up` fills in: `agent_id`, and the
86
- * `identity`, a declared persona *name* like the agent's own. `cron` is the key the reconciler
87
- * matches live rows by (deployments have no name), so it must be unique within one agent.
88
- * `budget_micro_usd` has no default on `POST /v1/deployments`, so it is required here for the
89
- * same reason the agent's `budget` is.
90
- */
91
- declare const ScheduleDeclSchema: z.ZodObject<{
92
- cron: z.ZodString;
93
- timezone: z.ZodOptional<z.ZodString>;
94
- input: z.ZodString;
95
- budget_micro_usd: z.ZodNumber;
96
- identity: z.ZodOptional<z.ZodString>;
97
- enabled: z.ZodOptional<z.ZodBoolean>;
98
- }, z.core.$strip>;
99
- /** Exactly the `POST /v1/agents` fields a blueprint declares — `model` and `budget` are required by that route, so requiring them here turns a guaranteed apply-time refusal into a define-time one. */
100
- declare const AgentDeclSchema: z.ZodObject<{
101
- name: z.ZodString;
102
- model: z.ZodString;
103
- budget: z.ZodObject<{
104
- cap_micro_usd: z.ZodNumber;
105
- max_task_micro_usd: z.ZodNumber;
106
- period: z.ZodEnum<{
107
- month: "month";
108
- day: "day";
109
- week: "week";
110
- }>;
111
- }, z.core.$strip>;
112
- description: z.ZodOptional<z.ZodString>;
113
- role: z.ZodOptional<z.ZodString>;
114
- required: z.ZodOptional<z.ZodBoolean>;
115
- system: z.ZodOptional<z.ZodString>;
116
- tools: z.ZodOptional<z.ZodObject<{
117
- default_config: z.ZodObject<{
118
- permission: z.ZodEnum<{
119
- allow: "allow";
120
- deny: "deny";
121
- ask: "ask";
122
- }>;
123
- }, z.core.$strip>;
124
- configs: z.ZodRecord<z.ZodString, z.ZodObject<{
125
- enabled: z.ZodBoolean;
126
- permission: z.ZodEnum<{
127
- allow: "allow";
128
- deny: "deny";
129
- ask: "ask";
130
- }>;
131
- config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
132
- }, z.core.$strip>>;
133
- }, z.core.$strip>>;
134
- skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
135
- mcp_servers: z.ZodOptional<z.ZodArray<z.ZodObject<{
136
- name: z.ZodString;
137
- url: z.ZodURL;
138
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
139
- }, z.core.$strip>>>;
140
- window: z.ZodOptional<z.ZodEnum<{
141
- immediate: "immediate";
142
- priority: "priority";
143
- loose: "loose";
144
- }>>;
145
- multiagent: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
146
- agents: z.ZodArray<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<{
147
- type: "agent";
148
- name: string;
149
- }, string>>, z.ZodObject<{
150
- type: z.ZodLiteral<"agent">;
151
- name: z.ZodString;
152
- version: z.ZodOptional<z.ZodNumber>;
153
- }, z.core.$strip>, z.ZodObject<{
154
- type: z.ZodLiteral<"self">;
155
- }, z.core.$strip>, z.ZodObject<{
156
- type: z.ZodLiteral<"advisor">;
157
- model: z.ZodString;
158
- }, z.core.$strip>]>>;
159
- type: z.ZodLiteral<"coordinator">;
160
- board: z.ZodOptional<z.ZodBoolean>;
161
- }, z.core.$strip>, z.ZodNull]>>;
162
- output_schema: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
163
- structured_output_required: z.ZodOptional<z.ZodBoolean>;
164
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
165
- allowed_apps: z.ZodOptional<z.ZodArray<z.ZodString>>;
166
- identity: z.ZodOptional<z.ZodString>;
167
- handoffs: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"team">, z.ZodArray<z.ZodString>]>>;
168
- schedules: z.ZodOptional<z.ZodArray<z.ZodObject<{
169
- cron: z.ZodString;
170
- timezone: z.ZodOptional<z.ZodString>;
171
- input: z.ZodString;
172
- budget_micro_usd: z.ZodNumber;
173
- identity: z.ZodOptional<z.ZodString>;
174
- enabled: z.ZodOptional<z.ZodBoolean>;
175
- }, z.core.$strip>>>;
176
- intake: z.ZodOptional<z.ZodObject<{
177
- message: z.ZodString;
178
- budget_micro_usd: z.ZodOptional<z.ZodNumber>;
179
- }, z.core.$strip>>;
180
- }, z.core.$strip>;
181
- /**
182
- * A vault credential (§23) minus what `up` fills in. `value` is a real third-party secret, so it is
183
- * `{ from_env }` only — never a literal — and travels once, on create. Values are write-only and
184
- * rows immutable, so `kind`, `key` and `host` / `mcp_server_url` are all the reconciler can match a
185
- * live row by.
186
- */
187
- declare const CredentialDeclSchema: z.ZodObject<{
188
- kind: z.ZodEnum<{
189
- env_var: "env_var";
190
- static_bearer: "static_bearer";
191
- mcp_oauth: "mcp_oauth";
192
- }>;
193
- key: z.ZodString;
194
- host: z.ZodOptional<z.ZodString>;
195
- mcp_server_url: z.ZodOptional<z.ZodURL>;
196
- value: z.ZodObject<{
197
- from_env: z.ZodString;
198
- }, z.core.$strip>;
199
- }, z.core.$strip>;
200
- /** `name` is the vault's `display_name`, the key it is found by; `identity` a declared persona *name*. */
201
- declare const VaultDeclSchema: z.ZodObject<{
202
- name: z.ZodString;
203
- identity: z.ZodOptional<z.ZodString>;
204
- credentials: z.ZodArray<z.ZodObject<{
205
- kind: z.ZodEnum<{
206
- env_var: "env_var";
207
- static_bearer: "static_bearer";
208
- mcp_oauth: "mcp_oauth";
209
- }>;
210
- key: z.ZodString;
211
- host: z.ZodOptional<z.ZodString>;
212
- mcp_server_url: z.ZodOptional<z.ZodURL>;
213
- value: z.ZodObject<{
214
- from_env: z.ZodString;
215
- }, z.core.$strip>;
216
- }, z.core.$strip>>;
217
- }, z.core.$strip>;
218
- /** `file` holds the skill body, resolved against the config's directory; the slug grammar is `POST /v1/skills`' (§13). */
219
- declare const SkillDeclSchema: z.ZodObject<{
220
- slug: z.ZodString;
221
- file: z.ZodString;
222
- }, z.core.$strip>;
223
- declare const IdentityDeclSchema: z.ZodObject<{
224
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
225
- name: z.ZodString;
226
- legal: z.ZodOptional<z.ZodArray<z.ZodObject<{
227
- description: z.ZodString;
228
- state: z.ZodEnum<{
229
- AL: "AL";
230
- AK: "AK";
231
- AZ: "AZ";
232
- AR: "AR";
233
- CA: "CA";
234
- CO: "CO";
235
- CT: "CT";
236
- DE: "DE";
237
- DC: "DC";
238
- FL: "FL";
239
- GA: "GA";
240
- HI: "HI";
241
- ID: "ID";
242
- IL: "IL";
243
- IN: "IN";
244
- IA: "IA";
245
- KS: "KS";
246
- KY: "KY";
247
- LA: "LA";
248
- ME: "ME";
249
- MD: "MD";
250
- MA: "MA";
251
- MI: "MI";
252
- MN: "MN";
253
- MS: "MS";
254
- MO: "MO";
255
- MT: "MT";
256
- NE: "NE";
257
- NV: "NV";
258
- NH: "NH";
259
- NJ: "NJ";
260
- NM: "NM";
261
- NY: "NY";
262
- NC: "NC";
263
- ND: "ND";
264
- OH: "OH";
265
- OK: "OK";
266
- OR: "OR";
267
- PA: "PA";
268
- RI: "RI";
269
- SC: "SC";
270
- SD: "SD";
271
- TN: "TN";
272
- TX: "TX";
273
- UT: "UT";
274
- VT: "VT";
275
- VA: "VA";
276
- WA: "WA";
277
- WV: "WV";
278
- WI: "WI";
279
- WY: "WY";
280
- }>;
281
- name_options: z.ZodArray<z.ZodString>;
282
- naics_code: z.ZodString;
283
- label: z.ZodString;
284
- }, z.core.$strip>>>;
285
- wallet: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
286
- network: z.ZodOptional<z.ZodEnum<{
287
- "eip155:84532": "eip155:84532";
288
- "eip155:8453": "eip155:8453";
289
- }>>;
290
- policy: z.ZodOptional<z.ZodObject<{
291
- per_tx_cap_micro_usd: z.ZodOptional<z.ZodNumber>;
292
- daily_cap_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
293
- low_balance_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
294
- }, z.core.$strip>>;
295
- }, z.core.$strip>, z.ZodArray<z.ZodObject<{
296
- network: z.ZodOptional<z.ZodEnum<{
297
- "eip155:84532": "eip155:84532";
298
- "eip155:8453": "eip155:8453";
299
- }>>;
300
- policy: z.ZodOptional<z.ZodObject<{
301
- per_tx_cap_micro_usd: z.ZodOptional<z.ZodNumber>;
302
- daily_cap_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
303
- low_balance_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
304
- }, z.core.$strip>>;
305
- }, z.core.$strip>>]>>;
306
- cards: z.ZodOptional<z.ZodArray<z.ZodObject<{
307
- label: z.ZodString;
308
- load_micro_usd: z.ZodNumber;
309
- }, z.core.$strip>>>;
310
- }, z.core.$strip>;
311
- /**
312
- * One card the apply seeds on the organization's board (`canonical-spec §31.11`). `key` is the
313
- * card's idempotency handle — `<project>:<key>` on the wire — so a re-apply finds the card it wrote;
314
- * `assignee` is an agent NAME, which is what a board card carries (§28.11); `blocked_by` names
315
- * sibling tasks by key and becomes their `crd_` ids at apply time.
316
- */
317
- declare const TaskDeclSchema: z.ZodObject<{
318
- key: z.ZodString;
319
- title: z.ZodString;
320
- body: z.ZodOptional<z.ZodString>;
321
- assignee: z.ZodOptional<z.ZodString>;
322
- blocked_by: z.ZodOptional<z.ZodArray<z.ZodString>>;
323
- }, z.core.$strip>;
324
- declare const ProjectSchema: z.ZodObject<{
325
- name: z.ZodString;
326
- blueprint: z.ZodOptional<z.ZodString>;
327
- template: z.ZodOptional<z.ZodString>;
328
- title: z.ZodOptional<z.ZodString>;
329
- description: z.ZodOptional<z.ZodString>;
330
- platforms: z.ZodOptional<z.ZodArray<z.ZodEnum<{
331
- bluesky: "bluesky";
332
- facebook: "facebook";
333
- instagram: "instagram";
334
- linkedin: "linkedin";
335
- mastodon: "mastodon";
336
- pinterest: "pinterest";
337
- reddit: "reddit";
338
- threads: "threads";
339
- tiktok: "tiktok";
340
- x: "x";
341
- youtube: "youtube";
342
- }>>>;
343
- mini_apps: z.ZodOptional<z.ZodArray<z.ZodObject<{
344
- slug: z.ZodString;
345
- name: z.ZodString;
346
- icon: z.ZodEnum<{
347
- calendar: "calendar";
348
- grid: "grid";
349
- list: "list";
350
- chart: "chart";
351
- play: "play";
352
- }>;
353
- pages: z.ZodArray<z.ZodObject<{
354
- slug: z.ZodString;
355
- title: z.ZodString;
356
- spec: z.ZodObject<{
357
- root: z.ZodString;
358
- elements: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
359
- type: z.ZodLiteral<"Page">;
360
- props: z.ZodObject<{}, z.core.$strict>;
361
- children: z.ZodArray<z.ZodString>;
362
- }, z.core.$strict>, z.ZodObject<{
363
- type: z.ZodLiteral<"Section">;
364
- props: z.ZodObject<{
365
- title: z.ZodString;
366
- to: z.ZodOptional<z.ZodString>;
367
- hide_empty: z.ZodOptional<z.ZodBoolean>;
368
- }, z.core.$strict>;
369
- children: z.ZodArray<z.ZodString>;
370
- }, z.core.$strict>, z.ZodObject<{
371
- type: z.ZodLiteral<"Stack">;
372
- props: z.ZodObject<{}, z.core.$strict>;
373
- children: z.ZodArray<z.ZodString>;
374
- }, z.core.$strict>, z.ZodObject<{
375
- type: z.ZodLiteral<"Grid">;
376
- props: z.ZodObject<{
377
- columns: z.ZodLiteral<2 | 1 | 3>;
378
- }, z.core.$strict>;
379
- children: z.ZodArray<z.ZodString>;
380
- }, z.core.$strict>, z.ZodObject<{
381
- type: z.ZodLiteral<"Metric">;
382
- props: z.ZodObject<{
383
- label: z.ZodString;
384
- value: z.ZodObject<{
385
- $source: z.ZodEnum<{
386
- views_total: "views_total";
387
- spend_total: "spend_total";
388
- }>;
389
- days: z.ZodDefault<z.ZodNumber>;
390
- }, z.core.$strict>;
391
- delta: z.ZodOptional<z.ZodObject<{
392
- $source: z.ZodEnum<{
393
- views_change: "views_change";
394
- }>;
395
- }, z.core.$strict>>;
396
- }, z.core.$strict>;
397
- children: z.ZodOptional<z.ZodArray<z.ZodString>>;
398
- }, z.core.$strict>, z.ZodObject<{
399
- type: z.ZodLiteral<"LineChart">;
400
- props: z.ZodObject<{
401
- label: z.ZodOptional<z.ZodString>;
402
- series: z.ZodObject<{
403
- $source: z.ZodEnum<{
404
- spend_by_day: "spend_by_day";
405
- }>;
406
- days: z.ZodDefault<z.ZodNumber>;
407
- }, z.core.$strict>;
408
- }, z.core.$strict>;
409
- children: z.ZodOptional<z.ZodArray<z.ZodString>>;
410
- }, z.core.$strict>, z.ZodObject<{
411
- type: z.ZodLiteral<"BarList">;
412
- props: z.ZodObject<{
413
- label: z.ZodOptional<z.ZodString>;
414
- bars: z.ZodObject<{
415
- $source: z.ZodEnum<{
416
- post_views: "post_views";
417
- }>;
418
- limit: z.ZodDefault<z.ZodNumber>;
419
- }, z.core.$strict>;
420
- }, z.core.$strict>;
421
- children: z.ZodOptional<z.ZodArray<z.ZodString>>;
422
- }, z.core.$strict>, z.ZodObject<{
423
- type: z.ZodLiteral<"Progress">;
424
- props: z.ZodObject<{
425
- label: z.ZodString;
426
- progress: z.ZodObject<{
427
- $source: z.ZodEnum<{
428
- posts_this_week: "posts_this_week";
429
- }>;
430
- }, z.core.$strict>;
431
- }, z.core.$strict>;
432
- children: z.ZodOptional<z.ZodArray<z.ZodString>>;
433
- }, z.core.$strict>, z.ZodObject<{
434
- type: z.ZodLiteral<"Roadmap">;
435
- props: z.ZodObject<{
436
- label: z.ZodOptional<z.ZodString>;
437
- board: z.ZodObject<{
438
- $source: z.ZodEnum<{
439
- roadmap: "roadmap";
440
- }>;
441
- per_group: z.ZodDefault<z.ZodNumber>;
442
- }, z.core.$strict>;
443
- }, z.core.$strict>;
444
- children: z.ZodOptional<z.ZodArray<z.ZodString>>;
445
- }, z.core.$strict>, z.ZodObject<{
446
- type: z.ZodLiteral<"Schedule">;
447
- props: z.ZodObject<{
448
- label: z.ZodOptional<z.ZodString>;
449
- week: z.ZodObject<{
450
- $source: z.ZodEnum<{
451
- schedule: "schedule";
452
- }>;
453
- }, z.core.$strict>;
454
- }, z.core.$strict>;
455
- children: z.ZodOptional<z.ZodArray<z.ZodString>>;
456
- }, z.core.$strict>, z.ZodObject<{
457
- type: z.ZodLiteral<"Media">;
458
- props: z.ZodObject<{
459
- label: z.ZodOptional<z.ZodString>;
460
- files: z.ZodObject<{
461
- $source: z.ZodEnum<{
462
- latest_media: "latest_media";
463
- newest_media: "newest_media";
464
- }>;
465
- count: z.ZodDefault<z.ZodNumber>;
466
- }, z.core.$strict>;
467
- }, z.core.$strict>;
468
- children: z.ZodOptional<z.ZodArray<z.ZodString>>;
469
- }, z.core.$strict>, z.ZodObject<{
470
- type: z.ZodLiteral<"Text">;
471
- props: z.ZodObject<{
472
- text: z.ZodString;
473
- }, z.core.$strict>;
474
- children: z.ZodOptional<z.ZodArray<z.ZodString>>;
475
- }, z.core.$strict>, z.ZodObject<{
476
- type: z.ZodLiteral<"Needs">;
477
- props: z.ZodObject<{
478
- label: z.ZodOptional<z.ZodString>;
479
- needs: z.ZodObject<{
480
- $source: z.ZodEnum<{
481
- needs: "needs";
482
- }>;
483
- }, z.core.$strict>;
484
- }, z.core.$strict>;
485
- children: z.ZodOptional<z.ZodArray<z.ZodString>>;
486
- }, z.core.$strict>, z.ZodObject<{
487
- type: z.ZodLiteral<"Activity">;
488
- props: z.ZodObject<{
489
- label: z.ZodOptional<z.ZodString>;
490
- agents: z.ZodObject<{
491
- $source: z.ZodEnum<{
492
- agents_activity: "agents_activity";
493
- }>;
494
- }, z.core.$strict>;
495
- }, z.core.$strict>;
496
- children: z.ZodOptional<z.ZodArray<z.ZodString>>;
497
- }, z.core.$strict>, z.ZodObject<{
498
- type: z.ZodLiteral<"Accounts">;
499
- props: z.ZodObject<{
500
- accounts: z.ZodObject<{
501
- $source: z.ZodEnum<{
502
- accounts: "accounts";
503
- }>;
504
- }, z.core.$strict>;
505
- }, z.core.$strict>;
506
- children: z.ZodOptional<z.ZodArray<z.ZodString>>;
507
- }, z.core.$strict>, z.ZodObject<{
508
- type: z.ZodLiteral<"Posts">;
509
- props: z.ZodObject<{
510
- label: z.ZodOptional<z.ZodString>;
511
- layout: z.ZodOptional<z.ZodEnum<{
512
- grid: "grid";
513
- list: "list";
514
- row: "row";
515
- }>>;
516
- posts: z.ZodObject<{
517
- $source: z.ZodEnum<{
518
- posts: "posts";
519
- }>;
520
- status: z.ZodUnion<readonly [z.ZodEnum<{
521
- scheduled: "scheduled";
522
- posted: "posted";
523
- waiting: "waiting";
524
- }>, z.ZodArray<z.ZodEnum<{
525
- scheduled: "scheduled";
526
- posted: "posted";
527
- waiting: "waiting";
528
- }>>]>;
529
- limit: z.ZodDefault<z.ZodNumber>;
530
- }, z.core.$strict>;
531
- }, z.core.$strict>;
532
- children: z.ZodOptional<z.ZodArray<z.ZodString>>;
533
- }, z.core.$strict>, z.ZodObject<{
534
- type: z.ZodLiteral<"Answers">;
535
- props: z.ZodObject<{
536
- answers: z.ZodObject<{
537
- $source: z.ZodEnum<{
538
- answers: "answers";
539
- }>;
540
- keys: z.ZodArray<z.ZodString>;
541
- }, z.core.$strict>;
542
- }, z.core.$strict>;
543
- children: z.ZodOptional<z.ZodArray<z.ZodString>>;
544
- }, z.core.$strict>, z.ZodObject<{
545
- type: z.ZodLiteral<"MediaLibrary">;
546
- props: z.ZodObject<{}, z.core.$strict>;
547
- children: z.ZodOptional<z.ZodArray<z.ZodString>>;
548
- }, z.core.$strict>], "type">>;
549
- }, z.core.$strict>;
550
- }, z.core.$strict>>;
551
- }, z.core.$strict>>>;
552
- questions: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
553
- type: z.ZodLiteral<"text">;
554
- placeholder: z.ZodOptional<z.ZodString>;
555
- key: z.ZodString;
556
- label: z.ZodString;
557
- help: z.ZodOptional<z.ZodString>;
558
- optional: z.ZodOptional<z.ZodBoolean>;
559
- }, z.core.$strip>, z.ZodObject<{
560
- type: z.ZodLiteral<"choice">;
561
- options: z.ZodArray<z.ZodString>;
562
- multiple: z.ZodDefault<z.ZodBoolean>;
563
- other: z.ZodDefault<z.ZodBoolean>;
564
- key: z.ZodString;
565
- label: z.ZodString;
566
- help: z.ZodOptional<z.ZodString>;
567
- optional: z.ZodOptional<z.ZodBoolean>;
568
- }, z.core.$strip>], "type">>>;
569
- skills: z.ZodDefault<z.ZodArray<z.ZodObject<{
570
- slug: z.ZodString;
571
- file: z.ZodString;
572
- }, z.core.$strip>>>;
573
- identities: z.ZodDefault<z.ZodArray<z.ZodObject<{
574
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
575
- name: z.ZodString;
576
- legal: z.ZodOptional<z.ZodArray<z.ZodObject<{
577
- description: z.ZodString;
578
- state: z.ZodEnum<{
579
- AL: "AL";
580
- AK: "AK";
581
- AZ: "AZ";
582
- AR: "AR";
583
- CA: "CA";
584
- CO: "CO";
585
- CT: "CT";
586
- DE: "DE";
587
- DC: "DC";
588
- FL: "FL";
589
- GA: "GA";
590
- HI: "HI";
591
- ID: "ID";
592
- IL: "IL";
593
- IN: "IN";
594
- IA: "IA";
595
- KS: "KS";
596
- KY: "KY";
597
- LA: "LA";
598
- ME: "ME";
599
- MD: "MD";
600
- MA: "MA";
601
- MI: "MI";
602
- MN: "MN";
603
- MS: "MS";
604
- MO: "MO";
605
- MT: "MT";
606
- NE: "NE";
607
- NV: "NV";
608
- NH: "NH";
609
- NJ: "NJ";
610
- NM: "NM";
611
- NY: "NY";
612
- NC: "NC";
613
- ND: "ND";
614
- OH: "OH";
615
- OK: "OK";
616
- OR: "OR";
617
- PA: "PA";
618
- RI: "RI";
619
- SC: "SC";
620
- SD: "SD";
621
- TN: "TN";
622
- TX: "TX";
623
- UT: "UT";
624
- VT: "VT";
625
- VA: "VA";
626
- WA: "WA";
627
- WV: "WV";
628
- WI: "WI";
629
- WY: "WY";
630
- }>;
631
- name_options: z.ZodArray<z.ZodString>;
632
- naics_code: z.ZodString;
633
- label: z.ZodString;
634
- }, z.core.$strip>>>;
635
- wallet: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
636
- network: z.ZodOptional<z.ZodEnum<{
637
- "eip155:84532": "eip155:84532";
638
- "eip155:8453": "eip155:8453";
639
- }>>;
640
- policy: z.ZodOptional<z.ZodObject<{
641
- per_tx_cap_micro_usd: z.ZodOptional<z.ZodNumber>;
642
- daily_cap_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
643
- low_balance_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
644
- }, z.core.$strip>>;
645
- }, z.core.$strip>, z.ZodArray<z.ZodObject<{
646
- network: z.ZodOptional<z.ZodEnum<{
647
- "eip155:84532": "eip155:84532";
648
- "eip155:8453": "eip155:8453";
649
- }>>;
650
- policy: z.ZodOptional<z.ZodObject<{
651
- per_tx_cap_micro_usd: z.ZodOptional<z.ZodNumber>;
652
- daily_cap_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
653
- low_balance_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
654
- }, z.core.$strip>>;
655
- }, z.core.$strip>>]>>;
656
- cards: z.ZodOptional<z.ZodArray<z.ZodObject<{
657
- label: z.ZodString;
658
- load_micro_usd: z.ZodNumber;
659
- }, z.core.$strip>>>;
660
- }, z.core.$strip>>>;
661
- vaults: z.ZodDefault<z.ZodArray<z.ZodObject<{
662
- name: z.ZodString;
663
- identity: z.ZodOptional<z.ZodString>;
664
- credentials: z.ZodArray<z.ZodObject<{
665
- kind: z.ZodEnum<{
666
- env_var: "env_var";
667
- static_bearer: "static_bearer";
668
- mcp_oauth: "mcp_oauth";
669
- }>;
670
- key: z.ZodString;
671
- host: z.ZodOptional<z.ZodString>;
672
- mcp_server_url: z.ZodOptional<z.ZodURL>;
673
- value: z.ZodObject<{
674
- from_env: z.ZodString;
675
- }, z.core.$strip>;
676
- }, z.core.$strip>>;
677
- }, z.core.$strip>>>;
678
- apps: z.ZodDefault<z.ZodArray<z.ZodObject<{
679
- name: z.ZodString;
680
- type: z.ZodEnum<{
681
- frontend_only: "frontend_only";
682
- fullstack: "fullstack";
683
- }>;
684
- description: z.ZodOptional<z.ZodString>;
685
- deploy_dir: z.ZodOptional<z.ZodString>;
686
- mcp: z.ZodOptional<z.ZodString>;
687
- env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
688
- from_env: z.ZodString;
689
- }, z.core.$strip>, z.ZodObject<{
690
- generate: z.ZodLiteral<true>;
691
- }, z.core.$strip>]>>>;
692
- required: z.ZodOptional<z.ZodBoolean>;
693
- migrations: z.ZodOptional<z.ZodArray<z.ZodString>>;
694
- buckets: z.ZodOptional<z.ZodArray<z.ZodObject<{
695
- name: z.ZodString;
696
- public: z.ZodDefault<z.ZodBoolean>;
697
- }, z.core.$strip>>>;
698
- }, z.core.$strip>>>;
699
- agents: z.ZodDefault<z.ZodArray<z.ZodObject<{
700
- name: z.ZodString;
701
- model: z.ZodString;
702
- budget: z.ZodObject<{
703
- cap_micro_usd: z.ZodNumber;
704
- max_task_micro_usd: z.ZodNumber;
705
- period: z.ZodEnum<{
706
- month: "month";
707
- day: "day";
708
- week: "week";
709
- }>;
710
- }, z.core.$strip>;
711
- description: z.ZodOptional<z.ZodString>;
712
- role: z.ZodOptional<z.ZodString>;
713
- required: z.ZodOptional<z.ZodBoolean>;
714
- system: z.ZodOptional<z.ZodString>;
715
- tools: z.ZodOptional<z.ZodObject<{
716
- default_config: z.ZodObject<{
717
- permission: z.ZodEnum<{
718
- allow: "allow";
719
- deny: "deny";
720
- ask: "ask";
721
- }>;
722
- }, z.core.$strip>;
723
- configs: z.ZodRecord<z.ZodString, z.ZodObject<{
724
- enabled: z.ZodBoolean;
725
- permission: z.ZodEnum<{
726
- allow: "allow";
727
- deny: "deny";
728
- ask: "ask";
729
- }>;
730
- config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
731
- }, z.core.$strip>>;
732
- }, z.core.$strip>>;
733
- skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
734
- mcp_servers: z.ZodOptional<z.ZodArray<z.ZodObject<{
735
- name: z.ZodString;
736
- url: z.ZodURL;
737
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
738
- }, z.core.$strip>>>;
739
- window: z.ZodOptional<z.ZodEnum<{
740
- immediate: "immediate";
741
- priority: "priority";
742
- loose: "loose";
743
- }>>;
744
- multiagent: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
745
- agents: z.ZodArray<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<{
746
- type: "agent";
747
- name: string;
748
- }, string>>, z.ZodObject<{
749
- type: z.ZodLiteral<"agent">;
750
- name: z.ZodString;
751
- version: z.ZodOptional<z.ZodNumber>;
752
- }, z.core.$strip>, z.ZodObject<{
753
- type: z.ZodLiteral<"self">;
754
- }, z.core.$strip>, z.ZodObject<{
755
- type: z.ZodLiteral<"advisor">;
756
- model: z.ZodString;
757
- }, z.core.$strip>]>>;
758
- type: z.ZodLiteral<"coordinator">;
759
- board: z.ZodOptional<z.ZodBoolean>;
760
- }, z.core.$strip>, z.ZodNull]>>;
761
- output_schema: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
762
- structured_output_required: z.ZodOptional<z.ZodBoolean>;
763
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
764
- allowed_apps: z.ZodOptional<z.ZodArray<z.ZodString>>;
765
- identity: z.ZodOptional<z.ZodString>;
766
- handoffs: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"team">, z.ZodArray<z.ZodString>]>>;
767
- schedules: z.ZodOptional<z.ZodArray<z.ZodObject<{
768
- cron: z.ZodString;
769
- timezone: z.ZodOptional<z.ZodString>;
770
- input: z.ZodString;
771
- budget_micro_usd: z.ZodNumber;
772
- identity: z.ZodOptional<z.ZodString>;
773
- enabled: z.ZodOptional<z.ZodBoolean>;
774
- }, z.core.$strip>>>;
775
- intake: z.ZodOptional<z.ZodObject<{
776
- message: z.ZodString;
777
- budget_micro_usd: z.ZodOptional<z.ZodNumber>;
778
- }, z.core.$strip>>;
779
- }, z.core.$strip>>>;
780
- crew_per_client: z.ZodOptional<z.ZodArray<z.ZodObject<{
781
- name: z.ZodString;
782
- role: z.ZodOptional<z.ZodString>;
783
- description: z.ZodOptional<z.ZodString>;
784
- }, z.core.$strip>>>;
785
- tasks: z.ZodDefault<z.ZodArray<z.ZodObject<{
786
- key: z.ZodString;
787
- title: z.ZodString;
788
- body: z.ZodOptional<z.ZodString>;
789
- assignee: z.ZodOptional<z.ZodString>;
790
- blocked_by: z.ZodOptional<z.ZodArray<z.ZodString>>;
791
- }, z.core.$strip>>>;
792
- removed: z.ZodDefault<z.ZodObject<{
793
- apps: z.ZodDefault<z.ZodArray<z.ZodString>>;
794
- agents: z.ZodDefault<z.ZodArray<z.ZodString>>;
795
- skills: z.ZodDefault<z.ZodArray<z.ZodString>>;
796
- identities: z.ZodDefault<z.ZodArray<z.ZodString>>;
797
- vaults: z.ZodDefault<z.ZodArray<z.ZodString>>;
798
- }, z.core.$strip>>;
799
- kept: z.ZodDefault<z.ZodObject<{
800
- agents: z.ZodDefault<z.ZodArray<z.ZodString>>;
801
- }, z.core.$strip>>;
802
- }, z.core.$strip>;
803
- type AppDecl = z.infer<typeof AppDeclSchema>;
804
- type AgentDecl = z.infer<typeof AgentDeclSchema>;
805
- type CrewPerClientDecl = NonNullable<ProjectConfig["crew_per_client"]>[number];
806
- type ScheduleDecl = z.infer<typeof ScheduleDeclSchema>;
807
- type SkillDecl = z.infer<typeof SkillDeclSchema>;
808
- type IdentityDecl = z.infer<typeof IdentityDeclSchema>;
809
- type VaultDecl = z.infer<typeof VaultDeclSchema>;
810
- type CredentialDecl = z.infer<typeof CredentialDeclSchema>;
811
- type TaskDecl = z.infer<typeof TaskDeclSchema>;
812
- type ProjectConfig = z.infer<typeof ProjectSchema>;
813
- /** Validate an untyped value (a loaded `.json`, an evaluated module) into a frozen project. */
814
- declare function parseProject(input: unknown): Readonly<ProjectConfig>;
815
- /** A config, plus the template data modules its blueprint repo carries (`template.ts`). */
816
- interface DefineInput extends z.input<typeof ProjectSchema> {
817
- /**
818
- * Every template this blueprint has — all of them, not just the chosen one. The chosen one's
819
- * agents become the project's crew; the others are what the switch rule keeps, which is why a
820
- * repo that carries only some of them is refused: switching would silently narrow.
821
- */
822
- templates?: readonly Template[];
823
- }
824
- /** The one export a `naive.config.ts` calls. Identity plus validation; the object comes back frozen. */
825
- declare function defineProject({ templates, ...input }: DefineInput): Readonly<ProjectConfig>;
826
-
827
6
  /**
828
7
  * The blueprint install (`canonical-spec §29.6`) — one applied declaration per
829
8
  * (organization, project), and the drift a `revision_conflict` names.
@@ -845,10 +24,10 @@ declare function defineProject({ templates, ...input }: DefineInput): Readonly<P
845
24
  * names unchanged, so nothing downstream of it learns a second word for the same thing.
846
25
  */
847
26
  declare const ResourceActionSchema: z.ZodEnum<{
27
+ deleted: "deleted";
848
28
  created: "created";
849
29
  updated: "updated";
850
30
  unchanged: "unchanged";
851
- deleted: "deleted";
852
31
  refused: "refused";
853
32
  }>;
854
33
  type ResourceAction = z.infer<typeof ResourceActionSchema>;
@@ -856,10 +35,10 @@ type ResourceAction = z.infer<typeof ResourceActionSchema>;
856
35
  declare const ResourceReportSchema: z.ZodObject<{
857
36
  name: z.ZodString;
858
37
  action: z.ZodEnum<{
38
+ deleted: "deleted";
859
39
  created: "created";
860
40
  updated: "updated";
861
41
  unchanged: "unchanged";
862
- deleted: "deleted";
863
42
  refused: "refused";
864
43
  }>;
865
44
  id: z.ZodOptional<z.ZodString>;
@@ -1188,6 +367,13 @@ interface UpOptions {
1188
367
  * applied install lands on the row that exists.
1189
368
  */
1190
369
  project?: string;
370
+ /**
371
+ * An install that shares the organization by its own names (ADR-1104, `scoped.ts`): its crew is
372
+ * filed under `project` rather than the template, and an identity is stamped with `project` and
373
+ * adopted only when it already carries it — another project's persona, or one nobody stamped, is
374
+ * refused rather than taken. Absent is every apply before that rule, exactly as it was.
375
+ */
376
+ isolated?: boolean;
1191
377
  /**
1192
378
  * What dials an app's own address before its crew is briefed (`awaitServing`). The platform's
1193
379
  * `fetch` by default; a test hands in a fake. It is NOT the client's `fetch`, which on a hosted
@@ -1204,6 +390,28 @@ declare function selectCrew(config: Readonly<ProjectConfig>, select: BlueprintSe
1204
390
  /** Plan → apply → report. Every refusal is one line in the report, never a thrown escape. */
1205
391
  declare function up(config: Readonly<ProjectConfig>, client: VettaClient, opts?: UpOptions): Promise<UpReport>;
1206
392
 
393
+ /**
394
+ * ONE TEMPLATE, TWICE IN ONE ORGANIZATION (`canonical-spec §29.6`, ADR-1104).
395
+ *
396
+ * Everything `up()` provisions is keyed by name in the organization, and ADR-0785 refuses a name
397
+ * another project holds — so a second install of a template found every agent taken and hired no
398
+ * one. An install that must share the organization with those names takes its own: every agent,
399
+ * app, identity and vault name, and every reference to one, starts with the install's prefix. The
400
+ * API decides the prefix once, when the install row is created, and passes it here on every apply.
401
+ *
402
+ * `config.name` becomes the install's `project`, so app ownership (ADR-0375), `NAIVE_PROJECT` and
403
+ * the board's card keys (`<project>:<key>`) are the install's own and never another install's.
404
+ *
405
+ * Prose is not rewritten. A system prompt that says "hand the script to the editor" still says it;
406
+ * the agent is told, in one generated line at the end of its `system`, what each name is here.
407
+ */
408
+
409
+ /**
410
+ * The config an install with `prefix` applies. `""` renames nothing and only files it under `project`.
411
+ * Skills stay shared by slug, so no install's `removed` deletes one another install's crew runs.
412
+ */
413
+ declare function scoped(config: Readonly<ProjectConfig>, prefix: string, project: string): ProjectConfig;
414
+
1207
415
  /**
1208
416
  * Agents in `naive up`: upsert by name with a drift-only PATCH, `allowed_apps` names resolved to
1209
417
  * app ids in the `apps` tool config (§29.3), the platform config passthrough (`system`, `skills`,
@@ -1232,4 +440,4 @@ declare function up(config: Readonly<ProjectConfig>, client: VettaClient, opts?:
1232
440
  */
1233
441
  declare const PROJECT_CONTEXT_PREAMBLE: string;
1234
442
 
1235
- export { type AgentDecl, type AppDecl, BLUEPRINTS, BlueprintRefusal, CONFIG_CANDIDATES, type ConfigLoad, type CredentialDecl, type CrewPerClientDecl, type DefineInput, type FileSource, type IdentityDecl, type MigrationFile, PLATFORM_ENV, PROJECT_CONTEXT_PREAMBLE, type PlatformEnv, type ProjectConfig, type ResourceAction, type ResourceReport, type ScheduleDecl, type SkillDecl, type TaskDecl, type Template, type TemplateChoice, type UpOptions, type UpReport, type VaultDecl, chooseTemplate, collectFiles, contentHash, defineProject, generatedPassword, generatedSecret, hasRoster, loadConfig, migrationFiles, parseProject, selectCrew, up };
443
+ export { AgentDecl, AppDecl, CONFIG_CANDIDATES, type ConfigLoad, type FileSource, type MigrationFile, PLATFORM_ENV, PROJECT_CONTEXT_PREAMBLE, type PlatformEnv, ProjectConfig, type ResourceAction, type ResourceReport, type UpOptions, type UpReport, collectFiles, contentHash, generatedPassword, generatedSecret, hasRoster, loadConfig, migrationFiles, scoped, selectCrew, up };