@fungi.computer/forage 0.1.0 → 0.2.1

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/docs/api/index.md CHANGED
@@ -342,12 +342,14 @@ Narrow convenience namespace for the package's public seams.
342
342
  ### forageSearchInput
343
343
 
344
344
  ```ts
345
- const forageSearchInput: ZodObject<
346
- {
347
- query: ZodString;
348
- maxResults: ZodDefault<ZodNumber>;
349
- },
350
- $strip
345
+ const forageSearchInput: ZodLazy<
346
+ ZodObject<
347
+ {
348
+ query: ZodString;
349
+ maxResults: ZodDefault<ZodNumber>;
350
+ },
351
+ $strip
352
+ >
351
353
  >;
352
354
  ```
353
355
 
@@ -358,18 +360,20 @@ Input accepted by the pure catalog search seam.
358
360
  ### forageDescribeInput
359
361
 
360
362
  ```ts
361
- const forageDescribeInput: ZodObject<
362
- {
363
- path: ZodString;
364
- detail: ZodDefault<
365
- ZodEnum<{
366
- index: "index";
367
- full: "full";
368
- }>
369
- >;
370
- methods: ZodOptional<ZodArray<ZodString>>;
371
- },
372
- $strip
363
+ const forageDescribeInput: ZodLazy<
364
+ ZodObject<
365
+ {
366
+ path: ZodString;
367
+ detail: ZodDefault<
368
+ ZodEnum<{
369
+ index: "index";
370
+ full: "full";
371
+ }>
372
+ >;
373
+ methods: ZodOptional<ZodArray<ZodString>>;
374
+ },
375
+ $strip
376
+ >
373
377
  >;
374
378
  ```
375
379
 
@@ -404,16 +408,18 @@ const searchResultSchema: ZodObject<
404
408
  description: ZodOptional<ZodString>;
405
409
  score: ZodNumber;
406
410
  matchReason: ZodOptional<ZodString>;
407
- sample: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>;
411
+ sample: ZodOptional<ZodLazy<ZodRecord<ZodString, ZodJSONSchema>>>;
408
412
  capabilityNotes: ZodOptional<ZodString>;
409
413
  peers: ZodOptional<
410
414
  ZodArray<
411
- ZodObject<
412
- {
413
- path: ZodString;
414
- capabilityNotes: ZodOptional<ZodString>;
415
- },
416
- $strip
415
+ ZodLazy<
416
+ ZodObject<
417
+ {
418
+ path: ZodString;
419
+ capabilityNotes: ZodOptional<ZodString>;
420
+ },
421
+ $strip
422
+ >
417
423
  >
418
424
  >
419
425
  >;
@@ -429,40 +435,25 @@ One ranked operation in a search response.
429
435
  ### searchOutputSchema
430
436
 
431
437
  ```ts
432
- const searchOutputSchema: ZodObject<
433
- {
434
- results: ZodArray<
435
- ZodObject<
436
- {
437
- path: ZodString;
438
- description: ZodOptional<ZodString>;
439
- score: ZodNumber;
440
- matchReason: ZodOptional<ZodString>;
441
- sample: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>;
442
- capabilityNotes: ZodOptional<ZodString>;
443
- peers: ZodOptional<
444
- ZodArray<
445
- ZodObject<
446
- {
447
- path: ZodString;
448
- capabilityNotes: ZodOptional<ZodString>;
449
- },
450
- $strip
451
- >
452
- >
453
- >;
454
- },
455
- $strip
456
- >
457
- >;
458
- total: ZodNumber;
459
- truncated: ZodBoolean;
460
- topScore: ZodNumber;
461
- margin: ZodNumber;
462
- catalogStamp: ZodString;
463
- },
464
- $strip
465
- >;
438
+ const searchOutputSchema: ZodLazy<ZodObject<{
439
+ results: ZodArray<ZodObject<{
440
+ path: ZodString;
441
+ description: ZodOptional<ZodString>;
442
+ score: ZodNumber;
443
+ matchReason: ZodOptional<ZodString>;
444
+ sample: ZodOptional<ZodLazy<ZodRecord<ZodString, ZodJSONSchema>>>;
445
+ capabilityNotes: ZodOptional<ZodString>;
446
+ peers: ZodOptional<ZodArray<ZodLazy<ZodObject<{
447
+ path: ...;
448
+ capabilityNotes: ...;
449
+ }, $strip>>>>;
450
+ }, $strip>>;
451
+ total: ZodNumber;
452
+ truncated: ZodBoolean;
453
+ topScore: ZodNumber;
454
+ margin: ZodNumber;
455
+ catalogStamp: ZodString;
456
+ }, $strip>>;
466
457
  ```
467
458
 
468
459
  Bounded search response envelope.
