create-walle 0.10.1 → 0.10.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/README.md +7 -1
- package/lib/owner-write-safety.js +135 -0
- package/lib/public-runtime.js +13 -5
- package/lib/release-schema.json +3 -2
- package/lib/runtime-closure-policy.json +11 -8
- package/package.json +1 -1
- package/template/bin/deps-doctor.js +1 -1
- package/template/bin/node-bin.sh +11 -0
- package/template/coding-task-manager/api-prompts.js +55 -29
- package/template/coding-task-manager/bin/claude-hook.js +62 -4
- package/template/coding-task-manager/bin/claude-table-parity.js +307 -0
- package/template/coding-task-manager/bin/conversation-storage-auto-migration-lib.js +16 -1
- package/template/coding-task-manager/bin/conversation-storage-generation-evidence.js +9 -2
- package/template/coding-task-manager/bin/conversation-storage-service-entry-lib.js +16 -1
- package/template/coding-task-manager/bin/conversation-storage-walle-owner.js +247 -0
- package/template/coding-task-manager/bin/ctm-machine-pair.js +160 -0
- package/template/coding-task-manager/bin/ctm-relay-client.js +35 -12
- package/template/coding-task-manager/bin/land.js +2069 -0
- package/template/coding-task-manager/bin/lead-wait-census.js +1348 -0
- package/template/coding-task-manager/bin/memory-census.js +4 -2
- package/template/coding-task-manager/bin/memory-sync-verify.js +151 -0
- package/template/coding-task-manager/bin/probe-refusal-scope.js +530 -0
- package/template/coding-task-manager/bin/repair-foreign-clone.js +564 -0
- package/template/coding-task-manager/bin/repair-resume-echo-titles.js +248 -0
- package/template/coding-task-manager/bin/write-lock-bench.js +111 -0
- package/template/coding-task-manager/db.js +860 -317
- package/template/coding-task-manager/git-utils.js +44 -0
- package/template/coding-task-manager/lib/acp/acp-client.js +383 -0
- package/template/coding-task-manager/lib/acp/dsh-context-truth.js +176 -0
- package/template/coding-task-manager/lib/acp/dsh-launch-model.js +302 -0
- package/template/coding-task-manager/lib/acp/dsh-mcp-servers.js +194 -0
- package/template/coding-task-manager/lib/acp/dsh-prompt-lane.js +616 -0
- package/template/coding-task-manager/lib/acp/dsh-route-patch.js +308 -0
- package/template/coding-task-manager/lib/acp/dsh-session-runtime.js +522 -0
- package/template/coding-task-manager/lib/acp/dsh-transcript.js +395 -0
- package/template/coding-task-manager/lib/acp/dsh-usage-log.js +162 -0
- package/template/coding-task-manager/lib/acp/ndjson-stdio-transport.js +225 -0
- package/template/coding-task-manager/lib/adopted-host-redial.js +47 -7
- package/template/coding-task-manager/lib/adopted-launch-environment.js +123 -0
- package/template/coding-task-manager/lib/agent-auto-update-runtime.js +0 -3
- package/template/coding-task-manager/lib/agent-auto-update.js +26 -10
- package/template/coding-task-manager/lib/agent-bundle/build.js +657 -0
- package/template/coding-task-manager/lib/agent-bundle/codex-install.js +558 -0
- package/template/coding-task-manager/lib/agent-bundle/drift.js +120 -0
- package/template/coding-task-manager/lib/agent-bundle/gc.js +522 -0
- package/template/coding-task-manager/lib/agent-bundle/inventory.js +346 -0
- package/template/coding-task-manager/lib/agent-bundle/push.js +717 -0
- package/template/coding-task-manager/lib/agent-bundle/skill-transfer.js +724 -0
- package/template/coding-task-manager/lib/agent-bundle/spawn.js +119 -0
- package/template/coding-task-manager/lib/agent-bundle/store.js +568 -0
- package/template/coding-task-manager/lib/agent-capabilities.js +142 -12
- package/template/coding-task-manager/lib/agent-cli-cache.js +30 -5
- package/template/coding-task-manager/lib/agent-definitions.js +19 -0
- package/template/coding-task-manager/lib/agent-hooks-codex-toml.js +28 -16
- package/template/coding-task-manager/lib/agent-hooks-codex-workspace.js +9 -1
- package/template/coding-task-manager/lib/agent-hooks-installer.js +23 -8
- package/template/coding-task-manager/lib/agent-hooks-prune.js +37 -11
- package/template/coding-task-manager/lib/agent-hooks-shim.js +105 -0
- package/template/coding-task-manager/lib/agent-presets.js +99 -1
- package/template/coding-task-manager/lib/agent-title-apply.js +88 -0
- package/template/coding-task-manager/lib/agent-title-backfill-read.js +92 -0
- package/template/coding-task-manager/lib/agent-upgrade-jobs.js +12 -1
- package/template/coding-task-manager/lib/agent-version-service.js +74 -11
- package/template/coding-task-manager/lib/all-sessions-query.js +6 -2
- package/template/coding-task-manager/lib/api/agent-bundles.js +436 -0
- package/template/coding-task-manager/lib/api/backup-retention.js +83 -0
- package/template/coding-task-manager/lib/api/conversation-sync-routes.js +124 -0
- package/template/coding-task-manager/lib/api/diagnostics.js +549 -69
- package/template/coding-task-manager/lib/api/fleet.js +118 -0
- package/template/coding-task-manager/lib/api/host-stats.js +98 -0
- package/template/coding-task-manager/lib/api/hub-bridge.js +243 -0
- package/template/coding-task-manager/lib/api/ingress.js +43 -12
- package/template/coding-task-manager/lib/api/landing.js +403 -0
- package/template/coding-task-manager/lib/api/machine-pairing.js +285 -0
- package/template/coding-task-manager/lib/api/machine-pool.js +307 -0
- package/template/coding-task-manager/lib/api/machines.js +1150 -0
- package/template/coding-task-manager/lib/api/memory-sync-routes.js +335 -0
- package/template/coding-task-manager/lib/api/misc-ops.js +25 -5
- package/template/coding-task-manager/lib/api/providers.js +53 -6
- package/template/coding-task-manager/lib/api/remote-sessions.js +1326 -0
- package/template/coding-task-manager/lib/api/resume-from-store.js +25 -0
- package/template/coding-task-manager/lib/api/session-attach.js +623 -0
- package/template/coding-task-manager/lib/api/session-messages.js +1384 -0
- package/template/coding-task-manager/lib/api/sessions.js +237 -59
- package/template/coding-task-manager/lib/api/setup-network.js +544 -16
- package/template/coding-task-manager/lib/api/setup-wizard-handlers.js +884 -0
- package/template/coding-task-manager/lib/api/setup.js +829 -10
- package/template/coding-task-manager/lib/api/transcript-history.js +17 -4
- package/template/coding-task-manager/lib/api/walle-bridge.js +9 -1
- package/template/coding-task-manager/lib/api/worktrees.js +38 -37
- package/template/coding-task-manager/lib/approval-drift.js +16 -1
- package/template/coding-task-manager/lib/approval-logical-frame.js +5 -1
- package/template/coding-task-manager/lib/approval-scope.js +68 -4
- package/template/coding-task-manager/lib/attachment-reconciler-wiring.js +5 -2
- package/template/coding-task-manager/lib/auth-context.js +32 -2
- package/template/coding-task-manager/lib/auth-rate-limit.js +64 -1
- package/template/coding-task-manager/lib/auth-rules.js +474 -62
- package/template/coding-task-manager/lib/background-stop.js +369 -0
- package/template/coding-task-manager/lib/best-of-attempts.js +4 -1
- package/template/coding-task-manager/lib/best-of-launch-plan.js +52 -0
- package/template/coding-task-manager/lib/box-keep-awake.js +89 -0
- package/template/coding-task-manager/lib/broadcast-reason-stats.js +152 -0
- package/template/coding-task-manager/lib/broadcast-serialize.js +7 -1
- package/template/coding-task-manager/lib/browser-session-broker.js +9 -1
- package/template/coding-task-manager/lib/browser-use-adapter.js +33 -2
- package/template/coding-task-manager/lib/build-info.js +4 -2
- package/template/coding-task-manager/lib/claude-markdown-ansi.js +27 -85
- package/template/coding-task-manager/lib/claude-model-truth.js +13 -2
- package/template/coding-task-manager/lib/claude-session-title.js +6 -30
- package/template/coding-task-manager/lib/claude-table-layout.js +322 -0
- package/template/coding-task-manager/lib/claude-transcript-terminal-renderer.js +17 -13
- package/template/coding-task-manager/lib/client-diag-handler.js +69 -2
- package/template/coding-task-manager/lib/codex-app-server-client.js +14 -16
- package/template/coding-task-manager/lib/codex-config-guard.js +33 -3
- package/template/coding-task-manager/lib/codex-configuration-history.js +55 -0
- package/template/coding-task-manager/lib/codex-harness-qualification.js +55 -20
- package/template/coding-task-manager/lib/codex-launch-health.js +29 -2
- package/template/coding-task-manager/lib/codex-link-preparation.js +9 -8
- package/template/coding-task-manager/lib/codex-paths.js +2 -1
- package/template/coding-task-manager/lib/codex-rollout-history.js +743 -0
- package/template/coding-task-manager/lib/coding-agent-models.js +48 -42
- package/template/coding-task-manager/lib/coding-cli-skill-installer.js +44 -14
- package/template/coding-task-manager/lib/coding-session-model-adapters.js +70 -4
- package/template/coding-task-manager/lib/coding-session-model-owner.js +1 -1
- package/template/coding-task-manager/lib/coding-session-model-projection.js +5 -0
- package/template/coding-task-manager/lib/coding-session-model-public.js +7 -1
- package/template/coding-task-manager/lib/coding-session-model-runtime.js +24 -6
- package/template/coding-task-manager/lib/coding-session-model-scan.js +31 -0
- package/template/coding-task-manager/lib/coding-session-model-state.js +17 -0
- package/template/coding-task-manager/lib/coding-session-model-sync-state.js +0 -1
- package/template/coding-task-manager/lib/conversation-freshness-diagnostics.js +280 -0
- package/template/coding-task-manager/lib/conversation-import/cursor-guard-owner.js +10 -0
- package/template/coding-task-manager/lib/conversation-item-clock.js +261 -0
- package/template/coding-task-manager/lib/conversation-source-registry.js +5 -0
- package/template/coding-task-manager/lib/conversation-store-v2.js +44 -0
- package/template/coding-task-manager/lib/conversation-sync.js +355 -0
- package/template/coding-task-manager/lib/create/resolve-launch-params.js +104 -13
- package/template/coding-task-manager/lib/create/worker-role-profile.js +4 -4
- package/template/coding-task-manager/lib/create-intent-lease.js +51 -0
- package/template/coding-task-manager/lib/ctm-boot-lifecycle.js +17 -1
- package/template/coding-task-manager/lib/ctm-session-context-api.js +97 -6
- package/template/coding-task-manager/lib/db-domain-tables.js +8 -0
- package/template/coding-task-manager/lib/db-domains.js +22 -2
- package/template/coding-task-manager/lib/db-owner-dispatch-probe.js +32 -0
- package/template/coding-task-manager/lib/db-owner-op-registry.js +7 -0
- package/template/coding-task-manager/lib/db-owner-request-counts.js +178 -0
- package/template/coding-task-manager/lib/db-owner-worker-client.js +68 -14
- package/template/coding-task-manager/lib/db-schema-source-files.js +6 -0
- package/template/coding-task-manager/lib/deferred-restore-attempt.js +6 -2
- package/template/coding-task-manager/lib/feature-manifest.js +5 -1
- package/template/coding-task-manager/lib/fleet-conversation-route.js +97 -0
- package/template/coding-task-manager/lib/fleet-fanout.js +78 -0
- package/template/coding-task-manager/lib/fleet-hub.js +762 -0
- package/template/coding-task-manager/lib/fleet-origin-follower.js +252 -0
- package/template/coding-task-manager/lib/fleet-resolver-effects.js +147 -0
- package/template/coding-task-manager/lib/fleet-resolver-tick.js +148 -0
- package/template/coding-task-manager/lib/fleet-resolver.js +454 -0
- package/template/coding-task-manager/lib/fleet-session-list-routes.js +114 -0
- package/template/coding-task-manager/lib/fleet-session-lists.js +672 -0
- package/template/coding-task-manager/lib/fleet-update.js +798 -0
- package/template/coding-task-manager/lib/fs-watcher-root-watch.js +141 -0
- package/template/coding-task-manager/lib/fs-watcher.js +61 -44
- package/template/coding-task-manager/lib/harness-history-transition.js +52 -11
- package/template/coding-task-manager/lib/headless-inflight-ops.js +203 -0
- package/template/coding-task-manager/lib/headless-missing-reply.js +42 -0
- package/template/coding-task-manager/lib/headless-term-service.js +139 -25
- package/template/coding-task-manager/lib/hermetic-agent-launch-guard.js +10 -0
- package/template/coding-task-manager/lib/history-transition-read-op.js +175 -8
- package/template/coding-task-manager/lib/host-control-dial.js +167 -0
- package/template/coding-task-manager/lib/host-cpu-categories.js +310 -0
- package/template/coding-task-manager/lib/host-fseventsd-sampler.js +399 -0
- package/template/coding-task-manager/lib/host-handoff-orchestrator.js +16 -2
- package/template/coding-task-manager/lib/host-handoff.js +50 -15
- package/template/coding-task-manager/lib/host-health-ledger.js +164 -12
- package/template/coding-task-manager/lib/host-self-truth-watchdog.js +4 -0
- package/template/coding-task-manager/lib/host-stats.js +475 -0
- package/template/coding-task-manager/lib/host-threadpool-evacuation.js +160 -0
- package/template/coding-task-manager/lib/host-threadpool-monitor.js +14 -1
- package/template/coding-task-manager/lib/hosted-input-dispatch.js +203 -0
- package/template/coding-task-manager/lib/hosted-sync-worker.js +141 -310
- package/template/coding-task-manager/lib/hub-bridge-access.js +798 -0
- package/template/coding-task-manager/lib/hub-bridge-box.js +409 -0
- package/template/coding-task-manager/lib/hub-bridge-mcp.js +380 -0
- package/template/coding-task-manager/lib/hub-bridge-mesh.js +313 -0
- package/template/coding-task-manager/lib/hub-bridge-ops.js +721 -0
- package/template/coding-task-manager/lib/hub-bridge.js +398 -0
- package/template/coding-task-manager/lib/idle-notify.js +491 -0
- package/template/coding-task-manager/lib/instance-id-ownership-manifest.js +12 -0
- package/template/coding-task-manager/lib/instance-manifest-runtime.js +3 -0
- package/template/coding-task-manager/lib/instance-manifest.js +18 -2
- package/template/coding-task-manager/lib/instance-sync-status.js +33 -8
- package/template/coding-task-manager/lib/landing/agent-rule.txt +1 -0
- package/template/coding-task-manager/lib/landing/batch-runner.js +366 -0
- package/template/coding-task-manager/lib/landing/config.js +536 -0
- package/template/coding-task-manager/lib/landing/ctm-view.js +256 -0
- package/template/coding-task-manager/lib/landing/gate.js +360 -0
- package/template/coding-task-manager/lib/landing/git.js +344 -0
- package/template/coding-task-manager/lib/landing/lease.js +247 -0
- package/template/coding-task-manager/lib/landing/merge-delta.js +380 -0
- package/template/coding-task-manager/lib/landing/proof.js +223 -0
- package/template/coding-task-manager/lib/landing/queue.js +998 -0
- package/template/coding-task-manager/lib/landing/radar.js +489 -0
- package/template/coding-task-manager/lib/landing/resolve-cli.js +424 -0
- package/template/coding-task-manager/lib/landing/state.js +263 -0
- package/template/coding-task-manager/lib/landing/stop.js +49 -0
- package/template/coding-task-manager/lib/landing/sync-cli.js +475 -0
- package/template/coding-task-manager/lib/landing/sync.js +456 -0
- package/template/coding-task-manager/lib/landing/train.js +885 -0
- package/template/coding-task-manager/lib/landing/window.js +57 -0
- package/template/coding-task-manager/lib/launch-environment.js +121 -0
- package/template/coding-task-manager/lib/launch-model-override.js +193 -8
- package/template/coding-task-manager/lib/launch-plan-pool.js +2 -1
- package/template/coding-task-manager/lib/launch-plan-warm-cache.js +6 -0
- package/template/coding-task-manager/lib/launch-plan-worker.js +59 -2
- package/template/coding-task-manager/lib/lead-model-observer.js +57 -1
- package/template/coding-task-manager/lib/lead-model-options.js +160 -3
- package/template/coding-task-manager/lib/lead-model-restore-reconciliation.js +106 -24
- package/template/coding-task-manager/lib/lead-model-switch-runtime.js +409 -72
- package/template/coding-task-manager/lib/lead-model-switch.js +115 -10
- package/template/coding-task-manager/lib/lead-model-transition-runtime.js +14 -2
- package/template/coding-task-manager/lib/lead-model-transition-store.js +85 -9
- package/template/coding-task-manager/lib/lead-route-preflight.js +179 -0
- package/template/coding-task-manager/lib/lead-switch-history-mode.js +110 -0
- package/template/coding-task-manager/lib/lead-wire-agent.js +7 -0
- package/template/coding-task-manager/lib/legacy-draft-cancellation-recovery.js +111 -0
- package/template/coding-task-manager/lib/lifecycle-wake-experiment.js +9 -2
- package/template/coding-task-manager/lib/live-defer-announce.js +45 -0
- package/template/coding-task-manager/lib/login-tripwire.js +1 -0
- package/template/coding-task-manager/lib/machine-pairing.js +238 -0
- package/template/coding-task-manager/lib/machine-pool.js +409 -0
- package/template/coding-task-manager/lib/machine-registry.js +1494 -0
- package/template/coding-task-manager/lib/machine-self.js +66 -0
- package/template/coding-task-manager/lib/macos-capabilities.js +32 -15
- package/template/coding-task-manager/lib/main-thread-lint-exemptions.json +485 -57
- package/template/coding-task-manager/lib/mainloop-observability.js +14 -9
- package/template/coding-task-manager/lib/media-draft-owner.js +16 -3
- package/template/coding-task-manager/lib/media-journal-control-reader.js +473 -0
- package/template/coding-task-manager/lib/media-journal.js +84 -27
- package/template/coding-task-manager/lib/media-store-options.js +43 -15
- package/template/coding-task-manager/lib/memory-join.js +337 -0
- package/template/coding-task-manager/lib/memory-sync-verify.js +393 -0
- package/template/coding-task-manager/lib/memory-sync.js +565 -0
- package/template/coding-task-manager/lib/migrations/v56-host-samples-and-machine-pool.js +76 -0
- package/template/coding-task-manager/lib/migrations/v57-delegate-pref-mirror-opencode.js +68 -0
- package/template/coding-task-manager/lib/migrations/v58-subagent-launch-native-subagents.js +42 -0
- package/template/coding-task-manager/lib/migrations/v59-coding-session-model-state-dsh.js +73 -0
- package/template/coding-task-manager/lib/migrations/v60-delegate-pref-mirror-dsh.js +78 -0
- package/template/coding-task-manager/lib/migrations/v61-conversation-item-clock.js +71 -0
- package/template/coding-task-manager/lib/mirror-feed-sanitize.js +12 -3
- package/template/coding-task-manager/lib/model-availability.js +727 -0
- package/template/coding-task-manager/lib/model-execution-recipe-metadata.js +4 -6
- package/template/coding-task-manager/lib/model-host-receipt.js +6 -3
- package/template/coding-task-manager/lib/model-id-rule.js +19 -0
- package/template/coding-task-manager/lib/model-proxy/anthropic-face.js +8 -0
- package/template/coding-task-manager/lib/model-proxy/auto-mode-review.js +110 -23
- package/template/coding-task-manager/lib/model-proxy/chat-response-translators.js +6 -0
- package/template/coding-task-manager/lib/model-proxy/generation-probe.js +60 -17
- package/template/coding-task-manager/lib/model-proxy/handoff.js +494 -0
- package/template/coding-task-manager/lib/model-proxy/historical-tool-declarations.js +37 -0
- package/template/coding-task-manager/lib/model-proxy/lead-request-validation.js +1 -0
- package/template/coding-task-manager/lib/model-proxy/lead-token-admin.js +130 -0
- package/template/coding-task-manager/lib/model-proxy/lead-worker-picks.js +25 -0
- package/template/coding-task-manager/lib/model-proxy/native-lead-listener.js +61 -7
- package/template/coding-task-manager/lib/model-proxy/proxy-cli.js +200 -0
- package/template/coding-task-manager/lib/model-proxy/proxy-instance-record.js +257 -0
- package/template/coding-task-manager/lib/model-proxy/refusal-scope.js +151 -0
- package/template/coding-task-manager/lib/model-proxy/request-budget-store.js +11 -2
- package/template/coding-task-manager/lib/model-proxy/stream-accounting.js +205 -0
- package/template/coding-task-manager/lib/model-proxy/tokens.js +147 -5
- package/template/coding-task-manager/lib/model-proxy/upstream-outcome.js +18 -0
- package/template/coding-task-manager/lib/native-agent-model-args.js +25 -22
- package/template/coding-task-manager/lib/native-history-control.js +7 -5
- package/template/coding-task-manager/lib/native-lead-settings-client.js +46 -5
- package/template/coding-task-manager/lib/native-lead-tls.js +18 -4
- package/template/coding-task-manager/lib/oauth-proxy-supervisor.js +776 -75
- package/template/coding-task-manager/lib/online-backup-worker-client.js +2 -0
- package/template/coding-task-manager/lib/opencode-cli.js +480 -0
- package/template/coding-task-manager/lib/opencode-launch-model.js +471 -0
- package/template/coding-task-manager/lib/opencode-v1-plugin/model-carrier.mjs +35 -0
- package/template/coding-task-manager/lib/opencode-v2-plugin/server.js +118 -0
- package/template/coding-task-manager/lib/owner-action-manifest-data.json +15 -1
- package/template/coding-task-manager/lib/painted-row-recorder.js +9 -1
- package/template/coding-task-manager/lib/park-composer-draft.js +54 -0
- package/template/coding-task-manager/lib/park-fresh-relaunch.js +41 -10
- package/template/coding-task-manager/lib/perf-phase-trace.js +72 -0
- package/template/coding-task-manager/lib/perf-summary.js +7 -0
- package/template/coding-task-manager/lib/perf-tracker.js +63 -2
- package/template/coding-task-manager/lib/project-config.js +7 -0
- package/template/coding-task-manager/lib/prompt-purge-v2.js +52 -1
- package/template/coding-task-manager/lib/prompt-submission-contract.js +21 -1
- package/template/coding-task-manager/lib/provider-login-broker.js +264 -24
- package/template/coding-task-manager/lib/provider-login-capture.js +153 -0
- package/template/coding-task-manager/lib/provider-login-tab.js +10 -2
- package/template/coding-task-manager/lib/queue-draft-status-overlay.js +36 -0
- package/template/coding-task-manager/lib/raw-codex-history-window.js +5 -3
- package/template/coding-task-manager/lib/read-pool-client.js +94 -4
- package/template/coding-task-manager/lib/read-pool-op-registry.js +10 -1
- package/template/coding-task-manager/lib/read-pool-worker-handle.js +29 -4
- package/template/coding-task-manager/lib/recent-catalog-query.js +41 -0
- package/template/coding-task-manager/lib/recent-session-catalog-response.js +76 -10
- package/template/coding-task-manager/lib/recovery-evidence.js +26 -11
- package/template/coding-task-manager/lib/relay-client.js +57 -3
- package/template/coding-task-manager/lib/relink-audit.js +34 -5
- package/template/coding-task-manager/lib/remote-command-context.js +12 -0
- package/template/coding-task-manager/lib/remote-command-runtime.js +13 -1
- package/template/coding-task-manager/lib/remote-machine-catalog.js +1357 -0
- package/template/coding-task-manager/lib/remote-machine-create.js +1233 -0
- package/template/coding-task-manager/lib/remote-machine-link.js +1426 -0
- package/template/coding-task-manager/lib/remote-machine-proxy.js +654 -0
- package/template/coding-task-manager/lib/remote-session-forward.js +364 -0
- package/template/coding-task-manager/lib/remote-submission-status.js +6 -0
- package/template/coding-task-manager/lib/remote-terminal-target.js +9 -2
- package/template/coding-task-manager/lib/restart-guard.js +18 -6
- package/template/coding-task-manager/lib/restart-outcome-truth.js +20 -3
- package/template/coding-task-manager/lib/restart-preflight.js +9 -2
- package/template/coding-task-manager/lib/restore-backoff-gate.js +10 -2
- package/template/coding-task-manager/lib/restore-prepare-retry.js +12 -5
- package/template/coding-task-manager/lib/restore-resume-batch.js +22 -1
- package/template/coding-task-manager/lib/restore-seed-modes.js +87 -0
- package/template/coding-task-manager/lib/restored-scrollback-hydration-runtime.js +22 -2
- package/template/coding-task-manager/lib/resume-admission.js +17 -3
- package/template/coding-task-manager/lib/resume-blocked-wire.js +62 -1
- package/template/coding-task-manager/lib/resume-cwd.js +13 -0
- package/template/coding-task-manager/lib/resume-from-store.js +12 -1
- package/template/coding-task-manager/lib/resume-origin-facts.js +38 -1
- package/template/coding-task-manager/lib/resume-preflight.js +21 -16
- package/template/coding-task-manager/lib/review-repo-admission.js +39 -6
- package/template/coding-task-manager/lib/review-repo-registry.js +74 -18
- package/template/coding-task-manager/lib/root-delivery-runtime.js +74 -17
- package/template/coding-task-manager/lib/root-delivery-selection.js +37 -1
- package/template/coding-task-manager/lib/root-prompt-admission.js +33 -2
- package/template/coding-task-manager/lib/root-prompt-flow.js +168 -34
- package/template/coding-task-manager/lib/runtime-contract.js +3 -1
- package/template/coding-task-manager/lib/schema-indexes.js +1 -0
- package/template/coding-task-manager/lib/scrollback-archive-store.js +7 -4
- package/template/coding-task-manager/lib/session-analysis-memory.js +2 -0
- package/template/coding-task-manager/lib/session-context-locator.js +742 -0
- package/template/coding-task-manager/lib/session-create/attachment.js +2 -2
- package/template/coding-task-manager/lib/session-create/codex-native-provider-gate.js +218 -0
- package/template/coding-task-manager/lib/session-create/codex-resume-exit-classify.js +52 -0
- package/template/coding-task-manager/lib/session-create/create-phases.js +118 -0
- package/template/coding-task-manager/lib/session-create/delegate-worker.js +179 -20
- package/template/coding-task-manager/lib/session-create/dsh-session.js +930 -0
- package/template/coding-task-manager/lib/session-create/identity.js +20 -1
- package/template/coding-task-manager/lib/session-create/lead-route-launch.js +186 -13
- package/template/coding-task-manager/lib/session-create/native-lead-lifetime.js +55 -3
- package/template/coding-task-manager/lib/session-create/opencode-lead-provider.js +50 -0
- package/template/coding-task-manager/lib/session-create/prepared.js +201 -9
- package/template/coding-task-manager/lib/session-create/provider-launch-context.js +77 -0
- package/template/coding-task-manager/lib/session-create/provider-process.js +193 -64
- package/template/coding-task-manager/lib/session-create/response.js +37 -19
- package/template/coding-task-manager/lib/session-create/structured-session.js +27 -0
- package/template/coding-task-manager/lib/session-create/subagent-pick-table.js +3 -1
- package/template/coding-task-manager/lib/session-create/subagent-pick.js +458 -9
- package/template/coding-task-manager/lib/session-create/transcript.js +14 -5
- package/template/coding-task-manager/lib/session-create/worker-budget-setup.js +21 -2
- package/template/coding-task-manager/lib/session-create/worker-continuation.js +50 -2
- package/template/coding-task-manager/lib/session-create/worker-launch-sandbox.js +39 -10
- package/template/coding-task-manager/lib/session-create/worker-notices.js +94 -5
- package/template/coding-task-manager/lib/session-create/worker-observability.js +101 -9
- package/template/coding-task-manager/lib/session-create/worker-stop.js +11 -3
- package/template/coding-task-manager/lib/session-create/worker-wait-watcher.js +315 -0
- package/template/coding-task-manager/lib/session-empty.js +13 -10
- package/template/coding-task-manager/lib/session-geometry-authority-handler.js +10 -1
- package/template/coding-task-manager/lib/session-host-manager.js +212 -206
- package/template/coding-task-manager/lib/session-jobs.js +20 -10
- package/template/coding-task-manager/lib/session-lifecycle.js +28 -4
- package/template/coding-task-manager/lib/session-model-action-preconditions.js +15 -2
- package/template/coding-task-manager/lib/session-model-intent-contract.js +11 -8
- package/template/coding-task-manager/lib/session-park.js +738 -0
- package/template/coding-task-manager/lib/session-path-grant.js +13 -4
- package/template/coding-task-manager/lib/session-resource-sampler.js +19 -9
- package/template/coding-task-manager/lib/session-standup.js +67 -4
- package/template/coding-task-manager/lib/session-status-ledger.js +147 -6
- package/template/coding-task-manager/lib/session-status-runtime.js +45 -1
- package/template/coding-task-manager/lib/session-title-mirror.js +25 -57
- package/template/coding-task-manager/lib/session-transcript-trash.js +8 -1
- package/template/coding-task-manager/lib/session-transport.js +17 -0
- package/template/coding-task-manager/lib/session-workspace-projection.js +54 -5
- package/template/coding-task-manager/lib/session-workspace-tracking-runtime.js +213 -1
- package/template/coding-task-manager/lib/skill-autocomplete-query.js +120 -3
- package/template/coding-task-manager/lib/skill-autocomplete.js +15 -1
- package/template/coding-task-manager/lib/sqlite-file-set.js +39 -0
- package/template/coding-task-manager/lib/standup-search-adapter.js +16 -2
- package/template/coding-task-manager/lib/startup-pointer-write.js +57 -0
- package/template/coding-task-manager/lib/state-sync/client-ledger.js +12 -0
- package/template/coding-task-manager/lib/state-sync/frame-emitter.js +319 -100
- package/template/coding-task-manager/lib/state-sync/painted-frame-field.js +11 -0
- package/template/coding-task-manager/lib/storage/coding-session-model-store.js +25 -23
- package/template/coding-task-manager/lib/storage/delegate-pref-mirror-store.js +32 -9
- package/template/coding-task-manager/lib/structured-session-boot-sweep.js +235 -0
- package/template/coding-task-manager/lib/submission-ack.js +90 -2
- package/template/coding-task-manager/lib/surviving-owner-bootstrap.js +7 -2
- package/template/coding-task-manager/lib/surviving-owner-recovery.js +2 -1
- package/template/coding-task-manager/lib/systemd-scope.js +115 -0
- package/template/coding-task-manager/lib/telemetry-receiver.js +39 -0
- package/template/coding-task-manager/lib/terminal-attach-geometry.js +985 -0
- package/template/coding-task-manager/lib/terminal-bootstrap.js +30 -0
- package/template/coding-task-manager/lib/terminal-draft-http-status.js +25 -0
- package/template/coding-task-manager/lib/terminal-draft-operation.js +357 -0
- package/template/coding-task-manager/lib/terminal-input-admission.js +17 -1
- package/template/coding-task-manager/lib/terminal-input-prepared.js +563 -0
- package/template/coding-task-manager/lib/transcript-archiver.js +229 -229
- package/template/coding-task-manager/lib/transcript-cache-temps.js +171 -0
- package/template/coding-task-manager/lib/transcript-frame-cache.js +20 -5
- package/template/coding-task-manager/lib/transcript-guard-job.js +55 -4
- package/template/coding-task-manager/lib/transcript-link.js +77 -0
- package/template/coding-task-manager/lib/transcript-manifest-store.js +8 -4
- package/template/coding-task-manager/lib/transcript-source.js +44 -7
- package/template/coding-task-manager/lib/transcript-store.js +49 -0
- package/template/coding-task-manager/lib/tunnel-lane-governor.js +6 -3
- package/template/coding-task-manager/lib/typing-interaction-trace.js +198 -3
- package/template/coding-task-manager/lib/typing-worker-stages.js +60 -0
- package/template/coding-task-manager/lib/usage-ledger/backfill.js +40 -5
- package/template/coding-task-manager/lib/usage-ledger/client.js +4 -1
- package/template/coding-task-manager/lib/usage-ledger/dsh-parse.js +152 -0
- package/template/coding-task-manager/lib/usage-ledger/dsh-read.js +73 -0
- package/template/coding-task-manager/lib/usage-ledger/ingest.js +34 -6
- package/template/coding-task-manager/lib/usage-ledger/live.js +35 -8
- package/template/coding-task-manager/lib/usage-ledger/read.js +29 -20
- package/template/coding-task-manager/lib/usage-ledger/schema.js +61 -1
- package/template/coding-task-manager/lib/usage-ledger/task-coordinator.js +4 -2
- package/template/coding-task-manager/lib/visible-revision-watchdog.js +8 -12
- package/template/coding-task-manager/lib/wake-skip-reasons.js +47 -0
- package/template/coding-task-manager/lib/walle/turn.js +1 -1
- package/template/coding-task-manager/lib/walle-history-serve.js +838 -0
- package/template/coding-task-manager/lib/walle-kill-authority.js +2 -2
- package/template/coding-task-manager/lib/walle-log-rotation.js +164 -1
- package/template/coding-task-manager/lib/walle-mcp-auto-config.js +56 -2
- package/template/coding-task-manager/lib/walle-row-history.js +495 -0
- package/template/coding-task-manager/lib/walle-supervisor.js +130 -27
- package/template/coding-task-manager/lib/watch-worker-client.js +203 -0
- package/template/coding-task-manager/lib/worker-failure-classify.js +13 -1
- package/template/coding-task-manager/lib/worker-terminal-output.js +5 -2
- package/template/coding-task-manager/lib/ws/hub-bridge.js +35 -0
- package/template/coding-task-manager/lib/ws/lifecycle.js +6 -11
- package/template/coding-task-manager/lib/ws/misc.js +1 -1
- package/template/coding-task-manager/lib/ws/state-sync.js +125 -6
- package/template/coding-task-manager/lib/ws/terminal-attach.js +123 -1
- package/template/coding-task-manager/lib/ws-router.js +68 -1
- package/template/coding-task-manager/lib/ws-send-admission.js +22 -4
- package/template/coding-task-manager/oauth-proxy.js +211 -170
- package/template/coding-task-manager/package-lock.json +34 -94
- package/template/coding-task-manager/package.json +7 -3
- package/template/coding-task-manager/protocol/message-table.json +10 -0
- package/template/coding-task-manager/protocol/messages.js +10 -0
- package/template/coding-task-manager/protocol/ws-schema.json +20 -0
- package/template/coding-task-manager/protocol/ws-schema.md +2 -0
- package/template/coding-task-manager/providers/codex-mcp-extract.js +121 -19
- package/template/coding-task-manager/providers/codex-mcp.js +14 -5
- package/template/coding-task-manager/public/css/app.css +449 -1
- package/template/coding-task-manager/public/css/reviews.css +4 -0
- package/template/coding-task-manager/public/css/walle-session.css +4 -0
- package/template/coding-task-manager/public/index.html +766 -465
- package/template/coding-task-manager/public/js/agent-command.js +86 -0
- package/template/coding-task-manager/public/js/app/backups-panel.js +111 -5
- package/template/coding-task-manager/public/js/app/coding-agent-upgrade.js +103 -4
- package/template/coding-task-manager/public/js/app/machines-page.js +2572 -0
- package/template/coding-task-manager/public/js/app/models-tab.js +658 -73
- package/template/coding-task-manager/public/js/app/restart-banner.js +53 -0
- package/template/coding-task-manager/public/js/app/worktrees-panel.js +191 -7
- package/template/coding-task-manager/public/js/background-work.js +203 -28
- package/template/coding-task-manager/public/js/coding-session-model-presentation.js +181 -13
- package/template/coding-task-manager/public/js/core/active-session-groups.js +179 -0
- package/template/coding-task-manager/public/js/core/pending-create.js +238 -0
- package/template/coding-task-manager/public/js/core/recent-machine-source.js +228 -0
- package/template/coding-task-manager/public/js/core/session-commands.js +847 -5
- package/template/coding-task-manager/public/js/core/session-selectors.js +5 -1
- package/template/coding-task-manager/public/js/dashboard-client-function-order.json +8 -0
- package/template/coding-task-manager/public/js/document-review-links.js +9 -1
- package/template/coding-task-manager/public/js/file-resolution-client.js +52 -1
- package/template/coding-task-manager/public/js/history-app-seam.js +48 -4
- package/template/coding-task-manager/public/js/history-painted-rows.js +17 -2
- package/template/coding-task-manager/public/js/history-reader-park.js +13 -1
- package/template/coding-task-manager/public/js/history-scroller.js +187 -9
- package/template/coding-task-manager/public/js/history-transcript-pages.js +5 -5
- package/template/coding-task-manager/public/js/machine-pool-shared.js +991 -0
- package/template/coding-task-manager/public/js/message-renderer.js +4 -3
- package/template/coding-task-manager/public/js/model-picker.js +3 -1
- package/template/coding-task-manager/public/js/native-subagent-review.js +15 -2
- package/template/coding-task-manager/public/js/new-session-agent-grid.js +346 -0
- package/template/coding-task-manager/public/js/pasted-content.js +236 -0
- package/template/coding-task-manager/public/js/pe-private-content-lifetime.js +39 -7
- package/template/coding-task-manager/public/js/private-model-lifetime.js +6 -2
- package/template/coding-task-manager/public/js/private-state-scope.js +31 -3
- package/template/coding-task-manager/public/js/prompt-submission-client.js +173 -8
- package/template/coding-task-manager/public/js/prompt-submission-tray.js +281 -0
- package/template/coding-task-manager/public/js/prompts.js +11 -10
- package/template/coding-task-manager/public/js/protocol.js +10 -0
- package/template/coding-task-manager/public/js/queue-panel-submission-reconcile.js +174 -1
- package/template/coding-task-manager/public/js/restart-banner-policy.js +29 -1
- package/template/coding-task-manager/public/js/reviews.js +7 -3
- package/template/coding-task-manager/public/js/root-draft-lifetime.js +139 -2
- package/template/coding-task-manager/public/js/root-queue-builder-lifetime.js +16 -0
- package/template/coding-task-manager/public/js/row-join.js +4 -2
- package/template/coding-task-manager/public/js/session-model-picker.js +447 -57
- package/template/coding-task-manager/public/js/session-search-utils.js +64 -21
- package/template/coding-task-manager/public/js/session-usage-view.js +2 -1
- package/template/coding-task-manager/public/js/session-workspace-tracking.js +51 -1
- package/template/coding-task-manager/public/js/state-sync-client.js +14 -1
- package/template/coding-task-manager/public/js/stream-view.js +6 -5
- package/template/coding-task-manager/public/js/terminal/conv-only-session.js +287 -0
- package/template/coding-task-manager/public/js/terminal/runtime-02.js +16 -7
- package/template/coding-task-manager/public/js/terminal/runtime-03.js +41 -0
- package/template/coding-task-manager/public/js/terminal/runtime-04.js +41 -4
- package/template/coding-task-manager/public/js/terminal/runtime-09.js +2 -0
- package/template/coding-task-manager/public/js/terminal/runtime-10.js +5 -5
- package/template/coding-task-manager/public/js/terminal/runtime-12.js +60 -3
- package/template/coding-task-manager/public/js/terminal/runtime-16.js +16 -12
- package/template/coding-task-manager/public/js/terminal/runtime-18.js +14 -0
- package/template/coding-task-manager/public/js/terminal/runtime-19.js +8 -4
- package/template/coding-task-manager/public/js/terminal/runtime-20.js +211 -74
- package/template/coding-task-manager/public/js/terminal/runtime-21.js +19 -6
- package/template/coding-task-manager/public/js/terminal/runtime-22.js +86 -0
- package/template/coding-task-manager/public/js/terminal-attachment-draft.js +67 -13
- package/template/coding-task-manager/public/js/terminal-history-viewport.js +1 -1
- package/template/coding-task-manager/public/js/terminal-image-orchestration.js +52 -6
- package/template/coding-task-manager/public/js/terminal-wheel.js +62 -5
- package/template/coding-task-manager/public/js/walle/chat-conversation.js +15 -7
- package/template/coding-task-manager/public/js/walle-session.js +30 -7
- package/template/coding-task-manager/public/js/walle.js +6 -0
- package/template/coding-task-manager/public/js/ws/live-dispatch.js +10 -0
- package/template/coding-task-manager/public/m/app.css +366 -8
- package/template/coding-task-manager/public/m/app.js +1006 -74
- package/template/coding-task-manager/public/m/index.html +55 -1
- package/template/coding-task-manager/public/m/machines.js +2147 -0
- package/template/coding-task-manager/public/m/pool-failover.js +391 -0
- package/template/coding-task-manager/public/m/private-api.js +31 -1
- package/template/coding-task-manager/public/m/private-queue-actions.js +26 -7
- package/template/coding-task-manager/public/m/sw.js +5 -0
- package/template/coding-task-manager/public/usage.html +1 -0
- package/template/coding-task-manager/queue-engine.js +13 -0
- package/template/coding-task-manager/scripts/dev-route-fixture/synthetic-route-upstream.js +104 -0
- package/template/coding-task-manager/scripts/dev-route-fixture.js +339 -0
- package/template/coding-task-manager/scripts/opencode-lead-route-probe.js +195 -0
- package/template/coding-task-manager/scripts/opencode-v2-contract-probe/fake-anthropic.js +168 -0
- package/template/coding-task-manager/scripts/opencode-v2-contract-probe/probe-plugin/server.js +95 -0
- package/template/coding-task-manager/scripts/opencode-v2-contract-probe.js +673 -0
- package/template/coding-task-manager/server/approvals.js +5 -6
- package/template/coding-task-manager/server/boot.js +136 -17
- package/template/coding-task-manager/server.js +2819 -11885
- package/template/coding-task-manager/session-integrity.js +71 -13
- package/template/coding-task-manager/workers/db-owner-worker.js +72 -9
- package/template/coding-task-manager/workers/online-backup-worker.js +1 -0
- package/template/coding-task-manager/workers/read-pool-model-collector.js +51 -3
- package/template/coding-task-manager/workers/read-pool-worker.js +93 -12
- package/template/coding-task-manager/workers/session-host-pool-process.js +24 -10
- package/template/coding-task-manager/workers/session-host-process.js +19 -8
- package/template/coding-task-manager/workers/transcript-archive-worker.js +1 -1
- package/template/coding-task-manager/workers/watch-worker.js +105 -0
- package/template/coding-task-manager/workers/worktree-worker.js +202 -33
- package/template/ctm-relay/lib/protocol.js +14 -1
- package/template/package-lock.json +2 -2
- package/template/package.json +1 -1
- package/template/scripts/conversation-storage-v2-migration.js +78 -11
- package/template/shared/backup-retention.js +82 -0
- package/template/shared/conversation-admission.js +2 -0
- package/template/shared/conversation-provenance.js +3 -7
- package/template/shared/conversation-storage-v2-contract.js +47 -6
- package/template/shared/fixtures/worker-status-payloads.json +392 -0
- package/template/shared/git-remote-key.js +83 -0
- package/template/shared/host-identity.js +98 -2
- package/template/shared/linked-worktree.js +51 -0
- package/template/shared/macos-fda-target.js +57 -0
- package/template/shared/orphan-parents.js +55 -0
- package/template/shared/owner-write-safety.js +135 -0
- package/template/shared/public-runtime.js +13 -5
- package/template/shared/release-schema.json +3 -2
- package/template/shared/report-citations.js +14 -0
- package/template/shared/sqlite-write-lock.js +361 -223
- package/template/shared/storage/contract.js +38 -3
- package/template/wall-e/adapters/imessage.js +12 -0
- package/template/wall-e/agent.js +92 -4
- package/template/wall-e/api-walle.js +26 -1
- package/template/wall-e/bin/brain-purge-legacy-ctm.js +3 -2
- package/template/wall-e/bin/train-gemma-e4b-tooluse.js +2 -2
- package/template/wall-e/bin/walle-mcp-stdio.js +14 -8
- package/template/wall-e/brain/brain-join.js +859 -0
- package/template/wall-e/brain/brain-sync-membership.js +20 -0
- package/template/wall-e/brain/brain-sync-store.js +131 -77
- package/template/wall-e/brain/brain-sync-v2-schema.js +203 -0
- package/template/wall-e/brain/brain-sync-v2.js +578 -0
- package/template/wall-e/brain/delegate-model-prefs-store.js +13 -4
- package/template/wall-e/brain/deterministic-id.js +51 -0
- package/template/wall-e/brain/helper-rules-schema.js +129 -0
- package/template/wall-e/brain/memories.js +2 -2
- package/template/wall-e/brain/migrations.js +91 -28
- package/template/wall-e/brain/model-deployment-facts.js +31 -1
- package/template/wall-e/brain/model-identity-migration.js +1 -1
- package/template/wall-e/brain/owner-call-whitelist.js +39 -7
- package/template/wall-e/brain/schema-ensures.js +22 -0
- package/template/wall-e/brain/schema.js +45 -85
- package/template/wall-e/brain.js +172 -36
- package/template/wall-e/chat.js +3 -3
- package/template/wall-e/coding/agent-shell-env.js +7 -2
- package/template/wall-e/coding/journal-dispatcher.js +51 -0
- package/template/wall-e/coding/prompt-bundle.js +66 -21
- package/template/wall-e/coding/session-journal.js +28 -40
- package/template/wall-e/coding-orchestrator.js +23 -26
- package/template/wall-e/config/main-loop-exemptions.json +2 -2
- package/template/wall-e/http/admin-api.js +37 -0
- package/template/wall-e/http/auth.js +18 -1
- package/template/wall-e/http/blog-views-api.js +318 -0
- package/template/wall-e/http/gws-api.js +4 -0
- package/template/wall-e/http/helper-rules-api.js +327 -0
- package/template/wall-e/http/model-admin.js +8 -1
- package/template/wall-e/http/model-delegate-pref-admin.js +3 -3
- package/template/wall-e/http/model-proxy-providers.js +177 -2
- package/template/wall-e/http/model-route-health.js +157 -0
- package/template/wall-e/http/sync-api.js +278 -464
- package/template/wall-e/http/telemetry-api.js +12 -0
- package/template/wall-e/jobs/job-runner.js +28 -1
- package/template/wall-e/lib/blog-view-policy.js +88 -0
- package/template/wall-e/lib/blog-view-store.js +169 -0
- package/template/wall-e/lib/brain-owner-op-priority.js +9 -1
- package/template/wall-e/lib/client-config-lock.js +2 -1
- package/template/wall-e/lib/coding-journal-writer-child-client.js +67 -18
- package/template/wall-e/lib/ctm-data-dir.js +26 -0
- package/template/wall-e/lib/derivation-home.js +147 -0
- package/template/wall-e/lib/error-kinds.js +10 -1
- package/template/wall-e/lib/feature-manifest.js +1 -1
- package/template/wall-e/lib/helper-rules/cell-state.js +123 -0
- package/template/wall-e/lib/helper-rules/evaluate.js +398 -0
- package/template/wall-e/lib/helper-rules/explore-rubric.md +12 -0
- package/template/wall-e/lib/helper-rules/grade.js +320 -0
- package/template/wall-e/lib/helper-rules/label.js +247 -0
- package/template/wall-e/lib/helper-rules/lead-call-hook.js +555 -0
- package/template/wall-e/lib/helper-rules/store.js +669 -0
- package/template/wall-e/lib/landing-mcp-tools.js +170 -0
- package/template/wall-e/lib/mcp-client-config.js +133 -14
- package/template/wall-e/lib/mcp-gateway-migrate.js +28 -64
- package/template/wall-e/lib/mcp-integration.js +63 -19
- package/template/wall-e/lib/parent-death.js +7 -1
- package/template/wall-e/lib/runtime-worker-pool.js +1 -0
- package/template/wall-e/lib/scheduler-worker-jobs.js +12 -4
- package/template/wall-e/lib/telemetry-db-schema.js +37 -0
- package/template/wall-e/lib/telemetry-process-client.js +76 -1
- package/template/wall-e/llm/default-fallback.js +4 -0
- package/template/wall-e/llm/delegate-lead-prefs.js +16 -1
- package/template/wall-e/llm/delegate-vendor-default.js +12 -5
- package/template/wall-e/llm/model-catalog.js +13 -4
- package/template/wall-e/llm/model-roles.js +7 -1
- package/template/wall-e/llm/native-delegate-selection.js +56 -8
- package/template/wall-e/llm/portkey-http.js +150 -0
- package/template/wall-e/llm/portkey-sync.js +15 -145
- package/template/wall-e/llm/worker-delegate-args.js +72 -7
- package/template/wall-e/llm/worker-mcp-routing.js +117 -7
- package/template/wall-e/llm/worker-route.js +43 -1
- package/template/wall-e/loops/brain-custom-writes.js +64 -0
- package/template/wall-e/loops/ingest.js +17 -1
- package/template/wall-e/loops/think.js +19 -4
- package/template/wall-e/mcp-contract.js +222 -6
- package/template/wall-e/mcp-protocol-contract.js +77 -2
- package/template/wall-e/mcp-server.js +141 -31
- package/template/wall-e/mcp-worker-schemas.js +25 -7
- package/template/wall-e/memory/ctm-context-client.js +110 -5
- package/template/wall-e/memory/ctm-session-context.js +9 -3
- package/template/wall-e/memory/hub-bridge-client.js +388 -0
- package/template/wall-e/memory/replica-origin.js +56 -0
- package/template/wall-e/memory/session-pool.js +135 -0
- package/template/wall-e/runtime/live-capabilities.js +8 -3
- package/template/wall-e/server.js +4 -2
- package/template/wall-e/shared/release-schema.json +3 -2
- package/template/wall-e/shared/sqlite-file-set.js +39 -0
- package/template/wall-e/shared/sqlite-write-lock.js +361 -223
- package/template/wall-e/shared/storage/contract.js +38 -3
- package/template/wall-e/skills/_templates/delegate-worker/VERSION +1 -1
- package/template/wall-e/skills/_templates/delegate-worker/released-sha256.json +13 -1
- package/template/wall-e/skills/_templates/delegate-worker/templates/claude/SKILL.md +11 -6
- package/template/wall-e/skills/_templates/delegate-worker/templates/codex/SKILL.md +13 -8
- package/template/wall-e/skills/_templates/fleet-sync/VERSION +1 -0
- package/template/wall-e/skills/_templates/fleet-sync/released-sha256.json +16 -0
- package/template/wall-e/skills/_templates/fleet-sync/templates/claude/SKILL.md +64 -0
- package/template/wall-e/skills/_templates/fleet-sync/templates/codex/SKILL.md +64 -0
- package/template/wall-e/tools/chrome-automation.js +6 -0
- package/template/wall-e/tools/local-tools.js +6 -4
- package/template/wall-e/training/setup-cuda-train-env.sh +2 -2
- package/template/wall-e/workers/brain-owner-worker.js +27 -4
- package/template/wall-e/workers/coding-journal-writer-child.js +8 -1
- package/template/wall-e/workers/mcp-gateway-process.js +5 -5
- package/template/wall-e/workers/telemetry-worker.js +8 -0
|
@@ -21,6 +21,10 @@ const {
|
|
|
21
21
|
} = require('../state-sync/nack-classification');
|
|
22
22
|
// WP-0c (composer-freeze-stop-and-wait-emitter-2026-09-16, D-3/D-8): report-only, zero-dependency.
|
|
23
23
|
const { maybePersistFrameApplyReceipt } = require('../state-sync/frame-apply-receipt');
|
|
24
|
+
// WP-4 (§9 S-39, docs/deepseek-harness-acp-agent-2026-10-28.html): an ACP session (dsh) has no
|
|
25
|
+
// terminal to restore, so its snapshot is answered with the empty, not-terminal frame below — the
|
|
26
|
+
// Wall-E history redirect must NOT run for it.
|
|
27
|
+
const { isAcpSession } = require('../session-transport');
|
|
24
28
|
|
|
25
29
|
let _deps = null;
|
|
26
30
|
|
|
@@ -67,6 +71,9 @@ function _serializeKey(sessionId, cols, rows, scrollbackRows, rolloutHistory) {
|
|
|
67
71
|
// softMs, hardMs, makeReqId(), buildPost(reqId), refreshCache(entry, resp),
|
|
68
72
|
// scrollbackRows, rolloutHistory }. The last two are KEY inputs (I8) -- every
|
|
69
73
|
// caller must supply them, whether or not it ends up creating the entry.
|
|
74
|
+
// WP-3: the hard timer passes `issuedAt: entry.startedAt` to recordMiss and
|
|
75
|
+
// routes a 'degraded' verdict to a 'host-degraded' diagnostic -- never to
|
|
76
|
+
// _reviveUnresponsiveHost, which only an 'unresponsive' verdict reaches.
|
|
70
77
|
function _attachOrPostSerialize(sessionId, cols, rows, waiter, entryHooks) {
|
|
71
78
|
const key = _serializeKey(sessionId, cols, rows, entryHooks.scrollbackRows, entryHooks.rolloutHistory);
|
|
72
79
|
const existing = _inflightSerialize.get(key);
|
|
@@ -98,9 +105,23 @@ function _attachOrPostSerialize(sessionId, cols, rows, waiter, entryHooks) {
|
|
|
98
105
|
for (const w of entry.waiters) w.onHardTimeout?.(entry);
|
|
99
106
|
// WP-1 (D-1/D-2): the readiness ledger's one deadlined-miss input for a
|
|
100
107
|
// hosted session -- ONE call per coalesced request, never per waiter.
|
|
108
|
+
// WP-3 (session-stops-mid-job-2026-10-24.html, D-11): `issuedAt` is this
|
|
109
|
+
// entry's own creation time, so the ledger can tell "this request family
|
|
110
|
+
// timed out" (readiness) from "the host has said nothing at all" (liveness).
|
|
101
111
|
if (entryHooks.hostId) {
|
|
102
|
-
const verdictResult = entryHooks.hostHealth?.recordMiss?.(entryHooks.hostId, { sessionId, kind: 'hard', deadlineMs: 60000 });
|
|
103
|
-
if (verdictResult) {
|
|
112
|
+
const verdictResult = entryHooks.hostHealth?.recordMiss?.(entryHooks.hostId, { sessionId, kind: 'hard', deadlineMs: 60000, issuedAt: entry.startedAt });
|
|
113
|
+
if (verdictResult?.verdict === 'degraded') {
|
|
114
|
+
// D-11: a host that relayed a frame after this request was issued is
|
|
115
|
+
// talking -- its serialize path is slow/wedged, but it and every agent
|
|
116
|
+
// in it stay alive. Report once per session for this host; NEVER revive.
|
|
117
|
+
_deps?.recordSessionDiagnostic?.(sessionId, 'host-degraded', {
|
|
118
|
+
hostId: entryHooks.hostId,
|
|
119
|
+
reason: 'serialize-timeout',
|
|
120
|
+
lastFrameAgoMs: verdictResult.lastFrameAgoMs,
|
|
121
|
+
});
|
|
122
|
+
} else if (verdictResult?.verdict === 'unresponsive') {
|
|
123
|
+
// D-12: only a host that has sent NO frame of any kind since the first
|
|
124
|
+
// missed request was issued reaches here.
|
|
104
125
|
// Final-review fix C2: this is fire-and-forget from a timer. Without a
|
|
105
126
|
// `.catch`, ANY rejection inside the revive (registry read, crash-cap
|
|
106
127
|
// read, diagnostic write, host shutdown) becomes an unhandled rejection
|
|
@@ -360,11 +381,23 @@ function handleAck(ctx, msg) {
|
|
|
360
381
|
headlessWorker,
|
|
361
382
|
} = _deps;
|
|
362
383
|
if (msg.id) {
|
|
384
|
+
const ackSeq = Number(msg.seq || 0);
|
|
385
|
+
// WP-0 (S-10, docs/state-sync-pipelined-deltas-echo-never-waits-for-ack-2026-10-31.html
|
|
386
|
+
// §5 D-5, §9 S-10): measure the frame's MAIN-side round trip BEFORE noteAckReceived
|
|
387
|
+
// forgets the ledger's sentAt for this seq. -1 means "no evidence" (a seq the ledger
|
|
388
|
+
// never recorded, or one already retired), never a fabricated 0 ms.
|
|
389
|
+
const sentAt = Number(_stateSyncClientLedger.sentAtFor?.({
|
|
390
|
+
clientId: ctx.ws.clientId || '',
|
|
391
|
+
socketGeneration: ctx.ws.socketGeneration || 0,
|
|
392
|
+
sessionId: msg.id,
|
|
393
|
+
seq: ackSeq,
|
|
394
|
+
}) || 0);
|
|
395
|
+
const mainRttMs = sentAt > 0 ? Math.max(0, Date.now() - sentAt) : -1;
|
|
363
396
|
_stateSyncClientLedger.noteAckReceived({
|
|
364
397
|
clientId: ctx.ws.clientId || '',
|
|
365
398
|
socketGeneration: ctx.ws.socketGeneration || 0,
|
|
366
399
|
sessionId: msg.id,
|
|
367
|
-
seq:
|
|
400
|
+
seq: ackSeq,
|
|
368
401
|
gridRevision: Number(msg.gridRevision || 0),
|
|
369
402
|
});
|
|
370
403
|
ctx.ws.lastClientHealthBeatAt = Date.now();
|
|
@@ -383,6 +416,7 @@ function handleAck(ctx, msg) {
|
|
|
383
416
|
headlessWorker.postMessage({
|
|
384
417
|
type: 'ack', sessionId: msg.id, seq: Number(msg.seq || 0),
|
|
385
418
|
clientId: ctx.ws.clientId || '', socketGeneration: Number(ctx.ws.socketGeneration || 0),
|
|
419
|
+
mainRttMs,
|
|
386
420
|
});
|
|
387
421
|
// S-25 (terminal-baseline-single-owner-2026-09-14 WP-4): record the worker-reported
|
|
388
422
|
// ackedSeq for this delivery on the socket itself -- _admitStaleGridServe reads this
|
|
@@ -390,7 +424,7 @@ function handleAck(ctx, msg) {
|
|
|
390
424
|
if (!(ctx.ws._workerAckedSeqBySession instanceof Map)) {
|
|
391
425
|
ctx.ws._workerAckedSeqBySession = new Map();
|
|
392
426
|
}
|
|
393
|
-
ctx.ws._workerAckedSeqBySession.set(msg.id,
|
|
427
|
+
ctx.ws._workerAckedSeqBySession.set(msg.id, ackSeq);
|
|
394
428
|
}
|
|
395
429
|
return;
|
|
396
430
|
|
|
@@ -471,6 +505,42 @@ function handleNack(ctx, msg) {
|
|
|
471
505
|
}
|
|
472
506
|
}
|
|
473
507
|
|
|
508
|
+
// WP-3 (box-idle-sleep-remote-typing-freezes-2026-11-01.html §5 D-7, §6 WP-3, §8 WP-3, §11 A-5):
|
|
509
|
+
// process-lifetime exit counters for the frame-receipt path. Live measurement on 2026-11-01 showed
|
|
510
|
+
// every hub-typed keystroke reading "unpainted" in the box's typing-latency rollup (731/731, last
|
|
511
|
+
// stage ack-received); the browser's `painted` stamp only ever arrives through handleFrameReceipt,
|
|
512
|
+
// so these counts name the stage a receipt dies at (`received` minus the other buckets = still
|
|
513
|
+
// inside the handler). INSTRUMENTATION ONLY: no receipt is admitted, refused, or shaped differently
|
|
514
|
+
// because of them, and nothing here reads or writes the per-peer rate limiter (server.js owns that
|
|
515
|
+
// refusal diagnostic). Read out through `GET /api/diagnostics/receipt-exits`; reset only by
|
|
516
|
+
// resetFrameReceiptExitCountsForTest().
|
|
517
|
+
const _frameReceiptExitCounts = {
|
|
518
|
+
// every call into handleFrameReceipt that carries a msg.id.
|
|
519
|
+
received: 0,
|
|
520
|
+
// the existing stale-generation early return below.
|
|
521
|
+
staleGeneration: 0,
|
|
522
|
+
// receipts whose disposition maps to no trace stage (traceStage === ''), including the
|
|
523
|
+
// not-in-the-`allowed` set early return, which maps to no stage by definition.
|
|
524
|
+
noTraceStage: 0,
|
|
525
|
+
// traceStage set, but msg.interactionIds absent or empty -- no _noteTypingInteraction call issued.
|
|
526
|
+
noInteractionIds: 0,
|
|
527
|
+
// traceStage set and at least one _noteTypingInteraction call issued.
|
|
528
|
+
stamped: 0,
|
|
529
|
+
// subset of `stamped` whose traceStage is 'painted'.
|
|
530
|
+
paintedStamped: 0,
|
|
531
|
+
// subset of `noInteractionIds` whose traceStage is 'painted'.
|
|
532
|
+
paintedNoInteractionIds: 0,
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
// Shallow copy: the live object is module-private, so a caller can never write it by accident.
|
|
536
|
+
function getFrameReceiptExitCounts() {
|
|
537
|
+
return { ..._frameReceiptExitCounts };
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
function resetFrameReceiptExitCountsForTest() {
|
|
541
|
+
for (const key of Object.keys(_frameReceiptExitCounts)) _frameReceiptExitCounts[key] = 0;
|
|
542
|
+
}
|
|
543
|
+
|
|
474
544
|
function handleFrameReceipt(ctx, msg) {
|
|
475
545
|
const {
|
|
476
546
|
recordSessionDiagnostic,
|
|
@@ -481,9 +551,11 @@ function handleFrameReceipt(ctx, msg) {
|
|
|
481
551
|
_observeSessionRuntimePaint,
|
|
482
552
|
} = _deps;
|
|
483
553
|
if (!msg.id) return;
|
|
554
|
+
_frameReceiptExitCounts.received += 1;
|
|
484
555
|
const receiptSocketGeneration = Number(msg.socketGeneration || 0);
|
|
485
556
|
if (receiptSocketGeneration > 0
|
|
486
557
|
&& receiptSocketGeneration !== Number(ctx.ws.socketGeneration || 0)) {
|
|
558
|
+
_frameReceiptExitCounts.staleGeneration += 1;
|
|
487
559
|
recordSessionDiagnostic(msg.id, 'state-sync-stale-frame-receipt', {
|
|
488
560
|
receiptSocketGeneration,
|
|
489
561
|
socketGeneration: Number(ctx.ws.socketGeneration || 0),
|
|
@@ -498,7 +570,13 @@ function handleFrameReceipt(ctx, msg) {
|
|
|
498
570
|
'rejected-grid', 'rejected-desync', 'reseed', 'rejected-local-restore', 'rejected-dims',
|
|
499
571
|
'rejected-transform-error', 'rejected-apply-error', 'apply-timeout',
|
|
500
572
|
]);
|
|
501
|
-
|
|
573
|
+
// WP-3: an unrecognised disposition exits here and produces no trace stage, so it belongs in
|
|
574
|
+
// the same bucket as the dispositions that map to '' below -- this is exactly the "where did
|
|
575
|
+
// the receipt die" reading the counters exist for.
|
|
576
|
+
if (!allowed.has(disposition)) {
|
|
577
|
+
_frameReceiptExitCounts.noTraceStage += 1;
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
502
580
|
const serverReceivedAt = Date.now();
|
|
503
581
|
maybePersistFrameApplyReceipt(msg.id, msg, disposition, recordSessionDiagnostic, serverReceivedAt);
|
|
504
582
|
const reportedClientAt = Number(msg.clientAt || 0);
|
|
@@ -548,7 +626,18 @@ function handleFrameReceipt(ctx, msg) {
|
|
|
548
626
|
? 'painted'
|
|
549
627
|
: '';
|
|
550
628
|
if (traceStage) {
|
|
551
|
-
|
|
629
|
+
// WP-3: the exact ids the loop below will visit, so the counter reads "a call was issued"
|
|
630
|
+
// -- a missing/empty interactionIds (or one whose entries all fall past the 16-id cap)
|
|
631
|
+
// means the receipt reached this stage server-side but named no keystroke to stamp.
|
|
632
|
+
const interactionIds = (Array.isArray(msg.interactionIds) ? msg.interactionIds : []).slice(0, 16);
|
|
633
|
+
if (interactionIds.length > 0) {
|
|
634
|
+
_frameReceiptExitCounts.stamped += 1;
|
|
635
|
+
if (traceStage === 'painted') _frameReceiptExitCounts.paintedStamped += 1;
|
|
636
|
+
} else {
|
|
637
|
+
_frameReceiptExitCounts.noInteractionIds += 1;
|
|
638
|
+
if (traceStage === 'painted') _frameReceiptExitCounts.paintedNoInteractionIds += 1;
|
|
639
|
+
}
|
|
640
|
+
for (const interactionId of interactionIds) {
|
|
552
641
|
_noteTypingInteraction({
|
|
553
642
|
interactionId,
|
|
554
643
|
stage: traceStage,
|
|
@@ -567,6 +656,11 @@ function handleFrameReceipt(ctx, msg) {
|
|
|
567
656
|
activeLoafMs: ledgerEvent.activeLoafMs,
|
|
568
657
|
});
|
|
569
658
|
}
|
|
659
|
+
} else {
|
|
660
|
+
// WP-3: a disposition that reached this point but maps to no stage (buffered,
|
|
661
|
+
// rejected-*, reseed, ...) -- the receipt was admitted and handled, yet can never stamp a
|
|
662
|
+
// typing-interaction stage, so this is the bucket that explains an unpainted rollup.
|
|
663
|
+
_frameReceiptExitCounts.noTraceStage += 1;
|
|
570
664
|
}
|
|
571
665
|
// R-2: the worker's WP-2 emitter takes no 'frame-receipt' input (empty case,
|
|
572
666
|
// lib/headless-term-service.js) -- the post is dead, deleted with the sender.
|
|
@@ -647,6 +741,10 @@ function handleKeyframeReq(ctx, msg) {
|
|
|
647
741
|
// and can mismatch the admission ledger's expectedEpoch.
|
|
648
742
|
contentRecoveryEpoch: ctx.ws.frameProtocol === FRAME_PROTOCOL_V2 ? deliveredSurfaceEpoch : 0,
|
|
649
743
|
reason: String(msg.reason || '').slice(0, 48), // WP-0c: report-only
|
|
744
|
+
// WP-2 (D-6, §9 S-8): forward the client's committed baseline seq ONLY when it is a valid
|
|
745
|
+
// non-negative safe integer, so "absent" (an old client, served exactly as today) stays
|
|
746
|
+
// distinguishable from 0 (a current client that genuinely holds no baseline yet).
|
|
747
|
+
...(Number.isSafeInteger(msg.haveSeq) && msg.haveSeq >= 0 ? { haveSeq: msg.haveSeq } : {}),
|
|
650
748
|
});
|
|
651
749
|
}
|
|
652
750
|
|
|
@@ -703,6 +801,22 @@ function handleSnapshot(ctx, msg) {
|
|
|
703
801
|
sendTerminalSessionUnavailableSnapshot(ctx.ws, msg.id, 'snapshot', msg);
|
|
704
802
|
return;
|
|
705
803
|
}
|
|
804
|
+
if (isAcpSession(_snapSession)) {
|
|
805
|
+
// §9 S-39: a conv-only ACP session has no PTY and no terminal snapshot. Answer with the
|
|
806
|
+
// same empty not-terminal frame the Wall-E redirect uses, but WITHOUT the Wall-E history
|
|
807
|
+
// call (dsh history is CTM's own transcript, delivered by the session stream).
|
|
808
|
+
if (ctx.ws.readyState === 1) {
|
|
809
|
+
_wsSend(ctx.ws, JSON.stringify({
|
|
810
|
+
type: 'snapshot',
|
|
811
|
+
id: msg.id,
|
|
812
|
+
data: null,
|
|
813
|
+
notTerminal: true,
|
|
814
|
+
restoreSource: 'snapshot-acp-no-terminal',
|
|
815
|
+
clientRestoreSeq: msg.clientRestoreSeq,
|
|
816
|
+
}));
|
|
817
|
+
}
|
|
818
|
+
return;
|
|
819
|
+
}
|
|
706
820
|
if (isWalleLikeSession(_snapSession)) {
|
|
707
821
|
recordSessionDiagnostic(msg.id, 'walle-snapshot-history-redirect', {
|
|
708
822
|
source: msg.restoreSource || 'snapshot',
|
|
@@ -970,4 +1084,9 @@ module.exports = {
|
|
|
970
1084
|
// applied/painted receipt directly to prove it resets the client-fault episode counter.
|
|
971
1085
|
handleFrameReceipt,
|
|
972
1086
|
handleAck,
|
|
1087
|
+
// WP-3 (box-idle-sleep-remote-typing-freezes-2026-11-01.html §8 WP-3): process-lifetime
|
|
1088
|
+
// frame-receipt exit counters, read out by GET /api/diagnostics/receipt-exits (no behaviour
|
|
1089
|
+
// change -- pure instrumentation).
|
|
1090
|
+
getFrameReceiptExitCounts,
|
|
1091
|
+
resetFrameReceiptExitCountsForTest,
|
|
973
1092
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const crypto = require('node:crypto');
|
|
4
|
+
|
|
3
5
|
const {
|
|
4
6
|
approvalResolveResultIsTerminal,
|
|
5
7
|
publicApprovalResolveBody,
|
|
@@ -25,6 +27,22 @@ const {
|
|
|
25
27
|
// socket reference rewritten to `ctx.ws` inline.
|
|
26
28
|
|
|
27
29
|
const { registerWsHandlers } = require('../ws-router');
|
|
30
|
+
// WP-2 (docs/remote-machine-hub-sessions-2026-10-22.html §5 D-10, §6.3, §9 S-1): the remote-create
|
|
31
|
+
// seam. Required here (not injected through configure()) so server.js needs no edit for the
|
|
32
|
+
// branch; its production dependencies are resolved LAZILY inside the module, so loading this file
|
|
33
|
+
// still never touches db.js.
|
|
34
|
+
const remoteMachineCreate = require('../remote-machine-create');
|
|
35
|
+
// WP-3 (D-4, S-9): the local create path notes a short in-flight lease so a restart guard
|
|
36
|
+
// (GET /api/instance/update-gate, POST /api/restart/ctm) can see a create that has no session row.
|
|
37
|
+
const { noteCreateIntent } = require('../create-intent-lease');
|
|
38
|
+
// WP-3 (docs/remote-machine-hub-sessions-2026-10-22.html §6.4, S-22): the live-plane relay seam.
|
|
39
|
+
// Loading this file installs lib/remote-machine-link.js's pre-dispatch hook (lib/ws-router.js),
|
|
40
|
+
// which diverts any message naming a MIRROR session to the box and returns false — leaving the
|
|
41
|
+
// local path byte-identical — for every other session. Installed here, at boot, because this file
|
|
42
|
+
// is where the WP-2 remote-create branch already lives; the hook is inert until a mirror session
|
|
43
|
+
// exists, so no server.js edit is needed for it.
|
|
44
|
+
const remoteMachineLink = require('../remote-machine-link');
|
|
45
|
+
remoteMachineLink.installIntercept();
|
|
28
46
|
|
|
29
47
|
let _deps = null;
|
|
30
48
|
|
|
@@ -50,8 +68,13 @@ function configure({
|
|
|
50
68
|
_subscribeTerminalTail,
|
|
51
69
|
_unsubscribeTerminalTail,
|
|
52
70
|
_ensureCodexThreadLinkOffThread,
|
|
71
|
+
remoteCreateDeps,
|
|
72
|
+
// WP-3: the process error sink, for the one REPORT path this module owns (a bundle session-record
|
|
73
|
+
// failure must be visible without ever failing a create).
|
|
74
|
+
errorSink = null,
|
|
53
75
|
} = {}) {
|
|
54
76
|
_deps = {
|
|
77
|
+
errorSink,
|
|
55
78
|
handleCreatePrepared,
|
|
56
79
|
CTM_WAKE_MANIFEST_ENABLED,
|
|
57
80
|
_subscribeStateSyncClient,
|
|
@@ -73,7 +96,13 @@ function configure({
|
|
|
73
96
|
_subscribeTerminalTail,
|
|
74
97
|
_unsubscribeTerminalTail,
|
|
75
98
|
_ensureCodexThreadLinkOffThread,
|
|
99
|
+
remoteCreateDeps: remoteCreateDeps && typeof remoteCreateDeps === 'object' ? remoteCreateDeps : null,
|
|
76
100
|
};
|
|
101
|
+
// WP-0 (docs/relay-per-viewer-delivery-contract-2026-10-27.html §5 D-5, §9 S-3): hand the hub's
|
|
102
|
+
// session-diagnostics reporter to the relay, so a relayed frame a hub viewer did not get is
|
|
103
|
+
// recorded as `relay-frame-undelivered` through the SAME sink every other hub diagnostic uses
|
|
104
|
+
// (server.js already passes `remoteCreateDeps: { recordSessionDiagnostic }` here — no server.js edit).
|
|
105
|
+
remoteMachineLink.setDiagnosticsSink(remoteCreateDeps && typeof remoteCreateDeps.recordSessionDiagnostic === 'function' ? remoteCreateDeps.recordSessionDiagnostic : null);
|
|
77
106
|
}
|
|
78
107
|
|
|
79
108
|
function handleWakeResync(ctx, msg) {
|
|
@@ -206,6 +235,71 @@ function publicCreateInternalControlPresent(msg) {
|
|
|
206
235
|
return false;
|
|
207
236
|
}
|
|
208
237
|
|
|
238
|
+
// ---------------------------------------------------------------------------------------------
|
|
239
|
+
// WP-3 (docs/remote-agent-skills-bundles-2026-10-25.html §5 D-4/D-6, §6.3/§6.5) — the BOX side of
|
|
240
|
+
// "which hub created this session".
|
|
241
|
+
//
|
|
242
|
+
// A create that arrives over a PEER-AUTHENTICATED WebSocket (an authenticated hub forwarding a
|
|
243
|
+
// session) is recorded in the box's bundle store as `sessions/<id>.json` BEFORE the provider process
|
|
244
|
+
// spawns, so WP-4 can resolve the hub's bundle at spawn time (D-7). The identity is the
|
|
245
|
+
// AUTHENTICATED principal (`ctx.ws.auth.peerInstanceId`, the same value lib/api/agent-bundles.js
|
|
246
|
+
// reads as `req.ctmAuth.peerInstanceId`) — never a header, never a body field, which is what makes
|
|
247
|
+
// the record unforgeable by whoever sends the frame.
|
|
248
|
+
// ---------------------------------------------------------------------------------------------
|
|
249
|
+
|
|
250
|
+
/** The authenticated peer id on this connection, or '' — a loopback/browser create has none. */
|
|
251
|
+
function peerInstanceIdOf(ctx) {
|
|
252
|
+
// Read through `ctx.` like every other connection access in lib/ws/*.js (tests/ws-router-parity
|
|
253
|
+
// .test.js forbids a bare connection-closure identifier, and a local here would be one).
|
|
254
|
+
const peerAuth = ctx && ctx.ws && ctx.ws.auth;
|
|
255
|
+
return String((peerAuth && (peerAuth.peerInstanceId || peerAuth.peer_instance_id)) || '').trim();
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Record `sessions/<id>.json` for a hub-forwarded create. Returns the session id it recorded, or
|
|
260
|
+
* null when this create did not come from an authenticated peer.
|
|
261
|
+
*
|
|
262
|
+
* D-6/D-7: a record failure REPORTS and continues — the create is never failed, delayed past its
|
|
263
|
+
* spawn, or otherwise changed by bundle bookkeeping.
|
|
264
|
+
*
|
|
265
|
+
* The id: `lib/session-create/prepared.js` uses `msg.id || crypto.randomUUID()` as the session id on
|
|
266
|
+
* the row it writes, so when the frame carries no id this stamps the SAME randomUUID onto `msg`
|
|
267
|
+
* before the create path runs — the recorded id is then the id the session actually gets, never a
|
|
268
|
+
* second guess. (The hub always forwards the allowlisted `id`; this branch covers a direct peer
|
|
269
|
+
* caller that does not.)
|
|
270
|
+
*
|
|
271
|
+
* @returns {Promise<string|null>}
|
|
272
|
+
*/
|
|
273
|
+
async function recordHubCreatedSession(ctx, msg, deps = {}) {
|
|
274
|
+
const hubPeerId = peerInstanceIdOf(ctx);
|
|
275
|
+
if (!hubPeerId) return null; // a local (browser/loopback) create records nothing
|
|
276
|
+
if (!msg || typeof msg !== 'object') return null;
|
|
277
|
+
if (!msg.id) msg.id = crypto.randomUUID();
|
|
278
|
+
const sessionId = String(msg.id);
|
|
279
|
+
try {
|
|
280
|
+
const store = deps.store || require('../agent-bundle/store');
|
|
281
|
+
const dataDir = deps.dataDir || require('../data-dir').getDataDir();
|
|
282
|
+
// The hub's CURRENT pointer when it has pushed one; `resolveSpawnBundle` re-reads it at spawn
|
|
283
|
+
// anyway, so a null (no push yet) is a fine create-time value.
|
|
284
|
+
const treeHash = await store.currentHubTree(dataDir, hubPeerId);
|
|
285
|
+
await store.recordSessionHub(dataDir, sessionId, hubPeerId, treeHash);
|
|
286
|
+
return sessionId;
|
|
287
|
+
} catch (error) {
|
|
288
|
+
// REPORT: bundle bookkeeping must never fail or change a create — the session spawns without a
|
|
289
|
+
// bundle, which is the same outcome as a hub that had never pushed (D-6/D-7).
|
|
290
|
+
const detail = String((error && error.message) || error || 'agent_bundle_session_record_failed').slice(0, 200);
|
|
291
|
+
if (deps.errorSink && typeof deps.errorSink.report === 'function') {
|
|
292
|
+
deps.errorSink.report('terminal-attach:agent-bundle-session-record', Object.assign(
|
|
293
|
+
new Error(detail),
|
|
294
|
+
{ code: 'agent_bundle_session_record_failed' },
|
|
295
|
+
));
|
|
296
|
+
} else {
|
|
297
|
+
console.warn(`[agent-bundle] session record failed for ${String(sessionId).slice(0, 12)}: ${detail}`);
|
|
298
|
+
}
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
209
303
|
// Registered handler for the public 'create' type. On refusal it returns
|
|
210
304
|
// without forwarding, so no reservation/preparation/spawn happens even on a
|
|
211
305
|
// closed socket; an open socket gets exactly one bounded frame that names
|
|
@@ -225,6 +319,22 @@ async function handleCreate(ctx, msg) {
|
|
|
225
319
|
}
|
|
226
320
|
return;
|
|
227
321
|
}
|
|
322
|
+
// WP-2 (S-1): a create naming a REGISTERED REMOTE machine is forwarded to that box instead of
|
|
323
|
+
// being prepared here. The check is BEFORE the local plan, so nothing local (generation,
|
|
324
|
+
// prepared plan, PTY) is ever created for it; `machine` absent or naming THIS instance's minted
|
|
325
|
+
// id falls through to the unchanged local path (S-2 — the local deny list above is untouched
|
|
326
|
+
// and is never widened for forwarded frames).
|
|
327
|
+
if (remoteMachineCreate.isRemoteMachineTarget(msg, _deps.remoteCreateDeps || {})) {
|
|
328
|
+
return remoteMachineCreate.forwardRemoteCreate(ctx, msg, _deps.remoteCreateDeps || {});
|
|
329
|
+
}
|
|
330
|
+
// WP-3 (D-4, S-9): the create is about to run HERE, so note the intent on THIS machine's lease —
|
|
331
|
+
// a restart in the next two minutes would abort it. Deliberately AFTER the forward branch above:
|
|
332
|
+
// a forwarded create is noted by the box that runs it, never by the hub that passed it on.
|
|
333
|
+
noteCreateIntent('WS create', ctx);
|
|
334
|
+
// WP-3 (§6.3/§6.5): a create that arrived from an AUTHENTICATED PEER is recorded BEFORE the
|
|
335
|
+
// provider process spawns, so WP-4 can resolve this hub's bundle at spawn time. A local create
|
|
336
|
+
// (no peer principal) records nothing, and the record can never fail the create.
|
|
337
|
+
await recordHubCreatedSession(ctx, msg, _deps);
|
|
228
338
|
return _deps.handleCreatePrepared(ctx.ws, msg);
|
|
229
339
|
}
|
|
230
340
|
|
|
@@ -250,4 +360,16 @@ function register() {
|
|
|
250
360
|
});
|
|
251
361
|
}
|
|
252
362
|
|
|
253
|
-
module.exports = {
|
|
363
|
+
module.exports = {
|
|
364
|
+
configure,
|
|
365
|
+
register,
|
|
366
|
+
// WP-3: the box-side record of which hub created a session (and the authenticated-peer read it
|
|
367
|
+
// is keyed on), exported so the store/hub integration tests can drive it directly.
|
|
368
|
+
peerInstanceIdOf,
|
|
369
|
+
recordHubCreatedSession,
|
|
370
|
+
// Exported for the WP-2 enforcement test (tests/create-forward-allowlist.test.js): the LIVE
|
|
371
|
+
// deny list and the LIVE §6.3 allowlist, so the test can never drift from either constant.
|
|
372
|
+
PUBLIC_CREATE_INTERNAL_CONTROLS,
|
|
373
|
+
REMOTE_CREATE_FORWARD_ALLOWLIST: remoteMachineCreate.REMOTE_CREATE_FORWARD_ALLOWLIST,
|
|
374
|
+
filterRemoteCreateForward: remoteMachineCreate.filterRemoteCreateForward,
|
|
375
|
+
};
|
|
@@ -77,6 +77,64 @@ class WsRouter {
|
|
|
77
77
|
|
|
78
78
|
const _router = new WsRouter();
|
|
79
79
|
|
|
80
|
+
// ---------------------------------------------------------------------------------------------
|
|
81
|
+
// Pre-dispatch hooks (WP-3, docs/remote-machine-hub-sessions-2026-10-22.html §6.4)
|
|
82
|
+
//
|
|
83
|
+
// The ONE seam a relay needs. A machine-hub session lives on a REMOTE box, not in this process's
|
|
84
|
+
// `sessions` Map (OQ-4), so every message that NAMES such a session must be diverted before a
|
|
85
|
+
// local handler dereferences it. Rather than touch each lib/ws/*.js group, a module registers a
|
|
86
|
+
// hook here and `dispatchWs` offers it every inbound frame first (in registration order):
|
|
87
|
+
//
|
|
88
|
+
// hook(ctx, msg) -> true the hook handled it; the local dispatch is SKIPPED
|
|
89
|
+
// hook(ctx, msg) -> false not mine; the next hook, then the normal handler, runs
|
|
90
|
+
//
|
|
91
|
+
// Hooks are consulted OUTSIDE `WsRouter.dispatch` on purpose: `dispatch` is the pure registry
|
|
92
|
+
// primitive (unit-tested directly), and a hook is a deployment-level concern of the process's
|
|
93
|
+
// singleton. A hook that throws is REPORTED and treated as "not handled" — one broken relay must
|
|
94
|
+
// never take the whole WS surface down with it.
|
|
95
|
+
// ---------------------------------------------------------------------------------------------
|
|
96
|
+
const _preDispatchHooks = [];
|
|
97
|
+
|
|
98
|
+
function registerWsPreDispatchHook(name, hook) {
|
|
99
|
+
if (!name || typeof name !== 'string') {
|
|
100
|
+
throw new TypeError('registerWsPreDispatchHook: name must be a non-empty string');
|
|
101
|
+
}
|
|
102
|
+
if (typeof hook !== 'function') {
|
|
103
|
+
throw new TypeError(`registerWsPreDispatchHook(${name}): hook must be a function`);
|
|
104
|
+
}
|
|
105
|
+
if (_preDispatchHooks.some((entry) => entry.name === name)) {
|
|
106
|
+
throw new Error(`registerWsPreDispatchHook: duplicate hook name: ${name}`);
|
|
107
|
+
}
|
|
108
|
+
const entry = { name, hook };
|
|
109
|
+
_preDispatchHooks.push(entry);
|
|
110
|
+
return () => {
|
|
111
|
+
const at = _preDispatchHooks.indexOf(entry);
|
|
112
|
+
if (at >= 0) _preDispatchHooks.splice(at, 1);
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// SYNCHRONOUS on purpose: hooks return a plain boolean, so a message no hook claims (every local
|
|
117
|
+
// keystroke) reaches its handler in the same tick it always did — no added microtask.
|
|
118
|
+
function runWsPreDispatchHooks(ctx, msg) {
|
|
119
|
+
for (const entry of _preDispatchHooks) {
|
|
120
|
+
let handled = false;
|
|
121
|
+
try {
|
|
122
|
+
handled = entry.hook(ctx, msg);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
// REPORT, then fall through: the relay is a routing optimization, never a gate — a hook
|
|
125
|
+
// fault must degrade to the pre-WP-3 behaviour (the local handler), not drop the frame.
|
|
126
|
+
console.error(`[ws-router] pre-dispatch hook ${entry.name} failed:`, error?.stack || error);
|
|
127
|
+
handled = false;
|
|
128
|
+
}
|
|
129
|
+
if (handled === true) return true;
|
|
130
|
+
}
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function listWsPreDispatchHooks() {
|
|
135
|
+
return _preDispatchHooks.map((entry) => entry.name);
|
|
136
|
+
}
|
|
137
|
+
|
|
80
138
|
function registerWsHandler(type, handler) {
|
|
81
139
|
_router.registerOne('_default', type, handler);
|
|
82
140
|
}
|
|
@@ -86,6 +144,7 @@ function registerWsHandlers(groupName, handlersByType) {
|
|
|
86
144
|
}
|
|
87
145
|
|
|
88
146
|
async function dispatchWs(ctx, msg) {
|
|
147
|
+
if (runWsPreDispatchHooks(ctx, msg)) return true;
|
|
89
148
|
return _router.dispatch(ctx, msg);
|
|
90
149
|
}
|
|
91
150
|
|
|
@@ -93,4 +152,12 @@ function listRegisteredWsTypes() {
|
|
|
93
152
|
return _router.list();
|
|
94
153
|
}
|
|
95
154
|
|
|
96
|
-
module.exports = {
|
|
155
|
+
module.exports = {
|
|
156
|
+
registerWsHandler,
|
|
157
|
+
registerWsHandlers,
|
|
158
|
+
registerWsPreDispatchHook,
|
|
159
|
+
listWsPreDispatchHooks,
|
|
160
|
+
dispatchWs,
|
|
161
|
+
listRegisteredWsTypes,
|
|
162
|
+
WsRouter,
|
|
163
|
+
};
|
|
@@ -79,15 +79,33 @@ function prepareExactJsonEnvelope(payload, stringify = JSON.stringify) {
|
|
|
79
79
|
return { encoded, bytes: measuredBytes };
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
// T1 (docs/walle-turn-lifecycle-delivery-2026-10-26.html §3): the `walle-transcript-append`
|
|
83
|
+
// channel carries BOTH replaceable stream samples and turn LIFECYCLE control notifications —
|
|
84
|
+
// server.js's _recordWalleTranscriptAppend emits recordType=user/assistant rows and bare
|
|
85
|
+
// partType=turn_terminal parts, and the client (public/js/walle-session.js
|
|
86
|
+
// handleTranscriptAppend) flips generating state or forces a refetch on exactly those.
|
|
87
|
+
// Shedding them as replaceable stream samples is what left a live turn reading
|
|
88
|
+
// isGenerating=false while its interactive user echo still arrived. Classification therefore
|
|
89
|
+
// reads the already-resolved channel plus the payload's decoded recordType/partType, normalized
|
|
90
|
+
// exactly like the client's String(value || '').toLowerCase(); every other append stays stream.
|
|
91
|
+
// `explicitChannel` is the caller's already-resolved channel (wsSend's `options.channel`).
|
|
92
|
+
function classifyWsPayload(payload, explicitClass = '', explicitChannel = '') {
|
|
83
93
|
if (['interactive', 'stream', 'bulk'].includes(explicitClass)) return explicitClass;
|
|
84
|
-
const channel = payloadChannel(payload);
|
|
94
|
+
const channel = payloadChannel(payload, explicitChannel);
|
|
85
95
|
if (process.env.CTM_WS_SOLICITED_REPLY_INTERACTIVE !== '0' && SOLICITED_REPLY_CHANNELS.has(channel)) {
|
|
86
96
|
return 'interactive';
|
|
87
97
|
}
|
|
88
98
|
if (process.env.CTM_WALLE_WS_CLASS_SPLIT !== '0') {
|
|
89
99
|
if (WALLE_TERMINAL_CHANNELS.has(channel) || channel.startsWith('walle-permission')) return 'interactive';
|
|
90
|
-
if (WALLE_STREAM_CHANNELS.has(channel))
|
|
100
|
+
if (WALLE_STREAM_CHANNELS.has(channel)) {
|
|
101
|
+
if (channel === 'walle-transcript-append') {
|
|
102
|
+
const decoded = normalizePayload(payload);
|
|
103
|
+
const recordType = String(decoded?.recordType || '').toLowerCase();
|
|
104
|
+
const partType = String(decoded?.partType || '').toLowerCase();
|
|
105
|
+
if (recordType === 'user' || recordType === 'assistant' || partType === 'turn_terminal') return 'interactive';
|
|
106
|
+
}
|
|
107
|
+
return 'stream';
|
|
108
|
+
}
|
|
91
109
|
}
|
|
92
110
|
if (['frame', 'terminal-tail', 'terminal-dirty', 'session-activity', 'fingerprint'].includes(channel)) return 'stream';
|
|
93
111
|
if (['sessions', 'wake-digest', 'wake-manifest', 'conversation-updated', 'data-changed'].includes(channel)
|
|
@@ -133,7 +151,7 @@ function wsSend(ws, payload, options = {}) {
|
|
|
133
151
|
const state = ws._ctmAdmission || createAdmissionState(options);
|
|
134
152
|
ws._ctmAdmission = state;
|
|
135
153
|
const now = Number(options.now) || Date.now();
|
|
136
|
-
const trafficClass = classifyWsPayload(payload, options.class);
|
|
154
|
+
const trafficClass = classifyWsPayload(payload, options.class, options.channel);
|
|
137
155
|
const channel = payloadChannel(payload, options.channel);
|
|
138
156
|
const decision = options.admissionEnabled === false
|
|
139
157
|
? { result: ws.readyState === 1 ? ADMISSION_RESULTS.SENT : ADMISSION_RESULTS.DROPPED_BACKPRESSURE, reason: 'disabled' }
|