@ixo/decision-oracle 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +121 -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,1303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Decision API's wire contract (`/v1/api/*`, go-prod spec §4) as Zod — the mirror of
|
|
3
|
+
* `openapi/decision-api.yaml`, whose component schemas are GENERATED from these
|
|
4
|
+
* (`openapi/generate.ts`) and whose examples `test/node/contracts-openapi.test.ts` parses here.
|
|
5
|
+
* x402 and UDID shapes mirror the board's contracts (`board/contracts/{x402,ixo-pay,udid}`).
|
|
6
|
+
*
|
|
7
|
+
* REQUEST bodies are `z.strictObject`: an unknown key is a `400 VALIDATION` (§4.3 "validation is
|
|
8
|
+
* complete before anything is charged or stored"), never silently dropped. RESPONSES are
|
|
9
|
+
* `z.object`, so a reader tolerates the additive changes §4.1 ships without a bump. Query strings
|
|
10
|
+
* are loose: an unknown parameter is ignored. URLs we ACCEPT are https only (§14); URLs we RETURN
|
|
11
|
+
* are plain `z.url()`, so a local dev oracle on http still validates.
|
|
12
|
+
*
|
|
13
|
+
* Not a published subpath: the router parses with it, and clients (S7) are generated from the
|
|
14
|
+
* OpenAPI. NODE-SAFE all the same (zod + the engine's type mirror), because the node lane tests it.
|
|
15
|
+
*/
|
|
16
|
+
import { z } from "zod";
|
|
17
|
+
import { Decision, ErroredFact, ManifestReviewAnswer, Verdict } from "../lib/engine/types.js";
|
|
18
|
+
import { Capability, MemberRole } from "./capabilities.js";
|
|
19
|
+
import { ApiErrorCode, ApiErrorEnvelope, SourcePausedReason } from "./errors.js";
|
|
20
|
+
// --- limits (§4.1, §4.3, §4.6) --------------------------------------------------------------------
|
|
21
|
+
/** `Prefer: wait=N` / `?wait=N` ceiling: under the step's 4-minute timeout and the ~100 s most
|
|
22
|
+
* gateways cut at, above the typical AI + external-source budget (§4.6). */
|
|
23
|
+
export const MAX_WAIT_SECONDS = 90;
|
|
24
|
+
export const MAX_BATCH_CLAIMS = 100;
|
|
25
|
+
export const MAX_PAGE_LIMIT = 500;
|
|
26
|
+
/** `metadata` is echoed on every GET and webhook, never evaluated — kept small (§4.3). */
|
|
27
|
+
export const MAX_METADATA_BYTES = 4096;
|
|
28
|
+
export const MAX_JSON_BODY_BYTES = 1024 * 1024;
|
|
29
|
+
export const MAX_UPLOAD_BYTES = 25_000_000;
|
|
30
|
+
// --- ids and scalars --------------------------------------------------------------------------------
|
|
31
|
+
const ULID = "[0-9A-HJKMNP-TV-Z]{26}";
|
|
32
|
+
const ulidId = (prefix) => z.string().regex(new RegExp(`^${prefix}_${ULID}$`));
|
|
33
|
+
/** `apc_` + 40 hex of sha256(sourceId|Idempotency-Key) — so the ledger's PK insert IS the
|
|
34
|
+
* duplicate guard (§4.6) — or `apc_` + a fresh ULID when the caller sent no key. */
|
|
35
|
+
export const ClaimId = z.string().regex(new RegExp(`^apc_([0-9a-f]{40}|${ULID})$`));
|
|
36
|
+
/** Any claim a record can show (contracts v1.2): an API claim's `ClaimId`, or a chain claim's own
|
|
37
|
+
* id — a CID, or (on older collections) a Matrix event id — at most 512 chars. What the READ
|
|
38
|
+
* routes take as `:claimId` (the record, timeline, receipt, report — a source's for its linked
|
|
39
|
+
* collections' chain claims, and the operator's); submit, review and erase stay `ClaimId`. */
|
|
40
|
+
export const RecordClaimId = z.string().min(1).max(512);
|
|
41
|
+
export const SourceId = ulidId("src");
|
|
42
|
+
export const EndpointId = ulidId("whe");
|
|
43
|
+
export const EventId = ulidId("evt");
|
|
44
|
+
export const MemberId = ulidId("mem");
|
|
45
|
+
export const UploadId = ulidId("upl");
|
|
46
|
+
export const AuditId = ulidId("aud");
|
|
47
|
+
/** `wh:<eventId>:<endpointId>`, or `wh:<eventId>:claim` for the claim's own `webhookUrl` — the
|
|
48
|
+
* `matrix_deliveries.dedupeKey`, so a redelivery can never double-post one event to one target. */
|
|
49
|
+
export const DeliveryId = z.string().regex(new RegExp(`^wh:evt_${ULID}:(whe_${ULID}|claim)$`));
|
|
50
|
+
/** The facilitator's settlement id (`org.udid.receipt@1` `settlementId`, payments spec §13.1): 64
|
|
51
|
+
* hex, one per offer — a batch's claims share it. Replaces the hold id `chargeId` (contracts v1.3). */
|
|
52
|
+
export const SettlementId = z.string().regex(/^[0-9a-f]{64}$/);
|
|
53
|
+
/** The 8-char lookup prefix of an API key (`eo_live_<prefix>_<secret>`, §3.2). */
|
|
54
|
+
export const KeyPrefix = z.string().regex(/^[0-9a-z]{8}$/);
|
|
55
|
+
export const ProtocolDid = z.string().regex(/^did:ixo:entity:[0-9a-zA-Z]+$/);
|
|
56
|
+
/** An IXO user account (`ixo1` + 38 bech32 chars) — members, owners, payers. Contract and DAO
|
|
57
|
+
* accounts are not supported at launch (the board's `didIxo`). */
|
|
58
|
+
export const AccountDid = z.string().regex(/^did:ixo:ixo1[02-9ac-hj-np-z]{38}$/);
|
|
59
|
+
/** A company entity (company authority D1): the on-chain entity whose controllers administer every
|
|
60
|
+
* source linked to it. */
|
|
61
|
+
export const EntityDid = z.string().regex(/^did:ixo:entity:[0-9a-f]{32}$/);
|
|
62
|
+
/** A reviewer key: `did:key` (Ed25519) generated in the member's browser (§3.2, §10). */
|
|
63
|
+
export const ReviewerDid = z.string().regex(/^did:key:z[1-9A-HJ-NP-Za-km-z]+$/);
|
|
64
|
+
/** ISO-8601 UTC (§4.1) — `Z`, never an offset — on everything we write. */
|
|
65
|
+
export const Timestamp = z.iso.datetime();
|
|
66
|
+
/** A compact JWS: base64url(header).base64url(payload).base64url(signature). */
|
|
67
|
+
export const CompactJws = z.string().regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/);
|
|
68
|
+
/** SSRF control §14 starts at the schema: https only. The public-DNS / private-range checks run
|
|
69
|
+
* at fetch time, per redirect hop, where the resolved address is known. */
|
|
70
|
+
export const HttpsUrl = z.url({ protocol: /^https$/ });
|
|
71
|
+
/** A non-negative integer in an asset's base units as a decimal STRING, never a float — PAY
|
|
72
|
+
* (`upay`, 1 PAY = 1 USD = 1,000,000 upay) or a customer's own asset. 78 digits covers uint256. */
|
|
73
|
+
export const BaseUnitAmount = z.string().regex(/^(0|[1-9][0-9]{0,77})$/);
|
|
74
|
+
/** Any CAIP-2 `namespace:reference` — the network of a customer's own x402 offer. */
|
|
75
|
+
export const Caip2Network = z.string().regex(/^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}$/);
|
|
76
|
+
/** x402's network id for the IXO chain the facilitator settles on, CAIP-2 `cosmos:<chain-id>`
|
|
77
|
+
* (`cosmos:devnet-1`, `cosmos:pandora-8` testnet, `cosmos:ixo-5` mainnet). */
|
|
78
|
+
export const IxoNetwork = z.string().regex(/^cosmos:[-_a-zA-Z0-9]{1,32}$/);
|
|
79
|
+
/** The card scheme's networks (payments spec §6.3, `stripe-manual-capture`): Stripe test or live. */
|
|
80
|
+
export const StripeNetwork = z.enum(["stripe:test", "stripe:live"]);
|
|
81
|
+
/** CAIP-2 `eip155:<chainId>`: the `exact` scheme's EVM chain (USDC on Base: `eip155:8453`). */
|
|
82
|
+
export const EvmNetwork = z.string().regex(/^eip155:[1-9][0-9]{0,19}$/);
|
|
83
|
+
/** A 20-byte EVM account, hex: an `exact` payment's payer (its EIP-3009 authorization's signer). */
|
|
84
|
+
export const EvmAddress = z.string().regex(/^0x[0-9a-fA-F]{40}$/);
|
|
85
|
+
/** Where a payment settles: the IXO chain (PAY), Stripe (card, contracts v1.4) or an EVM chain
|
|
86
|
+
* (`exact`: USDC on Base, a plan without PAY). */
|
|
87
|
+
export const SettleNetwork = z.union([IxoNetwork, StripeNetwork, EvmNetwork]);
|
|
88
|
+
/** The facilitator's offer id, the 402's single-use nonce: a lowercase UUID. */
|
|
89
|
+
export const OfferNonce = z
|
|
90
|
+
.string()
|
|
91
|
+
.regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/);
|
|
92
|
+
export const Scope = z.enum(["claims:write", "claims:read", "webhooks:manage"]);
|
|
93
|
+
export { Capability, MemberRole };
|
|
94
|
+
/** The ledger's `claim_ingests.status` — where the claim got to, independent of the verdict. */
|
|
95
|
+
export const ClaimStatus = z.enum(["queued", "processing", "processed", "failed"]);
|
|
96
|
+
/** How a claim arrived (contracts v1.2): `POST /v1/api/claims`, or the cron's scan of a watched
|
|
97
|
+
* on-chain collection. */
|
|
98
|
+
export const ClaimLane = z.enum(["api", "chain"]);
|
|
99
|
+
/** The `decisions.chainStatus` column: where a verdict got to on chain. Always `skipped` on the API
|
|
100
|
+
* lane (nothing is signed); a chain claim's is the act lane's real state. */
|
|
101
|
+
export const ChainStatus = z.enum([
|
|
102
|
+
"pending",
|
|
103
|
+
"submitted",
|
|
104
|
+
"blocked",
|
|
105
|
+
"skipped",
|
|
106
|
+
"held",
|
|
107
|
+
"owner_submitted",
|
|
108
|
+
]);
|
|
109
|
+
/**
|
|
110
|
+
* The `decisions.status` column: the engine's three, the facts lane's own `invalid_facts`, and the
|
|
111
|
+
* engine's two refusals of the claim's content (v1.7): `content_mismatch` (the facts don't match the
|
|
112
|
+
* content you sent) and `payload_too_large` — both with no decision, and the claim `failed`.
|
|
113
|
+
*/
|
|
114
|
+
export const DecisionStatus = z.enum([
|
|
115
|
+
"decided",
|
|
116
|
+
"pending_review",
|
|
117
|
+
"unusable",
|
|
118
|
+
"invalid_facts",
|
|
119
|
+
"content_mismatch",
|
|
120
|
+
"payload_too_large",
|
|
121
|
+
]);
|
|
122
|
+
/**
|
|
123
|
+
* A claim's payment (contracts v1.3, payments spec §4): `reserved` at accept (`/verify` reserved the
|
|
124
|
+
* price; the claim runs), `settled` once the engine's receipt was accepted (the minute's transfer has
|
|
125
|
+
* not paid it yet), `paid` with the transfer's `transaction`, `released` when no receipt came within
|
|
126
|
+
* 24 h (nothing moved), `failed` when the facilitator refused the receipt (nothing moved).
|
|
127
|
+
*/
|
|
128
|
+
/** `refunded` / `partially_refunded` (v1.4.3) are a paid CARD payment the operator refunded since —
|
|
129
|
+
* PAY is final on chain and never reaches them. */
|
|
130
|
+
export const PaymentStatus = z.enum([
|
|
131
|
+
"reserved",
|
|
132
|
+
"settled",
|
|
133
|
+
"paid",
|
|
134
|
+
"released",
|
|
135
|
+
"failed",
|
|
136
|
+
"refunded",
|
|
137
|
+
"partially_refunded",
|
|
138
|
+
]);
|
|
139
|
+
/** `failed` will be retried; `dead` spent its 8 attempts (§4.5) and waits for a redeliver. The
|
|
140
|
+
* delivery row's `sent` is `delivered` here: the wire says what the receiver got. */
|
|
141
|
+
export const DeliveryStatus = z.enum(["pending", "delivered", "failed", "dead"]);
|
|
142
|
+
/**
|
|
143
|
+
* v1.8 (D10): a source starts `pending-link` — created by a controller of its organisation, waiting
|
|
144
|
+
* for the engine to hold the organisation's link for it — and turns `active` at the company sync.
|
|
145
|
+
* `disputed`: the engine holds a link for ANOTHER entity (first link wins), or says disputed — no
|
|
146
|
+
* authority; delete the source and add the oracle again. Neither takes claims, keys, invites or
|
|
147
|
+
* webhooks. `paused` is the only state with a `pausedReason`.
|
|
148
|
+
*/
|
|
149
|
+
export const SourceStatus = z.enum(["pending-link", "active", "paused", "disputed"]);
|
|
150
|
+
/**
|
|
151
|
+
* How a source pays (§3.2): `x402` — an outside customer pays per decision (§11) — or `none` — the
|
|
152
|
+
* operator's own organisation or a partner it does not charge: no 402, no `api_charges` row. Set
|
|
153
|
+
* only by the oracle's operator; the engine bills the oracle's owner its fee either way (§11.12).
|
|
154
|
+
*/
|
|
155
|
+
export const BillingMode = z.enum(["x402", "none"]);
|
|
156
|
+
export { Verdict };
|
|
157
|
+
/**
|
|
158
|
+
* The oracle's published price for one protocol (payments spec §3.1) — what
|
|
159
|
+
* `GET /v1/api/protocols/:did` serves, every offer quotes and the facilitator checks each charge
|
|
160
|
+
* against (`price_mismatch` otherwise). `amountMicroUsd` is the price, and the PAY base units
|
|
161
|
+
* (`amount`, 1 upay = 1 micro-USD) the same number; `amountCents` is it rounded DOWN to a whole
|
|
162
|
+
* cent, for display and the per-key daily cap.
|
|
163
|
+
*/
|
|
164
|
+
export const Price = z.object({
|
|
165
|
+
amountMicroUsd: z.int().min(0),
|
|
166
|
+
amountCents: z.int().min(0),
|
|
167
|
+
currency: z.literal("USD"),
|
|
168
|
+
amount: BaseUnitAmount,
|
|
169
|
+
asset: z.literal("upay"),
|
|
170
|
+
});
|
|
171
|
+
const keysetPage = (item) => z.object({ items: z.array(item), nextCursor: z.string().nullable() });
|
|
172
|
+
// --- x402 (§4.3, §11.2, §11.9, §11.10; board contracts x402/, ixo-pay/, udid/) -----------------------
|
|
173
|
+
/**
|
|
174
|
+
* x402 v2 `PaymentRequirements` in its generic form — what a customer's own payment service
|
|
175
|
+
* advertised, forwarded to the engine untouched (§11.10 step 1). LOOSE on purpose, the one loose
|
|
176
|
+
* request object: the engine binds the decision-to-pay to `sha256(RFC 8785 canonical JSON of
|
|
177
|
+
* requirements)`, so dropping a key we do not know would change the digest the payer's
|
|
178
|
+
* facilitator recomputes — and the credential would never verify. v2 has no `resource` here.
|
|
179
|
+
*/
|
|
180
|
+
export const PaymentRequirements = z.looseObject({
|
|
181
|
+
scheme: z.string().min(1),
|
|
182
|
+
network: Caip2Network,
|
|
183
|
+
amount: BaseUnitAmount,
|
|
184
|
+
asset: z.string().min(1),
|
|
185
|
+
payTo: z.string().min(1),
|
|
186
|
+
maxTimeoutSeconds: z.int().min(1),
|
|
187
|
+
extra: z.record(z.string(), z.unknown()).optional(),
|
|
188
|
+
});
|
|
189
|
+
/** x402 v2 `ResourceInfo`: what is paid for. LOOSE — upstream grows it. */
|
|
190
|
+
export const ResourceInfo = z.looseObject({
|
|
191
|
+
url: z.url().max(2048),
|
|
192
|
+
description: z.string().optional(),
|
|
193
|
+
mimeType: z.string().optional(),
|
|
194
|
+
});
|
|
195
|
+
/**
|
|
196
|
+
* One ixo-pay `accepts[]` entry (§11.2) exactly as the facilitator registered it — strict, because
|
|
197
|
+
* the payer echoes it byte for byte as `accepted` and the facilitator refuses anything not
|
|
198
|
+
* canonically equal (`terms_mismatch`). `extra.nonce` is the facilitator's single-use offerId.
|
|
199
|
+
*/
|
|
200
|
+
export const IxoPayRequirements = z.strictObject({
|
|
201
|
+
scheme: z.literal("ixo-pay"),
|
|
202
|
+
network: IxoNetwork,
|
|
203
|
+
asset: z.literal("upay"),
|
|
204
|
+
amount: BaseUnitAmount,
|
|
205
|
+
/** The real recipient: the operator's own `EARNINGS_ADDRESS`, an IXO account (payments spec §3.2,
|
|
206
|
+
* §13.1). The oracle names it in the offer; the facilitator checks it, never picks one. */
|
|
207
|
+
payTo: z.string().regex(/^ixo1[02-9ac-hj-np-z]{38,58}$/),
|
|
208
|
+
maxTimeoutSeconds: z.int().min(1).max(3600),
|
|
209
|
+
extra: z.strictObject({ nonce: OfferNonce, fundingUrl: z.url() }),
|
|
210
|
+
});
|
|
211
|
+
/**
|
|
212
|
+
* The `PAYMENT-REQUIRED` header (base64 of UTF-8 JSON) — authoritative for x402 clients (board
|
|
213
|
+
* D30). It is the facilitator's `/offers` answer verbatim: `resource.url` is the submit URL with
|
|
214
|
+
* the claimId as fragment, or the batch URL. `accepts` holds the ways the oracle's plan takes: an
|
|
215
|
+
* ixo-pay entry (PAY, IXO-run oracles only), the facilitator's `stripe-manual-capture` entry when
|
|
216
|
+
* it takes card (contracts v1.4, payments spec §6.3), and x402's `exact` EVM entry when it takes
|
|
217
|
+
* USDC on Base — a plan without PAY lists no ixo-pay entry at all (§11.7).
|
|
218
|
+
*/
|
|
219
|
+
export const X402PaymentRequired = z.object({
|
|
220
|
+
x402Version: z.literal(2),
|
|
221
|
+
error: z.string().optional(),
|
|
222
|
+
resource: ResourceInfo,
|
|
223
|
+
accepts: z
|
|
224
|
+
.array(PaymentRequirements)
|
|
225
|
+
.min(1)
|
|
226
|
+
.refine((a) => a.some((r) => IxoPayRequirements.safeParse(r).success ||
|
|
227
|
+
(r.scheme === "stripe-manual-capture" && StripeNetwork.safeParse(r.network).success) ||
|
|
228
|
+
(r.scheme === "exact" && EvmNetwork.safeParse(r.network).success)), {
|
|
229
|
+
message: "accepts must contain an ixo-pay, a stripe-manual-capture (card) or an exact entry",
|
|
230
|
+
}),
|
|
231
|
+
extensions: z.record(z.string(), z.unknown()).optional(),
|
|
232
|
+
});
|
|
233
|
+
/** The `PAYMENT-SIGNATURE` request header (base64 of UTF-8 JSON, x402 v2 PaymentPayload): the
|
|
234
|
+
* chosen terms echoed as `accepted`, and the developer's delegation with the 402's nonce. */
|
|
235
|
+
export const IxoPayPaymentPayload = z.strictObject({
|
|
236
|
+
x402Version: z.literal(2),
|
|
237
|
+
resource: ResourceInfo.optional(),
|
|
238
|
+
accepted: IxoPayRequirements,
|
|
239
|
+
payload: z.strictObject({
|
|
240
|
+
/** `IXO_PAYMENT_DELEGATION` verbatim: base64 of the encoded UCAN delegation. */
|
|
241
|
+
delegation: z
|
|
242
|
+
.string()
|
|
243
|
+
.min(16)
|
|
244
|
+
.regex(/^[A-Za-z0-9+/_-]+={0,2}$/),
|
|
245
|
+
nonce: OfferNonce,
|
|
246
|
+
}),
|
|
247
|
+
extensions: z.record(z.string(), z.unknown()).optional(),
|
|
248
|
+
});
|
|
249
|
+
/**
|
|
250
|
+
* One card `accepts[]` entry (contracts v1.4, payments spec §6.3): the facilitator's
|
|
251
|
+
* `stripe-manual-capture` terms — `amount` in US cents, `payTo` the operator's Stripe account,
|
|
252
|
+
* `extra` exactly `{ nonce }`. Listed after the ixo-pay entry when the oracle takes card.
|
|
253
|
+
*/
|
|
254
|
+
export const CardRequirements = z.strictObject({
|
|
255
|
+
scheme: z.literal("stripe-manual-capture"),
|
|
256
|
+
network: StripeNetwork,
|
|
257
|
+
amount: z.string().regex(/^[1-9][0-9]{0,77}$/),
|
|
258
|
+
asset: z.literal("usd"),
|
|
259
|
+
payTo: z.string().regex(/^acct_[a-zA-Z0-9]+$/),
|
|
260
|
+
maxTimeoutSeconds: z.int().min(10).max(300),
|
|
261
|
+
extra: z.strictObject({ nonce: OfferNonce }),
|
|
262
|
+
});
|
|
263
|
+
/**
|
|
264
|
+
* The `PAYMENT-SIGNATURE` header for card (contracts v1.4): the card entry echoed as `accepted` and
|
|
265
|
+
* the PaymentIntent the payer authorized (uncaptured) on its saved card. There is no delegation:
|
|
266
|
+
* the payer is the account the facilitator's `/verify` names. After a 3-D Secure confirmation the
|
|
267
|
+
* SAME header (the original offer) is sent again, even past the offer's `maxTimeoutSeconds`.
|
|
268
|
+
*/
|
|
269
|
+
export const CardPaymentPayload = z.strictObject({
|
|
270
|
+
x402Version: z.literal(2),
|
|
271
|
+
resource: ResourceInfo.optional(),
|
|
272
|
+
accepted: CardRequirements,
|
|
273
|
+
payload: z.strictObject({
|
|
274
|
+
paymentIntentId: z.string().regex(/^pi_[a-zA-Z0-9]+$/),
|
|
275
|
+
customerId: z.string().regex(/^cus_[a-zA-Z0-9]+$/),
|
|
276
|
+
}),
|
|
277
|
+
extensions: z.record(z.string(), z.unknown()).optional(),
|
|
278
|
+
});
|
|
279
|
+
/** One claim of a (possibly batched) settlement and where it got to at the facilitator. */
|
|
280
|
+
/**
|
|
281
|
+
* A chain claim's id as the facilitator keys its reservation (1.22.0, x402-ixo-pay 0.7.0): a CIDv1
|
|
282
|
+
* in lowercase base32 — checked by form, as the facilitator does.
|
|
283
|
+
*/
|
|
284
|
+
export const ChainClaimId = z.string().regex(/^b[a-z2-7]{50,100}$/);
|
|
285
|
+
/** A settled claim: an API claim, or (1.22.0) a chain claim a per-review collection paid for. */
|
|
286
|
+
export const SettlementClaim = z.looseObject({
|
|
287
|
+
claimId: z.union([ClaimId, ChainClaimId]),
|
|
288
|
+
state: z.string().min(1),
|
|
289
|
+
});
|
|
290
|
+
/** `org.udid.receipt@1` — the settlement receipt: one `settlementId` per offer, the claims the
|
|
291
|
+
* `/settle` call carried receipts for; `decision` is absent on ixo-pay (no decision-to-pay). */
|
|
292
|
+
export const UdidReceipt = z.looseObject({
|
|
293
|
+
settlementId: SettlementId,
|
|
294
|
+
offerId: OfferNonce,
|
|
295
|
+
replayed: z.boolean(),
|
|
296
|
+
claims: z.array(SettlementClaim).min(1).max(MAX_BATCH_CLAIMS),
|
|
297
|
+
decision: z.object({ issuer: z.string().min(1), id: z.string().min(1) }).optional(),
|
|
298
|
+
});
|
|
299
|
+
/**
|
|
300
|
+
* The `PAYMENT-RESPONSE` header on a sync `200` (contracts v1.3): the facilitator's `/settle` answer
|
|
301
|
+
* for the claim's receipt, forwarded VERBATIM — loose, so nothing it adds is stripped. `success`
|
|
302
|
+
* with the real `transaction` once the minute's transfer paid it; before that (usual for PAY)
|
|
303
|
+
* `settlement_pending` (its `transaction` empty, or at most a reference that is not yet final) with
|
|
304
|
+
* the `settlementId`.
|
|
305
|
+
*/
|
|
306
|
+
/** Who paid: an IXO account (PAY, and card — bound to one), or an `exact` payment's EVM signer. */
|
|
307
|
+
const SettlePayer = z.union([AccountDid, EvmAddress]);
|
|
308
|
+
export const X402PaymentResponse = z.union([
|
|
309
|
+
z.looseObject({
|
|
310
|
+
success: z.literal(true),
|
|
311
|
+
/** The IXO transfer's tx hash, the card's captured PaymentIntent (`pi_…`, v1.4), or the
|
|
312
|
+
* `exact` USDC transfer's EVM tx hash. */
|
|
313
|
+
transaction: z.string().min(1).max(256),
|
|
314
|
+
network: SettleNetwork,
|
|
315
|
+
payer: SettlePayer,
|
|
316
|
+
extensions: z.looseObject({ "org.udid.receipt@1": UdidReceipt }),
|
|
317
|
+
}),
|
|
318
|
+
z.looseObject({
|
|
319
|
+
success: z.literal(false),
|
|
320
|
+
errorReason: z.literal("settlement_pending"),
|
|
321
|
+
/** Empty until the transfer; any string is accepted here, only `success` makes it real. */
|
|
322
|
+
transaction: z.string(),
|
|
323
|
+
network: SettleNetwork,
|
|
324
|
+
payer: SettlePayer,
|
|
325
|
+
extensions: z.looseObject({ "org.udid.receipt@1": UdidReceipt }),
|
|
326
|
+
}),
|
|
327
|
+
]);
|
|
328
|
+
const PaymentCode = ApiErrorCode.extract(["PAYMENT_REQUIRED", "SPEND_CAP", "INSUFFICIENT_CREDITS"]);
|
|
329
|
+
/**
|
|
330
|
+
* The 402 BODY (Appendix A, board D30): our error envelope, the x402 object in
|
|
331
|
+
* `details.paymentRequired` for a client that reads bodies, and `price` / `fundingUrl` for a human.
|
|
332
|
+
* Only `PAYMENT_REQUIRED` carries an offer: `SPEND_CAP` and `INSUFFICIENT_CREDITS` have nothing an
|
|
333
|
+
* SDK may auto-pay, so it branches on `error.code` and surfaces those two to the developer.
|
|
334
|
+
*/
|
|
335
|
+
export const PaymentRequiredBody = z
|
|
336
|
+
.object({
|
|
337
|
+
error: ApiErrorEnvelope.shape.error.extend({
|
|
338
|
+
code: PaymentCode,
|
|
339
|
+
details: z.object({
|
|
340
|
+
paymentRequired: X402PaymentRequired.optional(),
|
|
341
|
+
price: Price,
|
|
342
|
+
fundingUrl: z.url(),
|
|
343
|
+
}),
|
|
344
|
+
}),
|
|
345
|
+
})
|
|
346
|
+
.refine((b) => (b.error.code === "PAYMENT_REQUIRED") === (b.error.details.paymentRequired !== undefined), { message: "details.paymentRequired is present exactly on PAYMENT_REQUIRED" });
|
|
347
|
+
// --- submit (§4.3) ---------------------------------------------------------------------------------
|
|
348
|
+
const AttachmentBase = {
|
|
349
|
+
/** The claim form's file question this answers — what `attachments[].question` carries in a FactSet. */
|
|
350
|
+
question: z.string().min(1).max(256),
|
|
351
|
+
name: z.string().min(1).max(256).optional(),
|
|
352
|
+
mediaType: z
|
|
353
|
+
.string()
|
|
354
|
+
.min(1)
|
|
355
|
+
.max(256)
|
|
356
|
+
.optional()
|
|
357
|
+
.describe("Optional. Left out on a url attachment, the oracle detects it once at accept — from the URL's extension, else the Content-Type of one HEAD — and stores it with the claim; unknown stays application/octet-stream. An upload's type is the one sniffed at upload."),
|
|
358
|
+
cid: z.string().min(1).max(256).optional(),
|
|
359
|
+
};
|
|
360
|
+
/**
|
|
361
|
+
* A file the claim points at: EXACTLY one of an https `url` or an `uploadId` from
|
|
362
|
+
* `PUT /v1/api/uploads` (strict objects, so both-or-neither matches no branch). An `uploadId` is
|
|
363
|
+
* resolved to its R2 object inside the workflow — never through a signed URL, whose `exp` would
|
|
364
|
+
* expire under a slow retry ladder. v1.7: an upload carries the `cid` its upload returned — it is
|
|
365
|
+
* part of the claim's content (company authority: the engine binds the file by it), and accept
|
|
366
|
+
* refuses one that is not the upload's.
|
|
367
|
+
*/
|
|
368
|
+
export const Attachment = z.union([
|
|
369
|
+
z.strictObject({ ...AttachmentBase, url: HttpsUrl }),
|
|
370
|
+
z.strictObject({
|
|
371
|
+
...AttachmentBase,
|
|
372
|
+
uploadId: UploadId,
|
|
373
|
+
cid: z
|
|
374
|
+
.string()
|
|
375
|
+
.min(1)
|
|
376
|
+
.max(256)
|
|
377
|
+
.describe("Required: the `cid` PUT /v1/api/uploads returned for this upload."),
|
|
378
|
+
}),
|
|
379
|
+
]);
|
|
380
|
+
const Metadata = z
|
|
381
|
+
.record(z.string(), z.unknown())
|
|
382
|
+
.refine((m) => new TextEncoder().encode(JSON.stringify(m)).length <= MAX_METADATA_BYTES, {
|
|
383
|
+
message: `metadata must serialize to at most ${MAX_METADATA_BYTES} bytes`,
|
|
384
|
+
});
|
|
385
|
+
export const SubmitClaimRequest = z.strictObject({
|
|
386
|
+
/** Optional when the source has exactly one allowed protocol. */
|
|
387
|
+
protocolDid: ProtocolDid.optional(),
|
|
388
|
+
/** The credentialSubject, shaped by `GET /v1/api/protocols/:did` `answers` — checked against
|
|
389
|
+
* that JSON Schema at the route, since it is per-protocol. Never returned by any read. */
|
|
390
|
+
answers: z.record(z.string(), z.unknown()),
|
|
391
|
+
attachments: z.array(Attachment).max(100).optional(),
|
|
392
|
+
/**
|
|
393
|
+
* Your own stable id for the person the claim is about (e.g. a courier id) — the frequency rule's
|
|
394
|
+
* per-submitter count. When absent, the answer the source's company link names (`payeeField`)
|
|
395
|
+
* is used. Required when the protocol has a frequency rule (its work order's
|
|
396
|
+
* `facts.frequency`) and neither is there: otherwise `400 VALIDATION` at `submitter` (at
|
|
397
|
+
* `answers.<payeeField>` when the source has one), before any payment. Over OAuth (an AI app
|
|
398
|
+
* signed in as a person) it must be that person's DID, else `400 VALIDATION` at `submitter`.
|
|
399
|
+
*/
|
|
400
|
+
submitter: z.string().min(1).max(256).optional(),
|
|
401
|
+
metadata: Metadata.optional(),
|
|
402
|
+
webhookUrl: HttpsUrl.optional(),
|
|
403
|
+
});
|
|
404
|
+
/** `202` when the decision did not land inside the wait budget — also a repeat of a running key. */
|
|
405
|
+
export const Accepted = z.object({
|
|
406
|
+
claimId: ClaimId,
|
|
407
|
+
status: ClaimStatus,
|
|
408
|
+
pollUrl: z.url(),
|
|
409
|
+
});
|
|
410
|
+
/**
|
|
411
|
+
* Async only; ONE offer covers the batch (price × valid items), one reservation per claim, each
|
|
412
|
+
* settled on its own receipt. With an `Idempotency-Key` K on the batch, item i's claimId derives from
|
|
413
|
+
* `K:i`, so a retried batch re-finds every item.
|
|
414
|
+
*/
|
|
415
|
+
export const BatchSubmitRequest = z.strictObject({
|
|
416
|
+
claims: z.array(SubmitClaimRequest).min(1).max(MAX_BATCH_CLAIMS),
|
|
417
|
+
});
|
|
418
|
+
/** One item's answer: accepted, or its own validation error inline — one bad item never fails the batch. */
|
|
419
|
+
export const BatchItemResult = z.discriminatedUnion("status", [
|
|
420
|
+
z.object({
|
|
421
|
+
index: z.int().min(0),
|
|
422
|
+
status: z.literal("accepted"),
|
|
423
|
+
claimId: ClaimId,
|
|
424
|
+
pollUrl: z.url(),
|
|
425
|
+
}),
|
|
426
|
+
z.object({
|
|
427
|
+
index: z.int().min(0),
|
|
428
|
+
status: z.literal("rejected"),
|
|
429
|
+
error: ApiErrorEnvelope.shape.error.omit({ requestId: true }),
|
|
430
|
+
}),
|
|
431
|
+
]);
|
|
432
|
+
export const BatchSubmitResponse = z.object({ items: z.array(BatchItemResult) });
|
|
433
|
+
// --- the record (§4.4) -----------------------------------------------------------------------------
|
|
434
|
+
export const ReceiptRef = z.object({ cid: z.string().min(1), jws: z.string().min(1) });
|
|
435
|
+
/**
|
|
436
|
+
* The `decisions` row as the API shows it. `decision` is the ENGINE's `Decision` verbatim — the
|
|
437
|
+
* oracle never decides, so there is no field here it computed; null for the facts lane's
|
|
438
|
+
* `invalid_facts` (no engine call was made). `chainStatus` is always `skipped` on the API lane;
|
|
439
|
+
* on a chain claim it is where the `MsgEvaluateClaim` got to (contracts v1.2).
|
|
440
|
+
*/
|
|
441
|
+
export const ClaimDecision = z.object({
|
|
442
|
+
status: DecisionStatus,
|
|
443
|
+
verdict: Verdict.nullable(),
|
|
444
|
+
rubricId: z.string().nullable(),
|
|
445
|
+
factsDigest: z.string().nullable(),
|
|
446
|
+
resultDigest: z.string().nullable(),
|
|
447
|
+
decision: Decision.nullable(),
|
|
448
|
+
explanation: z.string().nullable(),
|
|
449
|
+
/**
|
|
450
|
+
* The engine's one public credential for this decision (UDID). On an approved claim whose
|
|
451
|
+
* protocol has `OracleConfig.payouts` it is also typed `DecisionToPayCredential` and carries the
|
|
452
|
+
* payment binding a company's facilitator pays from (v1.13).
|
|
453
|
+
*/
|
|
454
|
+
receipt: ReceiptRef.nullable(),
|
|
455
|
+
chainStatus: ChainStatus,
|
|
456
|
+
/**
|
|
457
|
+
* WHY a claim was held or refused (1.20.0): each `ext`/`ai` fact that came back `error`, as the
|
|
458
|
+
* engine names it — `name` lane-prefixed (`ext.beforeAfter`, `ai.sameBoat`), `detail` the fact's
|
|
459
|
+
* own error text (the handler's or the stock lane's, never an answer field), at most 500 chars.
|
|
460
|
+
* The engine's `reasons` stay generic. Omitted when no fact errored.
|
|
461
|
+
*/
|
|
462
|
+
erroredFacts: z.array(ErroredFact).min(1).optional(),
|
|
463
|
+
});
|
|
464
|
+
/** A task a human must answer (§10), with the prompt and answer shape the manifest declares. */
|
|
465
|
+
export const ReviewTask = z.object({
|
|
466
|
+
id: z.string().min(1),
|
|
467
|
+
prompt: z.string().min(1),
|
|
468
|
+
answer: ManifestReviewAnswer,
|
|
469
|
+
});
|
|
470
|
+
/**
|
|
471
|
+
* `pendingTasks` are what the engine asked for, with prompt and answer shape from the manifest —
|
|
472
|
+
* stored in the claim's `review_required` timeline event at decision time, so a later manifest
|
|
473
|
+
* change never rewrites what the reviewer was asked.
|
|
474
|
+
*/
|
|
475
|
+
export const ClaimReviewState = z.object({
|
|
476
|
+
pendingTasks: z.array(ReviewTask),
|
|
477
|
+
answeredAt: Timestamp.nullable(),
|
|
478
|
+
foldedAt: Timestamp.nullable(),
|
|
479
|
+
/** Why the fold did not land (e.g. the engine's `STALE_REVIEW`) — cleared by a re-answer. */
|
|
480
|
+
foldError: z.string().nullable(),
|
|
481
|
+
/**
|
|
482
|
+
* A paid claim's review deadline (contracts v1.3.1): when its payment reservation runs out — the
|
|
483
|
+
* facilitator's extended expiry, else 24 h after verify. Answers after it are refused
|
|
484
|
+
* `409 REVIEW_EXPIRED`, since the claim could no longer be paid. Null for a source that does not
|
|
485
|
+
* bill (`billingMode: none`), and once the claim no longer awaits review.
|
|
486
|
+
*/
|
|
487
|
+
answerBy: Timestamp.nullable(),
|
|
488
|
+
});
|
|
489
|
+
export const ClaimPayment = z.object({
|
|
490
|
+
/** How it was paid: PAY (`ixo-pay`, in upay), since v1.4 card (`stripe-manual-capture`, US
|
|
491
|
+
* cents: the claim's price), or USDC on Base (`exact`, in USDC base units = micro-USD). */
|
|
492
|
+
scheme: z.enum(["ixo-pay", "stripe-manual-capture", "exact"]),
|
|
493
|
+
amount: BaseUnitAmount,
|
|
494
|
+
asset: z.enum(["upay", "usd", "usdc"]),
|
|
495
|
+
/** The facilitator's settlement id; null while `reserved` (contracts v1.3; was `chargeId`). */
|
|
496
|
+
settlementId: SettlementId.nullable(),
|
|
497
|
+
status: PaymentStatus,
|
|
498
|
+
/** What paid it, once `paid`: the transfer's chain tx hash (PAY) or the captured PaymentIntent
|
|
499
|
+
* (`pi_…`, card); never invented. */
|
|
500
|
+
transaction: z.string().min(1).max(256).nullable(),
|
|
501
|
+
/** A card refund (v1.4.3), as the facilitator reports it — the latest refund's time and id, and
|
|
502
|
+
* the total refunded in US cents. All null until one exists, and always for PAY. */
|
|
503
|
+
refundedAt: Timestamp.nullable(),
|
|
504
|
+
refundId: z.string().min(1).max(256).nullable(),
|
|
505
|
+
refundedAmountCents: z.number().int().nonnegative().nullable(),
|
|
506
|
+
});
|
|
507
|
+
/** The claim's latest event, aggregated over its deliveries (the claim's own `webhookUrl` and
|
|
508
|
+
* every subscribed endpoint): `delivered` only when all are; `dead` if any is; the attempts summed. */
|
|
509
|
+
export const ClaimWebhookState = z.object({
|
|
510
|
+
status: DeliveryStatus,
|
|
511
|
+
attempts: z.int().min(0),
|
|
512
|
+
});
|
|
513
|
+
/** Why a claim failed (§5): the facts lane missed the work order, the engine refused the facts,
|
|
514
|
+
* the stored body no longer matched its digest, or the retry ladder (~4 h) ran out. */
|
|
515
|
+
export const ClaimErrorCode = z.enum([
|
|
516
|
+
"invalid_facts",
|
|
517
|
+
"engine_rejected",
|
|
518
|
+
"body_mismatch",
|
|
519
|
+
"retries_exhausted",
|
|
520
|
+
]);
|
|
521
|
+
/**
|
|
522
|
+
* §4.4 — the sync 200, the GET, and every `claim.*` webhook's `data`. NEVER the answers (§6.3):
|
|
523
|
+
* they are personal data and only the fold re-reads them. `null` wherever a part has not happened.
|
|
524
|
+
* Since v1.2 it shows either lane: an API claim has its `sourceId` and no `collectionId`; a chain
|
|
525
|
+
* claim its on-chain `collectionId`, `metadata` and `payment` null, and a `sourceId` only when read
|
|
526
|
+
* through a source's linked collection.
|
|
527
|
+
*/
|
|
528
|
+
export const ClaimRecord = z.object({
|
|
529
|
+
claimId: RecordClaimId,
|
|
530
|
+
lane: ClaimLane,
|
|
531
|
+
sourceId: SourceId.nullable(),
|
|
532
|
+
collectionId: z.string().min(1).nullable(),
|
|
533
|
+
/** An API claim's protocol; a chain claim's is its collection's. */
|
|
534
|
+
protocolDid: ProtocolDid,
|
|
535
|
+
/**
|
|
536
|
+
* v1.5 (S16) — who the claim is ABOUT: `submitter` on submit, else (v1.7) the answer the
|
|
537
|
+
* source's company link names (`payeeField`) — the payee a decision to pay binds
|
|
538
|
+
* (`submitter:<sourceId>:<submitter>`). An OPAQUE id — never a name, email or phone. Null for a
|
|
539
|
+
* chain claim (its payee is the on-chain agent) and after erasure. Optional only so a record from
|
|
540
|
+
* an oracle before 1.5 still parses.
|
|
541
|
+
*/
|
|
542
|
+
submitter: z.string().nullable().optional(),
|
|
543
|
+
/**
|
|
544
|
+
* v1.7 — who SENT the claim, set by the oracle from the caller, never from the content: the
|
|
545
|
+
* signed-in user's DID for an AI app over OAuth; null for an API key, a console submit and a
|
|
546
|
+
* chain claim.
|
|
547
|
+
*/
|
|
548
|
+
submittedBy: z.string().nullable(),
|
|
549
|
+
/**
|
|
550
|
+
* v1.12.0 — WHICH AI app sent the claim over OAuth; null for an API key, a console submit and a
|
|
551
|
+
* chain claim. `name` is the app's registered name (e.g. "Claude", "ChatGPT", "Codex"),
|
|
552
|
+
* self-declared when it registered — trimmed, at most 100 characters — so on its own it is a
|
|
553
|
+
* hint. `verified` is true when AuthHub registered the app with only Claude's or ChatGPT's own
|
|
554
|
+
* callback, so the token can only be theirs: show the app's icon then. A local app (Claude Code,
|
|
555
|
+
* Codex: loopback redirects) is `verified: false`, whatever its name.
|
|
556
|
+
*/
|
|
557
|
+
submittedVia: z
|
|
558
|
+
.strictObject({ name: z.string().min(1).max(100), verified: z.boolean() })
|
|
559
|
+
.nullable()
|
|
560
|
+
.meta({ example: { name: "Claude", verified: true } }),
|
|
561
|
+
/**
|
|
562
|
+
* v1.7 — the claim content's id, `sha256:<hex>` over the canonical JSON of what you sent (minus
|
|
563
|
+
* `webhookUrl`, with the resolved `protocolDid`): recompute it from your own
|
|
564
|
+
* request to check the receipt is about your claim. Survives erasure. Null for a chain claim and
|
|
565
|
+
* for an API claim accepted before 1.7.
|
|
566
|
+
*/
|
|
567
|
+
contentDigest: z.string().nullable(),
|
|
568
|
+
status: ClaimStatus,
|
|
569
|
+
decision: ClaimDecision.nullable(),
|
|
570
|
+
review: ClaimReviewState.nullable(),
|
|
571
|
+
payment: ClaimPayment.nullable(),
|
|
572
|
+
webhook: ClaimWebhookState.nullable(),
|
|
573
|
+
/** Set when `status` is `failed` (§5). `message` is fixed text per code — never a handler's or
|
|
574
|
+
* the engine's own error text, which can echo answer values. */
|
|
575
|
+
error: z.object({ code: ClaimErrorCode, message: z.string() }).nullable(),
|
|
576
|
+
metadata: z.record(z.string(), z.unknown()).nullable(),
|
|
577
|
+
createdAt: Timestamp,
|
|
578
|
+
decidedAt: Timestamp.nullable(),
|
|
579
|
+
});
|
|
580
|
+
export const ClaimPage = keysetPage(ClaimRecord);
|
|
581
|
+
/**
|
|
582
|
+
* v1.2.1 — the operator's read of a record (`/admin/claims*`): the owning source's display name
|
|
583
|
+
* beside its `sourceId`, since an operator is no member of its customers' sources and cannot look
|
|
584
|
+
* the name up. `null` for a chain claim, which no source owns.
|
|
585
|
+
*/
|
|
586
|
+
export const AdminClaimRecord = ClaimRecord.extend({ sourceName: z.string().nullable() });
|
|
587
|
+
export const AdminClaimPage = keysetPage(AdminClaimRecord);
|
|
588
|
+
/** `GET /v1/api/claims` filters (§4.2); newest first, keyset (§4.1). Loose: an unknown
|
|
589
|
+
* parameter is ignored, as HTTP caches and tracing proxies add their own. `lane` picks one lane;
|
|
590
|
+
* absent, a console member gets both — the source's API claims and its linked collections' chain
|
|
591
|
+
* claims (contracts v1.2) — and an API key `api`, so an integration written before 1.2 sees no
|
|
592
|
+
* chain record it did not ask for (`lane=chain`). `collectionId` narrows to one linked
|
|
593
|
+
* collection's chain claims. */
|
|
594
|
+
export const ListClaimsQuery = z.object({
|
|
595
|
+
lane: ClaimLane.optional(),
|
|
596
|
+
collectionId: z.string().min(1).max(256).optional(),
|
|
597
|
+
status: ClaimStatus.optional(),
|
|
598
|
+
/** The decision's status — `pending_review` is the review queue. */
|
|
599
|
+
decision: DecisionStatus.optional(),
|
|
600
|
+
protocol: ProtocolDid.optional(),
|
|
601
|
+
verdict: Verdict.optional(),
|
|
602
|
+
since: Timestamp.optional(),
|
|
603
|
+
until: Timestamp.optional(),
|
|
604
|
+
limit: z.coerce.number().int().min(1).max(MAX_PAGE_LIMIT).default(100),
|
|
605
|
+
cursor: z.string().max(1024).optional(),
|
|
606
|
+
});
|
|
607
|
+
/** `GET /v1/api/admin/claims` (contracts v1.2): the source list's filters over EVERY source and
|
|
608
|
+
* every watched collection, plus `sourceId` — which finds API claims only. */
|
|
609
|
+
export const AdminListClaimsQuery = ListClaimsQuery.extend({
|
|
610
|
+
sourceId: SourceId.optional(),
|
|
611
|
+
});
|
|
612
|
+
// --- timeline, receipt, report, review, erase (§4.2) -----------------------------------------------
|
|
613
|
+
export const ClaimEventType = z.enum([
|
|
614
|
+
"accepted",
|
|
615
|
+
"paid",
|
|
616
|
+
"facts_produced",
|
|
617
|
+
"decided",
|
|
618
|
+
"review_required",
|
|
619
|
+
"review_answered",
|
|
620
|
+
"folded",
|
|
621
|
+
"unusable",
|
|
622
|
+
"failed",
|
|
623
|
+
"webhook_attempt",
|
|
624
|
+
"erased",
|
|
625
|
+
/** A chain claim's verdict is on chain (contracts v1.2): `data.chainStatus` says whose tx. */
|
|
626
|
+
"chain_submitted",
|
|
627
|
+
/** A paid claim's review passed its `answerBy` unanswered (contracts v1.3.1): `data.answerBy`.
|
|
628
|
+
* The claim stays `pending_review` — closed unpaid. */
|
|
629
|
+
"review_expired",
|
|
630
|
+
]);
|
|
631
|
+
/** One `api_events` row — or, for a chain claim, one step derived from its ledger rows' times.
|
|
632
|
+
* `data` carries names, codes, durations and counts — for `facts_produced` the fact names and
|
|
633
|
+
* their timings, NEVER a value (§4.2). `accepted` carries `protocolDid`, and `via:
|
|
634
|
+
* "oauth:<client_id>"` (1.4.6) when an AI app submitted the claim over OAuth. */
|
|
635
|
+
export const ClaimEvent = z.object({
|
|
636
|
+
id: EventId,
|
|
637
|
+
type: ClaimEventType,
|
|
638
|
+
at: Timestamp,
|
|
639
|
+
data: z.record(z.string(), z.unknown()).nullable(),
|
|
640
|
+
});
|
|
641
|
+
export const ClaimEvents = z.object({ claimId: RecordClaimId, items: z.array(ClaimEvent) });
|
|
642
|
+
/** Everything needed to verify offline: the engine's receipt and where its keys live. */
|
|
643
|
+
export const Receipt = z.object({
|
|
644
|
+
cid: z.string().min(1),
|
|
645
|
+
jws: z.string().min(1),
|
|
646
|
+
/** The engine's `/v1/issuer-keys` — pin the `kid` from there. */
|
|
647
|
+
issuerKeysUrl: z.url(),
|
|
648
|
+
verifyUrl: z.url(),
|
|
649
|
+
});
|
|
650
|
+
/**
|
|
651
|
+
* Mirrors the chain lane's review body (`routes/v1/reviews.ts`): answers cover EXACTLY the
|
|
652
|
+
* pending tasks, and `attestation` — the reviewer's signed statement — is required: a member's
|
|
653
|
+
* from its registered `did:key` (§10), an organisation controller's (a root, 1.11.0) from its
|
|
654
|
+
* `did:ixo` with a `kid` on that DID's document. It is typed optional only so a missing one
|
|
655
|
+
* answers `ATTESTATION_REQUIRED` rather than a generic `VALIDATION`, as on the chain lane.
|
|
656
|
+
*/
|
|
657
|
+
export const ReviewRequest = z.strictObject({
|
|
658
|
+
answers: z.record(z.string().min(1).max(256), z.union([z.boolean(), z.string().max(4096)])),
|
|
659
|
+
attestation: z.string().min(1).max(16384).optional(),
|
|
660
|
+
/** 1.11.0 — the reviewer's authority, a base64 CAR (the chain route's bounds); every link has
|
|
661
|
+
* `nbf` and `exp` ≤ 30 days apart and a `claims/review` cap on `ixo:oracle/<oracle did:web>/
|
|
662
|
+
* source/<sourceId>`, no wildcard. A ROOT: one delegation, issuer = audience = its did:ixo,
|
|
663
|
+
* signed by the attestation's key. A MEMBER: two links — its stored access from a controller,
|
|
664
|
+
* then its did:ixo → its registered reviewer did:key (exactly `claims/review`). REQUIRED — typed
|
|
665
|
+
* optional so a missing one is `400 REVIEWER_GRANT_INVALID` (`absent`), the engine's code. */
|
|
666
|
+
reviewerGrant: z.string().min(1).max(16384).optional(),
|
|
667
|
+
/** The `resultDigest` the reviewer answered; when sent, a different current digest is
|
|
668
|
+
* `409 NOT_PENDING_REVIEW` before the attestation is checked. */
|
|
669
|
+
answeredAgainst: z.string().min(1).optional(),
|
|
670
|
+
});
|
|
671
|
+
/** The stored review, as the chain lane's `reviewBody` shows it — the JWS itself never leaves. */
|
|
672
|
+
export const ReviewRow = z.object({
|
|
673
|
+
claimId: ClaimId,
|
|
674
|
+
answers: z.record(z.string(), z.union([z.boolean(), z.string()])),
|
|
675
|
+
/** A member's reviewer key, or (1.11.0) the organisation controller who answered as root. */
|
|
676
|
+
reviewerDid: z.union([ReviewerDid, AccountDid]),
|
|
677
|
+
answeredAt: Timestamp,
|
|
678
|
+
foldedAt: Timestamp.nullable(),
|
|
679
|
+
foldError: z.string().nullable(),
|
|
680
|
+
});
|
|
681
|
+
/**
|
|
682
|
+
* Why the CALLER cannot answer reviews on this oracle (1.15.0), known before it tries — only what is
|
|
683
|
+
* cheap and certain: `oracle-owner`, it is the account that registered this oracle with the decision
|
|
684
|
+
* engine, which never folds an answer from the oracle's own side (`403 REVIEWER_NOT_AUTHORIZED`,
|
|
685
|
+
* `details.reason: "oracle-owner"`); `not-reviewer`, the caller does not sign answers — an API key
|
|
686
|
+
* (which may still relay a member-signed answer), or a member or AI app without `claims/review`.
|
|
687
|
+
*/
|
|
688
|
+
export const ReviewBlock = z.enum(["oracle-owner", "not-reviewer"]);
|
|
689
|
+
/** Can the caller answer this review? `reason` is set iff `ok` is false. */
|
|
690
|
+
export const CanAnswer = z.object({ ok: z.boolean(), reason: ReviewBlock.optional() });
|
|
691
|
+
/**
|
|
692
|
+
* `GET /v1/api/claims/:claimId/review` — what a reviewer needs to answer (§3.4 `claims/review`):
|
|
693
|
+
* the ONLY read that returns a claim's answers, and only while it awaits review. Every read is an
|
|
694
|
+
* audit row. A file is its own https URL, or a short-lived signed read of an upload.
|
|
695
|
+
*/
|
|
696
|
+
/** A file as a reviewer opens it: its own https URL, or a short-lived signed read of an upload. */
|
|
697
|
+
const ReviewFile = z.object({
|
|
698
|
+
question: z.string().min(1),
|
|
699
|
+
name: z.string().nullable(),
|
|
700
|
+
mediaType: z.string().nullable(),
|
|
701
|
+
url: z.url(),
|
|
702
|
+
});
|
|
703
|
+
/**
|
|
704
|
+
* A possible duplicate the engine holds as review task `unique:<ruleId>` (1.24.0), from its
|
|
705
|
+
* `pendingTaskDetails`. `score` is the duplicate lane's similarity in basis points. `prior` is the
|
|
706
|
+
* earlier claim, never its answers or submitter: its `outcome` is this oracle's decision on it
|
|
707
|
+
* (null when it has none); `claimId`, `submittedAt` and the earlier claim's matched `files` only
|
|
708
|
+
* when it is the SAME source's claim, under the same protocol.
|
|
709
|
+
*/
|
|
710
|
+
const ReviewDuplicate = z.object({
|
|
711
|
+
taskId: z.string().min(1),
|
|
712
|
+
ruleId: z.string().min(1),
|
|
713
|
+
score: z.number().int().min(0).max(10_000).optional(),
|
|
714
|
+
prior: z.object({
|
|
715
|
+
outcome: Verdict.nullable(),
|
|
716
|
+
claimId: ClaimId.optional(),
|
|
717
|
+
submittedAt: Timestamp.optional(),
|
|
718
|
+
files: z.array(ReviewFile).optional(),
|
|
719
|
+
}),
|
|
720
|
+
});
|
|
721
|
+
export const ReviewView = z.object({
|
|
722
|
+
claimId: ClaimId,
|
|
723
|
+
protocolDid: ProtocolDid,
|
|
724
|
+
/** The `resultDigest` being reviewed — send it back as `answeredAgainst`. */
|
|
725
|
+
resultDigest: z.string().min(1),
|
|
726
|
+
pendingTasks: z.array(ReviewTask),
|
|
727
|
+
answers: z.record(z.string(), z.unknown()),
|
|
728
|
+
files: z.array(ReviewFile),
|
|
729
|
+
submittedAt: Timestamp,
|
|
730
|
+
/** The record's `review.answerBy` (contracts v1.3.1): past it, the view still serves the claim
|
|
731
|
+
* but an answer is refused `409 REVIEW_EXPIRED`. */
|
|
732
|
+
answerBy: Timestamp.nullable(),
|
|
733
|
+
/** Whether the CALLER can answer (1.15.0): the console disables the form when it cannot. */
|
|
734
|
+
canAnswer: CanAnswer,
|
|
735
|
+
/** The record's `decision.erroredFacts` (1.20.0): which facts errored and why — omitted when
|
|
736
|
+
* none did. */
|
|
737
|
+
erroredFacts: z.array(ErroredFact).min(1).optional(),
|
|
738
|
+
/** One per pending `unique:<ruleId>` task the engine detailed (1.24.0) — omitted when none. */
|
|
739
|
+
duplicates: z.array(ReviewDuplicate).min(1).optional(),
|
|
740
|
+
});
|
|
741
|
+
/** The engine's decision report in JSON (`Accept: application/json`), proxied as-is — LOOSE
|
|
742
|
+
* because its body is the engine's to grow; only the keys a client joins on are pinned. */
|
|
743
|
+
export const DecisionReport = z.looseObject({
|
|
744
|
+
claimId: RecordClaimId,
|
|
745
|
+
verdict: Verdict.nullable(),
|
|
746
|
+
});
|
|
747
|
+
// --- uploads (§4.2, §6.2) --------------------------------------------------------------------------
|
|
748
|
+
/** `url` is a short-lived signed read (`/v1/api/files/:uploadId?exp=&sig=`) for a person to look at
|
|
749
|
+
* the file, never a public object; a claim references the file by `uploadId`. */
|
|
750
|
+
export const Upload = z.object({
|
|
751
|
+
/** Put this in `attachments[].uploadId`. */
|
|
752
|
+
uploadId: UploadId,
|
|
753
|
+
url: z.url(),
|
|
754
|
+
cid: z.string().min(1),
|
|
755
|
+
mediaType: z.string().min(1),
|
|
756
|
+
size: z.int().min(0).max(MAX_UPLOAD_BYTES),
|
|
757
|
+
});
|
|
758
|
+
/**
|
|
759
|
+
* v1.7: a one-use, signed `PUT` for a client that must not hold the API key (an AI app's sandboxed
|
|
760
|
+
* widget). `uploadUrl` is the whole credential — `PUT` the bytes to it with no `Authorization`
|
|
761
|
+
* before `expiresAt`, and the answer is the same `Upload` as `PUT /v1/api/uploads`, under this
|
|
762
|
+
* `uploadId`. `GET /v1/api/uploads/{uploadId}` reads it back once used.
|
|
763
|
+
*/
|
|
764
|
+
export const UploadLink = z.object({
|
|
765
|
+
uploadId: UploadId,
|
|
766
|
+
uploadUrl: z.url(),
|
|
767
|
+
expiresAt: Timestamp,
|
|
768
|
+
});
|
|
769
|
+
// --- protocols (§4.2) ------------------------------------------------------------------------------
|
|
770
|
+
/** `price: null` — this oracle publishes no price for the protocol (contract v1.1.1): nothing is
|
|
771
|
+
* offered for it, and the facilitator refuses any offer that names it. */
|
|
772
|
+
export const ProtocolSummary = z.object({
|
|
773
|
+
protocolDid: ProtocolDid,
|
|
774
|
+
name: z.string().nullable(),
|
|
775
|
+
price: Price.nullable(),
|
|
776
|
+
});
|
|
777
|
+
export const ProtocolList = z.object({ items: z.array(ProtocolSummary) });
|
|
778
|
+
export const FileQuestion = z.object({
|
|
779
|
+
question: z.string().min(1),
|
|
780
|
+
required: z.boolean(),
|
|
781
|
+
mediaTypes: z.array(z.string().min(1)),
|
|
782
|
+
maxBytes: z.int().min(1).max(MAX_UPLOAD_BYTES),
|
|
783
|
+
});
|
|
784
|
+
/**
|
|
785
|
+
* The work order a CALLER needs (§4.2): what to send, and what will happen to it. Facts are NAMES
|
|
786
|
+
* only — the engine's manifest carries endpoints, audiences and AI instructions that are the
|
|
787
|
+
* oracle's business, not the customer's.
|
|
788
|
+
*/
|
|
789
|
+
export const ProtocolWorkOrder = z.object({
|
|
790
|
+
protocolDid: ProtocolDid,
|
|
791
|
+
name: z.string().nullable(),
|
|
792
|
+
rubricId: z.string().min(1),
|
|
793
|
+
/** JSON Schema (2020-12) for `answers`, derived from the protocol's claim form. */
|
|
794
|
+
answers: z.record(z.string(), z.unknown()),
|
|
795
|
+
files: z.array(FileQuestion),
|
|
796
|
+
facts: z.object({
|
|
797
|
+
ext: z.array(z.string()),
|
|
798
|
+
ai: z.array(z.string()),
|
|
799
|
+
unique: z.boolean(),
|
|
800
|
+
frequency: z.boolean(),
|
|
801
|
+
}),
|
|
802
|
+
reviewTasks: z.array(ReviewTask),
|
|
803
|
+
/** Null when no price is published for the protocol (v1.1.1), as in `ProtocolSummary`. */
|
|
804
|
+
price: Price.nullable(),
|
|
805
|
+
example: SubmitClaimRequest,
|
|
806
|
+
});
|
|
807
|
+
// --- the source and its console (§3, §6.1, §12.2) ----------------------------------------------------
|
|
808
|
+
/** One allowed protocol. The price is the oracle's published one (payments spec §3.1) — no
|
|
809
|
+
* per-source prices (owner, v1.1): a partner who should not pay gets billing mode `none`. */
|
|
810
|
+
export const AllowedProtocol = z.object({ protocolDid: ProtocolDid });
|
|
811
|
+
export const Source = z.object({
|
|
812
|
+
sourceId: SourceId,
|
|
813
|
+
name: z.string().min(1),
|
|
814
|
+
/** The IXO account that created the source (a controller of its organisation then): the deed
|
|
815
|
+
* whose PAY the facilitator reads (§11). Not a root — the organisation's controllers are. */
|
|
816
|
+
ownerDid: AccountDid,
|
|
817
|
+
status: SourceStatus,
|
|
818
|
+
/** Null exactly while `status` is `active`. */
|
|
819
|
+
pausedReason: SourcePausedReason.nullable(),
|
|
820
|
+
billingMode: BillingMode,
|
|
821
|
+
allowedProtocols: z.array(AllowedProtocol),
|
|
822
|
+
refillFloorCents: z.int().min(0).nullable(),
|
|
823
|
+
defaultWebhookUrl: z.url().nullable(),
|
|
824
|
+
contactEmail: z.email().nullable(),
|
|
825
|
+
/** v1.8 — the organisation (its on-chain entity) this source belongs to, from creation, never
|
|
826
|
+
* null (D10): its current controllers administer the source. */
|
|
827
|
+
companyEntityDid: EntityDid,
|
|
828
|
+
/** v1.7 — the answer field the organisation's link names as a claim's payee when no `submitter`
|
|
829
|
+
* is sent; null until the source is `active`. */
|
|
830
|
+
payeeField: z.string().nullable(),
|
|
831
|
+
createdAt: Timestamp,
|
|
832
|
+
/** 1.17.0 — when the company sync first made it `active` (set once, never cleared); null while it
|
|
833
|
+
* has never been active, so a `pending-link` or `disputed` source with null never held claims. */
|
|
834
|
+
activatedAt: Timestamp.nullable(),
|
|
835
|
+
});
|
|
836
|
+
/** Sign-up (§12.3, D10): a current controller of `entityDid` adds this oracle to the organisation.
|
|
837
|
+
* The source starts `pending-link`; the invoker pays (`ownerDid`) but holds no membership — as a
|
|
838
|
+
* controller it is root already. */
|
|
839
|
+
export const CreateSourceRequest = z.strictObject({
|
|
840
|
+
name: z.string().min(1).max(128),
|
|
841
|
+
contactEmail: z.email(),
|
|
842
|
+
/** v1.8 (D10): the organisation — the invoker must be a current controller of it. */
|
|
843
|
+
entityDid: EntityDid,
|
|
844
|
+
});
|
|
845
|
+
/**
|
|
846
|
+
* Where a member stands: `invited` (an email invite nobody has accepted), `accepted` (an account
|
|
847
|
+
* joined, no grant uploaded yet — it can call nothing), `active` (a live grant), `expired`,
|
|
848
|
+
* `revoked`. The owner is always `active`: the root needs no grant.
|
|
849
|
+
*/
|
|
850
|
+
export const MemberStatus = z.enum(["invited", "accepted", "active", "expired", "revoked"]);
|
|
851
|
+
export const Member = z.object({
|
|
852
|
+
memberId: MemberId,
|
|
853
|
+
/** Null until an email invite is accepted by a signed-in IXO account. */
|
|
854
|
+
did: AccountDid.nullable(),
|
|
855
|
+
email: z.email().nullable(),
|
|
856
|
+
/** The preset the grant was made as (§3.4). */
|
|
857
|
+
role: MemberRole,
|
|
858
|
+
status: MemberStatus,
|
|
859
|
+
/** What the live grant allows — the role's preset; empty until a grant is uploaded. */
|
|
860
|
+
capabilities: z.array(Capability),
|
|
861
|
+
/** `nb.protocols` of the grant: the protocols its `claims/*` are narrowed to; null = all. */
|
|
862
|
+
protocols: z.array(ProtocolDid).nullable(),
|
|
863
|
+
expiresAt: Timestamp.nullable(),
|
|
864
|
+
/** The CID of the owner's signed delegation — what a revocation lists. */
|
|
865
|
+
delegationCid: z.string().nullable(),
|
|
866
|
+
revokedAt: Timestamp.nullable(),
|
|
867
|
+
/** The browser-generated key whose attestations this oracle accepts from this member (§10). */
|
|
868
|
+
reviewerDid: ReviewerDid.nullable(),
|
|
869
|
+
/** v1.7 — when the member's own `reviewerDid` delegation expires; null when none is uploaded. */
|
|
870
|
+
reviewerDelegationExpiresAt: Timestamp.nullable(),
|
|
871
|
+
/** The member's own switch for review emails (§10.1); the room follows its own mute. */
|
|
872
|
+
notifyReviews: z.boolean(),
|
|
873
|
+
invitedAt: Timestamp,
|
|
874
|
+
acceptedAt: Timestamp.nullable(),
|
|
875
|
+
});
|
|
876
|
+
export const MemberList = z.object({ items: z.array(Member) });
|
|
877
|
+
/** Returned once, on create and on rotation — never on a read. */
|
|
878
|
+
const WebhookSecret = z.string().regex(/^whsec_[0-9A-Za-z]{32,}$/);
|
|
879
|
+
/** `webhookSecret` signs deliveries to a claim's own `webhookUrl` and the source's default URL
|
|
880
|
+
* (§4.5) — shown here once; `POST /v1/api/source/webhook-secret` rotates it. */
|
|
881
|
+
export const CreateSourceResponse = z.object({
|
|
882
|
+
source: Source,
|
|
883
|
+
webhookSecret: WebhookSecret,
|
|
884
|
+
});
|
|
885
|
+
/** The old secret keeps signing beside the new one until `previousExpiresAt` (24 h). */
|
|
886
|
+
export const RotateWebhookSecretResponse = z.object({
|
|
887
|
+
webhookSecret: WebhookSecret,
|
|
888
|
+
previousExpiresAt: Timestamp,
|
|
889
|
+
});
|
|
890
|
+
/**
|
|
891
|
+
* `GET /v1/api/sources` — the signed-in account's sources on THIS oracle (the console asks every
|
|
892
|
+
* oracle it lists). `delegation` is the member's stored grant (base64 CAR), which the console
|
|
893
|
+
* attaches as its invocation's proof; null for the owner, and until a grant is uploaded.
|
|
894
|
+
*/
|
|
895
|
+
export const MySource = z.object({
|
|
896
|
+
source: Source,
|
|
897
|
+
memberId: MemberId,
|
|
898
|
+
role: MemberRole,
|
|
899
|
+
status: MemberStatus,
|
|
900
|
+
capabilities: z.array(Capability),
|
|
901
|
+
protocols: z.array(ProtocolDid).nullable(),
|
|
902
|
+
expiresAt: Timestamp.nullable(),
|
|
903
|
+
delegation: z.string().nullable(),
|
|
904
|
+
delegationCid: z.string().nullable(),
|
|
905
|
+
});
|
|
906
|
+
export const MySourceList = z.object({ items: z.array(MySource) });
|
|
907
|
+
/**
|
|
908
|
+
* `GET /v1/api/organisations/{entityDid}/sources` query (1.17.0): the organisation's sources on this
|
|
909
|
+
* oracle in every state, keyset-paged (`SourcePage`), for a current controller of the entity only.
|
|
910
|
+
*/
|
|
911
|
+
export const ListOrganisationSourcesQuery = z.object({
|
|
912
|
+
limit: z.coerce.number().int().min(1).max(MAX_PAGE_LIMIT).default(100),
|
|
913
|
+
cursor: z.string().max(1024).optional(),
|
|
914
|
+
});
|
|
915
|
+
/**
|
|
916
|
+
* `POST /v1/api/sources/{sourceId}/company/sync` (v1.8): the source as mirrored from the engine's
|
|
917
|
+
* stored link for its organisation, and its members.
|
|
918
|
+
*/
|
|
919
|
+
export const CompanySyncResponse = z.object({ source: Source, members: z.array(Member) });
|
|
920
|
+
/** An invite names the role the owner will grant; the grant itself is `PUT …/delegation`. An
|
|
921
|
+
* invite by `did` is accepted at once (the account exists); by `email` it waits for `accept`.
|
|
922
|
+
* `owner` here makes a CO-owner: a grant of `source/*`, revocable like any other — the source's
|
|
923
|
+
* roots stay its organisation's current controllers (D10); `ownerDid`, the creator who pays, is
|
|
924
|
+
* not one. */
|
|
925
|
+
export const InviteMemberRequest = z
|
|
926
|
+
.strictObject({
|
|
927
|
+
email: z.email().optional(),
|
|
928
|
+
did: AccountDid.optional(),
|
|
929
|
+
role: MemberRole,
|
|
930
|
+
})
|
|
931
|
+
.refine((b) => b.email !== undefined || b.did !== undefined, {
|
|
932
|
+
message: "an invite names an email or a did",
|
|
933
|
+
});
|
|
934
|
+
/** `inviteToken` is shown once (an email invite only); the console turns it into the link. */
|
|
935
|
+
export const InviteMemberResponse = Member.extend({
|
|
936
|
+
inviteToken: z
|
|
937
|
+
.string()
|
|
938
|
+
.regex(/^inv_[0-9A-Za-z]{32,}$/)
|
|
939
|
+
.nullable(),
|
|
940
|
+
});
|
|
941
|
+
/** `POST /v1/api/members/accept` — the invoking account becomes that member. */
|
|
942
|
+
export const AcceptInviteRequest = z.strictObject({
|
|
943
|
+
inviteToken: z.string().regex(/^inv_[0-9A-Za-z]{32,}$/),
|
|
944
|
+
});
|
|
945
|
+
/**
|
|
946
|
+
* `PUT /v1/api/members/:memberId/delegation` — the owner's signed grant (§3.4 step 3), base64 of
|
|
947
|
+
* the delegation CAR. Checked before it is stored: issued by the owner (or a co-owner holding
|
|
948
|
+
* `source/*` from the owner), to this member's DID, over this source's resource, capabilities
|
|
949
|
+
* EXACTLY the role's preset, not expired. Replacing a grant revokes the previous one.
|
|
950
|
+
*/
|
|
951
|
+
export const GrantMemberRequest = z.strictObject({
|
|
952
|
+
delegation: z
|
|
953
|
+
.string()
|
|
954
|
+
.min(16)
|
|
955
|
+
.max(65536)
|
|
956
|
+
.regex(/^[A-Za-z0-9+/_-]+={0,2}$/),
|
|
957
|
+
role: MemberRole,
|
|
958
|
+
});
|
|
959
|
+
/**
|
|
960
|
+
* A member's own settings: their reviewer key (§10) and their review-email switch (§10.1).
|
|
961
|
+
* Registering a key needs `reviewerProof`: a compact JWS signed by THAT did:key over `{ memberId,
|
|
962
|
+
* sourceId, reviewerDid, iat }` — proof of possession, so a stolen console session cannot enrol a
|
|
963
|
+
* key it does not hold (§14). Clearing it (`null`) needs none. A field left out is left alone. A
|
|
964
|
+
* role change is a revoke plus a new grant, never a PATCH.
|
|
965
|
+
*/
|
|
966
|
+
export const UpdateMemberRequest = z
|
|
967
|
+
.strictObject({
|
|
968
|
+
reviewerDid: ReviewerDid.nullable().optional(),
|
|
969
|
+
reviewerProof: CompactJws.optional(),
|
|
970
|
+
notifyReviews: z.boolean().optional(),
|
|
971
|
+
})
|
|
972
|
+
.refine((b) => (typeof b.reviewerDid === "string") === (b.reviewerProof !== undefined), {
|
|
973
|
+
message: "reviewerProof is required with a reviewerDid, and only then",
|
|
974
|
+
})
|
|
975
|
+
.refine((b) => b.reviewerDid !== undefined || b.notifyReviews !== undefined, {
|
|
976
|
+
message: "name a reviewerDid or notifyReviews",
|
|
977
|
+
});
|
|
978
|
+
/** A key as every read shows it: the prefix, never the secret (§3.3 — shown once, at create). */
|
|
979
|
+
export const ApiKey = z.object({
|
|
980
|
+
prefix: KeyPrefix,
|
|
981
|
+
name: z.string().nullable(),
|
|
982
|
+
/** `eo_live_7f3a9c1d_…` — what the console prints. */
|
|
983
|
+
masked: z.string().regex(/^eo_(live|test)_[0-9a-z]{8}_\u2026$/),
|
|
984
|
+
environment: z.enum(["live", "test"]),
|
|
985
|
+
scopes: z.array(Scope).min(1),
|
|
986
|
+
maxSpendCentsPerDay: z.int().min(1).nullable(),
|
|
987
|
+
createdAt: Timestamp,
|
|
988
|
+
lastUsedAt: Timestamp.nullable(),
|
|
989
|
+
/** Future while a rotation's grace period runs (`DELETE …?graceDays=`); the key works until then. */
|
|
990
|
+
revokedAt: Timestamp.nullable(),
|
|
991
|
+
});
|
|
992
|
+
export const KeyList = z.object({ items: z.array(ApiKey) });
|
|
993
|
+
export const CreateApiKeyRequest = z.strictObject({
|
|
994
|
+
name: z.string().min(1).max(64).optional(),
|
|
995
|
+
scopes: z.array(Scope).min(1).max(3),
|
|
996
|
+
maxSpendCentsPerDay: z.int().min(1).optional(),
|
|
997
|
+
});
|
|
998
|
+
/** `DELETE /v1/api/keys/:prefix` — `graceDays` > 0 lets a rotation overlap (§3.3: up to 30 days). */
|
|
999
|
+
export const RevokeApiKeyQuery = z.object({
|
|
1000
|
+
graceDays: z.coerce.number().int().min(0).max(30).default(0),
|
|
1001
|
+
});
|
|
1002
|
+
/** The only response that ever carries the full key. */
|
|
1003
|
+
export const CreateApiKeyResponse = ApiKey.extend({
|
|
1004
|
+
key: z.string().regex(/^eo_(live|test)_[0-9a-z]{8}_[0-9A-Za-z]{32,}$/),
|
|
1005
|
+
});
|
|
1006
|
+
/** A source's settings (§12.2 Settings). The allow-list and the billing mode are the operator's
|
|
1007
|
+
* (`/v1/api/admin/sources/:id/…`), because they are commercial terms. */
|
|
1008
|
+
export const SourceSettings = z
|
|
1009
|
+
.strictObject({
|
|
1010
|
+
name: z.string().min(1).max(128).optional(),
|
|
1011
|
+
defaultWebhookUrl: HttpsUrl.nullable().optional(),
|
|
1012
|
+
contactEmail: z.email().optional(),
|
|
1013
|
+
refillFloorCents: z.int().min(0).nullable().optional(),
|
|
1014
|
+
})
|
|
1015
|
+
.refine((b) => Object.keys(b).length > 0, { message: "nothing to update" });
|
|
1016
|
+
export const AuditEntry = z.object({
|
|
1017
|
+
id: AuditId,
|
|
1018
|
+
/** Null for an action on no one source (an operator's cross-source change). */
|
|
1019
|
+
sourceId: SourceId.nullable(),
|
|
1020
|
+
/** Who: a member's DID, an API key's prefix, an operator's DID, or — `system` — the oracle's own
|
|
1021
|
+
* scheduled job as `system:<job>` (e.g. `system:link-recheck` dropping a linked collection).
|
|
1022
|
+
* `oauth` (1.4.6): a user (`id`, their DID) acting through an AI app connected to the oracle's
|
|
1023
|
+
* MCP server over OAuth — `clientId` and `clientName` name the app, as AuthHub registered it. */
|
|
1024
|
+
actor: z.object({
|
|
1025
|
+
kind: z.enum(["member", "key", "operator", "system", "oauth"]),
|
|
1026
|
+
id: z.string().min(1),
|
|
1027
|
+
clientId: z.string().optional(),
|
|
1028
|
+
clientName: z.string().optional(),
|
|
1029
|
+
}),
|
|
1030
|
+
/** Dotted verb, e.g. `key.created`, `member.role_changed`, `claim.body_erased`. */
|
|
1031
|
+
action: z.string().min(1),
|
|
1032
|
+
target: z.string().nullable(),
|
|
1033
|
+
at: Timestamp,
|
|
1034
|
+
details: z.record(z.string(), z.unknown()).nullable(),
|
|
1035
|
+
});
|
|
1036
|
+
export const AuditPage = keysetPage(AuditEntry);
|
|
1037
|
+
// --- webhooks management (§4.5) ----------------------------------------------------------------------
|
|
1038
|
+
/** Appendix B. Declared here, not in webhooks.ts, because endpoints subscribe to them and the
|
|
1039
|
+
* envelope there carries `ClaimRecord` — one direction of import, no cycle. */
|
|
1040
|
+
export const WebhookEventType = z.enum([
|
|
1041
|
+
"claim.accepted",
|
|
1042
|
+
"claim.decided",
|
|
1043
|
+
"claim.review_required",
|
|
1044
|
+
"claim.folded",
|
|
1045
|
+
"claim.unusable",
|
|
1046
|
+
"claim.failed",
|
|
1047
|
+
/** contracts v1.3.1: a paid claim's review closed unanswered at `review.answerBy` — unpaid. */
|
|
1048
|
+
"claim.review_expired",
|
|
1049
|
+
"source.paused",
|
|
1050
|
+
"source.resumed",
|
|
1051
|
+
"payment.settled",
|
|
1052
|
+
"balance.low",
|
|
1053
|
+
]);
|
|
1054
|
+
/** An endpoint's subscriptions; `[]` = every event, including types added later. */
|
|
1055
|
+
const Subscriptions = z.array(WebhookEventType);
|
|
1056
|
+
export const WebhookEndpoint = z.object({
|
|
1057
|
+
endpointId: EndpointId,
|
|
1058
|
+
url: z.url(),
|
|
1059
|
+
events: Subscriptions,
|
|
1060
|
+
enabled: z.boolean(),
|
|
1061
|
+
createdAt: Timestamp,
|
|
1062
|
+
});
|
|
1063
|
+
export const EndpointList = z.object({ items: z.array(WebhookEndpoint) });
|
|
1064
|
+
export const CreateWebhookEndpointRequest = z.strictObject({
|
|
1065
|
+
url: HttpsUrl,
|
|
1066
|
+
events: Subscriptions,
|
|
1067
|
+
});
|
|
1068
|
+
export const CreateWebhookEndpointResponse = WebhookEndpoint.extend({ secret: WebhookSecret });
|
|
1069
|
+
export const UpdateWebhookEndpointRequest = z
|
|
1070
|
+
.strictObject({
|
|
1071
|
+
url: HttpsUrl.optional(),
|
|
1072
|
+
events: Subscriptions.optional(),
|
|
1073
|
+
enabled: z.boolean().optional(),
|
|
1074
|
+
/** Issue a new secret; the old one keeps verifying for 24 h so receivers can roll over. */
|
|
1075
|
+
rotateSecret: z.literal(true).optional(),
|
|
1076
|
+
})
|
|
1077
|
+
.refine((b) => Object.keys(b).length > 0, { message: "nothing to update" });
|
|
1078
|
+
/** `secret` present iff the PATCH rotated it. */
|
|
1079
|
+
export const UpdateWebhookEndpointResponse = WebhookEndpoint.extend({
|
|
1080
|
+
secret: WebhookSecret.optional(),
|
|
1081
|
+
});
|
|
1082
|
+
export const WebhookDelivery = z.object({
|
|
1083
|
+
id: DeliveryId,
|
|
1084
|
+
eventId: EventId,
|
|
1085
|
+
type: WebhookEventType,
|
|
1086
|
+
status: DeliveryStatus,
|
|
1087
|
+
attempts: z.int().min(0).max(8),
|
|
1088
|
+
lastStatusCode: z.int().nullable(),
|
|
1089
|
+
nextAttemptAt: Timestamp.nullable(),
|
|
1090
|
+
createdAt: Timestamp,
|
|
1091
|
+
});
|
|
1092
|
+
export const DeliveryPage = keysetPage(WebhookDelivery);
|
|
1093
|
+
/**
|
|
1094
|
+
* `GET /v1/api/webhooks/deliveries/:deliveryId` — one delivery with what was sent. Only the LAST
|
|
1095
|
+
* attempt's outcome is kept (v1.1); the envelope is null once the claim's body retention erased it.
|
|
1096
|
+
*/
|
|
1097
|
+
export const WebhookDeliveryDetail = WebhookDelivery.extend({
|
|
1098
|
+
/** Null for a claim's own `webhookUrl` or the source's default URL. */
|
|
1099
|
+
endpointId: EndpointId.nullable(),
|
|
1100
|
+
/** Where it was posted; null once the claim's body retention erased it (a webhook URL is
|
|
1101
|
+
* personal data, §6.3), like the envelope. */
|
|
1102
|
+
targetUrl: z.url().nullable(),
|
|
1103
|
+
request: z.object({ body: z.unknown().nullable() }),
|
|
1104
|
+
lastError: z.string().nullable(),
|
|
1105
|
+
});
|
|
1106
|
+
// --- linked collections (S3 M6) ----------------------------------------------------------------------
|
|
1107
|
+
/** An on-chain claim collection id (a uint64, as the chain and Blocksync print it). */
|
|
1108
|
+
export const CollectionId = z.string().regex(/^[0-9]{1,20}$/);
|
|
1109
|
+
/**
|
|
1110
|
+
* An on-chain collection the source has linked: its chain claims then read with the source's own.
|
|
1111
|
+
* `linkedBy` is either a member who owns the collection entity on chain (company authority D9) —
|
|
1112
|
+
* re-checked hourly; a link whose linker no longer owns it is dropped — or (1.21.0) the source's
|
|
1113
|
+
* own `companyEntityDid`, for a link the oracle made at the collection's registration because the
|
|
1114
|
+
* engine names that organisation as the collection's company — re-checked hourly against the
|
|
1115
|
+
* engine, dropped when it no longer does. Only a drop hides a link (1.23.0): a re-check that cannot
|
|
1116
|
+
* read the chain or the engine keeps it in the reads. Billing stays the collection owner's on-chain evaluation
|
|
1117
|
+
* payment: never a 402 here.
|
|
1118
|
+
*/
|
|
1119
|
+
export const LinkedCollection = z.object({
|
|
1120
|
+
collectionId: CollectionId,
|
|
1121
|
+
protocolDid: ProtocolDid,
|
|
1122
|
+
linkedBy: z.union([AccountDid, EntityDid]),
|
|
1123
|
+
linkedAt: Timestamp,
|
|
1124
|
+
});
|
|
1125
|
+
export const LinkedCollectionList = z.object({ items: z.array(LinkedCollection) });
|
|
1126
|
+
export const LinkCollectionRequest = z.strictObject({ collectionId: CollectionId });
|
|
1127
|
+
// --- me (§4.2, §12.3) ------------------------------------------------------------------------------
|
|
1128
|
+
/**
|
|
1129
|
+
* The source owner's balance — the deed of `ownerDid`, not of whichever live member paid a given
|
|
1130
|
+
* offer — as the facilitator sees it (`GET /v1/balances`, payments spec §5.3), base units
|
|
1131
|
+
* of `upay` (1 upay = 1 micro-USD): `balance` in the deed, `sendLimit` left on the send permission
|
|
1132
|
+
* (null = no permission granted yet), `reserved` for claims awaiting their receipt, `settled` on a
|
|
1133
|
+
* receipt and not yet transferred, `paying` in the transfer under way, `available` = what a new
|
|
1134
|
+
* reservation may take (contracts v1.3; was `held` / `spent`).
|
|
1135
|
+
*/
|
|
1136
|
+
export const Credits = z.object({
|
|
1137
|
+
asset: z.literal("upay"),
|
|
1138
|
+
balance: BaseUnitAmount,
|
|
1139
|
+
sendLimit: BaseUnitAmount.nullable(),
|
|
1140
|
+
reserved: BaseUnitAmount,
|
|
1141
|
+
settled: BaseUnitAmount,
|
|
1142
|
+
paying: BaseUnitAmount,
|
|
1143
|
+
available: BaseUnitAmount,
|
|
1144
|
+
});
|
|
1145
|
+
// --- review billing (1.22.0: per-review checker billing for chain claims) -------------------------
|
|
1146
|
+
/**
|
|
1147
|
+
* A source's standing review-billing delegation (while IXO's plan lets the oracle bill reviews): the x402-ixo-pay
|
|
1148
|
+
* payment delegation (base64 CAR, one `billing/pay` on `billing:decision-api` to the facilitator,
|
|
1149
|
+
* `nb: { maxAmount, denom: "upay", oracles: [<this oracle's did:web>] }`, an `exp`, no proofs, no
|
|
1150
|
+
* facts) its organisation's CURRENT chain owner signed. It pays for every review of the
|
|
1151
|
+
* organisation's chain collections' claims, from the owner's subscription credits.
|
|
1152
|
+
*/
|
|
1153
|
+
export const SetReviewBillingRequest = z.strictObject({
|
|
1154
|
+
delegation: z.string().min(1).max(16_384),
|
|
1155
|
+
});
|
|
1156
|
+
/**
|
|
1157
|
+
* `active`; `expired` past its `exp`; `exhausted` when what is left of `maxAmount` covers no
|
|
1158
|
+
* review; `payer_not_owner` when its signer is no longer the organisation's chain owner.
|
|
1159
|
+
*/
|
|
1160
|
+
export const ReviewBillingState = z.enum(["active", "expired", "exhausted", "payer_not_owner"]);
|
|
1161
|
+
/**
|
|
1162
|
+
* Why a collection's reviews are paused: `payer-credits` — the payer's credits (or the send
|
|
1163
|
+
* permission behind them) do not cover a review: top up; `payer-delegation` — no usable delegation
|
|
1164
|
+
* (none, expired, used up, its signer no longer the owner): store a new one.
|
|
1165
|
+
*/
|
|
1166
|
+
export const PayerPausedReason = z.enum(["payer-credits", "payer-delegation"]);
|
|
1167
|
+
/**
|
|
1168
|
+
* The stored delegation as the Console reads it — never the token. `spent` / `remaining` are this
|
|
1169
|
+
* oracle's own count against `maxAmount` (the facilitator exposes none; the delegation is bound to
|
|
1170
|
+
* this oracle alone, so the two agree); `credits` the payer's balance at the facilitator, null until
|
|
1171
|
+
* it answers this oracle (after the first review is reserved).
|
|
1172
|
+
*/
|
|
1173
|
+
export const ReviewBilling = z.object({
|
|
1174
|
+
sourceId: SourceId,
|
|
1175
|
+
state: ReviewBillingState,
|
|
1176
|
+
payer: AccountDid,
|
|
1177
|
+
delegationCid: z.string().min(1),
|
|
1178
|
+
maxAmount: BaseUnitAmount,
|
|
1179
|
+
spent: BaseUnitAmount,
|
|
1180
|
+
remaining: BaseUnitAmount,
|
|
1181
|
+
expiresAt: Timestamp,
|
|
1182
|
+
credits: Credits.nullable(),
|
|
1183
|
+
pricePerReview: z.array(z.object({ protocolDid: ProtocolDid, amount: BaseUnitAmount, amountCents: z.int().min(0) })),
|
|
1184
|
+
pausedCollections: z.array(z.object({ collectionId: CollectionId, reason: PayerPausedReason, since: Timestamp })),
|
|
1185
|
+
createdBy: AccountDid,
|
|
1186
|
+
createdAt: Timestamp,
|
|
1187
|
+
updatedAt: Timestamp,
|
|
1188
|
+
});
|
|
1189
|
+
/** `DELETE`'s answer: whether a delegation was held, and what a full stop takes. */
|
|
1190
|
+
export const ReviewBillingDeleted = z.object({ deleted: z.boolean(), message: z.string() });
|
|
1191
|
+
export const Limits = z.object({
|
|
1192
|
+
maxBodyBytes: z.int(),
|
|
1193
|
+
maxUploadBytes: z.int(),
|
|
1194
|
+
maxBatchClaims: z.int(),
|
|
1195
|
+
maxWaitSeconds: z.int(),
|
|
1196
|
+
maxConcurrentWaiters: z.int(),
|
|
1197
|
+
maxPageLimit: z.int(),
|
|
1198
|
+
});
|
|
1199
|
+
/** Who is asking — the console resolves its API-developer role from this (§12.3). */
|
|
1200
|
+
export const Caller = z.discriminatedUnion("kind", [
|
|
1201
|
+
z.object({ kind: z.literal("key"), prefix: KeyPrefix, scopes: z.array(Scope) }),
|
|
1202
|
+
z.object({
|
|
1203
|
+
kind: z.literal("member"),
|
|
1204
|
+
memberId: MemberId,
|
|
1205
|
+
did: AccountDid,
|
|
1206
|
+
role: MemberRole,
|
|
1207
|
+
capabilities: z.array(Capability),
|
|
1208
|
+
protocols: z.array(ProtocolDid).nullable(),
|
|
1209
|
+
}),
|
|
1210
|
+
/** v1.8 (D10) — a current controller of the source's organisation, invoking as root with no
|
|
1211
|
+
* membership: every capability. */
|
|
1212
|
+
z.object({ kind: z.literal("controller"), did: AccountDid, capabilities: z.array(Capability) }),
|
|
1213
|
+
]);
|
|
1214
|
+
/**
|
|
1215
|
+
* Least exposure (§14): `members` (emails, DIDs) only to a console member — never to an API key;
|
|
1216
|
+
* `keys` to a key or a member with `keys/manage`; `webhookEndpoints` to a key with
|
|
1217
|
+
* `webhooks:manage` or a member with `webhooks/manage`; `credits` to a key or a member with
|
|
1218
|
+
* `spend/read`. `credits` is the source owner's balance (another live member who pays an offer
|
|
1219
|
+
* has their own, not shown here); null when the source pays nothing here (billing mode `none`,
|
|
1220
|
+
* payments off) or the facilitator could not be read.
|
|
1221
|
+
*/
|
|
1222
|
+
export const Me = z.object({
|
|
1223
|
+
caller: Caller,
|
|
1224
|
+
source: Source,
|
|
1225
|
+
members: z.array(Member).optional(),
|
|
1226
|
+
keys: z.array(ApiKey).optional(),
|
|
1227
|
+
credits: Credits.nullable().optional(),
|
|
1228
|
+
limits: Limits,
|
|
1229
|
+
webhookEndpoints: z.array(WebhookEndpoint).optional(),
|
|
1230
|
+
/** Why the caller can answer no review on this source (1.15.0, `ReviewBlock`); null when it can. */
|
|
1231
|
+
reviewBlocked: ReviewBlock.nullable(),
|
|
1232
|
+
});
|
|
1233
|
+
// --- operator (§12.2 "operator view") ----------------------------------------------------------------
|
|
1234
|
+
export const SourcePage = keysetPage(Source);
|
|
1235
|
+
export const PauseSourceRequest = z.strictObject({ note: z.string().max(1024).optional() });
|
|
1236
|
+
/** Replaces the allow-list whole — a PUT, so the console's form is the truth. */
|
|
1237
|
+
export const SetSourceProtocolsRequest = z.strictObject({
|
|
1238
|
+
protocols: z.array(z.strictObject({ protocolDid: ProtocolDid })),
|
|
1239
|
+
});
|
|
1240
|
+
/** `PUT /v1/api/admin/sources/:sourceId/billing-mode` — operators only, never the source's members. */
|
|
1241
|
+
export const SetBillingModeRequest = z.strictObject({ billingMode: BillingMode });
|
|
1242
|
+
/**
|
|
1243
|
+
* `GET /v1/api/admin/facilitator-delegation` (contracts v1.4.1): S10's card facilitator
|
|
1244
|
+
* (`ixo-pay-facilitator`) trusts this oracle's did:web as its root for operator actions, so an
|
|
1245
|
+
* operator reaches it with a delegation the oracle signs — one capability per requested action
|
|
1246
|
+
* (never `*`, never the retired `operators/manage`), no `nb`, to the operator's own did:ixo, at
|
|
1247
|
+
* most an hour. Minted fresh every call (a nonce each), never cached.
|
|
1248
|
+
*/
|
|
1249
|
+
export const FACILITATOR_RESOURCE = "ixo:ixo-pay-facilitator";
|
|
1250
|
+
export const FACILITATOR_DELEGATION_MAX_TTL_SEC = 3600;
|
|
1251
|
+
/** The facilitator's operator actions (S10), in the order a delegation lists them. */
|
|
1252
|
+
export const FacilitatorAction = z.enum([
|
|
1253
|
+
"operators/onboard",
|
|
1254
|
+
"operators/read",
|
|
1255
|
+
"operators/refund",
|
|
1256
|
+
"operators/evidence",
|
|
1257
|
+
]);
|
|
1258
|
+
export const FacilitatorDelegationQuery = z.object({
|
|
1259
|
+
/** Comma-separated, deduplicated, put in `FacilitatorAction` order; absent ⇒ all four. */
|
|
1260
|
+
actions: z
|
|
1261
|
+
.string()
|
|
1262
|
+
.optional()
|
|
1263
|
+
.transform((raw, ctx) => {
|
|
1264
|
+
if (raw === undefined)
|
|
1265
|
+
return [...FacilitatorAction.options];
|
|
1266
|
+
const asked = new Set(raw.split(",").map((a) => a.trim()));
|
|
1267
|
+
const unknown = [...asked].filter((a) => !FacilitatorAction.safeParse(a).success);
|
|
1268
|
+
if (unknown.length > 0) {
|
|
1269
|
+
// A `payouts/*` ask is a Console still on the retired payout grant (CA-M8): say where it went.
|
|
1270
|
+
const payouts = unknown.some((a) => a.startsWith("payouts/"))
|
|
1271
|
+
? " Payout access is not granted here: the payouts facilitator's own team (its company's admins) grants it."
|
|
1272
|
+
: "";
|
|
1273
|
+
ctx.addIssue({
|
|
1274
|
+
code: "custom",
|
|
1275
|
+
message: `${unknown.map((a) => (a === "" ? "(empty)" : a)).join(", ")} is not a facilitator action. Ask for one or more of ${FacilitatorAction.options.join(", ")}, separated by commas.${payouts}`,
|
|
1276
|
+
});
|
|
1277
|
+
return z.NEVER;
|
|
1278
|
+
}
|
|
1279
|
+
return FacilitatorAction.options.filter((a) => asked.has(a));
|
|
1280
|
+
}),
|
|
1281
|
+
ttl: z.coerce.number().int().min(60).max(FACILITATOR_DELEGATION_MAX_TTL_SEC).default(3600),
|
|
1282
|
+
});
|
|
1283
|
+
export const FacilitatorCapability = z.object({
|
|
1284
|
+
with: z.literal(FACILITATOR_RESOURCE),
|
|
1285
|
+
can: FacilitatorAction,
|
|
1286
|
+
});
|
|
1287
|
+
export const FacilitatorDelegation = z.object({
|
|
1288
|
+
/** A UCAN delegation as a base64 CAR — the same encoding as a console role grant. */
|
|
1289
|
+
delegation: z.string().min(1),
|
|
1290
|
+
/** `did:web:<ORACLE_HOSTNAME>`, signed with the key `/.well-known/did.json` publishes. */
|
|
1291
|
+
issuer: z.string().startsWith("did:web:"),
|
|
1292
|
+
/** The invoking operator's did:ixo. */
|
|
1293
|
+
audience: AccountDid,
|
|
1294
|
+
/** Exactly the delegation's `att`: one per requested action. */
|
|
1295
|
+
capabilities: z.array(FacilitatorCapability).min(1),
|
|
1296
|
+
expiresAt: Timestamp,
|
|
1297
|
+
});
|
|
1298
|
+
// --- export (§6.3) -----------------------------------------------------------------------------------
|
|
1299
|
+
/** The source's personal data (claim bodies, metadata, members, endpoints, the list of uploaded files,
|
|
1300
|
+
* the webhook delivery log, review answers) as one archive, behind a short-lived signed URL
|
|
1301
|
+
* — the export route §6.3 promises. */
|
|
1302
|
+
export const DataExport = z.object({ url: z.url(), expiresAt: Timestamp });
|
|
1303
|
+
//# sourceMappingURL=api.js.map
|