logicsrc/packages/validators/src/schemas.ts
Anthony Ettinger 1d69dc3804
OpenErrand 0.1: an errand on a website with no API, with the human steps kept human (#227)
* OpenErrand 0.1: an errand on a website with no API, with the human steps kept human

docs/openerrand.md mints OpenErrand: one JSON file per errand (register an
account, download a transcript) naming the site, the inputs with a
sensitivity class and ordered sources (document, vault, prompt, generate,
derive, candidate, literal), field rules matched by id then label, page and
wait steps, five human gates a runner never performs (declare,
identity-proofing, code, mail, captcha), outcomes, the never-retried shared
secret, vault and download outputs, hand-off cards that may name only public
inputs, the publisher index at /.well-known/openerrand.json, and thirteen
runner rules. The worked example is the MyFTB business registration that
cli-tools `ftb` performs (profullstack/cli-tools#125), with no personal data.

- @logicsrc/schemas: openerrand + openerrand-index schemas and fixtures
- @logicsrc/validators: semantic checks (references, templates, no personal
  or secret input on a card) and tests that validate the spec's own examples
- logicsrc-web: registry entry (process family), /openerrand landing page,
  the example and the index served as static files, contract tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* OpenErrand: hand-off cards stay on the surface that owns the data

Anthony's ruling: tax and finance data never touches a social or promotion
tool, and nothing is sent to a CPA or preparer.

- Hand-off cards are delivered only on the surface that owns the errand's
  data (for a tax or finance errand, the principal's finance app through its
  CLI, PWA, MCP server or API, such as CoinPay, or the runner's terminal),
  never a social, promotion or third-party posting service, and never to
  anyone but the principal. A card for an errand with personal or secret
  inputs does not leave that surface. Runner rule 9 says the same.
- The run record and the sample run name the card by an opaque id
  (pin-letter/7f3k2q) instead of a mynaposter.com URL; the myna mention is gone.
- `principal: represented` no longer cites a preparer with a power of attorney.
- The FTB card's last step no longer suggests sending the PIN to someone else.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* OpenErrand: user-agent rule, captcha solver policy, reference runner note

Anthony's answers on #227 ("go with your recommendations"):

- Rule 11: a runner may run headless with a normal desktop browser user agent
  (dropping HeadlessChrome) and nothing more: no fingerprint spoofing beyond
  the UA string, no stealth plugins, no solving or evading a bot challenge.
  A challenge the browser completes itself is a wait step; any other is a
  captcha gate.
- Captcha solvers: new site.sector and captcha step `solver`
  (forbidden by default | allowed). Never allowed on government, tax,
  financial, healthcare or identity-provider sites, nor on any errand with a
  declare or identity-proofing step or a secret input; elsewhere only when the
  file says so, with every use logged. The validator rejects `allowed` in the
  forbidden set or without a stated sector; six new tests. The FTB example
  states sector "tax".
- Reference runner: @logicsrc/openerrand / `logicsrc errand run`, marked in
  progress; ftb stays the runner the example was taken from.
- Name stays OpenErrand; family stays Agents and process.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 08:57:10 -07:00

149 lines
9.1 KiB
TypeScript

import openabtestManifestSchema from "@logicsrc/schemas/openabtest-manifest" with { type: "json" };
import openabtestEventSchema from "@logicsrc/schemas/openabtest-event" with { type: "json" };
/**
* Every LogicSRC JSON Schema, keyed by kind.
*
* Schemas are imported through @logicsrc/schemas package exports rather than by
* a relative path across the repository. A relative import works in the
* monorepo and breaks the moment this package is published: "../../schemas/..."
* resolves outside the published tarball, so an installed @logicsrc/validators
* could not load a single schema.
*/
import agentSchema from "@logicsrc/schemas/agent" with { type: "json" };
import openrentalSchema from "@logicsrc/schemas/openrental" with { type: "json" };
import openerrandSchema from "@logicsrc/schemas/openerrand" with { type: "json" };
import openerrandIndexSchema from "@logicsrc/schemas/openerrand-index" with { type: "json" };
import accountAuditEventSchema from "@logicsrc/schemas/account-audit-event" with { type: "json" };
import accountGrantSchema from "@logicsrc/schemas/account-grant" with { type: "json" };
import accountProviderSchema from "@logicsrc/schemas/account-provider" with { type: "json" };
import connectedAccountSchema from "@logicsrc/schemas/connected-account" with { type: "json" };
import emailMessageSchema from "@logicsrc/schemas/email-message" with { type: "json" };
import eventSchema from "@logicsrc/schemas/event" with { type: "json" };
import pluginSchema from "@logicsrc/schemas/plugin" with { type: "json" };
import pullRequestSchema from "@logicsrc/schemas/pull-request" with { type: "json" };
import repoSchema from "@logicsrc/schemas/repo" with { type: "json" };
import runSchema from "@logicsrc/schemas/run" with { type: "json" };
import socialPostSchema from "@logicsrc/schemas/social-post" with { type: "json" };
import taskSchema from "@logicsrc/schemas/task" with { type: "json" };
import agentadAdSchema from "@logicsrc/schemas/agentad-ad" with { type: "json" };
import agentadPlacementSchema from "@logicsrc/schemas/agentad-placement" with { type: "json" };
import agentadAdRequestSchema from "@logicsrc/schemas/agentad-ad-request" with { type: "json" };
import agentadAdResponseSchema from "@logicsrc/schemas/agentad-ad-response" with { type: "json" };
import agentadImpressionSchema from "@logicsrc/schemas/agentad-impression" with { type: "json" };
import agentadClickSchema from "@logicsrc/schemas/agentad-click" with { type: "json" };
import agentadCampaignSchema from "@logicsrc/schemas/agentad-campaign" with { type: "json" };
import credentialProviderSchema from "@logicsrc/schemas/credential-provider" with { type: "json" };
import credentialSyncPlanSchema from "@logicsrc/schemas/credential-sync-plan" with { type: "json" };
import credentialSyncRunSchema from "@logicsrc/schemas/credential-sync-run" with { type: "json" };
import credentialAuditEventSchema from "@logicsrc/schemas/credential-audit-event" with { type: "json" };
import openprdPrdSchema from "@logicsrc/schemas/openprd-prd" with { type: "json" };
import ontologyManifestSchema from "@logicsrc/schemas/openontology-manifest" with { type: "json" };
import ontologyNamespaceSchema from "@logicsrc/schemas/openontology-namespace" with { type: "json" };
import ontologyEntityTypeSchema from "@logicsrc/schemas/openontology-entity-type" with { type: "json" };
import ontologyPropertySchema from "@logicsrc/schemas/openontology-property" with { type: "json" };
import ontologyRelationshipTypeSchema from "@logicsrc/schemas/openontology-relationship-type" with { type: "json" };
import ontologyConstraintSchema from "@logicsrc/schemas/openontology-constraint" with { type: "json" };
import ontologyQuerySchema from "@logicsrc/schemas/openontology-query" with { type: "json" };
import ontologyActionSchema from "@logicsrc/schemas/openontology-action" with { type: "json" };
import ontologyEntitySchema from "@logicsrc/schemas/openontology-entity" with { type: "json" };
import ontologyClaimSchema from "@logicsrc/schemas/openontology-claim" with { type: "json" };
import ontologySourceSchema from "@logicsrc/schemas/openontology-source" with { type: "json" };
import ontologyEvidenceSchema from "@logicsrc/schemas/openontology-evidence" with { type: "json" };
import ontologyChangeSetSchema from "@logicsrc/schemas/openontology-changeset" with { type: "json" };
import ontologyReviewSchema from "@logicsrc/schemas/openontology-review" with { type: "json" };
import ontologyApprovalSchema from "@logicsrc/schemas/openontology-approval" with { type: "json" };
import ontologyEventSchema from "@logicsrc/schemas/openontology-event" with { type: "json" };
import ontologyPackageSchema from "@logicsrc/schemas/openontology-package" with { type: "json" };
import ocManifestSchema from "@logicsrc/schemas/opencontext-manifest" with { type: "json" };
import ocObjectSchema from "@logicsrc/schemas/opencontext-object" with { type: "json" };
import ocBundleSchema from "@logicsrc/schemas/opencontext-bundle" with { type: "json" };
import ocRoleSchema from "@logicsrc/schemas/opencontext-role" with { type: "json" };
import ocProvenanceSchema from "@logicsrc/schemas/opencontext-provenance" with { type: "json" };
import ocDecisionSchema from "@logicsrc/schemas/opencontext-decision" with { type: "json" };
import ocDiagnosticSchema from "@logicsrc/schemas/opencontext-diagnostic" with { type: "json" };
import ocAuditEventSchema from "@logicsrc/schemas/opencontext-audit-event" with { type: "json" };
// OpenCreds. The database schema $refs the item and manifest schemas by $id,
// so all six are registered together in index.ts before anything is compiled.
import credsItemSchema from "@logicsrc/schemas/opencreds-item" with { type: "json" };
import credsEnvelopeSchema from "@logicsrc/schemas/opencreds-envelope" with { type: "json" };
import credsVaultMetaSchema from "@logicsrc/schemas/opencreds-vault-meta" with { type: "json" };
import credsManifestSchema from "@logicsrc/schemas/opencreds-manifest" with { type: "json" };
import credsDatabaseSchema from "@logicsrc/schemas/opencreds-database" with { type: "json" };
import credsAuditEventSchema from "@logicsrc/schemas/opencreds-audit-event" with { type: "json" };
import openwallMessageSchema from "@logicsrc/schemas/openwall-message" with { type: "json" };
import openwallReceiptSchema from "@logicsrc/schemas/openwall-receipt" with { type: "json" };
export const schemas = {
"openabtest-manifest": openabtestManifestSchema,
"openabtest-event": openabtestEventSchema,
"openwall-message": openwallMessageSchema,
"openwall-receipt": openwallReceiptSchema,
agent: agentSchema,
openrental: openrentalSchema,
openerrand: openerrandSchema,
"openerrand-index": openerrandIndexSchema,
"account-audit-event": accountAuditEventSchema,
"account-grant": accountGrantSchema,
"account-provider": accountProviderSchema,
"connected-account": connectedAccountSchema,
"email-message": emailMessageSchema,
event: eventSchema,
plugin: pluginSchema,
"pull-request": pullRequestSchema,
repo: repoSchema,
run: runSchema,
"social-post": socialPostSchema,
task: taskSchema,
"agentad-ad": agentadAdSchema,
"agentad-placement": agentadPlacementSchema,
"agentad-ad-request": agentadAdRequestSchema,
"agentad-ad-response": agentadAdResponseSchema,
"agentad-impression": agentadImpressionSchema,
"agentad-click": agentadClickSchema,
"agentad-campaign": agentadCampaignSchema,
"credential-provider": credentialProviderSchema,
"credential-sync-plan": credentialSyncPlanSchema,
"credential-sync-run": credentialSyncRunSchema,
"credential-audit-event": credentialAuditEventSchema,
"openprd-prd": openprdPrdSchema,
"openontology-manifest": ontologyManifestSchema,
"openontology-namespace": ontologyNamespaceSchema,
"openontology-entity-type": ontologyEntityTypeSchema,
"openontology-property": ontologyPropertySchema,
"openontology-relationship-type": ontologyRelationshipTypeSchema,
"openontology-constraint": ontologyConstraintSchema,
"openontology-query": ontologyQuerySchema,
"openontology-action": ontologyActionSchema,
"openontology-entity": ontologyEntitySchema,
"openontology-claim": ontologyClaimSchema,
"openontology-source": ontologySourceSchema,
"openontology-evidence": ontologyEvidenceSchema,
"openontology-changeset": ontologyChangeSetSchema,
"openontology-review": ontologyReviewSchema,
"openontology-approval": ontologyApprovalSchema,
"openontology-event": ontologyEventSchema,
"openontology-package": ontologyPackageSchema,
"opencontext-manifest": ocManifestSchema,
"opencontext-object": ocObjectSchema,
"opencontext-bundle": ocBundleSchema,
"opencontext-role": ocRoleSchema,
"opencontext-provenance": ocProvenanceSchema,
"opencontext-decision": ocDecisionSchema,
"opencontext-diagnostic": ocDiagnosticSchema,
"opencontext-audit-event": ocAuditEventSchema,
"opencreds-item": credsItemSchema,
"opencreds-envelope": credsEnvelopeSchema,
"opencreds-vault-meta": credsVaultMetaSchema,
"opencreds-manifest": credsManifestSchema,
"opencreds-database": credsDatabaseSchema,
"opencreds-audit-event": credsAuditEventSchema
} as const;
export type SchemaKind = keyof typeof schemas;
export function isSchemaKind(value: string): value is SchemaKind {
return Object.hasOwn(schemas, value);
}