@usenaive-sdk/blueprints 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -146,6 +146,10 @@ declare const AgentDeclSchema: z.ZodObject<{
146
146
  identity: z.ZodOptional<z.ZodString>;
147
147
  enabled: z.ZodOptional<z.ZodBoolean>;
148
148
  }, z.core.$strip>>>;
149
+ intake: z.ZodOptional<z.ZodObject<{
150
+ message: z.ZodString;
151
+ budget_micro_usd: z.ZodOptional<z.ZodNumber>;
152
+ }, z.core.$strip>>;
149
153
  }, z.core.$strip>;
150
154
  /**
151
155
  * A vault credential (§23) minus what `up` fills in. `value` is a real third-party secret, so it is
@@ -197,6 +201,21 @@ declare const ProjectSchema: z.ZodObject<{
197
201
  name: z.ZodString;
198
202
  blueprint: z.ZodOptional<z.ZodString>;
199
203
  template: z.ZodOptional<z.ZodString>;
204
+ questions: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
205
+ type: z.ZodLiteral<"text">;
206
+ placeholder: z.ZodOptional<z.ZodString>;
207
+ key: z.ZodString;
208
+ label: z.ZodString;
209
+ help: z.ZodOptional<z.ZodString>;
210
+ }, z.core.$strip>, z.ZodObject<{
211
+ type: z.ZodLiteral<"choice">;
212
+ options: z.ZodArray<z.ZodString>;
213
+ multiple: z.ZodDefault<z.ZodBoolean>;
214
+ other: z.ZodDefault<z.ZodBoolean>;
215
+ key: z.ZodString;
216
+ label: z.ZodString;
217
+ help: z.ZodOptional<z.ZodString>;
218
+ }, z.core.$strip>], "type">>>;
200
219
  skills: z.ZodDefault<z.ZodArray<z.ZodObject<{
201
220
  slug: z.ZodString;
202
221
  file: z.ZodString;
@@ -283,6 +302,10 @@ declare const ProjectSchema: z.ZodObject<{
283
302
  identity: z.ZodOptional<z.ZodString>;
284
303
  enabled: z.ZodOptional<z.ZodBoolean>;
285
304
  }, z.core.$strip>>>;
305
+ intake: z.ZodOptional<z.ZodObject<{
306
+ message: z.ZodString;
307
+ budget_micro_usd: z.ZodOptional<z.ZodNumber>;
308
+ }, z.core.$strip>>;
286
309
  }, z.core.$strip>>>;
287
310
  removed: z.ZodDefault<z.ZodObject<{
288
311
  apps: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -343,6 +366,31 @@ type ConfigLoad = {
343
366
  };
344
367
  declare function loadConfig(dir: string): Promise<ConfigLoad>;
345
368
 
369
+ /**
370
+ * A built tree, from either place one can be. A **directory** is the apply a person runs: a
371
+ * checkout on their laptop or in CI. A **file map** is the apply the platform runs on their
372
+ * behalf — the tree comes out of a published artifact's object-store entry (`canonical-spec §31.1`)
373
+ * and there is no checkout anywhere, because a hosted run never clones a blueprint.
374
+ */
375
+ type FileSource = string | Record<string, string>;
376
+ /**
377
+ * ONE FILTER, ONE DIGEST, BOTH SOURCES — which is the whole of why the map arm exists rather than
378
+ * the caller handing its map straight to `contentHash`.
379
+ *
380
+ * A published artifact's `content_hash` is compared against the newest deployment's to decide
381
+ * whether to upload at all (§31.1), and the two sides of that comparison are collected in different
382
+ * places: the deployment's from a directory here, the artifact's from a map on the server. If the
383
+ * map arm skipped one exclusion or one size cap, the digests would differ for two trees that ship
384
+ * the same bytes and every hosted install would re-upload, forever, with nothing to point at.
385
+ */
386
+ declare function collectFiles(source: FileSource): Record<string, string>;
387
+ /**
388
+ * sha-256 over the files in path order, each as `path NUL byte-length NUL bytes`: the same tree
389
+ * hashes the same from any walk order, and the length prefix keeps two trees from sharing an
390
+ * encoding. Hex, so it travels as a plain string.
391
+ */
392
+ declare function contentHash(files: Record<string, string>): string;
393
+
346
394
  /**
347
395
  * The report vocabulary `up` speaks (`workstreams/10-blueprints.md §2` item 4) and the handful of
348
396
  * client-side moves every resource kind shares: one line per attempt with refusals caught into
@@ -370,6 +418,11 @@ interface ResourceReport {
370
418
  * bounded exception — a declared agent's `schedules` are owned as a complete set (`agents.ts`).
371
419
  * Skills and identities live here; apps, agents and vaults each have their own module, sharing the
372
420
  * report vocabulary in `report.ts`.
421
+ *
422
+ * One thing here is not a reconcile: an agent this apply **created** that declares an `intake` is
423
+ * sent its briefing as a started session (`agents.ts`, `canonical-spec §31.4`). It is what turns a
424
+ * provisioned crew into a crew that has started working, and it is idempotent for the same reason
425
+ * everything else here is — the agent is created exactly once.
373
426
  */
374
427
 
375
428
  interface UpReport {
@@ -385,6 +438,12 @@ interface UpReport {
385
438
  agents: ResourceReport[];
386
439
  /** One line per declared cron and per pruned live row, named `<agent> @ <cron>`. */
387
440
  schedules: ResourceReport[];
441
+ /**
442
+ * One line per agent this apply **created** that declares an `intake` — the session that was
443
+ * started, named by the agent, `id` the `ses_`. Empty on every later apply of the same crew: an
444
+ * agent is created once, so it is briefed once (`agents.ts`).
445
+ */
446
+ intake: ResourceReport[];
388
447
  /**
389
448
  * Live rows this client could not parse, named and stepped over (`report.ts`). One legacy row
390
449
  * used to abort the whole apply before any write; it is now a line here and nothing else.
@@ -405,4 +464,4 @@ interface UpOptions {
405
464
  /** Plan → apply → report. Every refusal is one line in the report, never a thrown escape. */
406
465
  declare function up(config: Readonly<ProjectConfig>, client: VettaClient, opts?: UpOptions): Promise<UpReport>;
407
466
 
408
- export { type AgentDecl, type AppDecl, BLUEPRINTS, BlueprintRefusal, CONFIG_CANDIDATES, type ConfigLoad, type CredentialDecl, type DefineInput, type IdentityDecl, type ProjectConfig, type ResourceAction, type ResourceReport, type ScheduleDecl, type SkillDecl, type Template, type TemplateChoice, type TemplateKind, type UpOptions, type UpReport, type VaultDecl, chooseTemplate, defineProject, loadConfig, parseProject, up };
467
+ export { type AgentDecl, type AppDecl, BLUEPRINTS, BlueprintRefusal, CONFIG_CANDIDATES, type ConfigLoad, type CredentialDecl, type DefineInput, type FileSource, type IdentityDecl, 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, loadConfig, parseProject, up };