@kya-os/cli 1.8.1 → 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 +1 -1
- package/dist/commands/checkpoint-init.d.ts.map +1 -1
- package/dist/commands/checkpoint-init.js +8 -41
- package/dist/commands/checkpoint-init.js.map +1 -1
- 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 +52 -9
- 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 +1 -1
- package/dist/utils/checkpoint-api.js +1 -1
- package/dist/utils/checkpoint-env.d.ts +1 -1
- package/dist/utils/checkpoint-env.js +2 -2
- package/dist/utils/checkpoint-env.js.map +1 -1
- package/dist/utils/checkpoint-scaffold.d.ts +1 -1
- package/dist/utils/checkpoint-scaffold.js +1 -1
- 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 -14
- package/dist/utils/dco/claude-config.d.ts.map +1 -1
- package/dist/utils/dco/claude-config.js +31 -97
- 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 -200
- 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 +15 -1
- package/dist/utils/poll.d.ts.map +1 -1
- package/dist/utils/poll.js +6 -3
- package/dist/utils/poll.js.map +1 -1
- 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,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Presentation primitives, ported from the V2 analytics surface.
|
|
3
|
+
*
|
|
4
|
+
* The reference is checkpoint's
|
|
5
|
+
* `apps/web/components/features/analytics/DESIGN.md`, whose layout spec is
|
|
6
|
+
* itself written as ASCII, so this is closer to a transcription than an
|
|
7
|
+
* interpretation:
|
|
8
|
+
*
|
|
9
|
+
* [ Bots ] [ AI ] [ Humans ] [ Blocked ] 7D · 30D · 90D
|
|
10
|
+
* ─────────────────────────────────────────────────────────────
|
|
11
|
+
* 259 sessions · 14 agents · 4 humans · 0 blocked last seen just now
|
|
12
|
+
* ─────────────────────────────────────────────────────────────
|
|
13
|
+
* ╭ Sessions over time 7D · daily ╮
|
|
14
|
+
* Recent activity
|
|
15
|
+
* Agent Sessions Humans behind Tools called Last seen
|
|
16
|
+
*
|
|
17
|
+
* @module cli/tui/components
|
|
18
|
+
*/
|
|
19
|
+
export interface Stat {
|
|
20
|
+
label: string;
|
|
21
|
+
value: string | number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The stat strip: `259 sessions · 14 agents · 4 humans · 0 blocked`.
|
|
25
|
+
*
|
|
26
|
+
* Value first, label second, matching the dashboard. Reading "259 sessions"
|
|
27
|
+
* is one glance; "sessions: 259" is two.
|
|
28
|
+
*/
|
|
29
|
+
export declare function StatStrip({ stats, trailing, width, }: {
|
|
30
|
+
stats: Stat[];
|
|
31
|
+
trailing?: string;
|
|
32
|
+
width: number;
|
|
33
|
+
}): JSX.Element;
|
|
34
|
+
/**
|
|
35
|
+
* Lens chips. One is active; the rest are affordances.
|
|
36
|
+
*
|
|
37
|
+
* The dashboard renders these as pills. A terminal has no pills, so the active
|
|
38
|
+
* one is the accent and the rest are dim, which is the same information with
|
|
39
|
+
* the same glance cost.
|
|
40
|
+
*/
|
|
41
|
+
export declare function Chips({ items, activeIndex, }: {
|
|
42
|
+
items: readonly string[];
|
|
43
|
+
/**
|
|
44
|
+
* Which chip is active, BY INDEX rather than by label. Matching on the label
|
|
45
|
+
* broke the moment labels carried their counts ("Open 3"), and it silently
|
|
46
|
+
* highlighted nothing rather than failing, which is the worst way for a
|
|
47
|
+
* selection bug to present.
|
|
48
|
+
*/
|
|
49
|
+
activeIndex: number;
|
|
50
|
+
}): JSX.Element;
|
|
51
|
+
/** A full-width horizontal rule, the dashboard's section divider. */
|
|
52
|
+
export declare function Rule({ width }: {
|
|
53
|
+
width: number;
|
|
54
|
+
}): JSX.Element;
|
|
55
|
+
export interface Column<T> {
|
|
56
|
+
header: string;
|
|
57
|
+
width: number;
|
|
58
|
+
/** Cell text. Colour is separate so the value and its emphasis stay apart. */
|
|
59
|
+
render: (row: T) => string;
|
|
60
|
+
color?: (row: T) => string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The column-matrix table from the design doc.
|
|
64
|
+
*
|
|
65
|
+
* Truncates rather than wraps. A wrapped row in a dense table destroys the
|
|
66
|
+
* column alignment that makes the table readable at a glance, and the
|
|
67
|
+
* alignment is the whole reason it is a table.
|
|
68
|
+
*/
|
|
69
|
+
/**
|
|
70
|
+
* Shrink columns until the row fits the pane.
|
|
71
|
+
*
|
|
72
|
+
* Declared widths are what the columns WANT; the pane decides what they get.
|
|
73
|
+
* Each pass takes a column from the widest column, so a narrow terminal eats
|
|
74
|
+
* into the roomiest field first and the tight ones (a status, a timestamp)
|
|
75
|
+
* keep their shape. Exported for its own test: the alternative is inferring
|
|
76
|
+
* the arithmetic from rendered frames, which is how an off-by-one hides.
|
|
77
|
+
*/
|
|
78
|
+
export declare function fitColumns<T>(columns: Column<T>[], width: number): number[];
|
|
79
|
+
export declare function Table<T>({ columns, rows, selected, empty, width, }: {
|
|
80
|
+
columns: Column<T>[];
|
|
81
|
+
rows: T[];
|
|
82
|
+
selected?: number;
|
|
83
|
+
empty: string;
|
|
84
|
+
width: number;
|
|
85
|
+
}): JSX.Element;
|
|
86
|
+
/**
|
|
87
|
+
* The "Sessions over time" pane as a text sparkline.
|
|
88
|
+
*
|
|
89
|
+
* The dashboard draws a stacked area chart. A terminal gets eight block
|
|
90
|
+
* glyphs, which carries the shape (the only thing anyone reads off that chart
|
|
91
|
+
* at a glance) without pretending to be a chart.
|
|
92
|
+
*/
|
|
93
|
+
export declare function Sparkline({ values }: {
|
|
94
|
+
values: number[];
|
|
95
|
+
}): JSX.Element;
|
|
96
|
+
/**
|
|
97
|
+
* A title row with an optional right-aligned hint.
|
|
98
|
+
*
|
|
99
|
+
* Replaces a bordered Pane component that nothing ever rendered. Two reasons
|
|
100
|
+
* it went: a border needs every row inside it padded to width or the right
|
|
101
|
+
* edge frays, and this is the third place a title-plus-hint row was hand-rolled
|
|
102
|
+
* -- each one an independent chance to forget the width and let the hint drift
|
|
103
|
+
* past the rule under it, which is exactly what the journal header did.
|
|
104
|
+
*/
|
|
105
|
+
export declare function SectionHeader({ title, hint, width, }: {
|
|
106
|
+
title: string;
|
|
107
|
+
hint?: string;
|
|
108
|
+
width: number;
|
|
109
|
+
}): JSX.Element;
|
|
110
|
+
//# sourceMappingURL=components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/tui/components.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAUH,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,KAAK,GACN,EAAE;IACD,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,GAAG,CAAC,OAAO,CAoBd;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,WAAW,GACZ,EAAE;IACD,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAYd;AAED,qEAAqE;AACrE,wBAAgB,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,GAAG,CAAC,OAAO,CAE9D;AAED,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC;CAC5B;AAED;;;;;;GAMG;AACH;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAgB3E;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,EACvB,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,KAAK,GACN,EAAE;IACD,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,GAAG,CAAC,OAAO,CAsDd;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,GAAG,CAAC,OAAO,CAQvE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,IAAI,EACJ,KAAK,GACN,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,GAAG,CAAC,OAAO,CAOd"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { theme } from "./theme.js";
|
|
4
|
+
import { plain } from "./sanitize.js";
|
|
5
|
+
/** The `a · b · c` separator the dashboard uses between inline facts. */
|
|
6
|
+
const DOT = " · ";
|
|
7
|
+
/**
|
|
8
|
+
* The stat strip: `259 sessions · 14 agents · 4 humans · 0 blocked`.
|
|
9
|
+
*
|
|
10
|
+
* Value first, label second, matching the dashboard. Reading "259 sessions"
|
|
11
|
+
* is one glance; "sessions: 259" is two.
|
|
12
|
+
*/
|
|
13
|
+
export function StatStrip({ stats, trailing, width, }) {
|
|
14
|
+
// The width is explicit, like Rule's, because space-between only distributes
|
|
15
|
+
// within a box that HAS a width. Left to size itself, Ink grows the box to
|
|
16
|
+
// fit its content, so the trailing text drifts past the rule above it by
|
|
17
|
+
// however long the stats happen to be -- wider on a busy ledger than a quiet
|
|
18
|
+
// one, which is the sort of misalignment that only shows up with real data.
|
|
19
|
+
return (_jsxs(Box, { width: width, justifyContent: "space-between", children: [_jsx(Box, { children: stats.map((s, i) => (_jsxs(Text, { children: [i > 0 ? _jsx(Text, { color: theme.dim, children: DOT }) : null, _jsx(Text, { bold: true, children: String(s.value) }), _jsxs(Text, { color: theme.dim, children: [" ", s.label] })] }, s.label))) }), trailing ? _jsx(Text, { color: theme.dim, children: trailing }) : null] }));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Lens chips. One is active; the rest are affordances.
|
|
23
|
+
*
|
|
24
|
+
* The dashboard renders these as pills. A terminal has no pills, so the active
|
|
25
|
+
* one is the accent and the rest are dim, which is the same information with
|
|
26
|
+
* the same glance cost.
|
|
27
|
+
*/
|
|
28
|
+
export function Chips({ items, activeIndex, }) {
|
|
29
|
+
return (_jsx(Box, { children: items.map((c, i) => (_jsx(Box, { marginRight: 2, children: _jsx(Text, { color: i === activeIndex ? theme.accent : theme.dim, bold: i === activeIndex, children: i === activeIndex ? `[ ${c} ]` : ` ${c} ` }) }, c))) }));
|
|
30
|
+
}
|
|
31
|
+
/** A full-width horizontal rule, the dashboard's section divider. */
|
|
32
|
+
export function Rule({ width }) {
|
|
33
|
+
return _jsx(Text, { color: theme.line, children: "─".repeat(Math.max(0, width)) });
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The column-matrix table from the design doc.
|
|
37
|
+
*
|
|
38
|
+
* Truncates rather than wraps. A wrapped row in a dense table destroys the
|
|
39
|
+
* column alignment that makes the table readable at a glance, and the
|
|
40
|
+
* alignment is the whole reason it is a table.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* Shrink columns until the row fits the pane.
|
|
44
|
+
*
|
|
45
|
+
* Declared widths are what the columns WANT; the pane decides what they get.
|
|
46
|
+
* Each pass takes a column from the widest column, so a narrow terminal eats
|
|
47
|
+
* into the roomiest field first and the tight ones (a status, a timestamp)
|
|
48
|
+
* keep their shape. Exported for its own test: the alternative is inferring
|
|
49
|
+
* the arithmetic from rendered frames, which is how an off-by-one hides.
|
|
50
|
+
*/
|
|
51
|
+
export function fitColumns(columns, width) {
|
|
52
|
+
const MIN = 4;
|
|
53
|
+
// Each cell renders its padded text plus one space of gutter.
|
|
54
|
+
const widths = columns.map((c) => c.width);
|
|
55
|
+
const total = () => widths.reduce((a, b) => a + b + 1, 0);
|
|
56
|
+
// Bounded by construction: every pass either shrinks a column or finds
|
|
57
|
+
// nothing above the floor and stops, so this cannot spin.
|
|
58
|
+
while (total() > width) {
|
|
59
|
+
let widest = 0;
|
|
60
|
+
for (let i = 1; i < widths.length; i++) {
|
|
61
|
+
if (widths[i] > widths[widest])
|
|
62
|
+
widest = i;
|
|
63
|
+
}
|
|
64
|
+
if (widths[widest] <= MIN)
|
|
65
|
+
break;
|
|
66
|
+
widths[widest]--;
|
|
67
|
+
}
|
|
68
|
+
return widths;
|
|
69
|
+
}
|
|
70
|
+
export function Table({ columns, rows, selected, empty, width, }) {
|
|
71
|
+
// Sanitize BEFORE measuring: a stripped escape must not still count toward
|
|
72
|
+
// the column width, or a hostile title silently squeezes the real columns.
|
|
73
|
+
const pad = (raw, w) => {
|
|
74
|
+
const s = plain(raw);
|
|
75
|
+
return s.length > w ? (w > 1 ? s.slice(0, w - 1) + "\u2026" : s.slice(0, w)) : s.padEnd(w);
|
|
76
|
+
};
|
|
77
|
+
const fitted = fitColumns(columns, width);
|
|
78
|
+
// One header, used by both the empty and populated cases. It was duplicated,
|
|
79
|
+
// which is the shape where a column tweak lands in one branch and the empty
|
|
80
|
+
// table quietly keeps the old header.
|
|
81
|
+
const header = (_jsx(Box, { children: columns.map((c, i) => (_jsxs(Text, { color: theme.dim, children: [pad(c.header, fitted[i]), " "] }, c.header))) }));
|
|
82
|
+
if (rows.length === 0) {
|
|
83
|
+
// Never blank. The design doc is explicit that every lens gets honest,
|
|
84
|
+
// useful empty copy rather than an empty box.
|
|
85
|
+
return (_jsxs(Box, { flexDirection: "column", children: [header, _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: theme.dim, children: empty }) })] }));
|
|
86
|
+
}
|
|
87
|
+
return (_jsxs(Box, { flexDirection: "column", children: [header, rows.map((row, i) => (_jsx(Box, { children: columns.map((c, ci) => (_jsxs(Text, { color: i === selected ? theme.accent : c.color?.(row), bold: i === selected, children: [pad(c.render(row), fitted[ci]), " "] }, c.header))) }, i)))] }));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The "Sessions over time" pane as a text sparkline.
|
|
91
|
+
*
|
|
92
|
+
* The dashboard draws a stacked area chart. A terminal gets eight block
|
|
93
|
+
* glyphs, which carries the shape (the only thing anyone reads off that chart
|
|
94
|
+
* at a glance) without pretending to be a chart.
|
|
95
|
+
*/
|
|
96
|
+
export function Sparkline({ values }) {
|
|
97
|
+
if (values.length === 0)
|
|
98
|
+
return _jsx(Text, { color: theme.dim, children: "no data yet" });
|
|
99
|
+
const blocks = "▁▂▃▄▅▆▇█";
|
|
100
|
+
const max = Math.max(...values, 1);
|
|
101
|
+
const line = values
|
|
102
|
+
.map((v) => blocks[Math.min(blocks.length - 1, Math.round((v / max) * (blocks.length - 1)))])
|
|
103
|
+
.join("");
|
|
104
|
+
return _jsx(Text, { color: theme.accent, children: line });
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A title row with an optional right-aligned hint.
|
|
108
|
+
*
|
|
109
|
+
* Replaces a bordered Pane component that nothing ever rendered. Two reasons
|
|
110
|
+
* it went: a border needs every row inside it padded to width or the right
|
|
111
|
+
* edge frays, and this is the third place a title-plus-hint row was hand-rolled
|
|
112
|
+
* -- each one an independent chance to forget the width and let the hint drift
|
|
113
|
+
* past the rule under it, which is exactly what the journal header did.
|
|
114
|
+
*/
|
|
115
|
+
export function SectionHeader({ title, hint, width, }) {
|
|
116
|
+
return (_jsxs(Box, { width: width, justifyContent: "space-between", children: [_jsx(Text, { bold: true, children: title }), hint ? _jsx(Text, { color: theme.dim, children: hint }) : null] }));
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/tui/components.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,yEAAyE;AACzE,MAAM,GAAG,GAAG,KAAK,CAAC;AAOlB;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,KAAK,GAKN;IACC,6EAA6E;IAC7E,2EAA2E;IAC3E,yEAAyE;IACzE,6EAA6E;IAC7E,4EAA4E;IAC5E,OAAO,CACL,MAAC,GAAG,IAAC,KAAK,EAAE,KAAK,EAAE,cAAc,EAAC,eAAe,aAC/C,KAAC,GAAG,cACD,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACnB,MAAC,IAAI,eACF,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,GAAG,YAAG,GAAG,GAAQ,CAAC,CAAC,CAAC,IAAI,EACpD,KAAC,IAAI,IAAC,IAAI,kBAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,GAAQ,EACnC,MAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,GAAG,kBAAI,CAAC,CAAC,KAAK,IAAQ,KAHhC,CAAC,CAAC,KAAK,CAIX,CACR,CAAC,GACE,EACL,QAAQ,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,GAAG,YAAG,QAAQ,GAAQ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AC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,GAAG,4BAAoB,CAAC;IAC3E,MAAM,MAAM,GAAG,UAAU,CAAC;IAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,MAAM;SAChB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC5F,IAAI,CAAC,EAAE,CAAC,CAAC;IACZ,OAAO,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,YAAG,IAAI,GAAQ,CAAC;AAClD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,KAAK,EACL,IAAI,EACJ,KAAK,GAKN;IACC,OAAO,CACL,MAAC,GAAG,IAAC,KAAK,EAAE,KAAK,EAAE,cAAc,EAAC,eAAe,aAC/C,KAAC,IAAI,IAAC,IAAI,kBAAE,KAAK,GAAQ,EACxB,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,GAAG,YAAG,IAAI,GAAQ,CAAC,CAAC,CAAC,IAAI,IAChD,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TUI entry point.
|
|
3
|
+
*
|
|
4
|
+
* Ink and React are OPTIONAL dependencies loaded here and nowhere else. A
|
|
5
|
+
* `kya-os init` run may now offer to open this (review-loop P18) -- but only
|
|
6
|
+
* on an explicit yes, and only from a TTY; a plain, non-interactive, or
|
|
7
|
+
* declined init never imports ink or React, so the lazy-import property this
|
|
8
|
+
* module has always documented still holds: nobody pays for a React
|
|
9
|
+
* renderer without asking for one. Same reasoning as better-sqlite3.
|
|
10
|
+
*
|
|
11
|
+
* @module cli/tui
|
|
12
|
+
*/
|
|
13
|
+
import { type Ledger } from "../orchestrator/db/index.js";
|
|
14
|
+
import type { LedgerSnapshot } from "./views/index.js";
|
|
15
|
+
export declare function readSnapshot(db: Ledger): LedgerSnapshot;
|
|
16
|
+
/**
|
|
17
|
+
* One-shot text rendering for a non-TTY.
|
|
18
|
+
*
|
|
19
|
+
* A TUI that hangs or exits non-zero when piped breaks CI for everyone, so the
|
|
20
|
+
* non-interactive path prints a snapshot and exits 0 rather than trying to
|
|
21
|
+
* take over a terminal that isn't there.
|
|
22
|
+
*/
|
|
23
|
+
export declare function renderSnapshotText(snap: LedgerSnapshot): string;
|
|
24
|
+
export interface RunTuiOptions {
|
|
25
|
+
ledgerPath?: string;
|
|
26
|
+
/** Nav id to land on instead of the default first item (e.g. "agents"). */
|
|
27
|
+
initialViewId?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function runTui(opts?: RunTuiOptions): Promise<void>;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tui/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAKtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,CAMvD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAwB/D;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAsB,MAAM,CAAC,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6CpE"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TUI entry point.
|
|
3
|
+
*
|
|
4
|
+
* Ink and React are OPTIONAL dependencies loaded here and nowhere else. A
|
|
5
|
+
* `kya-os init` run may now offer to open this (review-loop P18) -- but only
|
|
6
|
+
* on an explicit yes, and only from a TTY; a plain, non-interactive, or
|
|
7
|
+
* declined init never imports ink or React, so the lazy-import property this
|
|
8
|
+
* module has always documented still holds: nobody pays for a React
|
|
9
|
+
* renderer without asking for one. Same reasoning as better-sqlite3.
|
|
10
|
+
*
|
|
11
|
+
* @module cli/tui
|
|
12
|
+
*/
|
|
13
|
+
import { openLedger } from "../orchestrator/db/index.js";
|
|
14
|
+
import { plain } from "./sanitize.js";
|
|
15
|
+
import { listTickets } from "../orchestrator/db/tickets.js";
|
|
16
|
+
import { listJournal } from "../orchestrator/db/journal.js";
|
|
17
|
+
import { listDispatches } from "../orchestrator/db/dispatches.js";
|
|
18
|
+
export function readSnapshot(db) {
|
|
19
|
+
return {
|
|
20
|
+
tickets: listTickets(db),
|
|
21
|
+
journal: listJournal(db, 200),
|
|
22
|
+
dispatches: listDispatches(db),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* One-shot text rendering for a non-TTY.
|
|
27
|
+
*
|
|
28
|
+
* A TUI that hangs or exits non-zero when piped breaks CI for everyone, so the
|
|
29
|
+
* non-interactive path prints a snapshot and exits 0 rather than trying to
|
|
30
|
+
* take over a terminal that isn't there.
|
|
31
|
+
*/
|
|
32
|
+
export function renderSnapshotText(snap) {
|
|
33
|
+
const open = snap.tickets.filter((t) => t.status === "open").length;
|
|
34
|
+
const blocked = snap.tickets.filter((t) => t.status === "blocked").length;
|
|
35
|
+
// "1 dispatches" reads like a bug in the ledger rather than in the label,
|
|
36
|
+
// which is a bad first impression for a line whose whole job is to tell you
|
|
37
|
+
// the numbers are trustworthy.
|
|
38
|
+
const count = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
|
39
|
+
const lines = [
|
|
40
|
+
"KYA-OS orchestrator",
|
|
41
|
+
"",
|
|
42
|
+
`${count(snap.tickets.length, "ticket")} · ${open} open · ${blocked} blocked · ` +
|
|
43
|
+
`${count(snap.dispatches.length, "dispatch", "dispatches")} · ` +
|
|
44
|
+
`${count(snap.journal.length, "observation")}`,
|
|
45
|
+
];
|
|
46
|
+
if (snap.tickets.length) {
|
|
47
|
+
lines.push("", "Tickets");
|
|
48
|
+
for (const t of snap.tickets.slice(0, 10)) {
|
|
49
|
+
// Same hazard as the rendered frame: piping does not mean the far end
|
|
50
|
+
// is not a terminal. `... | cat` and `... | less` both still paint one.
|
|
51
|
+
lines.push(` ${t.status.padEnd(12)} ${plain(t.title)}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return lines.join("\n");
|
|
55
|
+
}
|
|
56
|
+
export async function runTui(opts = {}) {
|
|
57
|
+
const db = openLedger(opts.ledgerPath);
|
|
58
|
+
// Every exit from here on, including a throw from ink/react loading, the
|
|
59
|
+
// dynamic view imports, render, or waitUntilExit, must still close the
|
|
60
|
+
// handle. Sibling orchestrator commands hold the same invariant via
|
|
61
|
+
// withLedger; this path is async so it earns its own try/finally.
|
|
62
|
+
try {
|
|
63
|
+
const snap = readSnapshot(db);
|
|
64
|
+
if (!process.stdout.isTTY) {
|
|
65
|
+
process.stdout.write(renderSnapshotText(snap) + "\n");
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
let render;
|
|
69
|
+
let React;
|
|
70
|
+
try {
|
|
71
|
+
({ render } = await import("ink"));
|
|
72
|
+
React = await import("react");
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
throw new Error("The TUI needs the optional 'ink' and 'react' dependencies, which are not " +
|
|
76
|
+
"installed. Install them with `npm install ink react`, or use " +
|
|
77
|
+
"`kya-os orchestrator status` for a text view. " +
|
|
78
|
+
`Underlying error: ${err instanceof Error ? err.message : String(err)}`);
|
|
79
|
+
}
|
|
80
|
+
const { App } = await import("./app.js");
|
|
81
|
+
const { buildViews } = await import("./views/registry.js");
|
|
82
|
+
const { waitUntilExit } = render(React.createElement(App, {
|
|
83
|
+
views: await buildViews(snap),
|
|
84
|
+
width: process.stdout.columns ?? 100,
|
|
85
|
+
height: process.stdout.rows ?? 30,
|
|
86
|
+
authenticated: false,
|
|
87
|
+
initialViewId: opts.initialViewId,
|
|
88
|
+
}));
|
|
89
|
+
await waitUntilExit();
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
db.close();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tui/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAe,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGlE,MAAM,UAAU,YAAY,CAAC,EAAU;IACrC,OAAO;QACL,OAAO,EAAE,WAAW,CAAC,EAAE,CAAC;QACxB,OAAO,EAAE,WAAW,CAAC,EAAE,EAAE,GAAG,CAAC;QAC7B,UAAU,EAAE,cAAc,CAAC,EAAE,CAAC;KAC/B,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAoB;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CA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,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,GAAG;YACpC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE;YACjC,aAAa,EAAE,KAAK;YACpB,aAAa,EAAE,IAAI,CAAC,aAAa;SAClC,CAAC,CACH,CAAC;QACF,MAAM,aAAa,EAAE,CAAC;IACxB,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyboard handling as a pure function.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from the component deliberately. Driving keystrokes through a
|
|
5
|
+
* renderer to assert on a rendered frame tests the harness as much as the
|
|
6
|
+
* logic, and when it fails you cannot tell which one broke. A reducer over
|
|
7
|
+
* (state, key) -> state is directly testable, and the component becomes a
|
|
8
|
+
* thin adapter that owns no behaviour worth testing.
|
|
9
|
+
*
|
|
10
|
+
* @module cli/tui/keymap
|
|
11
|
+
*/
|
|
12
|
+
export interface KeyState {
|
|
13
|
+
index: number;
|
|
14
|
+
/** Index into the active view's own filter list. */
|
|
15
|
+
filter: number;
|
|
16
|
+
showHelp: boolean;
|
|
17
|
+
exit: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface KeyEvent {
|
|
20
|
+
input: string;
|
|
21
|
+
upArrow?: boolean;
|
|
22
|
+
downArrow?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Apply one key press.
|
|
26
|
+
*
|
|
27
|
+
* `count` is how many selectable nav entries exist; `filters` how many filter
|
|
28
|
+
* chips the CURRENT view offers. Moving to another view resets the filter,
|
|
29
|
+
* because the index means something different there -- leaving it at 3 while
|
|
30
|
+
* landing on a view with two chips would select a chip that is not on screen.
|
|
31
|
+
*/
|
|
32
|
+
export declare function reduceKey(state: KeyState, ev: KeyEvent, count: number, filters?: number): KeyState;
|
|
33
|
+
//# sourceMappingURL=keymap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keymap.d.ts","sourceRoot":"","sources":["../../src/tui/keymap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,QAAQ,EACf,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,SAAI,GACV,QAAQ,CA+BV"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyboard handling as a pure function.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from the component deliberately. Driving keystrokes through a
|
|
5
|
+
* renderer to assert on a rendered frame tests the harness as much as the
|
|
6
|
+
* logic, and when it fails you cannot tell which one broke. A reducer over
|
|
7
|
+
* (state, key) -> state is directly testable, and the component becomes a
|
|
8
|
+
* thin adapter that owns no behaviour worth testing.
|
|
9
|
+
*
|
|
10
|
+
* @module cli/tui/keymap
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Apply one key press.
|
|
14
|
+
*
|
|
15
|
+
* `count` is how many selectable nav entries exist; `filters` how many filter
|
|
16
|
+
* chips the CURRENT view offers. Moving to another view resets the filter,
|
|
17
|
+
* because the index means something different there -- leaving it at 3 while
|
|
18
|
+
* landing on a view with two chips would select a chip that is not on screen.
|
|
19
|
+
*/
|
|
20
|
+
export function reduceKey(state, ev, count, filters = 1) {
|
|
21
|
+
const { input } = ev;
|
|
22
|
+
if (input === "q")
|
|
23
|
+
return { ...state, exit: true };
|
|
24
|
+
if (input === "?")
|
|
25
|
+
return { ...state, showHelp: !state.showHelp };
|
|
26
|
+
// Cycle the active view's filter. Wrapping in both directions keeps one key
|
|
27
|
+
// sufficient on a short list while still allowing a step back on a long one.
|
|
28
|
+
if (input === "f") {
|
|
29
|
+
return { ...state, filter: filters > 0 ? (state.filter + 1) % filters : 0 };
|
|
30
|
+
}
|
|
31
|
+
if (input === "F") {
|
|
32
|
+
return { ...state, filter: filters > 0 ? (state.filter - 1 + filters) % filters : 0 };
|
|
33
|
+
}
|
|
34
|
+
if (ev.downArrow || input === "j") {
|
|
35
|
+
return { ...state, index: Math.min(count - 1, state.index + 1), filter: 0 };
|
|
36
|
+
}
|
|
37
|
+
if (ev.upArrow || input === "k") {
|
|
38
|
+
return { ...state, index: Math.max(0, state.index - 1), filter: 0 };
|
|
39
|
+
}
|
|
40
|
+
// Number keys jump straight to a view. Bounded by BOTH 9 and the actual
|
|
41
|
+
// entry count: a nav list shorter than nine must not accept a key that
|
|
42
|
+
// selects nothing, and one longer than nine must not be reachable past 9.
|
|
43
|
+
const n = Number.parseInt(input, 10);
|
|
44
|
+
if (Number.isInteger(n) && n >= 1 && n <= Math.min(9, count)) {
|
|
45
|
+
return { ...state, index: n - 1, filter: 0 };
|
|
46
|
+
}
|
|
47
|
+
return state;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=keymap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keymap.js","sourceRoot":"","sources":["../../src/tui/keymap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAgBH;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CACvB,KAAe,EACf,EAAY,EACZ,KAAa,EACb,OAAO,GAAG,CAAC;IAEX,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;IAErB,IAAI,KAAK,KAAK,GAAG;QAAE,OAAO,EAAE,GAAG,KAAK,E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AAE,EAAE,CAAC,CAAC;IACrC,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;QAC7D,OAAO,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAC/C,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sidebar navigation.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the V2 dashboard's own tree (components/features/layout/hooks/
|
|
5
|
+
* use-sidebar-data.tsx in checkpoint): Monitor, Analyze, Agents, Projects,
|
|
6
|
+
* Settings. Same names in the same order, so someone who knows the dashboard
|
|
7
|
+
* already knows this.
|
|
8
|
+
*
|
|
9
|
+
* `source` is the honest part. Views backed by the local ledger have real data
|
|
10
|
+
* now; views backed by Checkpoint need the /api/v1/cli/monitor read plane,
|
|
11
|
+
* which does not exist yet, and say so rather than rendering a convincing
|
|
12
|
+
* empty table.
|
|
13
|
+
*
|
|
14
|
+
* @module cli/tui/nav
|
|
15
|
+
*/
|
|
16
|
+
export type ViewSource = "ledger" | "checkpoint";
|
|
17
|
+
export interface NavItem {
|
|
18
|
+
id: string;
|
|
19
|
+
title: string;
|
|
20
|
+
source: ViewSource;
|
|
21
|
+
/** Indent level: 0 = section, 1 = child. */
|
|
22
|
+
depth: 0 | 1;
|
|
23
|
+
/** Section headers are labels, not destinations. */
|
|
24
|
+
selectable: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare const NAV: NavItem[];
|
|
27
|
+
export declare const SELECTABLE: NavItem[];
|
|
28
|
+
export declare function navIndexOf(id: string): number;
|
|
29
|
+
//# sourceMappingURL=nav.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["../../src/tui/nav.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,YAAY,CAAC;AAEjD,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,UAAU,CAAC;IACnB,4CAA4C;IAC5C,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;IACb,oDAAoD;IACpD,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,GAAG,EAAE,OAAO,EAqBxB,CAAC;AAEF,eAAO,MAAM,UAAU,WAAkC,CAAC;AAE1D,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE7C"}
|
package/dist/tui/nav.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sidebar navigation.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the V2 dashboard's own tree (components/features/layout/hooks/
|
|
5
|
+
* use-sidebar-data.tsx in checkpoint): Monitor, Analyze, Agents, Projects,
|
|
6
|
+
* Settings. Same names in the same order, so someone who knows the dashboard
|
|
7
|
+
* already knows this.
|
|
8
|
+
*
|
|
9
|
+
* `source` is the honest part. Views backed by the local ledger have real data
|
|
10
|
+
* now; views backed by Checkpoint need the /api/v1/cli/monitor read plane,
|
|
11
|
+
* which does not exist yet, and say so rather than rendering a convincing
|
|
12
|
+
* empty table.
|
|
13
|
+
*
|
|
14
|
+
* @module cli/tui/nav
|
|
15
|
+
*/
|
|
16
|
+
export const NAV = [
|
|
17
|
+
{ id: "monitor", title: "Monitor", source: "checkpoint", depth: 0, selectable: true },
|
|
18
|
+
{ id: "monitor.access", title: "Control access", source: "checkpoint", depth: 1, selectable: true },
|
|
19
|
+
{ id: "analyze", title: "Analyze", source: "checkpoint", depth: 0, selectable: true },
|
|
20
|
+
{ id: "sect.orchestrator", title: "Orchestrator", source: "ledger", depth: 0, selectable: false },
|
|
21
|
+
{ id: "orc.tickets", title: "Tickets", source: "ledger", depth: 1, selectable: true },
|
|
22
|
+
{ id: "orc.dispatches", title: "Dispatches", source: "ledger", depth: 1, selectable: true },
|
|
23
|
+
{ id: "orc.review", title: "Review", source: "ledger", depth: 1, selectable: true },
|
|
24
|
+
{ id: "orc.journal", title: "Journal", source: "ledger", depth: 1, selectable: true },
|
|
25
|
+
// Real local data now (~/.mcpi/profiles/, review-loop P18), not the
|
|
26
|
+
// Checkpoint read plane the rest of this file's "checkpoint" entries wait
|
|
27
|
+
// on -- see tui/views/agents.tsx.
|
|
28
|
+
{ id: "agents", title: "Agents", source: "ledger", depth: 0, selectable: true },
|
|
29
|
+
{ id: "agents.marketplace", title: "Marketplace", source: "checkpoint", depth: 1, selectable: true },
|
|
30
|
+
{ id: "projects", title: "Projects", source: "checkpoint", depth: 0, selectable: true },
|
|
31
|
+
{ id: "settings", title: "Settings", source: "checkpoint", depth: 0, selectable: true },
|
|
32
|
+
{ id: "settings.keys", title: "API keys", source: "checkpoint", depth: 1, selectable: true },
|
|
33
|
+
{ id: "settings.docs", title: "Documentation", source: "checkpoint", depth: 1, selectable: true },
|
|
34
|
+
];
|
|
35
|
+
export const SELECTABLE = NAV.filter((n) => n.selectable);
|
|
36
|
+
export function navIndexOf(id) {
|
|
37
|
+
return SELECTABLE.findIndex((n) => n.id === id);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=nav.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav.js","sourceRoot":"","sources":["../../src/tui/nav.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAcH,MAAM,CAAC,MAAM,GAAG,GAAc;IAC5B,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,E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AC,EAAE,UAAU,EAAE,IAAI,EAAE;IACpG,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;IAEvF,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;IACvF,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;IAC5F,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;CAClG,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;AAE1D,MAAM,UAAU,UAAU,CAAC,EAAU;IACnC,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal-safety for text that came from somewhere else.
|
|
3
|
+
*
|
|
4
|
+
* This lives in its own module, apart from the components that use it, because
|
|
5
|
+
* `components.tsx` imports ink at module scope and the non-TTY snapshot path
|
|
6
|
+
* must not. Pulling the sanitizer out of there would load ink eagerly and
|
|
7
|
+
* defeat the optional-dependency design -- an install that never opens the TUI
|
|
8
|
+
* would start paying for it, and a missing install would fail on a plain
|
|
9
|
+
* `kya-os orchestrator tui | cat` instead of printing text.
|
|
10
|
+
*
|
|
11
|
+
* @module cli/tui/sanitize
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Strip terminal control sequences from a remote-authored string.
|
|
15
|
+
*
|
|
16
|
+
* Ledger rows carry text this process did not write: ticket titles mirrored
|
|
17
|
+
* from Linear, agent names, branch and repo names. Both render paths hand
|
|
18
|
+
* strings to a terminal as-is, so a title containing a screen-clear and a
|
|
19
|
+
* cursor-home sequence blanks the operator's display, and whatever follows
|
|
20
|
+
* paints wherever it likes -- enough to forge a credential prompt inside a
|
|
21
|
+
* console the operator has every reason to trust. Confirmed reachable before
|
|
22
|
+
* this existed.
|
|
23
|
+
*/
|
|
24
|
+
export declare function plain(value: string): string;
|
|
25
|
+
//# sourceMappingURL=sanitize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/tui/sanitize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAa3C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal-safety for text that came from somewhere else.
|
|
3
|
+
*
|
|
4
|
+
* This lives in its own module, apart from the components that use it, because
|
|
5
|
+
* `components.tsx` imports ink at module scope and the non-TTY snapshot path
|
|
6
|
+
* must not. Pulling the sanitizer out of there would load ink eagerly and
|
|
7
|
+
* defeat the optional-dependency design -- an install that never opens the TUI
|
|
8
|
+
* would start paying for it, and a missing install would fail on a plain
|
|
9
|
+
* `kya-os orchestrator tui | cat` instead of printing text.
|
|
10
|
+
*
|
|
11
|
+
* @module cli/tui/sanitize
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Strip terminal control sequences from a remote-authored string.
|
|
15
|
+
*
|
|
16
|
+
* Ledger rows carry text this process did not write: ticket titles mirrored
|
|
17
|
+
* from Linear, agent names, branch and repo names. Both render paths hand
|
|
18
|
+
* strings to a terminal as-is, so a title containing a screen-clear and a
|
|
19
|
+
* cursor-home sequence blanks the operator's display, and whatever follows
|
|
20
|
+
* paints wherever it likes -- enough to forge a credential prompt inside a
|
|
21
|
+
* console the operator has every reason to trust. Confirmed reachable before
|
|
22
|
+
* this existed.
|
|
23
|
+
*/
|
|
24
|
+
export function plain(value) {
|
|
25
|
+
return (value
|
|
26
|
+
// CSI sequences (colour, cursor movement, screen clear).
|
|
27
|
+
.replace(/\u001b\[[0-9;?]*[ -\/]*[@-~]/g, "")
|
|
28
|
+
// OSC sequences (window title, hyperlinks), terminated by BEL or ST.
|
|
29
|
+
.replace(/\u001b\][^\u0007\u001b]*(?:\u0007|\u001b\\)/g, "")
|
|
30
|
+
// Any other escape-introduced sequence.
|
|
31
|
+
.replace(/\u001b./g, "")
|
|
32
|
+
// Bare control characters: carriage return overwrites the line already
|
|
33
|
+
// printed, backspace erases it, BEL rings, newline splits one row in two.
|
|
34
|
+
.replace(/[\u0000-\u001f\u007f-\u009f]/g, ""));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=sanitize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../../src/tui/sanitize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa;IACjC,OAAO,CACL,KAAK;QACH,yDAAyD;SACxD,OAAO,CAAC,+BAA+B,EAAE,EAAE,CAAC;QAC7C,qEAAqE;SACpE,OAAO,CAAC,8CAA8C,EAAE,EAAE,CAAC;QAC5D,wCAAwC;SACvC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;QACxB,uEAAuE;QACvE,0EAA0E;SACzE,OAAO,CAAC,+BAA+B,EAAE,EAAE,CAAC,CAChD,CAAC;AACJ,CAAC"}
|