@@ -472,38 +463,23 @@ Bounded search response envelope.
472
463
  ### listOutputSchema
473
464
 
474
465
  ```ts
475
- const listOutputSchema: ZodObject<
476
- {
477
- results: ZodArray<
478
- ZodObject<
479
- {
480
- path: ZodString;
481
- description: ZodOptional<ZodString>;
482
- score: ZodNumber;
483
- matchReason: ZodOptional<ZodString>;
484
- sample: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>;
485
- capabilityNotes: ZodOptional<ZodString>;
486
- peers: ZodOptional<
487
- ZodArray<
488
- ZodObject<
489
- {
490
- path: ZodString;
491
- capabilityNotes: ZodOptional<ZodString>;
492
- },
493
- $strip
494
- >
495
- >
496
- >;
497
- },
498
- $strip
499
- >
500
- >;
501
- total: ZodNumber;
502
- nextCursor: ZodNullable<ZodString>;
503
- catalogStamp: ZodString;
504
- },
505
- $strip
506
- >;
466
+ const listOutputSchema: ZodObject<{
467
+ results: ZodArray<ZodObject<{
468
+ path: ZodString;
469
+ description: ZodOptional<ZodString>;
470
+ score: ZodNumber;
471
+ matchReason: ZodOptional<ZodString>;
472
+ sample: ZodOptional<ZodLazy<ZodRecord<ZodString, ZodJSONSchema>>>;
473
+ capabilityNotes: ZodOptional<ZodString>;
474
+ peers: ZodOptional<ZodArray<ZodLazy<ZodObject<{
475
+ path: ZodString;
476
+ capabilityNotes: ZodOptional<...>;
477
+ }, $strip>>>>;
478
+ }, $strip>>;
479
+ total: ZodNumber;
480
+ nextCursor: ZodNullable<ZodString>;
481
+ catalogStamp: ZodString;
482
+ }, $strip>;
507
483
  ```
508
484
 
509
485
  One exhaustive page, using the exact search operation summary schema.
@@ -513,19 +489,21 @@ One exhaustive page, using the exact search operation summary schema.
513
489
  ### describeOutputSchema
514
490
 
515
491
  ```ts
516
- const describeOutputSchema: ZodObject<
517
- {
518
- path: ZodString;
519
- description: ZodOptional<ZodString>;
520
- types: ZodString;
521
- inputSchema: ZodOptional<ZodJSONSchema>;
522
- kind: ZodEnum<{
523
- module: "module";
524
- operation: "operation";
525
- }>;
526
- usage: ZodOptional<ZodString>;
527
- },
528
- $strip
492
+ const describeOutputSchema: ZodLazy<
493
+ ZodObject<
494
+ {
495
+ path: ZodString;
496
+ description: ZodOptional<ZodString>;
497
+ types: ZodString;
498
+ inputSchema: ZodOptional<ZodJSONSchema>;
499
+ kind: ZodEnum<{
500
+ module: "module";
501
+ operation: "operation";
502
+ }>;
503
+ usage: ZodOptional<ZodString>;
504
+ },
505
+ $strip
506
+ >
529
507
  >;
530
508
  ```
531
509
 
@@ -536,18 +514,20 @@ Deterministic description response.
536
514
  ### forageFailureSchema
537
515
 
538
516
  ```ts
539
- const forageFailureSchema: ZodObject<
540
- {
541
- code: ZodEnum<{
542
- empty_query: "empty_query";
543
- empty_catalog: "empty_catalog";
544
- unknown_target: "unknown_target";
545
- duplicate_operation: "duplicate_operation";
546
- invalid_input: "invalid_input";
547
- }>;
548
- message: ZodString;
549
- },
550
- $strip
517
+ const forageFailureSchema: ZodLazy<
518
+ ZodObject<
519
+ {
520
+ code: ZodEnum<{
521
+ empty_query: "empty_query";
522
+ empty_catalog: "empty_catalog";
523
+ unknown_target: "unknown_target";
524
+ duplicate_operation: "duplicate_operation";
525
+ invalid_input: "invalid_input";
526
+ }>;
527
+ message: ZodString;
528
+ },
529
+ $strip
530
+ >
551
531
  >;
552
532
  ```
553
533
 
@@ -558,42 +538,36 @@ Closed failure vocabulary for malformed or absent catalog requests.
558
538
  ### operationSchema
559
539
 
