@kya-os/cli 1.7.0 → 1.8.3
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/dist/commands/agent.d.ts +35 -0
- package/dist/commands/agent.d.ts.map +1 -0
- package/dist/commands/agent.js +321 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/build.js +2 -2
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/check.js +3 -3
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/checkpoint-init.d.ts +32 -0
- package/dist/commands/checkpoint-init.d.ts.map +1 -0
- package/dist/commands/checkpoint-init.js +521 -0
- package/dist/commands/checkpoint-init.js.map +1 -0
- package/dist/commands/claim.js +2 -2
- package/dist/commands/claim.js.map +1 -1
- package/dist/commands/dco.d.ts +59 -0
- package/dist/commands/dco.d.ts.map +1 -1
- package/dist/commands/dco.js +280 -5
- package/dist/commands/dco.js.map +1 -1
- package/dist/commands/dev.js +1 -1
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +18 -24
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/env.js +6 -6
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/identity.js +3 -3
- package/dist/commands/identity.js.map +1 -1
- package/dist/commands/init-stages.d.ts +141 -0
- package/dist/commands/init-stages.d.ts.map +1 -0
- package/dist/commands/init-stages.js +684 -0
- package/dist/commands/init-stages.js.map +1 -0
- package/dist/commands/init.d.ts +46 -16
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +229 -279
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/orchestrator.d.ts +18 -0
- package/dist/commands/orchestrator.d.ts.map +1 -0
- package/dist/commands/orchestrator.js +251 -0
- package/dist/commands/orchestrator.js.map +1 -0
- package/dist/commands/register.d.ts +1 -1
- package/dist/commands/register.d.ts.map +1 -1
- package/dist/commands/register.js +35 -7
- package/dist/commands/register.js.map +1 -1
- package/dist/commands/review.d.ts +48 -0
- package/dist/commands/review.d.ts.map +1 -0
- package/dist/commands/review.js +220 -0
- package/dist/commands/review.js.map +1 -0
- package/dist/commands/rotate.js +4 -4
- package/dist/commands/rotate.js.map +1 -1
- package/dist/commands/score.d.ts +15 -0
- package/dist/commands/score.d.ts.map +1 -0
- package/dist/commands/score.js +471 -0
- package/dist/commands/score.js.map +1 -0
- package/dist/commands/start.js +3 -3
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/verify.js +6 -6
- package/dist/commands/verify.js.map +1 -1
- package/dist/dco.d.ts +4 -0
- package/dist/dco.d.ts.map +1 -0
- package/dist/dco.js +23 -0
- package/dist/dco.js.map +1 -0
- package/dist/index.js +62 -11
- package/dist/orchestrator/daemon.d.ts +137 -0
- package/dist/orchestrator/daemon.d.ts.map +1 -0
- package/dist/orchestrator/daemon.js +242 -0
- package/dist/orchestrator/daemon.js.map +1 -0
- package/dist/orchestrator/db/dispatches.d.ts +108 -0
- package/dist/orchestrator/db/dispatches.d.ts.map +1 -0
- package/dist/orchestrator/db/dispatches.js +122 -0
- package/dist/orchestrator/db/dispatches.js.map +1 -0
- package/dist/orchestrator/db/index.d.ts +50 -0
- package/dist/orchestrator/db/index.d.ts.map +1 -0
- package/dist/orchestrator/db/index.js +116 -0
- package/dist/orchestrator/db/index.js.map +1 -0
- package/dist/orchestrator/db/journal.d.ts +93 -0
- package/dist/orchestrator/db/journal.d.ts.map +1 -0
- package/dist/orchestrator/db/journal.js +91 -0
- package/dist/orchestrator/db/journal.js.map +1 -0
- package/dist/orchestrator/db/liveness.d.ts +97 -0
- package/dist/orchestrator/db/liveness.d.ts.map +1 -0
- package/dist/orchestrator/db/liveness.js +105 -0
- package/dist/orchestrator/db/liveness.js.map +1 -0
- package/dist/orchestrator/db/mission.d.ts +78 -0
- package/dist/orchestrator/db/mission.d.ts.map +1 -0
- package/dist/orchestrator/db/mission.js +99 -0
- package/dist/orchestrator/db/mission.js.map +1 -0
- package/dist/orchestrator/db/schema.d.ts +14 -0
- package/dist/orchestrator/db/schema.d.ts.map +1 -0
- package/dist/orchestrator/db/schema.js +169 -0
- package/dist/orchestrator/db/schema.js.map +1 -0
- package/dist/orchestrator/db/tickets.d.ts +147 -0
- package/dist/orchestrator/db/tickets.d.ts.map +1 -0
- package/dist/orchestrator/db/tickets.js +238 -0
- package/dist/orchestrator/db/tickets.js.map +1 -0
- package/dist/orchestrator/db/verdicts.d.ts +187 -0
- package/dist/orchestrator/db/verdicts.d.ts.map +1 -0
- package/dist/orchestrator/db/verdicts.js +197 -0
- package/dist/orchestrator/db/verdicts.js.map +1 -0
- package/dist/orchestrator/events.d.ts +69 -0
- package/dist/orchestrator/events.d.ts.map +1 -0
- package/dist/orchestrator/events.js +20 -0
- package/dist/orchestrator/events.js.map +1 -0
- package/dist/orchestrator/github-credential-anchor-sender.d.ts +159 -0
- package/dist/orchestrator/github-credential-anchor-sender.d.ts.map +1 -0
- package/dist/orchestrator/github-credential-anchor-sender.js +313 -0
- package/dist/orchestrator/github-credential-anchor-sender.js.map +1 -0
- package/dist/orchestrator/hub-dispatch.d.ts +120 -0
- package/dist/orchestrator/hub-dispatch.d.ts.map +1 -0
- package/dist/orchestrator/hub-dispatch.js +257 -0
- package/dist/orchestrator/hub-dispatch.js.map +1 -0
- package/dist/orchestrator/hub-observer.d.ts +201 -0
- package/dist/orchestrator/hub-observer.d.ts.map +1 -0
- package/dist/orchestrator/hub-observer.js +474 -0
- package/dist/orchestrator/hub-observer.js.map +1 -0
- package/dist/orchestrator/journal-writer.d.ts +80 -0
- package/dist/orchestrator/journal-writer.d.ts.map +1 -0
- package/dist/orchestrator/journal-writer.js +113 -0
- package/dist/orchestrator/journal-writer.js.map +1 -0
- package/dist/orchestrator/mcp/server.d.ts +136 -0
- package/dist/orchestrator/mcp/server.d.ts.map +1 -0
- package/dist/orchestrator/mcp/server.js +582 -0
- package/dist/orchestrator/mcp/server.js.map +1 -0
- package/dist/orchestrator/mcp/stdio.d.ts +22 -0
- package/dist/orchestrator/mcp/stdio.d.ts.map +1 -0
- package/dist/orchestrator/mcp/stdio.js +51 -0
- package/dist/orchestrator/mcp/stdio.js.map +1 -0
- package/dist/orchestrator/review.d.ts +131 -0
- package/dist/orchestrator/review.d.ts.map +1 -0
- package/dist/orchestrator/review.js +322 -0
- package/dist/orchestrator/review.js.map +1 -0
- package/dist/tui/app.d.ts +33 -0
- package/dist/tui/app.d.ts.map +1 -0
- package/dist/tui/app.js +71 -0
- package/dist/tui/app.js.map +1 -0
- package/dist/tui/components.d.ts +110 -0
- package/dist/tui/components.d.ts.map +1 -0
- package/dist/tui/components.js +118 -0
- package/dist/tui/components.js.map +1 -0
- package/dist/tui/index.d.ts +30 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +95 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/keymap.d.ts +33 -0
- package/dist/tui/keymap.d.ts.map +1 -0
- package/dist/tui/keymap.js +49 -0
- package/dist/tui/keymap.js.map +1 -0
- package/dist/tui/nav.d.ts +29 -0
- package/dist/tui/nav.d.ts.map +1 -0
- package/dist/tui/nav.js +39 -0
- package/dist/tui/nav.js.map +1 -0
- package/dist/tui/sanitize.d.ts +25 -0
- package/dist/tui/sanitize.d.ts.map +1 -0
- package/dist/tui/sanitize.js +36 -0
- package/dist/tui/sanitize.js.map +1 -0
- package/dist/tui/theme.d.ts +32 -0
- package/dist/tui/theme.d.ts.map +1 -0
- package/dist/tui/theme.js +63 -0
- package/dist/tui/theme.js.map +1 -0
- package/dist/tui/views/agents.d.ts +67 -0
- package/dist/tui/views/agents.d.ts.map +1 -0
- package/dist/tui/views/agents.js +231 -0
- package/dist/tui/views/agents.js.map +1 -0
- package/dist/tui/views/index.d.ts +93 -0
- package/dist/tui/views/index.d.ts.map +1 -0
- package/dist/tui/views/index.js +150 -0
- package/dist/tui/views/index.js.map +1 -0
- package/dist/tui/views/registry.d.ts +22 -0
- package/dist/tui/views/registry.d.ts.map +1 -0
- package/dist/tui/views/registry.js +110 -0
- package/dist/tui/views/registry.js.map +1 -0
- package/dist/utils/agent/backoff.d.ts +31 -0
- package/dist/utils/agent/backoff.d.ts.map +1 -0
- package/dist/utils/agent/backoff.js +51 -0
- package/dist/utils/agent/backoff.js.map +1 -0
- package/dist/utils/agent/markers.d.ts +87 -0
- package/dist/utils/agent/markers.d.ts.map +1 -0
- package/dist/utils/agent/markers.js +147 -0
- package/dist/utils/agent/markers.js.map +1 -0
- package/dist/utils/agent/review.d.ts +67 -0
- package/dist/utils/agent/review.d.ts.map +1 -0
- package/dist/utils/agent/review.js +305 -0
- package/dist/utils/agent/review.js.map +1 -0
- package/dist/utils/agent/spawn-agent.d.ts +117 -0
- package/dist/utils/agent/spawn-agent.d.ts.map +1 -0
- package/dist/utils/agent/spawn-agent.js +177 -0
- package/dist/utils/agent/spawn-agent.js.map +1 -0
- package/dist/utils/agent/task.d.ts +101 -0
- package/dist/utils/agent/task.d.ts.map +1 -0
- package/dist/utils/agent/task.js +357 -0
- package/dist/utils/agent/task.js.map +1 -0
- package/dist/utils/agent/verify.d.ts +47 -0
- package/dist/utils/agent/verify.d.ts.map +1 -0
- package/dist/utils/agent/verify.js +144 -0
- package/dist/utils/agent/verify.js.map +1 -0
- package/dist/utils/agent-detector.d.ts +48 -0
- package/dist/utils/agent-detector.d.ts.map +1 -0
- package/dist/utils/agent-detector.js +74 -0
- package/dist/utils/agent-detector.js.map +1 -0
- package/dist/utils/agent-profile-stage.d.ts +70 -0
- package/dist/utils/agent-profile-stage.d.ts.map +1 -0
- package/dist/utils/agent-profile-stage.js +153 -0
- package/dist/utils/agent-profile-stage.js.map +1 -0
- package/dist/utils/agent-profiles.d.ts +27 -0
- package/dist/utils/agent-profiles.d.ts.map +1 -0
- package/dist/utils/agent-profiles.js +61 -0
- package/dist/utils/agent-profiles.js.map +1 -0
- package/dist/utils/checkpoint-api.d.ts +86 -0
- package/dist/utils/checkpoint-api.d.ts.map +1 -0
- package/dist/utils/checkpoint-api.js +196 -0
- package/dist/utils/checkpoint-api.js.map +1 -0
- package/dist/utils/checkpoint-env.d.ts +23 -0
- package/dist/utils/checkpoint-env.d.ts.map +1 -0
- package/dist/utils/checkpoint-env.js +59 -0
- package/dist/utils/checkpoint-env.js.map +1 -0
- package/dist/utils/checkpoint-scaffold.d.ts +61 -0
- package/dist/utils/checkpoint-scaffold.d.ts.map +1 -0
- package/dist/utils/checkpoint-scaffold.js +268 -0
- package/dist/utils/checkpoint-scaffold.js.map +1 -0
- package/dist/utils/cli-kit/browser.d.ts +24 -0
- package/dist/utils/cli-kit/browser.d.ts.map +1 -0
- package/dist/utils/cli-kit/browser.js +58 -0
- package/dist/utils/cli-kit/browser.js.map +1 -0
- package/dist/utils/cli-kit/claim-polling.d.ts +18 -0
- package/dist/utils/cli-kit/claim-polling.d.ts.map +1 -0
- package/dist/utils/{claim-polling.js → cli-kit/claim-polling.js} +19 -26
- package/dist/utils/cli-kit/claim-polling.js.map +1 -0
- package/dist/utils/cli-kit/diagnostics.d.ts +9 -0
- package/dist/utils/cli-kit/diagnostics.d.ts.map +1 -0
- package/dist/utils/cli-kit/diagnostics.js +11 -0
- package/dist/utils/cli-kit/diagnostics.js.map +1 -0
- package/dist/utils/cli-kit/fs-safe.d.ts +14 -0
- package/dist/utils/cli-kit/fs-safe.d.ts.map +1 -0
- package/dist/utils/cli-kit/fs-safe.js +20 -0
- package/dist/utils/cli-kit/fs-safe.js.map +1 -0
- package/dist/utils/cli-kit/index.d.ts +15 -0
- package/dist/utils/cli-kit/index.d.ts.map +1 -0
- package/dist/utils/cli-kit/index.js +10 -0
- package/dist/utils/cli-kit/index.js.map +1 -0
- package/dist/utils/cli-kit/json-file.d.ts +21 -0
- package/dist/utils/cli-kit/json-file.d.ts.map +1 -0
- package/dist/utils/cli-kit/json-file.js +51 -0
- package/dist/utils/cli-kit/json-file.js.map +1 -0
- package/dist/utils/cli-kit/marker-block.d.ts +26 -0
- package/dist/utils/cli-kit/marker-block.d.ts.map +1 -0
- package/dist/utils/cli-kit/marker-block.js +61 -0
- package/dist/utils/cli-kit/marker-block.js.map +1 -0
- package/dist/utils/cli-kit/paths.d.ts +15 -0
- package/dist/utils/cli-kit/paths.d.ts.map +1 -0
- package/dist/utils/cli-kit/paths.js +21 -0
- package/dist/utils/cli-kit/paths.js.map +1 -0
- package/dist/utils/cli-kit/secure-storage.d.ts +14 -0
- package/dist/utils/cli-kit/secure-storage.d.ts.map +1 -0
- package/dist/utils/cli-kit/secure-storage.js +20 -0
- package/dist/utils/cli-kit/secure-storage.js.map +1 -0
- package/dist/utils/cli-kit/step-report.d.ts +16 -0
- package/dist/utils/cli-kit/step-report.d.ts.map +1 -0
- package/dist/utils/cli-kit/step-report.js +36 -0
- package/dist/utils/cli-kit/step-report.js.map +1 -0
- package/dist/utils/dco/agent-metadata.d.ts +1 -1
- package/dist/utils/dco/agent-metadata.js +1 -1
- package/dist/utils/dco/agent-metadata.js.map +1 -1
- package/dist/utils/dco/claude-config.d.ts +18 -8
- package/dist/utils/dco/claude-config.d.ts.map +1 -1
- package/dist/utils/dco/claude-config.js +33 -79
- package/dist/utils/dco/claude-config.js.map +1 -1
- package/dist/utils/dco/dispatch.d.ts +134 -0
- package/dist/utils/dco/dispatch.d.ts.map +1 -0
- package/dist/utils/dco/dispatch.js +399 -0
- package/dist/utils/dco/dispatch.js.map +1 -0
- package/dist/utils/dco/fix.d.ts +122 -0
- package/dist/utils/dco/fix.d.ts.map +1 -0
- package/dist/utils/dco/fix.js +560 -0
- package/dist/utils/dco/fix.js.map +1 -0
- package/dist/utils/dco/git-config.d.ts.map +1 -1
- package/dist/utils/dco/git-config.js +5 -3
- package/dist/utils/dco/git-config.js.map +1 -1
- package/dist/utils/dco/github.d.ts +101 -0
- package/dist/utils/dco/github.d.ts.map +1 -1
- package/dist/utils/dco/github.js +133 -0
- package/dist/utils/dco/github.js.map +1 -1
- package/dist/utils/dco/paths.d.ts +1 -8
- package/dist/utils/dco/paths.d.ts.map +1 -1
- package/dist/utils/dco/paths.js +3 -12
- package/dist/utils/dco/paths.js.map +1 -1
- package/dist/utils/dco/render.d.ts +1 -1
- package/dist/utils/dco/render.d.ts.map +1 -1
- package/dist/utils/dco/render.js +4 -21
- package/dist/utils/dco/render.js.map +1 -1
- package/dist/utils/dco/resolve-agent.d.ts +54 -0
- package/dist/utils/dco/resolve-agent.d.ts.map +1 -0
- package/dist/utils/dco/resolve-agent.js +164 -0
- package/dist/utils/dco/resolve-agent.js.map +1 -0
- package/dist/utils/dco/setup.d.ts +10 -7
- package/dist/utils/dco/setup.d.ts.map +1 -1
- package/dist/utils/dco/setup.js +264 -199
- package/dist/utils/dco/setup.js.map +1 -1
- package/dist/utils/dco/signing-key-writer.d.ts +40 -0
- package/dist/utils/dco/signing-key-writer.d.ts.map +1 -0
- package/dist/utils/dco/signing-key-writer.js +76 -0
- package/dist/utils/dco/signing-key-writer.js.map +1 -0
- package/dist/utils/dco/ssh-key.d.ts +50 -0
- package/dist/utils/dco/ssh-key.d.ts.map +1 -1
- package/dist/utils/dco/ssh-key.js +129 -8
- package/dist/utils/dco/ssh-key.js.map +1 -1
- package/dist/utils/dco/status.d.ts +1 -1
- package/dist/utils/dco/status.d.ts.map +1 -1
- package/dist/utils/dco/status.js +3 -3
- package/dist/utils/dco/status.js.map +1 -1
- package/dist/utils/dco/verify.d.ts +170 -0
- package/dist/utils/dco/verify.d.ts.map +1 -0
- package/dist/utils/dco/verify.js +550 -0
- package/dist/utils/dco/verify.js.map +1 -0
- package/dist/utils/dependency-installer.d.ts +37 -0
- package/dist/utils/dependency-installer.d.ts.map +1 -0
- package/dist/utils/dependency-installer.js +32 -0
- package/dist/utils/dependency-installer.js.map +1 -0
- package/dist/utils/github-credential-stage.d.ts +87 -0
- package/dist/utils/github-credential-stage.d.ts.map +1 -0
- package/dist/utils/github-credential-stage.js +168 -0
- package/dist/utils/github-credential-stage.js.map +1 -0
- package/dist/utils/github-credential.d.ts +160 -0
- package/dist/utils/github-credential.d.ts.map +1 -0
- package/dist/utils/github-credential.js +308 -0
- package/dist/utils/github-credential.js.map +1 -0
- package/dist/utils/gitignore.d.ts +17 -0
- package/dist/utils/gitignore.d.ts.map +1 -0
- package/dist/utils/gitignore.js +40 -0
- package/dist/utils/gitignore.js.map +1 -0
- package/dist/utils/hub-config.d.ts +21 -0
- package/dist/utils/hub-config.d.ts.map +1 -0
- package/dist/utils/hub-config.js +28 -0
- package/dist/utils/hub-config.js.map +1 -0
- package/dist/utils/identity-heal.d.ts +16 -0
- package/dist/utils/identity-heal.d.ts.map +1 -0
- package/dist/utils/identity-heal.js +37 -0
- package/dist/utils/identity-heal.js.map +1 -0
- package/dist/utils/init/pipeline.d.ts +74 -0
- package/dist/utils/init/pipeline.d.ts.map +1 -0
- package/dist/utils/init/pipeline.js +96 -0
- package/dist/utils/init/pipeline.js.map +1 -0
- package/dist/utils/poll.d.ts +64 -0
- package/dist/utils/poll.d.ts.map +1 -0
- package/dist/utils/poll.js +76 -0
- package/dist/utils/poll.js.map +1 -0
- package/dist/utils/register-agent-identity.d.ts +67 -0
- package/dist/utils/register-agent-identity.d.ts.map +1 -0
- package/dist/utils/register-agent-identity.js +34 -0
- package/dist/utils/register-agent-identity.js.map +1 -0
- package/dist/utils/review/did-web-key.d.ts +34 -0
- package/dist/utils/review/did-web-key.d.ts.map +1 -0
- package/dist/utils/review/did-web-key.js +104 -0
- package/dist/utils/review/did-web-key.js.map +1 -0
- package/dist/utils/review/load-registry.d.ts +33 -0
- package/dist/utils/review/load-registry.d.ts.map +1 -0
- package/dist/utils/review/load-registry.js +62 -0
- package/dist/utils/review/load-registry.js.map +1 -0
- package/dist/utils/review/verdict-verify.d.ts +43 -0
- package/dist/utils/review/verdict-verify.d.ts.map +1 -0
- package/dist/utils/review/verdict-verify.js +53 -0
- package/dist/utils/review/verdict-verify.js.map +1 -0
- package/dist/utils/review-registry-writer.d.ts +52 -0
- package/dist/utils/review-registry-writer.d.ts.map +1 -0
- package/dist/utils/review-registry-writer.js +79 -0
- package/dist/utils/review-registry-writer.js.map +1 -0
- package/dist/utils/should-install-dependency.d.ts +17 -0
- package/dist/utils/should-install-dependency.d.ts.map +1 -0
- package/dist/utils/should-install-dependency.js +25 -0
- package/dist/utils/should-install-dependency.js.map +1 -0
- package/dist/utils/tool-readiness.d.ts +57 -0
- package/dist/utils/tool-readiness.d.ts.map +1 -0
- package/dist/utils/tool-readiness.js +114 -0
- package/dist/utils/tool-readiness.js.map +1 -0
- package/dist/utils/which.d.ts +2 -0
- package/dist/utils/which.d.ts.map +1 -0
- package/dist/utils/which.js +22 -0
- package/dist/utils/which.js.map +1 -0
- package/dist/version.d.ts +15 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +29 -0
- package/dist/version.js.map +1 -0
- package/package.json +19 -6
- package/dist/utils/claim-polling.d.ts +0 -21
- package/dist/utils/claim-polling.d.ts.map +0 -1
- package/dist/utils/claim-polling.js.map +0 -1
- package/dist/utils/dco/fs-safe.d.ts +0 -14
- package/dist/utils/dco/fs-safe.d.ts.map +0 -1
- package/dist/utils/dco/fs-safe.js +0 -20
- package/dist/utils/dco/fs-safe.js.map +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local review-verdict proof verification for `kya-os review verify`
|
|
3
|
+
* (review-loop P9 commit 3).
|
|
4
|
+
*
|
|
5
|
+
* Seam completed (was TEMPORARY pending review-loop P13's commit 0 / PR
|
|
6
|
+
* #701, now merged): delegates the signature check to
|
|
7
|
+
* `@kya-os/contracts/review/verify`'s `verifyReviewVerdictProof(body,
|
|
8
|
+
* publicKeyRaw)` (the same raw-bytes shape `resolveDidWebEd25519Key`,
|
|
9
|
+
* did-web-key.ts, already produces) rather than reimplementing the
|
|
10
|
+
* SPKI-wrap Ed25519 verify locally. `verifyLocalReviewVerdictProof` stays
|
|
11
|
+
* as a thin wrapper -- not deleted outright -- because contracts' function
|
|
12
|
+
* returns a plain boolean with no way to distinguish a digest mismatch
|
|
13
|
+
* from a signature failure, and `commands/review.ts` reports those as two
|
|
14
|
+
* different human-readable reasons; this wrapper does the digest
|
|
15
|
+
* pre-check itself (matching compute's `review.ts`'s identical seam) to
|
|
16
|
+
* keep that distinction, then delegates for the signature half.
|
|
17
|
+
*
|
|
18
|
+
* @module cli/utils/review/verdict-verify
|
|
19
|
+
*/
|
|
20
|
+
import { type ReviewVerdictBody } from "@kya-os/contracts/review";
|
|
21
|
+
export type VerdictProofFailureReason = "digest" | "signature";
|
|
22
|
+
export interface VerdictProofResult {
|
|
23
|
+
valid: boolean;
|
|
24
|
+
reason?: VerdictProofFailureReason;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Verify a review verdict's proof against a RAW Ed25519 public key: that
|
|
28
|
+
* `findingsDigest` matches `findings`, and that `proof.signature` was
|
|
29
|
+
* produced by the private half of `publicKeyRaw`. Fail-closed — any
|
|
30
|
+
* malformed input or key-import failure returns `{ valid: false, reason:
|
|
31
|
+
* "signature" }` rather than throwing (contracts' `verifyReviewVerdictProof`
|
|
32
|
+
* is itself fail-closed, never throws).
|
|
33
|
+
*/
|
|
34
|
+
export declare function verifyLocalReviewVerdictProof(body: ReviewVerdictBody, publicKeyRaw: Buffer): VerdictProofResult;
|
|
35
|
+
/**
|
|
36
|
+
* Extract every fenced ```kya-os-signed-verdict block's raw contents from a
|
|
37
|
+
* review or comment body. Returns the raw text (not yet parsed/validated) —
|
|
38
|
+
* callers JSON.parse and `ReviewVerdictBodySchema.safeParse` each block
|
|
39
|
+
* themselves, so a malformed block reports as one INVALID row rather than
|
|
40
|
+
* aborting extraction of the others.
|
|
41
|
+
*/
|
|
42
|
+
export declare function extractSignedVerdictBlocks(markdown: string): string[];
|
|
43
|
+
//# sourceMappingURL=verdict-verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verdict-verify.d.ts","sourceRoot":"","sources":["../../../src/utils/review/verdict-verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AAElC,MAAM,MAAM,yBAAyB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE/D,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,yBAAyB,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,iBAAiB,EACvB,YAAY,EAAE,MAAM,GACnB,kBAAkB,CAOpB;AAID;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAMrE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local review-verdict proof verification for `kya-os review verify`
|
|
3
|
+
* (review-loop P9 commit 3).
|
|
4
|
+
*
|
|
5
|
+
* Seam completed (was TEMPORARY pending review-loop P13's commit 0 / PR
|
|
6
|
+
* #701, now merged): delegates the signature check to
|
|
7
|
+
* `@kya-os/contracts/review/verify`'s `verifyReviewVerdictProof(body,
|
|
8
|
+
* publicKeyRaw)` (the same raw-bytes shape `resolveDidWebEd25519Key`,
|
|
9
|
+
* did-web-key.ts, already produces) rather than reimplementing the
|
|
10
|
+
* SPKI-wrap Ed25519 verify locally. `verifyLocalReviewVerdictProof` stays
|
|
11
|
+
* as a thin wrapper -- not deleted outright -- because contracts' function
|
|
12
|
+
* returns a plain boolean with no way to distinguish a digest mismatch
|
|
13
|
+
* from a signature failure, and `commands/review.ts` reports those as two
|
|
14
|
+
* different human-readable reasons; this wrapper does the digest
|
|
15
|
+
* pre-check itself (matching compute's `review.ts`'s identical seam) to
|
|
16
|
+
* keep that distinction, then delegates for the signature half.
|
|
17
|
+
*
|
|
18
|
+
* @module cli/utils/review/verdict-verify
|
|
19
|
+
*/
|
|
20
|
+
import { verifyReviewVerdictProof } from "@kya-os/contracts/review/verify";
|
|
21
|
+
import { computeFindingsDigest, } from "@kya-os/contracts/review";
|
|
22
|
+
/**
|
|
23
|
+
* Verify a review verdict's proof against a RAW Ed25519 public key: that
|
|
24
|
+
* `findingsDigest` matches `findings`, and that `proof.signature` was
|
|
25
|
+
* produced by the private half of `publicKeyRaw`. Fail-closed — any
|
|
26
|
+
* malformed input or key-import failure returns `{ valid: false, reason:
|
|
27
|
+
* "signature" }` rather than throwing (contracts' `verifyReviewVerdictProof`
|
|
28
|
+
* is itself fail-closed, never throws).
|
|
29
|
+
*/
|
|
30
|
+
export function verifyLocalReviewVerdictProof(body, publicKeyRaw) {
|
|
31
|
+
if (computeFindingsDigest(body.findings) !== body.findingsDigest) {
|
|
32
|
+
return { valid: false, reason: "digest" };
|
|
33
|
+
}
|
|
34
|
+
return verifyReviewVerdictProof(body, publicKeyRaw)
|
|
35
|
+
? { valid: true }
|
|
36
|
+
: { valid: false, reason: "signature" };
|
|
37
|
+
}
|
|
38
|
+
const SIGNED_VERDICT_FENCE = /```kya-os-signed-verdict\n([\s\S]*?)\n```/g;
|
|
39
|
+
/**
|
|
40
|
+
* Extract every fenced ```kya-os-signed-verdict block's raw contents from a
|
|
41
|
+
* review or comment body. Returns the raw text (not yet parsed/validated) —
|
|
42
|
+
* callers JSON.parse and `ReviewVerdictBodySchema.safeParse` each block
|
|
43
|
+
* themselves, so a malformed block reports as one INVALID row rather than
|
|
44
|
+
* aborting extraction of the others.
|
|
45
|
+
*/
|
|
46
|
+
export function extractSignedVerdictBlocks(markdown) {
|
|
47
|
+
const blocks = [];
|
|
48
|
+
for (const match of markdown.matchAll(SIGNED_VERDICT_FENCE)) {
|
|
49
|
+
blocks.push(match[1]);
|
|
50
|
+
}
|
|
51
|
+
return blocks;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=verdict-verify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verdict-verify.js","sourceRoot":"","sources":["../../../src/utils/review/verdict-verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EACL,qBAAqB,GAEtB,MAAM,0BAA0B,CAAC;AASlC;;;;;;;GAOG;AACH,MAAM,UAAU,6BAA6B,CAC3C,IAAuB,EACvB,YAAoB;IAEpB,IAAI,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,cAAc,EAAE,CAAC;QACjE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAC5C,CAAC;IACD,OAAO,wBAAwB,CAAC,IAAI,EAAE,YAAY,CAAC;QACjD,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE;QACjB,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AAC5C,CAAC;AAED,MAAM,oBAAoB,GAAG,4CAA4C,CAAC;AAE1E;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CAAC,QAAgB;IACzD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAC5D,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type ReviewerRegistry, type ReviewerRegistryEntry } from "@kya-os/contracts/review";
|
|
2
|
+
/**
|
|
3
|
+
* Generates/updates `~/.mcpi/review-registry.json` from the profiles just
|
|
4
|
+
* created by `kya-os init`'s agent-profile stage. Deliberately MERGE-ONLY:
|
|
5
|
+
* `orgId`/`orgRootDid`/`repos`/`quorumN` are org-wide values a single
|
|
6
|
+
* developer's `init` run has no way to know, so a machine with no existing
|
|
7
|
+
* registry gets no invented one -- only entries in an ALREADY-PRESENT file
|
|
8
|
+
* are ever added or updated. A failed validation is reported, never
|
|
9
|
+
* silently written (a bug, not a warning, per the spec).
|
|
10
|
+
*/
|
|
11
|
+
export declare function reviewRegistryPath(): string;
|
|
12
|
+
export type MergeReviewRegistryResult = {
|
|
13
|
+
status: "written";
|
|
14
|
+
path: string;
|
|
15
|
+
registry: ReviewerRegistry;
|
|
16
|
+
} | {
|
|
17
|
+
status: "skipped-no-existing-registry";
|
|
18
|
+
path: string;
|
|
19
|
+
} | {
|
|
20
|
+
status: "invalid-existing";
|
|
21
|
+
path: string;
|
|
22
|
+
error: string;
|
|
23
|
+
} | {
|
|
24
|
+
status: "invalid-result";
|
|
25
|
+
path: string;
|
|
26
|
+
error: string;
|
|
27
|
+
};
|
|
28
|
+
export interface MergeReviewRegistryOptions {
|
|
29
|
+
path?: string;
|
|
30
|
+
/**
|
|
31
|
+
* agentDids (from `newEntries`) to promote to `fixes: true` IF their
|
|
32
|
+
* githubLogin has no `fixes: true` entry anywhere in the MERGED registry
|
|
33
|
+
* (existing entries plus this run's, not just this run's own batch).
|
|
34
|
+
* Never demotes an existing fixer and never gives one person two.
|
|
35
|
+
*
|
|
36
|
+
* This decision belongs here, not in the caller: a caller building
|
|
37
|
+
* `newEntries` sees only its own batch (e.g. "the first profile created
|
|
38
|
+
* THIS run"), so computing `fixes` there is correct on a machine's first
|
|
39
|
+
* `kya-os init` but wrong on every later run that adds one more profile
|
|
40
|
+
* for someone who already has a fixer -- the caller has no way to know
|
|
41
|
+
* that without re-reading the file this function already loads.
|
|
42
|
+
*/
|
|
43
|
+
designateFixerCandidates?: string[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Merge freshly generated profile entries into the on-disk review registry,
|
|
47
|
+
* keyed by `agentDid`: a matching entry is updated in place (same array
|
|
48
|
+
* position), a new one is appended, and every entry this run didn't touch
|
|
49
|
+
* (other people's, hand-added) is preserved untouched.
|
|
50
|
+
*/
|
|
51
|
+
export declare function mergeReviewRegistry(newEntries: ReviewerRegistryEntry[], options?: MergeReviewRegistryOptions): MergeReviewRegistryResult;
|
|
52
|
+
//# sourceMappingURL=review-registry-writer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-registry-writer.d.ts","sourceRoot":"","sources":["../../src/utils/review-registry-writer.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC3B,MAAM,0BAA0B,CAAC;AAGlC;;;;;;;;GAQG;AAEH,wBAAgB,kBAAkB,IAAI,MAAM,CAK3C;AAED,MAAM,MAAM,yBAAyB,GACjC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAA;CAAE,GAC/D;IAAE,MAAM,EAAE,8BAA8B,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,MAAM,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,WAAW,0BAA0B;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;;OAYG;IACH,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;CACrC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,qBAAqB,EAAE,EACnC,OAAO,GAAE,0BAA+B,GACvC,yBAAyB,CAgE3B"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "fs";
|
|
2
|
+
import { join, resolve } from "path";
|
|
3
|
+
import { ReviewerRegistrySchema, } from "@kya-os/contracts/review";
|
|
4
|
+
import { stateDir, writeFileAtomicSafe } from "./cli-kit/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Generates/updates `~/.mcpi/review-registry.json` from the profiles just
|
|
7
|
+
* created by `kya-os init`'s agent-profile stage. Deliberately MERGE-ONLY:
|
|
8
|
+
* `orgId`/`orgRootDid`/`repos`/`quorumN` are org-wide values a single
|
|
9
|
+
* developer's `init` run has no way to know, so a machine with no existing
|
|
10
|
+
* registry gets no invented one -- only entries in an ALREADY-PRESENT file
|
|
11
|
+
* are ever added or updated. A failed validation is reported, never
|
|
12
|
+
* silently written (a bug, not a warning, per the spec).
|
|
13
|
+
*/
|
|
14
|
+
export function reviewRegistryPath() {
|
|
15
|
+
return resolve(process.env.MCPI_REVIEW_REGISTRY_PATH ||
|
|
16
|
+
join(stateDir("mcpi"), "review-registry.json"));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Merge freshly generated profile entries into the on-disk review registry,
|
|
20
|
+
* keyed by `agentDid`: a matching entry is updated in place (same array
|
|
21
|
+
* position), a new one is appended, and every entry this run didn't touch
|
|
22
|
+
* (other people's, hand-added) is preserved untouched.
|
|
23
|
+
*/
|
|
24
|
+
export function mergeReviewRegistry(newEntries, options = {}) {
|
|
25
|
+
const path = options.path ?? reviewRegistryPath();
|
|
26
|
+
if (!existsSync(path)) {
|
|
27
|
+
return { status: "skipped-no-existing-registry", path };
|
|
28
|
+
}
|
|
29
|
+
let parsed;
|
|
30
|
+
try {
|
|
31
|
+
parsed = JSON.parse(readFileSync(path, "utf-8"));
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
return {
|
|
35
|
+
status: "invalid-existing",
|
|
36
|
+
path,
|
|
37
|
+
error: `Could not parse ${path}: ${error instanceof Error ? error.message : String(error)}`,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const existing = ReviewerRegistrySchema.safeParse(parsed);
|
|
41
|
+
if (!existing.success) {
|
|
42
|
+
return {
|
|
43
|
+
status: "invalid-existing",
|
|
44
|
+
path,
|
|
45
|
+
error: `${path} fails schema validation: ${existing.error.message}`,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const byDid = new Map(existing.data.entries.map((e) => [e.agentDid, e]));
|
|
49
|
+
for (const entry of newEntries) {
|
|
50
|
+
byDid.set(entry.agentDid, entry);
|
|
51
|
+
}
|
|
52
|
+
if (options.designateFixerCandidates) {
|
|
53
|
+
const fixerLoginSeen = new Set(Array.from(byDid.values())
|
|
54
|
+
.filter((e) => e.fixes)
|
|
55
|
+
.map((e) => e.githubLogin));
|
|
56
|
+
for (const did of options.designateFixerCandidates) {
|
|
57
|
+
const entry = byDid.get(did);
|
|
58
|
+
if (!entry || fixerLoginSeen.has(entry.githubLogin))
|
|
59
|
+
continue;
|
|
60
|
+
byDid.set(did, { ...entry, fixes: true });
|
|
61
|
+
fixerLoginSeen.add(entry.githubLogin);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const merged = {
|
|
65
|
+
...existing.data,
|
|
66
|
+
entries: Array.from(byDid.values()),
|
|
67
|
+
};
|
|
68
|
+
const validated = ReviewerRegistrySchema.safeParse(merged);
|
|
69
|
+
if (!validated.success) {
|
|
70
|
+
return {
|
|
71
|
+
status: "invalid-result",
|
|
72
|
+
path,
|
|
73
|
+
error: `Generated review registry fails schema validation: ${validated.error.message}`,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
writeFileAtomicSafe(path, JSON.stringify(validated.data, null, 2) + "\n");
|
|
77
|
+
return { status: "written", path, registry: validated.data };
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=review-registry-writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-registry-writer.js","sourceRoot":"","sources":["../../src/utils/review-registry-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,E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sBAAsB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3D,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACvB,OAAO;YACL,MAAM,EAAE,gBAAgB;YACxB,IAAI;YACJ,KAAK,EAAE,sDAAsD,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE;SACvF,CAAC;IACJ,CAAC;IAED,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC1E,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decides whether `kya-os init` should install the missing `@kya-os/mcp-i`
|
|
3
|
+
* dependency, given `--install`/`--no-install`/`--yes` and whether stdin is
|
|
4
|
+
* a TTY. Pure decision logic, deliberately separated from init.ts's dynamic
|
|
5
|
+
* `import("@kya-os/mcp-i")` retry (which stays inline there -- it exists to
|
|
6
|
+
* survive monorepo CI ordering and isn't itself a seam) so this tri-state
|
|
7
|
+
* flag interaction is exhaustively unit-testable on its own.
|
|
8
|
+
*/
|
|
9
|
+
export interface ShouldInstallDependencyOptions {
|
|
10
|
+
/** true = --install, false = --no-install, undefined = neither passed. */
|
|
11
|
+
install?: boolean;
|
|
12
|
+
/** --yes: consents to installs only, never to registration/key decisions. */
|
|
13
|
+
yes?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export type ConfirmInstallImpl = (message: string) => Promise<boolean>;
|
|
16
|
+
export declare function shouldInstallDependency(options: ShouldInstallDependencyOptions, isTTY: boolean, confirmImpl: ConfirmInstallImpl): Promise<boolean>;
|
|
17
|
+
//# sourceMappingURL=should-install-dependency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"should-install-dependency.d.ts","sourceRoot":"","sources":["../../src/utils/should-install-dependency.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,8BAA8B;IAC7C,0EAA0E;IAC1E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEvE,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,8BAA8B,EACvC,KAAK,EAAE,OAAO,EACd,WAAW,EAAE,kBAAkB,GAC9B,OAAO,CAAC,OAAO,CAAC,CAelB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decides whether `kya-os init` should install the missing `@kya-os/mcp-i`
|
|
3
|
+
* dependency, given `--install`/`--no-install`/`--yes` and whether stdin is
|
|
4
|
+
* a TTY. Pure decision logic, deliberately separated from init.ts's dynamic
|
|
5
|
+
* `import("@kya-os/mcp-i")` retry (which stays inline there -- it exists to
|
|
6
|
+
* survive monorepo CI ordering and isn't itself a seam) so this tri-state
|
|
7
|
+
* flag interaction is exhaustively unit-testable on its own.
|
|
8
|
+
*/
|
|
9
|
+
export async function shouldInstallDependency(options, isTTY, confirmImpl) {
|
|
10
|
+
// --no-install always wins: an explicit "never" overrides even --yes.
|
|
11
|
+
if (options.install === false) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (!isTTY) {
|
|
15
|
+
// Non-TTY: keep today's behavior unless --install opted in (CI). --yes
|
|
16
|
+
// is a TTY-prompt shortcut and has no effect off a TTY.
|
|
17
|
+
return options.install === true;
|
|
18
|
+
}
|
|
19
|
+
// TTY: --yes or --install both skip the prompt with an implicit yes.
|
|
20
|
+
if (options.yes === true || options.install === true) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return confirmImpl("Install @kya-os/mcp-i now?");
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=should-install-dependency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"should-install-dependency.js","sourceRoot":"","sources":["../../src/utils/should-install-dependency.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,OAAuC,EACvC,KAAc,EACd,WAA+B;IAE/B,sEAAsE;IACtE,IAAI,OAAO,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,uEAAuE;QACvE,wDAAwD;QACxD,OAAO,OAAO,CAAC,OAAO,KAAK,IAAI,CAAC;IAClC,CAAC;IACD,qEAAqE;IACrE,IAAI,OAAO,CAAC,GAAG,KAAK,IAAI,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACrD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,WAAW,CAAC,4BAA4B,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether the external binaries init needs (`git`, `gh`, `claude`)
|
|
3
|
+
* are present, and for `gh` specifically, authenticated. Table-driven and
|
|
4
|
+
* fully injectable (`whichImpl`, `execImpl`) so every path is testable
|
|
5
|
+
* without touching the real filesystem, PATH, or network -- mirrors
|
|
6
|
+
* `packages/cli/src/utils/agent-detector.ts`'s detection-only contract:
|
|
7
|
+
* this module never executes a detected binary beyond a `--version`/
|
|
8
|
+
* `auth status` probe, and never spawns `gh auth login` itself (that is
|
|
9
|
+
* interactive and must be run by the user).
|
|
10
|
+
*/
|
|
11
|
+
export type ToolKind = "git" | "gh" | "claude";
|
|
12
|
+
export interface ToolCheck {
|
|
13
|
+
tool: ToolKind;
|
|
14
|
+
found: boolean;
|
|
15
|
+
version?: string;
|
|
16
|
+
/** `gh` only: result of `gh auth status`. */
|
|
17
|
+
authenticated?: boolean;
|
|
18
|
+
/** Exact per-platform command (or instruction) to resolve this row. */
|
|
19
|
+
installHint: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ExecResult {
|
|
22
|
+
stdout: string;
|
|
23
|
+
stderr: string;
|
|
24
|
+
code: number;
|
|
25
|
+
}
|
|
26
|
+
export type WhichImpl = (bin: string) => Promise<string | null>;
|
|
27
|
+
export type ExecImpl = (command: string, args: string[]) => Promise<ExecResult>;
|
|
28
|
+
export interface ToolReadinessDeps {
|
|
29
|
+
whichImpl: WhichImpl;
|
|
30
|
+
execImpl: ExecImpl;
|
|
31
|
+
platform: NodeJS.Platform;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Detect presence (and for `gh`, auth) of the requested tools. Never
|
|
35
|
+
* executes a detected binary beyond a `--version`/`auth status` probe.
|
|
36
|
+
*/
|
|
37
|
+
export declare function checkTools(required: ToolKind[], deps?: Partial<ToolReadinessDeps>): Promise<ToolCheck[]>;
|
|
38
|
+
export interface RunToolReadinessGateOptions {
|
|
39
|
+
interactive: boolean;
|
|
40
|
+
required?: ToolKind[];
|
|
41
|
+
deps?: Partial<ToolReadinessDeps>;
|
|
42
|
+
/** Injectable confirm prompt; defaults to an inquirer confirm. */
|
|
43
|
+
confirmImpl?: (message: string) => Promise<boolean>;
|
|
44
|
+
}
|
|
45
|
+
export interface ToolReadinessGateResult {
|
|
46
|
+
checks: ToolCheck[];
|
|
47
|
+
/** Tools whose absence should stop init entirely (today: just `git`). */
|
|
48
|
+
fatalMissing: ToolKind[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Run the readiness check and, in interactive mode on darwin, offer to run
|
|
52
|
+
* the brew install command for anything missing. Non-interactive (or
|
|
53
|
+
* non-darwin) callers get the checks back untouched -- no prompt, no
|
|
54
|
+
* install, ever attempted.
|
|
55
|
+
*/
|
|
56
|
+
export declare function runToolReadinessGate(options: RunToolReadinessGateOptions): Promise<ToolReadinessGateResult>;
|
|
57
|
+
//# sourceMappingURL=tool-readiness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-readiness.d.ts","sourceRoot":"","sources":["../../src/utils/tool-readiness.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,IAAI,GAAG,QAAQ,CAAC;AAE/C,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,uEAAuE;IACvE,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAChE,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AAEhF,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;CAC3B;AAiDD;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,QAAQ,EAAE,EACpB,IAAI,GAAE,OAAO,CAAC,iBAAiB,CAAM,GACpC,OAAO,CAAC,SAAS,EAAE,CAAC,CAmCtB;AAED,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAClC,kEAAkE;IAClE,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,yEAAyE;IACzE,YAAY,EAAE,QAAQ,EAAE,CAAC;CAC1B;AAYD;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,uBAAuB,CAAC,CA4BlC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { execFile } from "child_process";
|
|
2
|
+
import { promisify } from "util";
|
|
3
|
+
import { defaultWhich } from "./which.js";
|
|
4
|
+
const execFileAsync = promisify(execFile);
|
|
5
|
+
async function defaultExec(command, args) {
|
|
6
|
+
try {
|
|
7
|
+
const { stdout, stderr } = await execFileAsync(command, args, {
|
|
8
|
+
encoding: "utf8",
|
|
9
|
+
});
|
|
10
|
+
return { stdout, stderr, code: 0 };
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
const err = error;
|
|
14
|
+
return {
|
|
15
|
+
stdout: err.stdout ?? "",
|
|
16
|
+
stderr: err.stderr ?? err.message ?? "",
|
|
17
|
+
code: typeof err.code === "number" ? err.code : 1,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function defaultDeps() {
|
|
22
|
+
return { whichImpl: defaultWhich, execImpl: defaultExec, platform: process.platform };
|
|
23
|
+
}
|
|
24
|
+
function installHintFor(tool, platform) {
|
|
25
|
+
const darwin = platform === "darwin";
|
|
26
|
+
switch (tool) {
|
|
27
|
+
case "git":
|
|
28
|
+
return darwin
|
|
29
|
+
? "brew install git"
|
|
30
|
+
: "Install git: https://git-scm.com/downloads";
|
|
31
|
+
case "gh":
|
|
32
|
+
return darwin
|
|
33
|
+
? "brew install gh"
|
|
34
|
+
: "Install gh: https://cli.github.com";
|
|
35
|
+
case "claude":
|
|
36
|
+
return darwin
|
|
37
|
+
? "brew install --cask claude-code"
|
|
38
|
+
: "Install Claude Code: https://docs.claude.com/en/docs/claude-code";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Detect presence (and for `gh`, auth) of the requested tools. Never
|
|
43
|
+
* executes a detected binary beyond a `--version`/`auth status` probe.
|
|
44
|
+
*/
|
|
45
|
+
export async function checkTools(required, deps = {}) {
|
|
46
|
+
const { whichImpl, execImpl, platform } = { ...defaultDeps(), ...deps };
|
|
47
|
+
const results = [];
|
|
48
|
+
for (const tool of required) {
|
|
49
|
+
const binPath = await whichImpl(tool);
|
|
50
|
+
const found = Boolean(binPath);
|
|
51
|
+
let version;
|
|
52
|
+
let authenticated;
|
|
53
|
+
let installHint = installHintFor(tool, platform);
|
|
54
|
+
if (found) {
|
|
55
|
+
const versionResult = await execImpl(tool, ["--version"]);
|
|
56
|
+
if (versionResult.code === 0) {
|
|
57
|
+
version = versionResult.stdout.trim().split("\n")[0] || undefined;
|
|
58
|
+
}
|
|
59
|
+
if (tool === "gh") {
|
|
60
|
+
const authResult = await execImpl("gh", [
|
|
61
|
+
"auth",
|
|
62
|
+
"status",
|
|
63
|
+
"--hostname",
|
|
64
|
+
"github.com",
|
|
65
|
+
]);
|
|
66
|
+
authenticated = authResult.code === 0;
|
|
67
|
+
if (!authenticated) {
|
|
68
|
+
installHint = "gh auth login";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
results.push({ tool, found, version, authenticated, installHint });
|
|
73
|
+
}
|
|
74
|
+
return results;
|
|
75
|
+
}
|
|
76
|
+
const FATAL_IF_MISSING = ["git"];
|
|
77
|
+
async function defaultConfirm(message) {
|
|
78
|
+
const inquirer = (await import("inquirer")).default;
|
|
79
|
+
const { answer } = await inquirer.prompt([
|
|
80
|
+
{ type: "confirm", name: "answer", message, default: true },
|
|
81
|
+
]);
|
|
82
|
+
return answer;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Run the readiness check and, in interactive mode on darwin, offer to run
|
|
86
|
+
* the brew install command for anything missing. Non-interactive (or
|
|
87
|
+
* non-darwin) callers get the checks back untouched -- no prompt, no
|
|
88
|
+
* install, ever attempted.
|
|
89
|
+
*/
|
|
90
|
+
export async function runToolReadinessGate(options) {
|
|
91
|
+
const required = options.required ?? ["git", "gh", "claude"];
|
|
92
|
+
const deps = { ...defaultDeps(), ...options.deps };
|
|
93
|
+
const checks = await checkTools(required, deps);
|
|
94
|
+
if (options.interactive && deps.platform === "darwin") {
|
|
95
|
+
const confirmImpl = options.confirmImpl ?? defaultConfirm;
|
|
96
|
+
for (let i = 0; i < checks.length; i++) {
|
|
97
|
+
const check = checks[i];
|
|
98
|
+
if (!check.found && check.installHint.startsWith("brew ")) {
|
|
99
|
+
const shouldInstall = await confirmImpl(`${check.tool} was not found. Run \`${check.installHint}\` now?`);
|
|
100
|
+
if (shouldInstall) {
|
|
101
|
+
const [cmd, ...args] = check.installHint.split(" ");
|
|
102
|
+
await deps.execImpl(cmd, args);
|
|
103
|
+
const [rechecked] = await checkTools([check.tool], deps);
|
|
104
|
+
checks[i] = rechecked;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const fatalMissing = checks
|
|
110
|
+
.filter((c) => FATAL_IF_MISSING.includes(c.tool) && !c.found)
|
|
111
|
+
.map((c) => c.tool);
|
|
112
|
+
return { checks, fatalMissing };
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=tool-readiness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-readiness.js","sourceRoot":"","sources":["../../src/utils/tool-readiness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM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AAK,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC1D,MAAM,aAAa,GAAG,MAAM,WAAW,CACrC,GAAG,KAAK,CAAC,IAAI,yBAAyB,KAAK,CAAC,WAAW,SAAS,CACjE,CAAC;gBACF,IAAI,aAAa,EAAE,CAAC;oBAClB,MAAM,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBACpD,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;oBAC/B,MAAM,CAAC,SAAS,CAAC,GAAG,MAAM,UAAU,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;oBACzD,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;gBACxB,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,YAAY,GAAG,MAAM;SACxB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;SAC5D,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAEtB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"which.d.ts","sourceRoot":"","sources":["../../src/utils/which.ts"],"names":[],"mappings":"AAcA,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAYtE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { execFile } from "child_process";
|
|
2
|
+
import { promisify } from "util";
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a binary's path on PATH, cross-platform (`which` on POSIX,
|
|
5
|
+
* `where` on Windows). Returns null rather than throwing when the binary
|
|
6
|
+
* isn't found -- that's the expected, non-error outcome for a presence
|
|
7
|
+
* check, not a failure to report. Shared by tool-readiness.ts and
|
|
8
|
+
* agent-detector.ts, both of which need this exact resolution as their
|
|
9
|
+
* default injectable `whichImpl`.
|
|
10
|
+
*/
|
|
11
|
+
const execFileAsync = promisify(execFile);
|
|
12
|
+
export async function defaultWhich(bin) {
|
|
13
|
+
try {
|
|
14
|
+
const { stdout } = await execFileAsync(process.platform === "win32" ? "where" : "which", [bin], { encoding: "utf8" });
|
|
15
|
+
const path = stdout.split("\n")[0]?.trim();
|
|
16
|
+
return path || null;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=which.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"which.js","sourceRoot":"","sources":["../../src/utils/which.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC;;;;;;;GAOG;AAEH,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAW;IAC5C,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CACpC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAChD,CAAC,GAAG,CAAC,EACL,EAAE,QAAQ,EAAE,MAAM,EAAE,CACrB,CAAC;QACF,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;QAC3C,OAAO,IAAI,IAAI,IAAI,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @kya-os/cli version, read from package.json at module load time.
|
|
3
|
+
*
|
|
4
|
+
* All three bins (`kya-os`, `mcpi`, `dco`) report this so a `.version()`
|
|
5
|
+
* literal can never drift from the published package version the way
|
|
6
|
+
* "1.2.2" (index.prod.ts) and "1.0.0" (index.ts) previously did.
|
|
7
|
+
*
|
|
8
|
+
* Mirrors packages/compute/src/version.ts's approach: readFileSync +
|
|
9
|
+
* JSON.parse rather than a JSON import, since the latter needs an import
|
|
10
|
+
* attribute (`with { type: "json" }`) whose supported syntax has moved
|
|
11
|
+
* across Node versions.
|
|
12
|
+
*/
|
|
13
|
+
declare let cliVersion: string;
|
|
14
|
+
export { cliVersion };
|
|
15
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,QAAA,IAAI,UAAU,QAAU,CAAC;AAYzB,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @kya-os/cli version, read from package.json at module load time.
|
|
3
|
+
*
|
|
4
|
+
* All three bins (`kya-os`, `mcpi`, `dco`) report this so a `.version()`
|
|
5
|
+
* literal can never drift from the published package version the way
|
|
6
|
+
* "1.2.2" (index.prod.ts) and "1.0.0" (index.ts) previously did.
|
|
7
|
+
*
|
|
8
|
+
* Mirrors packages/compute/src/version.ts's approach: readFileSync +
|
|
9
|
+
* JSON.parse rather than a JSON import, since the latter needs an import
|
|
10
|
+
* attribute (`with { type: "json" }`) whose supported syntax has moved
|
|
11
|
+
* across Node versions.
|
|
12
|
+
*/
|
|
13
|
+
import { readFileSync } from "fs";
|
|
14
|
+
import { dirname, join } from "path";
|
|
15
|
+
import { fileURLToPath } from "url";
|
|
16
|
+
let cliVersion = "0.0.0";
|
|
17
|
+
try {
|
|
18
|
+
const pkgPath = join(dirname(fileURLToPath(import.meta.url)), "..", "package.json");
|
|
19
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
20
|
+
const version = pkg?.version;
|
|
21
|
+
if (typeof version === "string") {
|
|
22
|
+
cliVersion = version;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// Fallback — non-fatal (e.g., running from a bundled context)
|
|
27
|
+
}
|
|
28
|
+
export { cliVersion };
|
|
29
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,IAAI,UAAU,GAAG,OAAO,CAAC;AACzB,IAAI,CAAC;IACH,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;IACpF,MAAM,GAAG,GAAY,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAChE,MAAM,OAAO,GAAI,GAAoC,EAAE,OAAO,CAAC;IAC/D,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,UAAU,GAAG,OAAO,CAAC;IACvB,CAAC;AACH,CAAC;AAAC,MAAM,CAAC;IACP,8DAA8D;AAChE,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|