@ixo/decision-oracle 0.0.0-stage → 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/LICENSE +201 -0
- package/README.md +794 -2
- package/dist/act.d.ts +87 -0
- package/dist/act.d.ts.map +1 -0
- package/dist/act.js +20 -0
- package/dist/act.js.map +1 -0
- package/dist/app.d.ts +22 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +128 -0
- package/dist/app.js.map +1 -0
- package/dist/c2pa.wasm +0 -0
- package/dist/cli/commands/api.d.ts +50 -0
- package/dist/cli/commands/api.d.ts.map +1 -0
- package/dist/cli/commands/api.js +737 -0
- package/dist/cli/commands/api.js.map +1 -0
- package/dist/cli/commands/create-collection.d.ts +40 -0
- package/dist/cli/commands/create-collection.d.ts.map +1 -0
- package/dist/cli/commands/create-collection.js +318 -0
- package/dist/cli/commands/create-collection.js.map +1 -0
- package/dist/cli/commands/create-deed.d.ts +31 -0
- package/dist/cli/commands/create-deed.d.ts.map +1 -0
- package/dist/cli/commands/create-deed.js +208 -0
- package/dist/cli/commands/create-deed.js.map +1 -0
- package/dist/cli/commands/delegation.d.ts +26 -0
- package/dist/cli/commands/delegation.d.ts.map +1 -0
- package/dist/cli/commands/delegation.js +162 -0
- package/dist/cli/commands/delegation.js.map +1 -0
- package/dist/cli/commands/derive.d.ts +22 -0
- package/dist/cli/commands/derive.d.ts.map +1 -0
- package/dist/cli/commands/derive.js +53 -0
- package/dist/cli/commands/derive.js.map +1 -0
- package/dist/cli/commands/engine.d.ts +25 -0
- package/dist/cli/commands/engine.d.ts.map +1 -0
- package/dist/cli/commands/engine.js +107 -0
- package/dist/cli/commands/engine.js.map +1 -0
- package/dist/cli/commands/erase.d.ts +17 -0
- package/dist/cli/commands/erase.d.ts.map +1 -0
- package/dist/cli/commands/erase.js +117 -0
- package/dist/cli/commands/erase.js.map +1 -0
- package/dist/cli/commands/facts-run.d.ts +30 -0
- package/dist/cli/commands/facts-run.d.ts.map +1 -0
- package/dist/cli/commands/facts-run.js +409 -0
- package/dist/cli/commands/facts-run.js.map +1 -0
- package/dist/cli/commands/facts-scaffold.d.ts +22 -0
- package/dist/cli/commands/facts-scaffold.d.ts.map +1 -0
- package/dist/cli/commands/facts-scaffold.js +208 -0
- package/dist/cli/commands/facts-scaffold.js.map +1 -0
- package/dist/cli/commands/init.d.ts +18 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +34 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/login.d.ts +9 -0
- package/dist/cli/commands/login.d.ts.map +1 -0
- package/dist/cli/commands/login.js +16 -0
- package/dist/cli/commands/login.js.map +1 -0
- package/dist/cli/commands/logout.d.ts +10 -0
- package/dist/cli/commands/logout.d.ts.map +1 -0
- package/dist/cli/commands/logout.js +28 -0
- package/dist/cli/commands/logout.js.map +1 -0
- package/dist/cli/commands/manifest.d.ts +12 -0
- package/dist/cli/commands/manifest.d.ts.map +1 -0
- package/dist/cli/commands/manifest.js +48 -0
- package/dist/cli/commands/manifest.js.map +1 -0
- package/dist/cli/commands/oracle-init.d.ts +48 -0
- package/dist/cli/commands/oracle-init.d.ts.map +1 -0
- package/dist/cli/commands/oracle-init.js +1122 -0
- package/dist/cli/commands/oracle-init.js.map +1 -0
- package/dist/cli/commands/org.d.ts +28 -0
- package/dist/cli/commands/org.d.ts.map +1 -0
- package/dist/cli/commands/org.js +309 -0
- package/dist/cli/commands/org.js.map +1 -0
- package/dist/cli/commands/protocol-review.d.ts +20 -0
- package/dist/cli/commands/protocol-review.d.ts.map +1 -0
- package/dist/cli/commands/protocol-review.js +162 -0
- package/dist/cli/commands/protocol-review.js.map +1 -0
- package/dist/cli/commands/publish-protocol.d.ts +43 -0
- package/dist/cli/commands/publish-protocol.d.ts.map +1 -0
- package/dist/cli/commands/publish-protocol.js +345 -0
- package/dist/cli/commands/publish-protocol.js.map +1 -0
- package/dist/cli/commands/register.d.ts +16 -0
- package/dist/cli/commands/register.d.ts.map +1 -0
- package/dist/cli/commands/register.js +54 -0
- package/dist/cli/commands/register.js.map +1 -0
- package/dist/cli/commands/relink.d.ts +11 -0
- package/dist/cli/commands/relink.d.ts.map +1 -0
- package/dist/cli/commands/relink.js +36 -0
- package/dist/cli/commands/relink.js.map +1 -0
- package/dist/cli/commands/rubric-fetch-form.d.ts +16 -0
- package/dist/cli/commands/rubric-fetch-form.d.ts.map +1 -0
- package/dist/cli/commands/rubric-fetch-form.js +83 -0
- package/dist/cli/commands/rubric-fetch-form.js.map +1 -0
- package/dist/cli/commands/rubric-validate.d.ts +72 -0
- package/dist/cli/commands/rubric-validate.d.ts.map +1 -0
- package/dist/cli/commands/rubric-validate.js +163 -0
- package/dist/cli/commands/rubric-validate.js.map +1 -0
- package/dist/cli/commands/scan.d.ts +13 -0
- package/dist/cli/commands/scan.d.ts.map +1 -0
- package/dist/cli/commands/scan.js +39 -0
- package/dist/cli/commands/scan.js.map +1 -0
- package/dist/cli/commands/skills.d.ts +11 -0
- package/dist/cli/commands/skills.d.ts.map +1 -0
- package/dist/cli/commands/skills.js +19 -0
- package/dist/cli/commands/skills.js.map +1 -0
- package/dist/cli/commands/submit-claim.d.ts +25 -0
- package/dist/cli/commands/submit-claim.d.ts.map +1 -0
- package/dist/cli/commands/submit-claim.js +155 -0
- package/dist/cli/commands/submit-claim.js.map +1 -0
- package/dist/cli/index.d.ts +15 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +206 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/lib/agent-card-schema.d.ts +8 -0
- package/dist/cli/lib/agent-card-schema.d.ts.map +1 -0
- package/dist/cli/lib/agent-card-schema.js +169 -0
- package/dist/cli/lib/agent-card-schema.js.map +1 -0
- package/dist/cli/lib/ai-rest.d.ts +12 -0
- package/dist/cli/lib/ai-rest.d.ts.map +1 -0
- package/dist/cli/lib/ai-rest.js +36 -0
- package/dist/cli/lib/ai-rest.js.map +1 -0
- package/dist/cli/lib/args.d.ts +33 -0
- package/dist/cli/lib/args.d.ts.map +1 -0
- package/dist/cli/lib/args.js +24 -0
- package/dist/cli/lib/args.js.map +1 -0
- package/dist/cli/lib/authhub.d.ts +7 -0
- package/dist/cli/lib/authhub.d.ts.map +1 -0
- package/dist/cli/lib/authhub.js +210 -0
- package/dist/cli/lib/authhub.js.map +1 -0
- package/dist/cli/lib/chain.d.ts +264 -0
- package/dist/cli/lib/chain.d.ts.map +1 -0
- package/dist/cli/lib/chain.js +584 -0
- package/dist/cli/lib/chain.js.map +1 -0
- package/dist/cli/lib/devvars.d.ts +59 -0
- package/dist/cli/lib/devvars.d.ts.map +1 -0
- package/dist/cli/lib/devvars.js +206 -0
- package/dist/cli/lib/devvars.js.map +1 -0
- package/dist/cli/lib/engine.d.ts +54 -0
- package/dist/cli/lib/engine.d.ts.map +1 -0
- package/dist/cli/lib/engine.js +112 -0
- package/dist/cli/lib/engine.js.map +1 -0
- package/dist/cli/lib/identity-cards.d.ts +188 -0
- package/dist/cli/lib/identity-cards.d.ts.map +1 -0
- package/dist/cli/lib/identity-cards.js +261 -0
- package/dist/cli/lib/identity-cards.js.map +1 -0
- package/dist/cli/lib/matrix-account.d.ts +79 -0
- package/dist/cli/lib/matrix-account.d.ts.map +1 -0
- package/dist/cli/lib/matrix-account.js +228 -0
- package/dist/cli/lib/matrix-account.js.map +1 -0
- package/dist/cli/lib/oracle-account.d.ts +108 -0
- package/dist/cli/lib/oracle-account.d.ts.map +1 -0
- package/dist/cli/lib/oracle-account.js +207 -0
- package/dist/cli/lib/oracle-account.js.map +1 -0
- package/dist/cli/lib/project.d.ts +22 -0
- package/dist/cli/lib/project.d.ts.map +1 -0
- package/dist/cli/lib/project.js +62 -0
- package/dist/cli/lib/project.js.map +1 -0
- package/dist/cli/lib/session.d.ts +109 -0
- package/dist/cli/lib/session.d.ts.map +1 -0
- package/dist/cli/lib/session.js +354 -0
- package/dist/cli/lib/session.js.map +1 -0
- package/dist/cli/lib/workorder.d.ts +57 -0
- package/dist/cli/lib/workorder.d.ts.map +1 -0
- package/dist/cli/lib/workorder.js +101 -0
- package/dist/cli/lib/workorder.js.map +1 -0
- package/dist/config.d.ts +221 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +431 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +88 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +9 -0
- package/dist/context.js.map +1 -0
- package/dist/contracts/api.d.ts +3367 -0
- package/dist/contracts/api.d.ts.map +1 -0
- package/dist/contracts/api.js +1303 -0
- package/dist/contracts/api.js.map +1 -0
- package/dist/contracts/capabilities.d.ts +126 -0
- package/dist/contracts/capabilities.d.ts.map +1 -0
- package/dist/contracts/capabilities.js +164 -0
- package/dist/contracts/capabilities.js.map +1 -0
- package/dist/contracts/claim-source.d.ts +98 -0
- package/dist/contracts/claim-source.d.ts.map +1 -0
- package/dist/contracts/claim-source.js +17 -0
- package/dist/contracts/claim-source.js.map +1 -0
- package/dist/contracts/errors.d.ts +150 -0
- package/dist/contracts/errors.d.ts.map +1 -0
- package/dist/contracts/errors.js +121 -0
- package/dist/contracts/errors.js.map +1 -0
- package/dist/contracts/index.d.ts +15 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +11 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/payment-gate.d.ts +129 -0
- package/dist/contracts/payment-gate.d.ts.map +1 -0
- package/dist/contracts/payment-gate.js +24 -0
- package/dist/contracts/payment-gate.js.map +1 -0
- package/dist/contracts/start-api-claim.d.ts +90 -0
- package/dist/contracts/start-api-claim.d.ts.map +1 -0
- package/dist/contracts/start-api-claim.js +22 -0
- package/dist/contracts/start-api-claim.js.map +1 -0
- package/dist/contracts/webhooks.d.ts +1487 -0
- package/dist/contracts/webhooks.d.ts.map +1 -0
- package/dist/contracts/webhooks.js +71 -0
- package/dist/contracts/webhooks.js.map +1 -0
- package/dist/contracts/work-order.d.ts +29 -0
- package/dist/contracts/work-order.d.ts.map +1 -0
- package/dist/contracts/work-order.js +12 -0
- package/dist/contracts/work-order.js.map +1 -0
- package/dist/cron/ai-cost.d.ts +29 -0
- package/dist/cron/ai-cost.d.ts.map +1 -0
- package/dist/cron/ai-cost.js +80 -0
- package/dist/cron/ai-cost.js.map +1 -0
- package/dist/cron/api-lane.d.ts +39 -0
- package/dist/cron/api-lane.d.ts.map +1 -0
- package/dist/cron/api-lane.js +203 -0
- package/dist/cron/api-lane.js.map +1 -0
- package/dist/cron/backlog.d.ts +50 -0
- package/dist/cron/backlog.d.ts.map +1 -0
- package/dist/cron/backlog.js +115 -0
- package/dist/cron/backlog.js.map +1 -0
- package/dist/cron/billing.d.ts +11 -0
- package/dist/cron/billing.d.ts.map +1 -0
- package/dist/cron/billing.js +69 -0
- package/dist/cron/billing.js.map +1 -0
- package/dist/cron/collection.d.ts +50 -0
- package/dist/cron/collection.d.ts.map +1 -0
- package/dist/cron/collection.js +118 -0
- package/dist/cron/collection.js.map +1 -0
- package/dist/cron/funding.d.ts +16 -0
- package/dist/cron/funding.d.ts.map +1 -0
- package/dist/cron/funding.js +262 -0
- package/dist/cron/funding.js.map +1 -0
- package/dist/cron/payer-billing.d.ts +38 -0
- package/dist/cron/payer-billing.d.ts.map +1 -0
- package/dist/cron/payer-billing.js +119 -0
- package/dist/cron/payer-billing.js.map +1 -0
- package/dist/cron/scan.d.ts +43 -0
- package/dist/cron/scan.d.ts.map +1 -0
- package/dist/cron/scan.js +250 -0
- package/dist/cron/scan.js.map +1 -0
- package/dist/db/client.d.ts +14 -0
- package/dist/db/client.d.ts.map +1 -0
- package/dist/db/client.js +14 -0
- package/dist/db/client.js.map +1 -0
- package/dist/db/index.d.ts +7 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +7 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/schema.d.ts +6738 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +1433 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/define-oracle.d.ts +32 -0
- package/dist/define-oracle.d.ts.map +1 -0
- package/dist/define-oracle.js +80 -0
- package/dist/define-oracle.js.map +1 -0
- package/dist/dev-oracle.d.ts +9 -0
- package/dist/dev-oracle.d.ts.map +1 -0
- package/dist/dev-oracle.js +19 -0
- package/dist/dev-oracle.js.map +1 -0
- package/dist/dev-worker.d.ts +10 -0
- package/dist/dev-worker.d.ts.map +1 -0
- package/dist/dev-worker.js +12 -0
- package/dist/dev-worker.js.map +1 -0
- package/dist/env.d.ts +146 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +10 -0
- package/dist/env.js.map +1 -0
- package/dist/facts/exif.d.ts +43 -0
- package/dist/facts/exif.d.ts.map +1 -0
- package/dist/facts/exif.js +224 -0
- package/dist/facts/exif.js.map +1 -0
- package/dist/facts/fact.d.ts +62 -0
- package/dist/facts/fact.d.ts.map +1 -0
- package/dist/facts/fact.js +105 -0
- package/dist/facts/fact.js.map +1 -0
- package/dist/facts/geo.d.ts +55 -0
- package/dist/facts/geo.d.ts.map +1 -0
- package/dist/facts/geo.js +267 -0
- package/dist/facts/geo.js.map +1 -0
- package/dist/facts/index.d.ts +31 -0
- package/dist/facts/index.d.ts.map +1 -0
- package/dist/facts/index.js +27 -0
- package/dist/facts/index.js.map +1 -0
- package/dist/facts/linked-doc.d.ts +60 -0
- package/dist/facts/linked-doc.d.ts.map +1 -0
- package/dist/facts/linked-doc.js +101 -0
- package/dist/facts/linked-doc.js.map +1 -0
- package/dist/facts/types.d.ts +278 -0
- package/dist/facts/types.d.ts.map +1 -0
- package/dist/facts/types.js +19 -0
- package/dist/facts/types.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/api-lane/accept.d.ts +29 -0
- package/dist/lib/api-lane/accept.d.ts.map +1 -0
- package/dist/lib/api-lane/accept.js +218 -0
- package/dist/lib/api-lane/accept.js.map +1 -0
- package/dist/lib/api-lane/claim-list.d.ts +44 -0
- package/dist/lib/api-lane/claim-list.d.ts.map +1 -0
- package/dist/lib/api-lane/claim-list.js +92 -0
- package/dist/lib/api-lane/claim-list.js.map +1 -0
- package/dist/lib/api-lane/company.d.ts +56 -0
- package/dist/lib/api-lane/company.d.ts.map +1 -0
- package/dist/lib/api-lane/company.js +103 -0
- package/dist/lib/api-lane/company.js.map +1 -0
- package/dist/lib/api-lane/events.d.ts +21 -0
- package/dist/lib/api-lane/events.d.ts.map +1 -0
- package/dist/lib/api-lane/events.js +111 -0
- package/dist/lib/api-lane/events.js.map +1 -0
- package/dist/lib/api-lane/ids.d.ts +39 -0
- package/dist/lib/api-lane/ids.d.ts.map +1 -0
- package/dist/lib/api-lane/ids.js +78 -0
- package/dist/lib/api-lane/ids.js.map +1 -0
- package/dist/lib/api-lane/index.d.ts +16 -0
- package/dist/lib/api-lane/index.d.ts.map +1 -0
- package/dist/lib/api-lane/index.js +16 -0
- package/dist/lib/api-lane/index.js.map +1 -0
- package/dist/lib/api-lane/linked.d.ts +264 -0
- package/dist/lib/api-lane/linked.d.ts.map +1 -0
- package/dist/lib/api-lane/linked.js +272 -0
- package/dist/lib/api-lane/linked.js.map +1 -0
- package/dist/lib/api-lane/media-type.d.ts +15 -0
- package/dist/lib/api-lane/media-type.d.ts.map +1 -0
- package/dist/lib/api-lane/media-type.js +73 -0
- package/dist/lib/api-lane/media-type.js.map +1 -0
- package/dist/lib/api-lane/member-emails.d.ts +83 -0
- package/dist/lib/api-lane/member-emails.d.ts.map +1 -0
- package/dist/lib/api-lane/member-emails.js +213 -0
- package/dist/lib/api-lane/member-emails.js.map +1 -0
- package/dist/lib/api-lane/members.d.ts +42 -0
- package/dist/lib/api-lane/members.d.ts.map +1 -0
- package/dist/lib/api-lane/members.js +75 -0
- package/dist/lib/api-lane/members.js.map +1 -0
- package/dist/lib/api-lane/notify.d.ts +47 -0
- package/dist/lib/api-lane/notify.d.ts.map +1 -0
- package/dist/lib/api-lane/notify.js +240 -0
- package/dist/lib/api-lane/notify.js.map +1 -0
- package/dist/lib/api-lane/pause.d.ts +41 -0
- package/dist/lib/api-lane/pause.d.ts.map +1 -0
- package/dist/lib/api-lane/pause.js +155 -0
- package/dist/lib/api-lane/pause.js.map +1 -0
- package/dist/lib/api-lane/record.d.ts +76 -0
- package/dist/lib/api-lane/record.d.ts.map +1 -0
- package/dist/lib/api-lane/record.js +337 -0
- package/dist/lib/api-lane/record.js.map +1 -0
- package/dist/lib/api-lane/retention.d.ts +43 -0
- package/dist/lib/api-lane/retention.d.ts.map +1 -0
- package/dist/lib/api-lane/retention.js +176 -0
- package/dist/lib/api-lane/retention.js.map +1 -0
- package/dist/lib/api-lane/review.d.ts +76 -0
- package/dist/lib/api-lane/review.d.ts.map +1 -0
- package/dist/lib/api-lane/review.js +355 -0
- package/dist/lib/api-lane/review.js.map +1 -0
- package/dist/lib/api-lane/reviewers.d.ts +109 -0
- package/dist/lib/api-lane/reviewers.d.ts.map +1 -0
- package/dist/lib/api-lane/reviewers.js +755 -0
- package/dist/lib/api-lane/reviewers.js.map +1 -0
- package/dist/lib/api-lane/source-delete.d.ts +16 -0
- package/dist/lib/api-lane/source-delete.d.ts.map +1 -0
- package/dist/lib/api-lane/source-delete.js +50 -0
- package/dist/lib/api-lane/source-delete.js.map +1 -0
- package/dist/lib/api-lane/source.d.ts +19 -0
- package/dist/lib/api-lane/source.d.ts.map +1 -0
- package/dist/lib/api-lane/source.js +226 -0
- package/dist/lib/api-lane/source.js.map +1 -0
- package/dist/lib/api-lane/submitter.d.ts +22 -0
- package/dist/lib/api-lane/submitter.d.ts.map +1 -0
- package/dist/lib/api-lane/submitter.js +34 -0
- package/dist/lib/api-lane/submitter.js.map +1 -0
- package/dist/lib/api-lane/timeline.d.ts +20 -0
- package/dist/lib/api-lane/timeline.d.ts.map +1 -0
- package/dist/lib/api-lane/timeline.js +23 -0
- package/dist/lib/api-lane/timeline.js.map +1 -0
- package/dist/lib/api-lane/webhook-crypto.d.ts +44 -0
- package/dist/lib/api-lane/webhook-crypto.d.ts.map +1 -0
- package/dist/lib/api-lane/webhook-crypto.js +103 -0
- package/dist/lib/api-lane/webhook-crypto.js.map +1 -0
- package/dist/lib/api-lane/webhooks.d.ts +117 -0
- package/dist/lib/api-lane/webhooks.d.ts.map +1 -0
- package/dist/lib/api-lane/webhooks.js +503 -0
- package/dist/lib/api-lane/webhooks.js.map +1 -0
- package/dist/lib/archive.d.ts +64 -0
- package/dist/lib/archive.d.ts.map +1 -0
- package/dist/lib/archive.js +305 -0
- package/dist/lib/archive.js.map +1 -0
- package/dist/lib/bech32.d.ts +8 -0
- package/dist/lib/bech32.d.ts.map +1 -0
- package/dist/lib/bech32.js +39 -0
- package/dist/lib/bech32.js.map +1 -0
- package/dist/lib/claim-erase.d.ts +22 -0
- package/dist/lib/claim-erase.d.ts.map +1 -0
- package/dist/lib/claim-erase.js +44 -0
- package/dist/lib/claim-erase.js.map +1 -0
- package/dist/lib/cursor.d.ts +11 -0
- package/dist/lib/cursor.d.ts.map +1 -0
- package/dist/lib/cursor.js +20 -0
- package/dist/lib/cursor.js.map +1 -0
- package/dist/lib/email/send.d.ts +43 -0
- package/dist/lib/email/send.d.ts.map +1 -0
- package/dist/lib/email/send.js +71 -0
- package/dist/lib/email/send.js.map +1 -0
- package/dist/lib/email/template.d.ts +217 -0
- package/dist/lib/email/template.d.ts.map +1 -0
- package/dist/lib/email/template.js +713 -0
- package/dist/lib/email/template.js.map +1 -0
- package/dist/lib/engine/adr36.d.ts +56 -0
- package/dist/lib/engine/adr36.d.ts.map +1 -0
- package/dist/lib/engine/adr36.js +76 -0
- package/dist/lib/engine/adr36.js.map +1 -0
- package/dist/lib/engine/client.d.ts +162 -0
- package/dist/lib/engine/client.d.ts.map +1 -0
- package/dist/lib/engine/client.js +473 -0
- package/dist/lib/engine/client.js.map +1 -0
- package/dist/lib/engine/types.d.ts +1356 -0
- package/dist/lib/engine/types.d.ts.map +1 -0
- package/dist/lib/engine/types.js +562 -0
- package/dist/lib/engine/types.js.map +1 -0
- package/dist/lib/errors.d.ts +73 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +96 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/facts/builder.d.ts +88 -0
- package/dist/lib/facts/builder.d.ts.map +1 -0
- package/dist/lib/facts/builder.js +239 -0
- package/dist/lib/facts/builder.js.map +1 -0
- package/dist/lib/facts/ctx.d.ts +34 -0
- package/dist/lib/facts/ctx.d.ts.map +1 -0
- package/dist/lib/facts/ctx.js +51 -0
- package/dist/lib/facts/ctx.js.map +1 -0
- package/dist/lib/facts/expected.d.ts +23 -0
- package/dist/lib/facts/expected.d.ts.map +1 -0
- package/dist/lib/facts/expected.js +16 -0
- package/dist/lib/facts/expected.js.map +1 -0
- package/dist/lib/facts/fact-cache.d.ts +469 -0
- package/dist/lib/facts/fact-cache.d.ts.map +1 -0
- package/dist/lib/facts/fact-cache.js +52 -0
- package/dist/lib/facts/fact-cache.js.map +1 -0
- package/dist/lib/facts/factset.d.ts +608 -0
- package/dist/lib/facts/factset.d.ts.map +1 -0
- package/dist/lib/facts/factset.js +226 -0
- package/dist/lib/facts/factset.js.map +1 -0
- package/dist/lib/facts/producer.d.ts +190 -0
- package/dist/lib/facts/producer.d.ts.map +1 -0
- package/dist/lib/facts/producer.js +15 -0
- package/dist/lib/facts/producer.js.map +1 -0
- package/dist/lib/facts/runner.d.ts +111 -0
- package/dist/lib/facts/runner.d.ts.map +1 -0
- package/dist/lib/facts/runner.js +438 -0
- package/dist/lib/facts/runner.js.map +1 -0
- package/dist/lib/facts/stock/ai-check.d.ts +100 -0
- package/dist/lib/facts/stock/ai-check.d.ts.map +1 -0
- package/dist/lib/facts/stock/ai-check.js +526 -0
- package/dist/lib/facts/stock/ai-check.js.map +1 -0
- package/dist/lib/facts/stock/ai-inputs.d.ts +104 -0
- package/dist/lib/facts/stock/ai-inputs.d.ts.map +1 -0
- package/dist/lib/facts/stock/ai-inputs.js +332 -0
- package/dist/lib/facts/stock/ai-inputs.js.map +1 -0
- package/dist/lib/facts/stock/ai-provider.d.ts +105 -0
- package/dist/lib/facts/stock/ai-provider.d.ts.map +1 -0
- package/dist/lib/facts/stock/ai-provider.js +250 -0
- package/dist/lib/facts/stock/ai-provider.js.map +1 -0
- package/dist/lib/facts/stock/ai-unique.d.ts +85 -0
- package/dist/lib/facts/stock/ai-unique.d.ts.map +1 -0
- package/dist/lib/facts/stock/ai-unique.js +208 -0
- package/dist/lib/facts/stock/ai-unique.js.map +1 -0
- package/dist/lib/facts/stock/archive.d.ts +63 -0
- package/dist/lib/facts/stock/archive.d.ts.map +1 -0
- package/dist/lib/facts/stock/archive.js +349 -0
- package/dist/lib/facts/stock/archive.js.map +1 -0
- package/dist/lib/facts/stock/c2pa-trust-list.d.ts +16 -0
- package/dist/lib/facts/stock/c2pa-trust-list.d.ts.map +1 -0
- package/dist/lib/facts/stock/c2pa-trust-list.js +637 -0
- package/dist/lib/facts/stock/c2pa-trust-list.js.map +1 -0
- package/dist/lib/facts/stock/c2pa.d.ts +56 -0
- package/dist/lib/facts/stock/c2pa.d.ts.map +1 -0
- package/dist/lib/facts/stock/c2pa.js +234 -0
- package/dist/lib/facts/stock/c2pa.js.map +1 -0
- package/dist/lib/facts/stock/call.d.ts +91 -0
- package/dist/lib/facts/stock/call.d.ts.map +1 -0
- package/dist/lib/facts/stock/call.js +281 -0
- package/dist/lib/facts/stock/call.js.map +1 -0
- package/dist/lib/facts/stock/capability.d.ts +39 -0
- package/dist/lib/facts/stock/capability.d.ts.map +1 -0
- package/dist/lib/facts/stock/capability.js +59 -0
- package/dist/lib/facts/stock/capability.js.map +1 -0
- package/dist/lib/facts/stock/ext-source.d.ts +51 -0
- package/dist/lib/facts/stock/ext-source.d.ts.map +1 -0
- package/dist/lib/facts/stock/ext-source.js +201 -0
- package/dist/lib/facts/stock/ext-source.js.map +1 -0
- package/dist/lib/facts/stock/frequency-fact.d.ts +59 -0
- package/dist/lib/facts/stock/frequency-fact.d.ts.map +1 -0
- package/dist/lib/facts/stock/frequency-fact.js +86 -0
- package/dist/lib/facts/stock/frequency-fact.js.map +1 -0
- package/dist/lib/facts/stock/frequency.d.ts +32 -0
- package/dist/lib/facts/stock/frequency.d.ts.map +1 -0
- package/dist/lib/facts/stock/frequency.js +48 -0
- package/dist/lib/facts/stock/frequency.js.map +1 -0
- package/dist/lib/facts/stock/index.d.ts +27 -0
- package/dist/lib/facts/stock/index.d.ts.map +1 -0
- package/dist/lib/facts/stock/index.js +28 -0
- package/dist/lib/facts/stock/index.js.map +1 -0
- package/dist/lib/facts/stock/normalize.d.ts +45 -0
- package/dist/lib/facts/stock/normalize.d.ts.map +1 -0
- package/dist/lib/facts/stock/normalize.js +135 -0
- package/dist/lib/facts/stock/normalize.js.map +1 -0
- package/dist/lib/facts/stock/phash.d.ts +55 -0
- package/dist/lib/facts/stock/phash.d.ts.map +1 -0
- package/dist/lib/facts/stock/phash.js +256 -0
- package/dist/lib/facts/stock/phash.js.map +1 -0
- package/dist/lib/facts/stock/rule-defaults.d.ts +72 -0
- package/dist/lib/facts/stock/rule-defaults.d.ts.map +1 -0
- package/dist/lib/facts/stock/rule-defaults.js +55 -0
- package/dist/lib/facts/stock/rule-defaults.js.map +1 -0
- package/dist/lib/facts/stock/send.d.ts +52 -0
- package/dist/lib/facts/stock/send.d.ts.map +1 -0
- package/dist/lib/facts/stock/send.js +148 -0
- package/dist/lib/facts/stock/send.js.map +1 -0
- package/dist/lib/facts/stock/unique-score.d.ts +138 -0
- package/dist/lib/facts/stock/unique-score.d.ts.map +1 -0
- package/dist/lib/facts/stock/unique-score.js +257 -0
- package/dist/lib/facts/stock/unique-score.js.map +1 -0
- package/dist/lib/facts/stock/unique-store.d.ts +420 -0
- package/dist/lib/facts/stock/unique-store.d.ts.map +1 -0
- package/dist/lib/facts/stock/unique-store.js +328 -0
- package/dist/lib/facts/stock/unique-store.js.map +1 -0
- package/dist/lib/facts/stock/unique.d.ts +35 -0
- package/dist/lib/facts/stock/unique.d.ts.map +1 -0
- package/dist/lib/facts/stock/unique.js +327 -0
- package/dist/lib/facts/stock/unique.js.map +1 -0
- package/dist/lib/facts/tools.d.ts +57 -0
- package/dist/lib/facts/tools.d.ts.map +1 -0
- package/dist/lib/facts/tools.js +325 -0
- package/dist/lib/facts/tools.js.map +1 -0
- package/dist/lib/facts/validate.d.ts +33 -0
- package/dist/lib/facts/validate.d.ts.map +1 -0
- package/dist/lib/facts/validate.js +137 -0
- package/dist/lib/facts/validate.js.map +1 -0
- package/dist/lib/hash.d.ts +44 -0
- package/dist/lib/hash.d.ts.map +1 -0
- package/dist/lib/hash.js +80 -0
- package/dist/lib/hash.js.map +1 -0
- package/dist/lib/http/client.d.ts +113 -0
- package/dist/lib/http/client.d.ts.map +1 -0
- package/dist/lib/http/client.js +330 -0
- package/dist/lib/http/client.js.map +1 -0
- package/dist/lib/ids.d.ts +17 -0
- package/dist/lib/ids.d.ts.map +1 -0
- package/dist/lib/ids.js +26 -0
- package/dist/lib/ids.js.map +1 -0
- package/dist/lib/ixo/attachments.d.ts +116 -0
- package/dist/lib/ixo/attachments.d.ts.map +1 -0
- package/dist/lib/ixo/attachments.js +290 -0
- package/dist/lib/ixo/attachments.js.map +1 -0
- package/dist/lib/ixo/authz.d.ts +40 -0
- package/dist/lib/ixo/authz.d.ts.map +1 -0
- package/dist/lib/ixo/authz.js +113 -0
- package/dist/lib/ixo/authz.js.map +1 -0
- package/dist/lib/ixo/blocksync/index.d.ts +90 -0
- package/dist/lib/ixo/blocksync/index.d.ts.map +1 -0
- package/dist/lib/ixo/blocksync/index.js +251 -0
- package/dist/lib/ixo/blocksync/index.js.map +1 -0
- package/dist/lib/ixo/blocksync/queries.d.ts +15 -0
- package/dist/lib/ixo/blocksync/queries.d.ts.map +1 -0
- package/dist/lib/ixo/blocksync/queries.js +144 -0
- package/dist/lib/ixo/blocksync/queries.js.map +1 -0
- package/dist/lib/ixo/blocksync/types.d.ts +184 -0
- package/dist/lib/ixo/blocksync/types.d.ts.map +1 -0
- package/dist/lib/ixo/blocksync/types.js +108 -0
- package/dist/lib/ixo/blocksync/types.js.map +1 -0
- package/dist/lib/ixo/cellnode.d.ts +35 -0
- package/dist/lib/ixo/cellnode.d.ts.map +1 -0
- package/dist/lib/ixo/cellnode.js +43 -0
- package/dist/lib/ixo/cellnode.js.map +1 -0
- package/dist/lib/ixo/chain-write.d.ts +130 -0
- package/dist/lib/ixo/chain-write.d.ts.map +1 -0
- package/dist/lib/ixo/chain-write.js +460 -0
- package/dist/lib/ixo/chain-write.js.map +1 -0
- package/dist/lib/ixo/chain.d.ts +1046 -0
- package/dist/lib/ixo/chain.d.ts.map +1 -0
- package/dist/lib/ixo/chain.js +279 -0
- package/dist/lib/ixo/chain.js.map +1 -0
- package/dist/lib/ixo/claim-bot.d.ts +49 -0
- package/dist/lib/ixo/claim-bot.d.ts.map +1 -0
- package/dist/lib/ixo/claim-bot.js +141 -0
- package/dist/lib/ixo/claim-bot.js.map +1 -0
- package/dist/lib/ixo/delegation-verify.d.ts +44 -0
- package/dist/lib/ixo/delegation-verify.d.ts.map +1 -0
- package/dist/lib/ixo/delegation-verify.js +101 -0
- package/dist/lib/ixo/delegation-verify.js.map +1 -0
- package/dist/lib/ixo/did.d.ts +13 -0
- package/dist/lib/ixo/did.d.ts.map +1 -0
- package/dist/lib/ixo/did.js +85 -0
- package/dist/lib/ixo/did.js.map +1 -0
- package/dist/lib/ixo/grant-chain.d.ts +55 -0
- package/dist/lib/ixo/grant-chain.d.ts.map +1 -0
- package/dist/lib/ixo/grant-chain.js +185 -0
- package/dist/lib/ixo/grant-chain.js.map +1 -0
- package/dist/lib/ixo/identity.d.ts +32 -0
- package/dist/lib/ixo/identity.d.ts.map +1 -0
- package/dist/lib/ixo/identity.js +104 -0
- package/dist/lib/ixo/identity.js.map +1 -0
- package/dist/lib/ixo/index.d.ts +118 -0
- package/dist/lib/ixo/index.d.ts.map +1 -0
- package/dist/lib/ixo/index.js +395 -0
- package/dist/lib/ixo/index.js.map +1 -0
- package/dist/lib/ixo/payment.d.ts +104 -0
- package/dist/lib/ixo/payment.d.ts.map +1 -0
- package/dist/lib/ixo/payment.js +136 -0
- package/dist/lib/ixo/payment.js.map +1 -0
- package/dist/lib/ixo/ucan-store.d.ts +30 -0
- package/dist/lib/ixo/ucan-store.d.ts.map +1 -0
- package/dist/lib/ixo/ucan-store.js +134 -0
- package/dist/lib/ixo/ucan-store.js.map +1 -0
- package/dist/lib/ixo/ucan.d.ts +96 -0
- package/dist/lib/ixo/ucan.d.ts.map +1 -0
- package/dist/lib/ixo/ucan.js +216 -0
- package/dist/lib/ixo/ucan.js.map +1 -0
- package/dist/lib/ixo/verified-read.d.ts +43 -0
- package/dist/lib/ixo/verified-read.d.ts.map +1 -0
- package/dist/lib/ixo/verified-read.js +73 -0
- package/dist/lib/ixo/verified-read.js.map +1 -0
- package/dist/lib/ixo/vfs.d.ts +27 -0
- package/dist/lib/ixo/vfs.d.ts.map +1 -0
- package/dist/lib/ixo/vfs.js +42 -0
- package/dist/lib/ixo/vfs.js.map +1 -0
- package/dist/lib/ixo/web-did.d.ts +7 -0
- package/dist/lib/ixo/web-did.d.ts.map +1 -0
- package/dist/lib/ixo/web-did.js +9 -0
- package/dist/lib/ixo/web-did.js.map +1 -0
- package/dist/lib/logger.d.ts +34 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +126 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/matrix/api.d.ts +57 -0
- package/dist/lib/matrix/api.d.ts.map +1 -0
- package/dist/lib/matrix/api.js +58 -0
- package/dist/lib/matrix/api.js.map +1 -0
- package/dist/lib/matrix/client.d.ts +41 -0
- package/dist/lib/matrix/client.d.ts.map +1 -0
- package/dist/lib/matrix/client.js +104 -0
- package/dist/lib/matrix/client.js.map +1 -0
- package/dist/lib/matrix/deliver.d.ts +224 -0
- package/dist/lib/matrix/deliver.d.ts.map +1 -0
- package/dist/lib/matrix/deliver.js +788 -0
- package/dist/lib/matrix/deliver.js.map +1 -0
- package/dist/lib/matrix/events.d.ts +114 -0
- package/dist/lib/matrix/events.d.ts.map +1 -0
- package/dist/lib/matrix/events.js +143 -0
- package/dist/lib/matrix/events.js.map +1 -0
- package/dist/lib/matrix/mxid.d.ts +24 -0
- package/dist/lib/matrix/mxid.d.ts.map +1 -0
- package/dist/lib/matrix/mxid.js +47 -0
- package/dist/lib/matrix/mxid.js.map +1 -0
- package/dist/lib/metrics.d.ts +105 -0
- package/dist/lib/metrics.d.ts.map +1 -0
- package/dist/lib/metrics.js +204 -0
- package/dist/lib/metrics.js.map +1 -0
- package/dist/lib/oauth/approvals.d.ts +160 -0
- package/dist/lib/oauth/approvals.d.ts.map +1 -0
- package/dist/lib/oauth/approvals.js +273 -0
- package/dist/lib/oauth/approvals.js.map +1 -0
- package/dist/lib/oauth/standing.d.ts +152 -0
- package/dist/lib/oauth/standing.d.ts.map +1 -0
- package/dist/lib/oauth/standing.js +299 -0
- package/dist/lib/oauth/standing.js.map +1 -0
- package/dist/lib/oauth/token.d.ts +60 -0
- package/dist/lib/oauth/token.d.ts.map +1 -0
- package/dist/lib/oauth/token.js +129 -0
- package/dist/lib/oauth/token.js.map +1 -0
- package/dist/lib/payments/extend.d.ts +42 -0
- package/dist/lib/payments/extend.d.ts.map +1 -0
- package/dist/lib/payments/extend.js +98 -0
- package/dist/lib/payments/extend.js.map +1 -0
- package/dist/lib/payments/facilitator.d.ts +220 -0
- package/dist/lib/payments/facilitator.d.ts.map +1 -0
- package/dist/lib/payments/facilitator.js +451 -0
- package/dist/lib/payments/facilitator.js.map +1 -0
- package/dist/lib/payments/gate.d.ts +207 -0
- package/dist/lib/payments/gate.d.ts.map +1 -0
- package/dist/lib/payments/gate.js +481 -0
- package/dist/lib/payments/gate.js.map +1 -0
- package/dist/lib/payments/header-seal.d.ts +33 -0
- package/dist/lib/payments/header-seal.d.ts.map +1 -0
- package/dist/lib/payments/header-seal.js +76 -0
- package/dist/lib/payments/header-seal.js.map +1 -0
- package/dist/lib/payments/index.d.ts +12 -0
- package/dist/lib/payments/index.d.ts.map +1 -0
- package/dist/lib/payments/index.js +11 -0
- package/dist/lib/payments/index.js.map +1 -0
- package/dist/lib/payments/price.d.ts +25 -0
- package/dist/lib/payments/price.d.ts.map +1 -0
- package/dist/lib/payments/price.js +43 -0
- package/dist/lib/payments/price.js.map +1 -0
- package/dist/lib/payments/reconcile.d.ts +77 -0
- package/dist/lib/payments/reconcile.d.ts.map +1 -0
- package/dist/lib/payments/reconcile.js +317 -0
- package/dist/lib/payments/reconcile.js.map +1 -0
- package/dist/lib/payments/refund.d.ts +34 -0
- package/dist/lib/payments/refund.d.ts.map +1 -0
- package/dist/lib/payments/refund.js +123 -0
- package/dist/lib/payments/refund.js.map +1 -0
- package/dist/lib/payments/review-billing.d.ts +222 -0
- package/dist/lib/payments/review-billing.d.ts.map +1 -0
- package/dist/lib/payments/review-billing.js +609 -0
- package/dist/lib/payments/review-billing.js.map +1 -0
- package/dist/lib/payments/settle.d.ts +44 -0
- package/dist/lib/payments/settle.d.ts.map +1 -0
- package/dist/lib/payments/settle.js +306 -0
- package/dist/lib/payments/settle.js.map +1 -0
- package/dist/lib/payments/terms.d.ts +27 -0
- package/dist/lib/payments/terms.d.ts.map +1 -0
- package/dist/lib/payments/terms.js +21 -0
- package/dist/lib/payments/terms.js.map +1 -0
- package/dist/lib/payouts.d.ts +20 -0
- package/dist/lib/payouts.d.ts.map +1 -0
- package/dist/lib/payouts.js +30 -0
- package/dist/lib/payouts.js.map +1 -0
- package/dist/lib/readiness.d.ts +42 -0
- package/dist/lib/readiness.d.ts.map +1 -0
- package/dist/lib/readiness.js +130 -0
- package/dist/lib/readiness.js.map +1 -0
- package/dist/lib/redact.d.ts +23 -0
- package/dist/lib/redact.d.ts.map +1 -0
- package/dist/lib/redact.js +67 -0
- package/dist/lib/redact.js.map +1 -0
- package/dist/lib/register.d.ts +85 -0
- package/dist/lib/register.d.ts.map +1 -0
- package/dist/lib/register.js +390 -0
- package/dist/lib/register.js.map +1 -0
- package/dist/lib/review/attestation.d.ts +92 -0
- package/dist/lib/review/attestation.d.ts.map +1 -0
- package/dist/lib/review/attestation.js +264 -0
- package/dist/lib/review/attestation.js.map +1 -0
- package/dist/lib/review/reviewer-grant.d.ts +146 -0
- package/dist/lib/review/reviewer-grant.d.ts.map +1 -0
- package/dist/lib/review/reviewer-grant.js +359 -0
- package/dist/lib/review/reviewer-grant.js.map +1 -0
- package/dist/lib/review/tasks.d.ts +18 -0
- package/dist/lib/review/tasks.d.ts.map +1 -0
- package/dist/lib/review/tasks.js +36 -0
- package/dist/lib/review/tasks.js.map +1 -0
- package/dist/lib/sentry.d.ts +89 -0
- package/dist/lib/sentry.d.ts.map +1 -0
- package/dist/lib/sentry.js +284 -0
- package/dist/lib/sentry.js.map +1 -0
- package/dist/lib/spans.d.ts +14 -0
- package/dist/lib/spans.d.ts.map +1 -0
- package/dist/lib/spans.js +28 -0
- package/dist/lib/spans.js.map +1 -0
- package/dist/lib/tracing.d.ts +31 -0
- package/dist/lib/tracing.d.ts.map +1 -0
- package/dist/lib/tracing.js +66 -0
- package/dist/lib/tracing.js.map +1 -0
- package/dist/lib/ttl-cache.d.ts +26 -0
- package/dist/lib/ttl-cache.d.ts.map +1 -0
- package/dist/lib/ttl-cache.js +61 -0
- package/dist/lib/ttl-cache.js.map +1 -0
- package/dist/lib/validator.d.ts +19 -0
- package/dist/lib/validator.d.ts.map +1 -0
- package/dist/lib/validator.js +32 -0
- package/dist/lib/validator.js.map +1 -0
- package/dist/lib/work-order/form.d.ts +40 -0
- package/dist/lib/work-order/form.d.ts.map +1 -0
- package/dist/lib/work-order/form.js +316 -0
- package/dist/lib/work-order/form.js.map +1 -0
- package/dist/lib/work-order/index.d.ts +20 -0
- package/dist/lib/work-order/index.d.ts.map +1 -0
- package/dist/lib/work-order/index.js +66 -0
- package/dist/lib/work-order/index.js.map +1 -0
- package/dist/middleware/api/audit.d.ts +9 -0
- package/dist/middleware/api/audit.d.ts.map +1 -0
- package/dist/middleware/api/audit.js +38 -0
- package/dist/middleware/api/audit.js.map +1 -0
- package/dist/middleware/api/auth.d.ts +29 -0
- package/dist/middleware/api/auth.d.ts.map +1 -0
- package/dist/middleware/api/auth.js +105 -0
- package/dist/middleware/api/auth.js.map +1 -0
- package/dist/middleware/api/console.d.ts +92 -0
- package/dist/middleware/api/console.d.ts.map +1 -0
- package/dist/middleware/api/console.js +446 -0
- package/dist/middleware/api/console.js.map +1 -0
- package/dist/middleware/api/errors.d.ts +48 -0
- package/dist/middleware/api/errors.d.ts.map +1 -0
- package/dist/middleware/api/errors.js +133 -0
- package/dist/middleware/api/errors.js.map +1 -0
- package/dist/middleware/api/idempotency.d.ts +23 -0
- package/dist/middleware/api/idempotency.d.ts.map +1 -0
- package/dist/middleware/api/idempotency.js +158 -0
- package/dist/middleware/api/idempotency.js.map +1 -0
- package/dist/middleware/api/keys.d.ts +14 -0
- package/dist/middleware/api/keys.d.ts.map +1 -0
- package/dist/middleware/api/keys.js +66 -0
- package/dist/middleware/api/keys.js.map +1 -0
- package/dist/middleware/api/membership.d.ts +32 -0
- package/dist/middleware/api/membership.d.ts.map +1 -0
- package/dist/middleware/api/membership.js +48 -0
- package/dist/middleware/api/membership.js.map +1 -0
- package/dist/middleware/api/oauth.d.ts +28 -0
- package/dist/middleware/api/oauth.d.ts.map +1 -0
- package/dist/middleware/api/oauth.js +109 -0
- package/dist/middleware/api/oauth.js.map +1 -0
- package/dist/middleware/api/rate-limit.d.ts +23 -0
- package/dist/middleware/api/rate-limit.d.ts.map +1 -0
- package/dist/middleware/api/rate-limit.js +70 -0
- package/dist/middleware/api/rate-limit.js.map +1 -0
- package/dist/middleware/api/types.d.ts +92 -0
- package/dist/middleware/api/types.d.ts.map +1 -0
- package/dist/middleware/api/types.js +7 -0
- package/dist/middleware/api/types.js.map +1 -0
- package/dist/middleware/api/wait.d.ts +21 -0
- package/dist/middleware/api/wait.d.ts.map +1 -0
- package/dist/middleware/api/wait.js +85 -0
- package/dist/middleware/api/wait.js.map +1 -0
- package/dist/middleware/capability.d.ts +32 -0
- package/dist/middleware/capability.d.ts.map +1 -0
- package/dist/middleware/capability.js +113 -0
- package/dist/middleware/capability.js.map +1 -0
- package/dist/middleware/database.d.ts +14 -0
- package/dist/middleware/database.d.ts.map +1 -0
- package/dist/middleware/database.js +18 -0
- package/dist/middleware/database.js.map +1 -0
- package/dist/middleware/error-handler.d.ts +13 -0
- package/dist/middleware/error-handler.d.ts.map +1 -0
- package/dist/middleware/error-handler.js +127 -0
- package/dist/middleware/error-handler.js.map +1 -0
- package/dist/middleware/observability.d.ts +32 -0
- package/dist/middleware/observability.d.ts.map +1 -0
- package/dist/middleware/observability.js +134 -0
- package/dist/middleware/observability.js.map +1 -0
- package/dist/middleware/rate-limit.d.ts +16 -0
- package/dist/middleware/rate-limit.d.ts.map +1 -0
- package/dist/middleware/rate-limit.js +56 -0
- package/dist/middleware/rate-limit.js.map +1 -0
- package/dist/middleware/ucan-auth.d.ts +39 -0
- package/dist/middleware/ucan-auth.d.ts.map +1 -0
- package/dist/middleware/ucan-auth.js +278 -0
- package/dist/middleware/ucan-auth.js.map +1 -0
- package/dist/networks.d.ts +34 -0
- package/dist/networks.d.ts.map +1 -0
- package/dist/networks.js +49 -0
- package/dist/networks.js.map +1 -0
- package/dist/oracle.d.ts +193 -0
- package/dist/oracle.d.ts.map +1 -0
- package/dist/oracle.js +245 -0
- package/dist/oracle.js.map +1 -0
- package/dist/routes/health.d.ts +16 -0
- package/dist/routes/health.d.ts.map +1 -0
- package/dist/routes/health.js +29 -0
- package/dist/routes/health.js.map +1 -0
- package/dist/routes/v1/admin.d.ts +18 -0
- package/dist/routes/v1/admin.d.ts.map +1 -0
- package/dist/routes/v1/admin.js +101 -0
- package/dist/routes/v1/admin.js.map +1 -0
- package/dist/routes/v1/api/admin-claims.d.ts +14 -0
- package/dist/routes/v1/api/admin-claims.d.ts.map +1 -0
- package/dist/routes/v1/api/admin-claims.js +82 -0
- package/dist/routes/v1/api/admin-claims.js.map +1 -0
- package/dist/routes/v1/api/admin-facilitator.d.ts +20 -0
- package/dist/routes/v1/api/admin-facilitator.d.ts.map +1 -0
- package/dist/routes/v1/api/admin-facilitator.js +64 -0
- package/dist/routes/v1/api/admin-facilitator.js.map +1 -0
- package/dist/routes/v1/api/admin.d.ts +9 -0
- package/dist/routes/v1/api/admin.d.ts.map +1 -0
- package/dist/routes/v1/api/admin.js +110 -0
- package/dist/routes/v1/api/admin.js.map +1 -0
- package/dist/routes/v1/api/audit.d.ts +8 -0
- package/dist/routes/v1/api/audit.d.ts.map +1 -0
- package/dist/routes/v1/api/audit.js +56 -0
- package/dist/routes/v1/api/audit.js.map +1 -0
- package/dist/routes/v1/api/batch.d.ts +17 -0
- package/dist/routes/v1/api/batch.d.ts.map +1 -0
- package/dist/routes/v1/api/batch.js +192 -0
- package/dist/routes/v1/api/batch.js.map +1 -0
- package/dist/routes/v1/api/claims-read.d.ts +43 -0
- package/dist/routes/v1/api/claims-read.d.ts.map +1 -0
- package/dist/routes/v1/api/claims-read.js +123 -0
- package/dist/routes/v1/api/claims-read.js.map +1 -0
- package/dist/routes/v1/api/claims.d.ts +131 -0
- package/dist/routes/v1/api/claims.d.ts.map +1 -0
- package/dist/routes/v1/api/claims.js +407 -0
- package/dist/routes/v1/api/claims.js.map +1 -0
- package/dist/routes/v1/api/collections-link.d.ts +14 -0
- package/dist/routes/v1/api/collections-link.d.ts.map +1 -0
- package/dist/routes/v1/api/collections-link.js +97 -0
- package/dist/routes/v1/api/collections-link.js.map +1 -0
- package/dist/routes/v1/api/export.d.ts +48 -0
- package/dist/routes/v1/api/export.d.ts.map +1 -0
- package/dist/routes/v1/api/export.js +251 -0
- package/dist/routes/v1/api/export.js.map +1 -0
- package/dist/routes/v1/api/index.d.ts +16 -0
- package/dist/routes/v1/api/index.d.ts.map +1 -0
- package/dist/routes/v1/api/index.js +68 -0
- package/dist/routes/v1/api/index.js.map +1 -0
- package/dist/routes/v1/api/keys.d.ts +9 -0
- package/dist/routes/v1/api/keys.d.ts.map +1 -0
- package/dist/routes/v1/api/keys.js +95 -0
- package/dist/routes/v1/api/keys.js.map +1 -0
- package/dist/routes/v1/api/me.d.ts +21 -0
- package/dist/routes/v1/api/me.d.ts.map +1 -0
- package/dist/routes/v1/api/me.js +122 -0
- package/dist/routes/v1/api/me.js.map +1 -0
- package/dist/routes/v1/api/members.d.ts +17 -0
- package/dist/routes/v1/api/members.d.ts.map +1 -0
- package/dist/routes/v1/api/members.js +406 -0
- package/dist/routes/v1/api/members.js.map +1 -0
- package/dist/routes/v1/api/meta.d.ts +12 -0
- package/dist/routes/v1/api/meta.d.ts.map +1 -0
- package/dist/routes/v1/api/meta.js +59 -0
- package/dist/routes/v1/api/meta.js.map +1 -0
- package/dist/routes/v1/api/openapi.gen.d.ts +2 -0
- package/dist/routes/v1/api/openapi.gen.d.ts.map +1 -0
- package/dist/routes/v1/api/openapi.gen.js +7 -0
- package/dist/routes/v1/api/openapi.gen.js.map +1 -0
- package/dist/routes/v1/api/protocols.d.ts +22 -0
- package/dist/routes/v1/api/protocols.d.ts.map +1 -0
- package/dist/routes/v1/api/protocols.js +153 -0
- package/dist/routes/v1/api/protocols.js.map +1 -0
- package/dist/routes/v1/api/review-billing.d.ts +18 -0
- package/dist/routes/v1/api/review-billing.d.ts.map +1 -0
- package/dist/routes/v1/api/review-billing.js +196 -0
- package/dist/routes/v1/api/review-billing.js.map +1 -0
- package/dist/routes/v1/api/review.d.ts +30 -0
- package/dist/routes/v1/api/review.d.ts.map +1 -0
- package/dist/routes/v1/api/review.js +302 -0
- package/dist/routes/v1/api/review.js.map +1 -0
- package/dist/routes/v1/api/sources.d.ts +10 -0
- package/dist/routes/v1/api/sources.d.ts.map +1 -0
- package/dist/routes/v1/api/sources.js +293 -0
- package/dist/routes/v1/api/sources.js.map +1 -0
- package/dist/routes/v1/api/uploads.d.ts +37 -0
- package/dist/routes/v1/api/uploads.d.ts.map +1 -0
- package/dist/routes/v1/api/uploads.js +414 -0
- package/dist/routes/v1/api/uploads.js.map +1 -0
- package/dist/routes/v1/api/views.d.ts +18 -0
- package/dist/routes/v1/api/views.d.ts.map +1 -0
- package/dist/routes/v1/api/views.js +95 -0
- package/dist/routes/v1/api/views.js.map +1 -0
- package/dist/routes/v1/api/webhooks.d.ts +14 -0
- package/dist/routes/v1/api/webhooks.d.ts.map +1 -0
- package/dist/routes/v1/api/webhooks.js +282 -0
- package/dist/routes/v1/api/webhooks.js.map +1 -0
- package/dist/routes/v1/api/work-orders.d.ts +45 -0
- package/dist/routes/v1/api/work-orders.d.ts.map +1 -0
- package/dist/routes/v1/api/work-orders.js +171 -0
- package/dist/routes/v1/api/work-orders.js.map +1 -0
- package/dist/routes/v1/claims.d.ts +21 -0
- package/dist/routes/v1/claims.d.ts.map +1 -0
- package/dist/routes/v1/claims.js +153 -0
- package/dist/routes/v1/claims.js.map +1 -0
- package/dist/routes/v1/collections.d.ts +45 -0
- package/dist/routes/v1/collections.d.ts.map +1 -0
- package/dist/routes/v1/collections.js +201 -0
- package/dist/routes/v1/collections.js.map +1 -0
- package/dist/routes/v1/index.d.ts +13 -0
- package/dist/routes/v1/index.d.ts.map +1 -0
- package/dist/routes/v1/index.js +41 -0
- package/dist/routes/v1/index.js.map +1 -0
- package/dist/routes/v1/info.d.ts +14 -0
- package/dist/routes/v1/info.d.ts.map +1 -0
- package/dist/routes/v1/info.js +75 -0
- package/dist/routes/v1/info.js.map +1 -0
- package/dist/routes/v1/mcp/index.d.ts +33 -0
- package/dist/routes/v1/mcp/index.d.ts.map +1 -0
- package/dist/routes/v1/mcp/index.js +252 -0
- package/dist/routes/v1/mcp/index.js.map +1 -0
- package/dist/routes/v1/mcp/oauth.d.ts +27 -0
- package/dist/routes/v1/mcp/oauth.d.ts.map +1 -0
- package/dist/routes/v1/mcp/oauth.js +500 -0
- package/dist/routes/v1/mcp/oauth.js.map +1 -0
- package/dist/routes/v1/mcp/tools.d.ts +71 -0
- package/dist/routes/v1/mcp/tools.d.ts.map +1 -0
- package/dist/routes/v1/mcp/tools.js +432 -0
- package/dist/routes/v1/mcp/tools.js.map +1 -0
- package/dist/routes/v1/mcp/ui.d.ts +45 -0
- package/dist/routes/v1/mcp/ui.d.ts.map +1 -0
- package/dist/routes/v1/mcp/ui.js +454 -0
- package/dist/routes/v1/mcp/ui.js.map +1 -0
- package/dist/routes/v1/oauth.d.ts +29 -0
- package/dist/routes/v1/oauth.d.ts.map +1 -0
- package/dist/routes/v1/oauth.js +256 -0
- package/dist/routes/v1/oauth.js.map +1 -0
- package/dist/routes/v1/reviewers.d.ts +22 -0
- package/dist/routes/v1/reviewers.d.ts.map +1 -0
- package/dist/routes/v1/reviewers.js +165 -0
- package/dist/routes/v1/reviewers.js.map +1 -0
- package/dist/routes/v1/reviews.d.ts +38 -0
- package/dist/routes/v1/reviews.d.ts.map +1 -0
- package/dist/routes/v1/reviews.js +234 -0
- package/dist/routes/v1/reviews.js.map +1 -0
- package/dist/routes/v1/shared.d.ts +586 -0
- package/dist/routes/v1/shared.d.ts.map +1 -0
- package/dist/routes/v1/shared.js +229 -0
- package/dist/routes/v1/shared.js.map +1 -0
- package/dist/routes/well-known.d.ts +15 -0
- package/dist/routes/well-known.d.ts.map +1 -0
- package/dist/routes/well-known.js +35 -0
- package/dist/routes/well-known.js.map +1 -0
- package/dist/runtime.d.ts +100 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +144 -0
- package/dist/runtime.js.map +1 -0
- package/dist/testing/fake-tools.d.ts +104 -0
- package/dist/testing/fake-tools.d.ts.map +1 -0
- package/dist/testing/fake-tools.js +213 -0
- package/dist/testing/fake-tools.js.map +1 -0
- package/dist/testing/index.d.ts +54 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +104 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/samples.d.ts +70 -0
- package/dist/testing/samples.d.ts.map +1 -0
- package/dist/testing/samples.js +92 -0
- package/dist/testing/samples.js.map +1 -0
- package/dist/workflows/claim-ingest.d.ts +250 -0
- package/dist/workflows/claim-ingest.d.ts.map +1 -0
- package/dist/workflows/claim-ingest.js +1020 -0
- package/dist/workflows/claim-ingest.js.map +1 -0
- package/dist/workflows/claim-source.d.ts +25 -0
- package/dist/workflows/claim-source.d.ts.map +1 -0
- package/dist/workflows/claim-source.js +107 -0
- package/dist/workflows/claim-source.js.map +1 -0
- package/dist/workflows/review-complete.d.ts +82 -0
- package/dist/workflows/review-complete.d.ts.map +1 -0
- package/dist/workflows/review-complete.js +455 -0
- package/dist/workflows/review-complete.js.map +1 -0
- package/dist/workflows/steps.d.ts +125 -0
- package/dist/workflows/steps.d.ts.map +1 -0
- package/dist/workflows/steps.js +325 -0
- package/dist/workflows/steps.js.map +1 -0
- package/docs/api.md +2595 -0
- package/docs/guide.md +1525 -0
- package/migrations/0000_init.sql +108 -0
- package/migrations/0001_review_attestation.sql +1 -0
- package/migrations/0002_decisions_facts.sql +1 -0
- package/migrations/0003_api_lane.sql +171 -0
- package/migrations/0004_api_v1_1.sql +19 -0
- package/migrations/0005_member_notify.sql +3 -0
- package/migrations/0006_source_collections.sql +16 -0
- package/migrations/0007_api_settlement.sql +27 -0
- package/migrations/0008_review_extend.sql +1 -0
- package/migrations/0009_card_refunds.sql +4 -0
- package/migrations/0010_even_scorpion.sql +16 -0
- package/migrations/0011_mcp_oauth.sql +27 -0
- package/migrations/0012_mcp_standing.sql +21 -0
- package/migrations/0013_unknown_krista_starr.sql +2 -0
- package/migrations/0014_last_carnage.sql +14 -0
- package/migrations/0015_company_authority.sql +26 -0
- package/migrations/0016_owner_only_links.sql +6 -0
- package/migrations/0017_organisations.sql +35 -0
- package/migrations/0018_remove_app_signed.sql +4 -0
- package/migrations/0019_submitted_via.sql +2 -0
- package/migrations/0020_drop_decision_to_pay.sql +4 -0
- package/migrations/0021_manual_erase.sql +25 -0
- package/migrations/0022_errored_facts.sql +1 -0
- package/migrations/0023_review_billing.sql +20 -0
- package/migrations/0024_pending_task_details.sql +1 -0
- package/migrations/meta/0000_snapshot.json +707 -0
- package/migrations/meta/0001_snapshot.json +714 -0
- package/migrations/meta/0002_snapshot.json +721 -0
- package/migrations/meta/0003_snapshot.json +1845 -0
- package/migrations/meta/0004_snapshot.json +1969 -0
- package/migrations/meta/0005_snapshot.json +1991 -0
- package/migrations/meta/0006_snapshot.json +2097 -0
- package/migrations/meta/0007_snapshot.json +2128 -0
- package/migrations/meta/0008_snapshot.json +2133 -0
- package/migrations/meta/0009_snapshot.json +2161 -0
- package/migrations/meta/0010_snapshot.json +2265 -0
- package/migrations/meta/0011_snapshot.json +2448 -0
- package/migrations/meta/0012_snapshot.json +2577 -0
- package/migrations/meta/0013_snapshot.json +2594 -0
- package/migrations/meta/0014_snapshot.json +2602 -0
- package/migrations/meta/0015_snapshot.json +2778 -0
- package/migrations/meta/0016_snapshot.json +2778 -0
- package/migrations/meta/0017_snapshot.json +2792 -0
- package/migrations/meta/0018_snapshot.json +2778 -0
- package/migrations/meta/0019_snapshot.json +2792 -0
- package/migrations/meta/0020_snapshot.json +2785 -0
- package/migrations/meta/0021_snapshot.json +2762 -0
- package/migrations/meta/0022_snapshot.json +2769 -0
- package/migrations/meta/0023_snapshot.json +2900 -0
- package/migrations/meta/0024_snapshot.json +2907 -0
- package/migrations/meta/_journal.json +181 -0
- package/openapi/decision-api.yaml +12204 -0
- package/package.json +123 -4
- package/skills/README.md +19 -0
- package/skills/add-openhands-support/SKILL.md +113 -0
- package/skills/create-collection/SKILL.md +199 -0
- package/skills/create-collection/reference/claims-stack.md +106 -0
- package/skills/create-collection/reference/collection.md +111 -0
- package/skills/create-oracle/SKILL.md +400 -0
- package/skills/create-rubric/SKILL.md +130 -0
- package/skills/create-rubric/reference/format-cheatsheet.md +186 -0
- package/skills/create-rubric/templates/claim-form.example.json +60 -0
- package/skills/decision-api-client/SKILL.md +236 -0
- package/skills/decision-api-oracle/SKILL.md +336 -0
- package/skills/publish-protocol/SKILL.md +151 -0
- package/skills/publish-protocol/reference/publishing.md +116 -0
- package/skills/reference/engine-contract.md +222 -0
- package/skills/write-facts/SKILL.md +221 -0
- package/skills/write-facts/reference/examples/http-vendor.ts +88 -0
- package/skills/write-facts/reference/examples/price-matches-agreement.ts +67 -0
- package/skills/write-facts/reference/facts-api.md +232 -0
- package/templates/project/.dev.vars.example +93 -0
- package/templates/project/.editorconfig +9 -0
- package/templates/project/CLAUDE.md +45 -0
- package/templates/project/README.md +199 -0
- package/templates/project/biome.json +37 -0
- package/templates/project/gitignore +29 -0
- package/templates/project/package.json +32 -0
- package/templates/project/src/facts/index.ts +19 -0
- package/templates/project/src/index.ts +25 -0
- package/templates/project/test/api-lane.test.ts +57 -0
- package/templates/project/test/facts.test.ts +14 -0
- package/templates/project/tsconfig.json +25 -0
- package/templates/project/vitest.config.ts +13 -0
- package/templates/project/wrangler.jsonc +446 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# The decision engine's contract (what the package codes against)
|
|
2
|
+
|
|
3
|
+
Background, not an interface you write code against. The package owns every call below; a
|
|
4
|
+
provider's handlers never see the engine except through `tools.agreement()` (the buyer statement)
|
|
5
|
+
and `bunx decision-oracle facts run --preview` (a decision, nothing persisted or billed). Read this when
|
|
6
|
+
you need to understand an error the oracle logged, or what the engine does with the facts you
|
|
7
|
+
produce.
|
|
8
|
+
|
|
9
|
+
## Auth + preconditions
|
|
10
|
+
|
|
11
|
+
- Every call is a UCAN invocation: `X-Auth-Type: ucan` + `Authorization: Bearer <invocation>`,
|
|
12
|
+
audience = the engine's `did:web` (`EVAL_ENGINE_HOSTNAME`). Issuer = `did:web:<ORACLE_HOSTNAME>`
|
|
13
|
+
— this oracle's own did:web key, self-signed, so no on-chain IID key is needed.
|
|
14
|
+
- Once, before the first decision (and again whenever the chain address changes), the oracle calls
|
|
15
|
+
`POST /v1/oracles/register` with `{ address, pubKey, signature, ownerDelegation }`:
|
|
16
|
+
- `address` — `ORACLE_ADDRESS`, the grantee of the collection's `EvaluateClaimAuthorization` and
|
|
17
|
+
the key that signs `MsgEvaluateClaim`;
|
|
18
|
+
- `signature` — an ADR-36 `sign/MsgSignData` by that secp256k1 key over the exact string
|
|
19
|
+
`decision-engine:register:<principal.did>:<address>`. The engine verifies it, checks
|
|
20
|
+
pubKey → address, and upserts the row keyed by the DID. Because `principal.address` is
|
|
21
|
+
meaningless for a did:web, this proof is what binds DID ⇄ chain address.
|
|
22
|
+
- `ownerDelegation` — `OWNER_DELEGATION_CAR`, forwarded verbatim: the oracle OWNER's
|
|
23
|
+
`subscriptions/read` on `ixo:subscriptions` plus `billing/pay` bound to THIS oracle's did:web,
|
|
24
|
+
the two capabilities the engine needs to find and bill the owner's subscription. Nothing renews
|
|
25
|
+
it, so `bunx decision-oracle delegation --for engine` defaults to 100 years — an expired CAR is a
|
|
26
|
+
refusal, not a retry: mint a short one with `--days` only if you will re-mint and re-register
|
|
27
|
+
before it lapses.
|
|
28
|
+
- Everything downstream keys on what registration bound: the decided-once row is
|
|
29
|
+
(claimId, registered DID), the per-decision grant check uses the PROVEN address, and the receipt
|
|
30
|
+
names `{ did, address, factsDigest }`.
|
|
31
|
+
- Per decision the engine checks this oracle holds the on-chain `EvaluateClaimAuthorization` for the
|
|
32
|
+
collection. Decided once per (claimId, oracleDid): re-POSTing returns the stored row, which is what
|
|
33
|
+
makes the call safe inside a durable workflow step.
|
|
34
|
+
|
|
35
|
+
## POST /v1/decisions — the request
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
{ subject: { kind: "claim", claimId, collectionId, protocolDid },
|
|
39
|
+
rubric: { id: <sha256 hex pin, read off the protocol's #rub proof> },
|
|
40
|
+
facts: <FactSet v1>,
|
|
41
|
+
payout?: { version: 1, amountPath, currency | currencyPath | asset+decimals },
|
|
42
|
+
claimContent } — REQUIRED
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- `claimContent` binds the decision to the claim it judged:
|
|
46
|
+
`{ kind: "chain", cid, document? }` (`document` = base64 of the EXACT stored bytes, sent only when
|
|
47
|
+
the read lane CID-verified them) or `{ kind: "api", body }` (the content as stored at accept).
|
|
48
|
+
The engine checks the CID, the bytes, the answers and the attachments against the FactSet. A
|
|
49
|
+
claim read only from the Matrix claim bot, or a document over 256 KiB, goes without `document`.
|
|
50
|
+
- `payout` is sent for a protocol in `OracleConfig.payouts` (outside the facts); the payee is derived
|
|
51
|
+
by the engine, never sent.
|
|
52
|
+
|
|
53
|
+
FactSet v1 is a STRICT object (an unknown key is a 400):
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
version: 1
|
|
57
|
+
frozenAt: ISO — the ONE clock read; MUST equal ctx.now
|
|
58
|
+
answers: {…credentialSubject…}
|
|
59
|
+
attachments: [{ question, name, mediaType, cid|null, size|null }]
|
|
60
|
+
ctx: { now: ISO, collection: { startDate|null, endDate|null },
|
|
61
|
+
claim: { submitter|null, submitterAddress|null, submissionDate|null, useIntent? } }
|
|
62
|
+
ext: { name → { status:"ok", value: boolean|number, reason: string|null, confidence?, transcript? }
|
|
63
|
+
| { status:"error", onError:"review"|"reject", detail, transcript? } }
|
|
64
|
+
ai: { name → { status:"ok", value: boolean, reason: string|null, failedRules: string[], score: 0..100, confidence?, transcript? }
|
|
65
|
+
| { status:"error", onError, detail, transcript? } }
|
|
66
|
+
unique?: {…} frequency?: {…}
|
|
67
|
+
settings: { allowAiChecks: boolean, allowImageChecks: boolean } — REQUIRED
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`derived` and `formProof` are never sent — the engine computes both from chain. Those `ext`/`ai`
|
|
71
|
+
entries are exactly what a handler returns, after the runner normalized it.
|
|
72
|
+
|
|
73
|
+
## Errors
|
|
74
|
+
|
|
75
|
+
| code | meaning | what the package does |
|
|
76
|
+
| --- | --- | --- |
|
|
77
|
+
| 403 `NOT_REGISTERED` | never registered | register (ADR-36 proof) once, retry |
|
|
78
|
+
| 400 `INVALID_ADDRESS_PROOF` | register proof bad | non-retryable; `ORACLE_SECP_MNEMONIC` ≠ `ORACLE_ADDRESS` — a config bug |
|
|
79
|
+
| 403 `NO_EVALUATE_GRANT` | not hired for this collection | retry once (a grant may have just landed), then pause the collection |
|
|
80
|
+
| 402 `INSUFFICIENT_CREDITS` | the OWNER's credits are exhausted | pause every watched collection, log `details.manageSubscriptionUrl`; the cron resumes when `/me` says ok |
|
|
81
|
+
| 402 `NO_SUBSCRIPTION` (register) | the delegated owner has no subscription | non-retryable; the owner subscribes in the portal, then register again |
|
|
82
|
+
| 403 `DELEGATION_NOT_FOR_ORACLE` (register) | the CAR's `billing/pay` names a different oracle | non-retryable; re-mint with `--oracle did:web:<this host>` |
|
|
83
|
+
| 400 `BAD_REQUEST` (register, naming `ownerDelegation`) | the CAR is malformed, mis-addressed or expired | non-retryable; re-mint, then register again |
|
|
84
|
+
| 409 `RUBRIC_PIN_MISMATCH` | our pin ≠ the chain's `#rub` proof | invalidate the cached manifest, re-read, rebuild, retry once |
|
|
85
|
+
| 409 `STALE_REVIEW` | the review answered against a stale digest | refetch the decision, ask the reviewer again |
|
|
86
|
+
| 409 `CONTENT_MISMATCH` | `claimContent` doesn't match the claim (`details.reason` names the check) | non-retryable. Decide: a `decisions` row `status: content_mismatch`, `chainStatus: skipped`, the ingest fails and alerts. Fold: `foldError` |
|
|
87
|
+
| 413 `PAYLOAD_TOO_LARGE` | the body (6 MiB) or the decoded `document` (2 MiB) is over the cap | non-retryable. Decide: a `decisions` row `status: payload_too_large`, `chainStatus: skipped`, the ingest fails and alerts. Fold: `foldError` |
|
|
88
|
+
| 400 `REVIEWER_GRANT_INVALID` | the fold's `reviewerGrant` is absent (the decision has a company), malformed, mis-signed, expired or mis-scoped | non-retryable; `foldError` — the reviewer answers again with a valid grant (the chain reviewer-grant routes land with CA-M5a) |
|
|
89
|
+
| 403 `REVIEWER_NOT_AUTHORIZED` | the grant's root is not a current controller, or an oracle/evaluator is in the chain | non-retryable; `foldError` — ask a company reviewer |
|
|
90
|
+
| 400 `VALIDATION` | the facts' shape is wrong | non-retryable; a producer bug — fails loudly |
|
|
91
|
+
| 429 `RATE_LIMITED` | the engine's per-IP limiter | retryable; the step backs off (`Retry-After` honoured) |
|
|
92
|
+
| 503 `UNAVAILABLE` | a Blocksync/chain blip | retry (the step retries) |
|
|
93
|
+
|
|
94
|
+
An unusable rubric is NOT an error: `200` with `decision.status = "unusable"`.
|
|
95
|
+
|
|
96
|
+
## Billing
|
|
97
|
+
|
|
98
|
+
The engine bills a **flat rate per decision** from its live rate card; it runs no AI, so a decision's
|
|
99
|
+
price never depends on what the facts cost this oracle to produce. It bills the oracle OWNER's
|
|
100
|
+
credits — never the collection owner's, never this oracle's own wallet: one fee claim per decision,
|
|
101
|
+
into the owner's oracle claims collection (the subscription
|
|
102
|
+
`ownerDelegation` proved at register). Folds are free. `GET /v1/oracles/me`'s `billingStatus` says
|
|
103
|
+
when a paused oracle is `ok` again; the scan cron asks once per tick while anything is paused
|
|
104
|
+
`engine-credits` and resumes them all. `admin-unfunded` (the collection admin's chain account cannot
|
|
105
|
+
pay the evaluation leg) is package-side only — the engine never sees it.
|
|
106
|
+
|
|
107
|
+
## Response
|
|
108
|
+
|
|
109
|
+
```text
|
|
110
|
+
{ subject, rubricId,
|
|
111
|
+
decision: { status, verdict, class, evaluationStatus, action, totalBps, gates, criteria, pendingTasks, reasons },
|
|
112
|
+
explanation, factsDigest, resultDigest,
|
|
113
|
+
receipt: { cid, jws } | null, // approved + a payout block ⇒ also a DecisionToPayCredential with decision.binding
|
|
114
|
+
decisionToPayRefused?: "NO_PAYEE", // a payout scope with no derivable payee: still 200, no binding
|
|
115
|
+
traceId,
|
|
116
|
+
billing: { totalMicroUsd } | null, // the flat rate for this decision; null on preview, verify and folds
|
|
117
|
+
preferences: { id, digest } | null } // the engine-side preferences it applied; the oracle sends none
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
`decision.status` is one of `decided` / `pending_review` / `unusable`. `receipt` is null ONLY for
|
|
121
|
+
`pending_review` (it is minted after the fold); `decided` and `unusable` both carry one — an
|
|
122
|
+
`unusable` receipt proves the engine refused and why, in codes. The package stores both `cid` and
|
|
123
|
+
`jws` on the decision row, signs `MsgEvaluateClaim` only for `decided`, and puts the receipt CID in
|
|
124
|
+
`verification_proof`. Receipts resolve publicly at the engine's `GET /v1/receipts/:cid`.
|
|
125
|
+
|
|
126
|
+
## Human review
|
|
127
|
+
|
|
128
|
+
The engine cannot fold from its stored trace alone (answers are never persisted), so the package
|
|
129
|
+
re-pulls the claim body by CID — byte-identical from a CID-verified store; a bot-lane re-pull goes
|
|
130
|
+
without `document` — and posts `POST /v1/reviews/:claimId` with
|
|
131
|
+
`{ answeredAgainst, answers, reviewerDid, attestation, claim: { answers }, payout?, claimContent, reviewerGrant? }`.
|
|
132
|
+
`claimContent` is required and must name the decision's content (else `409 CONTENT_MISMATCH`);
|
|
133
|
+
`reviewerGrant` (a base64 CAR of the reviewer's delegation chain) is required when the decision has a
|
|
134
|
+
company.
|
|
135
|
+
The engine rebuilds the wire FactSet from its trace plus those answers and requires `factsDigest` to
|
|
136
|
+
match. **No fact handler runs again, and nothing is re-bought**: a fold is the same frozen facts with
|
|
137
|
+
the reviewer's answers folded in. Deterministic refusals (`404`, `403`, `409 STALE_REVIEW`,
|
|
138
|
+
`400 BAD_REQUEST`, `409 FACTS_MISMATCH`, `422 REVIEW_INCOMPLETE`) are surfaced as `foldError`, never
|
|
139
|
+
retried. A fold can itself come back `unusable` when the claim form drifted since the decision.
|
|
140
|
+
|
|
141
|
+
`attestation` is the reviewer's own `ClaimReviewAttestation` credential (a compact JWS) over those
|
|
142
|
+
answers, taken by the package's `POST /v1/reviews/:claimId`, verified there against the keys the
|
|
143
|
+
chain publishes for the invoking principal, stored verbatim on `claim_reviews.attestationJws` and
|
|
144
|
+
forwarded unchanged — the engine verifies it again, because `reviewerDid` alone is only the
|
|
145
|
+
oracle's word. **It is required**: a review or fold without one is `ATTESTATION_REQUIRED` (400)
|
|
146
|
+
before any lookup or write, and there is no flag. A failed check refuses the review with
|
|
147
|
+
`ATTESTATION_INVALID` (400), `ATTESTATION_KEY_UNKNOWN` (400 — no such key, no such document, no
|
|
148
|
+
Ed25519 method, or a 4xx naming the did:web URL fetched: deterministic),
|
|
149
|
+
`ATTESTATION_ISSUER_MISMATCH` (403, checked before anything resolves), `ATTESTATION_MISMATCH` (400)
|
|
150
|
+
or `ATTESTATION_UNRESOLVABLE` (503 — the resolver could not reach its source, including a 4xx that
|
|
151
|
+
names no URL and any 408/429; retryable). Replacing a stored answer therefore takes another
|
|
152
|
+
signature. A fold's receipt names the attestation in `evidence` by CID, and the fold's Matrix card
|
|
153
|
+
edit says "Signed by \<did\>".
|
|
154
|
+
|
|
155
|
+
**Deploy order:** portal first (an older package's review body schema is not strict, so the extra
|
|
156
|
+
field is harmless), then engine and package TOGETHER — both require it, and the engine's fold body
|
|
157
|
+
schema is strict, so forwarding `attestation` to an older engine 400s every fold into `foldError`.
|
|
158
|
+
|
|
159
|
+
## Dev lane
|
|
160
|
+
|
|
161
|
+
`POST /v1/decisions/preview` — the same request, with `rubric` allowed as `{ doc }` and
|
|
162
|
+
`form { doc, proof }` inline. Nothing is persisted, billed or grant-checked. This is what
|
|
163
|
+
`bunx decision-oracle facts run --preview` calls, and what `bunx decision-oracle rubric validate` builds on.
|
|
164
|
+
|
|
165
|
+
## Agreements — the buyer statement
|
|
166
|
+
|
|
167
|
+
The engine stores a buyer statement per collection (and optionally per counterparty) and serves it
|
|
168
|
+
to hired oracles; it never interprets the document. `tools.agreement(counterparty?)` is that read:
|
|
169
|
+
omit the argument for the claim's own agent, pass an explicit `null` for the collection's own terms.
|
|
170
|
+
|
|
171
|
+
- `GET /v1/collections/:collectionId/agreements?counterparty=<address>` → the latest snapshot for
|
|
172
|
+
that counterparty, falling back to the collection-wide one; 404 if none (the tool returns `null`).
|
|
173
|
+
- Authorization is strict: the caller must be the collection owner or a registered oracle holding
|
|
174
|
+
the on-chain `EvaluateClaimAuthorization` for THAT collection.
|
|
175
|
+
- `counterparty` is compared as an exact lowercase bech32 string; the package lowercases for you.
|
|
176
|
+
- At decision time the engine records which snapshot was current on the trace and the receipt —
|
|
177
|
+
which is why a handler reads the agreement LAST, right before returning the fact it feeds.
|
|
178
|
+
|
|
179
|
+
## Fact coverage + the manifest
|
|
180
|
+
|
|
181
|
+
- **The engine is the sole validator of rubric ↔ form ↔ facts.** Right after binding it requires
|
|
182
|
+
every declared `ext` name in `facts.ext` and every `ai` name in `facts.ai` (ok or error), with ok
|
|
183
|
+
values of the declared kind: `expect: "boolean"` ⇒ a JS boolean, `expect: "score"` ⇒ an INTEGER
|
|
184
|
+
0..10000 basis points (rejected, never clamped). A miss is `200` + `status: "unusable"`, billed
|
|
185
|
+
zero, with `FACT_MISSING` / `FACT_KIND` in `decision.reasons`. Never a 400.
|
|
186
|
+
- `decide()` reads only `status`, `value` and `onError` of a fact; `score` / `reason` /
|
|
187
|
+
`failedRules` feed the trace and the explanation, and `transcript` is never read — which is why an
|
|
188
|
+
`ai.*` fact may come from any producer at all (a vendor model, OCR, a person).
|
|
189
|
+
- **The work order is the manifest**, public and unauthenticated:
|
|
190
|
+
`GET /v1/rubrics/manifest?protocol=<did>` (`bunx decision-oracle manifest <did>` prints it).
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
{ rubricId, formProof: { pinned, live, drifted },
|
|
194
|
+
ext: Record<name, { expect, onError, endpoint, audience, capability?, send, timeoutMs?, usedBy }>,
|
|
195
|
+
ai: Record<name, { expect: "boolean", onError, instructions, send, usedBy }>,
|
|
196
|
+
hasAiChecks, ctx: string[], fields: { path, kind }[], derived: { name, expression }[],
|
|
197
|
+
review: { tasks, taskDetails? },
|
|
198
|
+
unique: { ruleId } | null, frequency: { ruleId } | null,
|
|
199
|
+
sizeProbes: { path, maxSizeMB }[] }
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
An unbindable rubric answers `200 { status: "unusable", issues }` (`RUBRIC_UNRESOLVED` for a
|
|
203
|
+
missing `#rub`, `BIND_FORM_DRIFT` for a drifted `#vct`, else the binder's own issues). `onError` is
|
|
204
|
+
always present (the format's absent-means-review default is resolved by the engine); `ctx` lists
|
|
205
|
+
only the tokens the rules name; `fields[].path` are resolved catalog paths. The package caches a
|
|
206
|
+
usable manifest per protocol for 5 minutes and re-reads it on `RUBRIC_PIN_MISMATCH`; an unusable
|
|
207
|
+
one is never cached — it pauses the collection instead, so one broken rubric costs no claims.
|
|
208
|
+
- `POST /v1/rubrics/manifest` is the same answer for a rubric that is not on chain yet: post
|
|
209
|
+
`{ rubric: { doc }, form: { doc, proof } }`. That is how `bunx decision-oracle rubric validate` binds a
|
|
210
|
+
draft.
|
|
211
|
+
|
|
212
|
+
## Who calls out
|
|
213
|
+
|
|
214
|
+
1. **The engine never calls a rubric's `endpoint` and never calls a model.** `runDecision` is pure.
|
|
215
|
+
A missing `ext.*` / `ai.*` is `unusable`, never fetched.
|
|
216
|
+
2. **The engine's only per-decision outbound reads are deterministic inputs**: Blocksync for the
|
|
217
|
+
protocol's linked resources and the collection admin, the byte fetch of `#rub` / `#vct` (verified
|
|
218
|
+
against the on-chain proof), and the chain read of the oracle's `EvaluateClaimAuthorization`.
|
|
219
|
+
3. **A rubric's `endpoint` / `audience` / `send` / `instructions` are the protocol owner's
|
|
220
|
+
documentation of how a fact is expected to be produced.** Only a producer acts on them — the
|
|
221
|
+
stock lane, or your handler. The engine validates only that the fact exists with the declared
|
|
222
|
+
kind.
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: write-facts
|
|
3
|
+
description: Use when an oracle built on @ixo/decision-oracle needs a fact handler — "write the handler for ext.X / ai.Y", a protocol review that says a name needs custom code, wiring a vendor API or the buyer statement into a fact, testing handlers with runFacts/fakeTools, or debugging FACT_MISSING / FACT_KIND / a fact that came back error.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Writing fact handlers
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
A rubric asks for named facts; the engine publishes that list as a **manifest** (the work order);
|
|
11
|
+
this oracle produces one value per name and the engine decides. A handler is one function per name:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// src/facts/deliveryConfirmed.ts
|
|
15
|
+
import { type ExtHandler, fact } from "@ixo/decision-oracle/facts";
|
|
16
|
+
|
|
17
|
+
export const deliveryConfirmed: ExtHandler = async ({ send }, tools) => {
|
|
18
|
+
const res = await tools.http.json<{ status?: string }>(
|
|
19
|
+
`https://courier.example/deliveries/${send.reference}`,
|
|
20
|
+
);
|
|
21
|
+
if (!res.ok) return fact.error(`courier responded ${res.status}`);
|
|
22
|
+
return res.body?.status === "delivered"; // a plain boolean ⇒ an `ok` fact
|
|
23
|
+
};
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Everything a handler needs is handed to it: the claim, the resolved `send` map, the declaration for
|
|
27
|
+
this name, and `tools` — the package's own machinery (the stock lane, HTTP with retries and a
|
|
28
|
+
transcript, the AI judge, attachment bytes, C2PA, the chain reads, the buyer statement). A handler
|
|
29
|
+
imports nothing but types and `fact`, and runs in plain node under test.
|
|
30
|
+
|
|
31
|
+
**Core principle: a handler answers, it never decides.** It says what is true, or says it could not
|
|
32
|
+
find out. What a "could not find out" MEANS is the rubric's `onError`, stamped by the runner — never
|
|
33
|
+
the handler's to choose, and never quietly upgraded to a pass.
|
|
34
|
+
|
|
35
|
+
## When to use
|
|
36
|
+
|
|
37
|
+
- "Write the handler for `ext.<name>` / `ai.<name>`" — the `create-oracle` pipeline's step 3
|
|
38
|
+
- A `protocol review` that lists a name as needing custom code (a vendor API, a `~derived` ref, a
|
|
39
|
+
judge that is not the stock AI check)
|
|
40
|
+
- Testing handlers (`runFacts`, `fakeTools`), or a fact that came back `error` in a real run
|
|
41
|
+
- The engine answered `unusable` with `FACT_MISSING` / `FACT_KIND`
|
|
42
|
+
|
|
43
|
+
Not for: authoring the rubric that declares these names (`create-rubric`), or the surrounding
|
|
44
|
+
project setup — identity, register, deploy (`create-oracle`).
|
|
45
|
+
|
|
46
|
+
## The loop — one manifest entry at a time
|
|
47
|
+
|
|
48
|
+
### 1. Read the work order
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
bunx decision-oracle protocol review <protocol did> [--network devnet|testnet|mainnet] [--json]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
It prints every declared `ext` source and `ai` check with its `expect`, `onError`, `endpoint`,
|
|
55
|
+
`send` and instructions, and says which names the stock lanes already cover. **If the manifest comes
|
|
56
|
+
back `unusable`, stop** — the rubric does not bind to its form, so there is nothing to answer yet
|
|
57
|
+
(hand back to `create-rubric`).
|
|
58
|
+
|
|
59
|
+
### 2. Decide stock vs custom, per name
|
|
60
|
+
|
|
61
|
+
| Lane | Stock covers it when… | Write a handler when… |
|
|
62
|
+
| --- | --- | --- |
|
|
63
|
+
| `ext.<name>` | the declared endpoint accepts a self-signed UCAN POST (the resolved `send` + the claim body; audience the endpoint's own did:web, capability `ixo:external-source` — the rubric's `capability` is ignored) and answers the strict `{ valid: boolean }` / `{ score: 0..10000 }` contract | it is a vendor API with different auth or a different shape, it needs YOUR system or a secret, it is answered from the CHAIN (`tools.chain`) rather than an endpoint at all, or its `send` reads a `~derived` value (the stock lane always answers that `error`) |
|
|
64
|
+
| `ai.<name>` | a plain stock AI judgment against the rubric's own `instructions` is what the author meant | a different model or vision vendor is required, the inputs need re-slicing or pre-checking, or `send` reads a `~derived` value |
|
|
65
|
+
| `unique` | always — this oracle's D1 registries, perceptual hashing, near-text and the gray-zone judge | only a wholly different duplicate strategy (rare); the `UniqueFact` shape is still fixed |
|
|
66
|
+
| `frequency` | always — one Blocksync submission count | same as above |
|
|
67
|
+
| `sizeProbes` | always — the package probes the named roots itself | never; not a handler's concern |
|
|
68
|
+
| `derived[]` | the ENGINE computes these; no fact is ever produced for a `~name` | a `send` naming one forces a handler on whichever `ext`/`ai` reads it — `manifest.derived[].expression` is there for you |
|
|
69
|
+
|
|
70
|
+
Ask the provider the judgment calls, don't guess them: do you control that endpoint (can you make
|
|
71
|
+
it speak the stock contract), and is a stock AI check the judge the author meant?
|
|
72
|
+
|
|
73
|
+
### 3. Scaffold, then fill
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
bunx decision-oracle facts scaffold <protocol did> [--all] [--dir src/facts]
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Writes `src/facts/<name>.ts` for every name that needs a handler (`--all` for every declared name)
|
|
80
|
+
plus `test/facts/<name>.test.ts` beside it, and never overwrites a file that already exists. Add
|
|
81
|
+
each export to the table in `src/facts/index.ts` yourself. **Every stub returns
|
|
82
|
+
`fact.error("not implemented: <name>")`** — a visible failure that routes to the rubric's own
|
|
83
|
+
`onError`. Leave it that way until the real call works; never a placeholder `true`.
|
|
84
|
+
|
|
85
|
+
Fill one in with `reference/facts-api.md` open — it has every input field, every `tools` member with
|
|
86
|
+
a one-line example, and the return table. Two worked handlers to copy the shape of:
|
|
87
|
+
|
|
88
|
+
- `reference/examples/http-vendor.ts` — a vendor HTTP source: read `send`, call the declared
|
|
89
|
+
endpoint, map only what you understand, `fact.error` for the rest, `retryLater` on a 5xx.
|
|
90
|
+
- `reference/examples/price-matches-agreement.ts` — the buyer statement: guard the inputs, read
|
|
91
|
+
`tools.agreement()` LAST, tell a checked "no" (`ok(false)`) from an unanswerable one (`error`).
|
|
92
|
+
|
|
93
|
+
### 3b. One call, many facts
|
|
94
|
+
|
|
95
|
+
When several declared sources come out of **one** call — four criteria judged by a single
|
|
96
|
+
structured model call is the case — write them as a group, not as four handlers that each buy their
|
|
97
|
+
own completion:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
// src/facts/index.ts
|
|
101
|
+
export const facts = defineFacts({
|
|
102
|
+
ext: { speed }, // answered on its own
|
|
103
|
+
groups: [group(["quality", "price", "reliability", "trust"], workScores)],
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// src/facts/workScores.ts
|
|
107
|
+
export const workScores: GroupHandler = async ({ names, answers }, tools) => {
|
|
108
|
+
const res = await tools.http.json<Scores>(JUDGE_URL, { method: "POST", body: { …answers } });
|
|
109
|
+
// One call, one failure: every name it owed gets an error. Never a neutral score for a judgment
|
|
110
|
+
// that was never made.
|
|
111
|
+
if (!res.ok) return Object.fromEntries(names.map((n) => [n, fact.error(`judge ${res.status}`)]));
|
|
112
|
+
return { quality: …, price: …, reliability: …, trust: … }; // one fact per name
|
|
113
|
+
};
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The runner calls it **once** per claim (one slot in the fan-out cap) and holds every name it answers
|
|
117
|
+
to the same rules a single handler's fact meets: each carries its own declaration's `onError`, each
|
|
118
|
+
is cached on its own, and a throw freezes every name the call owed. Plus: a name you leave out
|
|
119
|
+
becomes that name's own `handler returned no fact for <name>` error (silence is not an answer), a
|
|
120
|
+
name nobody asked for is dropped with a `facts.group-extra-fact` warning, `tools.stock()` throws
|
|
121
|
+
inside a group (it names none of the group's sources), and one name answered by both a single and a
|
|
122
|
+
group — or by two groups — throws at **boot**.
|
|
123
|
+
|
|
124
|
+
A group is the sanctioned way to share one call between facts. A private cache inside a handler
|
|
125
|
+
still is not: the runner's own fact cache is the only cache (see the rules below).
|
|
126
|
+
|
|
127
|
+
### 4. Test in plain node
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
bun run test # vitest, node environment — no Worker, no network
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
const out = await runFacts(facts, {
|
|
135
|
+
claim: sampleClaim({ reference: "ABC" }),
|
|
136
|
+
manifest: sampleManifest({ ext: { deliveryConfirmed: { expect: "boolean", onError: "review" } } }),
|
|
137
|
+
tools: fakeTools({ http: { "https://courier.example/deliveries/ABC": { status: "delivered" } } }),
|
|
138
|
+
});
|
|
139
|
+
expect(out.issues).toEqual([]);
|
|
140
|
+
expect(out.ext.deliveryConfirmed).toMatchObject({ status: "ok", value: true });
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
`runFacts` is the same runner production runs, followed by the same `validateFacts` — `issues: []`
|
|
144
|
+
means the engine would accept this FactSet. Cover both halves of every handler: the answer, and the
|
|
145
|
+
failure it is most likely to meet (an unmatched URL in `fakeTools` is a network failure; an
|
|
146
|
+
`httpResponse(503, …)` is a bad status). A handler with only a happy-path test is not tested.
|
|
147
|
+
|
|
148
|
+
### 5. Run them against a real claim
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
bunx decision-oracle facts run --protocol <protocol did> --claim protocol/sample-claim.json \
|
|
152
|
+
[--collection <id>] [--preview] [--facts src/facts/index.ts] [--network devnet] [--json]
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Pulls the live manifest, runs your table over that claim, and prints the facts plus any validation
|
|
156
|
+
issue (exit 1 if there are issues). `--preview` sends them to the engine's preview lane and prints
|
|
157
|
+
the decision they would produce — nothing persisted, nothing billed, no grant needed.
|
|
158
|
+
|
|
159
|
+
`--claim` takes either a flat answers object (the same file `submit-claim --answers` posts — the
|
|
160
|
+
passport example's `protocol/sample-claim.json` is one) or the `{ answers, attachments?: [...] }`
|
|
161
|
+
envelope. A flat file has no attachments, so a handler that reads one fails closed: run the passport
|
|
162
|
+
example against its sample claim and the AI fact comes back `error` (the guard's path), not a stock
|
|
163
|
+
verdict. To exercise a lane that needs files, hand `--claim` an envelope whose `attachments` entry
|
|
164
|
+
points at a local photo.
|
|
165
|
+
|
|
166
|
+
## The rules a handler must never break
|
|
167
|
+
|
|
168
|
+
- **Never fake an ok.** A fact you could not establish is `fact.error(detail)`. Returning `false`
|
|
169
|
+
says "I checked, and it is false" — a different claim about the world, and the rubric may reject on
|
|
170
|
+
it. A stub is `fact.error("not implemented: <name>")`, visibly.
|
|
171
|
+
- **Never choose `onError`.** There is no argument for it and no way to pass one: the runner stamps
|
|
172
|
+
the manifest's own value over whatever a handler produced. Do not try to route around it by
|
|
173
|
+
returning a different verdict instead.
|
|
174
|
+
- **Never decide.** No thresholds, no gates, no rubric parsing, no reading `rubric.json`. The
|
|
175
|
+
manifest is the only work order, and the engine is the only judge.
|
|
176
|
+
- **Read the agreement last.** `tools.agreement()` right before returning the fact it feeds — the
|
|
177
|
+
engine records the snapshot current at decision time on its receipt.
|
|
178
|
+
- **Read the chain through `tools.chain`, never by hand.** `linkedResources(entityDid)` for what an
|
|
179
|
+
entity anchors (and each resource's `proof`), `messages(filter)` for what an account did on chain
|
|
180
|
+
and when, `query()` for chain RPC. An empty answer is a FACT ("nothing anchored", "no such
|
|
181
|
+
message"); an unreachable Blocksync throws, and the step retries.
|
|
182
|
+
- **One clock, one fan-out.** Use `ctx.now`, never `Date.now()`. Don't spawn your own concurrency:
|
|
183
|
+
the runner already caps ext+ai at 4 in flight and caches every answer so a step retry never
|
|
184
|
+
re-buys it.
|
|
185
|
+
- **No secrets in code or commits.** A vendor key is a `wrangler.jsonc` binding / `.dev.vars` secret,
|
|
186
|
+
read as `tools.env.<NAME>`.
|
|
187
|
+
- **A handler never imports the worker.** `@ixo/decision-oracle/facts` and `@ixo/decision-oracle/testing`
|
|
188
|
+
only — both must keep loading in plain node, which is what makes the tests fast and real.
|
|
189
|
+
|
|
190
|
+
## Common mistakes
|
|
191
|
+
|
|
192
|
+
| Mistake | Fix |
|
|
193
|
+
| --- | --- |
|
|
194
|
+
| A stub (or an unreachable vendor) returning `true` so a run looks green | `fact.error("not implemented: <name>")` — a loud failure routed by the rubric beats a wrong value that passes shape validation |
|
|
195
|
+
| Passing an `onError` into `fact.error(...)`, or picking `reject` "because it's safer" | the manifest's own `onError` is stamped by the runner; the rubric author already made that call |
|
|
196
|
+
| Calling the declared endpoint AND `tools.stock()` | two calls, two charges, one fact — wrap the stock lane or replace it, never both |
|
|
197
|
+
| A handler named for something the manifest doesn't declare | it is ignored with a `facts.handler-unused` warning — copy the name from `protocol review`, exactly |
|
|
198
|
+
| Returning `0.82` for a `score` source | basis points, an integer 0..10000 (`8200`) — the engine rejects a float, it never clamps |
|
|
199
|
+
| `throw` used as a retry signal | any other throw is an `error` fact; only `throw fact.retryLater(detail)` retries the step |
|
|
200
|
+
| Reading `rubric.json` to work out what to produce | read the manifest (`protocol review` / `bunx decision-oracle manifest <did>`) — this oracle never parses a rubric |
|
|
201
|
+
| A test that only asserts the happy path | test the failure the handler will actually meet — an unmatched URL, a 503, a missing attachment |
|
|
202
|
+
| `Date.now()` / a second HTTP client / a private cache inside a handler | `ctx.now`, `tools.http.json`, and the runner's own fact cache — and `group([...], handler)` when several names share ONE call |
|
|
203
|
+
| Four handlers each buying the same model call, or a group that answers only the names it liked | one `group([...])` per shared call, returning a fact for EVERY name it was given (`names`) |
|
|
204
|
+
| Hand-rolling a GraphQL POST at `config.BLOCKSYNC_GRAPHQL_URL`, or treating a chain read that FAILED as an empty result | `tools.chain` — parsed, retried, and loud when the indexer is down; `[]` means "nothing there", which is a different fact |
|
|
205
|
+
|
|
206
|
+
## Output contract
|
|
207
|
+
|
|
208
|
+
Per name handled: the file (`src/facts/<name>.ts`), its entry in `src/facts/index.ts`, and its test
|
|
209
|
+
(both halves). Then `bun run check` green, `bunx decision-oracle facts run …` printing the facts with no
|
|
210
|
+
issues, and — said plainly — every name still on a stub, what it needs (a vendor endpoint, a key, a
|
|
211
|
+
decision from the provider), and which names are deliberately left to the stock lanes.
|
|
212
|
+
|
|
213
|
+
## Reference
|
|
214
|
+
|
|
215
|
+
- `node_modules/@ixo/decision-oracle/docs/api.md` — the COMPLETE reference: every export, every option,
|
|
216
|
+
every default and cap, the wire shapes, the `FACT_*` codes, the testing helpers in full.
|
|
217
|
+
- `reference/facts-api.md` — inputs, `tools`, returns, the runner's rules, the testing helpers.
|
|
218
|
+
- `reference/examples/` — the two worked handlers.
|
|
219
|
+
- `../reference/engine-contract.md` — what the engine does with these facts (fact coverage, the
|
|
220
|
+
manifest, `tools.agreement()`'s route, the error table). Background, not an interface to code
|
|
221
|
+
against.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type ExtHandler, fact } from "@ixo/decision-oracle/facts";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `ext.deliveryConfirmed` — the common case: the rubric names an endpoint, but the real system
|
|
5
|
+
* behind it is a vendor API with its own auth and its own response shape, so the stock lane (a
|
|
6
|
+
* UCAN-signed POST answering `{ valid }` / `{ score }`) cannot speak to it.
|
|
7
|
+
*
|
|
8
|
+
* The shape to copy:
|
|
9
|
+
* 1. read the declared `send` — never the raw claim body, and never a field the rubric did not
|
|
10
|
+
* declare for this source;
|
|
11
|
+
* 2. call the endpoint the rubric declares (`expected.endpoint`), not a URL of your own — if you
|
|
12
|
+
* must call somewhere else, say so in the reason so the trace shows it;
|
|
13
|
+
* 3. map only the answers you actually understand;
|
|
14
|
+
* 4. everything else is `fact.error(...)` with the transcript attached — an unknown status, an
|
|
15
|
+
* unparseable body, a vendor that has never heard of this reference. Never a fake pass.
|
|
16
|
+
* 5. transient trouble (no response at all, a 5xx) is `throw fact.retryLater(...)`: the workflow
|
|
17
|
+
* step retries later and the facts already answered are kept, instead of freezing a verdict on
|
|
18
|
+
* a blip.
|
|
19
|
+
*
|
|
20
|
+
* Do NOT also call `tools.stock()` here: that would be two calls, and two charges, for one fact.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
interface VendorDelivery {
|
|
24
|
+
status?: unknown;
|
|
25
|
+
signed_by?: unknown;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const deliveryConfirmed: ExtHandler = async ({ send, expected }, tools) => {
|
|
29
|
+
const reference = send.reference;
|
|
30
|
+
if (typeof reference !== "string" || reference.length === 0) {
|
|
31
|
+
// The claim genuinely has nothing to look up — a checked answer, not a failure to check.
|
|
32
|
+
return fact.ok(false, { reason: "the claim carries no delivery reference" });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Your own bindings ride on `tools.env` beside the package's; name them where you read them.
|
|
36
|
+
const { COURIER_API_KEY } = tools.env as typeof tools.env & { COURIER_API_KEY?: string };
|
|
37
|
+
if (!COURIER_API_KEY) return fact.error("COURIER_API_KEY is not configured on this oracle");
|
|
38
|
+
|
|
39
|
+
const res = await tools.http.json<VendorDelivery>(expected.endpoint, {
|
|
40
|
+
method: "POST",
|
|
41
|
+
headers: { authorization: `Bearer ${COURIER_API_KEY}` },
|
|
42
|
+
body: { reference },
|
|
43
|
+
timeoutMs: expected.timeoutMs ?? 5000,
|
|
44
|
+
// For a source that authenticates THIS oracle instead of a bearer key:
|
|
45
|
+
// ucan: true, (signed as this oracle for THIS URL's host, instead of the bearer header)
|
|
46
|
+
// — your own capability, if your API checks one, is `ucan: { capability }` set HERE in code,
|
|
47
|
+
// never `expected.capability` (the rubric's, which the oracle ignores)
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
if (res.status === null || res.status >= 500) {
|
|
51
|
+
throw fact.retryLater(`courier API unavailable (status ${res.status ?? "none"})`);
|
|
52
|
+
}
|
|
53
|
+
if (res.status === 404) {
|
|
54
|
+
return fact.ok(false, {
|
|
55
|
+
reason: `courier API has no delivery for ${reference}`,
|
|
56
|
+
transcript: res.transcript,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
if (!res.ok) {
|
|
60
|
+
return fact.error(`courier API answered ${res.status}`, { transcript: res.transcript });
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ---- Replace everything below with your courier API's real response shape. ----
|
|
64
|
+
const status = res.body?.status;
|
|
65
|
+
if (typeof status !== "string") {
|
|
66
|
+
return fact.error("courier API answered a body with no status field", {
|
|
67
|
+
transcript: res.transcript,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (status === "delivered") {
|
|
71
|
+
const signedBy = typeof res.body?.signed_by === "string" ? res.body.signed_by : "unknown";
|
|
72
|
+
return fact.ok(true, { reason: `courier recorded delivery, signed by ${signedBy}` });
|
|
73
|
+
}
|
|
74
|
+
if (status === "in_transit" || status === "returned" || status === "lost") {
|
|
75
|
+
return fact.ok(false, { reason: `courier status is ${status}` });
|
|
76
|
+
}
|
|
77
|
+
// A status this handler has never seen is NOT a "no" — it is an unanswered fact.
|
|
78
|
+
return fact.error(`unrecognised courier status: ${status}`, { transcript: res.transcript });
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* A `score` source (`expected.expect === "score"`) returns an INTEGER 0..10000 instead of a
|
|
83
|
+
* boolean — basis points, never a float and never clamped by the engine:
|
|
84
|
+
*
|
|
85
|
+
* const onTimePct = res.body?.on_time_pct; // 0..100 from the vendor
|
|
86
|
+
* if (typeof onTimePct !== "number") return fact.error("no on_time_pct in the vendor's answer");
|
|
87
|
+
* return fact.ok(Math.round(onTimePct * 100), { reason: `${onTimePct}% on time` });
|
|
88
|
+
*/
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type ExtHandler, fact } from "@ixo/decision-oracle/facts";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `ext.priceMatchesAgreement` — "is the claimed service, at the claimed price, what the buyer
|
|
5
|
+
* agreed to?" The worked shape for a handler that reads the BUYER STATEMENT: guard the inputs
|
|
6
|
+
* first (a claim with nothing to compare needs no read at all), then the ONE `tools.agreement()`
|
|
7
|
+
* call, as late as possible — the engine records the snapshot that was current at decision time on
|
|
8
|
+
* its receipt, so reading it last is what makes the receipt name the version these facts came from.
|
|
9
|
+
*
|
|
10
|
+
* Note which failures are `ok(false)` and which are `error`: "the claim named a service the
|
|
11
|
+
* agreement does not list" is a real, checked answer (false); "there is no agreement on file" or
|
|
12
|
+
* "the agreement is a document shape I do not understand" is an error — the rubric's own `onError`
|
|
13
|
+
* decides what that means. Neither is ever an invented `true`.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
interface AgreedService {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
priceUsd: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The one document shape this handler understands — anything else is a miss, never a guess. */
|
|
23
|
+
function agentServices(doc: unknown): AgreedService[] | null {
|
|
24
|
+
if (typeof doc !== "object" || doc === null) return null;
|
|
25
|
+
const { kind, services } = doc as { kind?: unknown; services?: unknown };
|
|
26
|
+
if (kind !== "agent-services/v1" || !Array.isArray(services)) return null;
|
|
27
|
+
const parsed: AgreedService[] = [];
|
|
28
|
+
for (const entry of services) {
|
|
29
|
+
if (typeof entry !== "object" || entry === null) return null;
|
|
30
|
+
const { id, name, priceUsd } = entry as { id?: unknown; name?: unknown; priceUsd?: unknown };
|
|
31
|
+
if (typeof id !== "string" || typeof name !== "string" || typeof priceUsd !== "number") {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
parsed.push({ id, name, priceUsd });
|
|
35
|
+
}
|
|
36
|
+
return parsed;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** USD compared in whole cents — money is integers, never float equality. */
|
|
40
|
+
const cents = (usd: number): number => Math.round(usd * 100);
|
|
41
|
+
|
|
42
|
+
export const priceMatchesAgreement: ExtHandler = async ({ answers }, tools) => {
|
|
43
|
+
const { serviceId, priceUsd } = answers;
|
|
44
|
+
if (typeof serviceId !== "string" || typeof priceUsd !== "number") {
|
|
45
|
+
return fact.ok(false, { reason: "claim carries no serviceId / priceUsd to compare" });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Last: the engine's receipt names the snapshot current at this moment.
|
|
49
|
+
const agreement = await tools.agreement();
|
|
50
|
+
if (!agreement) return fact.error("no agreement on file for this claim's counterparty");
|
|
51
|
+
|
|
52
|
+
const services = agentServices(agreement.doc);
|
|
53
|
+
if (!services)
|
|
54
|
+
return fact.error(`agreement ${agreement.id} is not an agent-services/v1 document`);
|
|
55
|
+
|
|
56
|
+
const agreed = services.find((service) => service.id === serviceId);
|
|
57
|
+
if (!agreed) {
|
|
58
|
+
return fact.ok(false, { reason: `service ${serviceId} is not in agreement ${agreement.id}` });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const matches = cents(agreed.priceUsd) === cents(priceUsd);
|
|
62
|
+
return fact.ok(matches, {
|
|
63
|
+
reason: matches
|
|
64
|
+
? `${agreed.name} at $${agreed.priceUsd} as agreed`
|
|
65
|
+
: `${agreed.name} claimed at $${priceUsd}, agreed at $${agreed.priceUsd}`,
|
|
66
|
+
});
|
|
67
|
+
};
|