@skrr-ai/cli 0.1.109 → 0.1.111
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/bin/run.js +15 -1
- package/dist/base-command.d.ts +44 -1
- package/dist/base-command.js +194 -33
- package/dist/commands/actions/list.js +2 -1
- package/dist/commands/agenda/trigger/create.js +1 -1
- package/dist/commands/agenda/trigger/list.js +2 -1
- package/dist/commands/agent-groups/list.js +2 -1
- package/dist/commands/agents/actions/list.js +2 -1
- package/dist/commands/agents/always-on/status.js +5 -0
- package/dist/commands/agents/chat.js +4 -1
- package/dist/commands/agents/duplicate.js +4 -0
- package/dist/commands/agents/eval/list.js +2 -1
- package/dist/commands/agents/files/list.js +2 -1
- package/dist/commands/agents/folders/list.js +2 -1
- package/dist/commands/agents/goals/list.js +2 -1
- package/dist/commands/agents/intuitions/list.js +8 -5
- package/dist/commands/agents/list.d.ts +12 -0
- package/dist/commands/agents/list.js +45 -8
- package/dist/commands/agents/releases/known-issues/list.js +2 -1
- package/dist/commands/agents/releases/list.js +5 -1
- package/dist/commands/agents/releases/trusted-publishers/list.js +2 -1
- package/dist/commands/agents/roles/list.js +2 -1
- package/dist/commands/agents/skills/list.js +2 -1
- package/dist/commands/agents/todos/list.js +2 -1
- package/dist/commands/agents/triggers/create.js +1 -1
- package/dist/commands/agents/triggers/list.js +2 -1
- package/dist/commands/agents/triggers/update.js +1 -1
- package/dist/commands/agents/update.d.ts +11 -0
- package/dist/commands/agents/update.js +58 -2
- package/dist/commands/api-keys/list.js +2 -1
- package/dist/commands/apps/channel.d.ts +20 -0
- package/dist/commands/apps/channel.js +64 -0
- package/dist/commands/apps/check-draft.d.ts +12 -0
- package/dist/commands/apps/check-draft.js +41 -0
- package/dist/commands/apps/check.d.ts +42 -0
- package/dist/commands/apps/check.js +91 -0
- package/dist/commands/apps/create.d.ts +15 -0
- package/dist/commands/apps/create.js +59 -0
- package/dist/commands/apps/data/put.d.ts +18 -0
- package/dist/commands/apps/data/put.js +72 -0
- package/dist/commands/apps/data/query.d.ts +20 -0
- package/dist/commands/apps/data/query.js +88 -0
- package/dist/commands/apps/disclosure.d.ts +16 -0
- package/dist/commands/apps/disclosure.js +71 -0
- package/dist/commands/apps/file/cat.d.ts +15 -0
- package/dist/commands/apps/file/cat.js +50 -0
- package/dist/commands/apps/file/ls.d.ts +13 -0
- package/dist/commands/apps/file/ls.js +47 -0
- package/dist/commands/apps/file/mv.d.ts +15 -0
- package/dist/commands/apps/file/mv.js +49 -0
- package/dist/commands/apps/file/rm.d.ts +15 -0
- package/dist/commands/apps/file/rm.js +53 -0
- package/dist/commands/apps/file/write.d.ts +17 -0
- package/dist/commands/apps/file/write.js +81 -0
- package/dist/commands/apps/install.d.ts +19 -0
- package/dist/commands/apps/install.js +136 -0
- package/dist/commands/apps/installations/list.d.ts +11 -0
- package/dist/commands/apps/installations/list.js +49 -0
- package/dist/commands/apps/installations/show.d.ts +12 -0
- package/dist/commands/apps/installations/show.js +61 -0
- package/dist/commands/apps/layout/set.d.ts +11 -0
- package/dist/commands/apps/layout/set.js +125 -0
- package/dist/commands/apps/layout/show.d.ts +9 -0
- package/dist/commands/apps/layout/show.js +33 -0
- package/dist/commands/apps/list.d.ts +10 -0
- package/dist/commands/apps/list.js +45 -0
- package/dist/commands/apps/logs.d.ts +13 -0
- package/dist/commands/apps/logs.js +55 -0
- package/dist/commands/apps/preview.d.ts +12 -0
- package/dist/commands/apps/preview.js +39 -0
- package/dist/commands/apps/publish/propose.d.ts +14 -0
- package/dist/commands/apps/publish/propose.js +45 -0
- package/dist/commands/apps/pull.d.ts +14 -0
- package/dist/commands/apps/pull.js +56 -0
- package/dist/commands/apps/push.d.ts +15 -0
- package/dist/commands/apps/push.js +75 -0
- package/dist/commands/apps/reconsent.d.ts +13 -0
- package/dist/commands/apps/reconsent.js +67 -0
- package/dist/commands/apps/report.d.ts +20 -0
- package/dist/commands/apps/report.js +63 -0
- package/dist/commands/apps/resume.d.ts +12 -0
- package/dist/commands/apps/resume.js +36 -0
- package/dist/commands/apps/settings/set.d.ts +13 -0
- package/dist/commands/apps/settings/set.js +54 -0
- package/dist/commands/apps/settings/show.d.ts +11 -0
- package/dist/commands/apps/settings/show.js +31 -0
- package/dist/commands/apps/show.d.ts +12 -0
- package/dist/commands/apps/show.js +49 -0
- package/dist/commands/apps/suspend.d.ts +12 -0
- package/dist/commands/apps/suspend.js +35 -0
- package/dist/commands/apps/uninstall.d.ts +13 -0
- package/dist/commands/apps/uninstall.js +43 -0
- package/dist/commands/apps/upgrade.d.ts +14 -0
- package/dist/commands/apps/upgrade.js +49 -0
- package/dist/commands/apps/version/create.d.ts +14 -0
- package/dist/commands/apps/version/create.js +53 -0
- package/dist/commands/apps/version/show.d.ts +12 -0
- package/dist/commands/apps/version/show.js +39 -0
- package/dist/commands/apps/versions.d.ts +12 -0
- package/dist/commands/apps/versions.js +40 -0
- package/dist/commands/apps/webhooks/list.d.ts +12 -0
- package/dist/commands/apps/webhooks/list.js +47 -0
- package/dist/commands/characters/list.js +2 -1
- package/dist/commands/chats/files/list.js +2 -1
- package/dist/commands/chats/folders/list.js +2 -1
- package/dist/commands/chats/list.js +2 -1
- package/dist/commands/chats/spaces/list.js +2 -1
- package/dist/commands/chats/widgets/list.js +2 -1
- package/dist/commands/code/jobs/list.js +4 -1
- package/dist/commands/commerce/incidents/list.js +2 -1
- package/dist/commands/commitments/accounting.js +3 -0
- package/dist/commands/commitments/action-proposals.d.ts +8 -0
- package/dist/commands/commitments/action-proposals.js +17 -2
- package/dist/commands/commitments/cost.d.ts +11 -0
- package/dist/commands/commitments/cost.js +25 -0
- package/dist/commands/commitments/create.js +6 -1
- package/dist/commands/commitments/endpoints/list.js +2 -1
- package/dist/commands/commitments/links/list.js +2 -1
- package/dist/commands/commitments/list.js +2 -1
- package/dist/commands/commitments/liveness.d.ts +30 -0
- package/dist/commands/commitments/liveness.js +22 -5
- package/dist/commands/commitments/pack/list.js +2 -1
- package/dist/commands/commitments/preflight.js +6 -2
- package/dist/commands/commitments/update.js +10 -1
- package/dist/commands/compass/list.js +2 -1
- package/dist/commands/context.js +7 -1
- package/dist/commands/convos/list.js +3 -2
- package/dist/commands/daemon/install.js +17 -1
- package/dist/commands/daemon/login.js +14 -0
- package/dist/commands/dm/list.js +2 -1
- package/dist/commands/dm/work.d.ts +19 -0
- package/dist/commands/dm/work.js +54 -0
- package/dist/commands/feeds/list.js +2 -1
- package/dist/commands/followups/list.js +2 -1
- package/dist/commands/followups/plans/cancel.d.ts +13 -0
- package/dist/commands/followups/plans/cancel.js +26 -0
- package/dist/commands/followups/plans/create.d.ts +11 -0
- package/dist/commands/followups/plans/create.js +35 -0
- package/dist/commands/followups/plans/list.d.ts +13 -0
- package/dist/commands/followups/plans/list.js +50 -0
- package/dist/commands/followups/plans/observability.d.ts +11 -0
- package/dist/commands/followups/plans/observability.js +46 -0
- package/dist/commands/followups/plans/revise.d.ts +13 -0
- package/dist/commands/followups/plans/revise.js +35 -0
- package/dist/commands/followups/plans/show.d.ts +11 -0
- package/dist/commands/followups/plans/show.js +32 -0
- package/dist/commands/goals/key-results/list.js +2 -1
- package/dist/commands/goals/labels/list.js +3 -2
- package/dist/commands/goals/list.js +3 -2
- package/dist/commands/grants/list.js +2 -1
- package/dist/commands/harnesses/grants/list.js +2 -1
- package/dist/commands/harnesses/leases/list.js +2 -1
- package/dist/commands/harnesses/list.js +10 -1
- package/dist/commands/harnesses/prune.d.ts +26 -0
- package/dist/commands/harnesses/prune.js +172 -0
- package/dist/commands/ingress/list.js +2 -1
- package/dist/commands/initiatives/list.js +2 -1
- package/dist/commands/instruction-blocks/list.js +2 -1
- package/dist/commands/instructions/list.js +2 -1
- package/dist/commands/integrations/connections/list.js +2 -1
- package/dist/commands/integrations/tools/list.js +2 -1
- package/dist/commands/labels/list.js +3 -2
- package/dist/commands/learning/adapters.d.ts +16 -0
- package/dist/commands/learning/adapters.js +44 -0
- package/dist/commands/login.js +11 -0
- package/dist/commands/machines/dedicated/list.js +2 -1
- package/dist/commands/machines/hosted/list.js +2 -1
- package/dist/commands/machines/list.js +2 -1
- package/dist/commands/machines/show.js +5 -2
- package/dist/commands/measures/list.js +2 -1
- package/dist/commands/memory/list.js +2 -1
- package/dist/commands/memory/proposals/list.js +2 -1
- package/dist/commands/memory/stores/list.js +2 -1
- package/dist/commands/memory/topics/list.js +2 -1
- package/dist/commands/memory/versions/list.js +2 -1
- package/dist/commands/messages/list.js +2 -1
- package/dist/commands/northstars/intents/list.js +2 -1
- package/dist/commands/northstars/list.js +2 -1
- package/dist/commands/northstars/recommendations/list.js +2 -1
- package/dist/commands/outbox/list.js +2 -1
- package/dist/commands/profiles/list.js +2 -1
- package/dist/commands/projects/docs/list.js +8 -1
- package/dist/commands/projects/updates/list.js +2 -1
- package/dist/commands/proposals/list.js +2 -1
- package/dist/commands/requests/comments/list.js +2 -1
- package/dist/commands/requests/list.js +2 -1
- package/dist/commands/shares/list.js +2 -1
- package/dist/commands/shortcuts/list.js +2 -1
- package/dist/commands/signals/monitors/list.js +2 -1
- package/dist/commands/signals/schemas/list.js +2 -1
- package/dist/commands/signals/sources/list.js +2 -1
- package/dist/commands/space-directory-views/list.js +2 -1
- package/dist/commands/spaces/actions/list.js +4 -3
- package/dist/commands/spaces/briefs/list.js +2 -1
- package/dist/commands/spaces/cycles/list.js +2 -1
- package/dist/commands/spaces/files/folders/list.js +2 -1
- package/dist/commands/spaces/files/list.js +3 -2
- package/dist/commands/spaces/heartbeats/list.js +3 -2
- package/dist/commands/spaces/labels/list.js +3 -2
- package/dist/commands/spaces/list.d.ts +3 -18
- package/dist/commands/spaces/list.js +28 -35
- package/dist/commands/spaces/live/cards/list.js +2 -1
- package/dist/commands/spaces/members/list.d.ts +1 -0
- package/dist/commands/spaces/members/list.js +4 -1
- package/dist/commands/spaces/show.js +2 -2
- package/dist/commands/spaces/skills/list.js +6 -2
- package/dist/commands/spaces/states/list.js +2 -1
- package/dist/commands/spaces/views/list.js +2 -1
- package/dist/commands/spaces/widgets/list.js +3 -2
- package/dist/commands/spaces/workflow-templates/list.js +2 -1
- package/dist/commands/spaces/workflows/fixtures/list.js +2 -1
- package/dist/commands/spaces/workflows/list.js +3 -2
- package/dist/commands/spaces/workflows/proposals/list.js +2 -1
- package/dist/commands/spaces/workflows/start.js +3 -1
- package/dist/commands/spaces/workflows/triggers/list.js +2 -1
- package/dist/commands/spaces/workflows/validate.js +12 -2
- package/dist/commands/store/acquisitions/list.js +2 -1
- package/dist/commands/store/admissions/list.js +17 -1
- package/dist/commands/store/advisories/list.js +2 -1
- package/dist/commands/store/follows/list.js +2 -1
- package/dist/commands/store/publishers/domains/list.js +2 -1
- package/dist/commands/store/reports/list.js +2 -1
- package/dist/commands/subscriptions/list.js +2 -1
- package/dist/commands/tasks/actionability.js +7 -30
- package/dist/commands/tasks/activity.js +14 -8
- package/dist/commands/tasks/approvals/list.js +2 -1
- package/dist/commands/tasks/assign.d.ts +1 -0
- package/dist/commands/tasks/assign.js +43 -7
- package/dist/commands/tasks/attachments/list.js +2 -1
- package/dist/commands/tasks/chat/send.js +34 -0
- package/dist/commands/tasks/comments/add.js +6 -1
- package/dist/commands/tasks/comments/list.js +2 -1
- package/dist/commands/tasks/complete.js +26 -2
- package/dist/commands/tasks/continue.d.ts +18 -0
- package/dist/commands/tasks/continue.js +54 -0
- package/dist/commands/tasks/create-tree.d.ts +5 -0
- package/dist/commands/tasks/create-tree.js +399 -219
- package/dist/commands/tasks/create.d.ts +1 -0
- package/dist/commands/tasks/create.js +63 -11
- package/dist/commands/tasks/deliverable/add.js +10 -3
- package/dist/commands/tasks/deliverable/list.js +2 -1
- package/dist/commands/tasks/events/list.js +2 -1
- package/dist/commands/tasks/execution-state.d.ts +12 -0
- package/dist/commands/tasks/execution-state.js +28 -0
- package/dist/commands/tasks/expectations/assess.js +40 -5
- package/dist/commands/tasks/guide.d.ts +10 -0
- package/dist/commands/tasks/guide.js +20 -0
- package/dist/commands/tasks/labels/list.js +2 -1
- package/dist/commands/tasks/list.d.ts +19 -0
- package/dist/commands/tasks/list.js +103 -6
- package/dist/commands/tasks/move.js +10 -2
- package/dist/commands/tasks/preflight.d.ts +14 -0
- package/dist/commands/tasks/preflight.js +77 -0
- package/dist/commands/tasks/rearm-recurrence.js +22 -3
- package/dist/commands/tasks/resource/list.js +2 -1
- package/dist/commands/tasks/result/submit.js +10 -1
- package/dist/commands/tasks/review.js +6 -1
- package/dist/commands/tasks/revisions.d.ts +2 -0
- package/dist/commands/tasks/revisions.js +8 -1
- package/dist/commands/tasks/show.d.ts +8 -0
- package/dist/commands/tasks/show.js +81 -43
- package/dist/commands/tasks/start.d.ts +1 -0
- package/dist/commands/tasks/start.js +35 -0
- package/dist/commands/tasks/templates/list.js +2 -1
- package/dist/commands/tasks/timeline.d.ts +5 -0
- package/dist/commands/tasks/timeline.js +9 -1
- package/dist/commands/tasks/unschedule.js +5 -1
- package/dist/commands/tasks/update.d.ts +1 -0
- package/dist/commands/tasks/update.js +36 -3
- package/dist/commands/tasks/updates/add.js +6 -1
- package/dist/commands/tasks/updates/list.js +2 -1
- package/dist/commands/tasks/upsert.d.ts +1 -0
- package/dist/commands/tasks/upsert.js +8 -1
- package/dist/commands/token/list.js +2 -1
- package/dist/commands/tokens/list.js +2 -1
- package/dist/commands/tones/list.js +4 -2
- package/dist/commands/triggers/audit.js +12 -3
- package/dist/commands/triggers/create.js +1 -1
- package/dist/commands/triggers/fire-detail.d.ts +7 -0
- package/dist/commands/triggers/fire-detail.js +30 -12
- package/dist/commands/triggers/fire.js +13 -3
- package/dist/commands/triggers/list.js +2 -1
- package/dist/commands/triggers/parse-intent.js +1 -1
- package/dist/commands/triggers/update.js +1 -1
- package/dist/commands/views/list.js +2 -1
- package/dist/commands/webhooks/list.js +2 -1
- package/dist/commands/whoami.js +1 -1
- package/dist/commands/widgets/list.js +2 -1
- package/dist/commands/widgets/save-as-app.d.ts +13 -0
- package/dist/commands/widgets/save-as-app.js +65 -0
- package/dist/commands/work-views/list.js +2 -1
- package/dist/commands/worklog/list.js +2 -1
- package/dist/commands/workspaces/grants.js +1 -4
- package/dist/commands/workspaces/list.js +3 -2
- package/dist/commands/workspaces/members.d.ts +1 -0
- package/dist/commands/workspaces/members.js +10 -7
- package/dist/generated/managed-instruction-guides.json +2 -2
- package/dist/help.js +7 -0
- package/dist/lib/agent-proactive-baseline.d.ts +9 -0
- package/dist/lib/agent-proactive-baseline.js +44 -0
- package/dist/lib/agentic-stream.d.ts +4 -1
- package/dist/lib/agentic-stream.js +29 -4
- package/dist/lib/appData.d.ts +75 -0
- package/dist/lib/appData.js +274 -0
- package/dist/lib/appInstallations.d.ts +117 -0
- package/dist/lib/appInstallations.js +960 -0
- package/dist/lib/appSettings.d.ts +3 -0
- package/dist/lib/appSettings.js +71 -0
- package/dist/lib/appWebhooks.d.ts +7 -0
- package/dist/lib/appWebhooks.js +59 -0
- package/dist/lib/apps-command.d.ts +44 -0
- package/dist/lib/apps-command.js +164 -0
- package/dist/lib/apps.d.ts +45 -0
- package/dist/lib/apps.js +148 -0
- package/dist/lib/appsCheck.d.ts +12 -0
- package/dist/lib/appsCheck.js +173 -0
- package/dist/lib/appsFs.d.ts +58 -0
- package/dist/lib/appsFs.js +384 -0
- package/dist/lib/auth-failure.d.ts +20 -0
- package/dist/lib/auth-failure.js +40 -3
- package/dist/lib/cli-installers.d.ts +9 -2
- package/dist/lib/command-miss.js +107 -0
- package/dist/lib/commitment-loop-status.js +25 -3
- package/dist/lib/commitment-product.js +5 -2
- package/dist/lib/commitments.d.ts +45 -3
- package/dist/lib/commitments.js +139 -41
- package/dist/lib/compasses.d.ts +4 -0
- package/dist/lib/compasses.js +11 -0
- package/dist/lib/daemon-machine-identity-copy.d.ts +14 -0
- package/dist/lib/daemon-machine-identity-copy.js +27 -0
- package/dist/lib/daemon-machine-identity.d.ts +27 -0
- package/dist/lib/daemon-machine-identity.js +61 -0
- package/dist/lib/daemon-setup.js +7 -7
- package/dist/lib/daemonHandoff.d.ts +19 -1
- package/dist/lib/daemonHandoff.js +62 -2
- package/dist/lib/dedicated-ssh.d.ts +2 -0
- package/dist/lib/dedicated-ssh.js +98 -28
- package/dist/lib/harnesses.d.ts +71 -0
- package/dist/lib/harnesses.js +70 -0
- package/dist/lib/json-output.d.ts +33 -0
- package/dist/lib/json-output.js +37 -0
- package/dist/lib/list-output.d.ts +9 -4
- package/dist/lib/list-output.js +38 -9
- package/dist/lib/lookbackPlans.d.ts +13 -0
- package/dist/lib/lookbackPlans.js +68 -0
- package/dist/lib/machines.d.ts +27 -6
- package/dist/lib/machines.js +25 -14
- package/dist/lib/member-output.d.ts +20 -0
- package/dist/lib/member-output.js +57 -0
- package/dist/lib/preflight-copy.d.ts +7 -0
- package/dist/lib/preflight-copy.js +31 -0
- package/dist/lib/profile-machine-identity-guard.js +11 -1
- package/dist/lib/roles.d.ts +2 -2
- package/dist/lib/task-admission.d.ts +9 -0
- package/dist/lib/task-admission.js +35 -0
- package/dist/lib/task-batch.d.ts +4 -0
- package/dist/lib/task-batch.js +2 -0
- package/dist/lib/task-economics.d.ts +10 -0
- package/dist/lib/task-economics.js +24 -2
- package/dist/lib/task-operations.d.ts +25 -0
- package/dist/lib/task-operations.js +123 -0
- package/dist/lib/task-preflight.d.ts +35 -0
- package/dist/lib/task-preflight.js +121 -0
- package/dist/lib/task-resource-references.d.ts +23 -0
- package/dist/lib/task-resource-references.js +119 -0
- package/dist/lib/task-spec-verification.d.ts +42 -0
- package/dist/lib/task-spec-verification.js +101 -0
- package/dist/lib/task-work.d.ts +11 -0
- package/dist/lib/task-work.js +41 -0
- package/dist/lib/task-write-attribution.d.ts +26 -0
- package/dist/lib/task-write-attribution.js +47 -0
- package/dist/lib/tasks.d.ts +13 -0
- package/dist/lib/tasks.js +61 -8
- package/dist/lib/triggers.d.ts +18 -0
- package/dist/lib/triggers.js +97 -5
- package/dist/lib/usage-discovery.d.ts +4 -0
- package/dist/lib/usage-discovery.js +14 -4
- package/dist/lib/widgetApps.d.ts +10 -0
- package/dist/lib/widgetApps.js +47 -0
- package/dist/lib/widgetStaticScan.js +25 -1
- package/dist/lib/workflow-run-view.d.ts +4 -0
- package/dist/lib/workflow-run-view.js +5 -0
- package/dist/lib/workspaces.d.ts +33 -9
- package/dist/lib/workspaces.js +19 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerWire.d.ts +14 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerWire.js +47 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonToolApproval.d.ts +49 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonToolApproval.js +26 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.d.ts +118 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +614 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +5 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.d.ts +60 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.js +130 -6
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.d.ts +2 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +15 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refreshClassification.d.ts +5 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refreshClassification.js +3 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/sessionRevocation.d.ts +177 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/sessionRevocation.js +484 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/telemetryRedaction.d.ts +11 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/telemetryRedaction.js +46 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.d.ts +232 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +372 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/types.d.ts +17 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/types.js +12 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerWire.d.ts +14 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerWire.js +45 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonToolApproval.d.ts +49 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonToolApproval.js +24 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.d.ts +118 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +608 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.d.ts +60 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.js +128 -6
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.d.ts +2 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +15 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refreshClassification.d.ts +5 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refreshClassification.js +3 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/sessionRevocation.d.ts +177 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/sessionRevocation.js +472 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/telemetryRedaction.d.ts +11 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/telemetryRedaction.js +44 -6
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.d.ts +232 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +360 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/types.d.ts +17 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/types.js +12 -1
- package/dist/node_modules/@skrr-ai/auth-core/package.json +31 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +25255 -18711
- package/docs/v1/operations.md +52 -0
- package/docs/v1/space-search.md +19 -0
- package/oclif.manifest.json +4843 -513
- package/package.json +32 -2
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { type KeyObject } from 'node:crypto';
|
|
2
|
+
import { type AttestedToolApprovalRefusalReason } from './daemonToolApproval.js';
|
|
3
|
+
/**
|
|
4
|
+
* Platform-signed tool approvals (OSK-16614) — attestation v2.
|
|
5
|
+
*
|
|
6
|
+
* v1 (`daemonToolApproval.ts`) is a plain JSON object whose authority is the
|
|
7
|
+
* channel it arrived on. That stops the MODEL approving itself, and nothing
|
|
8
|
+
* else: anything that can put a `daemon:tool:request` on the daemon's channel
|
|
9
|
+
* — a websocket or SSE layer bug, a relay, the Redis pub/sub bridge the
|
|
10
|
+
* request crosses, an injected event, a peer holding a stolen daemon session
|
|
11
|
+
* — can approve any `manual`-category call by writing the field.
|
|
12
|
+
*
|
|
13
|
+
* v2 is `{v: 2, payload, kid, sig}`: an Ed25519 signature by a platform
|
|
14
|
+
* approval key over the canonical JSON `payload`, which carries the v1 claims
|
|
15
|
+
* plus the `daemonId` and `sessionId` it was minted for. The daemon verifies
|
|
16
|
+
* it against a keyset it PINNED outside the approval decision (fetched over
|
|
17
|
+
* authenticated HTTPS, TOFU, per server origin) and that only changes through
|
|
18
|
+
* a keyset signed by a key it already trusts.
|
|
19
|
+
*
|
|
20
|
+
* What it stops: every writer to the channel that cannot reach the signing
|
|
21
|
+
* key. What it does NOT stop: a fully compromised API host with access to the
|
|
22
|
+
* key, or server code that mints without a person having answered — the key
|
|
23
|
+
* says "the platform says a person approved this call", not that one did.
|
|
24
|
+
* Only an approval signed by the approving person's own device closes that,
|
|
25
|
+
* and that is the long-term target this format is shaped for (a second key
|
|
26
|
+
* class in the same keyset), not something it claims today.
|
|
27
|
+
*
|
|
28
|
+
* Pure: node:crypto only, no schema library (auth-core is schema-free), no
|
|
29
|
+
* I/O. Where the keyset is stored and how it is fetched is the daemon's
|
|
30
|
+
* (`daemon/src/permissions/approval-keyset.ts`); where the private key lives
|
|
31
|
+
* is the server's (`api/server/utils/toolApprovalSigning.js`).
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Announced by a daemon that holds a pinned approval keyset and therefore
|
|
35
|
+
* verifies v2. The daemon announces it ONLY while pinned — positive
|
|
36
|
+
* withholding on its side too — and the server mints v2 only for a daemon
|
|
37
|
+
* that announced it, v1 otherwise.
|
|
38
|
+
*/
|
|
39
|
+
export declare const TOOL_APPROVAL_SIGNED_CAPABILITY = "tool_approval_signed_v1";
|
|
40
|
+
/**
|
|
41
|
+
* One public approval key. Same encoding as the release keys
|
|
42
|
+
* (`releaseKeys.ts`): base64 DER-SPKI Ed25519.
|
|
43
|
+
*/
|
|
44
|
+
export interface ApprovalPublicKey {
|
|
45
|
+
kid: string;
|
|
46
|
+
publicKeySpkiB64: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ApprovalSigner {
|
|
49
|
+
kid: string;
|
|
50
|
+
privateKey: KeyObject;
|
|
51
|
+
}
|
|
52
|
+
/** Derive the wire public key from a private (or public) Ed25519 KeyObject. */
|
|
53
|
+
export declare function approvalPublicKeyFromKeyObject(kid: string, key: KeyObject): ApprovalPublicKey;
|
|
54
|
+
/**
|
|
55
|
+
* The set of approval keys a daemon trusts for one server origin. `seq` only
|
|
56
|
+
* ever rises: a daemon refuses a keyset older than the one it pinned, so a
|
|
57
|
+
* retired (possibly compromised) key cannot be brought back by replaying the
|
|
58
|
+
* keyset that still listed it.
|
|
59
|
+
*/
|
|
60
|
+
export interface ApprovalKeyset {
|
|
61
|
+
v: 1;
|
|
62
|
+
seq: number;
|
|
63
|
+
keys: ApprovalPublicKey[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* What the server serves and the daemon pins. `keyset` is the canonical JSON
|
|
67
|
+
* TEXT of an `ApprovalKeyset`: signatures are over these exact bytes, so the
|
|
68
|
+
* verifier never has to re-serialize to check one. Each signature names the
|
|
69
|
+
* key that made it; a keyset is normally signed by every key it lists (that is
|
|
70
|
+
* what lets a daemon pinning only the old key accept the set that adds the new
|
|
71
|
+
* one), plus any offline root endorsements.
|
|
72
|
+
*/
|
|
73
|
+
export interface ApprovalKeysetDocument {
|
|
74
|
+
keyset: string;
|
|
75
|
+
signatures: Array<{
|
|
76
|
+
kid: string;
|
|
77
|
+
sig: string;
|
|
78
|
+
}>;
|
|
79
|
+
}
|
|
80
|
+
/** Canonical keyset text: keys sorted by kid, canonical JSON. */
|
|
81
|
+
export declare function canonicalApprovalKeysetText(keyset: ApprovalKeyset): string;
|
|
82
|
+
/**
|
|
83
|
+
* Server side: the document for a keyring. Every signer signs, and every
|
|
84
|
+
* signer's public key is listed. `endorsements` are signatures made OFFLINE
|
|
85
|
+
* over the same canonical text by a root key the daemon may have embedded
|
|
86
|
+
* (see `verifyApprovalKeysetDocument`'s `anchors`); the text is deterministic
|
|
87
|
+
* — no timestamp — precisely so an endorsement can be made ahead of time.
|
|
88
|
+
*/
|
|
89
|
+
export declare function buildApprovalKeysetDocument(args: {
|
|
90
|
+
seq: number;
|
|
91
|
+
signers: ApprovalSigner[];
|
|
92
|
+
endorsements?: Array<{
|
|
93
|
+
kid: string;
|
|
94
|
+
sig: string;
|
|
95
|
+
}>;
|
|
96
|
+
}): ApprovalKeysetDocument;
|
|
97
|
+
/** Sign keyset text with one key — for an offline root endorsement. */
|
|
98
|
+
export declare function endorseApprovalKeysetText(keysetText: string, signer: ApprovalSigner): {
|
|
99
|
+
kid: string;
|
|
100
|
+
sig: string;
|
|
101
|
+
};
|
|
102
|
+
/** Parse and validate keyset text. Null when it is not a well-formed keyset. */
|
|
103
|
+
export declare function parseApprovalKeysetText(text: unknown): ApprovalKeyset | null;
|
|
104
|
+
/**
|
|
105
|
+
* Why a keyset document was not adopted. Internal-only (daemon log and the
|
|
106
|
+
* `skrrd status` approvals line's last-refresh note), never a person's action
|
|
107
|
+
* except through the runbook in daemon/CLAUDE.md:
|
|
108
|
+
* - `malformed` — not a keyset document
|
|
109
|
+
* - `untrusted` — no valid signature by a key the daemon already trusts (a
|
|
110
|
+
* pinned key or an embedded root), or, for a first pin with no
|
|
111
|
+
* anchor, not even self-signed
|
|
112
|
+
* - `rollback` — `seq` is lower than the pinned keyset's
|
|
113
|
+
* - `conflict` — same `seq` as the pinned keyset with different keys
|
|
114
|
+
*/
|
|
115
|
+
export type ApprovalKeysetRefusalReason = 'malformed' | 'untrusted' | 'rollback' | 'conflict';
|
|
116
|
+
export type ApprovalKeysetVerdict = {
|
|
117
|
+
ok: true;
|
|
118
|
+
keyset: ApprovalKeyset;
|
|
119
|
+
/** The canonical text to pin. */
|
|
120
|
+
text: string;
|
|
121
|
+
/** `first_pin` (TOFU or root-anchored), `rotated`, or `unchanged`. */
|
|
122
|
+
change: 'first_pin' | 'rotated' | 'unchanged';
|
|
123
|
+
} | {
|
|
124
|
+
ok: false;
|
|
125
|
+
reason: ApprovalKeysetRefusalReason;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Daemon side: decide whether to adopt a keyset document.
|
|
129
|
+
*
|
|
130
|
+
* - Pinned: at least one signature must verify under a key in the PINNED set
|
|
131
|
+
* (or an anchor). The new set may drop or add keys — that is rotation — but
|
|
132
|
+
* its `seq` may not fall, and the same `seq` must be the same set.
|
|
133
|
+
* - Not pinned, anchors given (an embedded root for this server origin): at
|
|
134
|
+
* least one signature must verify under an anchor. No TOFU.
|
|
135
|
+
* - Not pinned, no anchors: trust on first use. The document must still be
|
|
136
|
+
* signed by a key it lists (proof that whoever served it holds one), but
|
|
137
|
+
* its authority is the authenticated HTTPS fetch it came from.
|
|
138
|
+
*
|
|
139
|
+
* A signature is checked against the TRUSTED copy of a key, looked up by kid —
|
|
140
|
+
* never against the key the new document lists under that kid, or a document
|
|
141
|
+
* could swap a key's bytes while keeping its name.
|
|
142
|
+
*/
|
|
143
|
+
export declare function verifyApprovalKeysetDocument(doc: unknown, trust: {
|
|
144
|
+
pinned: ApprovalKeyset | null;
|
|
145
|
+
anchors?: readonly ApprovalPublicKey[];
|
|
146
|
+
}): ApprovalKeysetVerdict;
|
|
147
|
+
export interface SignedToolApprovalPayload {
|
|
148
|
+
v: 2;
|
|
149
|
+
toolUseId: string;
|
|
150
|
+
toolName: string;
|
|
151
|
+
/** SHA-256 of the canonical tool input (`canonicalToolInputDigest`). */
|
|
152
|
+
inputSha256: string;
|
|
153
|
+
decidedBy: 'user';
|
|
154
|
+
/** The daemon this approval was minted for — another daemon refuses it. */
|
|
155
|
+
daemonId: string;
|
|
156
|
+
/** The agent session the call belongs to. */
|
|
157
|
+
sessionId: string;
|
|
158
|
+
issuedAt: number;
|
|
159
|
+
expiresAt: number;
|
|
160
|
+
}
|
|
161
|
+
export interface SignedToolApproval {
|
|
162
|
+
v: 2;
|
|
163
|
+
/** Canonical JSON text of a `SignedToolApprovalPayload` — the signed bytes. */
|
|
164
|
+
payload: string;
|
|
165
|
+
kid: string;
|
|
166
|
+
/** base64 Ed25519 signature over the domain prefix + `payload`. */
|
|
167
|
+
sig: string;
|
|
168
|
+
}
|
|
169
|
+
/** Server side: mint and sign a v2 attestation after a person approved THIS call. */
|
|
170
|
+
export declare function signToolApproval(args: {
|
|
171
|
+
toolUseId: string;
|
|
172
|
+
toolName: string;
|
|
173
|
+
toolInput: unknown;
|
|
174
|
+
daemonId: string;
|
|
175
|
+
sessionId: string;
|
|
176
|
+
signer: ApprovalSigner;
|
|
177
|
+
now?: number;
|
|
178
|
+
ttlMs?: number;
|
|
179
|
+
}): SignedToolApproval;
|
|
180
|
+
export interface SignedToolApprovalCall {
|
|
181
|
+
toolUseId: string;
|
|
182
|
+
toolName: string;
|
|
183
|
+
toolInput: unknown;
|
|
184
|
+
/** The verifying daemon's own id. */
|
|
185
|
+
daemonId: string;
|
|
186
|
+
/** The session the request says it belongs to. */
|
|
187
|
+
sessionId: string;
|
|
188
|
+
now?: number;
|
|
189
|
+
}
|
|
190
|
+
export type SignedToolApprovalVerdict = {
|
|
191
|
+
ok: true;
|
|
192
|
+
toolUseId: string;
|
|
193
|
+
expiresAt: number;
|
|
194
|
+
} | {
|
|
195
|
+
ok: false;
|
|
196
|
+
reason: AttestedToolApprovalRefusalReason;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Daemon side: verify a v2 attestation against the pinned keyset and the call.
|
|
200
|
+
* Order matters: nothing in the payload is READ until the signature verified
|
|
201
|
+
* under a pinned key, so an unsigned claim can never pick which check runs.
|
|
202
|
+
*/
|
|
203
|
+
export declare function verifySignedToolApproval(approval: unknown, call: SignedToolApprovalCall, keyset: ApprovalKeyset): SignedToolApprovalVerdict;
|
|
204
|
+
/**
|
|
205
|
+
* Where the verifying daemon stands with the platform's approval keyset.
|
|
206
|
+
* `unreadable` is its own state, not `unpinned`: a pin file that exists and
|
|
207
|
+
* cannot be read must not quietly re-open the unsigned path.
|
|
208
|
+
*/
|
|
209
|
+
export type ApprovalKeysetPinState = {
|
|
210
|
+
state: 'pinned';
|
|
211
|
+
keyset: ApprovalKeyset;
|
|
212
|
+
} | {
|
|
213
|
+
state: 'unpinned';
|
|
214
|
+
} | {
|
|
215
|
+
state: 'unreadable';
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Daemon side: THE decision for any attestation, whatever version arrived.
|
|
219
|
+
*
|
|
220
|
+
* - pinned → only v2 verified against the pinned keyset approves; v1 is
|
|
221
|
+
* refused as `unsigned` (downgrade protection).
|
|
222
|
+
* - unpinned → legacy: v1 is verified exactly as before; v2 is refused as
|
|
223
|
+
* `unpinned` (nothing here could check it — the server should
|
|
224
|
+
* not have sent it, since this daemon did not announce
|
|
225
|
+
* `tool_approval_signed_v1`).
|
|
226
|
+
* - unreadable → nothing approves.
|
|
227
|
+
*
|
|
228
|
+
* Returns the claims the spend-once ledger keys on when it approves.
|
|
229
|
+
*/
|
|
230
|
+
export declare function verifyToolApprovalAttestation(approval: unknown, call: SignedToolApprovalCall, pin: ApprovalKeysetPinState): SignedToolApprovalVerdict & {
|
|
231
|
+
signed?: boolean;
|
|
232
|
+
};
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TOOL_APPROVAL_SIGNED_CAPABILITY = void 0;
|
|
4
|
+
exports.approvalPublicKeyFromKeyObject = approvalPublicKeyFromKeyObject;
|
|
5
|
+
exports.canonicalApprovalKeysetText = canonicalApprovalKeysetText;
|
|
6
|
+
exports.buildApprovalKeysetDocument = buildApprovalKeysetDocument;
|
|
7
|
+
exports.endorseApprovalKeysetText = endorseApprovalKeysetText;
|
|
8
|
+
exports.parseApprovalKeysetText = parseApprovalKeysetText;
|
|
9
|
+
exports.verifyApprovalKeysetDocument = verifyApprovalKeysetDocument;
|
|
10
|
+
exports.signToolApproval = signToolApproval;
|
|
11
|
+
exports.verifySignedToolApproval = verifySignedToolApproval;
|
|
12
|
+
exports.verifyToolApprovalAttestation = verifyToolApprovalAttestation;
|
|
13
|
+
const node_crypto_1 = require("node:crypto");
|
|
14
|
+
const daemonToolApproval_js_1 = require("./daemonToolApproval.js");
|
|
15
|
+
/**
|
|
16
|
+
* Platform-signed tool approvals (OSK-16614) — attestation v2.
|
|
17
|
+
*
|
|
18
|
+
* v1 (`daemonToolApproval.ts`) is a plain JSON object whose authority is the
|
|
19
|
+
* channel it arrived on. That stops the MODEL approving itself, and nothing
|
|
20
|
+
* else: anything that can put a `daemon:tool:request` on the daemon's channel
|
|
21
|
+
* — a websocket or SSE layer bug, a relay, the Redis pub/sub bridge the
|
|
22
|
+
* request crosses, an injected event, a peer holding a stolen daemon session
|
|
23
|
+
* — can approve any `manual`-category call by writing the field.
|
|
24
|
+
*
|
|
25
|
+
* v2 is `{v: 2, payload, kid, sig}`: an Ed25519 signature by a platform
|
|
26
|
+
* approval key over the canonical JSON `payload`, which carries the v1 claims
|
|
27
|
+
* plus the `daemonId` and `sessionId` it was minted for. The daemon verifies
|
|
28
|
+
* it against a keyset it PINNED outside the approval decision (fetched over
|
|
29
|
+
* authenticated HTTPS, TOFU, per server origin) and that only changes through
|
|
30
|
+
* a keyset signed by a key it already trusts.
|
|
31
|
+
*
|
|
32
|
+
* What it stops: every writer to the channel that cannot reach the signing
|
|
33
|
+
* key. What it does NOT stop: a fully compromised API host with access to the
|
|
34
|
+
* key, or server code that mints without a person having answered — the key
|
|
35
|
+
* says "the platform says a person approved this call", not that one did.
|
|
36
|
+
* Only an approval signed by the approving person's own device closes that,
|
|
37
|
+
* and that is the long-term target this format is shaped for (a second key
|
|
38
|
+
* class in the same keyset), not something it claims today.
|
|
39
|
+
*
|
|
40
|
+
* Pure: node:crypto only, no schema library (auth-core is schema-free), no
|
|
41
|
+
* I/O. Where the keyset is stored and how it is fetched is the daemon's
|
|
42
|
+
* (`daemon/src/permissions/approval-keyset.ts`); where the private key lives
|
|
43
|
+
* is the server's (`api/server/utils/toolApprovalSigning.js`).
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* Announced by a daemon that holds a pinned approval keyset and therefore
|
|
47
|
+
* verifies v2. The daemon announces it ONLY while pinned — positive
|
|
48
|
+
* withholding on its side too — and the server mints v2 only for a daemon
|
|
49
|
+
* that announced it, v1 otherwise.
|
|
50
|
+
*/
|
|
51
|
+
exports.TOOL_APPROVAL_SIGNED_CAPABILITY = 'tool_approval_signed_v1';
|
|
52
|
+
/**
|
|
53
|
+
* Domain separation: the signed bytes are prefixed, so a signature made for
|
|
54
|
+
* an attestation can never verify as a keyset or vice versa, whatever JSON
|
|
55
|
+
* either happens to contain.
|
|
56
|
+
*/
|
|
57
|
+
const ATTESTATION_SIGNING_DOMAIN = 'skrr-tool-approval-v2\n';
|
|
58
|
+
const KEYSET_SIGNING_DOMAIN = 'skrr-tool-approval-keyset-v1\n';
|
|
59
|
+
/** A key id: short, printable, and safe to put in a log line. */
|
|
60
|
+
const KID_PATTERN = /^[A-Za-z0-9._-]{1,64}$/;
|
|
61
|
+
/** Bounds on untrusted wire input, so a hostile document cannot cost much. */
|
|
62
|
+
const MAX_PAYLOAD_BYTES = 4096;
|
|
63
|
+
const MAX_KEYSET_BYTES = 16 * 1024;
|
|
64
|
+
const MAX_KEYSET_KEYS = 16;
|
|
65
|
+
const MAX_KEYSET_SIGNATURES = 16;
|
|
66
|
+
/** Derive the wire public key from a private (or public) Ed25519 KeyObject. */
|
|
67
|
+
function approvalPublicKeyFromKeyObject(kid, key) {
|
|
68
|
+
const publicKey = key.type === 'private' ? (0, node_crypto_1.createPublicKey)(key) : key;
|
|
69
|
+
const der = publicKey.export({ format: 'der', type: 'spki' });
|
|
70
|
+
return { kid, publicKeySpkiB64: Buffer.from(der).toString('base64') };
|
|
71
|
+
}
|
|
72
|
+
function ed25519PublicKey(publicKeySpkiB64) {
|
|
73
|
+
try {
|
|
74
|
+
const key = (0, node_crypto_1.createPublicKey)({
|
|
75
|
+
key: Buffer.from(publicKeySpkiB64, 'base64'),
|
|
76
|
+
format: 'der',
|
|
77
|
+
type: 'spki',
|
|
78
|
+
});
|
|
79
|
+
return key.asymmetricKeyType === 'ed25519' ? key : null;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function verifySignature(domain, message, sigB64, key) {
|
|
86
|
+
try {
|
|
87
|
+
const sig = Buffer.from(sigB64, 'base64');
|
|
88
|
+
// An Ed25519 signature is exactly 64 bytes; anything else is not one, and
|
|
89
|
+
// base64 decoding is lenient enough that the check is worth making.
|
|
90
|
+
if (sig.length !== 64)
|
|
91
|
+
return false;
|
|
92
|
+
return (0, node_crypto_1.verify)(null, Buffer.from(domain + message, 'utf8'), key, sig);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function signMessage(domain, message, privateKey) {
|
|
99
|
+
return (0, node_crypto_1.sign)(null, Buffer.from(domain + message, 'utf8'), privateKey).toString('base64');
|
|
100
|
+
}
|
|
101
|
+
/** Code-unit order: the same on every runtime, unlike `localeCompare`. */
|
|
102
|
+
function compareKid(a, b) {
|
|
103
|
+
if (a === b)
|
|
104
|
+
return 0;
|
|
105
|
+
return a < b ? -1 : 1;
|
|
106
|
+
}
|
|
107
|
+
/** Canonical keyset text: keys sorted by kid, canonical JSON. */
|
|
108
|
+
function canonicalApprovalKeysetText(keyset) {
|
|
109
|
+
const keys = [...keyset.keys]
|
|
110
|
+
.map((k) => ({ kid: k.kid, publicKeySpkiB64: k.publicKeySpkiB64 }))
|
|
111
|
+
.sort((a, b) => compareKid(a.kid, b.kid));
|
|
112
|
+
return (0, daemonToolApproval_js_1.canonicalApprovalJson)({ v: 1, seq: keyset.seq, keys });
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Server side: the document for a keyring. Every signer signs, and every
|
|
116
|
+
* signer's public key is listed. `endorsements` are signatures made OFFLINE
|
|
117
|
+
* over the same canonical text by a root key the daemon may have embedded
|
|
118
|
+
* (see `verifyApprovalKeysetDocument`'s `anchors`); the text is deterministic
|
|
119
|
+
* — no timestamp — precisely so an endorsement can be made ahead of time.
|
|
120
|
+
*/
|
|
121
|
+
function buildApprovalKeysetDocument(args) {
|
|
122
|
+
const keyset = canonicalApprovalKeysetText({
|
|
123
|
+
v: 1,
|
|
124
|
+
seq: args.seq,
|
|
125
|
+
keys: args.signers.map((s) => approvalPublicKeyFromKeyObject(s.kid, s.privateKey)),
|
|
126
|
+
});
|
|
127
|
+
return {
|
|
128
|
+
keyset,
|
|
129
|
+
signatures: [
|
|
130
|
+
...args.signers.map((s) => ({
|
|
131
|
+
kid: s.kid,
|
|
132
|
+
sig: signMessage(KEYSET_SIGNING_DOMAIN, keyset, s.privateKey),
|
|
133
|
+
})),
|
|
134
|
+
...(args.endorsements ?? []),
|
|
135
|
+
],
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/** Sign keyset text with one key — for an offline root endorsement. */
|
|
139
|
+
function endorseApprovalKeysetText(keysetText, signer) {
|
|
140
|
+
return {
|
|
141
|
+
kid: signer.kid,
|
|
142
|
+
sig: signMessage(KEYSET_SIGNING_DOMAIN, keysetText, signer.privateKey),
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/** Parse and validate keyset text. Null when it is not a well-formed keyset. */
|
|
146
|
+
function parseApprovalKeysetText(text) {
|
|
147
|
+
if (typeof text !== 'string' || text.length === 0 || text.length > MAX_KEYSET_BYTES) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
let parsed;
|
|
151
|
+
try {
|
|
152
|
+
parsed = JSON.parse(text);
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
158
|
+
return null;
|
|
159
|
+
const p = parsed;
|
|
160
|
+
if (p.v !== 1 || !Number.isSafeInteger(p.seq) || p.seq < 1)
|
|
161
|
+
return null;
|
|
162
|
+
if (!Array.isArray(p.keys) || p.keys.length === 0 || p.keys.length > MAX_KEYSET_KEYS) {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
const keys = [];
|
|
166
|
+
const seen = new Set();
|
|
167
|
+
for (const entry of p.keys) {
|
|
168
|
+
if (!entry || typeof entry !== 'object')
|
|
169
|
+
return null;
|
|
170
|
+
const { kid, publicKeySpkiB64 } = entry;
|
|
171
|
+
if (typeof kid !== 'string' || !KID_PATTERN.test(kid) || seen.has(kid))
|
|
172
|
+
return null;
|
|
173
|
+
if (typeof publicKeySpkiB64 !== 'string' || !ed25519PublicKey(publicKeySpkiB64))
|
|
174
|
+
return null;
|
|
175
|
+
seen.add(kid);
|
|
176
|
+
keys.push({ kid, publicKeySpkiB64 });
|
|
177
|
+
}
|
|
178
|
+
const keyset = { v: 1, seq: p.seq, keys };
|
|
179
|
+
// One byte representation per keyset: a pinned keyset is compared by its
|
|
180
|
+
// text, so a non-canonical spelling of the same keys must not read as a
|
|
181
|
+
// different set (or the same seq would look like a conflict).
|
|
182
|
+
return canonicalApprovalKeysetText(keyset) === text ? keyset : null;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Daemon side: decide whether to adopt a keyset document.
|
|
186
|
+
*
|
|
187
|
+
* - Pinned: at least one signature must verify under a key in the PINNED set
|
|
188
|
+
* (or an anchor). The new set may drop or add keys — that is rotation — but
|
|
189
|
+
* its `seq` may not fall, and the same `seq` must be the same set.
|
|
190
|
+
* - Not pinned, anchors given (an embedded root for this server origin): at
|
|
191
|
+
* least one signature must verify under an anchor. No TOFU.
|
|
192
|
+
* - Not pinned, no anchors: trust on first use. The document must still be
|
|
193
|
+
* signed by a key it lists (proof that whoever served it holds one), but
|
|
194
|
+
* its authority is the authenticated HTTPS fetch it came from.
|
|
195
|
+
*
|
|
196
|
+
* A signature is checked against the TRUSTED copy of a key, looked up by kid —
|
|
197
|
+
* never against the key the new document lists under that kid, or a document
|
|
198
|
+
* could swap a key's bytes while keeping its name.
|
|
199
|
+
*/
|
|
200
|
+
function verifyApprovalKeysetDocument(doc, trust) {
|
|
201
|
+
if (!doc || typeof doc !== 'object' || Array.isArray(doc)) {
|
|
202
|
+
return { ok: false, reason: 'malformed' };
|
|
203
|
+
}
|
|
204
|
+
const d = doc;
|
|
205
|
+
const keyset = parseApprovalKeysetText(d.keyset);
|
|
206
|
+
if (!keyset)
|
|
207
|
+
return { ok: false, reason: 'malformed' };
|
|
208
|
+
const text = d.keyset;
|
|
209
|
+
if (!Array.isArray(d.signatures) ||
|
|
210
|
+
d.signatures.length === 0 ||
|
|
211
|
+
d.signatures.length > MAX_KEYSET_SIGNATURES) {
|
|
212
|
+
return { ok: false, reason: 'malformed' };
|
|
213
|
+
}
|
|
214
|
+
// A list, not a map: an anchor and a pinned key that share a kid are both
|
|
215
|
+
// tried, so neither can shadow the other.
|
|
216
|
+
let trusted = [
|
|
217
|
+
...(trust.anchors ?? []),
|
|
218
|
+
...(trust.pinned?.keys ?? []),
|
|
219
|
+
];
|
|
220
|
+
if (trusted.length === 0)
|
|
221
|
+
trusted = keyset.keys;
|
|
222
|
+
const signed = d.signatures.some((entry) => {
|
|
223
|
+
if (!entry || typeof entry !== 'object')
|
|
224
|
+
return false;
|
|
225
|
+
const { kid, sig } = entry;
|
|
226
|
+
if (typeof kid !== 'string' || typeof sig !== 'string')
|
|
227
|
+
return false;
|
|
228
|
+
return trusted.some((k) => {
|
|
229
|
+
if (k.kid !== kid)
|
|
230
|
+
return false;
|
|
231
|
+
const key = ed25519PublicKey(k.publicKeySpkiB64);
|
|
232
|
+
return key ? verifySignature(KEYSET_SIGNING_DOMAIN, text, sig, key) : false;
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
if (!signed)
|
|
236
|
+
return { ok: false, reason: 'untrusted' };
|
|
237
|
+
if (!trust.pinned)
|
|
238
|
+
return { ok: true, keyset, text, change: 'first_pin' };
|
|
239
|
+
if (keyset.seq < trust.pinned.seq)
|
|
240
|
+
return { ok: false, reason: 'rollback' };
|
|
241
|
+
if (keyset.seq === trust.pinned.seq) {
|
|
242
|
+
return canonicalApprovalKeysetText(trust.pinned) === text
|
|
243
|
+
? { ok: true, keyset, text, change: 'unchanged' }
|
|
244
|
+
: { ok: false, reason: 'conflict' };
|
|
245
|
+
}
|
|
246
|
+
return { ok: true, keyset, text, change: 'rotated' };
|
|
247
|
+
}
|
|
248
|
+
/** Server side: mint and sign a v2 attestation after a person approved THIS call. */
|
|
249
|
+
function signToolApproval(args) {
|
|
250
|
+
const now = args.now ?? Date.now();
|
|
251
|
+
const payload = {
|
|
252
|
+
v: 2,
|
|
253
|
+
toolUseId: args.toolUseId,
|
|
254
|
+
toolName: args.toolName,
|
|
255
|
+
inputSha256: (0, daemonToolApproval_js_1.canonicalToolInputDigest)(args.toolInput),
|
|
256
|
+
decidedBy: 'user',
|
|
257
|
+
daemonId: args.daemonId,
|
|
258
|
+
sessionId: args.sessionId,
|
|
259
|
+
issuedAt: now,
|
|
260
|
+
expiresAt: now + (args.ttlMs ?? daemonToolApproval_js_1.ATTESTED_TOOL_APPROVAL_TTL_MS),
|
|
261
|
+
};
|
|
262
|
+
const text = (0, daemonToolApproval_js_1.canonicalApprovalJson)(payload);
|
|
263
|
+
return {
|
|
264
|
+
v: 2,
|
|
265
|
+
payload: text,
|
|
266
|
+
kid: args.signer.kid,
|
|
267
|
+
sig: signMessage(ATTESTATION_SIGNING_DOMAIN, text, args.signer.privateKey),
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Daemon side: verify a v2 attestation against the pinned keyset and the call.
|
|
272
|
+
* Order matters: nothing in the payload is READ until the signature verified
|
|
273
|
+
* under a pinned key, so an unsigned claim can never pick which check runs.
|
|
274
|
+
*/
|
|
275
|
+
function verifySignedToolApproval(approval, call, keyset) {
|
|
276
|
+
if (approval === undefined || approval === null)
|
|
277
|
+
return { ok: false, reason: 'absent' };
|
|
278
|
+
if (typeof approval !== 'object' || Array.isArray(approval)) {
|
|
279
|
+
return { ok: false, reason: 'malformed' };
|
|
280
|
+
}
|
|
281
|
+
const a = approval;
|
|
282
|
+
if (a.v !== 2 ||
|
|
283
|
+
typeof a.payload !== 'string' ||
|
|
284
|
+
a.payload.length > MAX_PAYLOAD_BYTES ||
|
|
285
|
+
typeof a.kid !== 'string' ||
|
|
286
|
+
typeof a.sig !== 'string') {
|
|
287
|
+
return { ok: false, reason: 'malformed' };
|
|
288
|
+
}
|
|
289
|
+
const pinnedKey = keyset.keys.find((k) => k.kid === a.kid);
|
|
290
|
+
const key = pinnedKey ? ed25519PublicKey(pinnedKey.publicKeySpkiB64) : null;
|
|
291
|
+
if (!key)
|
|
292
|
+
return { ok: false, reason: 'unknown_key' };
|
|
293
|
+
if (!verifySignature(ATTESTATION_SIGNING_DOMAIN, a.payload, a.sig, key)) {
|
|
294
|
+
return { ok: false, reason: 'signature' };
|
|
295
|
+
}
|
|
296
|
+
let parsed;
|
|
297
|
+
try {
|
|
298
|
+
parsed = JSON.parse(a.payload);
|
|
299
|
+
}
|
|
300
|
+
catch {
|
|
301
|
+
return { ok: false, reason: 'malformed' };
|
|
302
|
+
}
|
|
303
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
304
|
+
return { ok: false, reason: 'malformed' };
|
|
305
|
+
}
|
|
306
|
+
const p = parsed;
|
|
307
|
+
if (p.v !== 2 ||
|
|
308
|
+
typeof p.toolUseId !== 'string' ||
|
|
309
|
+
typeof p.toolName !== 'string' ||
|
|
310
|
+
typeof p.inputSha256 !== 'string' ||
|
|
311
|
+
p.decidedBy !== 'user' ||
|
|
312
|
+
typeof p.daemonId !== 'string' ||
|
|
313
|
+
typeof p.sessionId !== 'string' ||
|
|
314
|
+
typeof p.issuedAt !== 'number' ||
|
|
315
|
+
typeof p.expiresAt !== 'number') {
|
|
316
|
+
return { ok: false, reason: 'malformed' };
|
|
317
|
+
}
|
|
318
|
+
// A signed approval for another daemon (or another session on this one) is
|
|
319
|
+
// a valid signature over the wrong question. Checked before freshness so the
|
|
320
|
+
// log says WHICH wrong question when both are wrong.
|
|
321
|
+
if (!call.daemonId ||
|
|
322
|
+
p.daemonId !== call.daemonId ||
|
|
323
|
+
!call.sessionId ||
|
|
324
|
+
p.sessionId !== call.sessionId) {
|
|
325
|
+
return { ok: false, reason: 'daemon_binding' };
|
|
326
|
+
}
|
|
327
|
+
const claims = (0, daemonToolApproval_js_1.verifyAttestedToolApprovalClaims)({
|
|
328
|
+
toolUseId: p.toolUseId,
|
|
329
|
+
toolName: p.toolName,
|
|
330
|
+
inputSha256: p.inputSha256,
|
|
331
|
+
issuedAt: p.issuedAt,
|
|
332
|
+
expiresAt: p.expiresAt,
|
|
333
|
+
}, call);
|
|
334
|
+
if (!claims.ok)
|
|
335
|
+
return claims;
|
|
336
|
+
return { ok: true, toolUseId: p.toolUseId, expiresAt: p.expiresAt };
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Daemon side: THE decision for any attestation, whatever version arrived.
|
|
340
|
+
*
|
|
341
|
+
* - pinned → only v2 verified against the pinned keyset approves; v1 is
|
|
342
|
+
* refused as `unsigned` (downgrade protection).
|
|
343
|
+
* - unpinned → legacy: v1 is verified exactly as before; v2 is refused as
|
|
344
|
+
* `unpinned` (nothing here could check it — the server should
|
|
345
|
+
* not have sent it, since this daemon did not announce
|
|
346
|
+
* `tool_approval_signed_v1`).
|
|
347
|
+
* - unreadable → nothing approves.
|
|
348
|
+
*
|
|
349
|
+
* Returns the claims the spend-once ledger keys on when it approves.
|
|
350
|
+
*/
|
|
351
|
+
function verifyToolApprovalAttestation(approval, call, pin) {
|
|
352
|
+
if (approval === undefined || approval === null)
|
|
353
|
+
return { ok: false, reason: 'absent' };
|
|
354
|
+
const version = approval && typeof approval === 'object' && !Array.isArray(approval)
|
|
355
|
+
? approval.v
|
|
356
|
+
: undefined;
|
|
357
|
+
if (pin.state === 'unreadable')
|
|
358
|
+
return { ok: false, reason: 'pin_unreadable' };
|
|
359
|
+
if (pin.state === 'pinned') {
|
|
360
|
+
if (version === 1)
|
|
361
|
+
return { ok: false, reason: 'unsigned' };
|
|
362
|
+
const verdict = verifySignedToolApproval(approval, call, pin.keyset);
|
|
363
|
+
return verdict.ok ? { ...verdict, signed: true } : verdict;
|
|
364
|
+
}
|
|
365
|
+
if (version === 2)
|
|
366
|
+
return { ok: false, reason: 'unpinned' };
|
|
367
|
+
const legacy = (0, daemonToolApproval_js_1.verifyAttestedToolApproval)(approval, call);
|
|
368
|
+
if (!legacy.ok)
|
|
369
|
+
return legacy;
|
|
370
|
+
const a = approval;
|
|
371
|
+
return { ok: true, toolUseId: a.toolUseId, expiresAt: a.expiresAt, signed: false };
|
|
372
|
+
}
|
|
@@ -82,7 +82,16 @@ export interface TokenPair {
|
|
|
82
82
|
export type PermanentAuthReason = 'REFRESH_INVALID' | 'REFRESH_REUSED' | 'REFRESH_EXPIRED' | 'SESSION_REVOKED' | 'DEVICE_KEY_MISMATCH' | 'TOKEN_INVALID' | 'TOKEN_EXPIRED' | 'UNKNOWN_401';
|
|
83
83
|
export declare class PermanentAuthFailure extends Error {
|
|
84
84
|
readonly code: PermanentAuthReason;
|
|
85
|
-
|
|
85
|
+
/**
|
|
86
|
+
* OSK-16941 — for `SESSION_REVOKED`, the server's `reason` (a
|
|
87
|
+
* `SESSION_REVOCATION_REASONS` value, `./sessionRevocation.ts`) exactly as
|
|
88
|
+
* received, or undefined when the server sent none. Deliberately not
|
|
89
|
+
* normalized here: a surface rendering it with `describeSessionRevocation`
|
|
90
|
+
* turns a missing or unknown value into the "we could not tell why" copy,
|
|
91
|
+
* and keeps an unrecognised code visible rather than losing it.
|
|
92
|
+
*/
|
|
93
|
+
readonly revocationReason?: string;
|
|
94
|
+
constructor(code: PermanentAuthReason, message: string, revocationReason?: string);
|
|
86
95
|
}
|
|
87
96
|
export declare class TransientAuthFailure extends Error {
|
|
88
97
|
readonly cause?: unknown;
|
|
@@ -91,6 +100,13 @@ export declare class TransientAuthFailure extends Error {
|
|
|
91
100
|
export interface ReauthState {
|
|
92
101
|
code: string;
|
|
93
102
|
message?: string;
|
|
103
|
+
/**
|
|
104
|
+
* OSK-16941 — the server's session-revocation `reason` for a
|
|
105
|
+
* `SESSION_REVOKED` latch, so the CLI and desktop can say WHY the person was
|
|
106
|
+
* signed out. Absent on latches written before it existed and on refusals
|
|
107
|
+
* that were not revocations.
|
|
108
|
+
*/
|
|
109
|
+
revocationReason?: string;
|
|
94
110
|
/** Epoch ms. */
|
|
95
111
|
at: number;
|
|
96
112
|
}
|
|
@@ -8,10 +8,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.TransientAuthFailure = exports.PermanentAuthFailure = void 0;
|
|
9
9
|
class PermanentAuthFailure extends Error {
|
|
10
10
|
code;
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* OSK-16941 — for `SESSION_REVOKED`, the server's `reason` (a
|
|
13
|
+
* `SESSION_REVOCATION_REASONS` value, `./sessionRevocation.ts`) exactly as
|
|
14
|
+
* received, or undefined when the server sent none. Deliberately not
|
|
15
|
+
* normalized here: a surface rendering it with `describeSessionRevocation`
|
|
16
|
+
* turns a missing or unknown value into the "we could not tell why" copy,
|
|
17
|
+
* and keeps an unrecognised code visible rather than losing it.
|
|
18
|
+
*/
|
|
19
|
+
revocationReason;
|
|
20
|
+
constructor(code, message, revocationReason) {
|
|
12
21
|
super(message);
|
|
13
22
|
this.name = 'PermanentAuthFailure';
|
|
14
23
|
this.code = code;
|
|
24
|
+
if (revocationReason !== undefined)
|
|
25
|
+
this.revocationReason = revocationReason;
|
|
15
26
|
}
|
|
16
27
|
}
|
|
17
28
|
exports.PermanentAuthFailure = PermanentAuthFailure;
|