@usenaive-sdk/blueprints 0.2.0 → 0.4.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 +519 -13
- package/dist/index.js +2525 -648
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -44,7 +44,8 @@ interface Template {
|
|
|
44
44
|
* Every blueprint and the templates it carries. `agency` defaults to `blank` — a working agency
|
|
45
45
|
* with no specialism is a safe thing to get by accident. `media` has NO default on purpose: its
|
|
46
46
|
* two crews spend money in different ways, so defaulting one of them is a bill the operator did
|
|
47
|
-
* not choose.
|
|
47
|
+
* not choose. `web` carries one crew today, so `publisher` is its default for the reason `blank` is
|
|
48
|
+
* `agency`'s: the only thing you can get is the thing you meant.
|
|
48
49
|
*/
|
|
49
50
|
declare const BLUEPRINTS: Record<string, {
|
|
50
51
|
templates: readonly string[];
|
|
@@ -80,7 +81,15 @@ declare const AppDeclSchema: z.ZodObject<{
|
|
|
80
81
|
mcp: z.ZodOptional<z.ZodString>;
|
|
81
82
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
82
83
|
from_env: z.ZodString;
|
|
84
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
85
|
+
generate: z.ZodLiteral<true>;
|
|
83
86
|
}, z.core.$strip>]>>>;
|
|
87
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
+
migrations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
89
|
+
buckets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
90
|
+
name: z.ZodString;
|
|
91
|
+
public: z.ZodDefault<z.ZodBoolean>;
|
|
92
|
+
}, z.core.$strip>>>;
|
|
84
93
|
}, z.core.$strip>;
|
|
85
94
|
/**
|
|
86
95
|
* A cron on the agent — a platform deployment (§12) minus what `up` fills in: `agent_id`, and the
|
|
@@ -111,6 +120,8 @@ declare const AgentDeclSchema: z.ZodObject<{
|
|
|
111
120
|
}>;
|
|
112
121
|
}, z.core.$strip>;
|
|
113
122
|
description: z.ZodOptional<z.ZodString>;
|
|
123
|
+
role: z.ZodOptional<z.ZodString>;
|
|
124
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
114
125
|
system: z.ZodOptional<z.ZodString>;
|
|
115
126
|
tools: z.ZodOptional<z.ZodObject<{
|
|
116
127
|
default_config: z.ZodObject<{
|
|
@@ -136,6 +147,31 @@ declare const AgentDeclSchema: z.ZodObject<{
|
|
|
136
147
|
url: z.ZodURL;
|
|
137
148
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
138
149
|
}, z.core.$strip>>>;
|
|
150
|
+
window: z.ZodOptional<z.ZodEnum<{
|
|
151
|
+
immediate: "immediate";
|
|
152
|
+
priority: "priority";
|
|
153
|
+
loose: "loose";
|
|
154
|
+
}>>;
|
|
155
|
+
multiagent: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
156
|
+
agents: z.ZodArray<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
157
|
+
type: "agent";
|
|
158
|
+
name: string;
|
|
159
|
+
}, string>>, z.ZodObject<{
|
|
160
|
+
type: z.ZodLiteral<"agent">;
|
|
161
|
+
name: z.ZodString;
|
|
162
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
163
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
164
|
+
type: z.ZodLiteral<"self">;
|
|
165
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
166
|
+
type: z.ZodLiteral<"advisor">;
|
|
167
|
+
model: z.ZodString;
|
|
168
|
+
}, z.core.$strip>]>>;
|
|
169
|
+
type: z.ZodLiteral<"coordinator">;
|
|
170
|
+
board: z.ZodOptional<z.ZodBoolean>;
|
|
171
|
+
}, z.core.$strip>, z.ZodNull]>>;
|
|
172
|
+
output_schema: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
173
|
+
structured_output_required: z.ZodOptional<z.ZodBoolean>;
|
|
174
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
139
175
|
allowed_apps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
140
176
|
identity: z.ZodOptional<z.ZodString>;
|
|
141
177
|
schedules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -196,6 +232,90 @@ declare const SkillDeclSchema: z.ZodObject<{
|
|
|
196
232
|
declare const IdentityDeclSchema: z.ZodObject<{
|
|
197
233
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
198
234
|
name: z.ZodString;
|
|
235
|
+
legal: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
236
|
+
description: z.ZodString;
|
|
237
|
+
state: z.ZodEnum<{
|
|
238
|
+
AL: "AL";
|
|
239
|
+
AK: "AK";
|
|
240
|
+
AZ: "AZ";
|
|
241
|
+
AR: "AR";
|
|
242
|
+
CA: "CA";
|
|
243
|
+
CO: "CO";
|
|
244
|
+
CT: "CT";
|
|
245
|
+
DE: "DE";
|
|
246
|
+
DC: "DC";
|
|
247
|
+
FL: "FL";
|
|
248
|
+
GA: "GA";
|
|
249
|
+
HI: "HI";
|
|
250
|
+
ID: "ID";
|
|
251
|
+
IL: "IL";
|
|
252
|
+
IN: "IN";
|
|
253
|
+
IA: "IA";
|
|
254
|
+
KS: "KS";
|
|
255
|
+
KY: "KY";
|
|
256
|
+
LA: "LA";
|
|
257
|
+
ME: "ME";
|
|
258
|
+
MD: "MD";
|
|
259
|
+
MA: "MA";
|
|
260
|
+
MI: "MI";
|
|
261
|
+
MN: "MN";
|
|
262
|
+
MS: "MS";
|
|
263
|
+
MO: "MO";
|
|
264
|
+
MT: "MT";
|
|
265
|
+
NE: "NE";
|
|
266
|
+
NV: "NV";
|
|
267
|
+
NH: "NH";
|
|
268
|
+
NJ: "NJ";
|
|
269
|
+
NM: "NM";
|
|
270
|
+
NY: "NY";
|
|
271
|
+
NC: "NC";
|
|
272
|
+
ND: "ND";
|
|
273
|
+
OH: "OH";
|
|
274
|
+
OK: "OK";
|
|
275
|
+
OR: "OR";
|
|
276
|
+
PA: "PA";
|
|
277
|
+
RI: "RI";
|
|
278
|
+
SC: "SC";
|
|
279
|
+
SD: "SD";
|
|
280
|
+
TN: "TN";
|
|
281
|
+
TX: "TX";
|
|
282
|
+
UT: "UT";
|
|
283
|
+
VT: "VT";
|
|
284
|
+
VA: "VA";
|
|
285
|
+
WA: "WA";
|
|
286
|
+
WV: "WV";
|
|
287
|
+
WI: "WI";
|
|
288
|
+
WY: "WY";
|
|
289
|
+
}>;
|
|
290
|
+
name_options: z.ZodArray<z.ZodString>;
|
|
291
|
+
naics_code: z.ZodString;
|
|
292
|
+
label: z.ZodString;
|
|
293
|
+
}, z.core.$strip>>>;
|
|
294
|
+
wallet: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
295
|
+
network: z.ZodOptional<z.ZodEnum<{
|
|
296
|
+
"eip155:84532": "eip155:84532";
|
|
297
|
+
"eip155:8453": "eip155:8453";
|
|
298
|
+
}>>;
|
|
299
|
+
policy: z.ZodOptional<z.ZodObject<{
|
|
300
|
+
per_tx_cap_micro_usd: z.ZodOptional<z.ZodNumber>;
|
|
301
|
+
daily_cap_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
302
|
+
low_balance_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
303
|
+
}, z.core.$strip>>;
|
|
304
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
305
|
+
network: z.ZodOptional<z.ZodEnum<{
|
|
306
|
+
"eip155:84532": "eip155:84532";
|
|
307
|
+
"eip155:8453": "eip155:8453";
|
|
308
|
+
}>>;
|
|
309
|
+
policy: z.ZodOptional<z.ZodObject<{
|
|
310
|
+
per_tx_cap_micro_usd: z.ZodOptional<z.ZodNumber>;
|
|
311
|
+
daily_cap_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
312
|
+
low_balance_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
313
|
+
}, z.core.$strip>>;
|
|
314
|
+
}, z.core.$strip>>]>>;
|
|
315
|
+
cards: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
316
|
+
label: z.ZodString;
|
|
317
|
+
load_micro_usd: z.ZodNumber;
|
|
318
|
+
}, z.core.$strip>>>;
|
|
199
319
|
}, z.core.$strip>;
|
|
200
320
|
declare const ProjectSchema: z.ZodObject<{
|
|
201
321
|
name: z.ZodString;
|
|
@@ -223,6 +343,90 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
223
343
|
identities: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
224
344
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
225
345
|
name: z.ZodString;
|
|
346
|
+
legal: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
347
|
+
description: z.ZodString;
|
|
348
|
+
state: z.ZodEnum<{
|
|
349
|
+
AL: "AL";
|
|
350
|
+
AK: "AK";
|
|
351
|
+
AZ: "AZ";
|
|
352
|
+
AR: "AR";
|
|
353
|
+
CA: "CA";
|
|
354
|
+
CO: "CO";
|
|
355
|
+
CT: "CT";
|
|
356
|
+
DE: "DE";
|
|
357
|
+
DC: "DC";
|
|
358
|
+
FL: "FL";
|
|
359
|
+
GA: "GA";
|
|
360
|
+
HI: "HI";
|
|
361
|
+
ID: "ID";
|
|
362
|
+
IL: "IL";
|
|
363
|
+
IN: "IN";
|
|
364
|
+
IA: "IA";
|
|
365
|
+
KS: "KS";
|
|
366
|
+
KY: "KY";
|
|
367
|
+
LA: "LA";
|
|
368
|
+
ME: "ME";
|
|
369
|
+
MD: "MD";
|
|
370
|
+
MA: "MA";
|
|
371
|
+
MI: "MI";
|
|
372
|
+
MN: "MN";
|
|
373
|
+
MS: "MS";
|
|
374
|
+
MO: "MO";
|
|
375
|
+
MT: "MT";
|
|
376
|
+
NE: "NE";
|
|
377
|
+
NV: "NV";
|
|
378
|
+
NH: "NH";
|
|
379
|
+
NJ: "NJ";
|
|
380
|
+
NM: "NM";
|
|
381
|
+
NY: "NY";
|
|
382
|
+
NC: "NC";
|
|
383
|
+
ND: "ND";
|
|
384
|
+
OH: "OH";
|
|
385
|
+
OK: "OK";
|
|
386
|
+
OR: "OR";
|
|
387
|
+
PA: "PA";
|
|
388
|
+
RI: "RI";
|
|
389
|
+
SC: "SC";
|
|
390
|
+
SD: "SD";
|
|
391
|
+
TN: "TN";
|
|
392
|
+
TX: "TX";
|
|
393
|
+
UT: "UT";
|
|
394
|
+
VT: "VT";
|
|
395
|
+
VA: "VA";
|
|
396
|
+
WA: "WA";
|
|
397
|
+
WV: "WV";
|
|
398
|
+
WI: "WI";
|
|
399
|
+
WY: "WY";
|
|
400
|
+
}>;
|
|
401
|
+
name_options: z.ZodArray<z.ZodString>;
|
|
402
|
+
naics_code: z.ZodString;
|
|
403
|
+
label: z.ZodString;
|
|
404
|
+
}, z.core.$strip>>>;
|
|
405
|
+
wallet: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
406
|
+
network: z.ZodOptional<z.ZodEnum<{
|
|
407
|
+
"eip155:84532": "eip155:84532";
|
|
408
|
+
"eip155:8453": "eip155:8453";
|
|
409
|
+
}>>;
|
|
410
|
+
policy: z.ZodOptional<z.ZodObject<{
|
|
411
|
+
per_tx_cap_micro_usd: z.ZodOptional<z.ZodNumber>;
|
|
412
|
+
daily_cap_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
413
|
+
low_balance_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
414
|
+
}, z.core.$strip>>;
|
|
415
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
416
|
+
network: z.ZodOptional<z.ZodEnum<{
|
|
417
|
+
"eip155:84532": "eip155:84532";
|
|
418
|
+
"eip155:8453": "eip155:8453";
|
|
419
|
+
}>>;
|
|
420
|
+
policy: z.ZodOptional<z.ZodObject<{
|
|
421
|
+
per_tx_cap_micro_usd: z.ZodOptional<z.ZodNumber>;
|
|
422
|
+
daily_cap_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
423
|
+
low_balance_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
424
|
+
}, z.core.$strip>>;
|
|
425
|
+
}, z.core.$strip>>]>>;
|
|
426
|
+
cards: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
427
|
+
label: z.ZodString;
|
|
428
|
+
load_micro_usd: z.ZodNumber;
|
|
429
|
+
}, z.core.$strip>>>;
|
|
226
430
|
}, z.core.$strip>>>;
|
|
227
431
|
vaults: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
228
432
|
name: z.ZodString;
|
|
@@ -252,7 +456,15 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
252
456
|
mcp: z.ZodOptional<z.ZodString>;
|
|
253
457
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
254
458
|
from_env: z.ZodString;
|
|
459
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
460
|
+
generate: z.ZodLiteral<true>;
|
|
255
461
|
}, z.core.$strip>]>>>;
|
|
462
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
463
|
+
migrations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
464
|
+
buckets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
465
|
+
name: z.ZodString;
|
|
466
|
+
public: z.ZodDefault<z.ZodBoolean>;
|
|
467
|
+
}, z.core.$strip>>>;
|
|
256
468
|
}, z.core.$strip>>>;
|
|
257
469
|
agents: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
258
470
|
name: z.ZodString;
|
|
@@ -267,6 +479,8 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
267
479
|
}>;
|
|
268
480
|
}, z.core.$strip>;
|
|
269
481
|
description: z.ZodOptional<z.ZodString>;
|
|
482
|
+
role: z.ZodOptional<z.ZodString>;
|
|
483
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
270
484
|
system: z.ZodOptional<z.ZodString>;
|
|
271
485
|
tools: z.ZodOptional<z.ZodObject<{
|
|
272
486
|
default_config: z.ZodObject<{
|
|
@@ -292,6 +506,31 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
292
506
|
url: z.ZodURL;
|
|
293
507
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
294
508
|
}, z.core.$strip>>>;
|
|
509
|
+
window: z.ZodOptional<z.ZodEnum<{
|
|
510
|
+
immediate: "immediate";
|
|
511
|
+
priority: "priority";
|
|
512
|
+
loose: "loose";
|
|
513
|
+
}>>;
|
|
514
|
+
multiagent: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
515
|
+
agents: z.ZodArray<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
516
|
+
type: "agent";
|
|
517
|
+
name: string;
|
|
518
|
+
}, string>>, z.ZodObject<{
|
|
519
|
+
type: z.ZodLiteral<"agent">;
|
|
520
|
+
name: z.ZodString;
|
|
521
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
522
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
523
|
+
type: z.ZodLiteral<"self">;
|
|
524
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
525
|
+
type: z.ZodLiteral<"advisor">;
|
|
526
|
+
model: z.ZodString;
|
|
527
|
+
}, z.core.$strip>]>>;
|
|
528
|
+
type: z.ZodLiteral<"coordinator">;
|
|
529
|
+
board: z.ZodOptional<z.ZodBoolean>;
|
|
530
|
+
}, z.core.$strip>, z.ZodNull]>>;
|
|
531
|
+
output_schema: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
532
|
+
structured_output_required: z.ZodOptional<z.ZodBoolean>;
|
|
533
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
295
534
|
allowed_apps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
296
535
|
identity: z.ZodOptional<z.ZodString>;
|
|
297
536
|
schedules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -307,6 +546,11 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
307
546
|
budget_micro_usd: z.ZodOptional<z.ZodNumber>;
|
|
308
547
|
}, z.core.$strip>>;
|
|
309
548
|
}, z.core.$strip>>>;
|
|
549
|
+
crew_per_client: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
550
|
+
name: z.ZodString;
|
|
551
|
+
role: z.ZodOptional<z.ZodString>;
|
|
552
|
+
description: z.ZodOptional<z.ZodString>;
|
|
553
|
+
}, z.core.$strip>>>;
|
|
310
554
|
removed: z.ZodDefault<z.ZodObject<{
|
|
311
555
|
apps: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
312
556
|
agents: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -320,6 +564,7 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
320
564
|
}, z.core.$strip>;
|
|
321
565
|
type AppDecl = z.infer<typeof AppDeclSchema>;
|
|
322
566
|
type AgentDecl = z.infer<typeof AgentDeclSchema>;
|
|
567
|
+
type CrewPerClientDecl = NonNullable<ProjectConfig["crew_per_client"]>[number];
|
|
323
568
|
type ScheduleDecl = z.infer<typeof ScheduleDeclSchema>;
|
|
324
569
|
type SkillDecl = z.infer<typeof SkillDeclSchema>;
|
|
325
570
|
type IdentityDecl = z.infer<typeof IdentityDeclSchema>;
|
|
@@ -340,6 +585,101 @@ interface DefineInput extends z.input<typeof ProjectSchema> {
|
|
|
340
585
|
/** The one export a `naive.config.ts` calls. Identity plus validation; the object comes back frozen. */
|
|
341
586
|
declare function defineProject({ templates, ...input }: DefineInput): Readonly<ProjectConfig>;
|
|
342
587
|
|
|
588
|
+
/**
|
|
589
|
+
* The blueprint install (`canonical-spec §29.6`) — one applied declaration per
|
|
590
|
+
* (organization, project), and the drift a `revision_conflict` names.
|
|
591
|
+
*
|
|
592
|
+
* `naive up` needed no server-side state while the only writer was a person with a clone: its
|
|
593
|
+
* working tree was the manifest. The studio applying the same declaration makes two writers on one
|
|
594
|
+
* organization, and neither can see the other. This row is what they share.
|
|
595
|
+
*
|
|
596
|
+
* It is not a second source of truth for what is provisioned — apps, agents, skills, identities and
|
|
597
|
+
* vaults stay keyed by name on their own routes. It records *that* an apply happened, with what, by
|
|
598
|
+
* whom, and against which revision.
|
|
599
|
+
*/
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* What one apply did to one resource. This is the vocabulary `naive up` has printed since it
|
|
603
|
+
* existed; it is written HERE, and imported by `@usenaive-sdk/blueprints`, for the reason
|
|
604
|
+
* `CLAUDE.md §2` gives: the hosted apply publishes the engine's report on the install (below), so
|
|
605
|
+
* it is a wire shape, and a wire shape has exactly one definition. The engine re-exports these two
|
|
606
|
+
* names unchanged, so nothing downstream of it learns a second word for the same thing.
|
|
607
|
+
*/
|
|
608
|
+
declare const ResourceActionSchema: z.ZodEnum<{
|
|
609
|
+
created: "created";
|
|
610
|
+
updated: "updated";
|
|
611
|
+
unchanged: "unchanged";
|
|
612
|
+
deleted: "deleted";
|
|
613
|
+
refused: "refused";
|
|
614
|
+
}>;
|
|
615
|
+
type ResourceAction = z.infer<typeof ResourceActionSchema>;
|
|
616
|
+
/** One line of an apply: what was named, what happened to it, and — for a refusal — why. */
|
|
617
|
+
declare const ResourceReportSchema: z.ZodObject<{
|
|
618
|
+
name: z.ZodString;
|
|
619
|
+
action: z.ZodEnum<{
|
|
620
|
+
created: "created";
|
|
621
|
+
updated: "updated";
|
|
622
|
+
unchanged: "unchanged";
|
|
623
|
+
deleted: "deleted";
|
|
624
|
+
refused: "refused";
|
|
625
|
+
}>;
|
|
626
|
+
id: z.ZodOptional<z.ZodString>;
|
|
627
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
628
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
629
|
+
}, z.core.$strip>;
|
|
630
|
+
type ResourceReportLine = z.infer<typeof ResourceReportSchema>;
|
|
631
|
+
/**
|
|
632
|
+
* Which of the declared crew an apply takes (§31.2), by declared name. Omitting it from the apply
|
|
633
|
+
* body means everything; a selection missing a `required` agent or app is `validation_failed`.
|
|
634
|
+
*/
|
|
635
|
+
declare const BlueprintSelectionSchema: z.ZodObject<{
|
|
636
|
+
agents: z.ZodArray<z.ZodString>;
|
|
637
|
+
apps: z.ZodArray<z.ZodString>;
|
|
638
|
+
}, z.core.$strip>;
|
|
639
|
+
type BlueprintSelection = z.infer<typeof BlueprintSelectionSchema>;
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* The report vocabulary `up` speaks (`workstreams/10-blueprints.md §2` item 4) and the handful of
|
|
643
|
+
* client-side moves every resource kind shares: one line per attempt with refusals caught into
|
|
644
|
+
* the report, drift as "a declared field whose live value differs", 404 as "not yet", full
|
|
645
|
+
* cursor pagination, and the by-name tombstone behind `removed`.
|
|
646
|
+
*/
|
|
647
|
+
|
|
648
|
+
type ResourceReport = ResourceReportLine;
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* A coordinator's roster, declared by NAME (`canonical-spec §31.6`, §28).
|
|
652
|
+
*
|
|
653
|
+
* At runtime a roster entry is `{type:"agent", id:"agt_…", version?}`; in a declaration no agent has
|
|
654
|
+
* an id yet, so the entry carries the declared `name` where the id goes and is otherwise the
|
|
655
|
+
* runtime's own `RosterEntrySchema` — `self` and `advisor` unchanged. `up()` resolves the names in
|
|
656
|
+
* a second pass, once every agent of the declaration has been created or patched and so has an id.
|
|
657
|
+
*/
|
|
658
|
+
|
|
659
|
+
/** `MultiagentField` with the roster by name: `true | false | null | {type:"coordinator", agents, board?}`. */
|
|
660
|
+
declare const DeclMultiagentField: z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
661
|
+
agents: z.ZodArray<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
662
|
+
type: "agent";
|
|
663
|
+
name: string;
|
|
664
|
+
}, string>>, z.ZodObject<{
|
|
665
|
+
type: z.ZodLiteral<"agent">;
|
|
666
|
+
name: z.ZodString;
|
|
667
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
668
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
669
|
+
type: z.ZodLiteral<"self">;
|
|
670
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
671
|
+
type: z.ZodLiteral<"advisor">;
|
|
672
|
+
model: z.ZodString;
|
|
673
|
+
}, z.core.$strip>]>>;
|
|
674
|
+
type: z.ZodLiteral<"coordinator">;
|
|
675
|
+
board: z.ZodOptional<z.ZodBoolean>;
|
|
676
|
+
}, z.core.$strip>, z.ZodNull]>;
|
|
677
|
+
type DeclMultiagent = z.infer<typeof DeclMultiagentField>;
|
|
678
|
+
type DeclRoster = Extract<DeclMultiagent, {
|
|
679
|
+
type: "coordinator";
|
|
680
|
+
}>;
|
|
681
|
+
declare const hasRoster: (value: DeclMultiagent | undefined) => value is DeclRoster;
|
|
682
|
+
|
|
343
683
|
declare const CONFIG_CANDIDATES: readonly ["naive.config.ts", "naive.config.js", "naive.config.mjs", "naive.config.json"];
|
|
344
684
|
type ConfigLoad = {
|
|
345
685
|
ok: true;
|
|
@@ -392,20 +732,80 @@ declare function collectFiles(source: FileSource): Record<string, string>;
|
|
|
392
732
|
declare function contentHash(files: Record<string, string>): string;
|
|
393
733
|
|
|
394
734
|
/**
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
735
|
+
* core-gaps: U8-database — `apps[].migrations` in `naive up` (`canonical-spec §37`). Each entry is a
|
|
736
|
+
* path under the config's directory, with `*` allowed in the file name (`sql/*.sql`); files match
|
|
737
|
+
* in name order within one entry and entries in declaration order, so `0001_…`, `0002_…` is the
|
|
738
|
+
* whole ordering story. A file's migration name is its base name without the extension, and
|
|
739
|
+
* `POST /v1/apps/{id}/db/migrations` applies each once: a replay is a no-op, changed SQL under a
|
|
740
|
+
* kept name is `409 version_conflict`, which the report carries by name.
|
|
741
|
+
*
|
|
742
|
+
* A hosted apply has no checkout: the publisher read the files and shipped them on the app's built
|
|
743
|
+
* tree (`canonical-spec §31.1`), so they arrive as `opts.migrations` by app name.
|
|
399
744
|
*/
|
|
400
745
|
|
|
401
|
-
|
|
402
|
-
interface ResourceReport {
|
|
746
|
+
interface MigrationFile {
|
|
403
747
|
name: string;
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
748
|
+
sql: string;
|
|
749
|
+
}
|
|
750
|
+
/** The files each pattern names, in order, each read once; a pattern that names nothing refuses. */
|
|
751
|
+
declare function migrationFiles(patterns: readonly string[], dir: string): MigrationFile[];
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Apps in `naive up`: upsert by `GET /v1/apps?name=` (§29.2), `env` written as write-only secrets
|
|
755
|
+
* only when the live `value_hash` differs from the local one (ADR-0354, ADR-0357), and the
|
|
756
|
+
* `deploy_dir` shipped only when its content hash differs from the newest live deployment's
|
|
757
|
+
* (ADR-0357). Live secret names the config does not declare are reported, never deleted
|
|
758
|
+
* (ADR-0352). `mcp` is patched on drift, absent meaning `null` (§29.5); the platform mints the
|
|
759
|
+
* app's `VETTA_MCP_TOKEN` itself, so nothing here ever holds that token.
|
|
760
|
+
*
|
|
761
|
+
* A hosted apply also arrives with a PLATFORM ENVIRONMENT (`PlatformEnv`, §29.7) — the base URL, the
|
|
762
|
+
* identity the install runs as, and a scoped key it will mint for an app that asks. That layer is
|
|
763
|
+
* read before `{ from_env }`'s own environment, and a declaration may ask for a value nobody has
|
|
764
|
+
* with `{ generate: true }`. Both are provisioned ONCE per app, because a value the platform invents
|
|
765
|
+
* has no stable digest and rewriting it every apply would rotate a live credential.
|
|
766
|
+
*
|
|
767
|
+
* An app also records the project that made it (ADR-0375), and that stamp is compared before any
|
|
768
|
+
* write: a name this project does not own is refused rather than adopted, which is what standing
|
|
769
|
+
* up a second blueprint did to the first one's live deployment.
|
|
770
|
+
*/
|
|
771
|
+
|
|
772
|
+
/** The platform environment's variable names (`canonical-spec §29.7`) — fixed, never inferred. */
|
|
773
|
+
declare const PLATFORM_ENV: {
|
|
774
|
+
/** The base URL of the API this apply ran through. */
|
|
775
|
+
readonly api_url: "NAIVE_API_URL";
|
|
776
|
+
/** The identity the install runs as, when the declaration declares exactly one. */
|
|
777
|
+
readonly identity_id: "NAIVE_IDENTITY_ID";
|
|
778
|
+
/** The install's `project` — the row the app's own context lookup lands on (§31.8). */
|
|
779
|
+
readonly project: "NAIVE_PROJECT";
|
|
780
|
+
/** A scoped organization API key minted for the app that asks for it. */
|
|
781
|
+
readonly api_key: "NAIVE_API_KEY";
|
|
782
|
+
};
|
|
783
|
+
/**
|
|
784
|
+
* WHAT THE PLATFORM PROVIDES A HOSTED APPLY, AND THE ONE DISTINCTION THAT MATTERS
|
|
785
|
+
* (`canonical-spec §29.7`).
|
|
786
|
+
*
|
|
787
|
+
* Absent on a laptop apply, which reads the author's shell and nothing else — the hosted path gains
|
|
788
|
+
* a layer, the local path does not lose one.
|
|
789
|
+
*
|
|
790
|
+
* **What the platform KNOWS it always tells the app; what the platform must INVENT it invents only
|
|
791
|
+
* on request, and only once.** That is not a stylistic split. A known value has a stable digest, so
|
|
792
|
+
* the `value_hash` compare that makes `naive up` idempotent (§29.2) can say `unchanged` about it and
|
|
793
|
+
* re-asserting it every apply costs nothing. An invented one never matches its own previous digest,
|
|
794
|
+
* so re-inventing it every apply would rotate a live credential under a build that still holds the
|
|
795
|
+
* old one — and, for a minted key, leave one dead `api_key` row behind per apply.
|
|
796
|
+
*/
|
|
797
|
+
interface PlatformEnv {
|
|
798
|
+
/**
|
|
799
|
+
* Values the platform knows. Written to every app this apply deploys that declares an `env` —
|
|
800
|
+
* whether or not the declaration names them, which is the `VETTA_MCP_TOKEN` precedent (§29.2) —
|
|
801
|
+
* and read FIRST by a `{ from_env }` that does name them.
|
|
802
|
+
*/
|
|
803
|
+
known: Record<string, string>;
|
|
804
|
+
/**
|
|
805
|
+
* Values the platform must invent, by variable name, given the app that asked. Called at most
|
|
806
|
+
* once per app, and only when that app holds no secret of that name.
|
|
807
|
+
*/
|
|
808
|
+
minted?: Record<string, (app: string) => Promise<string>>;
|
|
409
809
|
}
|
|
410
810
|
|
|
411
811
|
/**
|
|
@@ -449,6 +849,12 @@ interface UpReport {
|
|
|
449
849
|
* used to abort the whole apply before any write; it is now a line here and nothing else.
|
|
450
850
|
*/
|
|
451
851
|
skipped: string[];
|
|
852
|
+
/**
|
|
853
|
+
* Declared agents and apps the operator's `select` left out (`canonical-spec §31.2`): not created,
|
|
854
|
+
* not armed, not briefed, and — when one already exists — left exactly as it is. A choice, kept
|
|
855
|
+
* apart from `skipped` (rows this client could not read) and from a `refused` line (an attempt).
|
|
856
|
+
*/
|
|
857
|
+
deselected: string[];
|
|
452
858
|
}
|
|
453
859
|
interface UpOptions {
|
|
454
860
|
/** Plan only: reads happen, writes do not, and the report says what apply would do. */
|
|
@@ -460,8 +866,108 @@ interface UpOptions {
|
|
|
460
866
|
* (ADR-0375). Off by default — adopting by default is what overwrote a live deployment.
|
|
461
867
|
*/
|
|
462
868
|
adopt?: boolean;
|
|
869
|
+
/**
|
|
870
|
+
* The built trees, by app name, for an apply that runs where there is no checkout: the platform
|
|
871
|
+
* applying a published artifact on an operator's behalf (`canonical-spec §31.1`). The bytes come
|
|
872
|
+
* out of the artifact's object-store entry, in the same file map `deploy_dir` would have been
|
|
873
|
+
* collected into — which is why `collectFiles` takes both and there is one digest (`files.ts`).
|
|
874
|
+
*
|
|
875
|
+
* Present ⇒ the disk is never read for an app, and an app whose tree is not in the map is refused
|
|
876
|
+
* by name rather than deployed empty. Absent ⇒ `dir` + `deploy_dir`, exactly as before.
|
|
877
|
+
*/
|
|
878
|
+
trees?: Record<string, Record<string, string>>;
|
|
879
|
+
/**
|
|
880
|
+
* Why a declared app is absent from `trees`, by app name — an object-store read that failed
|
|
881
|
+
* rather than an object that was never uploaded. Both come out of `builtTree` as one refusal;
|
|
882
|
+
* only the caller that did the reading can tell them apart, so only it can say (`apps.ts`).
|
|
883
|
+
*/
|
|
884
|
+
tree_errors?: Record<string, string>;
|
|
885
|
+
/**
|
|
886
|
+
* core-gaps: U8-database — each app's `migrations`, by app name, as the publisher shipped them on
|
|
887
|
+
* its built tree (`canonical-spec §31.1`); read only when `trees` is present. An app that declares
|
|
888
|
+
* migrations and is absent here is refused by name (`migrations.ts`).
|
|
889
|
+
*/
|
|
890
|
+
migrations?: Record<string, MigrationFile[]>;
|
|
891
|
+
/**
|
|
892
|
+
* A skill's bytes by slug, for a hosted apply of a published declaration that carries them
|
|
893
|
+
* inline (`canonical-spec §42.8`). A hosted skill absent from this map is still refused by name.
|
|
894
|
+
*/
|
|
895
|
+
skills?: Record<string, string>;
|
|
896
|
+
/**
|
|
897
|
+
* What an app's `{ from_env }` reads (`apps.ts`). The process's own environment by default —
|
|
898
|
+
* the author's shell, which is the whole point of `from_env` on a laptop. A hosted apply has no
|
|
899
|
+
* shell and passes the operator's **answers** instead (`canonical-spec §31.2`): the same
|
|
900
|
+
* declaration, resolved against the only environment that apply has.
|
|
901
|
+
*/
|
|
902
|
+
env?: Record<string, string | undefined>;
|
|
903
|
+
/**
|
|
904
|
+
* THE PLATFORM ENVIRONMENT (`canonical-spec §29.7`) — what the platform itself provides an app,
|
|
905
|
+
* read BEFORE `env` and written whether or not the declaration names it.
|
|
906
|
+
*
|
|
907
|
+
* Present only on a hosted apply, and that is the whole of the local/hosted difference: `naive up`
|
|
908
|
+
* from a checkout passes none, reads the author's shell, and behaves exactly as it always has.
|
|
909
|
+
*
|
|
910
|
+
* `NAIVE_IDENTITY_ID` is filled in here rather than by the caller, because the id does not exist
|
|
911
|
+
* until this run has created the identity — identities are upserted before apps for the same
|
|
912
|
+
* reason agents reference them by name.
|
|
913
|
+
*/
|
|
914
|
+
platform?: PlatformEnv;
|
|
915
|
+
/**
|
|
916
|
+
* Which of the declared crew to provision, by name (§31.2). Omitted means everything, which is what
|
|
917
|
+
* every apply before this option did. A name the declaration lacks, or a `required` one left out,
|
|
918
|
+
* is a `BlueprintRefusal` before anything is read — the one thrown escape `up` has, because it is
|
|
919
|
+
* the caller's input that is wrong and not a resource that could not be made.
|
|
920
|
+
*/
|
|
921
|
+
select?: BlueprintSelection;
|
|
922
|
+
/**
|
|
923
|
+
* The install this crew belongs to — what a template agent's `metadata.project` names (§31.8).
|
|
924
|
+
* Defaults to `config.name`, which is the install `naive up` files under. A hosted apply files
|
|
925
|
+
* under the customer's own `project` and passes it here, so the runtime's lookup of the latest
|
|
926
|
+
* applied install lands on the row that exists.
|
|
927
|
+
*/
|
|
928
|
+
project?: string;
|
|
929
|
+
/**
|
|
930
|
+
* What dials an app's own address before its crew is briefed (`awaitServing`). The platform's
|
|
931
|
+
* `fetch` by default; a test hands in a fake. It is NOT the client's `fetch`, which on a hosted
|
|
932
|
+
* apply loops back into the API and never leaves the isolate.
|
|
933
|
+
*/
|
|
934
|
+
probe?: typeof globalThis.fetch;
|
|
463
935
|
}
|
|
936
|
+
/** The crew this apply takes (`UpOptions.select`), and the names it leaves out. */
|
|
937
|
+
declare function selectCrew(config: Readonly<ProjectConfig>, select: BlueprintSelection | undefined): {
|
|
938
|
+
apps: readonly AppDecl[];
|
|
939
|
+
agents: readonly AgentDecl[];
|
|
940
|
+
deselected: string[];
|
|
941
|
+
};
|
|
464
942
|
/** Plan → apply → report. Every refusal is one line in the report, never a thrown escape. */
|
|
465
943
|
declare function up(config: Readonly<ProjectConfig>, client: VettaClient, opts?: UpOptions): Promise<UpReport>;
|
|
466
944
|
|
|
467
|
-
|
|
945
|
+
/**
|
|
946
|
+
* Agents in `naive up`: upsert by name with a drift-only PATCH, `allowed_apps` names resolved to
|
|
947
|
+
* app ids in the `apps` tool config (§29.3), the platform config passthrough (`system`, `skills`,
|
|
948
|
+
* `mcp_servers`) verbatim, and `identity` attached after the upsert, never revoked (ADR-0353).
|
|
949
|
+
*
|
|
950
|
+
* An agent's `schedules` are the one bounded exception to "nothing is deleted by omission"
|
|
951
|
+
* (ADR-0355): deployments have no name, so the declared list is owned as a **complete set** keyed
|
|
952
|
+
* by exact `cron`. Matched rows are patched where other fields drifted, missing crons are created,
|
|
953
|
+
* and the agent's rows whose cron is not declared are deleted. The prune reaches only deployments
|
|
954
|
+
* of agents this blueprint declares with `schedules`; an agent without the key keeps whatever it has.
|
|
955
|
+
*
|
|
956
|
+
* **The match is the cron STRING, not the schedule it denotes.** `"0 8 * * 1"` and `"0 08 * * 1"`
|
|
957
|
+
* fire at the same minute and are two different keys: re-spelling a declared cron is read as the
|
|
958
|
+
* declared one being absent and an undeclared one being live, so it is a DELETE plus a CREATE, not
|
|
959
|
+
* a PATCH. The new row is a new `dep_` id with a fresh `next_run_at`, and whatever the old row's
|
|
960
|
+
* `enabled: false` was holding back is gone. Nothing here parses cron — a client that normalised
|
|
961
|
+
* the string would have to agree with the server's parser forever to stay idempotent, and the day
|
|
962
|
+
* they disagreed every apply would churn every schedule. Edit a cron and expect a new deployment.
|
|
963
|
+
*/
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* What every template agent's `system` opens with (§31.8): the one paragraph that turns the setup
|
|
967
|
+
* answers into something the crew acts on. The `project_context` tool it names is offered only to
|
|
968
|
+
* an agent whose metadata names a project with an applied install — exactly the agents this is
|
|
969
|
+
* prepended for.
|
|
970
|
+
*/
|
|
971
|
+
declare const PROJECT_CONTEXT_PREAMBLE: string;
|
|
972
|
+
|
|
973
|
+
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 Template, type TemplateChoice, type TemplateKind, type UpOptions, type UpReport, type VaultDecl, chooseTemplate, collectFiles, contentHash, defineProject, hasRoster, loadConfig, migrationFiles, parseProject, selectCrew, up };
|