560
540
  ```ts
561
- const operationSchema: ZodObject<{
541
+ const operationSchema: ZodLazy<ZodObject<{
562
542
  path: ZodString;
563
543
  description: ZodOptional<ZodString>;
564
- input: ZodCustom<Readonly<{
544
+ input: ZodLazy<ZodCustom<Readonly<{
565
545
  ~standard: Readonly<{
566
546
  jsonSchema: Readonly<{
567
- input: (options) => object;
568
- output: (options) => object;
547
+ input: ...;
548
+ output: ...;
569
549
  }>;
570
550
  }>;
571
551
  }>, Readonly<{
572
552
  ~standard: Readonly<{
573
553
  jsonSchema: Readonly<{
574
- input: (options) => object;
575
- output: (options) => object;
554
+ input: ...;
555
+ output: ...;
576
556
  }>;
577
557
  }>;
578
- }>>;
579
- output: ZodOptional<ZodCustom<Readonly<{
558
+ }>>>;
559
+ output: ZodOptional<ZodLazy<ZodCustom<Readonly<{
580
560
  ~standard: Readonly<{
581
- jsonSchema: Readonly<{
582
- input: (options) => ...;
583
- output: (options) => ...;
584
- }>;
561
+ jsonSchema: Readonly<...>;
585
562
  }>;
586
563
  }>, Readonly<{
587
564
  ~standard: Readonly<{
588
- jsonSchema: Readonly<{
589
- input: (options) => ...;
590
- output: (options) => ...;
591
- }>;
565
+ jsonSchema: Readonly<...>;
592
566
  }>;
593
- }>>>;
567
+ }>>>>;
594
568
  capabilityNotes: ZodOptional<ZodString>;
595
569
  instructions: ZodOptional<ZodString>;
596
- }, $strip>;
570
+ }, $strip>>;
597
571
  ```
598
572
 
599
573
  A secret-free, callback-free operation descriptor.
@@ -603,33 +577,21 @@ A secret-free, callback-free operation descriptor.
603
577
  ### catalogInputSchema
604
578
 
605
579
  ```ts
606
- const catalogInputSchema: ZodObject<{
580
+ const catalogInputSchema: ZodLazy<ZodObject<{
607
581
  revision: ZodString;
608
- operations: ZodArray<ZodObject<{
582
+ operations: ZodArray<ZodLazy<ZodObject<{
609
583
  path: ZodString;
610
584
  description: ZodOptional<ZodString>;
611
- input: ZodCustom<Readonly<{
612
- ~standard: Readonly<{
613
- jsonSchema: Readonly<...>;
614
- }>;
585
+ input: ZodLazy<ZodCustom<Readonly<{
586
+ ~standard: ...;
615
587
  }>, Readonly<{
616
- ~standard: Readonly<{
617
- jsonSchema: Readonly<...>;
618
- }>;
619
- }>>;
620
- output: ZodOptional<ZodCustom<Readonly<{
621
- ~standard: Readonly<{
622
- jsonSchema: ...;
623
- }>;
624
- }>, Readonly<{
625
- ~standard: Readonly<{
626
- jsonSchema: ...;
627
- }>;
588
+ ~standard: ...;
628
589
  }>>>;
590
+ output: ZodOptional<ZodLazy<ZodCustom<Readonly<...>, Readonly<...>>>>;
629
591
  capabilityNotes: ZodOptional<ZodString>;
630
592
  instructions: ZodOptional<ZodString>;
631
- }, $strip>>;
632
- }, $strip>;
593
+ }, $strip>>>;
594
+ }, $strip>>;
633
595
  ```
634
596
 
635
597
  Input used to construct one immutable catalog revision.
@@ -660,16 +622,47 @@ The shared JSON-Schema compiler for App methods and OpenAPI operations.
660
622
 
661
623
  ---
662
624
 
625
+ ### appJsonSchema()
626
+
627
+ ```ts
628
+ function appJsonSchema(
629
+ declaration,
630
+ ): Pick<
631
+ z.ZodType<z.output<z.ZodJSONSchema>>,
632
+ "parse" | "safeParse" | "~standard"
633
+ >;
634
+ ```
635
+
636
+ One decoded, immutable App declaration as a JSON-only Standard Schema. Release
637
+ and family-listing decoders own its JSON boundary. A catalog describes every
638
+ installed method on each capture but a turn validates only the few it calls.
639
+ Compiling every method eagerly exhausted an Agent Durable Object's isolate. A
640
+ draft 2020-12 description is the declaration itself; validators compile for the
641
+ call in hand and are never kept on the surface.
642
+
643
+ #### Parameters
644
+
645
+ | Parameter | Type |
646
+ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
647
+ | `declaration` | \| `boolean` \| \{ \[`key`: `string`\]: \| `null` \| `string` \| `number` \| `false` \| `true` \| \{ \[`index`: `number`\]: AppApiJsonValue; `length`: `number`; \} \| AppApiJsonObject; \} |
648
+
649
+ #### Returns
650
+
651
+ `Pick`\<`z.ZodType`\<`z.output`\<`z.ZodJSONSchema`\>\>, `"parse"` \|
652
+ `"safeParse"` \| `"~standard"`\>
653
+
654
+ ---
655
+
663
656
  ### appMethodSchemas()
