@crouton-kit/crouter 0.3.31 → 0.3.33
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/README.md +8 -0
- package/dist/build-root.js +1 -0
- package/dist/builtin-memory/crouter-development/marketplaces.md +2 -2
- package/dist/builtin-memory/crouter-development/personas/base-prompt.md +2 -2
- package/dist/builtin-memory/crouter-development/personas/orchestrator-prompt.md +5 -5
- package/dist/builtin-memory/crouter-development/personas.md +3 -4
- package/dist/builtin-memory/crouter-development/plugins.md +18 -18
- package/dist/builtin-memory/design.md +4 -1
- package/dist/builtin-memory/development.md +4 -1
- package/dist/builtin-memory/internal/INDEX.md +1 -1
- package/dist/builtin-memory/internal/nodes-and-canvas.md +6 -6
- package/dist/builtin-memory/internal/storage-tiers.md +5 -5
- package/dist/builtin-memory/planning.md +4 -1
- package/dist/builtin-memory/product.md +80 -0
- package/dist/builtin-memory/spec.md +4 -1
- package/dist/builtin-personas/advisor/PERSONA.md +10 -0
- package/dist/builtin-personas/design/PERSONA.md +2 -2
- package/dist/builtin-personas/design/orchestrator.md +3 -3
- package/dist/builtin-personas/developer/PERSONA.md +1 -1
- package/dist/builtin-personas/developer/orchestrator.md +2 -2
- package/dist/builtin-personas/explore/PERSONA.md +3 -3
- package/dist/builtin-personas/explore/orchestrator.md +4 -2
- package/dist/builtin-personas/general/PERSONA.md +1 -1
- package/dist/builtin-personas/general/orchestrator.md +1 -1
- package/dist/builtin-personas/orchestration-kernel.md +7 -14
- package/dist/builtin-personas/plan/PERSONA.md +1 -1
- package/dist/builtin-personas/plan/orchestrator.md +2 -2
- package/dist/builtin-personas/plan/reviewers/architecture-fit/PERSONA.md +1 -1
- package/dist/builtin-personas/plan/reviewers/code-smells/PERSONA.md +1 -1
- package/dist/builtin-personas/plan/reviewers/pattern-consistency/PERSONA.md +1 -1
- package/dist/builtin-personas/plan/reviewers/requirements-coverage/PERSONA.md +1 -1
- package/dist/builtin-personas/plan/reviewers/security/PERSONA.md +1 -1
- package/dist/builtin-personas/product/PERSONA.md +18 -0
- package/dist/builtin-personas/product/orchestrator.md +14 -0
- package/dist/builtin-personas/product/teardown/PERSONA.md +13 -0
- package/dist/builtin-personas/review/PERSONA.md +1 -1
- package/dist/builtin-personas/review/orchestrator.md +1 -1
- package/dist/builtin-personas/runtime-base.md +5 -0
- package/dist/builtin-personas/spec/PERSONA.md +1 -1
- package/dist/builtin-personas/spec/orchestrator.md +2 -2
- package/dist/builtin-personas/spec/requirements/PERSONA.md +1 -1
- package/dist/builtin-views/canvas/core.mjs +82 -1
- package/dist/builtin-views/canvas/tui.mjs +9 -5
- package/dist/builtin-views/canvas/web.jsx +3 -2
- package/dist/builtin-views/chat/core.mjs +725 -0
- package/dist/builtin-views/chat/text.mjs +101 -0
- package/dist/builtin-views/chat/tui.mjs +368 -0
- package/dist/builtin-views/chat/web.jsx +367 -0
- package/dist/builtin-views/prompt-review/core.mjs +863 -0
- package/dist/builtin-views/prompt-review/text.mjs +15 -0
- package/dist/builtin-views/prompt-review/tui.mjs +196 -0
- package/dist/builtin-views/prompt-review/web.jsx +484 -0
- package/dist/builtin-views/settings/core.mjs +397 -0
- package/dist/builtin-views/settings/text.mjs +40 -0
- package/dist/builtin-views/settings/tui.mjs +95 -0
- package/dist/builtin-views/settings/web.jsx +167 -0
- package/dist/cli.js +16 -3
- package/dist/clients/attach/__tests__/autocomplete-and-bash-mode.test.js +96 -0
- package/dist/clients/attach/__tests__/bash-bang-routing.test.js +58 -0
- package/dist/clients/attach/__tests__/bundle-pi-tui-dedup.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/bundle-pi-tui-dedup.test.js +56 -0
- package/dist/clients/attach/__tests__/titled-editor.test.js +22 -1
- package/dist/clients/attach/attach-cmd.d.ts +18 -0
- package/dist/clients/attach/attach-cmd.js +1723 -795
- package/dist/clients/attach/canvas-panels.js +2 -2
- package/dist/clients/attach/chat-view.d.ts +10 -0
- package/dist/clients/attach/chat-view.js +23 -0
- package/dist/clients/attach/config-load.d.ts +8 -4
- package/dist/clients/attach/config-load.js +2 -0
- package/dist/clients/attach/extension-dialogs.d.ts +2 -3
- package/dist/clients/attach/extension-dialogs.js +7 -9
- package/dist/clients/attach/graph-overlay.js +3 -2
- package/dist/clients/attach/input-controller.d.ts +4 -3
- package/dist/clients/attach/input-controller.js +24 -3
- package/dist/clients/attach/slash-commands.d.ts +7 -7
- package/dist/clients/attach/slash-commands.js +38 -14
- package/dist/clients/attach/titled-editor.js +18 -14
- package/dist/clients/attach/view-socket.d.ts +2 -1
- package/dist/clients/attach/view-socket.js +27 -8
- package/dist/clients/web/__tests__/source-cache.test.d.ts +1 -0
- package/dist/clients/web/__tests__/source-cache.test.js +32 -0
- package/dist/clients/web/dev-server.js +1 -0
- package/dist/clients/web/events.js +9 -11
- package/dist/clients/web/server.d.ts +4 -3
- package/dist/clients/web/server.js +138 -31
- package/dist/clients/web/source-cache.d.ts +10 -0
- package/dist/clients/web/source-cache.js +57 -0
- package/dist/clients/web/web-cmd.js +28 -9
- package/dist/commands/__tests__/human.test.js +30 -28
- package/dist/commands/canvas-history/search.js +1 -1
- package/dist/commands/canvas-history.js +5 -8
- package/dist/commands/canvas-issue.d.ts +2 -0
- package/dist/commands/canvas-issue.js +148 -0
- package/dist/commands/canvas-prune.js +19 -0
- package/dist/commands/canvas-rebuild-index.d.ts +2 -0
- package/dist/commands/canvas-rebuild-index.js +57 -0
- package/dist/commands/canvas-snapshot.d.ts +2 -0
- package/dist/commands/canvas-snapshot.js +48 -0
- package/dist/commands/canvas-tmux-spread.d.ts +2 -0
- package/dist/commands/canvas-tmux-spread.js +188 -0
- package/dist/commands/canvas.d.ts +1 -0
- package/dist/commands/canvas.js +16 -1
- package/dist/commands/chord.js +143 -48
- package/dist/commands/daemon.js +3 -3
- package/dist/commands/human/prompts.d.ts +0 -1
- package/dist/commands/human/prompts.js +39 -54
- package/dist/commands/human/queue.d.ts +12 -1
- package/dist/commands/human/queue.js +468 -73
- package/dist/commands/human/shared.d.ts +3 -4
- package/dist/commands/human/shared.js +3 -3
- package/dist/commands/human.js +11 -10
- package/dist/commands/memory/find.js +3 -2
- package/dist/commands/memory/list.js +4 -3
- package/dist/commands/memory/read.js +3 -3
- package/dist/commands/memory/shared.d.ts +1 -4
- package/dist/commands/memory/shared.js +6 -9
- package/dist/commands/memory/write.js +3 -3
- package/dist/commands/memory.js +4 -7
- package/dist/commands/node-context.d.ts +2 -0
- package/dist/commands/node-context.js +172 -0
- package/dist/commands/node-snapshot.d.ts +2 -0
- package/dist/commands/node-snapshot.js +123 -0
- package/dist/commands/node.js +228 -52
- package/dist/commands/pkg/plugin-inspect.js +6 -6
- package/dist/commands/pkg/plugin-manage.js +1 -1
- package/dist/commands/pkg/plugin.js +2 -2
- package/dist/commands/pkg.js +2 -2
- package/dist/commands/push.d.ts +2 -0
- package/dist/commands/push.js +79 -11
- package/dist/commands/revive.js +74 -1
- package/dist/commands/search/answer.d.ts +1 -0
- package/dist/commands/search/answer.js +50 -0
- package/dist/commands/search/contents.d.ts +1 -0
- package/dist/commands/search/contents.js +96 -0
- package/dist/commands/search/exa.d.ts +53 -0
- package/dist/commands/search/exa.js +155 -0
- package/dist/commands/search/puremd.d.ts +11 -0
- package/dist/commands/search/puremd.js +53 -0
- package/dist/commands/search/web.d.ts +1 -0
- package/dist/commands/search/web.js +65 -0
- package/dist/commands/search.d.ts +2 -0
- package/dist/commands/search.js +24 -0
- package/dist/commands/sys/__tests__/sync-import.test.d.ts +1 -0
- package/dist/commands/sys/__tests__/sync-import.test.js +72 -0
- package/dist/commands/sys/config.js +59 -10
- package/dist/commands/sys/doctor.js +56 -4
- package/dist/commands/sys/prompt-review.d.ts +1 -0
- package/dist/commands/sys/prompt-review.js +178 -0
- package/dist/commands/sys/promptstudio.d.ts +2 -0
- package/dist/commands/sys/promptstudio.js +65 -0
- package/dist/commands/sys/settings.d.ts +2 -0
- package/dist/commands/sys/settings.js +16 -0
- package/dist/commands/sys/sync.js +311 -159
- package/dist/commands/sys/sysprompt.d.ts +1 -0
- package/dist/commands/sys/sysprompt.js +86 -0
- package/dist/commands/sys.js +9 -5
- package/dist/commands/view-new.js +2 -2
- package/dist/core/__tests__/artifact-paths.test.d.ts +1 -0
- package/dist/core/__tests__/artifact-paths.test.js +44 -0
- package/dist/core/__tests__/broker-preflight.test.d.ts +1 -0
- package/dist/core/__tests__/broker-preflight.test.js +85 -0
- package/dist/core/__tests__/broker-sdk-wiring.test.js +15 -0
- package/dist/core/__tests__/canvas.test.js +37 -1
- package/dist/core/__tests__/chat-view-reconnect.test.d.ts +1 -0
- package/dist/core/__tests__/chat-view-reconnect.test.js +70 -0
- package/dist/core/__tests__/child-death-wake.test.js +11 -2
- package/dist/core/__tests__/close.test.js +39 -1
- package/dist/core/__tests__/connection-reconnect-resume.test.d.ts +1 -0
- package/dist/core/__tests__/connection-reconnect-resume.test.js +37 -0
- package/dist/core/__tests__/context-intro.test.js +48 -14
- package/dist/core/__tests__/daemon-boot.test.js +182 -9
- package/dist/core/__tests__/editor-label.test.d.ts +1 -0
- package/dist/core/__tests__/editor-label.test.js +26 -0
- package/dist/core/__tests__/fault-marker.test.d.ts +1 -0
- package/dist/core/__tests__/fault-marker.test.js +112 -0
- package/dist/core/__tests__/fault-retry-rewind.test.d.ts +1 -0
- package/dist/core/__tests__/fault-retry-rewind.test.js +123 -0
- package/dist/core/__tests__/fixtures/fake-engine.d.ts +30 -4
- package/dist/core/__tests__/fixtures/fake-engine.js +156 -17
- package/dist/core/__tests__/fixtures/fake-pi-host.js +10 -1
- package/dist/core/__tests__/full/human-new-window-regression.test.js +1 -1
- package/dist/core/__tests__/helpers/harness.d.ts +1 -1
- package/dist/core/__tests__/helpers/harness.js +9 -3
- package/dist/core/__tests__/human-stranded-deliver.test.js +38 -1
- package/dist/core/__tests__/human-surface-target.test.js +1 -1
- package/dist/core/__tests__/kickoff.test.js +18 -19
- package/dist/core/__tests__/memory-resolver.test.js +12 -1
- package/dist/core/__tests__/migration.test.js +49 -14
- package/dist/core/__tests__/model-ladders.test.d.ts +1 -0
- package/dist/core/__tests__/model-ladders.test.js +160 -0
- package/dist/core/__tests__/node-env.test.d.ts +1 -0
- package/dist/core/__tests__/node-env.test.js +26 -0
- package/dist/core/__tests__/push-final-guard.test.js +7 -1
- package/dist/core/__tests__/relaunch-root.test.js +9 -9
- package/dist/core/__tests__/revive.test.js +36 -6
- package/dist/core/__tests__/spawn-root.test.js +24 -1
- package/dist/core/__tests__/stop-guard.test.js +10 -0
- package/dist/core/__tests__/stranded-relaunch.test.d.ts +1 -0
- package/dist/core/__tests__/stranded-relaunch.test.js +72 -0
- package/dist/core/__tests__/tmux-surface.test.js +5 -1
- package/dist/core/__tests__/unknown-path.test.js +19 -19
- package/dist/core/__tests__/yield-ensures-daemon.test.d.ts +1 -0
- package/dist/core/__tests__/yield-ensures-daemon.test.js +54 -0
- package/dist/core/artifact.d.ts +2 -33
- package/dist/core/artifact.js +27 -87
- package/dist/core/bootstrap.js +2 -0
- package/dist/core/canvas/browse/__tests__/model.test.js +35 -1
- package/dist/core/canvas/browse/app.js +87 -17
- package/dist/core/canvas/browse/model.d.ts +10 -1
- package/dist/core/canvas/browse/model.js +37 -1
- package/dist/core/canvas/browse/render.js +35 -33
- package/dist/core/canvas/canvas.d.ts +7 -0
- package/dist/core/canvas/canvas.js +54 -5
- package/dist/core/canvas/db.js +35 -8
- package/dist/core/canvas/labels.d.ts +6 -8
- package/dist/core/canvas/labels.js +8 -11
- package/dist/core/canvas/nav-model.d.ts +5 -4
- package/dist/core/canvas/nav-model.js +31 -17
- package/dist/core/canvas/paths.d.ts +18 -1
- package/dist/core/canvas/paths.js +37 -2
- package/dist/core/canvas/render.d.ts +25 -0
- package/dist/core/canvas/render.js +96 -13
- package/dist/core/canvas/status-glyph.d.ts +35 -0
- package/dist/core/canvas/status-glyph.js +104 -0
- package/dist/core/canvas/types.d.ts +2 -2
- package/dist/core/config.js +114 -16
- package/dist/core/fault-classifier.d.ts +41 -0
- package/dist/core/fault-classifier.js +110 -0
- package/dist/core/feed/__tests__/empty-node-guard.test.d.ts +1 -0
- package/dist/core/feed/__tests__/empty-node-guard.test.js +45 -0
- package/dist/core/feed/feed.js +8 -0
- package/dist/core/feed/inbox.d.ts +15 -0
- package/dist/core/feed/inbox.js +40 -14
- package/dist/core/frontmatter.d.ts +1 -11
- package/dist/core/frontmatter.js +1 -55
- package/dist/core/hearth/config.d.ts +2 -0
- package/dist/core/hearth/config.js +75 -0
- package/dist/core/hearth/guest-env.d.ts +2 -0
- package/dist/core/hearth/guest-env.js +11 -0
- package/dist/core/hearth/index.d.ts +5 -0
- package/dist/core/hearth/index.js +5 -0
- package/dist/core/hearth/provider.d.ts +21 -0
- package/dist/core/hearth/provider.js +10 -0
- package/dist/core/hearth/providers/blaxel-bootstrap.d.ts +10 -0
- package/dist/core/hearth/providers/blaxel-bootstrap.js +39 -0
- package/dist/core/hearth/providers/blaxel-home.d.ts +11 -0
- package/dist/core/hearth/providers/blaxel-home.js +126 -0
- package/dist/core/hearth/providers/blaxel.d.ts +26 -0
- package/dist/core/hearth/providers/blaxel.js +208 -0
- package/dist/core/hearth/providers/types.d.ts +72 -0
- package/dist/core/hearth/providers/types.js +1 -0
- package/dist/core/hearth/registry.d.ts +15 -0
- package/dist/core/hearth/registry.js +179 -0
- package/dist/core/hearth/types.d.ts +121 -0
- package/dist/core/hearth/types.js +1 -0
- package/dist/core/host-exports/__tests__/export-prunes-boot-skill.test.d.ts +1 -0
- package/dist/core/host-exports/__tests__/export-prunes-boot-skill.test.js +79 -0
- package/dist/core/{skill-sync → host-exports}/builtins.d.ts +21 -13
- package/dist/core/host-exports/builtins.js +68 -0
- package/dist/core/{skill-sync → host-exports}/export.d.ts +9 -6
- package/dist/core/{skill-sync → host-exports}/export.js +37 -14
- package/dist/core/io.js +1 -1
- package/dist/core/log.d.ts +9 -0
- package/dist/core/log.js +113 -0
- package/dist/core/memory-resolver.d.ts +8 -8
- package/dist/core/memory-resolver.js +15 -28
- package/dist/core/personas/index.d.ts +4 -4
- package/dist/core/personas/index.js +2 -2
- package/dist/core/personas/loader.d.ts +51 -0
- package/dist/core/personas/loader.js +54 -50
- package/dist/core/personas/resolve.d.ts +43 -27
- package/dist/core/personas/resolve.js +336 -94
- package/dist/core/runtime/auth-reload.d.ts +7 -0
- package/dist/core/runtime/auth-reload.js +69 -0
- package/dist/core/runtime/bearings.d.ts +35 -15
- package/dist/core/runtime/bearings.js +305 -44
- package/dist/core/runtime/branded-host.d.ts +4 -2
- package/dist/core/runtime/branded-host.js +66 -4
- package/dist/core/runtime/broker-protocol.d.ts +38 -3
- package/dist/core/runtime/broker.js +343 -18
- package/dist/core/runtime/close.js +37 -29
- package/dist/core/runtime/connectivity.d.ts +12 -0
- package/dist/core/runtime/connectivity.js +73 -0
- package/dist/core/runtime/fault-recovery-nudge.d.ts +2 -0
- package/dist/core/runtime/fault-recovery-nudge.js +2 -0
- package/dist/core/runtime/fault-recovery.d.ts +23 -0
- package/dist/core/runtime/fault-recovery.js +74 -0
- package/dist/core/runtime/fault.d.ts +25 -0
- package/dist/core/runtime/fault.js +176 -0
- package/dist/core/runtime/front-door.d.ts +1 -1
- package/dist/core/runtime/front-door.js +2 -2
- package/dist/core/runtime/host.d.ts +10 -0
- package/dist/core/runtime/host.js +71 -9
- package/dist/core/runtime/kickoff.js +31 -45
- package/dist/core/runtime/launch.d.ts +32 -18
- package/dist/core/runtime/launch.js +148 -43
- package/dist/core/runtime/model-swap.d.ts +18 -0
- package/dist/core/runtime/model-swap.js +95 -0
- package/dist/core/runtime/naming.d.ts +7 -0
- package/dist/core/runtime/naming.js +61 -9
- package/dist/core/runtime/nodes.js +6 -1
- package/dist/core/runtime/persona.js +16 -17
- package/dist/core/runtime/placement.d.ts +36 -31
- package/dist/core/runtime/placement.js +149 -64
- package/dist/core/runtime/promote.d.ts +2 -0
- package/dist/core/runtime/promote.js +23 -3
- package/dist/core/runtime/recycle.js +6 -4
- package/dist/core/runtime/reset.d.ts +5 -2
- package/dist/core/runtime/reset.js +2 -2
- package/dist/core/runtime/revive.d.ts +4 -0
- package/dist/core/runtime/revive.js +27 -9
- package/dist/core/runtime/roadmap.d.ts +1 -1
- package/dist/core/runtime/roadmap.js +1 -1
- package/dist/core/runtime/spawn.d.ts +2 -2
- package/dist/core/runtime/spawn.js +30 -6
- package/dist/core/runtime/stop-guard.js +6 -1
- package/dist/core/runtime/tmux-chrome.d.ts +1 -1
- package/dist/core/runtime/tmux-chrome.js +1 -1
- package/dist/core/runtime/tmux.d.ts +29 -6
- package/dist/core/runtime/tmux.js +134 -80
- package/dist/core/runtime/view-socket-client.d.ts +46 -0
- package/dist/core/runtime/view-socket-client.js +203 -0
- package/dist/core/substrate/index.d.ts +1 -1
- package/dist/core/substrate/index.js +1 -1
- package/dist/core/substrate/on-read.js +16 -4
- package/dist/core/substrate/render.d.ts +10 -13
- package/dist/core/substrate/render.js +56 -51
- package/dist/core/tui/host.js +83 -18
- package/dist/core/view/__tests__/transport-cache.test.d.ts +1 -0
- package/dist/core/view/__tests__/transport-cache.test.js +62 -0
- package/dist/core/view/contract.d.ts +20 -0
- package/dist/core/view/stream-local.d.ts +3 -0
- package/dist/core/view/stream-local.js +184 -0
- package/dist/core/view/transport-cache.d.ts +8 -0
- package/dist/core/view/transport-cache.js +38 -0
- package/dist/core/view/transport-local.js +4 -0
- package/dist/core/view/transport.d.ts +7 -1
- package/dist/daemon/crtrd.d.ts +3 -19
- package/dist/daemon/crtrd.js +139 -178
- package/dist/daemon/manage.d.ts +18 -1
- package/dist/daemon/manage.js +54 -9
- package/dist/hearth/wake-proxy/__tests__/anthropic-oauth.test.d.ts +1 -0
- package/dist/hearth/wake-proxy/__tests__/anthropic-oauth.test.js +289 -0
- package/dist/hearth/wake-proxy/__tests__/config-timeout.test.d.ts +1 -0
- package/dist/hearth/wake-proxy/__tests__/config-timeout.test.js +34 -0
- package/dist/hearth/wake-proxy/__tests__/guest-source.test.d.ts +1 -0
- package/dist/hearth/wake-proxy/__tests__/guest-source.test.js +203 -0
- package/dist/hearth/wake-proxy/__tests__/hardening.test.d.ts +1 -0
- package/dist/hearth/wake-proxy/__tests__/hardening.test.js +59 -0
- package/dist/hearth/wake-proxy/__tests__/hearth-status-route.test.d.ts +1 -0
- package/dist/hearth/wake-proxy/__tests__/hearth-status-route.test.js +372 -0
- package/dist/hearth/wake-proxy/__tests__/http-running-route-fast-path.test.d.ts +1 -0
- package/dist/hearth/wake-proxy/__tests__/http-running-route-fast-path.test.js +258 -0
- package/dist/hearth/wake-proxy/__tests__/model-auth-routes.test.d.ts +1 -0
- package/dist/hearth/wake-proxy/__tests__/model-auth-routes.test.js +437 -0
- package/dist/hearth/wake-proxy/__tests__/source-bridge-gate.test.d.ts +1 -0
- package/dist/hearth/wake-proxy/__tests__/source-bridge-gate.test.js +455 -0
- package/dist/hearth/wake-proxy/__tests__/static-asset-allowlist.test.d.ts +1 -0
- package/dist/hearth/wake-proxy/__tests__/static-asset-allowlist.test.js +15 -0
- package/dist/hearth/wake-proxy/__tests__/warm-path-concurrency.test.d.ts +1 -0
- package/dist/hearth/wake-proxy/__tests__/warm-path-concurrency.test.js +141 -0
- package/dist/hearth/wake-proxy/__tests__/ws-teardown-accounting.test.d.ts +1 -0
- package/dist/hearth/wake-proxy/__tests__/ws-teardown-accounting.test.js +143 -0
- package/dist/hearth/wake-proxy/anthropic-oauth.d.ts +58 -0
- package/dist/hearth/wake-proxy/anthropic-oauth.js +189 -0
- package/dist/hearth/wake-proxy/auth.d.ts +22 -0
- package/dist/hearth/wake-proxy/auth.js +128 -0
- package/dist/hearth/wake-proxy/config.d.ts +2 -0
- package/dist/hearth/wake-proxy/config.js +151 -0
- package/dist/hearth/wake-proxy/guest-source.d.ts +14 -0
- package/dist/hearth/wake-proxy/guest-source.js +130 -0
- package/dist/hearth/wake-proxy/hearth-status.d.ts +44 -0
- package/dist/hearth/wake-proxy/hearth-status.js +267 -0
- package/dist/hearth/wake-proxy/home.d.ts +67 -0
- package/dist/hearth/wake-proxy/home.js +297 -0
- package/dist/hearth/wake-proxy/main.d.ts +1 -0
- package/dist/hearth/wake-proxy/main.js +134 -0
- package/dist/hearth/wake-proxy/model-auth.d.ts +13 -0
- package/dist/hearth/wake-proxy/model-auth.js +345 -0
- package/dist/hearth/wake-proxy/proxy.d.ts +35 -0
- package/dist/hearth/wake-proxy/proxy.js +716 -0
- package/dist/hearth/wake-proxy/public-source-gate.d.ts +9 -0
- package/dist/hearth/wake-proxy/public-source-gate.js +409 -0
- package/dist/hearth/wake-proxy/redact.d.ts +1 -0
- package/dist/hearth/wake-proxy/redact.js +17 -0
- package/dist/hearth/wake-proxy/server.d.ts +11 -0
- package/dist/hearth/wake-proxy/server.js +142 -0
- package/dist/hearth/wake-proxy/state.d.ts +18 -0
- package/dist/hearth/wake-proxy/state.js +342 -0
- package/dist/hearth/wake-proxy/types.d.ts +76 -0
- package/dist/hearth/wake-proxy/types.js +1 -0
- package/dist/index.js +3 -2
- package/dist/pi-extensions/__tests__/canvas-context-intro.test.js +6 -5
- package/dist/pi-extensions/canvas-context-intro.js +7 -7
- package/dist/pi-extensions/canvas-doc-substrate.js +19 -22
- package/dist/pi-extensions/canvas-nav.js +15 -8
- package/dist/pi-extensions/canvas-stophook.d.ts +1 -1
- package/dist/pi-extensions/canvas-stophook.js +78 -11
- package/dist/types.d.ts +39 -20
- package/dist/types.js +38 -13
- package/dist/web/runtime.js +141 -42
- package/dist/web/transport-http.js +7 -5
- package/dist/web/transport-stream.d.ts +3 -0
- package/dist/web/transport-stream.js +204 -0
- package/dist/web-client/assets/fragment-mono-latin-400-normal-BYwT3kSJ.woff +0 -0
- package/dist/web-client/assets/fragment-mono-latin-400-normal-yxdJ5AmL.woff2 +0 -0
- package/dist/web-client/assets/fragment-mono-latin-ext-400-normal-BbKYyvR9.woff2 +0 -0
- package/dist/web-client/assets/fragment-mono-latin-ext-400-normal-CT4YFKeK.woff +0 -0
- package/dist/web-client/assets/fraunces-latin-ext-wght-normal-Ca2vKHc0.woff2 +0 -0
- package/dist/web-client/assets/fraunces-latin-wght-normal-ukD16Tqj.woff2 +0 -0
- package/dist/web-client/assets/fraunces-vietnamese-wght-normal-CnvboYUG.woff2 +0 -0
- package/dist/web-client/assets/index-BZUxTkv5.css +2 -0
- package/dist/web-client/assets/index-D36PNBj4.js +80 -0
- package/dist/web-client/assets/instrument-sans-latin-ext-wght-normal-B5bTHO_g.woff2 +0 -0
- package/dist/web-client/assets/instrument-sans-latin-wght-normal-BbzFLZTg.woff2 +0 -0
- package/dist/web-client/assets/martian-mono-cyrillic-wght-normal-B84CD5C_.woff2 +0 -0
- package/dist/web-client/assets/martian-mono-latin-ext-wght-normal-DlL6xMw5.woff2 +0 -0
- package/dist/web-client/assets/martian-mono-latin-wght-normal-5W32yIyr.woff2 +0 -0
- package/dist/web-client/index.html +3 -2
- package/package.json +32 -10
- package/dist/core/__tests__/error-stall-recycle.test.js +0 -141
- package/dist/core/skill-sync/__tests__/dry-run-wrote-count.test.js +0 -57
- package/dist/core/skill-sync/builtins.js +0 -112
- package/dist/core/skill-sync/claude-plugins.d.ts +0 -23
- package/dist/core/skill-sync/claude-plugins.js +0 -71
- package/dist/core/skill-sync/engine.d.ts +0 -42
- package/dist/core/skill-sync/engine.js +0 -633
- package/dist/core/skill-sync/manifest.d.ts +0 -64
- package/dist/core/skill-sync/manifest.js +0 -181
- package/dist/core/skill-sync/profile.d.ts +0 -76
- package/dist/core/skill-sync/profile.js +0 -173
- package/dist/core/skill-sync/snapshot.d.ts +0 -57
- package/dist/core/skill-sync/snapshot.js +0 -120
- package/dist/pi-extensions/canvas-commands.d.ts +0 -37
- package/dist/pi-extensions/canvas-commands.js +0 -113
- package/dist/pi-extensions/canvas-resume.d.ts +0 -21
- package/dist/pi-extensions/canvas-resume.js +0 -83
- package/dist/pi-extensions/canvas-view.d.ts +0 -21
- package/dist/pi-extensions/canvas-view.js +0 -76
- package/dist/web-client/assets/index-BUvQb4hR.css +0 -2
- package/dist/web-client/assets/index-ClLQXYAE.js +0 -10
- /package/dist/{core/__tests__/error-stall-recycle.test.d.ts → clients/attach/__tests__/autocomplete-and-bash-mode.test.d.ts} +0 -0
- /package/dist/{core/skill-sync/__tests__/dry-run-wrote-count.test.d.ts → clients/attach/__tests__/bash-bang-routing.test.d.ts} +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { MachineId, MachineRef, MachineState, M0Config, RouteRef } from '../types.js';
|
|
2
|
+
export interface ExecResult {
|
|
3
|
+
exitCode: number | null;
|
|
4
|
+
timedOut: boolean;
|
|
5
|
+
stdout: string;
|
|
6
|
+
stderr: string;
|
|
7
|
+
raw?: Record<string, unknown> | null;
|
|
8
|
+
}
|
|
9
|
+
export interface ExecInput {
|
|
10
|
+
command: string;
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
background?: boolean;
|
|
13
|
+
env?: Record<string, string>;
|
|
14
|
+
cwd?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface VolumeRef {
|
|
17
|
+
volumeId: string;
|
|
18
|
+
name: string;
|
|
19
|
+
raw?: Record<string, unknown> | null;
|
|
20
|
+
}
|
|
21
|
+
export interface CreateMachineInput {
|
|
22
|
+
tenantId: string;
|
|
23
|
+
template?: string | null;
|
|
24
|
+
envs?: Record<string, string>;
|
|
25
|
+
enableNetwork?: boolean;
|
|
26
|
+
name?: string | null;
|
|
27
|
+
ports?: {
|
|
28
|
+
target: number;
|
|
29
|
+
protocol: 'HTTP';
|
|
30
|
+
}[];
|
|
31
|
+
volumeMount?: {
|
|
32
|
+
volumeName: string;
|
|
33
|
+
path: string;
|
|
34
|
+
} | null;
|
|
35
|
+
raw?: Record<string, unknown> | null;
|
|
36
|
+
}
|
|
37
|
+
export interface PublishHttpPortInput {
|
|
38
|
+
machineId: MachineId;
|
|
39
|
+
targetPort: number;
|
|
40
|
+
subdomain?: string | null;
|
|
41
|
+
routeId?: string | null;
|
|
42
|
+
routeName?: string | null;
|
|
43
|
+
raw?: Record<string, unknown> | null;
|
|
44
|
+
}
|
|
45
|
+
export interface HealthResult {
|
|
46
|
+
ok: boolean;
|
|
47
|
+
providerName: string;
|
|
48
|
+
status?: string | null;
|
|
49
|
+
raw?: Record<string, unknown> | null;
|
|
50
|
+
}
|
|
51
|
+
export type DestroyOutcome = {
|
|
52
|
+
kind: 'destroyed';
|
|
53
|
+
} | {
|
|
54
|
+
kind: 'not_found';
|
|
55
|
+
};
|
|
56
|
+
export interface MachineProvider {
|
|
57
|
+
readonly providerName: 'blaxel';
|
|
58
|
+
createVolume(input: {
|
|
59
|
+
name: string;
|
|
60
|
+
}): Promise<VolumeRef>;
|
|
61
|
+
createMachine(input: CreateMachineInput): Promise<MachineRef>;
|
|
62
|
+
getMachine(machineId: MachineId): Promise<MachineRef>;
|
|
63
|
+
exec(machineId: MachineId, input: ExecInput): Promise<ExecResult>;
|
|
64
|
+
waitForPort(machineId: MachineId, port: number, opts?: {
|
|
65
|
+
maxWaitMs?: number;
|
|
66
|
+
}): Promise<void>;
|
|
67
|
+
publishHttpPort(machineId: MachineId, input: PublishHttpPortInput): Promise<RouteRef>;
|
|
68
|
+
health(): Promise<HealthResult>;
|
|
69
|
+
destroy(machineId: MachineId): Promise<DestroyOutcome>;
|
|
70
|
+
destroyVolume(volumeId: string): Promise<DestroyOutcome>;
|
|
71
|
+
}
|
|
72
|
+
export type { MachineState, M0Config, RouteRef };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HomeRecord, TenantId } from './types.js';
|
|
2
|
+
export type RegistryData = Record<TenantId, HomeRecord>;
|
|
3
|
+
export declare class RegistryLockError extends Error {
|
|
4
|
+
readonly lockPath: string;
|
|
5
|
+
readonly holder: string;
|
|
6
|
+
readonly ageMs: number | null;
|
|
7
|
+
constructor(lockPath: string, holder: string, ageMs: number | null);
|
|
8
|
+
}
|
|
9
|
+
export declare function acquireRegistryLock(registryPath: string): () => void;
|
|
10
|
+
export declare function readRegistry(registryPath: string): RegistryData;
|
|
11
|
+
export declare function writeRegistry(registryPath: string, data: RegistryData): RegistryData;
|
|
12
|
+
export declare function getHome(registryPath: string, tenantId: TenantId): HomeRecord | null;
|
|
13
|
+
export declare function putHome(registryPath: string, home: HomeRecord): HomeRecord;
|
|
14
|
+
export declare function updateHome(registryPath: string, tenantId: TenantId, mutate: (home: HomeRecord) => HomeRecord | void): HomeRecord;
|
|
15
|
+
export declare function listHomes(registryPath: string): HomeRecord[];
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, chmodSync } from 'node:fs';
|
|
2
|
+
import { dirname, join, basename } from 'node:path';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { general } from '../errors.js';
|
|
5
|
+
import { nowIso } from '../fs-utils.js';
|
|
6
|
+
const LOCK_STALE_MS = 2 * 60_000;
|
|
7
|
+
function expandHomePath(path) {
|
|
8
|
+
if (path.startsWith('~'))
|
|
9
|
+
return join(homedir(), path.slice(1));
|
|
10
|
+
return path;
|
|
11
|
+
}
|
|
12
|
+
function registryLockPath(registryPath) {
|
|
13
|
+
return `${registryPath}.lock`;
|
|
14
|
+
}
|
|
15
|
+
function lockOwnerPath(lockPath) {
|
|
16
|
+
return join(lockPath, 'owner.json');
|
|
17
|
+
}
|
|
18
|
+
function ensureParentDir(path) {
|
|
19
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
20
|
+
}
|
|
21
|
+
function readJson(path) {
|
|
22
|
+
return JSON.parse(readFileSync(path, 'utf8'));
|
|
23
|
+
}
|
|
24
|
+
function normalizeRegistry(value) {
|
|
25
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
26
|
+
return {};
|
|
27
|
+
const out = {};
|
|
28
|
+
for (const [tenantId, record] of Object.entries(value)) {
|
|
29
|
+
if (record === null || typeof record !== 'object' || Array.isArray(record))
|
|
30
|
+
continue;
|
|
31
|
+
const obj = record;
|
|
32
|
+
if (typeof obj.tenantId !== 'string' || obj.tenantId === '')
|
|
33
|
+
continue;
|
|
34
|
+
out[tenantId] = obj;
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
function atomicWriteJson(path, value) {
|
|
39
|
+
ensureParentDir(path);
|
|
40
|
+
const tmp = `${path}.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`;
|
|
41
|
+
const content = JSON.stringify(value, null, 2) + '\n';
|
|
42
|
+
writeFileSync(tmp, content, { encoding: 'utf8', mode: 0o600 });
|
|
43
|
+
try {
|
|
44
|
+
renameSync(tmp, path);
|
|
45
|
+
chmodSync(path, 0o600);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
try {
|
|
49
|
+
unlinkSync(tmp);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
/* ignore */
|
|
53
|
+
}
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function lockDiagnostics(lockPath) {
|
|
58
|
+
let holder = lockPath;
|
|
59
|
+
let ageMs = null;
|
|
60
|
+
let stale = false;
|
|
61
|
+
try {
|
|
62
|
+
const st = statSync(lockPath);
|
|
63
|
+
ageMs = Date.now() - st.mtimeMs;
|
|
64
|
+
stale = ageMs >= LOCK_STALE_MS;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
/* ignore */
|
|
68
|
+
}
|
|
69
|
+
const ownerFile = lockOwnerPath(lockPath);
|
|
70
|
+
try {
|
|
71
|
+
const owner = JSON.parse(readFileSync(ownerFile, 'utf8'));
|
|
72
|
+
if (typeof owner.holder === 'string' && owner.holder !== '')
|
|
73
|
+
holder = owner.holder;
|
|
74
|
+
else if (typeof owner.pid === 'number')
|
|
75
|
+
holder = `pid ${owner.pid}`;
|
|
76
|
+
else if (typeof owner.startedAt === 'string')
|
|
77
|
+
holder = owner.startedAt;
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
/* ignore */
|
|
81
|
+
}
|
|
82
|
+
return { holder, ageMs, stale };
|
|
83
|
+
}
|
|
84
|
+
export class RegistryLockError extends Error {
|
|
85
|
+
lockPath;
|
|
86
|
+
holder;
|
|
87
|
+
ageMs;
|
|
88
|
+
constructor(lockPath, holder, ageMs) {
|
|
89
|
+
super(ageMs === null
|
|
90
|
+
? `registry lock held at ${lockPath} by ${holder}`
|
|
91
|
+
: `registry lock held at ${lockPath} by ${holder} (${Math.ceil(ageMs / 1000)}s old)`);
|
|
92
|
+
this.lockPath = lockPath;
|
|
93
|
+
this.holder = holder;
|
|
94
|
+
this.ageMs = ageMs;
|
|
95
|
+
this.name = 'RegistryLockError';
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export function acquireRegistryLock(registryPath) {
|
|
99
|
+
const lockPath = registryLockPath(registryPath);
|
|
100
|
+
ensureParentDir(lockPath);
|
|
101
|
+
try {
|
|
102
|
+
mkdirSync(lockPath, { mode: 0o700 });
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
const diagnostics = lockDiagnostics(lockPath);
|
|
106
|
+
throw new RegistryLockError(lockPath, diagnostics.holder, diagnostics.ageMs);
|
|
107
|
+
}
|
|
108
|
+
const owner = {
|
|
109
|
+
holder: `${process.pid}@${basename(registryPath)}:${nowIso()}`,
|
|
110
|
+
pid: process.pid,
|
|
111
|
+
startedAt: nowIso(),
|
|
112
|
+
cwd: process.cwd(),
|
|
113
|
+
};
|
|
114
|
+
atomicWriteJson(lockOwnerPath(lockPath), owner);
|
|
115
|
+
return () => {
|
|
116
|
+
try {
|
|
117
|
+
rmSync(lockPath, { recursive: true, force: true });
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
/* ignore */
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
export function readRegistry(registryPath) {
|
|
125
|
+
const path = expandHomePath(registryPath);
|
|
126
|
+
if (!existsSync(path))
|
|
127
|
+
return {};
|
|
128
|
+
return normalizeRegistry(readJson(path));
|
|
129
|
+
}
|
|
130
|
+
export function writeRegistry(registryPath, data) {
|
|
131
|
+
const path = expandHomePath(registryPath);
|
|
132
|
+
const release = acquireRegistryLock(path);
|
|
133
|
+
try {
|
|
134
|
+
atomicWriteJson(path, data);
|
|
135
|
+
return data;
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
release();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export function getHome(registryPath, tenantId) {
|
|
142
|
+
const registry = readRegistry(registryPath);
|
|
143
|
+
return registry[tenantId] ?? null;
|
|
144
|
+
}
|
|
145
|
+
export function putHome(registryPath, home) {
|
|
146
|
+
const path = expandHomePath(registryPath);
|
|
147
|
+
const release = acquireRegistryLock(path);
|
|
148
|
+
try {
|
|
149
|
+
const registry = readRegistry(path);
|
|
150
|
+
registry[home.tenantId] = home;
|
|
151
|
+
atomicWriteJson(path, registry);
|
|
152
|
+
return home;
|
|
153
|
+
}
|
|
154
|
+
finally {
|
|
155
|
+
release();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
export function updateHome(registryPath, tenantId, mutate) {
|
|
159
|
+
const path = expandHomePath(registryPath);
|
|
160
|
+
const release = acquireRegistryLock(path);
|
|
161
|
+
try {
|
|
162
|
+
const registry = readRegistry(path);
|
|
163
|
+
const current = registry[tenantId];
|
|
164
|
+
if (current === undefined) {
|
|
165
|
+
throw general(`no home for tenant ${tenantId}`, { tenantId, registryPath: path });
|
|
166
|
+
}
|
|
167
|
+
const draft = { ...current };
|
|
168
|
+
const next = mutate(draft) ?? draft;
|
|
169
|
+
registry[tenantId] = next;
|
|
170
|
+
atomicWriteJson(path, registry);
|
|
171
|
+
return next;
|
|
172
|
+
}
|
|
173
|
+
finally {
|
|
174
|
+
release();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
export function listHomes(registryPath) {
|
|
178
|
+
return Object.values(readRegistry(registryPath)).sort((a, b) => a.tenantId.localeCompare(b.tenantId));
|
|
179
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
export type TenantId = string;
|
|
2
|
+
export type MachineId = string;
|
|
3
|
+
export type SnapshotId = string;
|
|
4
|
+
export type RouteId = string;
|
|
5
|
+
export type RelayToken = string;
|
|
6
|
+
export type GuestNodeId = string;
|
|
7
|
+
export type MachineState = 'provisioning' | 'running' | 'paused' | 'stopped' | 'suspended' | 'restoring' | 'terminating' | 'terminated' | 'unknown' | string;
|
|
8
|
+
export type RouteUrlSource = 'provider' | 'config' | 'derived' | 'unknown';
|
|
9
|
+
export interface HomeStorageRef {
|
|
10
|
+
kind: 'volume';
|
|
11
|
+
durability: 'durable-volume';
|
|
12
|
+
longTermContract: true;
|
|
13
|
+
ownerMachineId: MachineId;
|
|
14
|
+
guestHome: string;
|
|
15
|
+
volumeId: string;
|
|
16
|
+
mountPath: string;
|
|
17
|
+
}
|
|
18
|
+
export interface MachineRef {
|
|
19
|
+
providerName: string;
|
|
20
|
+
machineId: MachineId;
|
|
21
|
+
state: MachineState;
|
|
22
|
+
guestIp?: string | null;
|
|
23
|
+
sshPort?: number | null;
|
|
24
|
+
updatedAt?: string | null;
|
|
25
|
+
raw?: Record<string, unknown> | null;
|
|
26
|
+
}
|
|
27
|
+
export interface SnapshotRef {
|
|
28
|
+
snapshotId: SnapshotId;
|
|
29
|
+
machineId: MachineId;
|
|
30
|
+
stateKey?: string | null;
|
|
31
|
+
memoryKey?: string | null;
|
|
32
|
+
diskKey?: string | null;
|
|
33
|
+
sizeBytes?: number | null;
|
|
34
|
+
createdAt?: string | null;
|
|
35
|
+
raw?: Record<string, unknown> | null;
|
|
36
|
+
}
|
|
37
|
+
export interface RouteRef {
|
|
38
|
+
routeId: RouteId;
|
|
39
|
+
machineId: MachineId;
|
|
40
|
+
targetPort: number;
|
|
41
|
+
url?: string | null;
|
|
42
|
+
subdomain?: string | null;
|
|
43
|
+
createdAt?: string | null;
|
|
44
|
+
concreteUrl?: string | null;
|
|
45
|
+
concreteUrlSource?: RouteUrlSource | null;
|
|
46
|
+
raw?: Record<string, unknown> | null;
|
|
47
|
+
}
|
|
48
|
+
export interface BootstrapMarker {
|
|
49
|
+
tenantId: TenantId;
|
|
50
|
+
nodeId: GuestNodeId;
|
|
51
|
+
daemonPid: number;
|
|
52
|
+
brokerPid: number;
|
|
53
|
+
crtrHome: string;
|
|
54
|
+
piAgentDir: string;
|
|
55
|
+
sessionFile?: string | null;
|
|
56
|
+
webPort: number;
|
|
57
|
+
createdAt: string;
|
|
58
|
+
}
|
|
59
|
+
export interface VerifyBaseline {
|
|
60
|
+
machineId: MachineId;
|
|
61
|
+
nodeId: GuestNodeId;
|
|
62
|
+
sessionFile: string;
|
|
63
|
+
sessionLineCount: number;
|
|
64
|
+
webPort: number;
|
|
65
|
+
capturedAt: string;
|
|
66
|
+
daemonPid?: number | null;
|
|
67
|
+
brokerPid?: number | null;
|
|
68
|
+
socketPath?: string | null;
|
|
69
|
+
}
|
|
70
|
+
export type VerifyPhase = 'pre-suspend' | 'post-restore' | 'post-recreate';
|
|
71
|
+
export interface VerifyCheck {
|
|
72
|
+
name: string;
|
|
73
|
+
status: 'PASS' | 'FAIL';
|
|
74
|
+
detail?: string;
|
|
75
|
+
value?: string | number | boolean | null;
|
|
76
|
+
}
|
|
77
|
+
export interface VerifyResult {
|
|
78
|
+
phase: VerifyPhase;
|
|
79
|
+
checks: VerifyCheck[];
|
|
80
|
+
passed: boolean;
|
|
81
|
+
machineState: MachineState;
|
|
82
|
+
nodeId?: GuestNodeId | null;
|
|
83
|
+
routeUrl?: string | null;
|
|
84
|
+
hearth_m0_verified?: boolean;
|
|
85
|
+
hearth_m0_recreate_verified?: boolean;
|
|
86
|
+
warmResume?: boolean | null;
|
|
87
|
+
restoreLatencyMs?: number | null;
|
|
88
|
+
recreateLatencyMs?: number | null;
|
|
89
|
+
baseline?: VerifyBaseline | null;
|
|
90
|
+
}
|
|
91
|
+
export interface HomeRecord {
|
|
92
|
+
tenantId: TenantId;
|
|
93
|
+
providerName: string;
|
|
94
|
+
machineId: MachineId;
|
|
95
|
+
homeStorage: HomeStorageRef;
|
|
96
|
+
state: MachineState;
|
|
97
|
+
nodeId?: GuestNodeId | null;
|
|
98
|
+
webRoute?: RouteRef | null;
|
|
99
|
+
latestSnapshot?: SnapshotRef | null;
|
|
100
|
+
verifyBaseline?: VerifyBaseline | null;
|
|
101
|
+
bootstrapMarker?: BootstrapMarker | null;
|
|
102
|
+
relayToken?: RelayToken | null;
|
|
103
|
+
warmResume?: boolean | null;
|
|
104
|
+
restoreLatencyMs?: number | null;
|
|
105
|
+
recreateLatencyMs?: number | null;
|
|
106
|
+
createdAt: string;
|
|
107
|
+
updatedAt: string;
|
|
108
|
+
raw?: Record<string, unknown> | null;
|
|
109
|
+
}
|
|
110
|
+
export interface M0Config {
|
|
111
|
+
providerName: string;
|
|
112
|
+
registryPath: string;
|
|
113
|
+
guestUser: string;
|
|
114
|
+
guestHome: string;
|
|
115
|
+
guestCodePath: string;
|
|
116
|
+
piPackages: string[];
|
|
117
|
+
webPort: number;
|
|
118
|
+
nodeKind: string;
|
|
119
|
+
piAuthJson?: string | null;
|
|
120
|
+
relayToken?: RelayToken | null;
|
|
121
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Regression: crouter must not leave its old generated `crtr-skills` Agent Skill
|
|
2
|
+
// installed in pi/Claude host skill dirs after memory became the first-class
|
|
3
|
+
// guidance surface. The legacy bundle caused pi to inject an <available_skills>
|
|
4
|
+
// block that described SKILL.md as current crouter behavior.
|
|
5
|
+
//
|
|
6
|
+
// Run: node --import tsx/esm --test src/core/host-exports/__tests__/export-prunes-boot-skill.test.ts
|
|
7
|
+
import { test, beforeEach, afterEach } from 'node:test';
|
|
8
|
+
import assert from 'node:assert/strict';
|
|
9
|
+
import { mkdtempSync, rmSync, mkdirSync, writeFileSync, existsSync, readFileSync } from 'node:fs';
|
|
10
|
+
import { tmpdir } from 'node:os';
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
import { defineBranch, defineLeaf, defineRoot } from '../../command.js';
|
|
13
|
+
import { provisionExports } from '../export.js';
|
|
14
|
+
let home;
|
|
15
|
+
let prevHome;
|
|
16
|
+
let prevNoExports;
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
prevHome = process.env.HOME;
|
|
19
|
+
prevNoExports = process.env.CRTR_NO_EXPORTS;
|
|
20
|
+
home = mkdtempSync(join(tmpdir(), 'crtr-export-prune-'));
|
|
21
|
+
process.env.HOME = home;
|
|
22
|
+
delete process.env.CRTR_NO_EXPORTS;
|
|
23
|
+
mkdirSync(join(home, '.pi', 'agent', 'skills', 'crtr-skills'), { recursive: true });
|
|
24
|
+
mkdirSync(join(home, '.claude', 'skills', 'crtr-skills'), { recursive: true });
|
|
25
|
+
writeFileSync(join(home, '.pi', 'agent', 'skills', 'crtr-skills', 'SKILL.md'), '---\nname: crtr-skills\n---\n\n<!-- crtr-boot-skill v2 -->\n', 'utf8');
|
|
26
|
+
writeFileSync(join(home, '.claude', 'skills', 'crtr-skills', 'SKILL.md'), '---\nname: crtr-skills\n---\n\nuser-customized, no crtr marker\n', 'utf8');
|
|
27
|
+
});
|
|
28
|
+
afterEach(() => {
|
|
29
|
+
if (prevHome === undefined)
|
|
30
|
+
delete process.env.HOME;
|
|
31
|
+
else
|
|
32
|
+
process.env.HOME = prevHome;
|
|
33
|
+
if (prevNoExports === undefined)
|
|
34
|
+
delete process.env.CRTR_NO_EXPORTS;
|
|
35
|
+
else
|
|
36
|
+
process.env.CRTR_NO_EXPORTS = prevNoExports;
|
|
37
|
+
rmSync(home, { recursive: true, force: true });
|
|
38
|
+
});
|
|
39
|
+
const root = defineRoot({
|
|
40
|
+
tagline: 'fixture',
|
|
41
|
+
globals: [],
|
|
42
|
+
subtrees: [
|
|
43
|
+
defineBranch({
|
|
44
|
+
name: 'fixture',
|
|
45
|
+
help: { name: 'fixture', summary: 'fixture' },
|
|
46
|
+
rootEntry: { concept: 'fixture', desc: 'fixture', useWhen: 'fixture' },
|
|
47
|
+
children: [
|
|
48
|
+
defineLeaf({
|
|
49
|
+
name: 'demo',
|
|
50
|
+
help: {
|
|
51
|
+
name: 'fixture demo',
|
|
52
|
+
summary: 'demo',
|
|
53
|
+
output: [],
|
|
54
|
+
outputKind: 'object',
|
|
55
|
+
effects: ['None. Read-only.'],
|
|
56
|
+
},
|
|
57
|
+
slash: {
|
|
58
|
+
name: 'demo',
|
|
59
|
+
description: 'demo command',
|
|
60
|
+
body: 'run demo',
|
|
61
|
+
},
|
|
62
|
+
run: async () => ({}),
|
|
63
|
+
}),
|
|
64
|
+
],
|
|
65
|
+
}),
|
|
66
|
+
],
|
|
67
|
+
});
|
|
68
|
+
test('provisionExports prunes marker-bearing legacy boot skills and still writes slash commands', () => {
|
|
69
|
+
provisionExports(root, ['node', 'crtr', 'fixture']);
|
|
70
|
+
assert.equal(existsSync(join(home, '.pi', 'agent', 'skills', 'crtr-skills', 'SKILL.md')), false, 'marker-bearing pi crtr-skills bundle should be removed');
|
|
71
|
+
assert.equal(existsSync(join(home, '.claude', 'skills', 'crtr-skills', 'SKILL.md')), true, 'markerless user-owned Claude skill should not be removed');
|
|
72
|
+
assert.match(readFileSync(join(home, '.pi', 'agent', 'prompts', 'demo.md'), 'utf8'), /<!-- crtr-mode-cmd v1 -->/, 'pi slash-command export should still be provisioned');
|
|
73
|
+
assert.match(readFileSync(join(home, '.claude', 'commands', 'demo.md'), 'utf8'), /<!-- crtr-mode-cmd v1 -->/, 'Claude slash-command export should still be provisioned');
|
|
74
|
+
});
|
|
75
|
+
test('bare front-door argv prunes legacy boot skills before pi can start', () => {
|
|
76
|
+
provisionExports(root, ['node', 'crtr']);
|
|
77
|
+
assert.equal(existsSync(join(home, '.pi', 'agent', 'skills', 'crtr-skills', 'SKILL.md')), false, 'bare crtr must remove stale pi crtr-skills before booting pi');
|
|
78
|
+
assert.equal(existsSync(join(home, '.pi', 'agent', 'prompts', 'demo.md')), false, 'bare front-door pruning must not provision slash-command prompts');
|
|
79
|
+
});
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Built-in export registry for
|
|
2
|
+
* Built-in export registry for crtr-generated host artifacts.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* (`bootSkillBody`, `renderSlashTemplate`) and their version markers were moved
|
|
9
|
-
* here verbatim from bootstrap.ts when skill-sync became the sole host writer —
|
|
10
|
-
* marker strings are byte-identical so already-deployed artifacts roll forward.
|
|
4
|
+
* Slash-command templates are one-way exports: code is the single source of
|
|
5
|
+
* truth, so crtr renders them into host prompt/command dirs with marker-guarded
|
|
6
|
+
* writes (see export.ts). Legacy generated Agent Skills are listed only as
|
|
7
|
+
* cleanup targets; crouter's first-class guidance surface is memory docs.
|
|
11
8
|
*/
|
|
12
9
|
import type { RootDef } from '../command.js';
|
|
13
10
|
/** A host runtime crtr exports generated artifacts into. */
|
|
@@ -23,7 +20,7 @@ export interface HostTarget {
|
|
|
23
20
|
}
|
|
24
21
|
/** One crtr-generated export artifact and every host it reaches. */
|
|
25
22
|
export interface ExportPair {
|
|
26
|
-
/** Stable id for logging, e.g. `@
|
|
23
|
+
/** Stable id for logging, e.g. `@cmd/<name>`. */
|
|
27
24
|
id: string;
|
|
28
25
|
/** On-disk artifact name (bundle dir name or file stem). */
|
|
29
26
|
name: string;
|
|
@@ -34,9 +31,20 @@ export interface ExportPair {
|
|
|
34
31
|
/** Every host destination. Targets with an absent host root are skipped. */
|
|
35
32
|
targets: HostTarget[];
|
|
36
33
|
}
|
|
37
|
-
|
|
34
|
+
/** A legacy crtr-generated artifact that should be removed if still present. */
|
|
35
|
+
export interface LegacyExportArtifact {
|
|
36
|
+
/** Stable id for logging/debugging. */
|
|
37
|
+
id: string;
|
|
38
|
+
/** On-disk artifact name (bundle dir name or file stem). */
|
|
39
|
+
name: string;
|
|
40
|
+
/** Marker prefix identifying a crtr-owned file. Markerless files are user-owned. */
|
|
41
|
+
markerPrefix: string;
|
|
42
|
+
/** Every host destination. Targets with an absent host root are skipped. */
|
|
43
|
+
targets: HostTarget[];
|
|
44
|
+
}
|
|
38
45
|
export declare const SLASH_CMD_MARKER_PREFIX = "<!-- crtr-mode-cmd v";
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
/** Legacy crtr-generated exports that should not survive after the memory cutover. */
|
|
47
|
+
export declare function legacyExportArtifacts(): LegacyExportArtifact[];
|
|
48
|
+
/** The crtr-generated export artifacts for this command tree: one pair per
|
|
49
|
+
* opted-in slash command (both hosts, file layout). */
|
|
42
50
|
export declare function builtinExportPairs(root: RootDef): ExportPair[];
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in export registry for crtr-generated host artifacts.
|
|
3
|
+
*
|
|
4
|
+
* Slash-command templates are one-way exports: code is the single source of
|
|
5
|
+
* truth, so crtr renders them into host prompt/command dirs with marker-guarded
|
|
6
|
+
* writes (see export.ts). Legacy generated Agent Skills are listed only as
|
|
7
|
+
* cleanup targets; crouter's first-class guidance surface is memory docs.
|
|
8
|
+
*/
|
|
9
|
+
import { homedir } from 'node:os';
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
import { collectSlashSpecs } from '../command.js';
|
|
12
|
+
// ── Slash commands ───────────────────────────────────────────────────────────
|
|
13
|
+
const SLASH_CMD_MARKER = '<!-- crtr-mode-cmd v1 -->';
|
|
14
|
+
export const SLASH_CMD_MARKER_PREFIX = '<!-- crtr-mode-cmd v';
|
|
15
|
+
/** Render a SlashSpec to a full template file (frontmatter + marker + body). */
|
|
16
|
+
function renderSlashTemplate(spec) {
|
|
17
|
+
const hint = spec.argumentHint !== undefined
|
|
18
|
+
? `argument-hint: ${JSON.stringify(spec.argumentHint)}\n`
|
|
19
|
+
: '';
|
|
20
|
+
return `---\ndescription: ${spec.description}\n${hint}---\n\n${SLASH_CMD_MARKER}\n\n${spec.body}\n`;
|
|
21
|
+
}
|
|
22
|
+
// ── Host roots ───────────────────────────────────────────────────────────────
|
|
23
|
+
function claudeSkillsRoot() {
|
|
24
|
+
return join(homedir(), '.claude', 'skills');
|
|
25
|
+
}
|
|
26
|
+
function piSkillsRoot() {
|
|
27
|
+
return join(homedir(), '.pi', 'agent', 'skills');
|
|
28
|
+
}
|
|
29
|
+
function claudeCommandsRoot() {
|
|
30
|
+
return join(homedir(), '.claude', 'commands');
|
|
31
|
+
}
|
|
32
|
+
function piPromptsRoot() {
|
|
33
|
+
return join(homedir(), '.pi', 'agent', 'prompts');
|
|
34
|
+
}
|
|
35
|
+
// ── Registry ─────────────────────────────────────────────────────────────────
|
|
36
|
+
const LEGACY_BOOT_SKILL_MARKER_PREFIX = '<!-- crtr-boot-skill v';
|
|
37
|
+
/** Legacy crtr-generated exports that should not survive after the memory cutover. */
|
|
38
|
+
export function legacyExportArtifacts() {
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
id: '@legacy/crtr-skills',
|
|
42
|
+
name: 'crtr-skills',
|
|
43
|
+
markerPrefix: LEGACY_BOOT_SKILL_MARKER_PREFIX,
|
|
44
|
+
targets: [
|
|
45
|
+
{ host: 'claude', dir: claudeSkillsRoot, layout: 'bundle' },
|
|
46
|
+
{ host: 'pi', dir: piSkillsRoot, layout: 'bundle' },
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
/** The crtr-generated export artifacts for this command tree: one pair per
|
|
52
|
+
* opted-in slash command (both hosts, file layout). */
|
|
53
|
+
export function builtinExportPairs(root) {
|
|
54
|
+
const pairs = [];
|
|
55
|
+
for (const spec of collectSlashSpecs(root)) {
|
|
56
|
+
pairs.push({
|
|
57
|
+
id: `@cmd/${spec.name}`,
|
|
58
|
+
name: spec.name,
|
|
59
|
+
markerPrefix: SLASH_CMD_MARKER_PREFIX,
|
|
60
|
+
render: () => renderSlashTemplate(spec),
|
|
61
|
+
targets: [
|
|
62
|
+
{ host: 'claude', dir: claudeCommandsRoot, layout: 'file' },
|
|
63
|
+
{ host: 'pi', dir: piPromptsRoot, layout: 'file' },
|
|
64
|
+
],
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return pairs;
|
|
68
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* One-way export of crtr-generated host artifacts — the sole writer of
|
|
3
|
-
* generated
|
|
4
|
-
* `~/.pi/agent/prompts`.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
* generated slash-command templates to `~/.claude/commands` and
|
|
4
|
+
* `~/.pi/agent/prompts`.
|
|
5
|
+
*
|
|
6
|
+
* crouter no longer exports Agent Skills / SKILL.md bundles. The export pass
|
|
7
|
+
* still prunes old marker-bearing `crtr-skills` bundles so hosts stop surfacing
|
|
8
|
+
* pi/Claude native skills after the memory cutover. Markerless files are
|
|
9
|
+
* user-owned and never removed.
|
|
8
10
|
*
|
|
9
11
|
* Triggered per-run by cli.ts (argv-gated, exactly as the old writers were) so
|
|
10
12
|
* first-run provisioning is preserved. Best-effort: a provisioning fault must
|
|
@@ -17,7 +19,8 @@ import type { RootDef } from '../command.js';
|
|
|
17
19
|
* only the leaf dir, never the host root. The single generalization of
|
|
18
20
|
* bootstrap.ts's two clobber-guards. */
|
|
19
21
|
export declare function writeIfOurs(path: string, content: string, markerPrefix: string): void;
|
|
20
|
-
/** Render and write every built-in export artifact to every present host
|
|
22
|
+
/** Render and write every built-in export artifact to every present host, while
|
|
23
|
+
* pruning legacy generated artifacts that should no longer be surfaced.
|
|
21
24
|
* Best-effort: swallows errors (debug-logged) so a provisioning fault never
|
|
22
25
|
* breaks an unrelated `crtr` command. Kill switch: `CRTR_NO_EXPORTS=1`. */
|
|
23
26
|
export declare function provisionExports(root: RootDef, argv?: string[]): void;
|