@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/README.md +7 -1
- package/dist/app-api.d.ts +14 -5
- package/dist/app-api.js +36 -16
- package/dist/catalog.js +48 -24
- package/dist/describe.js +11 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/normalization.d.ts +0 -1
- package/dist/normalization.js +24 -27
- package/dist/openapi.js +25 -14
- package/dist/rendering.d.ts +8 -14
- package/dist/rendering.js +87 -144
- package/dist/schemas.d.ts +1 -0
- package/dist/schemas.js +4 -6
- package/dist/search.d.ts +2 -3
- package/dist/search.js +43 -40
- package/docs/api/index.md +167 -168
- package/docs/api/openapi.md +1 -1
- package/package.json +2 -2
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:
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
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:
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
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
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
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
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
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
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
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:
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
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:
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
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:
|
|
568
|
-
output:
|
|
547
|
+
input: ...;
|
|
548
|
+
output: ...;
|
|
569
549
|
}>;
|
|
570
550
|
}>;
|
|
571
551
|
}>, Readonly<{
|
|
572
552
|
~standard: Readonly<{
|
|
573
553
|
jsonSchema: Readonly<{
|
|
574
|
-
input:
|
|
575
|
-
output:
|
|
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:
|
|
613
|
-
jsonSchema: Readonly<...>;
|
|
614
|
-
}>;
|
|
585
|
+
input: ZodLazy<ZodCustom<Readonly<{
|
|
586
|
+
~standard: ...;
|
|
615
587
|
}>, Readonly<{
|
|
616
|
-
~standard:
|
|
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
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
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
|
-
|
|
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 ( \| `"
|
|
764
|
-
`"agent.
|
|
765
|
-
\| `"
|
|
766
|
-
`"
|
|
767
|
-
|
|
768
|
-
`"
|
|
769
|
-
`"
|
|
770
|
-
`"
|
|
771
|
-
`"
|
|
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
|
|
package/docs/api/openapi.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/forage",
|
|
3
|
-
"version": "0.1
|
|
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.
|
|
32
|
+
"@fungi.computer/puffball": "0.3.0",
|
|
33
33
|
"yaml": "2.9.0",
|
|
34
34
|
"zod": "4.4.3"
|
|
35
35
|
},
|