@usenaive-sdk/blueprints 0.3.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 +425 -50
- package/dist/index.js +2405 -668
- 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[];
|
|
@@ -83,6 +84,12 @@ declare const AppDeclSchema: z.ZodObject<{
|
|
|
83
84
|
}, z.core.$strip>, z.ZodObject<{
|
|
84
85
|
generate: z.ZodLiteral<true>;
|
|
85
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>>>;
|
|
86
93
|
}, z.core.$strip>;
|
|
87
94
|
/**
|
|
88
95
|
* A cron on the agent — a platform deployment (§12) minus what `up` fills in: `agent_id`, and the
|
|
@@ -113,6 +120,8 @@ declare const AgentDeclSchema: z.ZodObject<{
|
|
|
113
120
|
}>;
|
|
114
121
|
}, z.core.$strip>;
|
|
115
122
|
description: z.ZodOptional<z.ZodString>;
|
|
123
|
+
role: z.ZodOptional<z.ZodString>;
|
|
124
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
116
125
|
system: z.ZodOptional<z.ZodString>;
|
|
117
126
|
tools: z.ZodOptional<z.ZodObject<{
|
|
118
127
|
default_config: z.ZodObject<{
|
|
@@ -138,6 +147,31 @@ declare const AgentDeclSchema: z.ZodObject<{
|
|
|
138
147
|
url: z.ZodURL;
|
|
139
148
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
140
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>>;
|
|
141
175
|
allowed_apps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
142
176
|
identity: z.ZodOptional<z.ZodString>;
|
|
143
177
|
schedules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -198,6 +232,90 @@ declare const SkillDeclSchema: z.ZodObject<{
|
|
|
198
232
|
declare const IdentityDeclSchema: z.ZodObject<{
|
|
199
233
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
200
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>>>;
|
|
201
319
|
}, z.core.$strip>;
|
|
202
320
|
declare const ProjectSchema: z.ZodObject<{
|
|
203
321
|
name: z.ZodString;
|
|
@@ -225,6 +343,90 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
225
343
|
identities: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
226
344
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
227
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>>>;
|
|
228
430
|
}, z.core.$strip>>>;
|
|
229
431
|
vaults: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
230
432
|
name: z.ZodString;
|
|
@@ -257,6 +459,12 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
257
459
|
}, z.core.$strip>, z.ZodObject<{
|
|
258
460
|
generate: z.ZodLiteral<true>;
|
|
259
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>>>;
|
|
260
468
|
}, z.core.$strip>>>;
|
|
261
469
|
agents: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
262
470
|
name: z.ZodString;
|
|
@@ -271,6 +479,8 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
271
479
|
}>;
|
|
272
480
|
}, z.core.$strip>;
|
|
273
481
|
description: z.ZodOptional<z.ZodString>;
|
|
482
|
+
role: z.ZodOptional<z.ZodString>;
|
|
483
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
274
484
|
system: z.ZodOptional<z.ZodString>;
|
|
275
485
|
tools: z.ZodOptional<z.ZodObject<{
|
|
276
486
|
default_config: z.ZodObject<{
|
|
@@ -296,6 +506,31 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
296
506
|
url: z.ZodURL;
|
|
297
507
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
298
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>>;
|
|
299
534
|
allowed_apps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
300
535
|
identity: z.ZodOptional<z.ZodString>;
|
|
301
536
|
schedules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -311,6 +546,11 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
311
546
|
budget_micro_usd: z.ZodOptional<z.ZodNumber>;
|
|
312
547
|
}, z.core.$strip>>;
|
|
313
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>>>;
|
|
314
554
|
removed: z.ZodDefault<z.ZodObject<{
|
|
315
555
|
apps: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
316
556
|
agents: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -324,6 +564,7 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
324
564
|
}, z.core.$strip>;
|
|
325
565
|
type AppDecl = z.infer<typeof AppDeclSchema>;
|
|
326
566
|
type AgentDecl = z.infer<typeof AgentDeclSchema>;
|
|
567
|
+
type CrewPerClientDecl = NonNullable<ProjectConfig["crew_per_client"]>[number];
|
|
327
568
|
type ScheduleDecl = z.infer<typeof ScheduleDeclSchema>;
|
|
328
569
|
type SkillDecl = z.infer<typeof SkillDeclSchema>;
|
|
329
570
|
type IdentityDecl = z.infer<typeof IdentityDeclSchema>;
|
|
@@ -344,6 +585,101 @@ interface DefineInput extends z.input<typeof ProjectSchema> {
|
|
|
344
585
|
/** The one export a `naive.config.ts` calls. Identity plus validation; the object comes back frozen. */
|
|
345
586
|
declare function defineProject({ templates, ...input }: DefineInput): Readonly<ProjectConfig>;
|
|
346
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
|
+
|
|
347
683
|
declare const CONFIG_CANDIDATES: readonly ["naive.config.ts", "naive.config.js", "naive.config.mjs", "naive.config.json"];
|
|
348
684
|
type ConfigLoad = {
|
|
349
685
|
ok: true;
|
|
@@ -396,57 +732,23 @@ declare function collectFiles(source: FileSource): Record<string, string>;
|
|
|
396
732
|
declare function contentHash(files: Record<string, string>): string;
|
|
397
733
|
|
|
398
734
|
/**
|
|
399
|
-
*
|
|
400
|
-
*
|
|
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.
|
|
401
741
|
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
* organization, and neither can see the other. This row is what they share.
|
|
405
|
-
*
|
|
406
|
-
* It is not a second source of truth for what is provisioned — apps, agents, skills, identities and
|
|
407
|
-
* vaults stay keyed by name on their own routes. It records *that* an apply happened, with what, by
|
|
408
|
-
* whom, and against which revision.
|
|
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.
|
|
409
744
|
*/
|
|
410
745
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
*/
|
|
418
|
-
declare const ResourceActionSchema: z.ZodEnum<{
|
|
419
|
-
created: "created";
|
|
420
|
-
updated: "updated";
|
|
421
|
-
unchanged: "unchanged";
|
|
422
|
-
deleted: "deleted";
|
|
423
|
-
refused: "refused";
|
|
424
|
-
}>;
|
|
425
|
-
type ResourceAction = z.infer<typeof ResourceActionSchema>;
|
|
426
|
-
/** One line of an apply: what was named, what happened to it, and — for a refusal — why. */
|
|
427
|
-
declare const ResourceReportSchema: z.ZodObject<{
|
|
428
|
-
name: z.ZodString;
|
|
429
|
-
action: z.ZodEnum<{
|
|
430
|
-
created: "created";
|
|
431
|
-
updated: "updated";
|
|
432
|
-
unchanged: "unchanged";
|
|
433
|
-
deleted: "deleted";
|
|
434
|
-
refused: "refused";
|
|
435
|
-
}>;
|
|
436
|
-
id: z.ZodOptional<z.ZodString>;
|
|
437
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
438
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
439
|
-
}, z.core.$strip>;
|
|
440
|
-
type ResourceReportLine = z.infer<typeof ResourceReportSchema>;
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* The report vocabulary `up` speaks (`workstreams/10-blueprints.md §2` item 4) and the handful of
|
|
444
|
-
* client-side moves every resource kind shares: one line per attempt with refusals caught into
|
|
445
|
-
* the report, drift as "a declared field whose live value differs", 404 as "not yet", full
|
|
446
|
-
* cursor pagination, and the by-name tombstone behind `removed`.
|
|
447
|
-
*/
|
|
448
|
-
|
|
449
|
-
type ResourceReport = ResourceReportLine;
|
|
746
|
+
interface MigrationFile {
|
|
747
|
+
name: string;
|
|
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[];
|
|
450
752
|
|
|
451
753
|
/**
|
|
452
754
|
* Apps in `naive up`: upsert by `GET /v1/apps?name=` (§29.2), `env` written as write-only secrets
|
|
@@ -473,6 +775,8 @@ declare const PLATFORM_ENV: {
|
|
|
473
775
|
readonly api_url: "NAIVE_API_URL";
|
|
474
776
|
/** The identity the install runs as, when the declaration declares exactly one. */
|
|
475
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";
|
|
476
780
|
/** A scoped organization API key minted for the app that asks for it. */
|
|
477
781
|
readonly api_key: "NAIVE_API_KEY";
|
|
478
782
|
};
|
|
@@ -545,6 +849,12 @@ interface UpReport {
|
|
|
545
849
|
* used to abort the whole apply before any write; it is now a line here and nothing else.
|
|
546
850
|
*/
|
|
547
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[];
|
|
548
858
|
}
|
|
549
859
|
interface UpOptions {
|
|
550
860
|
/** Plan only: reads happen, writes do not, and the report says what apply would do. */
|
|
@@ -572,6 +882,17 @@ interface UpOptions {
|
|
|
572
882
|
* only the caller that did the reading can tell them apart, so only it can say (`apps.ts`).
|
|
573
883
|
*/
|
|
574
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>;
|
|
575
896
|
/**
|
|
576
897
|
* What an app's `{ from_env }` reads (`apps.ts`). The process's own environment by default —
|
|
577
898
|
* the author's shell, which is the whole point of `from_env` on a laptop. A hosted apply has no
|
|
@@ -591,8 +912,62 @@ interface UpOptions {
|
|
|
591
912
|
* reason agents reference them by name.
|
|
592
913
|
*/
|
|
593
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;
|
|
594
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
|
+
};
|
|
595
942
|
/** Plan → apply → report. Every refusal is one line in the report, never a thrown escape. */
|
|
596
943
|
declare function up(config: Readonly<ProjectConfig>, client: VettaClient, opts?: UpOptions): Promise<UpReport>;
|
|
597
944
|
|
|
598
|
-
|
|
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 };
|