@ouro.bot/cli 0.1.0-alpha.152 → 0.1.0-alpha.1520
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +158 -42
- package/RepairGuide.ouro/agent.json +5 -0
- package/RepairGuide.ouro/psyche/IDENTITY.md +19 -0
- package/RepairGuide.ouro/psyche/SOUL.md +55 -0
- package/RepairGuide.ouro/skills/diagnose-broken-remote.md +63 -0
- package/RepairGuide.ouro/skills/diagnose-stacked-typed-issues.md +35 -0
- package/RepairGuide.ouro/skills/diagnose-sync-blocked.md +54 -0
- package/RepairGuide.ouro/skills/diagnose-vault-expired.md +60 -0
- package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/agent.json +4 -2
- package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/SOUL.md +2 -2
- package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/the-serpent.md +1 -1
- package/assets/bluebubbles-host +264 -0
- package/assets/sanctuary-host-launcher.sh +16 -0
- package/changelog.json +8900 -41
- package/deploy/unraid/Dockerfile +85 -0
- package/deploy/unraid/INSTALL.md +64 -0
- package/deploy/unraid/README.txt +3034 -0
- package/deploy/unraid/audit-container-spec.sh +4 -0
- package/deploy/unraid/container-runtime.json +1 -0
- package/deploy/unraid/credit-gateway.md +95 -0
- package/deploy/unraid/docker-man-template-transaction.mjs +733 -0
- package/deploy/unraid/docker-man-template-xml.cjs +105 -0
- package/deploy/unraid/github_known_hosts +3 -0
- package/deploy/unraid/install.sh +274 -0
- package/deploy/unraid/migrate-sanctuary-bundle.mjs +63 -0
- package/deploy/unraid/ouro-events/bootstrap-spool.sh +92 -0
- package/deploy/unraid/ouro-events/emit-event.mjs +310 -0
- package/deploy/unraid/ouro-events/emit-usenet-event.sh +54 -0
- package/deploy/unraid/ouro-events/install-usenet-guard.sh +435 -0
- package/deploy/unraid/ouro-events/usenet-health.sh +176 -0
- package/deploy/unraid/ouro-host-lock.mjs +245 -0
- package/deploy/unraid/ouro-sync-ssh +98 -0
- package/deploy/unraid/ouro-sync.sudoers +3 -0
- package/deploy/unraid/sanctuary-acceptance-adapter.sh +43 -0
- package/deploy/unraid/sanctuary-acceptance-contract.json +198 -0
- package/deploy/unraid/sanctuary-acceptance-harness.sh +23 -0
- package/deploy/unraid/sanctuary-authority-installation.json +36 -0
- package/deploy/unraid/sanctuary-authority-service.sh +30 -0
- package/deploy/unraid/sanctuary-butler-upgrade.mjs +1604 -0
- package/deploy/unraid/sanctuary-deployment-target.mjs +710 -0
- package/deploy/unraid/sanctuary-replay-gate.mjs +2781 -0
- package/deploy/unraid/sanctuary-safe-rename.py +24 -0
- package/deploy/unraid/sanctuary-sync-cutover.sh +1039 -0
- package/deploy/unraid/sanctuary-unit16-host-broker.mjs +2088 -0
- package/deploy/unraid/sanctuary-unit16-run.sh +570 -0
- package/deploy/unraid/sanctuary-unit18-target-audit.sh +27 -0
- package/deploy/unraid/sanctuary.ouro/agent.json +73 -0
- package/deploy/unraid/sanctuary.ouro/arc/README.md +3 -0
- package/deploy/unraid/sanctuary.ouro/awaiting/house-care-sweep.md +17 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +5 -0
- package/deploy/unraid/sanctuary.ouro/habits/sanctuary-health.md +8 -0
- package/deploy/unraid/sanctuary.ouro/mcp/media-mcp.mjs +2533 -0
- package/deploy/unraid/sanctuary.ouro/product/PRODUCT.md +13 -0
- package/deploy/unraid/sanctuary.ouro/provider-readiness.json +11 -0
- package/deploy/unraid/sanctuary.ouro/psyche/ASPIRATIONS.md +5 -0
- package/deploy/unraid/sanctuary.ouro/psyche/IDENTITY.md +7 -0
- package/deploy/unraid/sanctuary.ouro/psyche/LORE.md +7 -0
- package/deploy/unraid/sanctuary.ouro/psyche/SOUL.md +15 -0
- package/deploy/unraid/sanctuary.ouro/psyche/TACIT.md +3 -0
- package/deploy/unraid/sanctuary.ouro/state/policy/steward.json +7 -0
- package/deploy/unraid/sanctuary.ouro/tool-profiles.json +274 -0
- package/deploy/unraid/sanctuary.xml +30 -0
- package/desk.lock.json +8 -0
- package/dist/a2a/approval-relay-forward.js +117 -0
- package/dist/a2a/approval-relay.js +95 -0
- package/dist/a2a/approval-request-wire.js +123 -0
- package/dist/a2a/card.js +57 -0
- package/dist/a2a/client.js +331 -0
- package/dist/a2a/config.js +50 -0
- package/dist/a2a/delegated-command-grants.js +93 -0
- package/dist/a2a/delegated-command.js +200 -0
- package/dist/a2a/delegation-stores.js +56 -0
- package/dist/a2a/did-resolution.js +205 -0
- package/dist/a2a/escalation-grants.js +84 -0
- package/dist/a2a/escalation-wiring.js +60 -0
- package/dist/a2a/identity.js +258 -0
- package/dist/a2a/inbound-share.js +131 -0
- package/dist/a2a/mission-result-wire.js +265 -0
- package/dist/a2a/onboarding.js +133 -0
- package/dist/a2a/operator-trust.js +399 -0
- package/dist/a2a/outbox-client.js +59 -0
- package/dist/a2a/outbox-store.js +245 -0
- package/dist/a2a/outbox-wire.js +106 -0
- package/dist/a2a/pin-store.js +167 -0
- package/dist/a2a/refusals.js +55 -0
- package/dist/a2a/relay-client.js +106 -0
- package/dist/a2a/relay-config-vault.js +64 -0
- package/dist/a2a/relay-contacts.js +120 -0
- package/dist/a2a/relay-inbox.js +360 -0
- package/dist/a2a/relay-retirements.js +89 -0
- package/dist/a2a/replay-grant-holders.js +33 -0
- package/dist/a2a/replay-harness.js +188 -0
- package/dist/a2a/resolution-proof.js +53 -0
- package/dist/a2a/sealed-chat.js +142 -0
- package/dist/a2a/seen-ledger.js +216 -0
- package/dist/a2a/server.js +1088 -0
- package/dist/a2a/task-store.js +69 -0
- package/dist/a2a/transport.js +100 -0
- package/dist/a2a/trust-commands.js +203 -0
- package/dist/a2a/trusted-files.js +185 -0
- package/dist/a2a/types.js +3 -0
- package/dist/actions/generated/mailbox/actions.json +592 -0
- package/dist/actions/generated/mailbox/commands.json +181 -0
- package/dist/actions/generated/mailbox/mcp.json +454 -0
- package/dist/actions/generated/mailbox-tools/tools.json +516 -0
- package/dist/arc/attention-types.js +8 -0
- package/dist/arc/cares.js +360 -0
- package/dist/arc/episodes.js +118 -0
- package/dist/arc/evolution.js +490 -0
- package/dist/arc/flight-recorder.js +1030 -0
- package/dist/arc/intentions.js +134 -0
- package/dist/arc/json-store.js +117 -0
- package/dist/arc/obligations.js +386 -0
- package/dist/arc/packets.js +336 -0
- package/dist/arc/presence.js +185 -0
- package/dist/arc/task-lifecycle.js +57 -0
- package/dist/commerce/store.js +755 -0
- package/dist/commerce/types.js +3 -0
- package/dist/eval/assertions/index.js +378 -0
- package/dist/eval/billing-guard.js +23 -0
- package/dist/eval/budget.js +142 -0
- package/dist/eval/domain/case.js +115 -0
- package/dist/eval/domain/stats.js +19 -0
- package/dist/eval/guest-entry.js +18 -0
- package/dist/eval/h-guest-entry.js +19 -0
- package/dist/eval/interview-entry.js +174 -0
- package/dist/eval/interview-grade-entry.js +36 -0
- package/dist/eval/interview-guest-entry.js +19 -0
- package/dist/eval/interviews/allocation.js +90 -0
- package/dist/eval/interviews/final.js +133 -0
- package/dist/eval/interviews/grader.js +209 -0
- package/dist/eval/interviews/guest/arms.js +173 -0
- package/dist/eval/interviews/guest/ax/ax-command.js +792 -0
- package/dist/eval/interviews/guest/ax/effects.js +51 -0
- package/dist/eval/interviews/guest/ax/exit-codes.js +51 -0
- package/dist/eval/interviews/guest/ax/help.js +181 -0
- package/dist/eval/interviews/guest/ax/mcp.js +246 -0
- package/dist/eval/interviews/guest/ax/outcome.js +211 -0
- package/dist/eval/interviews/guest/ax/output.js +53 -0
- package/dist/eval/interviews/guest/ax/precise-copy.js +200 -0
- package/dist/eval/interviews/guest/ax/problem.js +95 -0
- package/dist/eval/interviews/guest/ax/voice.js +83 -0
- package/dist/eval/interviews/guest/ax/wait.js +158 -0
- package/dist/eval/interviews/guest/books-core.js +54 -0
- package/dist/eval/interviews/guest/cli-shell.js +267 -0
- package/dist/eval/interviews/guest/h/codex.js +201 -0
- package/dist/eval/interviews/guest/h/fidelity.js +59 -0
- package/dist/eval/interviews/guest/h/openhands.js +176 -0
- package/dist/eval/interviews/guest/h/run.js +99 -0
- package/dist/eval/interviews/guest/h/wire.js +403 -0
- package/dist/eval/interviews/guest/loop.js +87 -0
- package/dist/eval/interviews/guest/operations.js +108 -0
- package/dist/eval/interviews/guest/run.js +81 -0
- package/dist/eval/interviews/guest/u/arms.js +268 -0
- package/dist/eval/interviews/h/kit.js +119 -0
- package/dist/eval/interviews/latch.js +143 -0
- package/dist/eval/interviews/protocol.js +120 -0
- package/dist/eval/interviews/rewrite.js +57 -0
- package/dist/eval/interviews/runner.js +354 -0
- package/dist/eval/interviews/u/kit.js +117 -0
- package/dist/eval/kill-switch.js +33 -0
- package/dist/eval/month-ledger.js +95 -0
- package/dist/eval/readback/hedges.js +39 -0
- package/dist/eval/remote-entry.js +32 -0
- package/dist/eval/report.js +85 -0
- package/dist/eval/run-command.js +188 -0
- package/dist/eval/run-entry.js +93 -0
- package/dist/eval/sandbox/agent-profile.js +74 -0
- package/dist/eval/sandbox/declared-gaps.js +17 -0
- package/dist/eval/sandbox/docker.js +353 -0
- package/dist/eval/sandbox/guest.js +55 -0
- package/dist/eval/sandbox/host-lock.js +62 -0
- package/dist/eval/sandbox/images.js +39 -0
- package/dist/eval/sandbox/oracle.js +32 -0
- package/dist/eval/sandbox/projection.js +127 -0
- package/dist/eval/sandbox/readback.js +137 -0
- package/dist/eval/sandbox/remote.js +102 -0
- package/dist/eval/sandbox/slugger-projection.js +377 -0
- package/dist/eval/self-test.js +84 -0
- package/dist/eval/stop-command.js +71 -0
- package/dist/eval/stop-entry.js +46 -0
- package/dist/eval/targets/index.js +127 -0
- package/dist/eval/transport/provider-proxy.js +262 -0
- package/dist/eval/transport/synthetic-sanctuary.js +111 -0
- package/dist/eval/transport/telegram-turn.js +241 -0
- package/dist/eval/watch/cli.js +63 -0
- package/dist/eval/watch/guarded-fs.js +254 -0
- package/dist/eval/watch/log-reader.js +99 -0
- package/dist/eval/watch/rows.js +143 -0
- package/dist/eval/watch/run-watch.js +160 -0
- package/dist/eval/watch-entry.js +26 -0
- package/dist/gateway/keys.js +117 -0
- package/dist/gateway/server.js +429 -0
- package/dist/heart/active-work.js +421 -45
- package/dist/heart/agent-entry.js +255 -4
- package/dist/heart/approval-files.js +94 -0
- package/dist/heart/approval-store.js +1000 -0
- package/dist/heart/atomic-file.js +115 -0
- package/dist/heart/attachments/downloaded-store.js +89 -0
- package/dist/heart/attachments/image-normalize.js +201 -0
- package/dist/heart/attachments/materialize.js +97 -0
- package/dist/heart/attachments/originals.js +102 -0
- package/dist/heart/attachments/render.js +29 -0
- package/dist/heart/attachments/sources/bluebubbles.js +155 -0
- package/dist/heart/attachments/sources/cli-local-file.js +78 -0
- package/dist/heart/attachments/sources/downloaded.js +76 -0
- package/dist/heart/attachments/sources/index.js +19 -0
- package/dist/heart/attachments/store.js +132 -0
- package/dist/heart/attachments/transcribe-audio.js +231 -0
- package/dist/heart/attachments/types.js +93 -0
- package/dist/heart/attachments/understand.js +195 -0
- package/dist/heart/auth/auth-flow.js +590 -0
- package/dist/heart/auth/github-device-login.js +104 -0
- package/dist/heart/autonomy-budget.js +478 -0
- package/dist/heart/awaiting/a2a-await-delivery.js +109 -0
- package/dist/heart/awaiting/await-alert.js +152 -0
- package/dist/heart/awaiting/await-expiry.js +143 -0
- package/dist/heart/awaiting/await-loader.js +91 -0
- package/dist/heart/awaiting/await-parser.js +152 -0
- package/dist/heart/awaiting/await-runtime-state.js +130 -0
- package/dist/heart/awaiting/await-scheduler.js +462 -0
- package/dist/heart/background-operations.js +281 -0
- package/dist/heart/bluebubbles-host-account.js +78 -0
- package/dist/heart/bridges/manager.js +137 -17
- package/dist/heart/bridges/store.js +14 -2
- package/dist/heart/bundle-state.js +168 -0
- package/dist/heart/chat-interaction.js +69 -0
- package/dist/heart/commitments.js +44 -14
- package/dist/heart/config-registry.js +340 -0
- package/dist/heart/config.js +191 -140
- package/dist/heart/context-loss-gauntlet.js +387 -0
- package/dist/heart/context-loss-sentinel.js +1200 -0
- package/dist/heart/core.js +2781 -697
- package/dist/heart/cross-chat-delivery.js +29 -22
- package/dist/heart/daemon/agent-config-check.js +494 -0
- package/dist/heart/daemon/agent-discovery.js +304 -3
- package/dist/heart/daemon/agent-home.js +409 -0
- package/dist/heart/daemon/agent-service.js +210 -28
- package/dist/heart/daemon/agentic-repair.js +548 -0
- package/dist/heart/daemon/app-sessions-record.js +82 -0
- package/dist/heart/daemon/await-private-wake.js +59 -0
- package/dist/heart/daemon/bluebubbles-cli-integration.js +71 -0
- package/dist/heart/daemon/bluebubbles-health-diagnostics.js +122 -0
- package/dist/heart/daemon/bluebubbles-host-protocol.js +433 -0
- package/dist/heart/daemon/bluebubbles-host.js +273 -0
- package/dist/heart/daemon/boot-sync-probe.js +223 -0
- package/dist/heart/daemon/cadence.js +110 -0
- package/dist/heart/daemon/cli-arg-redaction.js +26 -0
- package/dist/heart/daemon/cli-commands/a2a.js +26 -0
- package/dist/heart/daemon/cli-commands/cards.js +68 -0
- package/dist/heart/daemon/cli-commands/coding-tools.js +13 -0
- package/dist/heart/daemon/cli-commands/desk.js +43 -0
- package/dist/heart/daemon/cli-commands/dns.js +13 -0
- package/dist/heart/daemon/cli-commands/entry-points.js +182 -0
- package/dist/heart/daemon/cli-commands/failure-code.js +11 -0
- package/dist/heart/daemon/cli-commands/friends.js +18 -0
- package/dist/heart/daemon/cli-commands/habits.js +15 -0
- package/dist/heart/daemon/cli-commands/lifecycle.js +42 -0
- package/dist/heart/daemon/cli-commands/mail.js +11 -0
- package/dist/heart/daemon/cli-commands/mind.js +25 -0
- package/dist/heart/daemon/cli-commands/presence.js +28 -0
- package/dist/heart/daemon/cli-commands/providers.js +20 -0
- package/dist/heart/daemon/cli-commands/rsvp.js +20 -0
- package/dist/heart/daemon/cli-commands/shepherd.js +17 -0
- package/dist/heart/daemon/cli-commands/vault.js +23 -0
- package/dist/heart/daemon/cli-defaults.js +997 -0
- package/dist/heart/daemon/cli-desk.js +346 -0
- package/dist/heart/daemon/cli-exec.js +9688 -0
- package/dist/heart/daemon/cli-gate.js +198 -0
- package/dist/heart/daemon/cli-help.js +800 -0
- package/dist/heart/daemon/cli-manifest.js +115 -0
- package/dist/heart/daemon/cli-parse.js +3635 -0
- package/dist/heart/daemon/cli-render-doctor.js +57 -0
- package/dist/heart/daemon/cli-render.js +816 -0
- package/dist/heart/daemon/cli-types.js +8 -0
- package/dist/heart/daemon/compile-cache.js +69 -0
- package/dist/heart/daemon/connect-bay.js +323 -0
- package/dist/heart/daemon/container-credential-bootstrap.js +273 -0
- package/dist/heart/daemon/container-healthcheck.js +123 -0
- package/dist/heart/daemon/container-runtime.js +97 -0
- package/dist/heart/daemon/container-spec-auditor-main.js +187 -0
- package/dist/heart/daemon/container-spec-auditor.js +261 -0
- package/dist/heart/daemon/daemon-bootstrap-startup.js +115 -0
- package/dist/heart/daemon/daemon-cli.js +29 -3145
- package/dist/heart/daemon/daemon-entry.js +1073 -55
- package/dist/heart/daemon/daemon-health.js +186 -0
- package/dist/heart/daemon/daemon-rollup.js +57 -0
- package/dist/heart/daemon/daemon-runtime-sync.js +147 -13
- package/dist/heart/daemon/daemon-tombstone.js +134 -4
- package/dist/heart/daemon/daemon.js +1984 -131
- package/dist/heart/daemon/desk-admin.js +420 -0
- package/dist/heart/daemon/dns-workflow.js +394 -0
- package/dist/heart/daemon/doctor-types.js +8 -0
- package/dist/heart/daemon/doctor.js +1890 -0
- package/dist/heart/daemon/freshness.js +345 -0
- package/dist/heart/daemon/habit-private-wake.js +61 -0
- package/dist/heart/daemon/health-monitor.js +209 -12
- package/dist/heart/daemon/home-filesystem.js +93 -0
- package/dist/heart/daemon/hook-post-tool-use.js +149 -0
- package/dist/heart/daemon/hooks/agent-config-v2.js +33 -0
- package/dist/heart/daemon/hooks/bundle-meta.js +135 -1
- package/dist/heart/daemon/http-health-probe.js +80 -0
- package/dist/heart/daemon/human-command-screens.js +234 -0
- package/dist/heart/daemon/human-readiness.js +114 -0
- package/dist/heart/daemon/inner-status.js +7 -18
- package/dist/heart/daemon/interactive-repair.js +394 -0
- package/dist/heart/daemon/launchd.js +40 -8
- package/dist/heart/daemon/linux-service.js +382 -0
- package/dist/heart/daemon/log-tailer.js +79 -10
- package/dist/heart/daemon/logs-prune.js +132 -0
- package/dist/heart/daemon/mailroom-copy-proof.js +158 -0
- package/dist/heart/daemon/mcp-canary.js +525 -0
- package/dist/heart/daemon/message-router.js +65 -5
- package/dist/heart/daemon/migrate-to-desk.js +848 -0
- package/dist/heart/daemon/os-cron-deps.js +5 -0
- package/dist/heart/daemon/os-cron.js +45 -15
- package/dist/heart/daemon/ouro-bot-entry.js +8 -3
- package/dist/heart/daemon/ouro-cli-main.js +50 -0
- package/dist/heart/daemon/ouro-entry.js +43 -20
- package/dist/heart/daemon/plugin-cli.js +432 -0
- package/dist/heart/daemon/portable-git-install.js +265 -0
- package/dist/heart/daemon/portable-git.js +179 -0
- package/dist/heart/daemon/presence-daemon.js +265 -0
- package/dist/heart/daemon/presence-roster.js +260 -0
- package/dist/heart/daemon/presence.js +469 -0
- package/dist/heart/daemon/process-manager.js +790 -71
- package/dist/heart/daemon/process-tree.js +109 -0
- package/dist/heart/daemon/provider-discovery.js +171 -0
- package/dist/heart/daemon/provider-ping-progress.js +83 -0
- package/dist/heart/daemon/prunable-bundle.js +144 -0
- package/dist/heart/daemon/pulse.js +511 -0
- package/dist/heart/daemon/readiness-repair.js +365 -0
- package/dist/heart/daemon/run-hooks.js +2 -0
- package/dist/heart/daemon/runtime-logging.js +54 -14
- package/dist/heart/daemon/runtime-metadata.js +2 -30
- package/dist/heart/daemon/runtime-mode.js +13 -2
- package/dist/heart/daemon/runtime-replacement-handoff.js +207 -0
- package/dist/heart/daemon/safe-mode.js +161 -0
- package/dist/heart/daemon/sanctuary-acceptance-adapter.js +2659 -0
- package/dist/heart/daemon/sanctuary-acceptance-harness.js +1832 -0
- package/dist/heart/daemon/sanctuary-acceptance-marker.js +267 -0
- package/dist/heart/daemon/sanctuary-acceptance-scenarios.js +956 -0
- package/dist/heart/daemon/sanctuary-authority-codec.js +86 -0
- package/dist/heart/daemon/sanctuary-authority-epoch.js +291 -0
- package/dist/heart/daemon/sanctuary-authority-installation.js +161 -0
- package/dist/heart/daemon/sanctuary-authority-ledger.js +241 -0
- package/dist/heart/daemon/sanctuary-authority-root-lifecycle.js +1370 -0
- package/dist/heart/daemon/sanctuary-authority-vault-migration.js +79 -0
- package/dist/heart/daemon/sanctuary-bundle-migration.js +974 -0
- package/dist/heart/daemon/sanctuary-host-authority.js +1008 -0
- package/dist/heart/daemon/sanctuary-host-detached-supervisor.js +493 -0
- package/dist/heart/daemon/sanctuary-host-executor.js +670 -0
- package/dist/heart/daemon/sanctuary-host-linux-kernel.js +334 -0
- package/dist/heart/daemon/sanctuary-host-supervisor-entry.js +210 -0
- package/dist/heart/daemon/sanctuary-host-supervisor.js +95 -0
- package/dist/heart/daemon/sanctuary-package-management.js +113 -0
- package/dist/heart/daemon/sanctuary-scheduler-liveness.js +227 -0
- package/dist/heart/daemon/sanctuary-scheduler-origin.js +132 -0
- package/dist/heart/daemon/sanctuary-telegram-authority-entry.js +481 -0
- package/dist/heart/daemon/sanctuary-telegram-authority-gateway.js +614 -0
- package/dist/heart/daemon/sanctuary-telegram-authority-service.js +763 -0
- package/dist/heart/daemon/sanctuary-telegram-test-driver-entry.js +97 -0
- package/dist/heart/daemon/sanctuary-telegram-test-driver.js +294 -0
- package/dist/heart/daemon/sense-manager.js +1071 -60
- package/dist/heart/daemon/skill-management-installer.js +1 -1
- package/dist/heart/daemon/socket-client.js +180 -12
- package/dist/heart/daemon/stale-bundle-prune.js +113 -0
- package/dist/heart/daemon/startup-tui.js +339 -0
- package/dist/heart/daemon/state-retention.js +234 -0
- package/dist/heart/daemon/supercronic-supervisor.js +282 -0
- package/dist/heart/daemon/task-scheduler.js +115 -15
- package/dist/heart/daemon/terminal-ui.js +503 -0
- package/dist/heart/daemon/thoughts.js +133 -49
- package/dist/heart/daemon/up-progress.js +366 -0
- package/dist/heart/daemon/vault-items.js +56 -0
- package/dist/heart/daemon/vault-outage.js +74 -0
- package/dist/heart/delegated-work-report.js +115 -0
- package/dist/heart/delegation.js +0 -3
- package/dist/heart/external-events/router.js +1556 -0
- package/dist/heart/failure-reports.js +398 -0
- package/dist/heart/file-lock.js +109 -0
- package/dist/heart/frontend-approval-runtime.js +506 -0
- package/dist/heart/frontend-journal.js +215 -0
- package/dist/heart/frontend-session-service.js +330 -0
- package/dist/heart/frontend-socket-client.js +173 -0
- package/dist/heart/frontend-socket.js +434 -0
- package/dist/heart/frontend-turn-errors.js +20 -0
- package/dist/heart/git-binary.js +115 -0
- package/dist/heart/habits/habit-cancel.js +810 -0
- package/dist/heart/habits/habit-lifecycle.js +1324 -0
- package/dist/heart/{daemon → habits}/habit-migration.js +41 -28
- package/dist/heart/habits/habit-parser.js +278 -0
- package/dist/heart/habits/habit-runtime-state.js +93 -0
- package/dist/heart/habits/habit-scheduler.js +667 -0
- package/dist/heart/habits/habit-session-summary.js +318 -0
- package/dist/heart/habits/habit-session.js +643 -0
- package/dist/heart/{daemon → hatch}/hatch-flow.js +60 -36
- package/dist/heart/{daemon → hatch}/hatch-specialist.js +6 -8
- package/dist/heart/{daemon → hatch}/specialist-prompt.js +10 -6
- package/dist/heart/hatch/specialist-tools.js +395 -0
- package/dist/heart/identity.js +389 -60
- package/dist/heart/kept-notes.js +289 -0
- package/dist/heart/letters/doors-tools.js +63 -0
- package/dist/heart/letters/doors.js +436 -0
- package/dist/heart/letters/letter-index.js +89 -0
- package/dist/heart/letters/letter.js +247 -0
- package/dist/heart/letters/store.js +210 -0
- package/dist/heart/letters/writer.js +298 -0
- package/dist/heart/machine-identity.js +175 -0
- package/dist/heart/mail-import-discovery.js +356 -0
- package/dist/heart/mcp/mcp-server.js +922 -0
- package/dist/heart/migrate-config.js +100 -0
- package/dist/heart/model-capabilities.js +98 -16
- package/dist/heart/model-limits.js +49 -0
- package/dist/heart/optional-packages.js +77 -0
- package/dist/heart/orientation-frame.js +393 -0
- package/dist/heart/platform.js +81 -0
- package/dist/heart/primitives.js +1 -1
- package/dist/heart/private-runtime/decision-renderer.js +158 -0
- package/dist/heart/private-runtime/index.js +18 -0
- package/dist/heart/private-runtime/ledger.js +212 -0
- package/dist/heart/private-runtime/policy.js +303 -0
- package/dist/heart/private-runtime/types.js +2 -0
- package/dist/heart/progress-story.js +1 -1
- package/dist/heart/provider-attempt.js +137 -0
- package/dist/heart/provider-binding-resolver.js +273 -0
- package/dist/heart/provider-credentials.js +449 -0
- package/dist/heart/provider-failover.js +260 -37
- package/dist/heart/provider-fallback.js +228 -0
- package/dist/heart/provider-models.js +96 -0
- package/dist/heart/provider-ping-child.js +125 -0
- package/dist/heart/provider-ping-entry.js +8 -0
- package/dist/heart/provider-ping.js +217 -78
- package/dist/heart/provider-readiness-cache.js +119 -0
- package/dist/heart/provider-visibility.js +188 -0
- package/dist/heart/providers/account-pool.js +717 -0
- package/dist/heart/providers/anthropic-token.js +15 -47
- package/dist/heart/providers/anthropic.js +275 -80
- package/dist/heart/providers/azure.js +19 -31
- package/dist/heart/providers/error-classification.js +129 -0
- package/dist/heart/providers/github-copilot.js +131 -36
- package/dist/heart/providers/minimax-vlm.js +189 -0
- package/dist/heart/providers/minimax.js +19 -27
- package/dist/heart/providers/openai-codex-token.js +349 -0
- package/dist/heart/providers/openai-codex.js +46 -57
- package/dist/heart/providers/openai-compatible.js +177 -0
- package/dist/heart/quota/fleet-readings.js +222 -0
- package/dist/heart/quota/tranche.js +59 -0
- package/dist/heart/reach-channel.js +85 -0
- package/dist/heart/reply-style.js +52 -0
- package/dist/heart/run-ledger.js +247 -0
- package/dist/heart/runtime-capability-check.js +170 -0
- package/dist/heart/runtime-credentials.js +647 -0
- package/dist/heart/runtime-cwd.js +87 -0
- package/dist/heart/sense-truth.js +26 -4
- package/dist/heart/sent-message-ledger.js +98 -0
- package/dist/heart/session-activity.js +89 -23
- package/dist/heart/session-events.js +1609 -0
- package/dist/heart/session-playback-cli-main.js +10 -0
- package/dist/heart/session-playback-cli.js +36 -0
- package/dist/heart/session-playback.js +231 -0
- package/dist/heart/session-redaction-repair-cli-main.js +34 -0
- package/dist/heart/session-redaction-repair.js +552 -0
- package/dist/heart/session-stats-cli-main.js +10 -0
- package/dist/heart/session-stats.js +183 -0
- package/dist/heart/session-transcript.js +133 -0
- package/dist/heart/shelf-claims.js +136 -0
- package/dist/heart/shepherd/custody-types.js +2 -0
- package/dist/heart/shepherd/mandates.js +352 -0
- package/dist/heart/shepherd/operation-commands.js +19 -0
- package/dist/heart/shepherd/operations.js +139 -0
- package/dist/heart/shepherd/supervision-read.js +131 -0
- package/dist/heart/shepherd/supervision.js +114 -0
- package/dist/heart/shepherd/types.js +2 -0
- package/dist/heart/shepherd-config.js +113 -0
- package/dist/heart/source-grounding.js +313 -0
- package/dist/heart/sqlite.js +18 -0
- package/dist/heart/start-of-turn-packet.js +372 -0
- package/dist/heart/steward-policy.js +656 -0
- package/dist/heart/streaming.js +627 -193
- package/dist/heart/structured-output.js +196 -0
- package/dist/heart/sync-classification.js +176 -0
- package/dist/heart/sync-health.js +152 -0
- package/dist/heart/sync-lock.js +431 -0
- package/dist/heart/sync.js +1583 -0
- package/dist/heart/target-resolution.js +7 -7
- package/dist/heart/tempo.js +93 -0
- package/dist/heart/temporal-view.js +41 -0
- package/dist/heart/termination-guard.js +27 -0
- package/dist/heart/timeouts.js +101 -0
- package/dist/heart/tool-activity-callbacks.js +59 -0
- package/dist/heart/tool-approval.js +382 -0
- package/dist/heart/tool-description.js +155 -0
- package/dist/heart/tool-friction.js +55 -0
- package/dist/heart/tool-images.js +42 -0
- package/dist/heart/tool-loop.js +9 -3
- package/dist/heart/tool-output-budget.js +41 -0
- package/dist/heart/turn-context.js +503 -0
- package/dist/heart/turn-execution-lease.js +78 -0
- package/dist/heart/turn-summary.js +216 -0
- package/dist/heart/versioning/host-self-update.js +118 -0
- package/dist/heart/{daemon → versioning}/ouro-bot-global-installer.js +6 -5
- package/dist/heart/{daemon → versioning}/ouro-bot-wrapper.js +3 -2
- package/dist/heart/versioning/ouro-path-installer.js +432 -0
- package/dist/heart/versioning/ouro-recovery-launcher.js +98 -0
- package/dist/heart/versioning/ouro-version-manager.js +432 -0
- package/dist/heart/versioning/release-sources.js +185 -0
- package/dist/heart/versioning/self-update-defaults.js +443 -0
- package/dist/heart/versioning/self-update.js +270 -0
- package/dist/heart/{daemon → versioning}/staged-restart.js +40 -8
- package/dist/heart/{daemon → versioning}/update-checker.js +12 -35
- package/dist/heart/versioning/update-hooks.js +160 -0
- package/dist/heart/versioning/update-state.js +134 -0
- package/dist/heart/versioning/updater-launchd.js +204 -0
- package/dist/heart/versioning/version-intent.js +114 -0
- package/dist/heart/work-card.js +380 -0
- package/dist/mailroom/attention.js +167 -0
- package/dist/mailroom/autonomy.js +209 -0
- package/dist/mailroom/azure-sdk.js +27 -0
- package/dist/mailroom/blob-store.js +991 -0
- package/dist/mailroom/body-cache.js +61 -0
- package/dist/mailroom/cache-sync-cli.js +58 -0
- package/dist/mailroom/core.js +813 -0
- package/dist/mailroom/entry.js +169 -0
- package/dist/mailroom/file-store.js +568 -0
- package/dist/mailroom/hosted-cache-sync.js +384 -0
- package/dist/mailroom/mbox-import.js +393 -0
- package/dist/mailroom/migration.js +164 -0
- package/dist/mailroom/outbound.js +380 -0
- package/dist/mailroom/policy.js +263 -0
- package/dist/mailroom/reader.js +308 -0
- package/dist/mailroom/search-cache.js +513 -0
- package/dist/mailroom/search-relevance.js +319 -0
- package/dist/mailroom/smtp-ingress.js +176 -0
- package/dist/mailroom/source-state.js +176 -0
- package/dist/mailroom/sweep-orphans-cli.js +34 -0
- package/dist/mailroom/thread.js +109 -0
- package/dist/mailroom/travel-extract.js +89 -0
- package/dist/mind/bundle-manifest.js +25 -4
- package/dist/mind/context.js +335 -198
- package/dist/mind/desk-section.js +332 -0
- package/dist/mind/diary-integrity.js +60 -0
- package/dist/mind/diary.js +31 -53
- package/dist/mind/embedding-provider.js +60 -0
- package/dist/mind/file-state.js +179 -0
- package/dist/mind/friend-link-codes.js +209 -0
- package/dist/mind/friend-merge.js +336 -0
- package/dist/mind/house-names.js +43 -0
- package/dist/mind/note-search.js +198 -0
- package/dist/mind/obligation-steering.js +15 -9
- package/dist/mind/outbound-record.js +176 -0
- package/dist/mind/pending.js +294 -11
- package/dist/mind/prompt-budget.js +511 -0
- package/dist/mind/prompt-refresh.js +3 -2
- package/dist/mind/prompt.js +947 -368
- package/dist/mind/provenance-trust.js +26 -0
- package/dist/mind/record-paths.js +312 -0
- package/dist/mind/scrutiny.js +121 -0
- package/dist/mind/session-transaction.js +642 -0
- package/dist/mind/token-estimate.js +17 -0
- package/dist/mind/where-am-i.js +176 -0
- package/dist/nerves/cli-logging.js +7 -1
- package/dist/nerves/coverage/audit-rules.js +15 -6
- package/dist/nerves/coverage/audit.js +28 -2
- package/dist/nerves/coverage/cli-main.js +6 -1
- package/dist/nerves/coverage/cli.js +1 -1
- package/dist/nerves/coverage/contract.js +5 -5
- package/dist/nerves/coverage/file-completeness.js +153 -5
- package/dist/nerves/coverage/run-artifacts.js +55 -35
- package/dist/nerves/coverage/source-scanner.js +4 -4
- package/dist/nerves/event-buffer.js +111 -0
- package/dist/nerves/index.js +266 -30
- package/dist/nerves/observation.js +18 -0
- package/dist/nerves/redact.js +79 -0
- package/dist/nerves/review/cli-main.js +10 -0
- package/dist/nerves/review/cli.js +156 -0
- package/dist/nerves/review/core.js +159 -0
- package/dist/nerves/runtime.js +16 -1
- package/dist/repertoire/ado-client.js +15 -56
- package/dist/repertoire/ado-semantic.js +108 -40
- package/dist/repertoire/api-client.js +97 -0
- package/dist/repertoire/auth-required.js +22 -0
- package/dist/repertoire/bitwarden-native.js +458 -0
- package/dist/repertoire/bitwarden-store.js +1296 -0
- package/dist/repertoire/bundle-templates.js +71 -0
- package/dist/repertoire/bw-installer.js +268 -0
- package/dist/repertoire/coding/context-pack.js +80 -3
- package/dist/repertoire/coding/feedback.js +27 -26
- package/dist/repertoire/coding/index.js +63 -6
- package/dist/repertoire/coding/manager.js +31 -14
- package/dist/repertoire/coding/orca-client.js +194 -0
- package/dist/repertoire/coding/orca-manager.js +460 -0
- package/dist/repertoire/coding/router.js +124 -0
- package/dist/repertoire/coding/spawner.js +3 -2
- package/dist/repertoire/coding/tools.js +178 -34
- package/dist/repertoire/coding/workbench-client.js +272 -0
- package/dist/repertoire/coding/workbench-manager.js +404 -0
- package/dist/repertoire/commerce-errors.js +109 -0
- package/dist/repertoire/commerce-self-test.js +156 -0
- package/dist/repertoire/credential-access.js +183 -0
- package/dist/repertoire/desk/classifier.js +362 -0
- package/dist/repertoire/desk-mcp.js +140 -0
- package/dist/repertoire/duffel-client.js +185 -0
- package/dist/repertoire/github-client.js +14 -55
- package/dist/repertoire/graph-client.js +11 -52
- package/dist/repertoire/guardrails.js +1174 -70
- package/dist/repertoire/house-sweep.js +471 -0
- package/dist/repertoire/in-turn-tools-door.js +55 -0
- package/dist/repertoire/mcp-client.js +58 -5
- package/dist/repertoire/mcp-declared-tools.js +156 -0
- package/dist/repertoire/mcp-manager.js +457 -141
- package/dist/repertoire/mcp-tools.js +199 -0
- package/dist/repertoire/mcp-write-guard.js +85 -0
- package/dist/repertoire/plugin-mcp.js +175 -0
- package/dist/repertoire/plugins.js +253 -0
- package/dist/repertoire/relationship-authorization.js +322 -0
- package/dist/repertoire/sanctuary-container-policy.js +50 -0
- package/dist/repertoire/shell-sessions.js +136 -0
- package/dist/repertoire/skill-search.js +177 -0
- package/dist/repertoire/skill-summaries.js +129 -0
- package/dist/repertoire/skills.js +34 -4
- package/dist/repertoire/stripe-client.js +163 -0
- package/dist/repertoire/tool-arguments.js +180 -0
- package/dist/repertoire/tool-candidates.js +50 -0
- package/dist/repertoire/tool-catalog.js +228 -0
- package/dist/repertoire/tool-error-code.js +30 -0
- package/dist/repertoire/tool-limits.js +20 -0
- package/dist/repertoire/tool-results.js +29 -0
- package/dist/repertoire/tools-a2a.js +792 -0
- package/dist/repertoire/tools-app-sessions.js +219 -0
- package/dist/repertoire/tools-attachments.js +302 -0
- package/dist/repertoire/tools-awaiting.js +934 -0
- package/dist/repertoire/tools-base.js +85 -1420
- package/dist/repertoire/tools-bridge.js +153 -0
- package/dist/repertoire/tools-bundle.js +998 -0
- package/dist/repertoire/tools-chat.js +185 -0
- package/dist/repertoire/tools-commerce.js +272 -0
- package/dist/repertoire/tools-config.js +199 -0
- package/dist/repertoire/tools-continuity.js +648 -0
- package/dist/repertoire/tools-credential.js +410 -0
- package/dist/repertoire/tools-escalation.js +98 -0
- package/dist/repertoire/tools-evolution.js +560 -0
- package/dist/repertoire/tools-files.js +521 -0
- package/dist/repertoire/tools-flight.js +313 -0
- package/dist/repertoire/tools-flow.js +169 -0
- package/dist/repertoire/tools-friend-link.js +65 -0
- package/dist/repertoire/tools-github.js +11 -4
- package/dist/repertoire/tools-habits.js +111 -0
- package/dist/repertoire/tools-house-care.js +190 -0
- package/dist/repertoire/tools-mail.js +1928 -0
- package/dist/repertoire/tools-notes.js +567 -0
- package/dist/repertoire/tools-obligations.js +187 -0
- package/dist/repertoire/tools-orientation.js +36 -0
- package/dist/repertoire/tools-record.js +497 -0
- package/dist/repertoire/tools-rsvp.js +148 -0
- package/dist/repertoire/tools-runtime.js +260 -0
- package/dist/repertoire/tools-sanctuary-host.js +213 -0
- package/dist/repertoire/tools-session.js +1190 -0
- package/dist/repertoire/tools-shell.js +275 -0
- package/dist/repertoire/tools-shepherd-guidance.js +183 -0
- package/dist/repertoire/tools-shepherd.js +369 -0
- package/dist/repertoire/tools-steward-policy.js +157 -0
- package/dist/repertoire/tools-stripe.js +244 -0
- package/dist/repertoire/tools-surface.js +553 -0
- package/dist/repertoire/tools-teams.js +67 -17
- package/dist/repertoire/tools-telegram-contacts.js +41 -0
- package/dist/repertoire/tools-travel.js +142 -0
- package/dist/repertoire/tools-trip.js +1041 -0
- package/dist/repertoire/tools-unraid.js +627 -0
- package/dist/repertoire/tools-user-profile.js +166 -0
- package/dist/repertoire/tools-vault.js +46 -0
- package/dist/repertoire/tools-voice-local.js +210 -0
- package/dist/repertoire/tools-voice.js +153 -0
- package/dist/repertoire/tools-web.js +238 -0
- package/dist/repertoire/tools.js +614 -288
- package/dist/repertoire/travel-api-client.js +463 -0
- package/dist/repertoire/unraid-client.js +155 -0
- package/dist/repertoire/unraid-restart.js +342 -0
- package/dist/repertoire/user-profile.js +131 -0
- package/dist/repertoire/vault-setup.js +298 -0
- package/dist/repertoire/vault-unlock.js +816 -0
- package/dist/rsvp/aisleplanner-client.js +354 -0
- package/dist/rsvp/cli.js +936 -0
- package/dist/rsvp/config.js +327 -0
- package/dist/rsvp/cutover.js +453 -0
- package/dist/rsvp/diagnostics.js +232 -0
- package/dist/rsvp/diff-renderer.js +176 -0
- package/dist/rsvp/habit-policy.js +110 -0
- package/dist/rsvp/habit-stage.js +123 -0
- package/dist/rsvp/incident-bundle.js +97 -0
- package/dist/rsvp/migration.js +204 -0
- package/dist/rsvp/native-habit-runner.js +630 -0
- package/dist/rsvp/outbound-state.js +628 -0
- package/dist/rsvp/query.js +118 -0
- package/dist/rsvp/replay.js +233 -0
- package/dist/rsvp/snapshot.js +232 -0
- package/dist/rsvp/spend-ledger.js +175 -0
- package/dist/scripts/claude-code-stop-hook.js +4 -3
- package/dist/senses/a2a-entry.js +145 -0
- package/dist/senses/acp-server.js +386 -0
- package/dist/senses/app-sessions/client.js +128 -0
- package/dist/senses/app-sessions/digest-cards.js +263 -0
- package/dist/senses/app-sessions/digest-push.js +108 -0
- package/dist/senses/app-sessions/digest-sources.js +204 -0
- package/dist/senses/app-sessions/digest.js +284 -0
- package/dist/senses/app-sessions/run-command.js +51 -0
- package/dist/senses/app-sessions/sense.js +242 -0
- package/dist/senses/app-sessions/shepherd-cli.js +166 -0
- package/dist/senses/app-sessions/shepherd-rows.js +67 -0
- package/dist/senses/app-sessions/store.js +149 -0
- package/dist/senses/app-sessions/waiting-prompts.js +137 -0
- package/dist/senses/app-sessions/waiting-status.js +23 -0
- package/dist/senses/app-sessions-entry.js +87 -0
- package/dist/senses/attention-queue.js +95 -6
- package/dist/senses/await-turn-message.js +65 -0
- package/dist/senses/bluebubbles/active-turns.js +241 -0
- package/dist/senses/bluebubbles/attachment-cache.js +53 -0
- package/dist/senses/bluebubbles/attachment-download.js +143 -0
- package/dist/senses/{bluebubbles-client.js → bluebubbles/client.js} +391 -49
- package/dist/senses/bluebubbles/context-packet.js +207 -0
- package/dist/senses/bluebubbles/context-smoke.js +144 -0
- package/dist/senses/bluebubbles/entry.js +80 -0
- package/dist/senses/bluebubbles/host-account-verifier.js +113 -0
- package/dist/senses/{bluebubbles-inbound-log.js → bluebubbles/inbound-log.js} +21 -3
- package/dist/senses/bluebubbles/index.js +4663 -0
- package/dist/senses/bluebubbles/latest-turn.js +342 -0
- package/dist/senses/bluebubbles/media.js +255 -0
- package/dist/senses/{bluebubbles-model.js → bluebubbles/model.js} +152 -30
- package/dist/senses/{bluebubbles-mutation-log.js → bluebubbles/mutation-log.js} +24 -13
- package/dist/senses/bluebubbles/outbound-state.js +335 -0
- package/dist/senses/bluebubbles/processed-log.js +133 -0
- package/dist/senses/bluebubbles/reactions.js +18 -0
- package/dist/senses/bluebubbles/replay.js +284 -0
- package/dist/senses/{bluebubbles-runtime-state.js → bluebubbles/runtime-state.js} +47 -4
- package/dist/senses/bluebubbles/semantic-receipts.js +2014 -0
- package/dist/senses/bluebubbles/send-file.js +20 -0
- package/dist/senses/bluebubbles/send-health.js +126 -0
- package/dist/senses/{bluebubbles-session-cleanup.js → bluebubbles/session-cleanup.js} +1 -1
- package/dist/senses/bluebubbles/webhook-registration.js +257 -0
- package/dist/senses/bluebubbles-meta-guard.js +39 -0
- package/dist/senses/chat-file.js +75 -0
- package/dist/senses/cli/bracketed-paste.js +82 -0
- package/dist/senses/cli/image-paste.js +287 -0
- package/dist/senses/cli/image-ref-navigation.js +75 -0
- package/dist/senses/cli/ink-app.js +156 -0
- package/dist/senses/cli/inline-diff.js +64 -0
- package/dist/senses/cli/input-keys.js +209 -0
- package/dist/senses/cli/kill-ring.js +86 -0
- package/dist/senses/cli/message-list.js +51 -0
- package/dist/senses/cli/ouro-tui.js +633 -0
- package/dist/senses/cli/spinner-imperative.js +135 -0
- package/dist/senses/cli/spinner.js +101 -0
- package/dist/senses/cli/status-line.js +60 -0
- package/dist/senses/cli/streaming-markdown.js +526 -0
- package/dist/senses/cli/tool-display.js +85 -0
- package/dist/senses/cli/tool-render.js +85 -0
- package/dist/senses/cli/tui-store.js +252 -0
- package/dist/senses/cli/virtual-list.js +35 -0
- package/dist/senses/cli-entry.js +62 -9
- package/dist/senses/cli.js +627 -350
- package/dist/senses/commands.js +66 -3
- package/dist/senses/context-packet-ledger.js +367 -0
- package/dist/senses/context-packets.js +154 -0
- package/dist/senses/habit-lifecycle-guard.js +24 -0
- package/dist/senses/habit-turn-message.js +160 -0
- package/dist/senses/inbound-journal.js +186 -0
- package/dist/senses/ingress-evidence.js +2 -0
- package/dist/senses/mail-entry.js +69 -0
- package/dist/senses/mail.js +524 -0
- package/dist/senses/ordinary-owner-decision.js +98 -0
- package/dist/senses/pipeline.js +1216 -289
- package/dist/senses/private-runtime-worker.js +857 -0
- package/dist/senses/private-runtime.js +1692 -0
- package/dist/senses/proactive-content-guard.js +51 -0
- package/dist/senses/program-status.js +155 -0
- package/dist/senses/repeat-while.js +36 -0
- package/dist/senses/root-host-approval-port.js +345 -0
- package/dist/senses/root-host-approval-runtime.js +393 -0
- package/dist/senses/sanctuary-authority-resident.js +102 -0
- package/dist/senses/sanctuary-download-credit-presentation.js +31 -0
- package/dist/senses/sanctuary-full-visibility-contract.js +302 -0
- package/dist/senses/sanctuary-grounding.js +118 -0
- package/dist/senses/sanctuary-health-acceptance-probe-entry.js +21 -0
- package/dist/senses/sanctuary-health-acceptance-probe.js +802 -0
- package/dist/senses/sanctuary-health-runner.js +106 -0
- package/dist/senses/sanctuary-health.js +442 -0
- package/dist/senses/sanctuary-house.js +97 -0
- package/dist/senses/sanctuary-install-state-contract.js +169 -0
- package/dist/senses/sanctuary-interactive-control.js +410 -0
- package/dist/senses/sanctuary-media-catalog-contract.js +268 -0
- package/dist/senses/sanctuary-media-optimization.js +517 -0
- package/dist/senses/sanctuary-runtime.js +392 -0
- package/dist/senses/sanctuary-sab.js +85 -0
- package/dist/senses/sanctuary-storage-optimization-contract.js +32 -0
- package/dist/senses/sense-shutdown.js +72 -0
- package/dist/senses/shared-turn.js +741 -97
- package/dist/senses/shepherd/agent-presentation.js +88 -0
- package/dist/senses/shepherd/attention-page.js +166 -0
- package/dist/senses/shepherd/attention-sidebar.js +76 -0
- package/dist/senses/shepherd/attention.js +295 -0
- package/dist/senses/shepherd/checkin-config.js +76 -0
- package/dist/senses/shepherd/checkin-store.js +383 -0
- package/dist/senses/shepherd/client.js +196 -0
- package/dist/senses/shepherd/cmux.js +483 -0
- package/dist/senses/shepherd/composer.js +336 -0
- package/dist/senses/shepherd/conversation-hold.js +78 -0
- package/dist/senses/shepherd/feedback-reply.js +108 -0
- package/dist/senses/shepherd/feedback-source.js +20 -0
- package/dist/senses/shepherd/feedback-store.js +328 -0
- package/dist/senses/shepherd/feedback-submit.js +182 -0
- package/dist/senses/shepherd/feedback-worker.js +208 -0
- package/dist/senses/shepherd/guidance.js +273 -0
- package/dist/senses/shepherd/herdr.js +427 -0
- package/dist/senses/shepherd/host.js +14 -0
- package/dist/senses/shepherd/human-decision-guard.js +29 -0
- package/dist/senses/shepherd/judge-evaluation-command.js +185 -0
- package/dist/senses/shepherd/judge-evaluation-entry.js +20 -0
- package/dist/senses/shepherd/judge-evaluation.js +144 -0
- package/dist/senses/shepherd/judge.js +210 -0
- package/dist/senses/shepherd/notice-outbox.js +254 -0
- package/dist/senses/shepherd/observation-publisher.js +320 -0
- package/dist/senses/shepherd/operations-defaults.js +86 -0
- package/dist/senses/shepherd/operations.js +159 -0
- package/dist/senses/shepherd/owner-notice.js +496 -0
- package/dist/senses/shepherd/prompt-state.js +60 -0
- package/dist/senses/shepherd/recovery.js +543 -0
- package/dist/senses/shepherd/redact.js +66 -0
- package/dist/senses/shepherd/returns.js +79 -0
- package/dist/senses/shepherd/sense.js +862 -0
- package/dist/senses/shepherd/shepherd-judge-corpus-v1.json +170 -0
- package/dist/senses/shepherd/surface.js +125 -0
- package/dist/senses/shepherd/target-binding.js +13 -0
- package/dist/senses/shepherd/terminal-process.js +147 -0
- package/dist/senses/shepherd-entry.js +98 -0
- package/dist/senses/surface-tool.js +60 -34
- package/dist/senses/teams-attachments.js +68 -0
- package/dist/senses/teams-entry.js +80 -9
- package/dist/senses/teams-image.js +128 -0
- package/dist/senses/teams-inbound.js +76 -0
- package/dist/senses/teams-off-turn.js +199 -0
- package/dist/senses/teams-outbox.js +249 -0
- package/dist/senses/teams.js +1270 -378
- package/dist/senses/telegram-admission.js +700 -0
- package/dist/senses/telegram-approval-relay.js +293 -0
- package/dist/senses/telegram-approval-runtime.js +831 -0
- package/dist/senses/telegram-attachments.js +128 -0
- package/dist/senses/telegram-audit-ledger.js +220 -0
- package/dist/senses/telegram-authority-transport.js +233 -0
- package/dist/senses/telegram-chat-actions.js +57 -0
- package/dist/senses/telegram-client.js +1896 -0
- package/dist/senses/telegram-effect-adapter.js +892 -0
- package/dist/senses/telegram-entry.js +87 -0
- package/dist/senses/telegram-handoff.js +150 -0
- package/dist/senses/telegram-identity-key.js +143 -0
- package/dist/senses/telegram-markdown.js +331 -0
- package/dist/senses/telegram-owner-route.js +129 -0
- package/dist/senses/telegram.js +2789 -0
- package/dist/senses/terminal-handoff.js +44 -0
- package/dist/senses/trust-gate.js +104 -9
- package/dist/senses/turn-attempts.js +171 -0
- package/dist/senses/turn-watch.js +268 -0
- package/dist/senses/voice/audio-playback.js +237 -0
- package/dist/senses/voice/audio-routing.js +119 -0
- package/dist/senses/voice/call-auth.js +250 -0
- package/dist/senses/voice/elevenlabs.js +202 -0
- package/dist/senses/voice/floor-control.js +431 -0
- package/dist/senses/voice/floor-controller.js +115 -0
- package/dist/senses/voice/golden-path.js +116 -0
- package/dist/senses/voice/index.js +29 -0
- package/dist/senses/voice/local-audio-control.js +344 -0
- package/dist/senses/voice/local-audio-devices.js +516 -0
- package/dist/senses/voice/local-audio-disclosure.js +174 -0
- package/dist/senses/voice/local-audio-identity.js +103 -0
- package/dist/senses/voice/local-audio-join.js +325 -0
- package/dist/senses/voice/local-audio-mute.js +199 -0
- package/dist/senses/voice/local-audio-notify.js +124 -0
- package/dist/senses/voice/local-audio-prompts.js +116 -0
- package/dist/senses/voice/local-audio-transport.js +427 -0
- package/dist/senses/voice/local-audio.js +281 -0
- package/dist/senses/voice/local-media-stream.js +145 -0
- package/dist/senses/voice/meeting.js +113 -0
- package/dist/senses/voice/outbound.js +190 -0
- package/dist/senses/voice/phone.js +33 -0
- package/dist/senses/voice/playback.js +139 -0
- package/dist/senses/voice/process-guards.js +51 -0
- package/dist/senses/voice/realtime-eval.js +496 -0
- package/dist/senses/voice/realtime-tool-schema.js +195 -0
- package/dist/senses/voice/realtime-trace.js +531 -0
- package/dist/senses/voice/realtime-utterances.js +158 -0
- package/dist/senses/voice/transcript.js +70 -0
- package/dist/senses/voice/turn.js +219 -0
- package/dist/senses/voice/twilio-phone-runtime.js +836 -0
- package/dist/senses/voice/twilio-phone.js +5660 -0
- package/dist/senses/voice/types.js +2 -0
- package/dist/senses/voice/utterances.js +207 -0
- package/dist/senses/voice/whisper.js +153 -0
- package/dist/senses/voice-entry.js +84 -0
- package/dist/senses/voice-realtime-eval-command.js +99 -0
- package/dist/senses/voice-realtime-eval-entry.js +25 -0
- package/dist/senses/voice-twilio-entry.js +88 -0
- package/dist/trips/core.js +138 -0
- package/dist/trips/store.js +265 -0
- package/dist/util/frontmatter.js +69 -0
- package/node_modules/@ouro.bot/friends/LICENSE +201 -0
- package/node_modules/@ouro.bot/friends/README.md +687 -0
- package/node_modules/@ouro.bot/friends/actions/generated/mcp.json +1105 -0
- package/node_modules/@ouro.bot/friends/changelog.json +197 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/a2a-message.d.ts +39 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/a2a-message.js +54 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/adapter.d.ts +117 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/adapter.js +202 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/agent-card.d.ts +50 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/agent-card.js +32 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-key.d.ts +38 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-key.js +120 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-verifier.d.ts +195 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-verifier.js +342 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-web.d.ts +26 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-web.js +140 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/envelope-binding.d.ts +62 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/envelope-binding.js +83 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/index.d.ts +26 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/index.js +82 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/jcs.d.ts +5 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/jcs.js +84 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/reachability.d.ts +22 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/reachability.js +17 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/roster-verify.d.ts +15 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/roster-verify.js +61 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/seal.d.ts +47 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/seal.js +95 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sealed-envelope.d.ts +58 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sealed-envelope.js +113 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sign.d.ts +42 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sign.js +87 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sodium.d.ts +5 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sodium.js +19 -0
- package/node_modules/@ouro.bot/friends/dist/account-roster.d.ts +52 -0
- package/node_modules/@ouro.bot/friends/dist/account-roster.js +108 -0
- package/node_modules/@ouro.bot/friends/dist/agent-peer.d.ts +26 -0
- package/node_modules/@ouro.bot/friends/dist/agent-peer.js +138 -0
- package/node_modules/@ouro.bot/friends/dist/audit.d.ts +42 -0
- package/node_modules/@ouro.bot/friends/dist/audit.js +86 -0
- package/node_modules/@ouro.bot/friends/dist/channel.d.ts +16 -0
- package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/channel.js +83 -4
- package/node_modules/@ouro.bot/friends/dist/connect-authority.d.ts +43 -0
- package/node_modules/@ouro.bot/friends/dist/connect-authority.js +84 -0
- package/node_modules/@ouro.bot/friends/dist/connect.d.ts +56 -0
- package/node_modules/@ouro.bot/friends/dist/connect.js +163 -0
- package/node_modules/@ouro.bot/friends/dist/consent.d.ts +34 -0
- package/node_modules/@ouro.bot/friends/dist/consent.js +65 -0
- package/node_modules/@ouro.bot/friends/dist/coordination.d.ts +116 -0
- package/node_modules/@ouro.bot/friends/dist/coordination.js +329 -0
- package/node_modules/@ouro.bot/friends/dist/delegation-grant.d.ts +21 -0
- package/node_modules/@ouro.bot/friends/dist/delegation-grant.js +39 -0
- package/node_modules/@ouro.bot/friends/dist/file-bundle.d.ts +17 -0
- package/node_modules/@ouro.bot/friends/dist/file-bundle.js +27 -0
- package/node_modules/@ouro.bot/friends/dist/friend-lookup.d.ts +9 -0
- package/node_modules/@ouro.bot/friends/dist/friend-lookup.js +69 -0
- package/node_modules/@ouro.bot/friends/dist/grant-store-file.d.ts +19 -0
- package/node_modules/@ouro.bot/friends/dist/grant-store-file.js +157 -0
- package/node_modules/@ouro.bot/friends/dist/grant-store.d.ts +7 -0
- package/node_modules/@ouro.bot/friends/dist/grant-store.js +8 -0
- package/node_modules/@ouro.bot/friends/dist/grants.d.ts +43 -0
- package/node_modules/@ouro.bot/friends/dist/grants.js +100 -0
- package/node_modules/@ouro.bot/friends/dist/group-context.d.ts +21 -0
- package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/group-context.js +5 -4
- package/node_modules/@ouro.bot/friends/dist/identity.d.ts +17 -0
- package/node_modules/@ouro.bot/friends/dist/identity.js +68 -0
- package/node_modules/@ouro.bot/friends/dist/index.d.ts +73 -0
- package/node_modules/@ouro.bot/friends/dist/index.js +164 -0
- package/node_modules/@ouro.bot/friends/dist/link-identity.d.ts +14 -0
- package/node_modules/@ouro.bot/friends/dist/link-identity.js +157 -0
- package/node_modules/@ouro.bot/friends/dist/mailbox/index.d.ts +105 -0
- package/node_modules/@ouro.bot/friends/dist/mailbox/index.js +205 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/bin.d.ts +2 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/bin.js +17 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/dispatch.d.ts +40 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/dispatch.js +744 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/index.d.ts +6 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/index.js +14 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/run-main.d.ts +7 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/run-main.js +59 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/schemas.d.ts +10 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/schemas.js +23 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/server.d.ts +30 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/server.js +195 -0
- package/node_modules/@ouro.bot/friends/dist/message.d.ts +93 -0
- package/node_modules/@ouro.bot/friends/dist/message.js +129 -0
- package/node_modules/@ouro.bot/friends/dist/mission-result.d.ts +89 -0
- package/node_modules/@ouro.bot/friends/dist/mission-result.js +207 -0
- package/node_modules/@ouro.bot/friends/dist/mission-share.d.ts +94 -0
- package/node_modules/@ouro.bot/friends/dist/mission-share.js +232 -0
- package/node_modules/@ouro.bot/friends/dist/mission-store-file.d.ts +18 -0
- package/node_modules/@ouro.bot/friends/dist/mission-store-file.js +169 -0
- package/node_modules/@ouro.bot/friends/dist/mission-store.d.ts +10 -0
- package/node_modules/@ouro.bot/friends/dist/mission-store.js +9 -0
- package/node_modules/@ouro.bot/friends/dist/missions.d.ts +31 -0
- package/node_modules/@ouro.bot/friends/dist/missions.js +99 -0
- package/node_modules/@ouro.bot/friends/dist/notes.d.ts +11 -0
- package/node_modules/@ouro.bot/friends/dist/notes.js +90 -0
- package/node_modules/@ouro.bot/friends/dist/observability.d.ts +27 -0
- package/node_modules/@ouro.bot/friends/dist/observability.js +31 -0
- package/node_modules/@ouro.bot/friends/dist/outcomes.d.ts +9 -0
- package/node_modules/@ouro.bot/friends/dist/outcomes.js +51 -0
- package/node_modules/@ouro.bot/friends/dist/resolver.d.ts +59 -0
- package/node_modules/@ouro.bot/friends/dist/resolver.js +276 -0
- package/node_modules/@ouro.bot/friends/dist/results.d.ts +10 -0
- package/node_modules/@ouro.bot/friends/dist/results.js +2 -0
- package/node_modules/@ouro.bot/friends/dist/room.d.ts +22 -0
- package/node_modules/@ouro.bot/friends/dist/room.js +40 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store-file.d.ts +16 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store-file.js +125 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store-memory.d.ts +9 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store-memory.js +20 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store.d.ts +29 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store.js +9 -0
- package/node_modules/@ouro.bot/friends/dist/roster-verifier.d.ts +23 -0
- package/node_modules/@ouro.bot/friends/dist/roster-verifier.js +47 -0
- package/node_modules/@ouro.bot/friends/dist/share.d.ts +113 -0
- package/node_modules/@ouro.bot/friends/dist/share.js +314 -0
- package/node_modules/@ouro.bot/friends/dist/standing.d.ts +83 -0
- package/node_modules/@ouro.bot/friends/dist/standing.js +111 -0
- package/node_modules/@ouro.bot/friends/dist/store-file.d.ts +82 -0
- package/node_modules/@ouro.bot/friends/dist/store-file.js +1089 -0
- package/node_modules/@ouro.bot/friends/dist/store.d.ts +43 -0
- package/node_modules/@ouro.bot/friends/dist/tokens.d.ts +10 -0
- package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/tokens.js +7 -4
- package/node_modules/@ouro.bot/friends/dist/trust-explanation.d.ts +22 -0
- package/node_modules/@ouro.bot/friends/dist/trust-explanation.js +90 -0
- package/node_modules/@ouro.bot/friends/dist/trust-mutation.d.ts +16 -0
- package/node_modules/@ouro.bot/friends/dist/trust-mutation.js +67 -0
- package/node_modules/@ouro.bot/friends/dist/types.d.ts +333 -0
- package/node_modules/@ouro.bot/friends/dist/types.js +55 -0
- package/node_modules/@ouro.bot/friends/dist/util/cap-string.d.ts +7 -0
- package/node_modules/@ouro.bot/friends/dist/util/cap-string.js +35 -0
- package/node_modules/@ouro.bot/friends/dist/util/safe-id.d.ts +1 -0
- package/node_modules/@ouro.bot/friends/dist/util/safe-id.js +10 -0
- package/node_modules/@ouro.bot/friends/dist/verifier.d.ts +11 -0
- package/node_modules/@ouro.bot/friends/dist/verifier.js +29 -0
- package/node_modules/@ouro.bot/friends/dist/whoami.d.ts +7 -0
- package/node_modules/@ouro.bot/friends/dist/whoami.js +39 -0
- package/node_modules/@ouro.bot/friends/package.json +82 -0
- package/node_modules/libsodium/LICENSE +16 -0
- package/node_modules/libsodium/README.md +281 -0
- package/node_modules/libsodium/dist/modules/libsodium.js +1 -0
- package/node_modules/libsodium/dist/modules-esm/libsodium.mjs +1 -0
- package/node_modules/libsodium/package.json +54 -0
- package/node_modules/libsodium-wrappers/LICENSE +16 -0
- package/node_modules/libsodium-wrappers/README.md +281 -0
- package/node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.d.ts +2155 -0
- package/node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js +1 -0
- package/node_modules/libsodium-wrappers/dist/modules-esm/libsodium-wrappers.d.mts +2743 -0
- package/node_modules/libsodium-wrappers/dist/modules-esm/libsodium-wrappers.mjs +1 -0
- package/node_modules/libsodium-wrappers/package.json +74 -0
- package/npm-shrinkwrap.json +8789 -0
- package/package.json +97 -12
- package/skills/agent-commerce.md +116 -0
- package/skills/browser-navigation.md +120 -0
- package/skills/commerce-setup-guide.md +116 -0
- package/skills/commerce-setup.md +87 -0
- package/skills/configure-dev-tools.md +32 -14
- package/skills/sense-setup.md +56 -0
- package/skills/travel-planning.md +141 -0
- package/vendor/desk/.claude-plugin/plugin.json +35 -0
- package/vendor/desk/.mcp.claude-codex.json +28 -0
- package/vendor/desk/.mcp.copilot.json +16 -0
- package/vendor/desk/.ouro-desk.json +6 -0
- package/vendor/desk/CHANGELOG.md +7004 -0
- package/vendor/desk/README.md +195 -0
- package/vendor/desk/activation/README.md +98 -0
- package/vendor/desk/activation/copilot-root.flattened-bundle.json +38 -0
- package/vendor/desk/activation/desk.activation.json +251 -0
- package/vendor/desk/activation/host-capability-evidence.md +46 -0
- package/vendor/desk/activation/support-matrix.json +84 -0
- package/vendor/desk/agency.json +20 -0
- package/vendor/desk/agents/observer.agent.md +26 -0
- package/vendor/desk/agents/observer.md +29 -0
- package/vendor/desk/agents/worker.agent.md +32 -0
- package/vendor/desk/agents/worker.md +40 -0
- package/vendor/desk/artifacts/tombstones/tombstone.schema.json +53 -0
- package/vendor/desk/artifacts/tombstones/tombstones.jsonl +1 -0
- package/vendor/desk/changelog.d/README.md +12 -0
- package/vendor/desk/docs/agent-files.md +104 -0
- package/vendor/desk/docs/agentic-engineering-v2-rfc.md +206 -0
- package/vendor/desk/docs/agentic-engineering-v3-rfc.md +109 -0
- package/vendor/desk/docs/browser-remote-desktops.md +69 -0
- package/vendor/desk/docs/dependency-activation-stories-and-criteria.md +500 -0
- package/vendor/desk/docs/evaluation-packet.md +363 -0
- package/vendor/desk/docs/factory-local-capture.md +651 -0
- package/vendor/desk/docs/factory-store-playbook.md +927 -0
- package/vendor/desk/docs/images/factory-site.png +0 -0
- package/vendor/desk/docs/issue-drains.md +79 -0
- package/vendor/desk/docs/lfs-inspection.md +55 -0
- package/vendor/desk/docs/preview-diagnostics.md +11 -0
- package/vendor/desk/docs/relays.md +88 -0
- package/vendor/desk/docs/schedules.md +69 -0
- package/vendor/desk/docs/search-recovery.md +22 -0
- package/vendor/desk/docs/session-labels.md +157 -0
- package/vendor/desk/docs/session-retention.md +125 -0
- package/vendor/desk/docs/sessions.md +17 -0
- package/vendor/desk/docs/stalled-nudges.md +54 -0
- package/vendor/desk/docs/webhooks.md +80 -0
- package/vendor/desk/docs/workspace-tidy.md +74 -0
- package/vendor/desk/hooks/boot-checks.cjs +7 -0
- package/vendor/desk/hooks/claude-session-start.cjs +123 -0
- package/vendor/desk/hooks/compatible-node.cjs +97 -0
- package/vendor/desk/hooks/copilot-boot-prompt.cjs +69 -0
- package/vendor/desk/hooks/copilot-durable-files.cjs +8 -0
- package/vendor/desk/hooks/copilot-hooks.json +61 -0
- package/vendor/desk/hooks/copilot-intake-context.cjs +5 -0
- package/vendor/desk/hooks/copilot-lane-model.cjs +8 -0
- package/vendor/desk/hooks/copilot-session-start.cjs +264 -0
- package/vendor/desk/hooks/copilot-skill-current.cjs +28 -0
- package/vendor/desk/hooks/factory-end.cjs +5 -0
- package/vendor/desk/hooks/factory-start.cjs +27 -0
- package/vendor/desk/hooks/hooks.json +40 -0
- package/vendor/desk/hooks/lib/boot-checks.cjs +643 -0
- package/vendor/desk/hooks/lib/child-agent.cjs +14 -0
- package/vendor/desk/hooks/lib/copilot-intake-context.cjs +73 -0
- package/vendor/desk/hooks/lib/current-release.cjs +162 -0
- package/vendor/desk/hooks/lib/delivery-stop.cjs +326 -0
- package/vendor/desk/hooks/lib/detach-worker.cjs +43 -0
- package/vendor/desk/hooks/lib/durable-files.cjs +102 -0
- package/vendor/desk/hooks/lib/factory-end.cjs +327 -0
- package/vendor/desk/hooks/lib/lane-model.cjs +82 -0
- package/vendor/desk/hooks/lib/node-required.cjs +56 -0
- package/vendor/desk/hooks/lib/orca-session-title.cjs +60 -0
- package/vendor/desk/hooks/lib/session-end.cjs +30 -0
- package/vendor/desk/hooks/lib/sync-end.cjs +89 -0
- package/vendor/desk/hooks/loop-start.cjs +105 -0
- package/vendor/desk/hooks/node-missing.sh +78 -0
- package/vendor/desk/hooks/orca-session-title.cjs +8 -0
- package/vendor/desk/hooks/session-end.cjs +8 -0
- package/vendor/desk/mcp/README.md +269 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/support-matrix.json +72 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/README.md +25 -0
- package/vendor/desk/mcp/bootstrap.cjs +761 -0
- package/vendor/desk/mcp/docs/private-feedback.md +13 -0
- package/vendor/desk/mcp/idle-proxy.cjs +423 -0
- package/vendor/desk/mcp/index.js +813 -0
- package/vendor/desk/mcp/package-lock.json +3717 -0
- package/vendor/desk/mcp/package.json +44 -0
- package/vendor/desk/mcp/scripts/agency-desk-channel.js +7 -0
- package/vendor/desk/mcp/scripts/build-runtime-deps-pack.js +5 -0
- package/vendor/desk/mcp/scripts/crew.js +89 -0
- package/vendor/desk/mcp/scripts/drains-launcher.mjs +329 -0
- package/vendor/desk/mcp/scripts/drains.js +5 -0
- package/vendor/desk/mcp/scripts/factory.js +657 -0
- package/vendor/desk/mcp/scripts/file-desk-problem.js +9 -0
- package/vendor/desk/mcp/scripts/finish-commit.js +7 -0
- package/vendor/desk/mcp/scripts/lfs.js +37 -0
- package/vendor/desk/mcp/scripts/local-recovery.js +363 -0
- package/vendor/desk/mcp/scripts/migrations.js +11 -0
- package/vendor/desk/mcp/scripts/private-view.js +177 -0
- package/vendor/desk/mcp/scripts/resolve-desk-root.js +106 -0
- package/vendor/desk/mcp/scripts/session-boot.js +22 -0
- package/vendor/desk/mcp/scripts/session-retention.js +5 -0
- package/vendor/desk/mcp/scripts/session-sync.js +10 -0
- package/vendor/desk/mcp/scripts/sessions.js +5 -0
- package/vendor/desk/mcp/scripts/sync-push.js +13 -0
- package/vendor/desk/mcp/scripts/tidy-status.js +8 -0
- package/vendor/desk/mcp/scripts/verify-runtime-deps-pack.js +5 -0
- package/vendor/desk/mcp/src/actions/desk-read.actions.mts +73 -0
- package/vendor/desk/mcp/src/actions/desk-session.actions.mts +42 -0
- package/vendor/desk/mcp/src/actions/desk-web.actions.mts +52 -0
- package/vendor/desk/mcp/src/actions/desk.actions.mts +5 -0
- package/vendor/desk/mcp/src/actions/generated/desk/OuroActions.swift +649 -0
- package/vendor/desk/mcp/src/actions/generated/desk/OuroActionsReins.swift +61 -0
- package/vendor/desk/mcp/src/actions/generated/desk/actions.json +280 -0
- package/vendor/desk/mcp/src/actions/generated/desk/commands.json +145 -0
- package/vendor/desk/mcp/src/actions/generated/desk/mcp.json +256 -0
- package/vendor/desk/mcp/src/actions/generated/desk/web.ts +59 -0
- package/vendor/desk/mcp/src/actions/generated/desk/webmcp.json +250 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/OuroActions.swift +241 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/OuroActionsReins.swift +25 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/actions.json +73 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/commands.json +53 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/mcp.json +83 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/web.ts +47 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/webmcp.json +81 -0
- package/vendor/desk/mcp/src/actions/served.js +5 -0
- package/vendor/desk/mcp/src/activation/admit.js +77 -0
- package/vendor/desk/mcp/src/activation/failures.js +65 -0
- package/vendor/desk/mcp/src/activation/readiness-policy.js +102 -0
- package/vendor/desk/mcp/src/activation/schema.js +17 -0
- package/vendor/desk/mcp/src/activation/superpowers-context.js +265 -0
- package/vendor/desk/mcp/src/activation/validate.js +540 -0
- package/vendor/desk/mcp/src/artifacts/tombstones.js +61 -0
- package/vendor/desk/mcp/src/crew/initiative.js +287 -0
- package/vendor/desk/mcp/src/crew/workspace.js +1259 -0
- package/vendor/desk/mcp/src/db/init.js +75 -0
- package/vendor/desk/mcp/src/db/schema.sql +83 -0
- package/vendor/desk/mcp/src/desk/active-tasks.js +408 -0
- package/vendor/desk/mcp/src/desk/card-commit-guard.js +281 -0
- package/vendor/desk/mcp/src/desk/cleanup-index.js +53 -0
- package/vendor/desk/mcp/src/desk/content-home.js +246 -0
- package/vendor/desk/mcp/src/desk/crew-config.js +102 -0
- package/vendor/desk/mcp/src/desk/crew-member.js +196 -0
- package/vendor/desk/mcp/src/desk/crew-roster.js +151 -0
- package/vendor/desk/mcp/src/desk/frontmatter-lite.js +228 -0
- package/vendor/desk/mcp/src/desk/gh-logins.js +109 -0
- package/vendor/desk/mcp/src/desk/handles.js +123 -0
- package/vendor/desk/mcp/src/desk/handoff-reference.js +35 -0
- package/vendor/desk/mcp/src/desk/improvement-authority.js +3 -0
- package/vendor/desk/mcp/src/desk/improvement-cards.js +704 -0
- package/vendor/desk/mcp/src/desk/improvement-person.js +51 -0
- package/vendor/desk/mcp/src/desk/lifecycle.js +16 -0
- package/vendor/desk/mcp/src/desk/machine-desks.js +119 -0
- package/vendor/desk/mcp/src/desk/naming.js +333 -0
- package/vendor/desk/mcp/src/desk/organization.js +592 -0
- package/vendor/desk/mcp/src/desk/resources.js +274 -0
- package/vendor/desk/mcp/src/desk/runtime-resolver.js +30 -0
- package/vendor/desk/mcp/src/desk/scratch-paths.js +44 -0
- package/vendor/desk/mcp/src/desk/step-delivery.js +140 -0
- package/vendor/desk/mcp/src/desk/steps.js +263 -0
- package/vendor/desk/mcp/src/desk/tidy.js +930 -0
- package/vendor/desk/mcp/src/desk/unsigned-deliveries.js +359 -0
- package/vendor/desk/mcp/src/factory/agent-types.js +45 -0
- package/vendor/desk/mcp/src/factory/andon-watch.js +109 -0
- package/vendor/desk/mcp/src/factory/binding.js +612 -0
- package/vendor/desk/mcp/src/factory/boot-check.js +645 -0
- package/vendor/desk/mcp/src/factory/capture-classify.js +158 -0
- package/vendor/desk/mcp/src/factory/capture-count.js +183 -0
- package/vendor/desk/mcp/src/factory/capture-flush.js +268 -0
- package/vendor/desk/mcp/src/factory/capture-publish.js +141 -0
- package/vendor/desk/mcp/src/factory/capture-schema.js +193 -0
- package/vendor/desk/mcp/src/factory/capture-sweep.js +239 -0
- package/vendor/desk/mcp/src/factory/catch-point.js +60 -0
- package/vendor/desk/mcp/src/factory/commit-resolve.js +94 -0
- package/vendor/desk/mcp/src/factory/consent-answer.js +37 -0
- package/vendor/desk/mcp/src/factory/context-capability.js +15 -0
- package/vendor/desk/mcp/src/factory/context-outbox.js +885 -0
- package/vendor/desk/mcp/src/factory/context-run.js +386 -0
- package/vendor/desk/mcp/src/factory/context-schema.js +249 -0
- package/vendor/desk/mcp/src/factory/copilot-turn-index.js +93 -0
- package/vendor/desk/mcp/src/factory/copilot-usage.js +148 -0
- package/vendor/desk/mcp/src/factory/credential.js +45 -0
- package/vendor/desk/mcp/src/factory/derive-claude.js +960 -0
- package/vendor/desk/mcp/src/factory/derive-codex.js +734 -0
- package/vendor/desk/mcp/src/factory/derive-common.js +279 -0
- package/vendor/desk/mcp/src/factory/derive-copilot.js +1057 -0
- package/vendor/desk/mcp/src/factory/derive-run.js +807 -0
- package/vendor/desk/mcp/src/factory/desk-problem-file.js +310 -0
- package/vendor/desk/mcp/src/factory/desk-problem-fingerprint.js +70 -0
- package/vendor/desk/mcp/src/factory/desk-problem-known.js +246 -0
- package/vendor/desk/mcp/src/factory/desk-problem-template.js +107 -0
- package/vendor/desk/mcp/src/factory/desk-repo.js +1223 -0
- package/vendor/desk/mcp/src/factory/desk-task-line.js +28 -0
- package/vendor/desk/mcp/src/factory/desk-visibility.js +48 -0
- package/vendor/desk/mcp/src/factory/end-hook.js +14 -0
- package/vendor/desk/mcp/src/factory/evaluate-kick.js +164 -0
- package/vendor/desk/mcp/src/factory/evaluate-run.js +678 -0
- package/vendor/desk/mcp/src/factory/evaluator-step.js +484 -0
- package/vendor/desk/mcp/src/factory/filer-launch.js +79 -0
- package/vendor/desk/mcp/src/factory/flush-health.js +26 -0
- package/vendor/desk/mcp/src/factory/flush.js +1758 -0
- package/vendor/desk/mcp/src/factory/focus.js +326 -0
- package/vendor/desk/mcp/src/factory/headless-flag.cjs +32 -0
- package/vendor/desk/mcp/src/factory/headless-flag.js +25 -0
- package/vendor/desk/mcp/src/factory/headless-ledger.js +743 -0
- package/vendor/desk/mcp/src/factory/headless.js +567 -0
- package/vendor/desk/mcp/src/factory/held-route.js +93 -0
- package/vendor/desk/mcp/src/factory/host-flags.js +36 -0
- package/vendor/desk/mcp/src/factory/improvement-verify.js +429 -0
- package/vendor/desk/mcp/src/factory/kaizen-file.js +231 -0
- package/vendor/desk/mcp/src/factory/label-binding.js +90 -0
- package/vendor/desk/mcp/src/factory/label-schema.js +426 -0
- package/vendor/desk/mcp/src/factory/local-status.js +368 -0
- package/vendor/desk/mcp/src/factory/loop-conditions.js +121 -0
- package/vendor/desk/mcp/src/factory/loop-health.js +500 -0
- package/vendor/desk/mcp/src/factory/loop-slot.js +90 -0
- package/vendor/desk/mcp/src/factory/loop-status.js +100 -0
- package/vendor/desk/mcp/src/factory/loop-switch.cjs +14 -0
- package/vendor/desk/mcp/src/factory/loop-worker-state.js +96 -0
- package/vendor/desk/mcp/src/factory/loop-worker.js +290 -0
- package/vendor/desk/mcp/src/factory/marker.js +61 -0
- package/vendor/desk/mcp/src/factory/mirror-step.js +145 -0
- package/vendor/desk/mcp/src/factory/os-protect.js +243 -0
- package/vendor/desk/mcp/src/factory/outbox.js +2231 -0
- package/vendor/desk/mcp/src/factory/outcome.js +431 -0
- package/vendor/desk/mcp/src/factory/pipeline/andon.js +319 -0
- package/vendor/desk/mcp/src/factory/pipeline/attention-rollup.js +158 -0
- package/vendor/desk/mcp/src/factory/pipeline/attention.js +146 -0
- package/vendor/desk/mcp/src/factory/pipeline/build.js +299 -0
- package/vendor/desk/mcp/src/factory/pipeline/compare.js +148 -0
- package/vendor/desk/mcp/src/factory/pipeline/formulas.js +652 -0
- package/vendor/desk/mcp/src/factory/pipeline/kaizen.js +387 -0
- package/vendor/desk/mcp/src/factory/pipeline/lifecycle-clocks.js +345 -0
- package/vendor/desk/mcp/src/factory/pipeline/normalize.js +73 -0
- package/vendor/desk/mcp/src/factory/pipeline/number-states.js +154 -0
- package/vendor/desk/mcp/src/factory/pipeline/outcomes.js +268 -0
- package/vendor/desk/mcp/src/factory/pipeline/report.js +737 -0
- package/vendor/desk/mcp/src/factory/pipeline/rollups.js +883 -0
- package/vendor/desk/mcp/src/factory/pipeline/stretches.js +523 -0
- package/vendor/desk/mcp/src/factory/pipeline/timeline.js +199 -0
- package/vendor/desk/mcp/src/factory/pipeline/validate-pr.js +238 -0
- package/vendor/desk/mcp/src/factory/pipeline/versions.js +42 -0
- package/vendor/desk/mcp/src/factory/pipeline/walk.js +1177 -0
- package/vendor/desk/mcp/src/factory/plugin-registry.js +72 -0
- package/vendor/desk/mcp/src/factory/plugin-sources.cjs +249 -0
- package/vendor/desk/mcp/src/factory/pr-green.js +77 -0
- package/vendor/desk/mcp/src/factory/process-lock.js +142 -0
- package/vendor/desk/mcp/src/factory/proof-session.js +75 -0
- package/vendor/desk/mcp/src/factory/publish.js +637 -0
- package/vendor/desk/mcp/src/factory/published-schema.js +648 -0
- package/vendor/desk/mcp/src/factory/reconcile-reasons.js +22 -0
- package/vendor/desk/mcp/src/factory/reconcile-step.js +251 -0
- package/vendor/desk/mcp/src/factory/reconcile.js +808 -0
- package/vendor/desk/mcp/src/factory/release-version.js +134 -0
- package/vendor/desk/mcp/src/factory/repo-name.js +13 -0
- package/vendor/desk/mcp/src/factory/retention.js +60 -0
- package/vendor/desk/mcp/src/factory/route-desk.js +40 -0
- package/vendor/desk/mcp/src/factory/route-issues.js +251 -0
- package/vendor/desk/mcp/src/factory/route-local.js +264 -0
- package/vendor/desk/mcp/src/factory/schema.js +957 -0
- package/vendor/desk/mcp/src/factory/session-kind.js +16 -0
- package/vendor/desk/mcp/src/factory/session-lifetime.js +56 -0
- package/vendor/desk/mcp/src/factory/session-route.js +183 -0
- package/vendor/desk/mcp/src/factory/shell-git.js +500 -0
- package/vendor/desk/mcp/src/factory/store-issues.js +143 -0
- package/vendor/desk/mcp/src/factory/store-route.js +208 -0
- package/vendor/desk/mcp/src/factory/test-state-guard.js +103 -0
- package/vendor/desk/mcp/src/factory/time.js +36 -0
- package/vendor/desk/mcp/src/factory/tool-issue-file.js +84 -0
- package/vendor/desk/mcp/src/factory/tool-kinds.js +87 -0
- package/vendor/desk/mcp/src/factory/triage-schema.js +233 -0
- package/vendor/desk/mcp/src/factory/windows-acl.js +679 -0
- package/vendor/desk/mcp/src/indexer/chunk.js +232 -0
- package/vendor/desk/mcp/src/indexer/discover.js +434 -0
- package/vendor/desk/mcp/src/indexer/exclusions.js +247 -0
- package/vendor/desk/mcp/src/indexer/index.js +167 -0
- package/vendor/desk/mcp/src/indexer/refs.js +0 -0
- package/vendor/desk/mcp/src/indexer/text-hash.js +18 -0
- package/vendor/desk/mcp/src/lib/ouro-actions/actions.claims.json +75 -0
- package/vendor/desk/mcp/src/lib/ouro-actions/dist-manifest.json +70 -0
- package/vendor/desk/mcp/src/lib/ouro-actions/ouro-actions.mts +1416 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/LICENSE +21 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/ax-claims.ts +190 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/ax-command.ts +1020 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/checks.ts +343 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/cli.ts +240 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/component.ts +430 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/dev-commands.ts +204 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/doctor.ts +126 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/effects.ts +68 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/exit-codes.ts +75 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/help.ts +220 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/mcp.ts +268 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/outcome.ts +265 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/output.ts +67 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/precise-copy.ts +235 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/problem.ts +124 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/surfaces.kit.mts +8 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/surfaces.ts +568 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/terminal.ts +245 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/voice.ts +136 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/wait.ts +226 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/work-event.ts +181 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/xray.kit.mts +18 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/xray.ts +2072 -0
- package/vendor/desk/mcp/src/package-metadata.js +20 -0
- package/vendor/desk/mcp/src/protected/legacy-ledger.js +55 -0
- package/vendor/desk/mcp/src/readiness/leftovers.js +75 -0
- package/vendor/desk/mcp/src/readiness/process-start.js +149 -0
- package/vendor/desk/mcp/src/runtime/admission-worker.js +194 -0
- package/vendor/desk/mcp/src/runtime/admission.js +177 -0
- package/vendor/desk/mcp/src/runtime/agency-desk-channel.js +342 -0
- package/vendor/desk/mcp/src/runtime/agents-md.js +62 -0
- package/vendor/desk/mcp/src/runtime/append-lane.js +68 -0
- package/vendor/desk/mcp/src/runtime/argv-safe-reason.js +55 -0
- package/vendor/desk/mcp/src/runtime/boot-dependencies.js +75 -0
- package/vendor/desk/mcp/src/runtime/boot-text.js +504 -0
- package/vendor/desk/mcp/src/runtime/boot.js +1677 -0
- package/vendor/desk/mcp/src/runtime/bootstrap.js +1455 -0
- package/vendor/desk/mcp/src/runtime/chunked-import.js +102 -0
- package/vendor/desk/mcp/src/runtime/copilot-commit-trailer.js +133 -0
- package/vendor/desk/mcp/src/runtime/copilot-session.js +155 -0
- package/vendor/desk/mcp/src/runtime/deliver.js +469 -0
- package/vendor/desk/mcp/src/runtime/desk-channel.js +86 -0
- package/vendor/desk/mcp/src/runtime/desk-failure.js +26 -0
- package/vendor/desk/mcp/src/runtime/desk-health.js +168 -0
- package/vendor/desk/mcp/src/runtime/desk-session.js +1451 -0
- package/vendor/desk/mcp/src/runtime/diagnostic-server.js +72 -0
- package/vendor/desk/mcp/src/runtime/diagnostics.js +241 -0
- package/vendor/desk/mcp/src/runtime/drains-cli.js +187 -0
- package/vendor/desk/mcp/src/runtime/drains.js +781 -0
- package/vendor/desk/mcp/src/runtime/elsewhere-note.js +9 -0
- package/vendor/desk/mcp/src/runtime/failure-evidence.js +21 -0
- package/vendor/desk/mcp/src/runtime/fast-refs.js +209 -0
- package/vendor/desk/mcp/src/runtime/filer-throttle.js +66 -0
- package/vendor/desk/mcp/src/runtime/focused-card.js +147 -0
- package/vendor/desk/mcp/src/runtime/front-door.js +204 -0
- package/vendor/desk/mcp/src/runtime/gate-wait.js +2 -0
- package/vendor/desk/mcp/src/runtime/git-inspection.js +201 -0
- package/vendor/desk/mcp/src/runtime/git-read-worker.js +157 -0
- package/vendor/desk/mcp/src/runtime/health.js +50 -0
- package/vendor/desk/mcp/src/runtime/hooks.js +353 -0
- package/vendor/desk/mcp/src/runtime/hosted.js +163 -0
- package/vendor/desk/mcp/src/runtime/inbox.js +102 -0
- package/vendor/desk/mcp/src/runtime/index-drift.js +118 -0
- package/vendor/desk/mcp/src/runtime/last-start.js +133 -0
- package/vendor/desk/mcp/src/runtime/lesson-section.js +92 -0
- package/vendor/desk/mcp/src/runtime/lessons-shelf.js +100 -0
- package/vendor/desk/mcp/src/runtime/lfs.js +319 -0
- package/vendor/desk/mcp/src/runtime/native-path.js +12 -0
- package/vendor/desk/mcp/src/runtime/newest-release.js +197 -0
- package/vendor/desk/mcp/src/runtime/node-selection.js +233 -0
- package/vendor/desk/mcp/src/runtime/orca-session-title.js +225 -0
- package/vendor/desk/mcp/src/runtime/other-sessions.js +183 -0
- package/vendor/desk/mcp/src/runtime/pending-migrations.js +653 -0
- package/vendor/desk/mcp/src/runtime/plugin-update.js +215 -0
- package/vendor/desk/mcp/src/runtime/pluginless-runtimes.js +34 -0
- package/vendor/desk/mcp/src/runtime/pr-publication.js +226 -0
- package/vendor/desk/mcp/src/runtime/preview-snapshot.js +23 -0
- package/vendor/desk/mcp/src/runtime/publication-mode.js +19 -0
- package/vendor/desk/mcp/src/runtime/relays.js +974 -0
- package/vendor/desk/mcp/src/runtime/release-alert.js +148 -0
- package/vendor/desk/mcp/src/runtime/remote-identity.js +140 -0
- package/vendor/desk/mcp/src/runtime/resolve-here.js +4 -0
- package/vendor/desk/mcp/src/runtime/runtime-deps-cli.js +65 -0
- package/vendor/desk/mcp/src/runtime/runtime-deps.js +1109 -0
- package/vendor/desk/mcp/src/runtime/runtime-identity.js +22 -0
- package/vendor/desk/mcp/src/runtime/runtime-swap.js +101 -0
- package/vendor/desk/mcp/src/runtime/schedules.js +235 -0
- package/vendor/desk/mcp/src/runtime/session-activity.js +190 -0
- package/vendor/desk/mcp/src/runtime/session-label.js +30 -0
- package/vendor/desk/mcp/src/runtime/session-retention.js +662 -0
- package/vendor/desk/mcp/src/runtime/session-sync.js +333 -0
- package/vendor/desk/mcp/src/runtime/session-trailer.js +126 -0
- package/vendor/desk/mcp/src/runtime/sessions-cli.js +301 -0
- package/vendor/desk/mcp/src/runtime/signoff-listed.js +81 -0
- package/vendor/desk/mcp/src/runtime/skills.js +76 -0
- package/vendor/desk/mcp/src/runtime/stale-card-lead.js +52 -0
- package/vendor/desk/mcp/src/runtime/stale-desk-refresh.js +198 -0
- package/vendor/desk/mcp/src/runtime/stale-desk.js +219 -0
- package/vendor/desk/mcp/src/runtime/stalled.js +255 -0
- package/vendor/desk/mcp/src/runtime/standing-authority.js +79 -0
- package/vendor/desk/mcp/src/runtime/startup-boot.js +341 -0
- package/vendor/desk/mcp/src/runtime/startup-resolve.js +140 -0
- package/vendor/desk/mcp/src/runtime/state-branch.js +203 -0
- package/vendor/desk/mcp/src/runtime/status-compact.js +165 -0
- package/vendor/desk/mcp/src/runtime/status-inspection-child.js +26 -0
- package/vendor/desk/mcp/src/runtime/status-inspection.js +147 -0
- package/vendor/desk/mcp/src/runtime/status-root.js +39 -0
- package/vendor/desk/mcp/src/runtime/sync-worker.js +911 -0
- package/vendor/desk/mcp/src/runtime/test-state-guard.js +107 -0
- package/vendor/desk/mcp/src/runtime/unmerged-saves.js +247 -0
- package/vendor/desk/mcp/src/runtime/workspace-claim.js +53 -0
- package/vendor/desk/mcp/src/runtime/workspace-evidence.js +96 -0
- package/vendor/desk/mcp/src/runtime/workspace-tidy.js +509 -0
- package/vendor/desk/mcp/src/search/direct-lexical.js +54 -0
- package/vendor/desk/mcp/src/search/embedder.js +108 -0
- package/vendor/desk/mcp/src/search/engine.js +406 -0
- package/vendor/desk/mcp/src/search/files-router.js +22 -0
- package/vendor/desk/mcp/src/search/old-index.js +46 -0
- package/vendor/desk/mcp/src/search/vectors.js +60 -0
- package/vendor/desk/mcp/src/server.js +389 -0
- package/vendor/desk/mcp/src/tool-names.js +73 -0
- package/vendor/desk/mcp/src/tool-refusal.cjs +35 -0
- package/vendor/desk/mcp/src/tool-schema-parts.js +12 -0
- package/vendor/desk/mcp/src/tool-schemas.js +325 -0
- package/vendor/desk/mcp/src/tools/_card-commit.js +148 -0
- package/vendor/desk/mcp/src/tools/archive-links.js +185 -0
- package/vendor/desk/mcp/src/tools/archive-move.js +18 -0
- package/vendor/desk/mcp/src/tools/archive-native-session.js +728 -0
- package/vendor/desk/mcp/src/tools/archive-state.js +513 -0
- package/vendor/desk/mcp/src/tools/delivery-gate.js +251 -0
- package/vendor/desk/mcp/src/tools/desk-save.js +444 -0
- package/vendor/desk/mcp/src/tools/doctor.js +122 -0
- package/vendor/desk/mcp/src/tools/done-evidence.js +260 -0
- package/vendor/desk/mcp/src/tools/factory-context.js +204 -0
- package/vendor/desk/mcp/src/tools/friction.js +332 -0
- package/vendor/desk/mcp/src/tools/improvement.js +156 -0
- package/vendor/desk/mcp/src/tools/lesson-lines.js +22 -0
- package/vendor/desk/mcp/src/tools/lesson-owners.js +137 -0
- package/vendor/desk/mcp/src/tools/lesson-team.js +169 -0
- package/vendor/desk/mcp/src/tools/lesson.js +254 -0
- package/vendor/desk/mcp/src/tools/local-only.js +151 -0
- package/vendor/desk/mcp/src/tools/move.js +794 -0
- package/vendor/desk/mcp/src/tools/native-stage-context.js +32 -0
- package/vendor/desk/mcp/src/tools/note.js +267 -0
- package/vendor/desk/mcp/src/tools/search.js +634 -0
- package/vendor/desk/mcp/src/tools/shared-write.js +196 -0
- package/vendor/desk/mcp/src/tools/sibling-desk.js +37 -0
- package/vendor/desk/mcp/src/tools/status.js +233 -0
- package/vendor/desk/mcp/src/tools/task-archive-due.js +9 -0
- package/vendor/desk/mcp/src/tools/task-archived-resource.js +53 -0
- package/vendor/desk/mcp/src/tools/task-body.js +141 -0
- package/vendor/desk/mcp/src/tools/task-focus.js +164 -0
- package/vendor/desk/mcp/src/tools/task-log.js +76 -0
- package/vendor/desk/mcp/src/tools/task-signoff.js +155 -0
- package/vendor/desk/mcp/src/tools/task.js +1768 -0
- package/vendor/desk/mcp/src/tools/track-row.js +89 -0
- package/vendor/desk/mcp/src/tools/track.js +240 -0
- package/vendor/desk/mcp/src/util/agency-session.cjs +29 -0
- package/vendor/desk/mcp/src/util/archive-links.js +105 -0
- package/vendor/desk/mcp/src/util/bash.js +36 -0
- package/vendor/desk/mcp/src/util/capture-record.js +73 -0
- package/vendor/desk/mcp/src/util/cas-commit.js +252 -0
- package/vendor/desk/mcp/src/util/created-dirs.js +71 -0
- package/vendor/desk/mcp/src/util/deferred-tools.js +51 -0
- package/vendor/desk/mcp/src/util/desk-owner.js +99 -0
- package/vendor/desk/mcp/src/util/env-value.js +13 -0
- package/vendor/desk/mcp/src/util/file-identity.js +40 -0
- package/vendor/desk/mcp/src/util/finish-commit.js +145 -0
- package/vendor/desk/mcp/src/util/fm.js +410 -0
- package/vendor/desk/mcp/src/util/git-config-file.js +85 -0
- package/vendor/desk/mcp/src/util/git-stage.js +440 -0
- package/vendor/desk/mcp/src/util/main-publish.js +240 -0
- package/vendor/desk/mcp/src/util/markdown-links.cjs +555 -0
- package/vendor/desk/mcp/src/util/object-input.js +59 -0
- package/vendor/desk/mcp/src/util/paths.js +647 -0
- package/vendor/desk/mcp/src/util/rank.js +189 -0
- package/vendor/desk/mcp/src/util/redact.js +92 -0
- package/vendor/desk/mcp/src/util/remove-retry.js +35 -0
- package/vendor/desk/mcp/src/util/rename-retry.js +73 -0
- package/vendor/desk/mcp/src/util/route-around.js +265 -0
- package/vendor/desk/mcp/src/util/shell-quote.js +18 -0
- package/vendor/desk/mcp/src/util/startup-direction.js +124 -0
- package/vendor/desk/mcp/src/util/state-ignore.js +33 -0
- package/vendor/desk/mcp/src/util/tool-commits.js +64 -0
- package/vendor/desk/mcp/src/util/unicode-16/LICENSE-MIT.txt +7 -0
- package/vendor/desk/mcp/src/util/unicode-16/README.md +9 -0
- package/vendor/desk/mcp/src/util/unicode-16/letter.cjs +1 -0
- package/vendor/desk/mcp/src/util/unicode-16/mark.cjs +1 -0
- package/vendor/desk/mcp/src/util/unicode-16/number.cjs +1 -0
- package/vendor/desk/mcp/web-auth.cjs +1897 -0
- package/vendor/desk/mcp/web-browser-discovery.cjs +53 -0
- package/vendor/desk/mcp/web-catalog.json +34 -0
- package/vendor/desk/mcp/web-launch.cjs +101 -0
- package/vendor/desk/mcp/web.cjs +1239 -0
- package/vendor/desk/migrations/01-move-to-ourostack-desk.md +188 -0
- package/vendor/desk/migrations/02-tidy-desk.md +87 -0
- package/vendor/desk/migrations/03-desk-release-channel.md +38 -0
- package/vendor/desk/optional/session-label/consumer.mjs +237 -0
- package/vendor/desk/optional/session-label/extension.mjs +32 -0
- package/vendor/desk/plugin.json +54 -0
- package/vendor/desk/settings.json +3 -0
- package/vendor/desk/skills/add-workspace-mcp/SKILL.md +180 -0
- package/vendor/desk/skills/adopt-inflight-work/SKILL.md +212 -0
- package/vendor/desk/skills/archive-workflow/SKILL.md +132 -0
- package/vendor/desk/skills/content-routing/SKILL.md +95 -0
- package/vendor/desk/skills/core-meeting-capture/SKILL.md +47 -0
- package/vendor/desk/skills/core-meeting-capture/references/capture-contract.md +175 -0
- package/vendor/desk/skills/curator/SKILL.md +103 -0
- package/vendor/desk/skills/delightful-decks/SKILL.md +67 -0
- package/vendor/desk/skills/desk-problem/SKILL.md +87 -0
- package/vendor/desk/skills/directory-structure/SKILL.md +169 -0
- package/vendor/desk/skills/doc-review-rigor/SKILL.md +63 -0
- package/vendor/desk/skills/draining-issues/SKILL.md +62 -0
- package/vendor/desk/skills/evaluate-release/SKILL.md +96 -0
- package/vendor/desk/skills/evidence-discipline/SKILL.md +150 -0
- package/vendor/desk/skills/factory-evaluator/SKILL.md +122 -0
- package/vendor/desk/skills/factory-task-context/SKILL.md +116 -0
- package/vendor/desk/skills/factory-work/SKILL.md +16 -0
- package/vendor/desk/skills/fast-honest-ci/SKILL.md +70 -0
- package/vendor/desk/skills/fast-honest-ci/examples.md +49 -0
- package/vendor/desk/skills/first-run-bootstrap/SKILL.md +95 -0
- package/vendor/desk/skills/friction-management/SKILL.md +98 -0
- package/vendor/desk/skills/git-hygiene/SKILL.md +253 -0
- package/vendor/desk/skills/independent-review/SKILL.md +34 -0
- package/vendor/desk/skills/interaction-style/SKILL.md +239 -0
- package/vendor/desk/skills/lesson-capture/SKILL.md +85 -0
- package/vendor/desk/skills/lesson-capture/agents-md-budget.mjs +61 -0
- package/vendor/desk/skills/online-evaluation/SKILL.md +81 -0
- package/vendor/desk/skills/operator-voice-comments/LICENSE-humanize +21 -0
- package/vendor/desk/skills/operator-voice-comments/SKILL.md +90 -0
- package/vendor/desk/skills/operator-voice-comments/human-voice.md +43 -0
- package/vendor/desk/skills/peer-pr-review/SKILL.md +104 -0
- package/vendor/desk/skills/pr-feedback-on-own-pr/SKILL.md +145 -0
- package/vendor/desk/skills/pr-review-interrogation/SKILL.md +121 -0
- package/vendor/desk/skills/pr-reviewer-audit/SKILL.md +68 -0
- package/vendor/desk/skills/pr-reviewer-audit/helpers/audit.py +335 -0
- package/vendor/desk/skills/pr-reviewer-audit/helpers/test_audit.py +486 -0
- package/vendor/desk/skills/pr-self-review/SKILL.md +86 -0
- package/vendor/desk/skills/pr-surface-hygiene/SKILL.md +105 -0
- package/vendor/desk/skills/pr-surface-hygiene/check-visual-proof.cjs +99 -0
- package/vendor/desk/skills/pr-surface-hygiene/repository-setup.md +19 -0
- package/vendor/desk/skills/pr-surface-hygiene/resources/pr-visual-proof.yml +29 -0
- package/vendor/desk/skills/pr-surface-hygiene/resources/pull-request-template.md +5 -0
- package/vendor/desk/skills/preflight-actions/SKILL.md +60 -0
- package/vendor/desk/skills/preview-feedback/SKILL.md +70 -0
- package/vendor/desk/skills/repo-handling/SKILL.md +67 -0
- package/vendor/desk/skills/rnd-lab/SKILL.md +52 -0
- package/vendor/desk/skills/runtime-symptom-investigation/SKILL.md +106 -0
- package/vendor/desk/skills/session-resumption/SKILL.md +126 -0
- package/vendor/desk/skills/session-start/SKILL.md +54 -0
- package/vendor/desk/skills/session-start/details.md +150 -0
- package/vendor/desk/skills/session-start-migrations/README.md +71 -0
- package/vendor/desk/skills/session-start-migrations/SKILL.md +108 -0
- package/vendor/desk/skills/start-task/SKILL.md +88 -0
- package/vendor/desk/skills/task-card-format/SKILL.md +198 -0
- package/vendor/desk/skills/task-lifecycle/SKILL.md +217 -0
- package/vendor/desk/skills/track-card-format/SKILL.md +90 -0
- package/vendor/desk/skills/using-desk/SKILL.md +58 -0
- package/vendor/desk/skills/using-superpowers-with-desk/SKILL.md +156 -0
- package/vendor/desk/skills/work-orchestration/SKILL.md +162 -0
- package/dist/heart/daemon/auth-flow.js +0 -457
- package/dist/heart/daemon/habit-parser.js +0 -119
- package/dist/heart/daemon/habit-scheduler.js +0 -252
- package/dist/heart/daemon/mcp-server.js +0 -591
- package/dist/heart/daemon/ouro-path-installer.js +0 -221
- package/dist/heart/daemon/ouro-version-manager.js +0 -171
- package/dist/heart/daemon/specialist-tools.js +0 -283
- package/dist/heart/daemon/update-hooks.js +0 -138
- package/dist/heart/obligations.js +0 -197
- package/dist/heart/session-recall.js +0 -216
- package/dist/mind/associative-recall.js +0 -287
- package/dist/mind/friends/resolver.js +0 -84
- package/dist/mind/friends/store-file.js +0 -190
- package/dist/mind/friends/trust-explanation.js +0 -74
- package/dist/mind/friends/types.js +0 -29
- package/dist/mind/journal-index.js +0 -161
- package/dist/mind/obligations.js +0 -134
- package/dist/repertoire/tasks/board.js +0 -134
- package/dist/repertoire/tasks/index.js +0 -224
- package/dist/repertoire/tasks/lifecycle.js +0 -80
- package/dist/repertoire/tasks/middleware.js +0 -65
- package/dist/repertoire/tasks/parser.js +0 -171
- package/dist/repertoire/tasks/scanner.js +0 -132
- package/dist/repertoire/tasks/transitions.js +0 -126
- package/dist/repertoire/tools-bluebubbles.js +0 -94
- package/dist/senses/bluebubbles-entry.js +0 -13
- package/dist/senses/bluebubbles-media.js +0 -339
- package/dist/senses/bluebubbles.js +0 -1268
- package/dist/senses/contextual-heartbeat.js +0 -106
- package/dist/senses/debug-activity.js +0 -154
- package/dist/senses/inner-dialog-worker.js +0 -154
- package/dist/senses/inner-dialog.js +0 -768
- package/subagents/README.md +0 -7
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/basilisk.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/jafar.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/jormungandr.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/kaa.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/medusa.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/monty.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/nagini.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/ouroboros.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/python.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/quetzalcoatl.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/sir-hiss.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/the-snake.md +0 -0
- /package/dist/{repertoire/tasks/types.js → heart/attachments/sources/adapter.js} +0 -0
- /package/dist/heart/{daemon → hatch}/hatch-animation.js +0 -0
- /package/dist/heart/{daemon → hatch}/specialist-orchestrator.js +0 -0
- /package/dist/heart/{daemon → versioning}/ouro-uti.js +0 -0
- /package/dist/heart/{daemon → versioning}/wrapper-publish-guard.js +0 -0
- /package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/store.js +0 -0
|
@@ -0,0 +1,1416 @@
|
|
|
1
|
+
// Ouro's one action model: declare an action once, generate every surface from it, and fail CI when a surface drifts.
|
|
2
|
+
//
|
|
3
|
+
// One declaration per action (id, typed input and output, consent class, the person's label and description, the
|
|
4
|
+
// agent's description) projects to: a defineCommand definition (CLI, --json, MCP, in web's AX kit), an MCP tool, a
|
|
5
|
+
// WebMCP tool, web's defineComponentAx and bindAx entries with each control's props, an App Intent, a SwiftUI
|
|
6
|
+
// Button(intent:) and a Reins action. A person-only action refuses on every agent door with one typed refusal.
|
|
7
|
+
// Design: docs/superpowers/specs/2026-11-13-one-action-model-design.md. Adopter guide: docs/guides/actions.md.
|
|
8
|
+
//
|
|
9
|
+
// This file imports only node: modules, so an app vendors it as it is (dist/actions/ouro-actions.mts in a core
|
|
10
|
+
// release, pinned by hash) and runs it with Node 22.18 or later:
|
|
11
|
+
// node ouro-actions.mts generate <actions.mts> <dir> write every projection into <dir>
|
|
12
|
+
// node ouro-actions.mts check <actions.mts> <dir> fail when <dir> differs from what generate writes
|
|
13
|
+
// node ouro-actions.mts compare-mcp <actions.mts> <tools.json> fail when a live MCP tools/list differs
|
|
14
|
+
import { readdir, readFile, mkdir, writeFile } from "node:fs/promises";
|
|
15
|
+
import { dirname, join, resolve } from "node:path";
|
|
16
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
17
|
+
|
|
18
|
+
/** The generator's version, written into every generated file; it is core's version. */
|
|
19
|
+
export const ACTIONS_VERSION = "1.12.0";
|
|
20
|
+
const GENERATOR = `ouro-actions ${ACTIONS_VERSION}`;
|
|
21
|
+
|
|
22
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
23
|
+
// The declaration
|
|
24
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* What an action needs before it runs:
|
|
28
|
+
* - `read`: changes nothing;
|
|
29
|
+
* - `write`: changes only the person's own space;
|
|
30
|
+
* - `consequential`: reaches other people or can't be taken back, so an agent prepares it and the person says yes;
|
|
31
|
+
* - `person-only`: the person must start it themselves, and every agent door refuses it.
|
|
32
|
+
*/
|
|
33
|
+
export const CONSENTS = Object.freeze(["read", "write", "consequential", "person-only"] as const);
|
|
34
|
+
export type Consent = (typeof CONSENTS)[number];
|
|
35
|
+
|
|
36
|
+
interface FieldBase {
|
|
37
|
+
/** The person's word for it: a form label, an App Intent parameter's title. */
|
|
38
|
+
label: string;
|
|
39
|
+
/** What it is, for an agent: the JSON Schema description, the CLI flag's help. */
|
|
40
|
+
description: string;
|
|
41
|
+
optional?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Input only: the question Siri asks the person when this required value is missing, such as "What should I add to
|
|
44
|
+
* your shopping list?" (the App Intent parameter's requestValueDialog).
|
|
45
|
+
*/
|
|
46
|
+
ask?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Input only: a field only programs send, such as an idempotency key or a server-side owner. MCP, WebMCP and the CLI
|
|
49
|
+
* carry it; the App Intent and Reins, which stand for the person, leave it out, and in the Swift input it is optional
|
|
50
|
+
* and nil. A required protocol-only field (an existing tool's required idempotency key) is one the app's handler
|
|
51
|
+
* supplies when the person's door leaves it nil.
|
|
52
|
+
*/
|
|
53
|
+
protocolOnly?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Output only: the App Intent hands this field to Shortcuts as its result (`ReturnsValue`). One per action, required,
|
|
56
|
+
* a string, number, integer or boolean.
|
|
57
|
+
*/
|
|
58
|
+
returned?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Input only, and optional: the CLI flag's name when the field's own kebab-case name is a flag web's kit already
|
|
61
|
+
* takes, such as `flag: "plan-only"` for an existing MCP input named `dryRun`. `fromCli` renames it back.
|
|
62
|
+
*/
|
|
63
|
+
flag?: string;
|
|
64
|
+
/** Input only, and optional: the value may also be null, which a program sends to clear it (JSON Schema's `null`). */
|
|
65
|
+
nullable?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Input only, and optional: the property name the field has on the JSON wire (MCP, WebMCP), when the existing tool's
|
|
68
|
+
* input is named differently from the declaration's camelCase name, such as `wire: "has_instructions"` for
|
|
69
|
+
* `hasInstructions`. Only the JSON property changes; the other projections keep the declaration's name.
|
|
70
|
+
*/
|
|
71
|
+
wire?: string;
|
|
72
|
+
}
|
|
73
|
+
/** A JSON Schema `format` a string can name; MCP and WebMCP carry it, and the CLI and Swift take the string as it is. */
|
|
74
|
+
export const STRING_FORMATS = Object.freeze(["date-time", "date", "uri", "email"] as const);
|
|
75
|
+
export interface StringField extends FieldBase {
|
|
76
|
+
kind: "string";
|
|
77
|
+
/**
|
|
78
|
+
* Input only: the field is a positional CLI word, not a flag. A required one comes first; an optional one may follow
|
|
79
|
+
* other optional ones, and no required one may follow it, since a positional can't be skipped. Not for a number,
|
|
80
|
+
* boolean, list, group or one-of.
|
|
81
|
+
*/
|
|
82
|
+
arg?: boolean;
|
|
83
|
+
/** The longest the string may be, in characters (JSON Schema's `maxLength`). */
|
|
84
|
+
maxLength?: number;
|
|
85
|
+
/** A regular expression the string must match (JSON Schema's `pattern`), written as the source text, unanchored. */
|
|
86
|
+
pattern?: string;
|
|
87
|
+
format?: (typeof STRING_FORMATS)[number];
|
|
88
|
+
/**
|
|
89
|
+
* Input only: the app's own App Entity type, such as `"MarkdownDocumentEntity"`. The App Intent's parameter takes it, so
|
|
90
|
+
* Shortcuts shows its picker; Input, MCP and the CLI keep a string, its `id`. The type must be `public`, with
|
|
91
|
+
* `init(id: String)` and `id: String`.
|
|
92
|
+
*/
|
|
93
|
+
entity?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Input only: the value is long text, such as Markdown or a message. The App Intent's parameter opens a multiline editor
|
|
96
|
+
* (`String.IntentInputOptions(multiline: true)`), and the description MCP, WebMCP and the CLI show says it may run over
|
|
97
|
+
* several lines. Not for a positional `arg`, an `entity` or a `protocolOnly` field.
|
|
98
|
+
*/
|
|
99
|
+
multiline?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Input only: this string is an id the person never reads, such as `rcp_lemon_orzo`, and `shownAs` names the optional
|
|
102
|
+
* sibling input string that carries their word for it, such as `recipeTitle`. A confirm sheet shows that name in its
|
|
103
|
+
* place, with the id beside it as `raw`. The agent prepares both; the app's own resolver (A2UI `label`) can override
|
|
104
|
+
* the name from its own data. MCP, the CLI and the App Intent just see two inputs, so a tool that doesn't want the
|
|
105
|
+
* name there uses the resolver alone.
|
|
106
|
+
*/
|
|
107
|
+
shownAs?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Input only, and optional: the value the field takes when the person or program leaves it out, typed as the field's
|
|
110
|
+
* value. It is written into the JSON Schema, the CLI's args or flags and the usage line; the handler applies it.
|
|
111
|
+
*/
|
|
112
|
+
default?: string;
|
|
113
|
+
}
|
|
114
|
+
export interface NumberField extends FieldBase {
|
|
115
|
+
kind: "number" | "integer";
|
|
116
|
+
min?: number;
|
|
117
|
+
max?: number;
|
|
118
|
+
/** Input only, and optional: the value left out takes; within `min` and `max`, and a whole number for an integer. */
|
|
119
|
+
default?: number;
|
|
120
|
+
}
|
|
121
|
+
export interface BooleanField extends FieldBase {
|
|
122
|
+
kind: "boolean";
|
|
123
|
+
/** The one value it takes: `const: true` is an explicit confirmation a program must send, such as `confirmNoCover`. */
|
|
124
|
+
const?: true;
|
|
125
|
+
/** Input only, and optional: the value left out takes, a boolean (true when `const` is true). */
|
|
126
|
+
default?: boolean;
|
|
127
|
+
}
|
|
128
|
+
/** An enum takes `arg` as a string does; its `values` ride along in the CLI's args and in the MCP and WebMCP schemas. */
|
|
129
|
+
export interface EnumField<V extends string = string> extends FieldBase {
|
|
130
|
+
kind: "enum";
|
|
131
|
+
values: readonly V[];
|
|
132
|
+
/** Input only: a positional CLI word, with the same placement rules as a string's `arg`. */
|
|
133
|
+
arg?: boolean;
|
|
134
|
+
/** Input only, and optional: the value left out takes, one of `values`. */
|
|
135
|
+
default?: V;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The structured fields, for an existing MCP tool's inputs that a person's door can't carry: a list of values, a group
|
|
139
|
+
* of named fields, or one of several shapes. They are protocol-only input fields: MCP and WebMCP carry their JSON
|
|
140
|
+
* Schema and the CLI takes them as JSON; the App Intent, Reins and the Swift input leave them out. A list without `of`, or a
|
|
141
|
+
* group without `fields`, is free-form: any JSON array, or any JSON object, for an existing MCP tool's input that takes one
|
|
142
|
+
* without a shape.
|
|
143
|
+
*/
|
|
144
|
+
export interface ListField extends FieldBase { kind: "list"; of?: Field; minItems?: number; maxItems?: number; default?: never }
|
|
145
|
+
export interface GroupField extends FieldBase { kind: "group"; fields?: Fields; default?: never }
|
|
146
|
+
/**
|
|
147
|
+
* `combinator` is JSON Schema's `oneOf` (the default: exactly one option matches) or `anyOf` (one or more match; the
|
|
148
|
+
* options take the field's description, and their own are left out).
|
|
149
|
+
*/
|
|
150
|
+
export interface OneOfField extends FieldBase { kind: "one-of"; options: readonly Field[]; combinator?: "oneOf" | "anyOf"; default?: never }
|
|
151
|
+
export type Field = StringField | NumberField | BooleanField | EnumField | ListField | GroupField | OneOfField;
|
|
152
|
+
export type Fields = Readonly<Record<string, Field>>;
|
|
153
|
+
|
|
154
|
+
type Opt = { optional?: boolean };
|
|
155
|
+
/**
|
|
156
|
+
* Field builders. `arg: true` makes a string or enum input field a positional CLI word instead of a flag: web's words are
|
|
157
|
+
* strings, and an enum's values are what the word may be. Required words come before optional ones.
|
|
158
|
+
*/
|
|
159
|
+
export const field = Object.freeze({
|
|
160
|
+
string: <O extends Omit<StringField, "kind">>(o: O) => ({ ...o, kind: "string" as const }),
|
|
161
|
+
number: <O extends Omit<NumberField, "kind">>(o: O) => ({ ...o, kind: "number" as const }),
|
|
162
|
+
integer: <O extends Omit<NumberField, "kind">>(o: O) => ({ ...o, kind: "integer" as const }),
|
|
163
|
+
boolean: <O extends Omit<BooleanField, "kind">>(o: O) => ({ ...o, kind: "boolean" as const }),
|
|
164
|
+
enum: <const V extends string, O extends Omit<EnumField<V>, "kind">>(o: O & { values: readonly V[] }) => ({ ...o, kind: "enum" as const }),
|
|
165
|
+
/** A list of values, each the field `of` describes (its label and description describe one item). */
|
|
166
|
+
list: <const O extends Omit<ListField, "kind">>(o: O) => ({ ...o, kind: "list" as const }),
|
|
167
|
+
/** A group of named fields: a JSON object, nothing extra. */
|
|
168
|
+
group: <const O extends Omit<GroupField, "kind">>(o: O) => ({ ...o, kind: "group" as const }),
|
|
169
|
+
/** Exactly one of several shapes, such as a number of days or the word "never" (JSON Schema's `oneOf`). */
|
|
170
|
+
oneOf: <const O extends Omit<OneOfField, "kind">>(o: O) => ({ ...o, kind: "one-of" as const }),
|
|
171
|
+
});
|
|
172
|
+
const KINDS = Object.freeze(["string", "number", "integer", "boolean", "enum", "list", "group", "one-of"]);
|
|
173
|
+
const STRUCTURED = Object.freeze(["list", "group", "one-of"]);
|
|
174
|
+
const isStructured = (f: Field) => STRUCTURED.includes(f.kind);
|
|
175
|
+
/** A positional CLI word: a string or enum input field declared `arg: true`. */
|
|
176
|
+
const isArg = (f: Field) => "arg" in f && Boolean(f.arg);
|
|
177
|
+
|
|
178
|
+
type Nullable<F, T> = F extends { nullable: true } ? T | null : T;
|
|
179
|
+
type ValueOf<F> = Nullable<F, F extends { kind: "string" } ? string
|
|
180
|
+
: F extends { kind: "number" | "integer" } ? number
|
|
181
|
+
: F extends { kind: "boolean" } ? boolean
|
|
182
|
+
: F extends { kind: "enum"; values: readonly (infer V)[] } ? V
|
|
183
|
+
: F extends { kind: "list"; of: infer I } ? ValueOf<I>[]
|
|
184
|
+
: F extends { kind: "list" } ? unknown[]
|
|
185
|
+
: F extends { kind: "group"; fields: infer G } ? ValuesOf<G>
|
|
186
|
+
: F extends { kind: "group" } ? Record<string, unknown>
|
|
187
|
+
: F extends { kind: "one-of"; options: readonly (infer U)[] } ? ValueOf<U>
|
|
188
|
+
: never>;
|
|
189
|
+
type OptionalKeys<F> = { [K in keyof F]: F[K] extends Opt & { optional: true } ? K : never }[keyof F];
|
|
190
|
+
type RequiredKeys<F> = Exclude<keyof F, OptionalKeys<F>>;
|
|
191
|
+
/** The value an action's fields describe, optional fields optional. */
|
|
192
|
+
export type ValuesOf<F> = { [K in RequiredKeys<F>]: ValueOf<F[K]> } & { [K in OptionalKeys<F>]?: ValueOf<F[K]> };
|
|
193
|
+
/** An action's input type: `InputOf<typeof addShoppingListItem>`. */
|
|
194
|
+
export type InputOf<A> = A extends Action<infer I, Fields> ? ValuesOf<I> : never;
|
|
195
|
+
/** An action's output type. */
|
|
196
|
+
export type OutputOf<A> = A extends Action<Fields, infer O> ? ValuesOf<O> : never;
|
|
197
|
+
|
|
198
|
+
/** One thing that can go wrong at an action, as the agent reads it: the Ouro AX census's `ErrorCard`. */
|
|
199
|
+
export interface ActionError {
|
|
200
|
+
/** Lowercase words joined by - or _, such as `not-found`; the code the outcome carries. */
|
|
201
|
+
code: string;
|
|
202
|
+
means: string;
|
|
203
|
+
fix: string;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** Why only the person does it, said to the agent, and how the person does it. One line each. */
|
|
207
|
+
export interface PersonOnly {
|
|
208
|
+
reason: string;
|
|
209
|
+
how: string;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface ActionDef<I extends Fields = Fields, O extends Fields = Fields> {
|
|
213
|
+
/** snake_case, such as `add_shopping_list_item`: the MCP and WebMCP tool name. Other names derive from it. */
|
|
214
|
+
id: string;
|
|
215
|
+
consent: Consent;
|
|
216
|
+
/** The person's button text, and the App Intent's title. */
|
|
217
|
+
label: string;
|
|
218
|
+
/** The person's one sentence: the control's hint, the component AX summary. */
|
|
219
|
+
description: string;
|
|
220
|
+
/** The agent's description: the MCP and WebMCP description, the CLI summary. One line. */
|
|
221
|
+
agent: string;
|
|
222
|
+
/**
|
|
223
|
+
* When an agent should pick this action over its neighbours, one line, such as "Pick this to add one thing the person
|
|
224
|
+
* asked for; to change an item already there, use update_shopping_list_item." Its Ouro AX card's `when`, which the
|
|
225
|
+
* in-turn tools projection (src/actions-tools.mts) requires on every action an agent may call. Besides actions.json,
|
|
226
|
+
* the declaration itself, no other projection reads it.
|
|
227
|
+
*/
|
|
228
|
+
when?: string;
|
|
229
|
+
/**
|
|
230
|
+
* What can go wrong when an agent calls it, as the agent reads it: each error's code (the outcome's code), what it
|
|
231
|
+
* means and how to fix the call, one line each. Its Ouro AX card's `errors`. Besides actions.json, no other
|
|
232
|
+
* projection reads it.
|
|
233
|
+
*/
|
|
234
|
+
errors?: readonly ActionError[];
|
|
235
|
+
/**
|
|
236
|
+
* Only for `consequential`: the one question the person is asked before it acts, word for word on every surface that
|
|
237
|
+
* asks (the confirm sheet, the A2UI and MCP Apps card, the App Intent's prompt). One line of at most 200 characters.
|
|
238
|
+
* Left out, it is the `description`.
|
|
239
|
+
*/
|
|
240
|
+
confirm?: string;
|
|
241
|
+
input: I;
|
|
242
|
+
output: O;
|
|
243
|
+
/** Exactly when `consent` is `person-only`. */
|
|
244
|
+
personOnly?: PersonOnly;
|
|
245
|
+
/** For a person-only action, whether other people see its effect; it decides web's effect class. Default "private". */
|
|
246
|
+
reaches?: "private" | "others";
|
|
247
|
+
/** The CLI words, such as `list add`; defaults to the id in kebab case. */
|
|
248
|
+
cli?: string;
|
|
249
|
+
/** The App Intent opens the app when it runs (`openAppWhenRun`), for an action whose point is to show a window. */
|
|
250
|
+
opensApp?: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* A write that removes or overwrites some of the person's own things, such as deleting a list item: MCP's
|
|
253
|
+
* `destructiveHint`, so a client may ask before it runs. A consequential action is destructive already.
|
|
254
|
+
*/
|
|
255
|
+
destructive?: true;
|
|
256
|
+
/** Calling it again with the same input changes nothing more: MCP's `idempotentHint`, so a client may retry it. */
|
|
257
|
+
idempotent?: true;
|
|
258
|
+
/**
|
|
259
|
+
* The input takes keys it doesn't name, and a schema with no required input has no `required` list: the input schema
|
|
260
|
+
* an MCP server already serves for a tool moved onto the model. Declare it only to keep an existing tool's input exactly;
|
|
261
|
+
* a new action keeps the closed schema, which rejects a key it doesn't name.
|
|
262
|
+
*/
|
|
263
|
+
openInput?: true;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export interface Action<I extends Fields = Fields, O extends Fields = Fields> extends Readonly<ActionDef<I, O>> {
|
|
267
|
+
readonly names: Names;
|
|
268
|
+
readonly cliWords: string;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export interface ActionSet {
|
|
272
|
+
/** The set's name, such as `shopping`; it names the generated files' contents. */
|
|
273
|
+
readonly name: string;
|
|
274
|
+
/** The CLI tool's name, which twins start with, such as `shop`. */
|
|
275
|
+
readonly tool: string;
|
|
276
|
+
readonly actions: readonly Action[];
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/** The longest `confirm`, so a phone's prompt, an App Intent's dialog and a card's sheet all show it whole. */
|
|
280
|
+
export const CONFIRM_MAX = 200;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* The words a person meets for one action, which every surface takes from here and never writes for itself: `label` is
|
|
284
|
+
* the name, `description` the person's sentence, `agent` the model's, and `confirm` the question before a consequential
|
|
285
|
+
* action acts (the declared `confirm`, else the `description`; absent for any other consent). Person-facing surfaces
|
|
286
|
+
* (the control, the confirm sheet, a card, the App Intent, a Windows App Action) show `label`, `description` and
|
|
287
|
+
* `confirm`; model-facing ones (MCP, WebMCP, the CLI summary, an AppFunction's instruction) read `agent`, and carry
|
|
288
|
+
* `confirm` too where the protocol has a place for it.
|
|
289
|
+
*/
|
|
290
|
+
export interface ActionText {
|
|
291
|
+
label: string;
|
|
292
|
+
description: string;
|
|
293
|
+
agent: string;
|
|
294
|
+
confirm?: string;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export function actionText(a: Pick<Action, "label" | "description" | "agent" | "consent" | "confirm">): ActionText {
|
|
298
|
+
return { label: a.label, description: a.description, agent: a.agent, ...(a.consent === "consequential" ? { confirm: a.confirm ?? a.description } : {}) };
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export interface Names {
|
|
302
|
+
kebab: string;
|
|
303
|
+
camel: string;
|
|
304
|
+
pascal: string;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const ID = /^[a-z][a-z0-9]*(_[a-z0-9]+)*$/;
|
|
308
|
+
const FIELD_NAME = /^[a-z][a-zA-Z0-9]*$/;
|
|
309
|
+
const WIRE_NAME = /^[a-zA-Z][a-zA-Z0-9_]*$/;
|
|
310
|
+
/**
|
|
311
|
+
* What an input field may not take: web's kit's own flags (`--json`, `--help`, `--why`, `--why-file`, `--dry-run`,
|
|
312
|
+
* `--agent`, `--quiet`), which the field's flag would shadow (a field keeps its name and takes another with `flag`), and
|
|
313
|
+
* the generated App Intent's own members (`input`, `perform`), which its `@Parameter` would clash with. Swift keywords
|
|
314
|
+
* are escaped, so they are allowed.
|
|
315
|
+
*/
|
|
316
|
+
const KIT_FLAGS = Object.freeze(["json", "help", "why", "why-file", "dry-run", "agent", "quiet"]);
|
|
317
|
+
const INTENT_MEMBERS = Object.freeze(["input", "perform"]);
|
|
318
|
+
/** An enum value: lowercase words and digits, joined by -, _, /, . or : (`shopping-list`, `image/jpeg`, `notes:safe`). */
|
|
319
|
+
const ENUM_VALUE = /^[a-z][a-z0-9]*([-_/.:][a-z0-9]+)*$/;
|
|
320
|
+
/**
|
|
321
|
+
* Ids web's `defineComponentAx` reserves for the person (its `RESERVED_PERSON_ONLY`), which only a person-only action may
|
|
322
|
+
* take. Web also reads an id's meaning (`share-screen`, `mic-on`); its defineComponentAx and X-ray still apply that.
|
|
323
|
+
*/
|
|
324
|
+
const WEB_RESERVED_IDS = Object.freeze(["unmute", "camera", "camera_on", "share", "answer", "decline", "admit", "record"]);
|
|
325
|
+
/** A camelCase field name as web's kebab-case flag: `canEdit` is `can-edit`. */
|
|
326
|
+
const flagName = (field: string) => field.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
|
327
|
+
const oneLine = (v: unknown): v is string => typeof v === "string" && v.trim() !== "" && !/[\r\n]/.test(v);
|
|
328
|
+
|
|
329
|
+
/** The names an id derives: `add_shopping_list_item` is `add-shopping-list-item`, `addShoppingListItem`, `AddShoppingListItem`. */
|
|
330
|
+
export function names(id: string): Names {
|
|
331
|
+
const parts = id.split("_");
|
|
332
|
+
const cap = (s: string) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
333
|
+
return { kebab: parts.join("-"), camel: parts[0] + parts.slice(1).map(cap).join(""), pascal: parts.map(cap).join("") };
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* A field's default: the value it takes when left out. Refused where "left out" has no value to stand for (an output,
|
|
338
|
+
* a required, structured, entity or protocol-only field) and where the value doesn't fit the field's type, values,
|
|
339
|
+
* range, length, pattern or const.
|
|
340
|
+
*/
|
|
341
|
+
function checkDefault(at: string, f: Field, input: boolean): void {
|
|
342
|
+
const v: unknown = f.default;
|
|
343
|
+
if (!input) throw new Error(`${at}: default is for an input field, and an output has no value to leave out. Fix: drop default.`);
|
|
344
|
+
if (isStructured(f)) throw new Error(`${at}: a ${f.kind} field takes no default, since its value is a whole list, object or shape. Fix: drop default.`);
|
|
345
|
+
if (f.protocolOnly) throw new Error(`${at}: a protocol-only field takes no default, since the person's doors don't carry it. Fix: drop default, or drop protocolOnly.`);
|
|
346
|
+
if ("entity" in f && f.entity !== undefined) throw new Error(`${at}: an entity takes no default, since the person picks it. Fix: drop default, or drop entity.`);
|
|
347
|
+
if (!f.optional) throw new Error(`${at}: a default on a required field, which every call sends. Fix: make it optional: true, or drop the default.`);
|
|
348
|
+
if (f.kind === "enum") {
|
|
349
|
+
if (!(f.values as readonly unknown[]).includes(v)) throw new Error(`${at}: default ${JSON.stringify(v)} is not one of its values. Fix: one of ${f.values.map((x) => JSON.stringify(x)).join(", ")}, or drop default.`);
|
|
350
|
+
} else if (f.kind === "string") {
|
|
351
|
+
if (typeof v !== "string") throw new Error(`${at}: default ${JSON.stringify(v)} is not a string. Fix: a string, or drop default.`);
|
|
352
|
+
if (f.maxLength !== undefined && [...v].length > f.maxLength) throw new Error(`${at}: default is ${[...v].length} characters, over maxLength ${f.maxLength}. Fix: a shorter default, or a larger maxLength.`);
|
|
353
|
+
if (f.pattern !== undefined && !new RegExp(f.pattern, "u").test(v)) throw new Error(`${at}: default ${JSON.stringify(v)} doesn't match pattern ${f.pattern}. Fix: a default that matches, or drop pattern.`);
|
|
354
|
+
} else if (f.kind === "boolean") {
|
|
355
|
+
if (typeof v !== "boolean") throw new Error(`${at}: default ${JSON.stringify(v)} is not a boolean. Fix: true or false, or drop default.`);
|
|
356
|
+
if (f.const !== undefined && v !== f.const) throw new Error(`${at}: default ${v} is not the one value const allows, true. Fix: default: true, or drop default.`);
|
|
357
|
+
} else if (f.kind === "number" || f.kind === "integer") {
|
|
358
|
+
const whole = f.kind === "integer";
|
|
359
|
+
if (typeof v !== "number" || !Number.isFinite(v) || (whole && !Number.isInteger(v))) throw new Error(`${at}: default ${JSON.stringify(v)} is not ${whole ? "a whole number" : "a number"}. Fix: ${whole ? "a whole number" : "a number"} within min and max, or drop default.`);
|
|
360
|
+
if (f.min !== undefined && v < f.min) throw new Error(`${at}: default ${v} is below min ${f.min}. Fix: a default of ${f.min} or more, or a lower min.`);
|
|
361
|
+
if (f.max !== undefined && v > f.max) throw new Error(`${at}: default ${v} is above max ${f.max}. Fix: a default of ${f.max} or less, or a higher max.`);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/** Checks one field, wherever it sits: `top` is an action's input or output field; otherwise it is inside a list, group or one-of. */
|
|
366
|
+
function checkField(at: string, f: Field, input: boolean, top: boolean): void {
|
|
367
|
+
if (!KINDS.includes(f?.kind)) throw new Error(`${at}: has no kind. Fix: build it with field.string, field.number, field.integer, field.boolean, field.enum, field.list, field.group or field.oneOf.`);
|
|
368
|
+
if (!oneLine(f.label)) throw new Error(`${at}: label is empty or more than one line. Fix: the person's word for it, such as "Quantity".`);
|
|
369
|
+
if (!oneLine(f.description)) throw new Error(`${at}: description is empty or more than one line. Fix: one sentence for the agent.`);
|
|
370
|
+
if (f.wire !== undefined && !WIRE_NAME.test(f.wire)) throw new Error(`${at}: wire is not a JSON property name. Fix: letters, digits and underscores, starting with a letter, such as "has_instructions".`);
|
|
371
|
+
if (!top) {
|
|
372
|
+
for (const key of ["ask", "protocolOnly", "returned", "flag", "arg", "entity", "multiline", "shownAs"] as const) {
|
|
373
|
+
if (key in f && (f as unknown as Record<string, unknown>)[key] !== undefined) throw new Error(`${at}: ${key} is for an action's own input or output field, not one inside a list, group or one-of. Fix: drop ${key}.`);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
if (f.ask !== undefined && (!input || !oneLine(f.ask))) throw new Error(`${at}: ask is the one-line question Siri asks for a missing input value. Fix: drop it from an output field, or write it in one line.`);
|
|
377
|
+
if (f.protocolOnly !== undefined && (f.protocolOnly !== true || !input || ("arg" in f && f.arg))) throw new Error(`${at}: protocolOnly is for an input field that only programs send, never a CLI argument. Fix: protocolOnly: true without arg, or drop protocolOnly.`);
|
|
378
|
+
if (top && input && isStructured(f) && !f.protocolOnly) throw new Error(`${at}: a ${f.kind} field is only for programs, since the App Intent and Reins can't take one. Fix: add protocolOnly: true, or split it into plain fields.`);
|
|
379
|
+
if (!input && isStructured(f)) throw new Error(`${at}: an output field can't be a ${f.kind}. Fix: return it as a string field holding JSON.`);
|
|
380
|
+
if (f.flag !== undefined && (!input || !/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(f.flag))) throw new Error(`${at}: flag is an input field's CLI flag name, in kebab case. Fix: such as flag: "plan-only".`);
|
|
381
|
+
if (f.nullable !== undefined && (f.nullable !== true || !input || (top && !f.optional) || f.kind === "enum" || f.kind === "list" || f.kind === "group")) {
|
|
382
|
+
throw new Error(`${at}: nullable is for an optional string, number, integer, boolean or one-of input field that a program clears with null. Fix: make it optional, or drop nullable.`);
|
|
383
|
+
}
|
|
384
|
+
if ("returned" in f && f.returned !== undefined) {
|
|
385
|
+
if (input) throw new Error(`${at}: returned is only for an output field. Fix: drop returned.`);
|
|
386
|
+
if (!["string", "number", "integer", "boolean"].includes(f.kind)) throw new Error(`${at}: returned must be a string, number, integer or boolean field, which Shortcuts can take. Fix: return a text field.`);
|
|
387
|
+
if (f.optional) throw new Error(`${at}: returned must be required, so the intent always has a value to hand on. Fix: drop optional.`);
|
|
388
|
+
}
|
|
389
|
+
if (!input && f.kind === "enum") throw new Error(`${at}: an output field can't be an enum, since the Swift output has no type for it. Fix: return it as a string field and name its values in the description.`);
|
|
390
|
+
if ("entity" in f && f.entity !== undefined) {
|
|
391
|
+
if (f.kind !== "string" || !input) throw new Error(`${at}: entity is only for an input string field, whose value is the entity's id. Fix: drop entity.`);
|
|
392
|
+
if (!/^[A-Z][A-Za-z0-9]*$/.test(f.entity)) throw new Error(`${at}: entity is not a Swift type name. Fix: the app's App Entity, such as "MarkdownDocumentEntity".`);
|
|
393
|
+
if (f.protocolOnly) throw new Error(`${at}: entity is for the person's doors, and a protocol-only field isn't on them. Fix: drop entity or protocolOnly.`);
|
|
394
|
+
}
|
|
395
|
+
if ("multiline" in f && f.multiline !== undefined) {
|
|
396
|
+
if (f.kind !== "string") throw new Error(`${at}: multiline is only for a string field. Fix: drop multiline.`);
|
|
397
|
+
if (!input) throw new Error(`${at}: multiline is only for an input field. Fix: drop multiline.`);
|
|
398
|
+
if (f.arg) throw new Error(`${at}: multiline can't be a positional arg, which is one word on the command line. Fix: drop arg or multiline.`);
|
|
399
|
+
if (f.entity !== undefined) throw new Error(`${at}: multiline is for typed text, and an entity is picked. Fix: drop entity or multiline.`);
|
|
400
|
+
if (f.protocolOnly) throw new Error(`${at}: multiline is for the person's doors, and a protocol-only field isn't on them. Fix: drop multiline or protocolOnly.`);
|
|
401
|
+
}
|
|
402
|
+
if (isArg(f) && (!input || (f.kind !== "string" && f.kind !== "enum"))) throw new Error(`${at}: arg is only for an input string or enum field, since a positional is one word on the command line. Fix: drop arg, or make it a string or enum.`);
|
|
403
|
+
if (isArg(f) && f.nullable) throw new Error(`${at}: a positional arg can't be nullable, since a word can't be null. Fix: drop nullable, or drop arg.`);
|
|
404
|
+
if (f.kind === "string") {
|
|
405
|
+
if (f.maxLength !== undefined && !(Number.isInteger(f.maxLength) && f.maxLength > 0)) throw new Error(`${at}: maxLength is ${JSON.stringify(f.maxLength)}. Fix: a whole number above 0.`);
|
|
406
|
+
if (f.pattern !== undefined) {
|
|
407
|
+
try {
|
|
408
|
+
new RegExp(f.pattern, "u");
|
|
409
|
+
} catch {
|
|
410
|
+
throw new Error(`${at}: pattern ${JSON.stringify(f.pattern)} is not a regular expression. Fix: write the expression's source, such as "^[a-z]+$".`);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if (f.format !== undefined && !(STRING_FORMATS as readonly string[]).includes(f.format)) throw new Error(`${at}: format is ${JSON.stringify(f.format)}. Fix: one of ${STRING_FORMATS.join(", ")}, or leave it out.`);
|
|
414
|
+
}
|
|
415
|
+
if (f.kind === "boolean" && f.const !== undefined && f.const !== true) throw new Error(`${at}: const is ${JSON.stringify(f.const)}. Fix: const: true, for a confirmation a program must send, or leave it out.`);
|
|
416
|
+
if (f.kind === "boolean" && f.const !== undefined && f.nullable) throw new Error(`${at}: a const field can't be nullable, since const: true takes only true. Fix: drop nullable.`);
|
|
417
|
+
if (f.kind === "enum") {
|
|
418
|
+
if (!Array.isArray(f.values) || f.values.length === 0 || !f.values.every((v) => ENUM_VALUE.test(v))) {
|
|
419
|
+
throw new Error(`${at}: values is empty or not lowercase words. Fix: values: ["all", "unchecked"]; words may be joined by -, _, /, . or :, as in "image/jpeg" or "notes:safe".`);
|
|
420
|
+
}
|
|
421
|
+
// Only an action's own enum fields become Swift enums, so only they must keep their cases apart.
|
|
422
|
+
const cases = new Map<string, string>();
|
|
423
|
+
for (const v of top ? f.values : []) {
|
|
424
|
+
const other = cases.get(caseName(v));
|
|
425
|
+
if (other !== undefined) throw new Error(`${at}: values "${other}" and "${v}" are the same Swift case, ${caseName(v)}. Fix: drop or rename one.`);
|
|
426
|
+
cases.set(caseName(v), v);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
if (f.default !== undefined) checkDefault(at, f, input);
|
|
430
|
+
if (f.kind === "list" && f.of !== undefined) {
|
|
431
|
+
if (f.of?.optional) throw new Error(`${at} item: an item can't be optional. Fix: drop optional from of.`);
|
|
432
|
+
if (f.of?.default !== undefined) throw new Error(`${at} item: an item takes no default, since each value is sent. Fix: drop default from of.`);
|
|
433
|
+
for (const bound of ["minItems", "maxItems"] as const) {
|
|
434
|
+
const v = f[bound];
|
|
435
|
+
if (v !== undefined && !(Number.isInteger(v) && v >= 0)) throw new Error(`${at}: ${bound} is ${JSON.stringify(v)}. Fix: a whole number of 0 or more.`);
|
|
436
|
+
}
|
|
437
|
+
if (f.minItems !== undefined && f.maxItems !== undefined && f.minItems > f.maxItems) throw new Error(`${at}: minItems ${f.minItems} is above maxItems ${f.maxItems}. Fix: make minItems no larger than maxItems.`);
|
|
438
|
+
checkField(`${at} item`, f.of, input, false);
|
|
439
|
+
}
|
|
440
|
+
if (f.kind === "group" && f.fields !== undefined) checkFields(`${at}`, f.fields, input, false);
|
|
441
|
+
if (f.kind === "one-of") {
|
|
442
|
+
if (f.combinator !== undefined && f.combinator !== "oneOf" && f.combinator !== "anyOf") throw new Error(`${at}: combinator is not "oneOf" or "anyOf". Fix: combinator: "anyOf" when a value may match more than one option, else leave it out.`);
|
|
443
|
+
if (!Array.isArray(f.options) || f.options.length < 2) throw new Error(`${at}: options needs two shapes or more. Fix: options: [field.integer({ ... }), field.enum({ ... })], or use the one field.`);
|
|
444
|
+
// JSON Schema's oneOf takes a value that matches exactly one option, so no two options may take the same value.
|
|
445
|
+
const shapes = new Map<string, number>();
|
|
446
|
+
f.options.forEach((o, i) => {
|
|
447
|
+
if (o?.optional) throw new Error(`${at} option ${i + 1}: an option can't be optional. Fix: drop optional from the option; make the one-of field optional instead.`);
|
|
448
|
+
if (o?.nullable) throw new Error(`${at} option ${i + 1}: an option can't be nullable. Fix: make the one-of field nullable instead.`);
|
|
449
|
+
if (o?.default !== undefined) throw new Error(`${at} option ${i + 1}: an option takes no default, since the value itself picks the option. Fix: drop default from the option.`);
|
|
450
|
+
checkField(`${at} option ${i + 1}`, o, input, false);
|
|
451
|
+
const shape = o?.kind === "enum" ? "string" : o?.kind === "integer" ? "number" : o?.kind;
|
|
452
|
+
const other = shapes.get(shape);
|
|
453
|
+
if (other !== undefined) throw new Error(`${at} options ${other + 1} and ${i + 1}: both can take the same ${shape} value, and a one-of takes a value that matches exactly one. Fix: keep one option per kind of value, counting an enum as a string and an integer as a number.`);
|
|
454
|
+
shapes.set(shape, i);
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function checkFields(where: string, fields: unknown, input: boolean, top = true): void {
|
|
460
|
+
if (typeof fields !== "object" || fields === null || Array.isArray(fields)) throw new Error(`${where}: is not an object of fields. Fix: { <name>: field.string({ ... }) }, or {}.`);
|
|
461
|
+
for (const [name, f] of Object.entries(fields as Record<string, Field>)) {
|
|
462
|
+
const at = `${where} "${name}"`;
|
|
463
|
+
if (!FIELD_NAME.test(name)) throw new Error(`${at}: a field name is camelCase letters and digits. Fix: rename it, such as "canEdit".`);
|
|
464
|
+
if (top && input && INTENT_MEMBERS.includes(name)) throw new Error(`${at}: the name is taken by the App Intent's own members (${INTENT_MEMBERS.join(", ")}). Fix: rename it, such as "${name}Value".`);
|
|
465
|
+
if (top && input && KIT_FLAGS.includes(f?.flag ?? flagName(name))) {
|
|
466
|
+
throw new Error(`${at}: its CLI flag --${f?.flag ?? flagName(name)} is taken by web's kit, whose own flags are (${KIT_FLAGS.map((k) => `--${k}`).join(", ")}). Fix: rename it, such as "${name}Value", or keep the name and give it its own flag, such as flag: "${flagName(name)}-value".`);
|
|
467
|
+
}
|
|
468
|
+
if (top && "shownAs" in f && f.shownAs !== undefined) {
|
|
469
|
+
const to = f.shownAs;
|
|
470
|
+
const sibling = (fields as Record<string, Field>)[to];
|
|
471
|
+
if (f.kind !== "string") throw new Error(`${at}: shownAs is only for a string field, the id. Fix: drop shownAs.`);
|
|
472
|
+
if (!input) throw new Error(`${at}: shownAs is only for an input field. Fix: drop shownAs.`);
|
|
473
|
+
if (to === name) throw new Error(`${at}: shownAs names the field itself. Fix: name the sibling that holds the person's word for it, such as "recipeTitle".`);
|
|
474
|
+
if (typeof to !== "string" || !sibling) throw new Error(`${at}: shownAs ${JSON.stringify(to)} is not another input field. Fix: declare it beside this one, such as recipeTitle: field.string({ ..., optional: true }).`);
|
|
475
|
+
if (sibling.kind !== "string" || !sibling.optional) throw new Error(`${at}: shownAs ${JSON.stringify(to)} must be an optional string input, so a call without a name still works. Fix: make "${to}" an optional string.`);
|
|
476
|
+
if (sibling.protocolOnly) throw new Error(`${at}: shownAs ${JSON.stringify(to)} is protocolOnly, so the person's doors don't carry it. Fix: drop protocolOnly from "${to}".`);
|
|
477
|
+
if ("shownAs" in sibling && sibling.shownAs !== undefined) throw new Error(`${at}: shownAs ${JSON.stringify(to)} is itself shown as another field, and a name has no name. Fix: drop shownAs from "${to}".`);
|
|
478
|
+
}
|
|
479
|
+
checkField(at, f, input, top);
|
|
480
|
+
}
|
|
481
|
+
const wires = new Map<string, string>();
|
|
482
|
+
for (const [name, f] of Object.entries(fields as Record<string, Field>)) {
|
|
483
|
+
const wire = f.wire ?? name;
|
|
484
|
+
if (wires.has(wire)) throw new Error(`${where}: "${wires.get(wire)}" and "${name}" are both named "${wire}" on the wire. Fix: give one a different wire name.`);
|
|
485
|
+
wires.set(wire, name);
|
|
486
|
+
}
|
|
487
|
+
if (top && !input) {
|
|
488
|
+
const returned = Object.entries(fields as Record<string, Field>).filter(([, f]) => f.returned);
|
|
489
|
+
if (returned.length > 1) throw new Error(`${where}: ${returned.map(([n]) => `"${n}"`).join(" and ")} are both returned, and only one output field can be returned. Fix: keep returned on the one Shortcuts should get.`);
|
|
490
|
+
}
|
|
491
|
+
if (top && input) {
|
|
492
|
+
const flags = new Map<string, string>();
|
|
493
|
+
let optionalArg: string | undefined;
|
|
494
|
+
for (const [name, f] of Object.entries(fields as Record<string, Field>)) {
|
|
495
|
+
if (isArg(f)) {
|
|
496
|
+
if (!f.optional) {
|
|
497
|
+
if (optionalArg !== undefined) throw new Error(`${where} "${name}": a required arg comes after the optional arg "${optionalArg}"; a positional can't be skipped. Fix: make "${name}" optional, or put it before "${optionalArg}".`);
|
|
498
|
+
} else {
|
|
499
|
+
optionalArg ??= name;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
const flag = f.flag ?? flagName(name);
|
|
503
|
+
const other = flags.get(flag);
|
|
504
|
+
if (other !== undefined) throw new Error(`${where}: "${other}" and "${name}" share the CLI flag --${flag}. Fix: give one its own flag.`);
|
|
505
|
+
flags.set(flag, name);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
const ERROR_CODE = /^[a-z][a-z0-9]*([-_][a-z0-9]+)*$/;
|
|
511
|
+
|
|
512
|
+
/** An action's errors: a list of unique codes, each with one-line means and fix; `person-only` is the refusal's own. */
|
|
513
|
+
function checkErrors(at: string, errors: unknown): void {
|
|
514
|
+
if (errors === undefined) return;
|
|
515
|
+
if (!Array.isArray(errors)) throw new Error(`${at}: errors is not a list. Fix: errors: [{ code, means, fix }].`);
|
|
516
|
+
const seen = new Set<string>();
|
|
517
|
+
for (const e of errors as Record<string, unknown>[]) {
|
|
518
|
+
const code = e?.["code"];
|
|
519
|
+
if (typeof code !== "string" || !ERROR_CODE.test(code)) throw new Error(`${at}: error code ${JSON.stringify(code)} is not lowercase words joined by - or _. Fix: such as "not-found".`);
|
|
520
|
+
if (code === "person-only") throw new Error(`${at}: error code "person-only" is the person-only refusal's own, which core writes. Fix: another code, or consent "person-only".`);
|
|
521
|
+
if (seen.has(code)) throw new Error(`${at}: error code "${code}" is listed twice. Fix: list each code once.`);
|
|
522
|
+
seen.add(code);
|
|
523
|
+
for (const key of ["means", "fix"]) if (!oneLine(e[key])) throw new Error(`${at}: error "${code}": ${key} is empty or more than one line. Fix: write it in one line.`);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/** Declares one action and checks it; a problem throws one line with its fix. */
|
|
528
|
+
export function defineAction<const I extends Fields, const O extends Fields>(def: ActionDef<I, O>): Action<I, O> {
|
|
529
|
+
const id = typeof def.id === "string" ? def.id : String(def.id);
|
|
530
|
+
if (!ID.test(id)) throw new Error(`action ${JSON.stringify(id)}: the id is not snake_case. Fix: lowercase words joined by _, such as "add_shopping_list_item".`);
|
|
531
|
+
const at = `action "${id}"`;
|
|
532
|
+
if (!(CONSENTS as readonly string[]).includes(def.consent)) throw new Error(`${at}: consent is ${JSON.stringify(def.consent)}. Fix: one of ${CONSENTS.join(", ")}.`);
|
|
533
|
+
for (const key of ["label", "description", "agent"] as const) {
|
|
534
|
+
if (!oneLine(def[key])) throw new Error(`${at}: ${key} is empty or more than one line. Fix: write it in one line.`);
|
|
535
|
+
}
|
|
536
|
+
if (def.confirm !== undefined) {
|
|
537
|
+
if (def.consent !== "consequential") throw new Error(`${at}: confirm is only for consent "consequential", the one that asks. Fix: drop confirm, or make the consent "consequential".`);
|
|
538
|
+
if (!oneLine(def.confirm) || def.confirm.length > CONFIRM_MAX) throw new Error(`${at}: confirm is empty, more than one line or over ${CONFIRM_MAX} characters. Fix: ask the person in one short line.`);
|
|
539
|
+
}
|
|
540
|
+
if (def.consent === "person-only") {
|
|
541
|
+
if (!def.personOnly || !oneLine(def.personOnly.reason) || !oneLine(def.personOnly.how)) {
|
|
542
|
+
throw new Error(`${at}: a person-only action needs personOnly, its reason and how, one line each. Fix: personOnly: { reason: "You can't <do it> for the person; only they can.", how: "<where the person does it>" }.`);
|
|
543
|
+
}
|
|
544
|
+
} else {
|
|
545
|
+
if (def.personOnly !== undefined) throw new Error(`${at}: personOnly is only for consent "person-only". Fix: drop personOnly, or make the consent "person-only".`);
|
|
546
|
+
if (def.reaches !== undefined) throw new Error(`${at}: reaches is only for consent "person-only"; the consent class decides who sees the others. Fix: drop reaches.`);
|
|
547
|
+
}
|
|
548
|
+
if (def.consent !== "person-only" && WEB_RESERVED_IDS.includes(id)) throw new Error(`${at}: web reserves "${names(id).kebab}" for the person, so only a person-only action may use it. Fix: consent "person-only" with personOnly, or another id.`);
|
|
549
|
+
if (def.reaches !== undefined && def.reaches !== "private" && def.reaches !== "others") throw new Error(`${at}: reaches is ${JSON.stringify(def.reaches)}. Fix: "private" or "others".`);
|
|
550
|
+
if (def.cli !== undefined && !/^[a-z][a-z0-9-]*( [a-z][a-z0-9-]*)*$/.test(def.cli)) throw new Error(`${at}: cli is not lowercase words. Fix: such as "list add".`);
|
|
551
|
+
if (def.opensApp !== undefined && typeof def.opensApp !== "boolean") throw new Error(`${at}: opensApp is ${JSON.stringify(def.opensApp)}. Fix: true or false.`);
|
|
552
|
+
if (def.destructive !== undefined && (def.destructive !== true || def.consent !== "write")) {
|
|
553
|
+
throw new Error(`${at}: destructive is for a write that removes or overwrites the person's own things; a consequential action is destructive already, a read changes nothing and no agent door offers a person-only one. Fix: destructive: true on a write, or drop it.`);
|
|
554
|
+
}
|
|
555
|
+
if (def.idempotent !== undefined && (def.idempotent !== true || (def.consent !== "write" && def.consent !== "consequential"))) {
|
|
556
|
+
throw new Error(`${at}: idempotent is for a write or consequential action that changes nothing more when called again with the same input; a read is idempotent already. Fix: idempotent: true, or drop it.`);
|
|
557
|
+
}
|
|
558
|
+
if (def.when !== undefined && !oneLine(def.when)) throw new Error(`${at}: when is empty or more than one line. Fix: say in one line when an agent should pick it over its neighbours.`);
|
|
559
|
+
checkErrors(at, def.errors);
|
|
560
|
+
if (def.openInput !== undefined && def.openInput !== true) throw new Error(`${at}: openInput is ${JSON.stringify(def.openInput)}. Fix: true, or drop it.`);
|
|
561
|
+
checkFields(`${at} input`, def.input, true);
|
|
562
|
+
checkFields(`${at} output`, def.output, false);
|
|
563
|
+
const n = names(id);
|
|
564
|
+
return Object.freeze({ ...def, id, names: n, cliWords: def.cli ?? n.kebab });
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/** The set an app generates from. Ids, CLI words and derived names must be unique, so no two surfaces collide. */
|
|
568
|
+
export function defineActions(name: string, actions: readonly Action[], options: { tool?: string } = {}): ActionSet {
|
|
569
|
+
if (!/^[a-z][a-z0-9-]*$/.test(name)) throw new Error(`action set ${JSON.stringify(name)}: the set name is lowercase words joined by -. Fix: such as "shopping".`);
|
|
570
|
+
const tool = options.tool ?? name;
|
|
571
|
+
if (!/^[a-z][a-z0-9-]*$/.test(tool)) throw new Error(`action set "${name}": tool is ${JSON.stringify(tool)}. Fix: the CLI's name, such as "shop".`);
|
|
572
|
+
const seen = new Map<string, string>();
|
|
573
|
+
for (const a of actions) {
|
|
574
|
+
const keys: [string, string][] = [["id", a.id], ["kebab name", a.names.kebab], ["camel name", a.names.camel], ["Swift name", a.names.pascal], ["CLI words", a.cliWords]];
|
|
575
|
+
for (const [field, f] of [...Object.entries(a.input), ...Object.entries(a.output)]) if (f.kind === "enum") keys.push(["Swift enum type", enumType(a, field)]);
|
|
576
|
+
for (const [what, value] of keys) {
|
|
577
|
+
const key = `${what}=${value}`;
|
|
578
|
+
const other = seen.get(key);
|
|
579
|
+
if (other === a.id) throw new Error(`action set "${name}": action "${a.id}" is used twice. Fix: list each action once.`);
|
|
580
|
+
if (other !== undefined) throw new Error(`action set "${name}": actions "${other}" and "${a.id}" share the ${what} "${value}". Fix: rename one, or give it its own cli words.`);
|
|
581
|
+
}
|
|
582
|
+
for (const [what, value] of keys) seen.set(`${what}=${value}`, a.id);
|
|
583
|
+
}
|
|
584
|
+
return Object.freeze({ name, tool, actions: Object.freeze([...actions]) });
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
588
|
+
// Consent onto each surface, and the typed refusal
|
|
589
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
590
|
+
|
|
591
|
+
/** Web's effect class: consequential reaches others; read and write are the person's own. */
|
|
592
|
+
export function effectOf(a: Action): "private" | "others" {
|
|
593
|
+
if (a.consent === "consequential") return "others";
|
|
594
|
+
if (a.consent === "person-only") return a.reaches ?? "private";
|
|
595
|
+
return "private";
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
export interface McpAnnotations {
|
|
599
|
+
readOnlyHint: boolean;
|
|
600
|
+
destructiveHint: boolean;
|
|
601
|
+
openWorldHint: boolean;
|
|
602
|
+
idempotentHint?: true;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* MCP tool annotations: web's `effectAnnotations(effect, readOnly)`, with `destructiveHint` also on a write declared
|
|
607
|
+
* `destructive`, and `idempotentHint` on an action declared `idempotent` (MCP's default for it is false).
|
|
608
|
+
*/
|
|
609
|
+
export function annotationsOf(a: Action): McpAnnotations {
|
|
610
|
+
const others = effectOf(a) === "others";
|
|
611
|
+
const out: McpAnnotations = { readOnlyHint: a.consent === "read", destructiveHint: others || a.destructive === true, openWorldHint: others };
|
|
612
|
+
if (a.idempotent) out.idempotentHint = true;
|
|
613
|
+
return out;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
export interface Refusal {
|
|
617
|
+
ax: "outcome/1";
|
|
618
|
+
action: string;
|
|
619
|
+
effect: "private";
|
|
620
|
+
audience: { only: true; who: "only you" };
|
|
621
|
+
target: null;
|
|
622
|
+
state: "refused";
|
|
623
|
+
summary: string;
|
|
624
|
+
postcondition: { checked: false; holds: null; how: "not checked" };
|
|
625
|
+
receipt: null;
|
|
626
|
+
next: [];
|
|
627
|
+
error: { code: "person-only"; exit: 2; thing: string; problem: string; fix: null; message: string };
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
const sentence = (text: string) => text.trim().replace(/[.\s]+$/, "");
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* The answer every agent door gives a person-only action, in the shape web's CLI answers a person-only word under
|
|
634
|
+
* `--json` (cli.ts: `outcome({ action, state: "refused", summary, error })` over `personOnlyError`): a refused outcome
|
|
635
|
+
* whose error has code `person-only`, exit 2 (web's `usage`), the reason and how the person does it. `action` and
|
|
636
|
+
* `error.thing` keep the command words, which identify it; the summary and message name it by its label, the words
|
|
637
|
+
* on the person's button, because an agent relays them to a person, and on an App Action, MCP or A2UI door the
|
|
638
|
+
* command words mean nothing to them.
|
|
639
|
+
*/
|
|
640
|
+
export function refusal(a: Action): Refusal {
|
|
641
|
+
if (a.consent !== "person-only" || !a.personOnly) throw new Error(`action "${a.id}" is not person-only, so nothing refuses it. Fix: refuse only person-only actions.`);
|
|
642
|
+
const thing = a.cliWords;
|
|
643
|
+
const problem = `${sentence(a.personOnly.reason)}. Ask the person, who does it ${sentence(a.personOnly.how)}`;
|
|
644
|
+
const message = `${a.label}: ${sentence(problem)}.`;
|
|
645
|
+
return {
|
|
646
|
+
ax: "outcome/1",
|
|
647
|
+
action: thing,
|
|
648
|
+
effect: "private",
|
|
649
|
+
audience: { only: true, who: "only you" },
|
|
650
|
+
target: null,
|
|
651
|
+
state: "refused",
|
|
652
|
+
summary: message,
|
|
653
|
+
postcondition: { checked: false, holds: null, how: "not checked" },
|
|
654
|
+
receipt: null,
|
|
655
|
+
next: [],
|
|
656
|
+
error: { code: "person-only", exit: 2, thing, problem, fix: null, message },
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
661
|
+
// JSON projections
|
|
662
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
663
|
+
|
|
664
|
+
type Json = null | boolean | number | string | Json[] | { [k: string]: Json };
|
|
665
|
+
|
|
666
|
+
/** The field's description as an agent reads it: long text says it may run over several lines. */
|
|
667
|
+
const describe = (f: Field) => (f.kind === "string" && f.multiline ? `${f.description} It may run over several lines.` : f.description);
|
|
668
|
+
|
|
669
|
+
function fieldSchema(f: Field): Record<string, Json> {
|
|
670
|
+
if (f.kind === "one-of") {
|
|
671
|
+
const anyOf = f.combinator === "anyOf";
|
|
672
|
+
const options: Json[] = f.options.map((o) => (anyOf ? withoutDescriptions(fieldSchema(o)) : fieldSchema(o)));
|
|
673
|
+
if (f.nullable) options.push({ type: "null" });
|
|
674
|
+
return anyOf ? { anyOf: options, description: describe(f) } : { oneOf: options, description: describe(f) };
|
|
675
|
+
}
|
|
676
|
+
const type = f.kind === "enum" ? "string" : f.kind === "list" ? "array" : f.kind === "group" ? "object" : f.kind;
|
|
677
|
+
const s: Record<string, Json> = { type: f.nullable ? [type, "null"] : type, description: describe(f) };
|
|
678
|
+
if (f.kind === "enum") s["enum"] = [...f.values];
|
|
679
|
+
if ((f.kind === "number" || f.kind === "integer") && f.min !== undefined) s["minimum"] = f.min;
|
|
680
|
+
if ((f.kind === "number" || f.kind === "integer") && f.max !== undefined) s["maximum"] = f.max;
|
|
681
|
+
if (f.kind === "string" && f.maxLength !== undefined) s["maxLength"] = f.maxLength;
|
|
682
|
+
if (f.kind === "string" && f.pattern !== undefined) s["pattern"] = f.pattern;
|
|
683
|
+
if (f.kind === "string" && f.format !== undefined) s["format"] = f.format;
|
|
684
|
+
if (f.kind === "boolean" && f.const !== undefined) s["const"] = f.const;
|
|
685
|
+
if (f.default !== undefined) s["default"] = f.default;
|
|
686
|
+
if (f.kind === "list" && f.of !== undefined) s["items"] = fieldSchema(f.of);
|
|
687
|
+
if (f.kind === "list" && f.minItems !== undefined) s["minItems"] = f.minItems;
|
|
688
|
+
if (f.kind === "list" && f.maxItems !== undefined) s["maxItems"] = f.maxItems;
|
|
689
|
+
if (f.kind === "group" && f.fields !== undefined) Object.assign(s, objectSchema(f.fields));
|
|
690
|
+
return s;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
/** The JSON property a field has on the wire: its `wire` name, or its declaration name. */
|
|
694
|
+
const wireOf = (name: string, f: Field) => f.wire ?? name;
|
|
695
|
+
|
|
696
|
+
/** An anyOf option takes the one-of field's description, so its own (and its items') descriptions are left out. */
|
|
697
|
+
function withoutDescriptions(s: Json): Json {
|
|
698
|
+
if (Array.isArray(s)) return s.map(withoutDescriptions);
|
|
699
|
+
if (s === null || typeof s !== "object") return s;
|
|
700
|
+
return Object.fromEntries(Object.entries(s).filter(([k, v]) => k !== "description" || typeof v !== "string").map(([k, v]) => [k, withoutDescriptions(v)]));
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/** An open object leaves out `additionalProperties` and an empty `required`, as an MCP server already serves them. */
|
|
704
|
+
function objectSchema(fields: Fields, open = false): { type: "object"; properties: Record<string, Json>; required?: string[]; additionalProperties?: false } {
|
|
705
|
+
const entries = Object.entries(fields);
|
|
706
|
+
const required = entries.filter(([, f]) => !f.optional).map(([k, f]) => wireOf(k, f));
|
|
707
|
+
return {
|
|
708
|
+
type: "object",
|
|
709
|
+
properties: Object.fromEntries(entries.map(([k, f]) => [wireOf(k, f), fieldSchema(f)])),
|
|
710
|
+
...(open && required.length === 0 ? {} : { required }),
|
|
711
|
+
...(open ? {} : { additionalProperties: false }),
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/** The input's JSON Schema, shared by MCP, WebMCP and the CLI's `help --json`. */
|
|
716
|
+
export const inputSchema = (a: Action) => objectSchema(a.input, a.openInput === true);
|
|
717
|
+
|
|
718
|
+
/** The output's JSON Schema. */
|
|
719
|
+
export const outputSchema = (a: Action) => objectSchema(a.output);
|
|
720
|
+
|
|
721
|
+
export interface CommandJson {
|
|
722
|
+
name: string;
|
|
723
|
+
summary: string;
|
|
724
|
+
effect: "private" | "others";
|
|
725
|
+
readOnly?: true;
|
|
726
|
+
/**
|
|
727
|
+
* Positional words, in order: a required one has `required: true`; an optional one omits it. An enum's values ride along,
|
|
728
|
+
* and a default is typed JSON, as the field's type says.
|
|
729
|
+
*/
|
|
730
|
+
args?: { name: string; description: string; required?: true; values?: string[]; default?: string | number | boolean }[];
|
|
731
|
+
flags?: Record<string, Record<string, Json>>;
|
|
732
|
+
output?: string;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
function flagSpec(f: Field): Record<string, Json> {
|
|
736
|
+
// A structured field comes in as one JSON string, which fromCli parses.
|
|
737
|
+
if (isStructured(f)) return { type: "string", description: `${sentence(describe(f))}, as JSON.`, ...(f.optional ? {} : { required: true }) };
|
|
738
|
+
const s: Record<string, Json> = { type: f.kind === "integer" ? "number" : f.kind, description: describe(f) };
|
|
739
|
+
if (f.kind === "enum") s["values"] = [...f.values];
|
|
740
|
+
if (f.kind === "number" || f.kind === "integer") {
|
|
741
|
+
if (f.min !== undefined) s["min"] = f.min;
|
|
742
|
+
if (f.max !== undefined) s["max"] = f.max;
|
|
743
|
+
}
|
|
744
|
+
if (f.default !== undefined) s["default"] = f.default;
|
|
745
|
+
if (!f.optional) s["required"] = true;
|
|
746
|
+
return s;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/** The action as web's `defineCommand` definition, without `run`. A person-only action has none; it is a refusing word. */
|
|
750
|
+
export function toCommand(a: Action): CommandJson {
|
|
751
|
+
if (a.consent === "person-only") throw new Error(`action "${a.id}" is person-only: it is a word the CLI refuses, not a command. Fix: use the commands file's personOnly.`);
|
|
752
|
+
const cmd: CommandJson = { name: a.cliWords, summary: a.agent, effect: effectOf(a) };
|
|
753
|
+
if (a.consent === "read") cmd.readOnly = true;
|
|
754
|
+
const fields = Object.entries(a.input);
|
|
755
|
+
const args = fields.filter(([, f]) => isArg(f)).map(([name, f]) => ({
|
|
756
|
+
name,
|
|
757
|
+
description: f.description,
|
|
758
|
+
...(f.optional ? {} : { required: true as const }),
|
|
759
|
+
...(f.kind === "enum" ? { values: [...f.values] } : {}),
|
|
760
|
+
...(f.default !== undefined ? { default: f.default } : {}),
|
|
761
|
+
}));
|
|
762
|
+
const flags = Object.fromEntries(fields.filter(([, f]) => !isArg(f)).map(([name, f]) => [f.flag ?? flagName(name), flagSpec(f)]));
|
|
763
|
+
if (args.length) cmd.args = args;
|
|
764
|
+
if (Object.keys(flags).length) cmd.flags = flags;
|
|
765
|
+
const out = Object.keys(a.output);
|
|
766
|
+
if (out.length) cmd.output = `{ ${out.join(", ")} }`;
|
|
767
|
+
return cmd;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
export interface McpTool {
|
|
771
|
+
name: string;
|
|
772
|
+
title: string;
|
|
773
|
+
description: string;
|
|
774
|
+
inputSchema: ReturnType<typeof objectSchema>;
|
|
775
|
+
outputSchema?: ReturnType<typeof objectSchema>;
|
|
776
|
+
annotations: McpAnnotations;
|
|
777
|
+
/** A consequential action's confirm question, under `CONFIRM_META`; MCP has no field of its own for it. */
|
|
778
|
+
_meta?: Record<string, string>;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
/** The key under which an MCP tool's `_meta` carries the question the person is asked before it acts. */
|
|
782
|
+
export const CONFIRM_META = "ouro.bot/confirm";
|
|
783
|
+
|
|
784
|
+
/** The MCP tool. */
|
|
785
|
+
export function toMcpTool(a: Action): McpTool {
|
|
786
|
+
const tool: McpTool = { name: a.id, title: a.label, description: a.agent, inputSchema: inputSchema(a), annotations: annotationsOf(a) };
|
|
787
|
+
const confirm = actionText(a).confirm;
|
|
788
|
+
if (confirm !== undefined) tool._meta = { [CONFIRM_META]: confirm };
|
|
789
|
+
if (Object.keys(a.output).length) tool.outputSchema = outputSchema(a);
|
|
790
|
+
return tool;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
/** The WebMCP tool descriptor, for `registerTool`, with the hints WebMCP defines. */
|
|
794
|
+
export function toWebMcpTool(a: Action) {
|
|
795
|
+
const confirm = actionText(a).confirm;
|
|
796
|
+
return { name: a.id, title: a.label, description: a.agent, inputSchema: inputSchema(a), annotations: { readOnlyHint: a.consent === "read", consequentialHint: a.consent === "consequential" }, ...(confirm === undefined ? {} : { _meta: { [CONFIRM_META]: confirm } }) };
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
const header = (set: ActionSet) => ({ generator: GENERATOR, set: set.name });
|
|
800
|
+
const json = (v: unknown) => `${JSON.stringify(v, null, 2)}\n`;
|
|
801
|
+
const agentDoors = (set: ActionSet) => set.actions.filter((a) => a.consent !== "person-only");
|
|
802
|
+
const refusals = (set: ActionSet) => Object.fromEntries(set.actions.filter((a) => a.consent === "person-only").map((a) => [a.id, refusal(a)]));
|
|
803
|
+
const lit = (s: string) => JSON.stringify(s);
|
|
804
|
+
|
|
805
|
+
function twinOf(set: ActionSet, a: Action): string {
|
|
806
|
+
// A word the person may leave out is bracketed, as web's usage line shows it: `[<name>]`, or `[<name>=<default>]` when
|
|
807
|
+
// it has a default.
|
|
808
|
+
const args = Object.entries(a.input).filter(([, f]) => isArg(f)).map(([name, f]) => (f.optional ? `[<${name}>${f.default === undefined ? "" : `=${f.default}`}]` : `<${name}>`));
|
|
809
|
+
return [set.tool, a.cliWords, ...args].join(" ");
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
function renderWeb(set: ActionSet): string {
|
|
813
|
+
const comment = `// Generated by ${GENERATOR} from the "${set.name}" action set. Don't edit; run generate.`;
|
|
814
|
+
const ax = set.actions.map((a) => {
|
|
815
|
+
const side = a.consent === "person-only" ? `personOnly: ${lit(a.personOnly!.reason)}` : "agent: true";
|
|
816
|
+
return ` { id: ${lit(a.names.kebab)}, summary: ${lit(a.description)}, effect: ${lit(effectOf(a))}, ${side} },`;
|
|
817
|
+
});
|
|
818
|
+
const twins = agentDoors(set).map((a) => ` ${lit(a.names.kebab)}: ${lit(twinOf(set, a))},`);
|
|
819
|
+
const refuse = set.actions.filter((a) => a.consent === "person-only").map((a) => ` ${lit(a.names.kebab)}: ${lit(`${set.tool} ${a.cliWords}`)},`);
|
|
820
|
+
const cliInput = agentDoors(set).flatMap((a) => {
|
|
821
|
+
const renames = Object.entries(a.input).filter(([n, f]) => (f.flag ?? flagName(n)) !== n).map(([n, f]) => `${lit(f.flag ?? flagName(n))}: ${lit(n)}`);
|
|
822
|
+
return renames.length ? [` ${lit(a.names.kebab)}: { ${renames.join(", ")} },`] : [];
|
|
823
|
+
});
|
|
824
|
+
const cliJson = agentDoors(set).flatMap((a) => {
|
|
825
|
+
const structured = Object.entries(a.input).filter(([, f]) => isStructured(f)).map(([n]) => lit(n));
|
|
826
|
+
return structured.length ? [` ${lit(a.names.kebab)}: [${structured.join(", ")}],`] : [];
|
|
827
|
+
});
|
|
828
|
+
const controls = set.actions.map((a) =>
|
|
829
|
+
` ${lit(a.names.kebab)}: { label: ${lit(a.label)}, description: ${lit(a.description)}, consent: ${lit(a.consent)},${actionText(a).confirm === undefined ? "" : ` confirm: ${lit(actionText(a).confirm!)},`} props: { "data-ax-action": ${lit(a.names.kebab)} } },`,
|
|
830
|
+
);
|
|
831
|
+
return [
|
|
832
|
+
comment,
|
|
833
|
+
"//",
|
|
834
|
+
"// componentAx goes into web's defineComponentAx as a component's actions; twins goes into bindAx; spread a",
|
|
835
|
+
"// control's props on the control that takes the action, so web's expectAxRendered finds it.",
|
|
836
|
+
`export const generated = ${JSON.stringify(header(set))} as const;`,
|
|
837
|
+
"",
|
|
838
|
+
"export const componentAx = {",
|
|
839
|
+
" actions: [",
|
|
840
|
+
...ax,
|
|
841
|
+
" ],",
|
|
842
|
+
"} as const;",
|
|
843
|
+
"",
|
|
844
|
+
"export const twins = {",
|
|
845
|
+
" actions: {",
|
|
846
|
+
...twins,
|
|
847
|
+
" },",
|
|
848
|
+
" refuseAs: {",
|
|
849
|
+
...refuse,
|
|
850
|
+
" },",
|
|
851
|
+
"} as const;",
|
|
852
|
+
"",
|
|
853
|
+
"export const controls = {",
|
|
854
|
+
...controls,
|
|
855
|
+
"} as const;",
|
|
856
|
+
"",
|
|
857
|
+
"// Web's CLI hands run() its flags by name, which are kebab-case (--can-edit); every other door uses the field's",
|
|
858
|
+
"// name (canEdit). fromCli renames them, so a command's run() calls the same handler as MCP, WebMCP and Apple.",
|
|
859
|
+
"export const cliInput: Readonly<Record<string, Readonly<Record<string, string>>>> = {",
|
|
860
|
+
...cliInput,
|
|
861
|
+
"};",
|
|
862
|
+
"",
|
|
863
|
+
"// A list, group or one-of field comes in on the CLI as one JSON string; fromCli parses it.",
|
|
864
|
+
"export const cliJson: Readonly<Record<string, readonly string[]>> = {",
|
|
865
|
+
...cliJson,
|
|
866
|
+
"};",
|
|
867
|
+
"",
|
|
868
|
+
"export function fromCli(action: keyof typeof twins.actions, input: Readonly<Record<string, unknown>>): Record<string, unknown> {",
|
|
869
|
+
" const rename = cliInput[action] ?? {};",
|
|
870
|
+
" const json = cliJson[action] ?? [];",
|
|
871
|
+
" return Object.fromEntries(Object.entries(input).map(([key, value]) => {",
|
|
872
|
+
" const name = rename[key] ?? key;",
|
|
873
|
+
" return [name, json.includes(name) && typeof value === \"string\" ? JSON.parse(value) : value];",
|
|
874
|
+
" }));",
|
|
875
|
+
"}",
|
|
876
|
+
"",
|
|
877
|
+
].join("\n");
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
881
|
+
// Swift projections: App Intents, Button(intent:), Reins
|
|
882
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
883
|
+
|
|
884
|
+
const swiftLit = (s: string) => `"${s.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
885
|
+
const SWIFT_KEYWORDS = new Set(["as", "break", "case", "catch", "class", "continue", "default", "defer", "do", "else", "enum", "extension", "fallthrough", "false", "for", "func", "guard", "if", "import", "in", "init", "inout", "internal", "is", "let", "nil", "operator", "private", "protocol", "public", "repeat", "rethrows", "return", "self", "Self", "static", "struct", "subscript", "super", "switch", "throw", "throws", "true", "try", "typealias", "var", "where", "while"]);
|
|
886
|
+
const swiftId = (name: string) => (SWIFT_KEYWORDS.has(name) ? `\`${name}\`` : name);
|
|
887
|
+
const caseName = (v: string) => swiftId(names(v.replace(/[-/.:]/g, "_").replace(/_+/g, "_")).camel);
|
|
888
|
+
const enumType = (a: Action, field: string) => `${a.names.pascal}${field.charAt(0).toUpperCase()}${field.slice(1)}Value`;
|
|
889
|
+
|
|
890
|
+
/** Optional in Swift: an optional field, or a protocol-only one, which the person's doors leave nil. */
|
|
891
|
+
const swiftOptional = (f: Field) => f.optional === true || f.protocolOnly === true;
|
|
892
|
+
|
|
893
|
+
function swiftType(a: Action, name: string, f: Field): string {
|
|
894
|
+
const base = f.kind === "string" ? "String" : f.kind === "number" ? "Double" : f.kind === "integer" ? "Int" : f.kind === "boolean" ? "Bool" : enumType(a, name);
|
|
895
|
+
return swiftOptional(f) ? `${base}?` : base;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/** The input fields the person's doors (the App Intent and Reins) carry: every one but the protocol-only fields. */
|
|
899
|
+
const personFields = (a: Action) => Object.entries(a.input).filter(([, f]) => !f.protocolOnly);
|
|
900
|
+
|
|
901
|
+
function swiftStruct(a: Action, typeName: string, fields: Fields): string[] {
|
|
902
|
+
// A list, group or one-of field is protocol-only, and Swift never sends it, so the Swift input leaves it out.
|
|
903
|
+
const entries = Object.entries(fields).filter(([, f]) => !isStructured(f));
|
|
904
|
+
const lines = [`public struct ${typeName}: Codable, Sendable, Hashable {`];
|
|
905
|
+
for (const [n, f] of entries) lines.push(` public var ${swiftId(n)}: ${swiftType(a, n, f)}`);
|
|
906
|
+
const params = entries.map(([n, f]) => `${swiftId(n)}: ${swiftType(a, n, f)}${swiftOptional(f) ? " = nil" : ""}`).join(", ");
|
|
907
|
+
lines.push(` public init(${params}) {`);
|
|
908
|
+
for (const [n] of entries) lines.push(` self.${n} = ${swiftId(n)}`);
|
|
909
|
+
lines.push(" }", "}");
|
|
910
|
+
return lines;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
function swiftEnums(a: Action, intent: boolean): string[] {
|
|
914
|
+
const out: string[] = [];
|
|
915
|
+
for (const [n, f] of Object.entries(a.input)) {
|
|
916
|
+
if (f.kind !== "enum") continue;
|
|
917
|
+
const t = enumType(a, n);
|
|
918
|
+
out.push(`public enum ${t}: String, Codable, Sendable, Hashable, CaseIterable${intent ? ", AppEnum" : ""} {`);
|
|
919
|
+
for (const v of f.values) out.push(` case ${caseName(v)} = ${swiftLit(v)}`);
|
|
920
|
+
if (intent) {
|
|
921
|
+
out.push(` public static let typeDisplayRepresentation: TypeDisplayRepresentation = ${swiftLit(f.label)}`);
|
|
922
|
+
out.push(` public static let caseDisplayRepresentations: [${t}: DisplayRepresentation] = [`);
|
|
923
|
+
for (const v of f.values) out.push(` .${caseName(v)}: ${swiftLit(v)},`);
|
|
924
|
+
out.push(" ]");
|
|
925
|
+
}
|
|
926
|
+
out.push("}", "");
|
|
927
|
+
}
|
|
928
|
+
return out;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
function renderSwift(set: ActionSet): string {
|
|
932
|
+
const L: string[] = [
|
|
933
|
+
`// Generated by ${GENERATOR} from the "${set.name}" action set. Don't edit; run generate.`,
|
|
934
|
+
"//",
|
|
935
|
+
"// Each action has an Input and an Output, a handler the app sets once at launch (`<Action>Action.perform`), and a",
|
|
936
|
+
"// SwiftUI button. An agent door gets an App Intent whose perform() calls the same handler, and the button is",
|
|
937
|
+
"// Button(_:intent:), so a press, Siri, Shortcuts and Reins all take one path. A person-only action gets no App",
|
|
938
|
+
"// Intent, so no agent can reach it, and OuroActions.refusal(for:) answers a bridge that asks for it.",
|
|
939
|
+
"import AppIntents",
|
|
940
|
+
"import SwiftUI",
|
|
941
|
+
"",
|
|
942
|
+
"public enum OuroActionConsent: String, Sendable {",
|
|
943
|
+
' case read, write, consequential, personOnly = "person-only"',
|
|
944
|
+
"}",
|
|
945
|
+
"",
|
|
946
|
+
"/// The typed refusal of a person-only action: the error fields of web's refused outcome (code, exit, thing,",
|
|
947
|
+
"/// problem, message), plus the declaration's reason and how the person does it.",
|
|
948
|
+
"public struct OuroActionRefusal: Error, Sendable, Equatable {",
|
|
949
|
+
' public let code = "person-only"',
|
|
950
|
+
" public let exit = 2",
|
|
951
|
+
" public let thing: String",
|
|
952
|
+
" public let problem: String",
|
|
953
|
+
" public let message: String",
|
|
954
|
+
" public let reason: String",
|
|
955
|
+
" public let how: String",
|
|
956
|
+
"}",
|
|
957
|
+
"",
|
|
958
|
+
"/// An action ran before the app set its handler.",
|
|
959
|
+
"public struct OuroActionNotBound: Error, Sendable, Equatable {",
|
|
960
|
+
" public let action: String",
|
|
961
|
+
"}",
|
|
962
|
+
"",
|
|
963
|
+
`/// The "${set.name}" action set.`,
|
|
964
|
+
"public enum OuroActions {",
|
|
965
|
+
" public static let consent: [String: OuroActionConsent] = [",
|
|
966
|
+
...set.actions.map((a) => ` ${swiftLit(a.id)}: .${a.consent === "person-only" ? "personOnly" : a.consent},`),
|
|
967
|
+
" ]",
|
|
968
|
+
"",
|
|
969
|
+
" /// The refusal for a person-only action, by its id, kebab or camel name; nil for any other action.",
|
|
970
|
+
" public static func refusal(for action: String) -> OuroActionRefusal? {",
|
|
971
|
+
" switch action {",
|
|
972
|
+
];
|
|
973
|
+
for (const a of set.actions.filter((x) => x.consent === "person-only")) {
|
|
974
|
+
L.push(` case ${swiftLit(a.id)}, ${swiftLit(a.names.kebab)}, ${swiftLit(a.names.camel)}:`);
|
|
975
|
+
const r = refusal(a).error;
|
|
976
|
+
L.push(` return OuroActionRefusal(thing: ${swiftLit(r.thing)}, problem: ${swiftLit(r.problem)}, message: ${swiftLit(r.message)}, reason: ${swiftLit(a.personOnly!.reason)}, how: ${swiftLit(a.personOnly!.how)})`);
|
|
977
|
+
}
|
|
978
|
+
L.push(" default:", " return nil", " }", " }", "}", "");
|
|
979
|
+
|
|
980
|
+
for (const a of set.actions) {
|
|
981
|
+
const P = a.names.pascal;
|
|
982
|
+
const agentDoor = a.consent !== "person-only";
|
|
983
|
+
L.push(`// MARK: ${a.id} (${a.consent})`, "");
|
|
984
|
+
L.push(...swiftEnums(a, agentDoor));
|
|
985
|
+
L.push(...swiftStruct(a, `${P}Input`, a.input), "");
|
|
986
|
+
L.push(...swiftStruct(a, `${P}Output`, a.output), "");
|
|
987
|
+
L.push(`/// ${a.label}: ${a.description}`);
|
|
988
|
+
L.push("@MainActor", `public enum ${P}Action {`);
|
|
989
|
+
L.push(` public static let id = ${swiftLit(a.id)}`);
|
|
990
|
+
L.push(` /// The app's handler; every door calls it.`);
|
|
991
|
+
L.push(` public static var perform: (@MainActor @Sendable (${P}Input) async throws -> ${P}Output)?`);
|
|
992
|
+
if (agentDoor && a.consent === "consequential") {
|
|
993
|
+
L.push(` /// The question the person is asked, the declaration's confirm: the same words as the confirm sheet and the card.`);
|
|
994
|
+
L.push(` public static let confirmation: LocalizedStringResource = ${swiftLit(actionText(a).confirm!)}`);
|
|
995
|
+
L.push(" /// How the intent asks the person before it acts. Unset, it asks `confirmation`. A test sets it: return to");
|
|
996
|
+
L.push(" /// confirm, or throw to cancel, and the handler never runs. The app can also set it to ask in its own way.");
|
|
997
|
+
L.push(` public static var confirm: (@MainActor @Sendable (${P}Input) async throws -> Void)?`);
|
|
998
|
+
}
|
|
999
|
+
if (!agentDoor) L.push(" /// Called with the error when the person's press fails, since a plain button has nowhere to show it.", " public static var failed: (@MainActor @Sendable (any Error) -> Void)?");
|
|
1000
|
+
else {
|
|
1001
|
+
L.push(" /// What Siri and Shortcuts say when the App Intent finishes or fails: the result in words, or an error turned into");
|
|
1002
|
+
L.push(" /// words (rethrow to let the system show it). Unset, the intent says \"Done.\" and a failure throws.");
|
|
1003
|
+
L.push(` public static var dialog: (@MainActor @Sendable (${P}Input, Result<${P}Output, any Error>) async throws -> IntentDialog)?`);
|
|
1004
|
+
}
|
|
1005
|
+
L.push("");
|
|
1006
|
+
L.push(` public static func run(_ input: ${P}Input) async throws -> ${P}Output {`);
|
|
1007
|
+
L.push(` guard let perform else { throw OuroActionNotBound(action: id) }`);
|
|
1008
|
+
L.push(" return try await perform(input)", " }", "}", "");
|
|
1009
|
+
const fields = personFields(a);
|
|
1010
|
+
if (agentDoor) {
|
|
1011
|
+
L.push(`public struct ${P}Intent: AppIntent {`);
|
|
1012
|
+
L.push(` public static let title: LocalizedStringResource = ${swiftLit(a.label)}`);
|
|
1013
|
+
L.push(` public static let description = IntentDescription(${swiftLit(a.description)})`, "");
|
|
1014
|
+
if (a.opensApp) L.push(" public static let openAppWhenRun = true", "");
|
|
1015
|
+
const entityOf = (f: Field) => (f.kind === "string" ? f.entity : undefined);
|
|
1016
|
+
for (const [n, f] of fields) {
|
|
1017
|
+
const entity = entityOf(f);
|
|
1018
|
+
const ask = f.ask !== undefined ? `, requestValueDialog: ${swiftLit(f.ask)}` : "";
|
|
1019
|
+
const multiline = f.kind === "string" && f.multiline ? ", inputOptions: String.IntentInputOptions(multiline: true)" : "";
|
|
1020
|
+
L.push(` @Parameter(title: ${swiftLit(f.label)}, description: ${swiftLit(describe(f))}${ask}${multiline})`);
|
|
1021
|
+
L.push(` public var ${swiftId(n)}: ${entity ? `${entity}${f.optional ? "?" : ""}` : swiftType(a, n, f)}`);
|
|
1022
|
+
}
|
|
1023
|
+
if (fields.length) L.push("");
|
|
1024
|
+
L.push(" public init() {}", "");
|
|
1025
|
+
L.push(` public init(_ input: ${P}Input) {`, " self.init()");
|
|
1026
|
+
for (const [n, f] of fields) {
|
|
1027
|
+
const entity = entityOf(f);
|
|
1028
|
+
L.push(entity
|
|
1029
|
+
? ` self.${n} = ${f.optional ? `input.${swiftId(n)}.map { ${entity}(id: $0) }` : `${entity}(id: input.${swiftId(n)})`}`
|
|
1030
|
+
: ` self.${n} = input.${swiftId(n)}`);
|
|
1031
|
+
}
|
|
1032
|
+
L.push(" }", "");
|
|
1033
|
+
L.push(` public var input: ${P}Input {`, ` ${P}Input(${fields.map(([n, f]) => `${swiftId(n)}: ${swiftId(n)}${entityOf(f) ? `${f.optional ? "?" : ""}.id` : ""}`).join(", ")})`, " }", "");
|
|
1034
|
+
const returned = Object.entries(a.output).find(([, f]) => f.returned);
|
|
1035
|
+
const returns = ["IntentResult", ...(returned ? [`ReturnsValue<${swiftType(a, returned[0], returned[1])}>`] : []), "ProvidesDialog"].join(" & ");
|
|
1036
|
+
L.push(" @MainActor", ` public func perform() async throws -> some ${returns} {`);
|
|
1037
|
+
if (a.consent === "consequential") L.push(" // Consequential: the person says yes before it acts.", ` if let confirm = ${P}Action.confirm { try await confirm(self.input) } else { try await requestConfirmation(result: .result(dialog: IntentDialog(${P}Action.confirmation))) }`);
|
|
1038
|
+
L.push(" let input = self.input", ` let result: Result<${P}Output, any Error>`);
|
|
1039
|
+
L.push(` do { result = .success(try await ${P}Action.run(input)) } catch { result = .failure(error) }`);
|
|
1040
|
+
if (returned) {
|
|
1041
|
+
// A failure still throws: there is no value to hand on, and the dialog may rethrow a better error first.
|
|
1042
|
+
L.push(` let said: IntentDialog = try await ${P}Action.dialog?(input, result) ?? "Done."`);
|
|
1043
|
+
L.push(` return .result(value: try result.get().${swiftId(returned[0])}, dialog: said)`);
|
|
1044
|
+
} else {
|
|
1045
|
+
L.push(` if let dialog = ${P}Action.dialog { return .result(dialog: try await dialog(input, result)) }`);
|
|
1046
|
+
L.push(" _ = try result.get()", ' return .result(dialog: "Done.")');
|
|
1047
|
+
}
|
|
1048
|
+
L.push(" }", "}", "");
|
|
1049
|
+
}
|
|
1050
|
+
L.push(`/// The control for ${a.id}: ${agentDoor ? "Button(_:intent:), the same intent Siri and Shortcuts run" : "a plain Button, since no agent may start it"}.`);
|
|
1051
|
+
L.push("@available(iOS 17.0, macOS 14.0, watchOS 10.0, tvOS 17.0, *)");
|
|
1052
|
+
L.push(`public struct ${P}Button<Label: View>: View {`);
|
|
1053
|
+
L.push(` public let input: ${P}Input`, " let label: Label", "");
|
|
1054
|
+
L.push(` public init(_ input: ${P}Input, @ViewBuilder label: () -> Label) {`, " self.input = input", " self.label = label()", " }", "");
|
|
1055
|
+
L.push(" public var body: some View {");
|
|
1056
|
+
if (agentDoor) L.push(` Button(intent: ${P}Intent(input)) { label }`);
|
|
1057
|
+
else L.push(` Button { Task { do { _ = try await ${P}Action.run(input) } catch { ${P}Action.failed?(error) } } } label: { label }`);
|
|
1058
|
+
L.push(` .accessibilityHint(Text(verbatim: ${swiftLit(a.description)}))`, " }", "}", "");
|
|
1059
|
+
L.push("@available(iOS 17.0, macOS 14.0, watchOS 10.0, tvOS 17.0, *)");
|
|
1060
|
+
L.push(`extension ${P}Button where Label == Text {`);
|
|
1061
|
+
L.push(` public init(_ input: ${P}Input) {`, ` self.init(input) { Text(verbatim: ${swiftLit(a.label)}) }`, " }", "}", "");
|
|
1062
|
+
}
|
|
1063
|
+
return `${L.join("\n").replace(/\n+$/, "")}\n`;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
function reinsSchema(a: Action, f: Field): string {
|
|
1067
|
+
if (f.kind === "enum") return `.oneOf([${f.values.map(swiftLit).join(", ")}])`;
|
|
1068
|
+
return f.kind === "boolean" ? ".boolean" : `.${f.kind}`;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
function renderReins(set: ActionSet): string {
|
|
1072
|
+
const L: string[] = [
|
|
1073
|
+
`// Generated by ${GENERATOR} from the "${set.name}" action set. Don't edit; run generate.`,
|
|
1074
|
+
"//",
|
|
1075
|
+
"// Reins actions from the same declarations: each calls the handler a press and an App Intent call. Reins is the",
|
|
1076
|
+
"// test door that stands in for the person's finger, so person-only actions are here too.",
|
|
1077
|
+
"import OuroReins",
|
|
1078
|
+
"",
|
|
1079
|
+
];
|
|
1080
|
+
for (const a of set.actions) {
|
|
1081
|
+
const P = a.names.pascal;
|
|
1082
|
+
const fields = personFields(a);
|
|
1083
|
+
const props = fields.map(([n, f]) => `${swiftLit(n)}: ${reinsSchema(a, f)}`).join(", ");
|
|
1084
|
+
const required = fields.filter(([, f]) => !f.optional).map(([n]) => swiftLit(n)).join(", ");
|
|
1085
|
+
L.push(`extension ${P}Input: ReinsInput {`);
|
|
1086
|
+
L.push(` public static var reinsSchema: ReinsSchema { .object(properties: [${props || ":"}], required: [${required}]) }`, "}", "");
|
|
1087
|
+
}
|
|
1088
|
+
L.push("extension ReinsAction {");
|
|
1089
|
+
for (const a of set.actions) {
|
|
1090
|
+
const P = a.names.pascal;
|
|
1091
|
+
L.push(` /// ${a.label}: ${a.description}`);
|
|
1092
|
+
L.push(` public static func ${a.names.camel}() -> ReinsAction {`);
|
|
1093
|
+
L.push(` ReinsAction(${swiftLit(a.names.camel)}, ${swiftLit(a.label)}, input: ${P}Input.self) { input in _ = try await ${P}Action.run(input) }`);
|
|
1094
|
+
L.push(" }", "");
|
|
1095
|
+
}
|
|
1096
|
+
L[L.length - 1] = "}";
|
|
1097
|
+
return `${L.join("\n")}\n`;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
1101
|
+
// Every projection, the drift check and the live comparison
|
|
1102
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
1103
|
+
|
|
1104
|
+
/** Every file generate writes, by name. Deterministic: the same set renders the same bytes. */
|
|
1105
|
+
export function renderActions(set: ActionSet): Map<string, string> {
|
|
1106
|
+
const files = new Map<string, string>();
|
|
1107
|
+
files.set("actions.json", json({ ...header(set), tool: set.tool, actions: set.actions.map(({ names: _n, cliWords: _c, ...def }) => def) }));
|
|
1108
|
+
files.set("commands.json", json({ ...header(set), tool: set.tool, commands: agentDoors(set).map(toCommand), personOnly: Object.fromEntries(set.actions.filter((a) => a.consent === "person-only").map((a) => [a.cliWords, { reason: a.personOnly!.reason, how: a.personOnly!.how }])) }));
|
|
1109
|
+
files.set("mcp.json", json({ ...header(set), tools: agentDoors(set).map(toMcpTool), refusals: refusals(set) }));
|
|
1110
|
+
files.set("webmcp.json", json({ ...header(set), tools: agentDoors(set).map(toWebMcpTool), refusals: refusals(set) }));
|
|
1111
|
+
files.set("web.ts", renderWeb(set));
|
|
1112
|
+
files.set("OuroActions.swift", renderSwift(set));
|
|
1113
|
+
files.set("OuroActionsReins.swift", renderReins(set));
|
|
1114
|
+
return files;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
/** Every way `found` differs from what the set generates: a missing, extra or different file, at its first differing line. `only` checks just those files. */
|
|
1118
|
+
/** A projection without its generator's version, so files a newer ouro-actions would stamp differently still match. */
|
|
1119
|
+
const unstamped = (text: string) => text.replace(/\bouro-actions \d+\.\d+\.\d+\b/g, "ouro-actions");
|
|
1120
|
+
|
|
1121
|
+
export function checkGenerated(set: ActionSet, found: ReadonlyMap<string, string>, only?: ReadonlySet<string>): string[] {
|
|
1122
|
+
const expected = renderActions(set);
|
|
1123
|
+
const problems: string[] = [];
|
|
1124
|
+
for (const [path, text] of expected) {
|
|
1125
|
+
if (only && !only.has(path)) continue;
|
|
1126
|
+
const have = found.get(path);
|
|
1127
|
+
if (have === undefined) {
|
|
1128
|
+
problems.push(`${path}: missing. Fix: run generate.`);
|
|
1129
|
+
continue;
|
|
1130
|
+
}
|
|
1131
|
+
if (have === text || unstamped(have) === unstamped(text)) continue;
|
|
1132
|
+
// The first line that differs once the stamps are set aside, so a file an older ouro-actions stamped is reported where
|
|
1133
|
+
// it really drifted, not at its generator line (#123). Line numbers are the same either way: the stamp is within one line.
|
|
1134
|
+
const a = text.split("\n");
|
|
1135
|
+
const b = have.split("\n");
|
|
1136
|
+
let i = 0;
|
|
1137
|
+
while (i < a.length && b[i] !== undefined && unstamped(a[i]!) === unstamped(b[i]!)) i++;
|
|
1138
|
+
problems.push(`${path}:${i + 1}: drifted from its declaration: expected ${JSON.stringify(a[i] ?? "<end of file>")}, found ${JSON.stringify(b[i] ?? "<end of file>")}. Fix: change the declaration and run generate; never edit a generated file.`);
|
|
1139
|
+
}
|
|
1140
|
+
for (const path of found.keys()) if (!expected.has(path)) problems.push(`${path}: not generated from any declaration. Fix: delete it, or declare what it holds.`);
|
|
1141
|
+
return problems;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
const MCP_HINT_DEFAULTS: Readonly<Record<string, boolean>> = Object.freeze({ readOnlyHint: false, destructiveHint: true, openWorldHint: true, idempotentHint: false });
|
|
1145
|
+
const sortKeys = (v: unknown): unknown =>
|
|
1146
|
+
Array.isArray(v) ? v.map(sortKeys) : v && typeof v === "object" ? Object.fromEntries(Object.keys(v).sort().map((k) => [k, sortKeys((v as Record<string, unknown>)[k])])) : v;
|
|
1147
|
+
const same = (a: unknown, b: unknown) => JSON.stringify(sortKeys(a)) === JSON.stringify(sortKeys(b));
|
|
1148
|
+
|
|
1149
|
+
/**
|
|
1150
|
+
* Every way a live MCP server's tools differ from the declarations: a declared tool missing or with another
|
|
1151
|
+
* description, input schema or annotations; a person-only action listed as a tool; a tool nobody declared. `tools` is
|
|
1152
|
+
* a `tools/list` result (`{ tools: [...] }`) or its array.
|
|
1153
|
+
*/
|
|
1154
|
+
export function compareMcp(set: ActionSet, tools: unknown, options: { undeclared?: readonly string[] } = {}): string[] {
|
|
1155
|
+
const list = Array.isArray(tools) ? tools : (tools as { tools?: unknown })?.tools;
|
|
1156
|
+
if (!Array.isArray(list)) return ["tools: is not a tools/list result. Fix: pass the server's tools/list result, { tools: [...] }."];
|
|
1157
|
+
const live = new Map<string, Record<string, unknown>>();
|
|
1158
|
+
const problems: string[] = [];
|
|
1159
|
+
list.forEach((t: unknown, i: number) => {
|
|
1160
|
+
if (typeof t !== "object" || t === null || typeof (t as Record<string, unknown>)["name"] !== "string") return void problems.push(`tools[${i}]: is not a tool with a name. Fix: serve each tool as { name, description, inputSchema, annotations }.`);
|
|
1161
|
+
const name = (t as { name: string }).name;
|
|
1162
|
+
if (live.has(name)) problems.push(`${name}: the server lists it twice. Fix: list each tool once.`);
|
|
1163
|
+
live.set(name, t as Record<string, unknown>);
|
|
1164
|
+
});
|
|
1165
|
+
for (const a of set.actions) {
|
|
1166
|
+
const t = live.get(a.id);
|
|
1167
|
+
if (a.consent === "person-only") {
|
|
1168
|
+
if (t) problems.push(`${a.id}: is person-only but the server lists it as a tool. Fix: unlist it; a call answers the refusal in mcp.json.`);
|
|
1169
|
+
continue;
|
|
1170
|
+
}
|
|
1171
|
+
if (!t) {
|
|
1172
|
+
problems.push(`${a.id}: declared but the server doesn't list it. Fix: serve the tool from mcp.json.`);
|
|
1173
|
+
continue;
|
|
1174
|
+
}
|
|
1175
|
+
const want = toMcpTool(a);
|
|
1176
|
+
if (t["description"] !== want.description) problems.push(`${a.id}: description drifted: expected ${JSON.stringify(want.description)}, found ${JSON.stringify(t["description"])}. Fix: serve the declaration's agent description.`);
|
|
1177
|
+
if (!same(t["inputSchema"], want.inputSchema)) problems.push(`${a.id}: input schema drifted: expected ${JSON.stringify(sortKeys(want.inputSchema))}, found ${JSON.stringify(sortKeys(t["inputSchema"]))}. Fix: serve the declaration's input schema.`);
|
|
1178
|
+
const ann = (t["annotations"] ?? {}) as Record<string, unknown>;
|
|
1179
|
+
// A missing hint means MCP's default, which a client acts on: readOnlyHint false, destructiveHint and openWorldHint true.
|
|
1180
|
+
const wanted = want.annotations as unknown as Record<string, boolean | undefined>;
|
|
1181
|
+
for (const [k, fallback] of Object.entries(MCP_HINT_DEFAULTS)) if ((ann[k] ?? fallback) !== (wanted[k] ?? fallback)) problems.push(`${a.id}: annotation ${k} is ${k in ann ? JSON.stringify(ann[k]) : `missing (MCP's default, ${MCP_HINT_DEFAULTS[k]})`}, the declaration (consent "${a.consent}"${a.destructive ? ", destructive" : ""}${a.idempotent ? ", idempotent" : ""}) says ${wanted[k] ?? fallback}. Fix: serve the declaration's annotations.`);
|
|
1182
|
+
}
|
|
1183
|
+
// An app moving onto actions one tool at a time names the tools it hasn't declared yet. The list can only shrink: a
|
|
1184
|
+
// name on it that is now declared, or no longer served, is a problem too.
|
|
1185
|
+
const undeclared = new Set(options.undeclared ?? []);
|
|
1186
|
+
for (const name of live.keys()) if (!set.actions.some((a) => a.id === name) && !undeclared.has(name)) problems.push(`${name}: the server lists a tool no declaration has. Fix: declare it with defineAction.`);
|
|
1187
|
+
for (const name of undeclared) {
|
|
1188
|
+
if (set.actions.some((a) => a.id === name)) problems.push(`${name}: is declared, so it isn't undeclared any more. Fix: take it off the undeclared list.`);
|
|
1189
|
+
else if (!live.has(name)) problems.push(`${name}: is on the undeclared list but the server doesn't list it. Fix: take it off the undeclared list.`);
|
|
1190
|
+
}
|
|
1191
|
+
return problems;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
1195
|
+
// The report: what `check --report` writes, in the shape of the Ouro AX X-ray's report.json
|
|
1196
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
1197
|
+
|
|
1198
|
+
/** One claim of the action claim set (standard/ax/actions.claims.json), as the report needs it. */
|
|
1199
|
+
export interface ReportClaim {
|
|
1200
|
+
id: string;
|
|
1201
|
+
tier: "must" | "should";
|
|
1202
|
+
rule: string;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
export interface ActionsReport {
|
|
1206
|
+
tool: "ouro-actions";
|
|
1207
|
+
checker: { version: string };
|
|
1208
|
+
at: string;
|
|
1209
|
+
claimSet: { name: "actions"; version: string };
|
|
1210
|
+
target: { app: { name: string }; set: string; commit: string | null };
|
|
1211
|
+
summary: { claims: number; holding: number; must: number; mustHolding: number; checks: number };
|
|
1212
|
+
claims: { id: string; tier: "must" | "should"; holds: boolean; problems: string[] }[];
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
const parseJson = (text: string | undefined): Record<string, unknown> | null => {
|
|
1216
|
+
if (text === undefined) return null;
|
|
1217
|
+
try {
|
|
1218
|
+
const value: unknown = JSON.parse(text);
|
|
1219
|
+
return value && typeof value === "object" && !Array.isArray(value) ? (value as Record<string, unknown>) : null;
|
|
1220
|
+
} catch {
|
|
1221
|
+
return null;
|
|
1222
|
+
}
|
|
1223
|
+
};
|
|
1224
|
+
const toolsOf = (doc: Record<string, unknown> | null): Record<string, unknown>[] => (Array.isArray(doc?.["tools"]) ? (doc!["tools"] as Record<string, unknown>[]) : []);
|
|
1225
|
+
const hintsOf = (doc: Record<string, unknown> | null, name: string): Record<string, unknown> | null => {
|
|
1226
|
+
const tool = toolsOf(doc).find((t) => t["name"] === name);
|
|
1227
|
+
return tool && typeof tool["annotations"] === "object" ? (tool["annotations"] as Record<string, unknown>) : null;
|
|
1228
|
+
};
|
|
1229
|
+
const has = (doc: Record<string, unknown> | null, key: string, name: string) => Boolean(doc && typeof doc[key] === "object" && doc[key] !== null && name in (doc[key] as object));
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* Proves the action claim set's claims on a set's committed projections (the folder `generate` wrote), each from what
|
|
1233
|
+
* the files say: projections that equal their declaration; person-only actions offered on no agent door and refused on
|
|
1234
|
+
* each; consequential actions marked so on every door, and confirmed in the App Intent. The result is shaped like the
|
|
1235
|
+
* Ouro AX X-ray's report.json, so CI uploads it beside an X-ray report and the adoption ledger reads both.
|
|
1236
|
+
*/
|
|
1237
|
+
export function actionsReport(set: ActionSet, found: ReadonlyMap<string, string>, claims: readonly ReportClaim[], options: { claimSetVersion: string; app?: string; commit?: string | null; now?: () => Date }): ActionsReport {
|
|
1238
|
+
const mcp = parseJson(found.get("mcp.json"));
|
|
1239
|
+
const webmcp = parseJson(found.get("webmcp.json"));
|
|
1240
|
+
const commands = parseJson(found.get("commands.json"));
|
|
1241
|
+
const swift = found.get("OuroActions.swift");
|
|
1242
|
+
const commandOf = (a: Action) => (Array.isArray(commands?.["commands"]) ? (commands!["commands"] as Record<string, unknown>[]) : []).find((c) => c["name"] === a.cliWords);
|
|
1243
|
+
const proofs: Record<string, () => string[]> = {
|
|
1244
|
+
"action.projections-match": () => checkGenerated(set, found),
|
|
1245
|
+
"action.one-declaration": () => checkGenerated(set, found).length ? [`the committed projections are not all generated from ${set.name}'s declarations. Fix: run generate.`] : [],
|
|
1246
|
+
"action.person-only-refuses": () =>
|
|
1247
|
+
set.actions.filter((a) => a.consent === "person-only").flatMap((a) => [
|
|
1248
|
+
...(toolsOf(mcp).some((t) => t["name"] === a.id) ? [`${a.id}: mcp.json offers it as a tool. Fix: run generate.`] : []),
|
|
1249
|
+
...(toolsOf(webmcp).some((t) => t["name"] === a.id) ? [`${a.id}: webmcp.json offers it as a tool. Fix: run generate.`] : []),
|
|
1250
|
+
...(has(mcp, "refusals", a.id) ? [] : [`${a.id}: mcp.json does not refuse it. Fix: run generate.`]),
|
|
1251
|
+
...(has(webmcp, "refusals", a.id) ? [] : [`${a.id}: webmcp.json does not refuse it. Fix: run generate.`]),
|
|
1252
|
+
...(has(commands, "personOnly", a.cliWords) && !commandOf(a) ? [] : [`${a.id}: commands.json does not refuse "${a.cliWords}". Fix: run generate.`]),
|
|
1253
|
+
...(swift !== undefined && swift.includes(`struct ${a.names.pascal}Intent:`) ? [`${a.id}: OuroActions.swift has an App Intent for it. Fix: run generate.`] : []),
|
|
1254
|
+
]),
|
|
1255
|
+
"action.consequential-confirms": () =>
|
|
1256
|
+
set.actions.filter((a) => a.consent === "consequential").flatMap((a) => {
|
|
1257
|
+
const swiftIntent = swift === undefined ? null : swift.slice(swift.indexOf(`struct ${a.names.pascal}Intent:`), swift.indexOf("\n}\n", swift.indexOf(`struct ${a.names.pascal}Intent:`)));
|
|
1258
|
+
return [
|
|
1259
|
+
...(hintsOf(mcp, a.id)?.["destructiveHint"] === true ? [] : [`${a.id}: mcp.json does not mark it destructive. Fix: run generate.`]),
|
|
1260
|
+
...(hintsOf(webmcp, a.id)?.["consequentialHint"] === true ? [] : [`${a.id}: webmcp.json does not mark it consequential. Fix: run generate.`]),
|
|
1261
|
+
...(commandOf(a)?.["effect"] === "others" ? [] : [`${a.id}: commands.json does not give "${a.cliWords}" the effect "others", so the CLI does not ask for --why. Fix: run generate.`]),
|
|
1262
|
+
...(swiftIntent === null || swiftIntent.includes("requestConfirmation(") ? [] : [`${a.id}: its App Intent does not call requestConfirmation. Fix: run generate.`]),
|
|
1263
|
+
];
|
|
1264
|
+
}),
|
|
1265
|
+
"action.agent-description": () => set.actions.filter((a) => !a.agent?.trim()).map((a) => `${a.id}: has no agent description. Fix: write one line for a model in agent.`),
|
|
1266
|
+
};
|
|
1267
|
+
const results = claims.map((c) => {
|
|
1268
|
+
const problems = proofs[c.id]?.() ?? [`no check in ouro-actions ${ACTIONS_VERSION} proves ${c.id}. Fix: use the ouro-actions from the same core release as the claim set.`];
|
|
1269
|
+
return { id: c.id, tier: c.tier, holds: problems.length === 0, problems };
|
|
1270
|
+
});
|
|
1271
|
+
const musts = results.filter((r) => r.tier === "must");
|
|
1272
|
+
return {
|
|
1273
|
+
tool: "ouro-actions",
|
|
1274
|
+
checker: { version: ACTIONS_VERSION },
|
|
1275
|
+
at: (options.now ?? (() => new Date()))().toISOString(),
|
|
1276
|
+
claimSet: { name: "actions", version: options.claimSetVersion },
|
|
1277
|
+
target: { app: { name: options.app ?? set.tool ?? set.name }, set: set.name, commit: options.commit ?? null },
|
|
1278
|
+
summary: { claims: results.length, holding: results.filter((r) => r.holds).length, must: musts.length, mustHolding: musts.filter((r) => r.holds).length, checks: results.length },
|
|
1279
|
+
claims: results,
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
1284
|
+
// The CLI
|
|
1285
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
1286
|
+
|
|
1287
|
+
const count = (n: number, noun: string) => `${n} ${noun}${n === 1 ? "" : "s"}`;
|
|
1288
|
+
|
|
1289
|
+
async function loadSet(path: string): Promise<ActionSet> {
|
|
1290
|
+
const mod = (await import(pathToFileURL(resolve(path)).href)) as { default?: ActionSet };
|
|
1291
|
+
const set = mod.default;
|
|
1292
|
+
if (!set || !Array.isArray(set.actions) || typeof set.name !== "string") throw new Error(`${path}: has no default export from defineActions. Fix: export default defineActions("<name>", [ ... ]).`);
|
|
1293
|
+
return set;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
async function readDir(dir: string): Promise<Map<string, string>> {
|
|
1297
|
+
const found = new Map<string, string>();
|
|
1298
|
+
let entries: string[];
|
|
1299
|
+
try {
|
|
1300
|
+
entries = await readdir(dir);
|
|
1301
|
+
} catch {
|
|
1302
|
+
return found;
|
|
1303
|
+
}
|
|
1304
|
+
for (const name of entries.sort()) {
|
|
1305
|
+
if (name.startsWith(".")) continue;
|
|
1306
|
+
const text = await readFile(join(dir, name), "utf8").catch((error: { code?: string }) => (error.code === "EISDIR" ? null : Promise.reject(error)));
|
|
1307
|
+
if (text !== null) found.set(name, text);
|
|
1308
|
+
}
|
|
1309
|
+
return found;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
const USAGE = "usage: node ouro-actions.mts generate <actions.mts> <dir> [--targets <names>] | check <actions.mts> <dir> [--targets <names>] [--report <report.json> [--claims <actions.claims.json>] [--app <name>] [--commit <sha>]] | compare-mcp <actions.mts> <tools.json> [--undeclared <names.json>]";
|
|
1313
|
+
|
|
1314
|
+
const REPORT_FLAGS = ["--report", "--claims", "--app", "--commit", "--targets"];
|
|
1315
|
+
|
|
1316
|
+
/** The projections `--targets` names, by the short name a person types (`mcp,actions`), and the file each writes. */
|
|
1317
|
+
export const PROJECTIONS: Readonly<Record<string, string>> = Object.freeze({
|
|
1318
|
+
actions: "actions.json",
|
|
1319
|
+
commands: "commands.json",
|
|
1320
|
+
mcp: "mcp.json",
|
|
1321
|
+
webmcp: "webmcp.json",
|
|
1322
|
+
web: "web.ts",
|
|
1323
|
+
swift: "OuroActions.swift",
|
|
1324
|
+
reins: "OuroActionsReins.swift",
|
|
1325
|
+
});
|
|
1326
|
+
|
|
1327
|
+
/** The files a `--targets` list names, or every file when it is absent. Unknown names fail with the list of names. */
|
|
1328
|
+
export function targetFiles(targets: string | undefined): Set<string> | undefined {
|
|
1329
|
+
if (targets === undefined) return undefined;
|
|
1330
|
+
const names = targets.split(",");
|
|
1331
|
+
const unknown = names.filter((n) => !(n in PROJECTIONS));
|
|
1332
|
+
if (unknown.length || names.length === 0) throw new Error(`--targets: ${unknown.length ? unknown.join(", ") : "is empty"} is not a projection. Fix: use any of ${Object.keys(PROJECTIONS).join(", ")}.`);
|
|
1333
|
+
return new Set(names.map((n) => PROJECTIONS[n]!));
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
/** check's options after its two arguments: each of --report, --claims, --app and --commit at most once with a value; null when they are not. */
|
|
1337
|
+
function reportOptions(rest: readonly string[]): Record<string, string> | null {
|
|
1338
|
+
const options: Record<string, string> = {};
|
|
1339
|
+
for (let i = 0; i < rest.length; i += 2) {
|
|
1340
|
+
const [flag, value] = [rest[i]!, rest[i + 1]];
|
|
1341
|
+
if (!REPORT_FLAGS.includes(flag) || value === undefined || flag in options) return null;
|
|
1342
|
+
options[flag] = value;
|
|
1343
|
+
}
|
|
1344
|
+
const keys = Object.keys(options);
|
|
1345
|
+
return keys.length && !("--report" in options) && keys.some((k) => k !== "--targets") ? null : options;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
/** Runs the CLI; returns the exit code: 0 clean, 1 drift, 2 usage. */
|
|
1349
|
+
export async function main(argv: readonly string[], io: { out(s: string): void; err(s: string): void }): Promise<number> {
|
|
1350
|
+
const [cmd, declarations, target, flag, flagValue, ...rest] = argv;
|
|
1351
|
+
const report = cmd === "check" ? reportOptions(argv.slice(3)) : null;
|
|
1352
|
+
const flagOk = flag === undefined || (cmd === "compare-mcp" && flag === "--undeclared" && flagValue !== undefined && rest.length === 0) || (cmd === "generate" && flag === "--targets" && flagValue !== undefined && rest.length === 0) || report !== null;
|
|
1353
|
+
if (!cmd || !declarations || !target || !["generate", "check", "compare-mcp"].includes(cmd) || !flagOk) {
|
|
1354
|
+
io.err(`${USAGE}\n`);
|
|
1355
|
+
return 2;
|
|
1356
|
+
}
|
|
1357
|
+
const set = await loadSet(declarations);
|
|
1358
|
+
let only: Set<string> | undefined;
|
|
1359
|
+
try {
|
|
1360
|
+
only = cmd === "generate" ? targetFiles(flag === "--targets" ? flagValue : undefined) : targetFiles(report?.["--targets"]);
|
|
1361
|
+
} catch (e) {
|
|
1362
|
+
io.err(`ouro-actions: ${(e as Error).message}\n`);
|
|
1363
|
+
return 2;
|
|
1364
|
+
}
|
|
1365
|
+
if (cmd === "generate") {
|
|
1366
|
+
await mkdir(target, { recursive: true });
|
|
1367
|
+
const files = renderActions(set);
|
|
1368
|
+
for (const [path, text] of files) if (!only || only.has(path)) await writeFile(join(target, path), text);
|
|
1369
|
+
io.out(`ouro-actions: wrote ${only ? only.size : files.size} files for ${count(set.actions.length, "action")} into ${target}.\n`);
|
|
1370
|
+
return 0;
|
|
1371
|
+
}
|
|
1372
|
+
if (cmd === "check") {
|
|
1373
|
+
const found = await readDir(target);
|
|
1374
|
+
const problems = checkGenerated(set, found, only);
|
|
1375
|
+
for (const p of problems) io.err(`ouro-actions: ${p}\n`);
|
|
1376
|
+
if (report?.["--report"]) {
|
|
1377
|
+
const claimsPath = report["--claims"] ?? fileURLToPath(new URL("./actions.claims.json", import.meta.url));
|
|
1378
|
+
const claimSet = JSON.parse(await readFile(claimsPath, "utf8")) as { version: string; claims: ReportClaim[] };
|
|
1379
|
+
const written = actionsReport(set, found, claimSet.claims, { claimSetVersion: claimSet.version, app: report["--app"], commit: report["--commit"] ?? null });
|
|
1380
|
+
await mkdir(dirname(resolve(report["--report"])), { recursive: true });
|
|
1381
|
+
await writeFile(report["--report"], `${JSON.stringify(written, null, 2)}\n`);
|
|
1382
|
+
const { must, mustHolding, claims, holding } = written.summary;
|
|
1383
|
+
io.out(`ouro-actions: ${mustHolding} of ${must} must claims and ${holding} of ${claims} claims hold; wrote ${report["--report"]}.\n`);
|
|
1384
|
+
const broken = written.claims.filter((c) => c.tier === "must" && !c.holds);
|
|
1385
|
+
for (const c of broken) io.err(`ouro-actions: must claim ${c.id} does not hold: ${c.problems[0] ?? "no proof in this ouro-actions"}. See ${report["--report"]}.\n`);
|
|
1386
|
+
if (broken.length) return 1;
|
|
1387
|
+
}
|
|
1388
|
+
if (problems.length) return 1;
|
|
1389
|
+
io.out(`ouro-actions: ${count(set.actions.length, "action")}, every projection matches its declaration.\n`);
|
|
1390
|
+
return 0;
|
|
1391
|
+
}
|
|
1392
|
+
let undeclared: string[] | undefined;
|
|
1393
|
+
if (flagValue !== undefined) {
|
|
1394
|
+
const names: unknown = JSON.parse(await readFile(flagValue, "utf8"));
|
|
1395
|
+
if (!Array.isArray(names) || !names.every((n) => typeof n === "string")) {
|
|
1396
|
+
io.err(`ouro-actions: ${flagValue}: is not a JSON array of tool names. Fix: ["get_recipe", "create_recipe"].\n`);
|
|
1397
|
+
return 2;
|
|
1398
|
+
}
|
|
1399
|
+
undeclared = names;
|
|
1400
|
+
}
|
|
1401
|
+
const problems = compareMcp(set, JSON.parse(await readFile(target, "utf8")), { undeclared });
|
|
1402
|
+
for (const p of problems) io.err(`ouro-actions: ${p}\n`);
|
|
1403
|
+
if (problems.length) return 1;
|
|
1404
|
+
io.out(`ouro-actions: ${count(set.actions.length, "action")}, the live tools match their declarations.\n`);
|
|
1405
|
+
return 0;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
1409
|
+
main(process.argv.slice(2), { out: (s) => process.stdout.write(s), err: (s) => process.stderr.write(s) }).then(
|
|
1410
|
+
(code) => process.exit(code),
|
|
1411
|
+
(error: unknown) => {
|
|
1412
|
+
process.stderr.write(`ouro-actions: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
1413
|
+
process.exit(1);
|
|
1414
|
+
},
|
|
1415
|
+
);
|
|
1416
|
+
}
|