@crouton-kit/crouter 0.3.27 → 0.3.29
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/build-root.js +4 -2
- package/dist/builtin-memory/crouter-development/marketplaces.md +7 -6
- package/dist/builtin-memory/crouter-development/personas/base-prompt.md +1 -1
- package/dist/builtin-memory/crouter-development/personas/orchestrator-prompt.md +1 -1
- package/dist/builtin-memory/crouter-development/personas.md +1 -1
- package/dist/builtin-memory/crouter-development/plugins.md +20 -18
- package/dist/builtin-memory/design.md +1 -1
- package/dist/builtin-memory/development.md +1 -1
- package/dist/builtin-memory/internal/INDEX.md +1 -1
- package/dist/builtin-memory/internal/examples/INDEX.md +1 -1
- package/dist/builtin-memory/internal/examples/imessage-assistant.md +2 -2
- package/dist/builtin-memory/internal/nodes-and-canvas.md +1 -1
- package/dist/builtin-memory/internal/storage-tiers.md +1 -1
- package/dist/builtin-memory/planning.md +1 -1
- package/dist/builtin-memory/spec.md +6 -4
- package/dist/builtin-personas/orchestration-kernel.md +4 -5
- package/dist/builtin-personas/runtime-base.md +8 -4
- package/dist/builtin-personas/spec/PERSONA.md +8 -4
- package/dist/builtin-personas/spec/orchestrator.md +5 -3
- package/dist/builtin-personas/spec/requirements/PERSONA.md +10 -0
- package/dist/builtin-views/canvas/core.mjs +586 -0
- package/dist/builtin-views/canvas/text.mjs +58 -0
- package/dist/builtin-views/canvas/tui.mjs +165 -0
- package/dist/builtin-views/canvas/web.jsx +120 -0
- package/dist/builtin-views/git-pr/core.mjs +673 -0
- package/dist/builtin-views/git-pr/text.mjs +84 -0
- package/dist/builtin-views/git-pr/tui.mjs +302 -0
- package/dist/builtin-views/git-pr/web.jsx +216 -0
- package/dist/builtin-views/inbox/_lib/render.mjs +1 -3
- package/dist/builtin-views/inbox/core.mjs +1273 -0
- package/dist/builtin-views/inbox/text.mjs +73 -0
- package/dist/builtin-views/inbox/tui.mjs +312 -0
- package/dist/builtin-views/inbox/web.jsx +188 -0
- package/dist/builtin-views/linkedin/core.mjs +906 -0
- package/dist/builtin-views/linkedin/text.mjs +69 -0
- package/dist/builtin-views/linkedin/tui.mjs +427 -0
- package/dist/builtin-views/linkedin/web.jsx +206 -0
- package/dist/builtin-views/workspace-sidebar/core.mjs +621 -0
- package/dist/builtin-views/workspace-sidebar/text.mjs +53 -0
- package/dist/builtin-views/workspace-sidebar/tui.mjs +142 -0
- package/dist/builtin-views/workspace-sidebar/web.jsx +109 -0
- package/dist/cli.js +3 -3
- package/dist/clients/attach/__tests__/action-parity.test.js +48 -0
- package/dist/clients/attach/__tests__/clipboard-image.test.js +76 -0
- package/dist/clients/attach/__tests__/editor-newline.test.js +57 -0
- package/dist/clients/attach/__tests__/git-info.test.js +31 -0
- package/dist/clients/attach/__tests__/onrequest-wired.test.js +20 -0
- package/dist/clients/attach/__tests__/reconnect-giveup.test.js +30 -0
- package/dist/clients/attach/__tests__/slash-quit-copy.test.js +42 -0
- package/dist/clients/attach/__tests__/titled-editor.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/titled-editor.test.js +39 -0
- package/dist/clients/attach/attach-cmd.js +445 -41
- package/dist/clients/attach/auth-pickers.d.ts +9 -0
- package/dist/clients/attach/auth-pickers.js +194 -0
- package/dist/clients/attach/canvas-panels.d.ts +12 -0
- package/dist/clients/attach/canvas-panels.js +78 -0
- package/dist/clients/attach/chat-view.d.ts +27 -2
- package/dist/clients/attach/chat-view.js +98 -9
- package/dist/clients/attach/clipboard-image.d.ts +47 -8
- package/dist/clients/attach/clipboard-image.js +150 -26
- package/dist/clients/attach/clipboard-text.d.ts +3 -0
- package/dist/clients/attach/clipboard-text.js +39 -0
- package/dist/clients/attach/config-load.d.ts +54 -7
- package/dist/clients/attach/config-load.js +99 -3
- package/dist/clients/attach/context-message.d.ts +12 -0
- package/dist/clients/attach/context-message.js +72 -0
- package/dist/clients/attach/git-info.d.ts +20 -0
- package/dist/clients/attach/git-info.js +44 -0
- package/dist/clients/attach/graph-overlay.d.ts +43 -0
- package/dist/clients/attach/graph-overlay.js +306 -0
- package/dist/clients/attach/input-controller.d.ts +81 -13
- package/dist/clients/attach/input-controller.js +307 -67
- package/dist/clients/attach/pickers.d.ts +58 -0
- package/dist/clients/attach/pickers.js +171 -0
- package/dist/clients/attach/slash-commands.d.ts +44 -1
- package/dist/clients/attach/slash-commands.js +250 -27
- package/dist/clients/attach/titled-editor.d.ts +33 -0
- package/dist/clients/attach/titled-editor.js +84 -0
- package/dist/clients/attach/view-socket.d.ts +37 -2
- package/dist/clients/attach/view-socket.js +131 -7
- package/dist/clients/web/dev-server.d.ts +7 -0
- package/dist/clients/web/dev-server.js +59 -0
- package/dist/clients/web/events.d.ts +14 -0
- package/dist/clients/web/events.js +151 -0
- package/dist/clients/web/server.d.ts +18 -0
- package/dist/clients/web/server.js +450 -0
- package/dist/clients/web/web-cmd.d.ts +2 -0
- package/dist/clients/web/web-cmd.js +120 -0
- package/dist/commands/canvas.js +1 -2
- package/dist/commands/chord.js +1 -1
- package/dist/commands/dashboard.js +5 -1
- package/dist/commands/human/prompts.js +3 -3
- package/dist/commands/human/queue.d.ts +17 -0
- package/dist/commands/human/queue.js +111 -4
- package/dist/commands/memory/__tests__/lint-schema.test.js +27 -4
- package/dist/commands/memory/lint.d.ts +5 -4
- package/dist/commands/memory/lint.js +23 -7
- package/dist/commands/memory/read.js +2 -2
- package/dist/commands/memory/shared.d.ts +7 -1
- package/dist/commands/memory/shared.js +18 -3
- package/dist/commands/memory/write.js +20 -7
- package/dist/commands/memory.js +4 -4
- package/dist/commands/node.d.ts +1 -1
- package/dist/commands/node.js +64 -65
- package/dist/commands/pkg.js +1 -2
- package/dist/commands/revive.js +11 -3
- package/dist/commands/sys/feedback.d.ts +1 -0
- package/dist/commands/sys/feedback.js +163 -0
- package/dist/commands/sys/sync.d.ts +1 -0
- package/dist/commands/sys/sync.js +187 -0
- package/dist/commands/sys.js +4 -2
- package/dist/commands/view-cycle.js +2 -2
- package/dist/commands/view-list.js +8 -8
- package/dist/commands/view-new.js +21 -17
- package/dist/commands/view-pick.js +1 -1
- package/dist/commands/view-run.js +35 -14
- package/dist/commands/view.js +8 -6
- package/dist/commands/workspace.d.ts +2 -0
- package/dist/commands/workspace.js +161 -0
- package/dist/core/__tests__/broker-double-spawn.test.d.ts +1 -0
- package/dist/core/__tests__/broker-double-spawn.test.js +143 -0
- package/dist/core/__tests__/broker-fork-seam.test.d.ts +1 -0
- package/dist/core/__tests__/broker-fork-seam.test.js +102 -0
- package/dist/core/__tests__/broker-sdk-wiring.test.js +2 -0
- package/dist/core/__tests__/broker-snapshot-history.test.d.ts +1 -0
- package/dist/core/__tests__/broker-snapshot-history.test.js +105 -0
- package/dist/core/__tests__/child-death-wake.test.js +56 -111
- package/dist/core/__tests__/close.test.js +14 -20
- package/dist/core/__tests__/context-intro.test.js +19 -19
- package/dist/core/__tests__/daemon-boot.test.js +30 -23
- package/dist/core/__tests__/draw-style.test.js +1 -1
- package/dist/core/__tests__/error-stall-recycle.test.d.ts +1 -0
- package/dist/core/__tests__/error-stall-recycle.test.js +141 -0
- package/dist/core/__tests__/fixtures/fake-engine.d.ts +24 -1
- package/dist/core/__tests__/fixtures/fake-engine.js +32 -2
- package/dist/core/__tests__/fixtures/fake-pi-host.js +2 -2
- package/dist/core/__tests__/focuses.test.js +25 -13
- package/dist/core/__tests__/fork.test.js +22 -5
- package/dist/core/__tests__/full/broker-control-preempt.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-control-preempt.test.js +61 -0
- package/dist/core/__tests__/full/broker-model-changed-broadcast.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-model-changed-broadcast.test.js +57 -0
- package/dist/core/__tests__/full/broker-navigate-tree-rewelcome.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-navigate-tree-rewelcome.test.js +80 -0
- package/dist/core/__tests__/full/broker-pane-resolution.test.js +90 -0
- package/dist/core/__tests__/full/cascade-close.test.js +22 -8
- package/dist/core/__tests__/full/detach-focus.test.js +66 -169
- package/dist/core/__tests__/helpers/harness.d.ts +6 -9
- package/dist/core/__tests__/helpers/harness.js +19 -36
- package/dist/core/__tests__/human-node-not-supervised.test.d.ts +1 -0
- package/dist/core/__tests__/human-node-not-supervised.test.js +83 -0
- package/dist/core/__tests__/human-stranded-deliver.test.d.ts +1 -0
- package/dist/core/__tests__/human-stranded-deliver.test.js +108 -0
- package/dist/core/__tests__/lifecycle.test.js +1 -19
- package/dist/core/__tests__/live-mutation-verbs.test.js +5 -5
- package/dist/core/__tests__/memory-resolver.test.js +1 -1
- package/dist/core/__tests__/on-read-dedup-resume.test.d.ts +1 -0
- package/dist/core/__tests__/on-read-dedup-resume.test.js +81 -0
- package/dist/core/__tests__/refresh-stall-recycle.test.d.ts +1 -0
- package/dist/core/__tests__/refresh-stall-recycle.test.js +88 -0
- package/dist/core/__tests__/relaunch-root.test.d.ts +1 -0
- package/dist/core/__tests__/relaunch-root.test.js +114 -0
- package/dist/core/__tests__/reset.test.js +19 -79
- package/dist/core/__tests__/steer-note.test.js +9 -7
- package/dist/core/__tests__/tmux-surface.test.js +13 -7
- package/dist/core/bootstrap.d.ts +0 -3
- package/dist/core/bootstrap.js +1 -143
- package/dist/core/canvas/browse/__tests__/model.test.js +86 -1
- package/dist/core/canvas/browse/__tests__/render.test.js +2 -1
- package/dist/core/canvas/browse/app.js +131 -8
- package/dist/core/canvas/browse/model.d.ts +23 -5
- package/dist/core/canvas/browse/model.js +68 -13
- package/dist/core/canvas/browse/render.d.ts +7 -1
- package/dist/core/canvas/browse/render.js +178 -47
- package/dist/core/canvas/canvas.js +1 -1
- package/dist/core/canvas/focuses.d.ts +4 -4
- package/dist/core/canvas/focuses.js +7 -7
- package/dist/core/canvas/nav-model.d.ts +162 -0
- package/dist/core/canvas/nav-model.js +487 -0
- package/dist/core/canvas/paths.d.ts +7 -0
- package/dist/core/canvas/paths.js +9 -0
- package/dist/core/canvas/render.d.ts +68 -9
- package/dist/core/canvas/render.js +195 -61
- package/dist/core/canvas/types.d.ts +16 -23
- package/dist/core/config.js +1 -4
- package/dist/core/memory-resolver.js +43 -5
- package/dist/core/runtime/bearings.d.ts +1 -1
- package/dist/core/runtime/bearings.js +8 -8
- package/dist/core/runtime/branded-host.d.ts +16 -0
- package/dist/core/runtime/branded-host.js +127 -0
- package/dist/core/runtime/broker-protocol.d.ts +212 -6
- package/dist/core/runtime/broker-sdk.d.ts +0 -12
- package/dist/core/runtime/broker-sdk.js +77 -6
- package/dist/core/runtime/broker.d.ts +5 -1
- package/dist/core/runtime/broker.js +520 -59
- package/dist/core/runtime/close.d.ts +12 -2
- package/dist/core/runtime/close.js +37 -16
- package/dist/core/runtime/front-door.js +14 -7
- package/dist/core/runtime/host.d.ts +14 -34
- package/dist/core/runtime/host.js +14 -50
- package/dist/core/runtime/launch.d.ts +12 -9
- package/dist/core/runtime/launch.js +27 -15
- package/dist/core/runtime/lifecycle.d.ts +1 -1
- package/dist/core/runtime/lifecycle.js +15 -19
- package/dist/core/runtime/nodes.d.ts +0 -55
- package/dist/core/runtime/nodes.js +6 -74
- package/dist/core/runtime/placement.d.ts +91 -334
- package/dist/core/runtime/placement.js +262 -828
- package/dist/core/runtime/promote.d.ts +2 -0
- package/dist/core/runtime/promote.js +24 -6
- package/dist/core/runtime/recap.d.ts +8 -0
- package/dist/core/runtime/recap.js +107 -0
- package/dist/core/runtime/recycle.js +25 -61
- package/dist/core/runtime/reset.d.ts +43 -37
- package/dist/core/runtime/reset.js +131 -218
- package/dist/core/runtime/revive.d.ts +9 -29
- package/dist/core/runtime/revive.js +45 -135
- package/dist/core/runtime/spawn.d.ts +15 -11
- package/dist/core/runtime/spawn.js +168 -136
- package/dist/core/runtime/surface-bg.d.ts +11 -0
- package/dist/core/runtime/surface-bg.js +68 -0
- package/dist/core/runtime/tmux.d.ts +15 -43
- package/dist/core/runtime/tmux.js +38 -80
- package/dist/core/scope.d.ts +1 -2
- package/dist/core/scope.js +1 -5
- package/dist/core/skill-sync/__tests__/dry-run-wrote-count.test.d.ts +1 -0
- package/dist/core/skill-sync/__tests__/dry-run-wrote-count.test.js +57 -0
- package/dist/core/skill-sync/builtins.d.ts +42 -0
- package/dist/core/skill-sync/builtins.js +112 -0
- package/dist/core/skill-sync/claude-plugins.d.ts +23 -0
- package/dist/core/skill-sync/claude-plugins.js +71 -0
- package/dist/core/skill-sync/engine.d.ts +42 -0
- package/dist/core/skill-sync/engine.js +633 -0
- package/dist/core/skill-sync/export.d.ts +23 -0
- package/dist/core/skill-sync/export.js +86 -0
- package/dist/core/skill-sync/manifest.d.ts +64 -0
- package/dist/core/skill-sync/manifest.js +181 -0
- package/dist/core/skill-sync/profile.d.ts +76 -0
- package/dist/core/skill-sync/profile.js +173 -0
- package/dist/core/skill-sync/snapshot.d.ts +57 -0
- package/dist/core/skill-sync/snapshot.js +120 -0
- package/dist/core/spawn.d.ts +14 -0
- package/dist/core/spawn.js +29 -9
- package/dist/core/substrate/index.d.ts +2 -2
- package/dist/core/substrate/index.js +7 -7
- package/dist/core/substrate/injected-store.d.ts +10 -0
- package/dist/core/substrate/injected-store.js +55 -0
- package/dist/core/substrate/on-read.js +68 -6
- package/dist/core/substrate/render.d.ts +8 -11
- package/dist/core/substrate/render.js +29 -43
- package/dist/core/substrate/schema.d.ts +16 -11
- package/dist/core/substrate/schema.js +32 -31
- package/dist/core/tui/host.d.ts +12 -4
- package/dist/core/tui/host.js +280 -149
- package/dist/core/view/bridge.d.ts +10 -0
- package/dist/core/view/bridge.js +31 -0
- package/dist/core/view/chrome.d.ts +9 -0
- package/dist/core/view/chrome.js +22 -0
- package/dist/core/view/contract.d.ts +171 -0
- package/dist/core/view/contract.js +23 -0
- package/dist/core/view/loader.d.ts +31 -0
- package/dist/core/view/loader.js +188 -0
- package/dist/core/view/transport-local.d.ts +7 -0
- package/dist/core/view/transport-local.js +70 -0
- package/dist/core/view/transport.d.ts +4 -0
- package/dist/core/view/transport.js +15 -0
- package/dist/daemon/crtrd.d.ts +38 -27
- package/dist/daemon/crtrd.js +303 -376
- package/dist/daemon/manage.js +6 -1
- package/dist/index.js +1 -1
- package/dist/pi-extensions/__tests__/canvas-stophook-agentend.test.js +28 -20
- package/dist/pi-extensions/canvas-context-intro.js +4 -4
- package/dist/pi-extensions/canvas-doc-substrate.js +29 -20
- package/dist/pi-extensions/canvas-nav.js +35 -385
- package/dist/pi-extensions/canvas-recap.d.ts +37 -0
- package/dist/pi-extensions/canvas-recap.js +236 -0
- package/dist/pi-extensions/canvas-resume.js +2 -1
- package/dist/pi-extensions/canvas-stophook.d.ts +15 -13
- package/dist/pi-extensions/canvas-stophook.js +119 -103
- package/dist/pi-extensions/canvas-view.js +2 -1
- package/dist/pi-extensions/widget-order-bus.d.ts +6 -0
- package/dist/pi-extensions/widget-order-bus.js +34 -0
- package/dist/prompts/view.d.ts +2 -2
- package/dist/prompts/view.js +145 -73
- package/dist/types.d.ts +1 -6
- package/dist/types.js +1 -3
- package/dist/web/ViewChrome.d.ts +7 -0
- package/dist/web/ViewChrome.js +28 -0
- package/dist/web/ViewPane.d.ts +39 -0
- package/dist/web/ViewPane.js +48 -0
- package/dist/web/index.d.ts +6 -0
- package/dist/web/index.js +16 -0
- package/dist/web/runtime.d.ts +39 -0
- package/dist/web/runtime.js +133 -0
- package/dist/web/states.d.ts +24 -0
- package/dist/web/states.js +24 -0
- package/dist/web/transport-http.d.ts +5 -0
- package/dist/web/transport-http.js +28 -0
- package/dist/web-client/assets/index-BUvQb4hR.css +2 -0
- package/dist/web-client/assets/index-ClLQXYAE.js +10 -0
- package/dist/web-client/index.html +13 -0
- package/package.json +20 -6
- package/dist/builtin-views/canvas/client.mjs +0 -303
- package/dist/builtin-views/canvas/view.mjs +0 -576
- package/dist/builtin-views/git-pr/client.mjs +0 -440
- package/dist/builtin-views/git-pr/view.mjs +0 -675
- package/dist/builtin-views/inbox/sources/gmail.mjs +0 -965
- package/dist/builtin-views/inbox/sources/linkedin.mjs +0 -427
- package/dist/builtin-views/inbox/view.mjs +0 -889
- package/dist/builtin-views/linkedin/client.mjs +0 -610
- package/dist/builtin-views/linkedin/view.mjs +0 -1171
- package/dist/commands/pkg/bridge.d.ts +0 -1
- package/dist/commands/pkg/bridge.js +0 -137
- package/dist/commands/skill/author.d.ts +0 -3
- package/dist/commands/skill/author.js +0 -140
- package/dist/commands/skill/shared.d.ts +0 -3
- package/dist/commands/skill/shared.js +0 -19
- package/dist/commands/skill.d.ts +0 -2
- package/dist/commands/skill.js +0 -21
- package/dist/commands/tmux-spread.d.ts +0 -2
- package/dist/commands/tmux-spread.js +0 -144
- package/dist/core/__tests__/full/daemon-liveness-pane.full.test.js +0 -292
- package/dist/core/__tests__/full/placement-focus.test.js +0 -309
- package/dist/core/__tests__/full/placement-reconcile.test.js +0 -212
- package/dist/core/__tests__/full/placement-revive.test.js +0 -238
- package/dist/core/__tests__/full/placement-teardown.test.js +0 -221
- package/dist/core/__tests__/home-session.test.js +0 -186
- package/dist/core/__tests__/relaunch.test.js +0 -335
- package/dist/core/bridge-map.d.ts +0 -19
- package/dist/core/bridge-map.js +0 -73
- package/dist/core/tui/contract.d.ts +0 -83
- package/dist/core/tui/contract.js +0 -8
- package/dist/core/tui/loader.d.ts +0 -16
- package/dist/core/tui/loader.js +0 -94
- package/dist/prompts/skill.d.ts +0 -2
- package/dist/prompts/skill.js +0 -650
- /package/dist/{core/__tests__/full/daemon-liveness-pane.full.test.d.ts → clients/attach/__tests__/action-parity.test.d.ts} +0 -0
- /package/dist/{core/__tests__/full/placement-focus.test.d.ts → clients/attach/__tests__/clipboard-image.test.d.ts} +0 -0
- /package/dist/{core/__tests__/full/placement-reconcile.test.d.ts → clients/attach/__tests__/editor-newline.test.d.ts} +0 -0
- /package/dist/{core/__tests__/full/placement-revive.test.d.ts → clients/attach/__tests__/git-info.test.d.ts} +0 -0
- /package/dist/{core/__tests__/full/placement-teardown.test.d.ts → clients/attach/__tests__/onrequest-wired.test.d.ts} +0 -0
- /package/dist/{core/__tests__/home-session.test.d.ts → clients/attach/__tests__/reconnect-giveup.test.d.ts} +0 -0
- /package/dist/{core/__tests__/relaunch.test.d.ts → clients/attach/__tests__/slash-quit-copy.test.d.ts} +0 -0
package/dist/daemon/manage.js
CHANGED
|
@@ -8,6 +8,7 @@ import { dirname, join } from 'node:path';
|
|
|
8
8
|
import { fileURLToPath } from 'node:url';
|
|
9
9
|
import { mkdirSync } from 'node:fs';
|
|
10
10
|
import { crtrHome } from '../core/canvas/paths.js';
|
|
11
|
+
import { hostExecPath } from '../core/runtime/branded-host.js';
|
|
11
12
|
import { isDaemonRunning, readPidfile } from './crtrd.js';
|
|
12
13
|
// ---------------------------------------------------------------------------
|
|
13
14
|
// Entry point resolution
|
|
@@ -30,8 +31,12 @@ export function spawnDaemon() {
|
|
|
30
31
|
}
|
|
31
32
|
// Ensure the canvas home directory exists so the daemon can write its pidfile.
|
|
32
33
|
mkdirSync(crtrHome(), { recursive: true });
|
|
34
|
+
// Launch from the crouter-branded host binary so the daemon shows "crouter"
|
|
35
|
+
// in macOS Full Disk Access, not "node" (see branded-host). NOTE: when crtrd
|
|
36
|
+
// is launchd-owned, the plist's ProgramArguments must point at the branded
|
|
37
|
+
// binary too — this path only covers a manual `crtr canvas daemon start`.
|
|
33
38
|
const entry = resolveCrtrdEntry();
|
|
34
|
-
const child = spawn(
|
|
39
|
+
const child = spawn(hostExecPath(), [entry], {
|
|
35
40
|
detached: true,
|
|
36
41
|
stdio: 'ignore',
|
|
37
42
|
});
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// side effects and no circular imports — keep it that way.
|
|
11
11
|
// ── Runtime control ──────────────────────────────────────────────────────
|
|
12
12
|
// Sanctioned launchers/mutators. reviveNode is the ONLY sanctioned launcher of
|
|
13
|
-
//
|
|
13
|
+
// the broker engine; every node is broker-hosted (no host_kind choice).
|
|
14
14
|
export { spawnChild } from './core/runtime/spawn.js';
|
|
15
15
|
export { reviveNode } from './core/runtime/revive.js';
|
|
16
16
|
export { closeNode } from './core/runtime/close.js';
|
|
@@ -109,37 +109,42 @@ test('natural stop while awaiting a live worker → idle-release with NO push (n
|
|
|
109
109
|
// ---------------------------------------------------------------------------
|
|
110
110
|
// §5.1 — the §1.7 agent_end branch map on the focuses table. Every assertion is
|
|
111
111
|
// on the canvas focuses/runtime rows after firing agent_end (TMUX_PANE is
|
|
112
|
-
// cleared in beforeEach
|
|
113
|
-
//
|
|
114
|
-
//
|
|
112
|
+
// cleared in beforeEach). NOTE (broker-host cut): the placement read `focusOf`
|
|
113
|
+
// used by the handler now GC-prunes a viewer row whose pane is not a LIVE tmux
|
|
114
|
+
// pane (liveOrPrune → paneExists), so a fabricated '%pane' id is pruned on the
|
|
115
|
+
// first read. To drive the handler's focus path deterministically in the
|
|
116
|
+
// tmux-free fast tier we register viewer rows with a NULL pane (a registered-
|
|
117
|
+
// but-not-yet-realized viewer, which liveOrPrune passes through). status='done'
|
|
118
|
+
// is reached by setting the runtime row directly (the branch reads
|
|
119
|
+
// getNode(nodeId).status).
|
|
115
120
|
// ---------------------------------------------------------------------------
|
|
116
|
-
test('§5.1.1 truly-done + focused
|
|
121
|
+
test('§5.1.1 truly-done + focused → focus row CLOSED, NO manager takeover (broker cut deleted handFocusToManager)', () => {
|
|
122
|
+
// Regression guard for the broker-host cut: the engine is now a detached
|
|
123
|
+
// broker, not a pane, so there is no engine to hand to a manager. The old
|
|
124
|
+
// "dormant idle-release manager takes over the finished node's focus row"
|
|
125
|
+
// path (handFocusToManager) is DELETED — a truly-done focused node just
|
|
126
|
+
// tearDownNode's its own viewer and shuts down, EVEN when a dormant
|
|
127
|
+
// idle-release manager exists (the exact case that used to trigger takeover).
|
|
117
128
|
createNode(node('root', { parent: null, lifecycle: 'resident' }));
|
|
118
|
-
// mgr is dormant + idle-release — the ONLY dormant manager the daemon will
|
|
119
|
-
// revive INTO the frozen pane, so the ONLY dormant case that is a real takeover.
|
|
120
129
|
createNode(node('mgr', { parent: 'root', lifecycle: 'terminal', mode: 'orchestrator', status: 'idle', intent: 'idle-release' }));
|
|
121
|
-
// M starts WITH a recorded LOCATION so the
|
|
130
|
+
// M starts WITH a recorded LOCATION so the done-path presence-null is observable.
|
|
122
131
|
createNode(node('M', { parent: 'mgr', lifecycle: 'terminal', pane: '%m', tmux_session: 'Suser', window: '@wm' }));
|
|
123
132
|
subscribe('mgr', 'M', true);
|
|
124
|
-
openFocusRow('fM',
|
|
133
|
+
openFocusRow('fM', null, 'Suser', 'M'); // null pane → focusOf returns it → drives tearDownNode
|
|
125
134
|
process.env['CRTR_NODE_ID'] = 'M';
|
|
126
135
|
setStatus('M', 'done'); // pushed final this turn
|
|
127
136
|
const pi = makeFakePi();
|
|
128
137
|
registerCanvasStophook(pi);
|
|
129
138
|
let shutdown = false;
|
|
130
139
|
pi.fire('agent_end', stopEvent('done — pushed final'), { shutdown: () => { shutdown = true; } });
|
|
131
|
-
//
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
// getFocusByNode('M') still names fM — both asserts fail.
|
|
137
|
-
assert.equal(getFocusByNode('mgr')?.focus_id, 'fM', 'focus row taken over by the manager');
|
|
140
|
+
// The done branch: focusOf('M') != null → tearDownNode('M') CLOSES fM. The
|
|
141
|
+
// manager is NOT handed anything (takeover deleted). Non-vacuous: a takeover
|
|
142
|
+
// impl would leave getFocusByNode('mgr').focus_id === 'fM'.
|
|
143
|
+
assert.equal(getFocusByNode('mgr'), null, 'the manager is NOT handed the finished node\'s focus (takeover deleted)');
|
|
144
|
+
assert.equal(getFocusById('fM'), null, 'the finished node\'s viewer focus row is closed');
|
|
138
145
|
assert.equal(getFocusByNode('M'), null, 'the finished node no longer occupies any focus');
|
|
139
|
-
assert.equal(shutdown, true, 'pi shut down after
|
|
140
|
-
//
|
|
141
|
-
// own presence is nulled so two rows never reference %m. Non-vacuous: an impl
|
|
142
|
-
// that skips the done-path setPresence-null leaves getNode('M').pane === '%m'.
|
|
146
|
+
assert.equal(shutdown, true, 'pi shut down after teardown');
|
|
147
|
+
// The done node's own presence is nulled (setPresence(null) on the done path).
|
|
143
148
|
assert.equal(getNode('M')?.pane ?? null, null, 'the finished node\'s own LOCATION pane is nulled');
|
|
144
149
|
assert.equal(getNode('M')?.window ?? null, null, 'the finished node\'s window presence is nulled too');
|
|
145
150
|
});
|
|
@@ -206,7 +211,10 @@ test('§5.1.5 awaiting + FOCUSED → STAY ALIVE: pi keeps running (no release),
|
|
|
206
211
|
createNode(node('worker', { parent: 'mgr', lifecycle: 'terminal', status: 'active' }));
|
|
207
212
|
subscribe('root', 'mgr', true);
|
|
208
213
|
subscribe('mgr', 'worker', true); // mgr awaits a live worker → would idle-release if UNfocused
|
|
209
|
-
|
|
214
|
+
// null pane (broker cut): focusOf passes a null-pane viewer row through, so the
|
|
215
|
+
// handler reads mgr as FOCUSED in the tmux-free fast tier (a fabricated %pane
|
|
216
|
+
// would be GC-pruned by liveOrPrune and the node would wrongly release).
|
|
217
|
+
openFocusRow('fMgr', null, 'Suser', 'mgr');
|
|
210
218
|
process.env['CRTR_NODE_ID'] = 'mgr';
|
|
211
219
|
const pi = makeFakePi();
|
|
212
220
|
registerCanvasStophook(pi);
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
//
|
|
16
16
|
// The block carries: the path to the node's own context dir and the framing for
|
|
17
17
|
// what belongs there (a shared document store for the other nodes). EVERY node
|
|
18
|
-
// also gets a `<
|
|
19
|
-
// eligible `
|
|
18
|
+
// also gets a `<knowledge>` block rendered from the document substrate —
|
|
19
|
+
// eligible `knowledge` docs at their system-prompt visibility rung, plus the
|
|
20
20
|
// node's own node-local substrate docs — so the bearings name what to read on
|
|
21
|
-
// demand. (
|
|
22
|
-
//
|
|
21
|
+
// demand. (Preferences surface as their own `<preferences>` block of the
|
|
22
|
+
// system prompt, not in this block.) An
|
|
23
23
|
// orchestrator additionally gets the across-refresh-cycles framing (the one
|
|
24
24
|
// thing a terminal worker's bearings drop). The prose lives in
|
|
25
25
|
// core/runtime/bearings.ts (shared with the promotion guidance dump).
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
// It owns the substrate's two new pi hooks:
|
|
10
10
|
//
|
|
11
11
|
// 1. before_agent_start — the BOOT system-prompt half. Splices the rendered
|
|
12
|
-
// `<
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
12
|
+
// `<preferences>` + `<memory-guidance>` blocks into `event.systemPrompt`,
|
|
13
|
+
// right after pi's native "Available tools" list (before the
|
|
14
|
+
// `\n\nGuidelines:` anchor), so the substrate's standing directives sit in
|
|
15
|
+
// the tool-selection frame the agent reads while choosing a capability —
|
|
16
|
+
// mirroring the personal crouter-help.ts anchor logic. Falls back to
|
|
17
|
+
// appending when the anchor is absent. (Knowledge rides the `<crtr-context>`
|
|
18
|
+
// bearings message instead — see core/substrate/render.ts.)
|
|
19
19
|
//
|
|
20
20
|
// 2. tool_result (gated on `read`) — the ON-READ half. For each non-error
|
|
21
21
|
// `read`, surfaces the substrate docs that should appear alongside the file
|
|
@@ -34,8 +34,9 @@
|
|
|
34
34
|
// with no dep on the pi packages. Mirrors canvas-context-intro.ts.
|
|
35
35
|
import { homedir } from 'node:os';
|
|
36
36
|
import { join, resolve } from 'node:path';
|
|
37
|
-
import { renderMemoryGuidance, renderOnReadDocs, renderPreferencesSection,
|
|
37
|
+
import { renderMemoryGuidance, renderOnReadDocs, renderPreferencesSection, } from '../core/substrate/index.js';
|
|
38
38
|
import { clearSessionCache } from '../core/substrate/session-cache.js';
|
|
39
|
+
import { loadInjectedDocs, saveInjectedDocs } from '../core/substrate/injected-store.js';
|
|
39
40
|
// ---------------------------------------------------------------------------
|
|
40
41
|
// Extension
|
|
41
42
|
// ---------------------------------------------------------------------------
|
|
@@ -55,24 +56,29 @@ export function registerCanvasDocSubstrate(pi) {
|
|
|
55
56
|
const nodeId = process.env['CRTR_NODE_ID'];
|
|
56
57
|
if (nodeId === undefined || nodeId.trim() === '')
|
|
57
58
|
return; // not a canvas node — inert
|
|
58
|
-
// Per-
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
|
|
59
|
+
// Per-TRANSCRIPT set of injected doc realpaths → a doc surfaces at most once
|
|
60
|
+
// across the node's conversation, EVEN across a dormancy → revive(resume)
|
|
61
|
+
// cycle. A resume reuses the same .jsonl transcript in a NEW pi process, so
|
|
62
|
+
// the set is REHYDRATED from disk at process start (not started empty) and is
|
|
63
|
+
// NOT cleared on session_start — a resume continues the transcript, so the
|
|
64
|
+
// dedup must carry forward. The one launch path that begins a FRESH transcript
|
|
65
|
+
// (reviveNode with resume=false) deletes the file, so a new conversation
|
|
66
|
+
// rehydrates empty here. See core/substrate/injected-store.ts.
|
|
67
|
+
const injectedDocs = loadInjectedDocs(nodeId);
|
|
64
68
|
pi.on('session_start', () => {
|
|
65
|
-
|
|
69
|
+
// Only the per-session substrate PARSE cache resets each session (so the
|
|
70
|
+
// corpus is re-scanned, picking up skill/memory writes). injectedDocs is
|
|
71
|
+
// transcript-scoped, not session-scoped — deliberately NOT cleared here.
|
|
66
72
|
clearSessionCache();
|
|
67
73
|
});
|
|
68
|
-
// 1. BOOT system-prompt half — splice `<
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
//
|
|
74
|
+
// 1. BOOT system-prompt half — splice `<preferences>` + `<memory-guidance>`.
|
|
75
|
+
// The guidance block is always present for a canvas node (the memory system
|
|
76
|
+
// always exists), so the splice is never empty even when the preferences
|
|
77
|
+
// tree is. (Knowledge no longer enters the system prompt — it rides the
|
|
78
|
+
// `<crtr-context>` bearings message via renderKnowledgeBlock.)
|
|
72
79
|
pi.on('before_agent_start', (event) => {
|
|
73
80
|
try {
|
|
74
81
|
const sections = [
|
|
75
|
-
renderSkillsSection(nodeId),
|
|
76
82
|
renderPreferencesSection(nodeId),
|
|
77
83
|
renderMemoryGuidance(),
|
|
78
84
|
].filter((s) => s !== '');
|
|
@@ -109,6 +115,9 @@ export function registerCanvasDocSubstrate(pi) {
|
|
|
109
115
|
const injected = renderOnReadDocs(nodeId, absFile, injectedDocs);
|
|
110
116
|
if (injected === '')
|
|
111
117
|
return; // nothing surfaced — pass the read through unchanged
|
|
118
|
+
// A doc surfaced → renderOnReadDocs grew injectedDocs; persist the set so
|
|
119
|
+
// the dedup survives a later dormancy → revive(resume).
|
|
120
|
+
saveInjectedDocs(nodeId, injectedDocs);
|
|
112
121
|
// Prepend the surfacing docs ahead of the file contents.
|
|
113
122
|
return { content: [{ type: 'text', text: injected }, ...event.content] };
|
|
114
123
|
}
|