@usenaive-sdk/blueprints 0.3.0 → 0.5.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 +439 -50
- package/dist/index.js +2523 -676
- 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,8 +147,34 @@ 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>;
|
|
177
|
+
handoffs: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"team">, z.ZodArray<z.ZodString>]>>;
|
|
143
178
|
schedules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
144
179
|
cron: z.ZodString;
|
|
145
180
|
timezone: z.ZodOptional<z.ZodString>;
|
|
@@ -198,6 +233,90 @@ declare const SkillDeclSchema: z.ZodObject<{
|
|
|
198
233
|
declare const IdentityDeclSchema: z.ZodObject<{
|
|
199
234
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
200
235
|
name: z.ZodString;
|
|
236
|
+
legal: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
237
|
+
description: z.ZodString;
|
|
238
|
+
state: z.ZodEnum<{
|
|
239
|
+
AL: "AL";
|
|
240
|
+
AK: "AK";
|
|
241
|
+
AZ: "AZ";
|
|
242
|
+
AR: "AR";
|
|
243
|
+
CA: "CA";
|
|
244
|
+
CO: "CO";
|
|
245
|
+
CT: "CT";
|
|
246
|
+
DE: "DE";
|
|
247
|
+
DC: "DC";
|
|
248
|
+
FL: "FL";
|
|
249
|
+
GA: "GA";
|
|
250
|
+
HI: "HI";
|
|
251
|
+
ID: "ID";
|
|
252
|
+
IL: "IL";
|
|
253
|
+
IN: "IN";
|
|
254
|
+
IA: "IA";
|
|
255
|
+
KS: "KS";
|
|
256
|
+
KY: "KY";
|
|
257
|
+
LA: "LA";
|
|
258
|
+
ME: "ME";
|
|
259
|
+
MD: "MD";
|
|
260
|
+
MA: "MA";
|
|
261
|
+
MI: "MI";
|
|
262
|
+
MN: "MN";
|
|
263
|
+
MS: "MS";
|
|
264
|
+
MO: "MO";
|
|
265
|
+
MT: "MT";
|
|
266
|
+
NE: "NE";
|
|
267
|
+
NV: "NV";
|
|
268
|
+
NH: "NH";
|
|
269
|
+
NJ: "NJ";
|
|
270
|
+
NM: "NM";
|
|
271
|
+
NY: "NY";
|
|
272
|
+
NC: "NC";
|
|
273
|
+
ND: "ND";
|
|
274
|
+
OH: "OH";
|
|
275
|
+
OK: "OK";
|
|
276
|
+
OR: "OR";
|
|
277
|
+
PA: "PA";
|
|
278
|
+
RI: "RI";
|
|
279
|
+
SC: "SC";
|
|
280
|
+
SD: "SD";
|
|
281
|
+
TN: "TN";
|
|
282
|
+
TX: "TX";
|
|
283
|
+
UT: "UT";
|
|
284
|
+
VT: "VT";
|
|
285
|
+
VA: "VA";
|
|
286
|
+
WA: "WA";
|
|
287
|
+
WV: "WV";
|
|
288
|
+
WI: "WI";
|
|
289
|
+
WY: "WY";
|
|
290
|
+
}>;
|
|
291
|
+
name_options: z.ZodArray<z.ZodString>;
|
|
292
|
+
naics_code: z.ZodString;
|
|
293
|
+
label: z.ZodString;
|
|
294
|
+
}, z.core.$strip>>>;
|
|
295
|
+
wallet: z.ZodOptional<z.ZodUnion<[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>, z.ZodArray<z.ZodObject<{
|
|
306
|
+
network: z.ZodOptional<z.ZodEnum<{
|
|
307
|
+
"eip155:84532": "eip155:84532";
|
|
308
|
+
"eip155:8453": "eip155:8453";
|
|
309
|
+
}>>;
|
|
310
|
+
policy: z.ZodOptional<z.ZodObject<{
|
|
311
|
+
per_tx_cap_micro_usd: z.ZodOptional<z.ZodNumber>;
|
|
312
|
+
daily_cap_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
313
|
+
low_balance_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
314
|
+
}, z.core.$strip>>;
|
|
315
|
+
}, z.core.$strip>>]>>;
|
|
316
|
+
cards: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
317
|
+
label: z.ZodString;
|
|
318
|
+
load_micro_usd: z.ZodNumber;
|
|
319
|
+
}, z.core.$strip>>>;
|
|
201
320
|
}, z.core.$strip>;
|
|
202
321
|
declare const ProjectSchema: z.ZodObject<{
|
|
203
322
|
name: z.ZodString;
|
|
@@ -225,6 +344,90 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
225
344
|
identities: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
226
345
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
227
346
|
name: z.ZodString;
|
|
347
|
+
legal: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
348
|
+
description: z.ZodString;
|
|
349
|
+
state: z.ZodEnum<{
|
|
350
|
+
AL: "AL";
|
|
351
|
+
AK: "AK";
|
|
352
|
+
AZ: "AZ";
|
|
353
|
+
AR: "AR";
|
|
354
|
+
CA: "CA";
|
|
355
|
+
CO: "CO";
|
|
356
|
+
CT: "CT";
|
|
357
|
+
DE: "DE";
|
|
358
|
+
DC: "DC";
|
|
359
|
+
FL: "FL";
|
|
360
|
+
GA: "GA";
|
|
361
|
+
HI: "HI";
|
|
362
|
+
ID: "ID";
|
|
363
|
+
IL: "IL";
|
|
364
|
+
IN: "IN";
|
|
365
|
+
IA: "IA";
|
|
366
|
+
KS: "KS";
|
|
367
|
+
KY: "KY";
|
|
368
|
+
LA: "LA";
|
|
369
|
+
ME: "ME";
|
|
370
|
+
MD: "MD";
|
|
371
|
+
MA: "MA";
|
|
372
|
+
MI: "MI";
|
|
373
|
+
MN: "MN";
|
|
374
|
+
MS: "MS";
|
|
375
|
+
MO: "MO";
|
|
376
|
+
MT: "MT";
|
|
377
|
+
NE: "NE";
|
|
378
|
+
NV: "NV";
|
|
379
|
+
NH: "NH";
|
|
380
|
+
NJ: "NJ";
|
|
381
|
+
NM: "NM";
|
|
382
|
+
NY: "NY";
|
|
383
|
+
NC: "NC";
|
|
384
|
+
ND: "ND";
|
|
385
|
+
OH: "OH";
|
|
386
|
+
OK: "OK";
|
|
387
|
+
OR: "OR";
|
|
388
|
+
PA: "PA";
|
|
389
|
+
RI: "RI";
|
|
390
|
+
SC: "SC";
|
|
391
|
+
SD: "SD";
|
|
392
|
+
TN: "TN";
|
|
393
|
+
TX: "TX";
|
|
394
|
+
UT: "UT";
|
|
395
|
+
VT: "VT";
|
|
396
|
+
VA: "VA";
|
|
397
|
+
WA: "WA";
|
|
398
|
+
WV: "WV";
|
|
399
|
+
WI: "WI";
|
|
400
|
+
WY: "WY";
|
|
401
|
+
}>;
|
|
402
|
+
name_options: z.ZodArray<z.ZodString>;
|
|
403
|
+
naics_code: z.ZodString;
|
|
404
|
+
label: z.ZodString;
|
|
405
|
+
}, z.core.$strip>>>;
|
|
406
|
+
wallet: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
407
|
+
network: z.ZodOptional<z.ZodEnum<{
|
|
408
|
+
"eip155:84532": "eip155:84532";
|
|
409
|
+
"eip155:8453": "eip155:8453";
|
|
410
|
+
}>>;
|
|
411
|
+
policy: z.ZodOptional<z.ZodObject<{
|
|
412
|
+
per_tx_cap_micro_usd: z.ZodOptional<z.ZodNumber>;
|
|
413
|
+
daily_cap_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
414
|
+
low_balance_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
415
|
+
}, z.core.$strip>>;
|
|
416
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
417
|
+
network: z.ZodOptional<z.ZodEnum<{
|
|
418
|
+
"eip155:84532": "eip155:84532";
|
|
419
|
+
"eip155:8453": "eip155:8453";
|
|
420
|
+
}>>;
|
|
421
|
+
policy: z.ZodOptional<z.ZodObject<{
|
|
422
|
+
per_tx_cap_micro_usd: z.ZodOptional<z.ZodNumber>;
|
|
423
|
+
daily_cap_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
424
|
+
low_balance_micro_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
425
|
+
}, z.core.$strip>>;
|
|
426
|
+
}, z.core.$strip>>]>>;
|
|
427
|
+
cards: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
428
|
+
label: z.ZodString;
|
|
429
|
+
load_micro_usd: z.ZodNumber;
|
|
430
|
+
}, z.core.$strip>>>;
|
|
228
431
|
}, z.core.$strip>>>;
|
|
229
432
|
vaults: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
230
433
|
name: z.ZodString;
|
|
@@ -257,6 +460,12 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
257
460
|
}, z.core.$strip>, z.ZodObject<{
|
|
258
461
|
generate: z.ZodLiteral<true>;
|
|
259
462
|
}, z.core.$strip>]>>>;
|
|
463
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
464
|
+
migrations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
465
|
+
buckets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
466
|
+
name: z.ZodString;
|
|
467
|
+
public: z.ZodDefault<z.ZodBoolean>;
|
|
468
|
+
}, z.core.$strip>>>;
|
|
260
469
|
}, z.core.$strip>>>;
|
|
261
470
|
agents: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
262
471
|
name: z.ZodString;
|
|
@@ -271,6 +480,8 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
271
480
|
}>;
|
|
272
481
|
}, z.core.$strip>;
|
|
273
482
|
description: z.ZodOptional<z.ZodString>;
|
|
483
|
+
role: z.ZodOptional<z.ZodString>;
|
|
484
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
274
485
|
system: z.ZodOptional<z.ZodString>;
|
|
275
486
|
tools: z.ZodOptional<z.ZodObject<{
|
|
276
487
|
default_config: z.ZodObject<{
|
|
@@ -296,8 +507,34 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
296
507
|
url: z.ZodURL;
|
|
297
508
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
298
509
|
}, z.core.$strip>>>;
|
|
510
|
+
window: z.ZodOptional<z.ZodEnum<{
|
|
511
|
+
immediate: "immediate";
|
|
512
|
+
priority: "priority";
|
|
513
|
+
loose: "loose";
|
|
514
|
+
}>>;
|
|
515
|
+
multiagent: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
516
|
+
agents: z.ZodArray<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
517
|
+
type: "agent";
|
|
518
|
+
name: string;
|
|
519
|
+
}, string>>, z.ZodObject<{
|
|
520
|
+
type: z.ZodLiteral<"agent">;
|
|
521
|
+
name: z.ZodString;
|
|
522
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
523
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
524
|
+
type: z.ZodLiteral<"self">;
|
|
525
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
526
|
+
type: z.ZodLiteral<"advisor">;
|
|
527
|
+
model: z.ZodString;
|
|
528
|
+
}, z.core.$strip>]>>;
|
|
529
|
+
type: z.ZodLiteral<"coordinator">;
|
|
530
|
+
board: z.ZodOptional<z.ZodBoolean>;
|
|
531
|
+
}, z.core.$strip>, z.ZodNull]>>;
|
|
532
|
+
output_schema: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
533
|
+
structured_output_required: z.ZodOptional<z.ZodBoolean>;
|
|
534
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
299
535
|
allowed_apps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
300
536
|
identity: z.ZodOptional<z.ZodString>;
|
|
537
|
+
handoffs: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"team">, z.ZodArray<z.ZodString>]>>;
|
|
301
538
|
schedules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
302
539
|
cron: z.ZodString;
|
|
303
540
|
timezone: z.ZodOptional<z.ZodString>;
|
|
@@ -311,6 +548,11 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
311
548
|
budget_micro_usd: z.ZodOptional<z.ZodNumber>;
|
|
312
549
|
}, z.core.$strip>>;
|
|
313
550
|
}, z.core.$strip>>>;
|
|
551
|
+
crew_per_client: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
552
|
+
name: z.ZodString;
|
|
553
|
+
role: z.ZodOptional<z.ZodString>;
|
|
554
|
+
description: z.ZodOptional<z.ZodString>;
|
|
555
|
+
}, z.core.$strip>>>;
|
|
314
556
|
removed: z.ZodDefault<z.ZodObject<{
|
|
315
557
|
apps: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
316
558
|
agents: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -324,6 +566,7 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
324
566
|
}, z.core.$strip>;
|
|
325
567
|
type AppDecl = z.infer<typeof AppDeclSchema>;
|
|
326
568
|
type AgentDecl = z.infer<typeof AgentDeclSchema>;
|
|
569
|
+
type CrewPerClientDecl = NonNullable<ProjectConfig["crew_per_client"]>[number];
|
|
327
570
|
type ScheduleDecl = z.infer<typeof ScheduleDeclSchema>;
|
|
328
571
|
type SkillDecl = z.infer<typeof SkillDeclSchema>;
|
|
329
572
|
type IdentityDecl = z.infer<typeof IdentityDeclSchema>;
|
|
@@ -344,6 +587,101 @@ interface DefineInput extends z.input<typeof ProjectSchema> {
|
|
|
344
587
|
/** The one export a `naive.config.ts` calls. Identity plus validation; the object comes back frozen. */
|
|
345
588
|
declare function defineProject({ templates, ...input }: DefineInput): Readonly<ProjectConfig>;
|
|
346
589
|
|
|
590
|
+
/**
|
|
591
|
+
* The blueprint install (`canonical-spec §29.6`) — one applied declaration per
|
|
592
|
+
* (organization, project), and the drift a `revision_conflict` names.
|
|
593
|
+
*
|
|
594
|
+
* `naive up` needed no server-side state while the only writer was a person with a clone: its
|
|
595
|
+
* working tree was the manifest. The studio applying the same declaration makes two writers on one
|
|
596
|
+
* organization, and neither can see the other. This row is what they share.
|
|
597
|
+
*
|
|
598
|
+
* It is not a second source of truth for what is provisioned — apps, agents, skills, identities and
|
|
599
|
+
* vaults stay keyed by name on their own routes. It records *that* an apply happened, with what, by
|
|
600
|
+
* whom, and against which revision.
|
|
601
|
+
*/
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* What one apply did to one resource. This is the vocabulary `naive up` has printed since it
|
|
605
|
+
* existed; it is written HERE, and imported by `@usenaive-sdk/blueprints`, for the reason
|
|
606
|
+
* `CLAUDE.md §2` gives: the hosted apply publishes the engine's report on the install (below), so
|
|
607
|
+
* it is a wire shape, and a wire shape has exactly one definition. The engine re-exports these two
|
|
608
|
+
* names unchanged, so nothing downstream of it learns a second word for the same thing.
|
|
609
|
+
*/
|
|
610
|
+
declare const ResourceActionSchema: z.ZodEnum<{
|
|
611
|
+
created: "created";
|
|
612
|
+
updated: "updated";
|
|
613
|
+
unchanged: "unchanged";
|
|
614
|
+
deleted: "deleted";
|
|
615
|
+
refused: "refused";
|
|
616
|
+
}>;
|
|
617
|
+
type ResourceAction = z.infer<typeof ResourceActionSchema>;
|
|
618
|
+
/** One line of an apply: what was named, what happened to it, and — for a refusal — why. */
|
|
619
|
+
declare const ResourceReportSchema: z.ZodObject<{
|
|
620
|
+
name: z.ZodString;
|
|
621
|
+
action: z.ZodEnum<{
|
|
622
|
+
created: "created";
|
|
623
|
+
updated: "updated";
|
|
624
|
+
unchanged: "unchanged";
|
|
625
|
+
deleted: "deleted";
|
|
626
|
+
refused: "refused";
|
|
627
|
+
}>;
|
|
628
|
+
id: z.ZodOptional<z.ZodString>;
|
|
629
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
630
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
631
|
+
}, z.core.$strip>;
|
|
632
|
+
type ResourceReportLine = z.infer<typeof ResourceReportSchema>;
|
|
633
|
+
/**
|
|
634
|
+
* Which of the declared crew an apply takes (§31.2), by declared name. Omitting it from the apply
|
|
635
|
+
* body means everything; a selection missing a `required` agent or app is `validation_failed`.
|
|
636
|
+
*/
|
|
637
|
+
declare const BlueprintSelectionSchema: z.ZodObject<{
|
|
638
|
+
agents: z.ZodArray<z.ZodString>;
|
|
639
|
+
apps: z.ZodArray<z.ZodString>;
|
|
640
|
+
}, z.core.$strip>;
|
|
641
|
+
type BlueprintSelection = z.infer<typeof BlueprintSelectionSchema>;
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* The report vocabulary `up` speaks (`workstreams/10-blueprints.md §2` item 4) and the handful of
|
|
645
|
+
* client-side moves every resource kind shares: one line per attempt with refusals caught into
|
|
646
|
+
* the report, drift as "a declared field whose live value differs", 404 as "not yet", full
|
|
647
|
+
* cursor pagination, and the by-name tombstone behind `removed`.
|
|
648
|
+
*/
|
|
649
|
+
|
|
650
|
+
type ResourceReport = ResourceReportLine;
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* A coordinator's roster, declared by NAME (`canonical-spec §31.6`, §28).
|
|
654
|
+
*
|
|
655
|
+
* At runtime a roster entry is `{type:"agent", id:"agt_…", version?}`; in a declaration no agent has
|
|
656
|
+
* an id yet, so the entry carries the declared `name` where the id goes and is otherwise the
|
|
657
|
+
* runtime's own `RosterEntrySchema` — `self` and `advisor` unchanged. `up()` resolves the names in
|
|
658
|
+
* a second pass, once every agent of the declaration has been created or patched and so has an id.
|
|
659
|
+
*/
|
|
660
|
+
|
|
661
|
+
/** `MultiagentField` with the roster by name: `true | false | null | {type:"coordinator", agents, board?}`. */
|
|
662
|
+
declare const DeclMultiagentField: z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
663
|
+
agents: z.ZodArray<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
664
|
+
type: "agent";
|
|
665
|
+
name: string;
|
|
666
|
+
}, string>>, z.ZodObject<{
|
|
667
|
+
type: z.ZodLiteral<"agent">;
|
|
668
|
+
name: z.ZodString;
|
|
669
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
670
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
671
|
+
type: z.ZodLiteral<"self">;
|
|
672
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
673
|
+
type: z.ZodLiteral<"advisor">;
|
|
674
|
+
model: z.ZodString;
|
|
675
|
+
}, z.core.$strip>]>>;
|
|
676
|
+
type: z.ZodLiteral<"coordinator">;
|
|
677
|
+
board: z.ZodOptional<z.ZodBoolean>;
|
|
678
|
+
}, z.core.$strip>, z.ZodNull]>;
|
|
679
|
+
type DeclMultiagent = z.infer<typeof DeclMultiagentField>;
|
|
680
|
+
type DeclRoster = Extract<DeclMultiagent, {
|
|
681
|
+
type: "coordinator";
|
|
682
|
+
}>;
|
|
683
|
+
declare const hasRoster: (value: DeclMultiagent | undefined) => value is DeclRoster;
|
|
684
|
+
|
|
347
685
|
declare const CONFIG_CANDIDATES: readonly ["naive.config.ts", "naive.config.js", "naive.config.mjs", "naive.config.json"];
|
|
348
686
|
type ConfigLoad = {
|
|
349
687
|
ok: true;
|
|
@@ -396,57 +734,23 @@ declare function collectFiles(source: FileSource): Record<string, string>;
|
|
|
396
734
|
declare function contentHash(files: Record<string, string>): string;
|
|
397
735
|
|
|
398
736
|
/**
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
737
|
+
* core-gaps: U8-database — `apps[].migrations` in `naive up` (`canonical-spec §37`). Each entry is a
|
|
738
|
+
* path under the config's directory, with `*` allowed in the file name (`sql/*.sql`); files match
|
|
739
|
+
* in name order within one entry and entries in declaration order, so `0001_…`, `0002_…` is the
|
|
740
|
+
* whole ordering story. A file's migration name is its base name without the extension, and
|
|
741
|
+
* `POST /v1/apps/{id}/db/migrations` applies each once: a replay is a no-op, changed SQL under a
|
|
742
|
+
* kept name is `409 version_conflict`, which the report carries by name.
|
|
405
743
|
*
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
* whom, and against which revision.
|
|
409
|
-
*/
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* What one apply did to one resource. This is the vocabulary `naive up` has printed since it
|
|
413
|
-
* existed; it is written HERE, and imported by `@usenaive-sdk/blueprints`, for the reason
|
|
414
|
-
* `CLAUDE.md §2` gives: the hosted apply publishes the engine's report on the install (below), so
|
|
415
|
-
* it is a wire shape, and a wire shape has exactly one definition. The engine re-exports these two
|
|
416
|
-
* names unchanged, so nothing downstream of it learns a second word for the same thing.
|
|
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`.
|
|
744
|
+
* A hosted apply has no checkout: the publisher read the files and shipped them on the app's built
|
|
745
|
+
* tree (`canonical-spec §31.1`), so they arrive as `opts.migrations` by app name.
|
|
447
746
|
*/
|
|
448
747
|
|
|
449
|
-
|
|
748
|
+
interface MigrationFile {
|
|
749
|
+
name: string;
|
|
750
|
+
sql: string;
|
|
751
|
+
}
|
|
752
|
+
/** The files each pattern names, in order, each read once; a pattern that names nothing refuses. */
|
|
753
|
+
declare function migrationFiles(patterns: readonly string[], dir: string): MigrationFile[];
|
|
450
754
|
|
|
451
755
|
/**
|
|
452
756
|
* Apps in `naive up`: upsert by `GET /v1/apps?name=` (§29.2), `env` written as write-only secrets
|
|
@@ -473,6 +777,12 @@ declare const PLATFORM_ENV: {
|
|
|
473
777
|
readonly api_url: "NAIVE_API_URL";
|
|
474
778
|
/** The identity the install runs as, when the declaration declares exactly one. */
|
|
475
779
|
readonly identity_id: "NAIVE_IDENTITY_ID";
|
|
780
|
+
/** The install's `project` — the row the app's own context lookup lands on (§31.8). */
|
|
781
|
+
readonly project: "NAIVE_PROJECT";
|
|
782
|
+
/** The base URL of the Studio that installed the app, so it can send a signed-out visitor back. */
|
|
783
|
+
readonly studio_url: "NAIVE_STUDIO_URL";
|
|
784
|
+
/** The app's own `app_…` id — the one known value learnt from the row, not from the apply. */
|
|
785
|
+
readonly app_id: "NAIVE_APP_ID";
|
|
476
786
|
/** A scoped organization API key minted for the app that asks for it. */
|
|
477
787
|
readonly api_key: "NAIVE_API_KEY";
|
|
478
788
|
};
|
|
@@ -503,6 +813,14 @@ interface PlatformEnv {
|
|
|
503
813
|
*/
|
|
504
814
|
minted?: Record<string, (app: string) => Promise<string>>;
|
|
505
815
|
}
|
|
816
|
+
/** A value nobody has: 256 bits, URL-safe, no alphabet an app secret or a header would mangle. */
|
|
817
|
+
declare const generatedSecret: () => string;
|
|
818
|
+
/**
|
|
819
|
+
* `kq7m-x2rt-8bvn-pz4h`: four groups of four from a 31-letter alphabet, 16·log2(31) ≈ 79 bits. Each
|
|
820
|
+
* character is drawn by rejection sampling so the alphabet is used evenly — a modulo over 256 would
|
|
821
|
+
* not be.
|
|
822
|
+
*/
|
|
823
|
+
declare function generatedPassword(): string;
|
|
506
824
|
|
|
507
825
|
/**
|
|
508
826
|
* The reconciler behind `naive up` (`workstreams/10-blueprints.md §2`): a pure client of the
|
|
@@ -545,6 +863,12 @@ interface UpReport {
|
|
|
545
863
|
* used to abort the whole apply before any write; it is now a line here and nothing else.
|
|
546
864
|
*/
|
|
547
865
|
skipped: string[];
|
|
866
|
+
/**
|
|
867
|
+
* Declared agents and apps the operator's `select` left out (`canonical-spec §31.2`): not created,
|
|
868
|
+
* not armed, not briefed, and — when one already exists — left exactly as it is. A choice, kept
|
|
869
|
+
* apart from `skipped` (rows this client could not read) and from a `refused` line (an attempt).
|
|
870
|
+
*/
|
|
871
|
+
deselected: string[];
|
|
548
872
|
}
|
|
549
873
|
interface UpOptions {
|
|
550
874
|
/** Plan only: reads happen, writes do not, and the report says what apply would do. */
|
|
@@ -572,6 +896,17 @@ interface UpOptions {
|
|
|
572
896
|
* only the caller that did the reading can tell them apart, so only it can say (`apps.ts`).
|
|
573
897
|
*/
|
|
574
898
|
tree_errors?: Record<string, string>;
|
|
899
|
+
/**
|
|
900
|
+
* core-gaps: U8-database — each app's `migrations`, by app name, as the publisher shipped them on
|
|
901
|
+
* its built tree (`canonical-spec §31.1`); read only when `trees` is present. An app that declares
|
|
902
|
+
* migrations and is absent here is refused by name (`migrations.ts`).
|
|
903
|
+
*/
|
|
904
|
+
migrations?: Record<string, MigrationFile[]>;
|
|
905
|
+
/**
|
|
906
|
+
* A skill's bytes by slug, for a hosted apply of a published declaration that carries them
|
|
907
|
+
* inline (`canonical-spec §42.8`). A hosted skill absent from this map is still refused by name.
|
|
908
|
+
*/
|
|
909
|
+
skills?: Record<string, string>;
|
|
575
910
|
/**
|
|
576
911
|
* What an app's `{ from_env }` reads (`apps.ts`). The process's own environment by default —
|
|
577
912
|
* the author's shell, which is the whole point of `from_env` on a laptop. A hosted apply has no
|
|
@@ -591,8 +926,62 @@ interface UpOptions {
|
|
|
591
926
|
* reason agents reference them by name.
|
|
592
927
|
*/
|
|
593
928
|
platform?: PlatformEnv;
|
|
929
|
+
/**
|
|
930
|
+
* Which of the declared crew to provision, by name (§31.2). Omitted means everything, which is what
|
|
931
|
+
* every apply before this option did. A name the declaration lacks, or a `required` one left out,
|
|
932
|
+
* is a `BlueprintRefusal` before anything is read — the one thrown escape `up` has, because it is
|
|
933
|
+
* the caller's input that is wrong and not a resource that could not be made.
|
|
934
|
+
*/
|
|
935
|
+
select?: BlueprintSelection;
|
|
936
|
+
/**
|
|
937
|
+
* The install this crew belongs to — what a template agent's `metadata.project` names (§31.8).
|
|
938
|
+
* Defaults to `config.name`, which is the install `naive up` files under. A hosted apply files
|
|
939
|
+
* under the customer's own `project` and passes it here, so the runtime's lookup of the latest
|
|
940
|
+
* applied install lands on the row that exists.
|
|
941
|
+
*/
|
|
942
|
+
project?: string;
|
|
943
|
+
/**
|
|
944
|
+
* What dials an app's own address before its crew is briefed (`awaitServing`). The platform's
|
|
945
|
+
* `fetch` by default; a test hands in a fake. It is NOT the client's `fetch`, which on a hosted
|
|
946
|
+
* apply loops back into the API and never leaves the isolate.
|
|
947
|
+
*/
|
|
948
|
+
probe?: typeof globalThis.fetch;
|
|
594
949
|
}
|
|
950
|
+
/** The crew this apply takes (`UpOptions.select`), and the names it leaves out. */
|
|
951
|
+
declare function selectCrew(config: Readonly<ProjectConfig>, select: BlueprintSelection | undefined): {
|
|
952
|
+
apps: readonly AppDecl[];
|
|
953
|
+
agents: readonly AgentDecl[];
|
|
954
|
+
deselected: string[];
|
|
955
|
+
};
|
|
595
956
|
/** Plan → apply → report. Every refusal is one line in the report, never a thrown escape. */
|
|
596
957
|
declare function up(config: Readonly<ProjectConfig>, client: VettaClient, opts?: UpOptions): Promise<UpReport>;
|
|
597
958
|
|
|
598
|
-
|
|
959
|
+
/**
|
|
960
|
+
* Agents in `naive up`: upsert by name with a drift-only PATCH, `allowed_apps` names resolved to
|
|
961
|
+
* app ids in the `apps` tool config (§29.3), the platform config passthrough (`system`, `skills`,
|
|
962
|
+
* `mcp_servers`) verbatim, and `identity` attached after the upsert, never revoked (ADR-0353).
|
|
963
|
+
*
|
|
964
|
+
* An agent's `schedules` are the one bounded exception to "nothing is deleted by omission"
|
|
965
|
+
* (ADR-0355): deployments have no name, so the declared list is owned as a **complete set** keyed
|
|
966
|
+
* by exact `cron`. Matched rows are patched where other fields drifted, missing crons are created,
|
|
967
|
+
* and the agent's rows whose cron is not declared are deleted. The prune reaches only deployments
|
|
968
|
+
* of agents this blueprint declares with `schedules`; an agent without the key keeps whatever it has.
|
|
969
|
+
*
|
|
970
|
+
* **The match is the cron STRING, not the schedule it denotes.** `"0 8 * * 1"` and `"0 08 * * 1"`
|
|
971
|
+
* fire at the same minute and are two different keys: re-spelling a declared cron is read as the
|
|
972
|
+
* declared one being absent and an undeclared one being live, so it is a DELETE plus a CREATE, not
|
|
973
|
+
* a PATCH. The new row is a new `dep_` id with a fresh `next_run_at`, and whatever the old row's
|
|
974
|
+
* `enabled: false` was holding back is gone. Nothing here parses cron — a client that normalised
|
|
975
|
+
* the string would have to agree with the server's parser forever to stay idempotent, and the day
|
|
976
|
+
* they disagreed every apply would churn every schedule. Edit a cron and expect a new deployment.
|
|
977
|
+
*/
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* What every template agent's `system` opens with (§31.8): the one paragraph that turns the setup
|
|
981
|
+
* answers into something the crew acts on. The `project_context` tool it names is offered only to
|
|
982
|
+
* an agent whose metadata names a project with an applied install — exactly the agents this is
|
|
983
|
+
* prepended for.
|
|
984
|
+
*/
|
|
985
|
+
declare const PROJECT_CONTEXT_PREAMBLE: string;
|
|
986
|
+
|
|
987
|
+
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, generatedPassword, generatedSecret, hasRoster, loadConfig, migrationFiles, parseProject, selectCrew, up };
|