664
657
 
665
658
  ```ts
666
659
  function appMethodSchemas(api): object;
667
660
  ```
668
661
 
669
- Compile App validators and their Standard JSON Schema descriptions. Validation
670
- enforces both the declaration and JSON-only values; discovery describes the
671
- declaration without adding JSON guard nesting. Agar's emitted output already
672
- includes Pending for opted-in methods.
662
+ Describe App methods with call-scoped JSON validators. Validation enforces both
663
+ the declaration and JSON-only values; discovery describes the declaration
664
+ without adding JSON guard nesting. Agar's emitted output already includes
665
+ Pending for opted-in methods.
673
666
 
674
667
  #### Parameters
675
668
 
@@ -689,7 +682,7 @@ includes Pending for opted-in methods.
689
682
  function appToolSchemas(api): object;
690
683
  ```
691
684
 
692
- Compile discoverable App methods only; direct RPC validation uses
685
+ Describe discoverable App methods only; direct RPC validation uses
693
686
  appMethodSchemas.
694
687
 
695
688
  #### Parameters
@@ -715,8 +708,12 @@ function appToolFamilySchemas(
715
708
  call: string;
716
709
  effect: "write" | "external" | "read";
717
710
  requires: readonly (
711
+ | "approvals"
718
712
  | "agent.list"
719
713
  | "agent.manage"
714
+ | "agent.rename"
715
+ | "agent.avatar"
716
+ | "agent.toolPolicy"
720
717
  | "agent.read"
721
718
  | "agent.send"
722
719
  | "computer.list"
@@ -760,15 +757,17 @@ arguments; this projection supplies neither defaults nor handlers.
760
757
  #### Returns
761
758
 
762
759
  \| \{ `name`: `string`; `call`: `string`; `effect`: `"write"` \| `"external"` \|
763
- `"read"`; `requires`: readonly ( \| `"agent.list"` \| `"agent.manage"` \|
764
- `"agent.read"` \| `"agent.send"` \| `"computer.list"` \| `"computer.readFile"`
765
- \| `"computer.writeFile"` \| `"computer.execute"` \| `"llm.generation"` \|
766
- `"media.generation"` \| `"games:servers"` \| `"git.repository"` \| `"apps.open"`
767
- \| `"apps.call"` \| `"app.storage"` \| `"app.events.emit"` \|
768
- `"team.workbenchHost"` \| `"marketplace.browse"` \| `"marketplace.purchase"` \|
769
- `"workflow.run"` \| `"workflow.publish"` \| `"workflow.arm"` \| `"world"` \|
770
- `"channels.read"` \| `"channels.personal.manage"`)[]; `kind`: `"ready"` \|
771
- `"unindexed"`; `tools`: `object`[]; \} \| `null`
760
+ `"read"`; `requires`: readonly ( \| `"approvals"` \| `"agent.list"` \|
761
+ `"agent.manage"` \| `"agent.rename"` \| `"agent.avatar"` \| `"agent.toolPolicy"`
762
+ \| `"agent.read"` \| `"agent.send"` \| `"computer.list"` \|
763
+ `"computer.readFile"` \| `"computer.writeFile"` \| `"computer.execute"` \|
764
+ `"llm.generation"` \| `"media.generation"` \| `"games:servers"` \|
765
+ `"git.repository"` \| `"apps.open"` \| `"apps.call"` \| `"app.storage"` \|
766
+ `"app.events.emit"` \| `"team.workbenchHost"` \| `"marketplace.browse"` \|
767
+ `"marketplace.purchase"` \| `"workflow.run"` \| `"workflow.publish"` \|
768
+ `"workflow.arm"` \| `"world"` \| `"channels.read"` \|
769
+ `"channels.personal.manage"`)[]; `kind`: `"ready"` \| `"unindexed"`; `tools`:
770
+ `object`[]; \} \| `null`
772
771
 
773
772
  ---
774
773
 
@@ -197,7 +197,7 @@ const openApiOperationSchema: ZodObject<
197
197
  parameters: ZodArray<
198
198
  ZodObject<
199
199
  {
200
- name: ZodString;
200
+ name: ZodLazy<ZodString>;
201
201
  in: ZodEnum<{
202
202
  header: "header";
203
203
  path: "path";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/forage",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Pure immutable Zod-typed capability discovery",
6
6
  "type": "module",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@apidevtools/json-schema-ref-parser": "16.0.3",
32
- "@fungi.computer/puffball": "0.1.0",
32
+ "@fungi.computer/puffball": "0.3.0",
33
33
  "yaml": "2.9.0",
34
34
  "zod": "4.4.3"
35
35
  },