@eir-labs/coltrane 0.14.8 → 0.15.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.
@@ -231,10 +231,337 @@ export declare const SkillSchema: z.ZodObject<{
231
231
  fixtures?: unknown[] | undefined;
232
232
  md?: string | undefined;
233
233
  }>;
234
- export declare const AgentSchema: z.ZodObject<{
234
+ export declare const AgentObjectSchema: z.ZodObject<{
235
235
  slug: z.ZodString;
236
236
  primitives: z.ZodReadonly<z.ZodArray<z.ZodEnum<["SENSE", "INTERPRET", "JUDGE", "PLAN", "CREATE", "VERIFY"]>, "many">>;
237
237
  input_types: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString, "many">>>;
238
+ /** The inputs this agent CANNOT WORK WITHOUT in ANY placement — the per-agent MANDATE that
239
+ * `input_types` (the capability ENVELOPE: what the agent CAN consume across all roles) cannot
240
+ * express. `composeStandard` refuses a chair whose `input_contract` omits any of these, because
241
+ * that placement would run the agent's method against an input that never arrives. Every entry
242
+ * MUST also appear in `input_types` — an agent cannot REQUIRE an input outside its own envelope;
243
+ * the cross-field rule on `AgentSchema` (the `.superRefine` below) enforces that at PARSE.
244
+ *
245
+ * OPTIONAL with NO default — deliberately, exactly like `turn_budget`/`tier`. A `.default([])`
246
+ * would make the field non-optional on the `Agent` output type (breaking hand-rolled `Agent`
247
+ * literals such as `tests/genome_write_roundtrip.test.ts`'s `sensor`) and would ADD
248
+ * `required_inputs: []` to every existing agent on write-back, breaking byte-equivalent round-trip.
249
+ * Absent stays absent; a Zod object drops an undeclared key, so the field must be declared HERE to
250
+ * be retained. */
251
+ required_inputs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString, "many">>>;
252
+ output_types: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString, "many">>>;
253
+ domain: z.ZodDefault<z.ZodNullable<z.ZodString>>;
254
+ identity: z.ZodString;
255
+ method: z.ZodString;
256
+ constraints: z.ZodReadonly<z.ZodArray<z.ZodString, "many">>;
257
+ behavioral_primitives: z.ZodReadonly<z.ZodTuple<[z.ZodEnum<["explorer", "analyst", "critic", "synthesizer", "planner", "executor", "audience_modeler"]>, z.ZodEnum<["explorer", "analyst", "critic", "synthesizer", "planner", "executor", "audience_modeler"]>], null>>;
258
+ allowed_tools: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString, "many">>>;
259
+ disallowed_tools: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString, "many">>>;
260
+ /** REFERENCES into the shared repertoire (`skills/<slug>/`): the off-the-shelf method, bound by
261
+ * name, resolved against the genome's skills map at run time. A slug that resolves to no
262
+ * package is a dangling binding (loader) and a dead name when a chair requires it (runtime). */
263
+ skill_slugs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString, "many">>>;
264
+ /** The agent's OWN skills, carried on its record rather than referenced by name.
265
+ *
266
+ * An agent is the thing closest to its own work, so it is the agent that grows technique — and
267
+ * grown technique has to be portable: the same player seated in a second institution brings its
268
+ * method along instead of waiting for that institution's repertoire to contain it. Institution
269
+ * data never rides along; a carried skill declares `hydration` slots and the seating fills them.
270
+ *
271
+ * Relationship to `skill_slugs`: slugs name the SHARED repertoire, `skills` are the agent's own.
272
+ * Resolution unions the two, carried-first, so a carried definition SHADOWS a same-slug
273
+ * repertoire package (the player's own technique is the one that plays) and a slug covered by a
274
+ * carried definition is not a dangling binding. */
275
+ skills: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
276
+ slug: z.ZodString;
277
+ version: z.ZodOptional<z.ZodNumber>;
278
+ skill_type: z.ZodOptional<z.ZodString>;
279
+ input_type: z.ZodOptional<z.ZodString>;
280
+ output_type: z.ZodOptional<z.ZodString>;
281
+ corpus: z.ZodOptional<z.ZodString>;
282
+ determinism_ratio: z.ZodOptional<z.ZodNumber>;
283
+ permission: z.ZodOptional<z.ZodObject<{
284
+ tier: z.ZodOptional<z.ZodNumber>;
285
+ network: z.ZodOptional<z.ZodObject<{
286
+ allow: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
287
+ methods: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
288
+ max_requests: z.ZodOptional<z.ZodNumber>;
289
+ max_bytes: z.ZodOptional<z.ZodNumber>;
290
+ }, "strip", z.ZodTypeAny, {
291
+ allow: string[];
292
+ methods?: string[] | undefined;
293
+ max_requests?: number | undefined;
294
+ max_bytes?: number | undefined;
295
+ }, {
296
+ allow?: string[] | undefined;
297
+ methods?: string[] | undefined;
298
+ max_requests?: number | undefined;
299
+ max_bytes?: number | undefined;
300
+ }>>;
301
+ }, "strip", z.ZodTypeAny, {
302
+ tier?: number | undefined;
303
+ network?: {
304
+ allow: string[];
305
+ methods?: string[] | undefined;
306
+ max_requests?: number | undefined;
307
+ max_bytes?: number | undefined;
308
+ } | undefined;
309
+ }, {
310
+ tier?: number | undefined;
311
+ network?: {
312
+ allow?: string[] | undefined;
313
+ methods?: string[] | undefined;
314
+ max_requests?: number | undefined;
315
+ max_bytes?: number | undefined;
316
+ } | undefined;
317
+ }>>;
318
+ description: z.ZodOptional<z.ZodString>;
319
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
320
+ /** Slot name → the declared shape of what fills it. See HydrationSlotSchema: the method is the
321
+ * agent's, the slot data is the institution's (or the gig's). */
322
+ hydration: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
323
+ type: z.ZodString;
324
+ description: z.ZodOptional<z.ZodString>;
325
+ required: z.ZodOptional<z.ZodBoolean>;
326
+ binding: z.ZodOptional<z.ZodEnum<["institution", "gig"]>>;
327
+ }, "strip", z.ZodTypeAny, {
328
+ type: string;
329
+ description?: string | undefined;
330
+ required?: boolean | undefined;
331
+ binding?: "institution" | "gig" | undefined;
332
+ }, {
333
+ type: string;
334
+ description?: string | undefined;
335
+ required?: boolean | undefined;
336
+ binding?: "institution" | "gig" | undefined;
337
+ }>>>;
338
+ fixtures: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
339
+ code: z.ZodOptional<z.ZodString>;
340
+ md: z.ZodOptional<z.ZodString>;
341
+ }, "strip", z.ZodTypeAny, {
342
+ slug: string;
343
+ version?: number | undefined;
344
+ code?: string | undefined;
345
+ description?: string | undefined;
346
+ skill_type?: string | undefined;
347
+ input_type?: string | undefined;
348
+ output_type?: string | undefined;
349
+ corpus?: string | undefined;
350
+ determinism_ratio?: number | undefined;
351
+ permission?: {
352
+ tier?: number | undefined;
353
+ network?: {
354
+ allow: string[];
355
+ methods?: string[] | undefined;
356
+ max_requests?: number | undefined;
357
+ max_bytes?: number | undefined;
358
+ } | undefined;
359
+ } | undefined;
360
+ timeout_ms?: number | undefined;
361
+ hydration?: Record<string, {
362
+ type: string;
363
+ description?: string | undefined;
364
+ required?: boolean | undefined;
365
+ binding?: "institution" | "gig" | undefined;
366
+ }> | undefined;
367
+ fixtures?: unknown[] | undefined;
368
+ md?: string | undefined;
369
+ }, {
370
+ slug: string;
371
+ version?: number | undefined;
372
+ code?: string | undefined;
373
+ description?: string | undefined;
374
+ skill_type?: string | undefined;
375
+ input_type?: string | undefined;
376
+ output_type?: string | undefined;
377
+ corpus?: string | undefined;
378
+ determinism_ratio?: number | undefined;
379
+ permission?: {
380
+ tier?: number | undefined;
381
+ network?: {
382
+ allow?: string[] | undefined;
383
+ methods?: string[] | undefined;
384
+ max_requests?: number | undefined;
385
+ max_bytes?: number | undefined;
386
+ } | undefined;
387
+ } | undefined;
388
+ timeout_ms?: number | undefined;
389
+ hydration?: Record<string, {
390
+ type: string;
391
+ description?: string | undefined;
392
+ required?: boolean | undefined;
393
+ binding?: "institution" | "gig" | undefined;
394
+ }> | undefined;
395
+ fixtures?: unknown[] | undefined;
396
+ md?: string | undefined;
397
+ }>, "many">>>;
398
+ model_tier: z.ZodOptional<z.ZodEnum<["economy", "standard", "premium"]>>;
399
+ max_tool_calls: z.ZodOptional<z.ZodNumber>;
400
+ max_token_budget: z.ZodOptional<z.ZodNumber>;
401
+ code_tool_access: z.ZodOptional<z.ZodEnum<["none", "read", "write", "full"]>>;
402
+ depth_profile: z.ZodOptional<z.ZodEnum<["skim", "quick", "standard", "deep"]>>;
403
+ browser_grant: z.ZodOptional<z.ZodObject<{
404
+ allowed_origins: z.ZodArray<z.ZodString, "many">;
405
+ blocked_origins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
406
+ trace_dir: z.ZodOptional<z.ZodString>;
407
+ isolated: z.ZodOptional<z.ZodBoolean>;
408
+ headless: z.ZodOptional<z.ZodBoolean>;
409
+ }, "strip", z.ZodTypeAny, {
410
+ allowed_origins: string[];
411
+ blocked_origins?: string[] | undefined;
412
+ trace_dir?: string | undefined;
413
+ isolated?: boolean | undefined;
414
+ headless?: boolean | undefined;
415
+ }, {
416
+ allowed_origins: string[];
417
+ blocked_origins?: string[] | undefined;
418
+ trace_dir?: string | undefined;
419
+ isolated?: boolean | undefined;
420
+ headless?: boolean | undefined;
421
+ }>>;
422
+ }, "strip", z.ZodTypeAny, {
423
+ slug: string;
424
+ primitives: readonly ("SENSE" | "INTERPRET" | "JUDGE" | "PLAN" | "CREATE" | "VERIFY")[];
425
+ input_types: readonly string[];
426
+ output_types: readonly string[];
427
+ domain: string | null;
428
+ identity: string;
429
+ method: string;
430
+ constraints: readonly string[];
431
+ behavioral_primitives: readonly ["explorer" | "analyst" | "critic" | "synthesizer" | "planner" | "executor" | "audience_modeler", "explorer" | "analyst" | "critic" | "synthesizer" | "planner" | "executor" | "audience_modeler"];
432
+ depth_profile?: "skim" | "quick" | "standard" | "deep" | undefined;
433
+ required_inputs?: readonly string[] | undefined;
434
+ allowed_tools?: readonly string[] | undefined;
435
+ disallowed_tools?: readonly string[] | undefined;
436
+ skill_slugs?: readonly string[] | undefined;
437
+ skills?: readonly {
438
+ slug: string;
439
+ version?: number | undefined;
440
+ code?: string | undefined;
441
+ description?: string | undefined;
442
+ skill_type?: string | undefined;
443
+ input_type?: string | undefined;
444
+ output_type?: string | undefined;
445
+ corpus?: string | undefined;
446
+ determinism_ratio?: number | undefined;
447
+ permission?: {
448
+ tier?: number | undefined;
449
+ network?: {
450
+ allow: string[];
451
+ methods?: string[] | undefined;
452
+ max_requests?: number | undefined;
453
+ max_bytes?: number | undefined;
454
+ } | undefined;
455
+ } | undefined;
456
+ timeout_ms?: number | undefined;
457
+ hydration?: Record<string, {
458
+ type: string;
459
+ description?: string | undefined;
460
+ required?: boolean | undefined;
461
+ binding?: "institution" | "gig" | undefined;
462
+ }> | undefined;
463
+ fixtures?: unknown[] | undefined;
464
+ md?: string | undefined;
465
+ }[] | undefined;
466
+ model_tier?: "standard" | "economy" | "premium" | undefined;
467
+ max_tool_calls?: number | undefined;
468
+ max_token_budget?: number | undefined;
469
+ code_tool_access?: "none" | "read" | "write" | "full" | undefined;
470
+ browser_grant?: {
471
+ allowed_origins: string[];
472
+ blocked_origins?: string[] | undefined;
473
+ trace_dir?: string | undefined;
474
+ isolated?: boolean | undefined;
475
+ headless?: boolean | undefined;
476
+ } | undefined;
477
+ }, {
478
+ slug: string;
479
+ primitives: readonly ("SENSE" | "INTERPRET" | "JUDGE" | "PLAN" | "CREATE" | "VERIFY")[];
480
+ identity: string;
481
+ method: string;
482
+ constraints: readonly string[];
483
+ behavioral_primitives: readonly ["explorer" | "analyst" | "critic" | "synthesizer" | "planner" | "executor" | "audience_modeler", "explorer" | "analyst" | "critic" | "synthesizer" | "planner" | "executor" | "audience_modeler"];
484
+ input_types?: readonly string[] | undefined;
485
+ output_types?: readonly string[] | undefined;
486
+ domain?: string | null | undefined;
487
+ depth_profile?: "skim" | "quick" | "standard" | "deep" | undefined;
488
+ required_inputs?: readonly string[] | undefined;
489
+ allowed_tools?: readonly string[] | undefined;
490
+ disallowed_tools?: readonly string[] | undefined;
491
+ skill_slugs?: readonly string[] | undefined;
492
+ skills?: readonly {
493
+ slug: string;
494
+ version?: number | undefined;
495
+ code?: string | undefined;
496
+ description?: string | undefined;
497
+ skill_type?: string | undefined;
498
+ input_type?: string | undefined;
499
+ output_type?: string | undefined;
500
+ corpus?: string | undefined;
501
+ determinism_ratio?: number | undefined;
502
+ permission?: {
503
+ tier?: number | undefined;
504
+ network?: {
505
+ allow?: string[] | undefined;
506
+ methods?: string[] | undefined;
507
+ max_requests?: number | undefined;
508
+ max_bytes?: number | undefined;
509
+ } | undefined;
510
+ } | undefined;
511
+ timeout_ms?: number | undefined;
512
+ hydration?: Record<string, {
513
+ type: string;
514
+ description?: string | undefined;
515
+ required?: boolean | undefined;
516
+ binding?: "institution" | "gig" | undefined;
517
+ }> | undefined;
518
+ fixtures?: unknown[] | undefined;
519
+ md?: string | undefined;
520
+ }[] | undefined;
521
+ model_tier?: "standard" | "economy" | "premium" | undefined;
522
+ max_tool_calls?: number | undefined;
523
+ max_token_budget?: number | undefined;
524
+ code_tool_access?: "none" | "read" | "write" | "full" | undefined;
525
+ browser_grant?: {
526
+ allowed_origins: string[];
527
+ blocked_origins?: string[] | undefined;
528
+ trace_dir?: string | undefined;
529
+ isolated?: boolean | undefined;
530
+ headless?: boolean | undefined;
531
+ } | undefined;
532
+ }>;
533
+ /**
534
+ * The agent AUTHORING/parse surface: the plain `AgentObjectSchema` plus the one cross-field rule a
535
+ * single field cannot state — every `required_inputs` entry must also be an `input_types` entry.
536
+ *
537
+ * Mirrors the `VenueSchema` / `VenueObjectSchema` split below. The inner `AgentObjectSchema` is a
538
+ * plain `ZodObject`, so it retains `.shape` — which `zodToMcpProps(AgentObjectSchema)` (the advertised
539
+ * MCP surface) and `Object.keys(AgentObjectSchema.shape)` (server.ts's hosted-write key list) both
540
+ * need. `AgentSchema` wraps it in a `.superRefine`, a `ZodEffects` that has NEITHER — so those two
541
+ * consumers read the inner object while every `.parse`/`.safeParse` caller (`defineAgent`, the loader)
542
+ * gets the cross-field rule for free. An agent that requires an input outside its own capability
543
+ * envelope is MALFORMED, not merely un-composable, so it is refused at PARSE — earlier and closer to
544
+ * the author than the compose-time chair refusal, which is a different question (does THIS placement
545
+ * supply it?).
546
+ */
547
+ export declare const AgentSchema: z.ZodEffects<z.ZodObject<{
548
+ slug: z.ZodString;
549
+ primitives: z.ZodReadonly<z.ZodArray<z.ZodEnum<["SENSE", "INTERPRET", "JUDGE", "PLAN", "CREATE", "VERIFY"]>, "many">>;
550
+ input_types: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString, "many">>>;
551
+ /** The inputs this agent CANNOT WORK WITHOUT in ANY placement — the per-agent MANDATE that
552
+ * `input_types` (the capability ENVELOPE: what the agent CAN consume across all roles) cannot
553
+ * express. `composeStandard` refuses a chair whose `input_contract` omits any of these, because
554
+ * that placement would run the agent's method against an input that never arrives. Every entry
555
+ * MUST also appear in `input_types` — an agent cannot REQUIRE an input outside its own envelope;
556
+ * the cross-field rule on `AgentSchema` (the `.superRefine` below) enforces that at PARSE.
557
+ *
558
+ * OPTIONAL with NO default — deliberately, exactly like `turn_budget`/`tier`. A `.default([])`
559
+ * would make the field non-optional on the `Agent` output type (breaking hand-rolled `Agent`
560
+ * literals such as `tests/genome_write_roundtrip.test.ts`'s `sensor`) and would ADD
561
+ * `required_inputs: []` to every existing agent on write-back, breaking byte-equivalent round-trip.
562
+ * Absent stays absent; a Zod object drops an undeclared key, so the field must be declared HERE to
563
+ * be retained. */
564
+ required_inputs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString, "many">>>;
238
565
  output_types: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString, "many">>>;
239
566
  domain: z.ZodDefault<z.ZodNullable<z.ZodString>>;
240
567
  identity: z.ZodString;
@@ -416,6 +743,117 @@ export declare const AgentSchema: z.ZodObject<{
416
743
  constraints: readonly string[];
417
744
  behavioral_primitives: readonly ["explorer" | "analyst" | "critic" | "synthesizer" | "planner" | "executor" | "audience_modeler", "explorer" | "analyst" | "critic" | "synthesizer" | "planner" | "executor" | "audience_modeler"];
418
745
  depth_profile?: "skim" | "quick" | "standard" | "deep" | undefined;
746
+ required_inputs?: readonly string[] | undefined;
747
+ allowed_tools?: readonly string[] | undefined;
748
+ disallowed_tools?: readonly string[] | undefined;
749
+ skill_slugs?: readonly string[] | undefined;
750
+ skills?: readonly {
751
+ slug: string;
752
+ version?: number | undefined;
753
+ code?: string | undefined;
754
+ description?: string | undefined;
755
+ skill_type?: string | undefined;
756
+ input_type?: string | undefined;
757
+ output_type?: string | undefined;
758
+ corpus?: string | undefined;
759
+ determinism_ratio?: number | undefined;
760
+ permission?: {
761
+ tier?: number | undefined;
762
+ network?: {
763
+ allow: string[];
764
+ methods?: string[] | undefined;
765
+ max_requests?: number | undefined;
766
+ max_bytes?: number | undefined;
767
+ } | undefined;
768
+ } | undefined;
769
+ timeout_ms?: number | undefined;
770
+ hydration?: Record<string, {
771
+ type: string;
772
+ description?: string | undefined;
773
+ required?: boolean | undefined;
774
+ binding?: "institution" | "gig" | undefined;
775
+ }> | undefined;
776
+ fixtures?: unknown[] | undefined;
777
+ md?: string | undefined;
778
+ }[] | undefined;
779
+ model_tier?: "standard" | "economy" | "premium" | undefined;
780
+ max_tool_calls?: number | undefined;
781
+ max_token_budget?: number | undefined;
782
+ code_tool_access?: "none" | "read" | "write" | "full" | undefined;
783
+ browser_grant?: {
784
+ allowed_origins: string[];
785
+ blocked_origins?: string[] | undefined;
786
+ trace_dir?: string | undefined;
787
+ isolated?: boolean | undefined;
788
+ headless?: boolean | undefined;
789
+ } | undefined;
790
+ }, {
791
+ slug: string;
792
+ primitives: readonly ("SENSE" | "INTERPRET" | "JUDGE" | "PLAN" | "CREATE" | "VERIFY")[];
793
+ identity: string;
794
+ method: string;
795
+ constraints: readonly string[];
796
+ behavioral_primitives: readonly ["explorer" | "analyst" | "critic" | "synthesizer" | "planner" | "executor" | "audience_modeler", "explorer" | "analyst" | "critic" | "synthesizer" | "planner" | "executor" | "audience_modeler"];
797
+ input_types?: readonly string[] | undefined;
798
+ output_types?: readonly string[] | undefined;
799
+ domain?: string | null | undefined;
800
+ depth_profile?: "skim" | "quick" | "standard" | "deep" | undefined;
801
+ required_inputs?: readonly string[] | undefined;
802
+ allowed_tools?: readonly string[] | undefined;
803
+ disallowed_tools?: readonly string[] | undefined;
804
+ skill_slugs?: readonly string[] | undefined;
805
+ skills?: readonly {
806
+ slug: string;
807
+ version?: number | undefined;
808
+ code?: string | undefined;
809
+ description?: string | undefined;
810
+ skill_type?: string | undefined;
811
+ input_type?: string | undefined;
812
+ output_type?: string | undefined;
813
+ corpus?: string | undefined;
814
+ determinism_ratio?: number | undefined;
815
+ permission?: {
816
+ tier?: number | undefined;
817
+ network?: {
818
+ allow?: string[] | undefined;
819
+ methods?: string[] | undefined;
820
+ max_requests?: number | undefined;
821
+ max_bytes?: number | undefined;
822
+ } | undefined;
823
+ } | undefined;
824
+ timeout_ms?: number | undefined;
825
+ hydration?: Record<string, {
826
+ type: string;
827
+ description?: string | undefined;
828
+ required?: boolean | undefined;
829
+ binding?: "institution" | "gig" | undefined;
830
+ }> | undefined;
831
+ fixtures?: unknown[] | undefined;
832
+ md?: string | undefined;
833
+ }[] | undefined;
834
+ model_tier?: "standard" | "economy" | "premium" | undefined;
835
+ max_tool_calls?: number | undefined;
836
+ max_token_budget?: number | undefined;
837
+ code_tool_access?: "none" | "read" | "write" | "full" | undefined;
838
+ browser_grant?: {
839
+ allowed_origins: string[];
840
+ blocked_origins?: string[] | undefined;
841
+ trace_dir?: string | undefined;
842
+ isolated?: boolean | undefined;
843
+ headless?: boolean | undefined;
844
+ } | undefined;
845
+ }>, {
846
+ slug: string;
847
+ primitives: readonly ("SENSE" | "INTERPRET" | "JUDGE" | "PLAN" | "CREATE" | "VERIFY")[];
848
+ input_types: readonly string[];
849
+ output_types: readonly string[];
850
+ domain: string | null;
851
+ identity: string;
852
+ method: string;
853
+ constraints: readonly string[];
854
+ behavioral_primitives: readonly ["explorer" | "analyst" | "critic" | "synthesizer" | "planner" | "executor" | "audience_modeler", "explorer" | "analyst" | "critic" | "synthesizer" | "planner" | "executor" | "audience_modeler"];
855
+ depth_profile?: "skim" | "quick" | "standard" | "deep" | undefined;
856
+ required_inputs?: readonly string[] | undefined;
419
857
  allowed_tools?: readonly string[] | undefined;
420
858
  disallowed_tools?: readonly string[] | undefined;
421
859
  skill_slugs?: readonly string[] | undefined;
@@ -470,6 +908,7 @@ export declare const AgentSchema: z.ZodObject<{
470
908
  output_types?: readonly string[] | undefined;
471
909
  domain?: string | null | undefined;
472
910
  depth_profile?: "skim" | "quick" | "standard" | "deep" | undefined;
911
+ required_inputs?: readonly string[] | undefined;
473
912
  allowed_tools?: readonly string[] | undefined;
474
913
  disallowed_tools?: readonly string[] | undefined;
475
914
  skill_slugs?: readonly string[] | undefined;
@@ -2756,8 +3195,15 @@ export type VenueOutput = z.output<typeof VenueSchema>;
2756
3195
  */
2757
3196
  export declare function venueDefect(venue: VenueOutput): string | null;
2758
3197
  type JsonType = "string" | "number" | "boolean" | "array" | "object";
2759
- /** The MCP `properties` map (field → JSON type) for a genome class schema. */
2760
- export declare function zodToMcpProps(schema: z.ZodObject<z.ZodRawShape>): Record<string, JsonType>;
3198
+ /** The MCP `properties` map (field → JSON type) for a genome class schema.
3199
+ *
3200
+ * Accepts either a plain `ZodObject` or a `.superRefine`/`.refine`-wrapped one (a `ZodEffects`, e.g.
3201
+ * `AgentSchema` with its `required_inputs ⊆ input_types` rule): a cross-field-refined class has no
3202
+ * own `.shape`, so unwrap to the inner object before reading it. This mirrors `jsonTypeOf`'s own
3203
+ * effects-unwrapping (`_def.schema`) and lets a refined class advertise its field surface without a
3204
+ * parallel object-schema sibling threaded to every call site. Passing the inner `…ObjectSchema`
3205
+ * directly (as venue does) still works — the guard is a no-op on a plain object. */
3206
+ export declare function zodToMcpProps(schema: z.ZodTypeAny): Record<string, JsonType>;
2761
3207
  /** How a Resource REFILLS, expressed in the resource's OWN unit — a monthly seat renews, a one-off
2762
3208
  * purchase does not, a rate-based capacity decays. `quantity` is a magnitude in the SAME unit the
2763
3209
  * Resource declares; `per_period` is the cadence it renews over (absent for a one-off). NOTHING
@@ -84,10 +84,24 @@ export const SkillSchema = z.object({
84
84
  });
85
85
  // ── Agent — the template class, migrated end-to-end. z.input = AgentDef (what you author,
86
86
  // optionals allowed); z.output = Agent (defaults applied). One definition, both types. ──
87
- export const AgentSchema = z.object({
87
+ export const AgentObjectSchema = z.object({
88
88
  slug: z.string(),
89
89
  primitives: z.array(PrimitiveSchema).readonly(),
90
90
  input_types: z.array(z.string()).readonly().default([]),
91
+ /** The inputs this agent CANNOT WORK WITHOUT in ANY placement — the per-agent MANDATE that
92
+ * `input_types` (the capability ENVELOPE: what the agent CAN consume across all roles) cannot
93
+ * express. `composeStandard` refuses a chair whose `input_contract` omits any of these, because
94
+ * that placement would run the agent's method against an input that never arrives. Every entry
95
+ * MUST also appear in `input_types` — an agent cannot REQUIRE an input outside its own envelope;
96
+ * the cross-field rule on `AgentSchema` (the `.superRefine` below) enforces that at PARSE.
97
+ *
98
+ * OPTIONAL with NO default — deliberately, exactly like `turn_budget`/`tier`. A `.default([])`
99
+ * would make the field non-optional on the `Agent` output type (breaking hand-rolled `Agent`
100
+ * literals such as `tests/genome_write_roundtrip.test.ts`'s `sensor`) and would ADD
101
+ * `required_inputs: []` to every existing agent on write-back, breaking byte-equivalent round-trip.
102
+ * Absent stays absent; a Zod object drops an undeclared key, so the field must be declared HERE to
103
+ * be retained. */
104
+ required_inputs: z.array(z.string()).readonly().optional(),
91
105
  output_types: z.array(z.string()).readonly().default([]),
92
106
  domain: z.string().nullable().default(null),
93
107
  identity: z.string(),
@@ -121,6 +135,34 @@ export const AgentSchema = z.object({
121
135
  depth_profile: DepthSchema.optional(),
122
136
  browser_grant: BrowserGrantSchema.optional(),
123
137
  });
138
+ /**
139
+ * The agent AUTHORING/parse surface: the plain `AgentObjectSchema` plus the one cross-field rule a
140
+ * single field cannot state — every `required_inputs` entry must also be an `input_types` entry.
141
+ *
142
+ * Mirrors the `VenueSchema` / `VenueObjectSchema` split below. The inner `AgentObjectSchema` is a
143
+ * plain `ZodObject`, so it retains `.shape` — which `zodToMcpProps(AgentObjectSchema)` (the advertised
144
+ * MCP surface) and `Object.keys(AgentObjectSchema.shape)` (server.ts's hosted-write key list) both
145
+ * need. `AgentSchema` wraps it in a `.superRefine`, a `ZodEffects` that has NEITHER — so those two
146
+ * consumers read the inner object while every `.parse`/`.safeParse` caller (`defineAgent`, the loader)
147
+ * gets the cross-field rule for free. An agent that requires an input outside its own capability
148
+ * envelope is MALFORMED, not merely un-composable, so it is refused at PARSE — earlier and closer to
149
+ * the author than the compose-time chair refusal, which is a different question (does THIS placement
150
+ * supply it?).
151
+ */
152
+ export const AgentSchema = AgentObjectSchema.superRefine((agent, ctx) => {
153
+ const envelope = new Set(agent.input_types ?? []);
154
+ for (const req of agent.required_inputs ?? []) {
155
+ if (envelope.has(req))
156
+ continue;
157
+ ctx.addIssue({
158
+ code: z.ZodIssueCode.custom,
159
+ path: ["required_inputs"],
160
+ message: `required_inputs entry "${req}" is not in input_types [${(agent.input_types ?? []).join(", ")}] — ` +
161
+ `an agent cannot REQUIRE an input outside its capability envelope. Add "${req}" to input_types, ` +
162
+ `or drop it from required_inputs.`,
163
+ });
164
+ }
165
+ });
124
166
  // ── Chair / Phase / Standard — the schema is the DNA; the runtime Standard (resolved agents) is a
125
167
  // transform output and stays a derived type in composition.ts. The FILE/compose shape is here. ──
126
168
  export const ChairSchema = z.object({
@@ -1071,9 +1113,17 @@ function jsonTypeOf(schema) {
1071
1113
  return "array";
1072
1114
  return "object";
1073
1115
  }
1074
- /** The MCP `properties` map (field → JSON type) for a genome class schema. */
1116
+ /** The MCP `properties` map (field → JSON type) for a genome class schema.
1117
+ *
1118
+ * Accepts either a plain `ZodObject` or a `.superRefine`/`.refine`-wrapped one (a `ZodEffects`, e.g.
1119
+ * `AgentSchema` with its `required_inputs ⊆ input_types` rule): a cross-field-refined class has no
1120
+ * own `.shape`, so unwrap to the inner object before reading it. This mirrors `jsonTypeOf`'s own
1121
+ * effects-unwrapping (`_def.schema`) and lets a refined class advertise its field surface without a
1122
+ * parallel object-schema sibling threaded to every call site. Passing the inner `…ObjectSchema`
1123
+ * directly (as venue does) still works — the guard is a no-op on a plain object. */
1075
1124
  export function zodToMcpProps(schema) {
1076
- return Object.fromEntries(Object.entries(schema.shape).map(([k, v]) => [k, jsonTypeOf(v)]));
1125
+ const obj = (schema instanceof z.ZodEffects ? schema._def.schema : schema);
1126
+ return Object.fromEntries(Object.entries(obj.shape).map(([k, v]) => [k, jsonTypeOf(v)]));
1077
1127
  }
1078
1128
  // ── The committed-work objects — Tour / Booking / Resource, the binding middle place ──────────────
1079
1129
  //