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
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// WP-1 (docs/landing-pipeline-batched-multi-host-2026-10-30.html §5 D-3, §6, §8 WP-1, §9 S-1):
|
|
3
|
+
// the adaptive batch window.
|
|
4
|
+
//
|
|
5
|
+
// The window is how many runnable queued jobs one gate is asked to cover. It is Zuul's rule: +1 on a
|
|
6
|
+
// batch PASS (up to `landing.batch.max`), halve on a batch FAIL (never below 1). A window of 1 is
|
|
7
|
+
// exactly the serial queue that existed before this change, so a repository that never writes the
|
|
8
|
+
// file keeps today's behaviour.
|
|
9
|
+
//
|
|
10
|
+
// State lives at `<landing-dir>/window.json` — the same directory, the same atomic writer and the
|
|
11
|
+
// same `contract` stamp as every other file the queue owns (`state.js`). Nothing here reads git,
|
|
12
|
+
// spawns a process or knows about jobs: it is one integer and one transition.
|
|
13
|
+
|
|
14
|
+
const path = require('path');
|
|
15
|
+
|
|
16
|
+
const state = require('./state');
|
|
17
|
+
|
|
18
|
+
const DEFAULT_SIZE = 1;
|
|
19
|
+
const FILE = 'window.json';
|
|
20
|
+
|
|
21
|
+
function windowFile(root) {
|
|
22
|
+
return path.join(root, FILE);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function normalize(raw) {
|
|
26
|
+
if (!raw || typeof raw !== 'object') return DEFAULT_SIZE;
|
|
27
|
+
// Strictly a number: a `"8"` written by hand is a malformed window, and the safe reading of a
|
|
28
|
+
// malformed window is the serial one.
|
|
29
|
+
if (typeof raw.size !== 'number' || !Number.isInteger(raw.size) || raw.size < 1) return DEFAULT_SIZE;
|
|
30
|
+
return raw.size;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// `{ size }`, defaulting to `{ size: 1 }` when the file is absent, unreadable or malformed — an
|
|
34
|
+
// unknown window is the conservative one (today's serial behaviour), never a silent batch of eight.
|
|
35
|
+
function readWindow(root) {
|
|
36
|
+
return { size: normalize(state.readJsonSafe(windowFile(root))) };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// D-3: the transition, read-modify-write inside the queue's mutex (the runner is the only writer, but
|
|
40
|
+
// the file lives beside every other piece of shared state and gets the same protection). `max` is the
|
|
41
|
+
// ceiling (`landing.batch.max`, ≥ 1): a PASS never grows past it and a FAIL never shrinks below 1.
|
|
42
|
+
function bumpWindow(root, verdict, max) {
|
|
43
|
+
const ceiling = Number.isInteger(max) && max >= 1 ? max : DEFAULT_SIZE;
|
|
44
|
+
return state.withMutex(root, () => {
|
|
45
|
+
const before = readWindow(root).size;
|
|
46
|
+
const size = verdict === 'PASS' ? Math.min(before + 1, ceiling) : Math.max(Math.floor(before / 2), 1);
|
|
47
|
+
state.writeJsonAtomic(windowFile(root), { contract: state.CONTRACT, size });
|
|
48
|
+
return { size, before };
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
module.exports = {
|
|
53
|
+
DEFAULT_SIZE,
|
|
54
|
+
windowFile,
|
|
55
|
+
readWindow,
|
|
56
|
+
bumpWindow,
|
|
57
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// WP-0 of docs/launch-environment-host-carried-adoption-2026-10-26.html (§5 D-1, §6).
|
|
4
|
+
//
|
|
5
|
+
// ONE rule-versioned capture function for the per-session launch environment. The record it produces is a
|
|
6
|
+
// self-describing OBSERVATION -- { rule, state, values, reason } -- never a verdict about the session: it
|
|
7
|
+
// carries the rule that produced it (LAUNCH_ENV_RULE) so a later reader can convert a record written under
|
|
8
|
+
// an older rule (see lib/adopted-launch-environment.js, WP-2) instead of guessing. `rule` is an ordinal,
|
|
9
|
+
// not a content hash; the hash of the rule's inputs lives in tests/launch-environment.test.js
|
|
10
|
+
// (launchEnvironmentRuleDigest) so changing a projected key, a bound or the credential regex without
|
|
11
|
+
// bumping LAUNCH_ENV_RULE fails loudly.
|
|
12
|
+
//
|
|
13
|
+
// Dependency-free on purpose: node:crypto (rule digest) and node:buffer (byte bounds). No fs, no config.
|
|
14
|
+
|
|
15
|
+
const crypto = require('node:crypto');
|
|
16
|
+
const { Buffer } = require('node:buffer');
|
|
17
|
+
|
|
18
|
+
// Rule 2 = "the projected launch-context keys HOME/CODEX_HOME/TMPDIR are not private" (the rule since
|
|
19
|
+
// 4768eeced3); rule 1 = the pre-2026-10-25 reading.
|
|
20
|
+
const LAUNCH_ENV_RULE = 2;
|
|
21
|
+
|
|
22
|
+
// The keys a lead-model switch re-projects into the launch context (lib/lead-model-restore-reconciliation.js
|
|
23
|
+
// projectDeferredRestoreLaunch: HOME / CODEX_HOME from the launch context, TMPDIR alongside them). They are
|
|
24
|
+
// PROJECTED launch context, not per-session private overrides: a spawn still receives them, but their presence
|
|
25
|
+
// must never turn an otherwise empty override set into a private environment that only a surviving owner can
|
|
26
|
+
// reproduce. Anything else in the env is private and is captured by value.
|
|
27
|
+
const PROJECTED_LAUNCH_CONTEXT_KEYS = Object.freeze(['HOME', 'CODEX_HOME', 'TMPDIR']);
|
|
28
|
+
|
|
29
|
+
// Bounds of a capturable private environment (moved here from lib/lead-model-restore-reconciliation.js).
|
|
30
|
+
const MAX_SOURCE_ENV_ENTRIES = 64;
|
|
31
|
+
const MAX_SOURCE_ENV_BYTES = 32 * 1024;
|
|
32
|
+
const MAX_SOURCE_ENV_VALUE_BYTES = 8 * 1024;
|
|
33
|
+
|
|
34
|
+
// A key whose value is credential-shaped must never be written to a handoff manifest file.
|
|
35
|
+
const CREDENTIAL_KEY_RE = /(?:API_KEY|AUTH_TOKEN|_TOKEN|SECRET|PASSWORD|CREDENTIAL)/i;
|
|
36
|
+
|
|
37
|
+
const LAUNCH_ENV_STATES = Object.freeze(['captured', 'captured-empty', 'unavailable']);
|
|
38
|
+
const LAUNCH_ENV_REASONS = Object.freeze(['not_object', 'too_many_entries', 'bad_key', 'bad_value',
|
|
39
|
+
'too_many_bytes', 'credential_keys', 'legacy_worker_private_env', 'legacy_no_receipt']);
|
|
40
|
+
|
|
41
|
+
const ENV_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;
|
|
42
|
+
|
|
43
|
+
/** Returns a NEW object holding only the non-projected entries of `env`; never mutates its input and maps a
|
|
44
|
+
* non-object to `{}`. */
|
|
45
|
+
function privateOverridesFromEnv(env) {
|
|
46
|
+
if (!env || typeof env !== 'object' || Array.isArray(env)) return {};
|
|
47
|
+
const out = {};
|
|
48
|
+
for (const [key, value] of Object.entries(env)) {
|
|
49
|
+
if (!PROJECTED_LAUNCH_CONTEXT_KEYS.includes(key)) out[key] = value;
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function unavailable(reason) {
|
|
55
|
+
return Object.freeze({ rule: LAUNCH_ENV_RULE, state: 'unavailable', values: null, reason });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Captures a raw per-session private environment. Frozen result; never throws. */
|
|
59
|
+
function captureLaunchEnvironment(privateEnv) {
|
|
60
|
+
if (!privateEnv || typeof privateEnv !== 'object' || Array.isArray(privateEnv)) return unavailable('not_object');
|
|
61
|
+
const entries = Object.entries(privateEnv);
|
|
62
|
+
if (entries.length > MAX_SOURCE_ENV_ENTRIES) return unavailable('too_many_entries');
|
|
63
|
+
const values = {};
|
|
64
|
+
let bytes = 0;
|
|
65
|
+
for (const [key, value] of entries) {
|
|
66
|
+
if (!ENV_KEY_RE.test(key)) return unavailable('bad_key');
|
|
67
|
+
if (typeof value !== 'string' || value.includes('\0')
|
|
68
|
+
|| Buffer.byteLength(value, 'utf8') > MAX_SOURCE_ENV_VALUE_BYTES) return unavailable('bad_value');
|
|
69
|
+
bytes += Buffer.byteLength(key, 'utf8') + Buffer.byteLength(value, 'utf8');
|
|
70
|
+
if (bytes > MAX_SOURCE_ENV_BYTES) return unavailable('too_many_bytes');
|
|
71
|
+
values[key] = value;
|
|
72
|
+
}
|
|
73
|
+
const state = entries.length ? 'captured' : 'captured-empty';
|
|
74
|
+
return Object.freeze({ rule: LAUNCH_ENV_RULE, state, values: Object.freeze(values), reason: null });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// A record is a NEW frozen object rebuilt from validated fields: a tampered record (extra fields, a
|
|
78
|
+
// non-frozen values object, values that no longer satisfy the bounds) never reaches a caller as itself.
|
|
79
|
+
function normalizeLaunchEnvironment(value) {
|
|
80
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
|
|
81
|
+
if (value.rule !== LAUNCH_ENV_RULE || !LAUNCH_ENV_STATES.includes(value.state)) return null;
|
|
82
|
+
if (value.state === 'unavailable') {
|
|
83
|
+
if (typeof value.reason !== 'string' || !LAUNCH_ENV_REASONS.includes(value.reason)) return null;
|
|
84
|
+
if (value.values !== null) return null;
|
|
85
|
+
return Object.freeze({ rule: LAUNCH_ENV_RULE, state: 'unavailable', values: null, reason: value.reason });
|
|
86
|
+
}
|
|
87
|
+
if (value.reason !== null) return null;
|
|
88
|
+
const recaptured = captureLaunchEnvironment(value.values);
|
|
89
|
+
if (recaptured.state !== value.state) return null;
|
|
90
|
+
return Object.freeze({ rule: LAUNCH_ENV_RULE, state: value.state, values: recaptured.values, reason: null });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Validator in the `modelStorageRootsMetadata` style: `{}` or `{ launchEnvironment: frozenRecord }` so a
|
|
94
|
+
* caller spreads it. Only rule-2 records whose declared state agrees with a re-capture are accepted. With
|
|
95
|
+
* `{ manifest: true }` a record whose values hold a CREDENTIAL_KEY_RE key is REWRITTEN to
|
|
96
|
+
* `{ rule, state:'unavailable', values:null, reason:'credential_keys' }` (so no secret reaches the 0600
|
|
97
|
+
* manifest file); the other record keeps its values. */
|
|
98
|
+
function launchEnvironmentMetadata(value, { manifest = false } = {}) {
|
|
99
|
+
const record = normalizeLaunchEnvironment(value);
|
|
100
|
+
if (!record) return {};
|
|
101
|
+
if (manifest && record.values && Object.keys(record.values).some((key) => CREDENTIAL_KEY_RE.test(key))) {
|
|
102
|
+
return { launchEnvironment: Object.freeze({ rule: LAUNCH_ENV_RULE, state: 'unavailable', values: null,
|
|
103
|
+
reason: 'credential_keys' }) };
|
|
104
|
+
}
|
|
105
|
+
return { launchEnvironment: record };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** sha256 over the rule's inputs: projected keys, bounds and the credential regex. Pinned in
|
|
109
|
+
* tests/launch-environment.test.js -- bump LAUNCH_ENV_RULE and add a converter case when it changes. */
|
|
110
|
+
function launchEnvironmentRuleDigest() {
|
|
111
|
+
return crypto.createHash('sha256').update(JSON.stringify({
|
|
112
|
+
rule: LAUNCH_ENV_RULE,
|
|
113
|
+
projected: PROJECTED_LAUNCH_CONTEXT_KEYS,
|
|
114
|
+
limits: [MAX_SOURCE_ENV_ENTRIES, MAX_SOURCE_ENV_BYTES, MAX_SOURCE_ENV_VALUE_BYTES],
|
|
115
|
+
credentialRe: CREDENTIAL_KEY_RE.source,
|
|
116
|
+
})).digest('hex');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
module.exports = { LAUNCH_ENV_RULE, PROJECTED_LAUNCH_CONTEXT_KEYS, LAUNCH_ENV_STATES, LAUNCH_ENV_REASONS,
|
|
120
|
+
privateOverridesFromEnv, captureLaunchEnvironment, launchEnvironmentMetadata, launchEnvironmentRuleDigest,
|
|
121
|
+
MAX_SOURCE_ENV_ENTRIES, MAX_SOURCE_ENV_BYTES, MAX_SOURCE_ENV_VALUE_BYTES, CREDENTIAL_KEY_RE };
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
//
|
|
20
20
|
// Pure: never mutates `args`, never reads the DB or the environment.
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const {
|
|
23
|
+
CLAUDE_OPTION_SIGNATURES, CLAUDE_SHORT_OPTIONS, locateClaudeSettingsArg,
|
|
24
|
+
} = require('./native-lead-settings-argv');
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
26
|
+
// The ONE model-id rule lives in a leaf module (the session host loads it); re-exported here.
|
|
27
|
+
const { isValidOverrideModel } = require('./model-id-rule');
|
|
28
28
|
|
|
29
29
|
// Drops an existing `--model X` / `--model=X` / `-m X` / `-m=X` so the override is the only model flag.
|
|
30
30
|
function stripModelFlags(args) {
|
|
@@ -38,12 +38,30 @@ function stripModelFlags(args) {
|
|
|
38
38
|
return out;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
// OpenCode's OWN launcher form (docs/opencode-lead-and-delegate-model-selection-2026-10-28.html §6.3,
|
|
42
|
+
// R-8): the TUI's global flags come first and `--model` is spelled the long way only. Kept separate
|
|
43
|
+
// from `stripModelFlags` above so the Claude/Codex argv grammar (where `-m` is the Codex global and
|
|
44
|
+
// the model flag is appended/anchored) is never changed by an OpenCode-only rule.
|
|
45
|
+
function stripOpencodeModelFlags(args) {
|
|
46
|
+
const out = [];
|
|
47
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
48
|
+
const arg = String(args[i]);
|
|
49
|
+
if (arg === '--model' || arg === '-m') { i += 1; continue; }
|
|
50
|
+
if (arg.startsWith('--model=') || arg.startsWith('-m=')) continue;
|
|
51
|
+
out.push(args[i]);
|
|
52
|
+
}
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
|
|
41
56
|
/**
|
|
42
|
-
* @param {{ agentType: string, args: string[], model: unknown }} input
|
|
57
|
+
* @param {{ agentType: string, args: string[], model: unknown, line?: 'v1'|'v2'|null }} input
|
|
58
|
+
* `line` is the OpenCode binary's shape (lib/opencode-cli.js). It matters ONLY for
|
|
59
|
+
* `agentType === 'opencode'`; every other agent ignores it, and `null`/absent keeps the 1.x
|
|
60
|
+
* behaviour byte-identical.
|
|
43
61
|
* @returns {{ args: string[], applied: boolean, reason: string }}
|
|
44
62
|
* applied=false returns the input args untouched (same array) with the reason why.
|
|
45
63
|
*/
|
|
46
|
-
function applyLaunchModelOverride({ agentType, args, model } = {}) {
|
|
64
|
+
function applyLaunchModelOverride({ agentType, args, model, line } = {}) {
|
|
47
65
|
const list = Array.isArray(args) ? args : [];
|
|
48
66
|
if (model == null || model === '') return { args: list, applied: false, reason: 'none' };
|
|
49
67
|
if (!isValidOverrideModel(model)) return { args: list, applied: false, reason: 'invalid_model' };
|
|
@@ -64,6 +82,18 @@ function applyLaunchModelOverride({ agentType, args, model } = {}) {
|
|
|
64
82
|
const head = stripModelFlags(list.slice(0, resumeIdx));
|
|
65
83
|
return { args: [...head, '-m', model, ...list.slice(resumeIdx)], applied: true, reason: '' };
|
|
66
84
|
}
|
|
85
|
+
if (agentType === 'opencode') {
|
|
86
|
+
// 2.x (R-4, WP-4): the TUI rejects `--model`, so the target never touches this argv. Strip every
|
|
87
|
+
// prior model flag so a stale one cannot survive either; the model rides the inline config +
|
|
88
|
+
// plugin `switch_model` the spawn path writes (lib/session-create/subagent-pick.js
|
|
89
|
+
// opencodeV2PluginEnv). `applied:true` records that the switch IS carried, just not here.
|
|
90
|
+
if (line === 'v2') return { args: stripOpencodeModelFlags(list), applied: true, reason: 'opencode-v2-plugin-carrier' };
|
|
91
|
+
// 1.x: OpenCode takes its global flags first; strip every prior model flag (`--model X`,
|
|
92
|
+
// `--model=X`, `-m X`, `-m=X`). This rides a FRESH relaunch only (a resumed 1.x conversation
|
|
93
|
+
// keeps the model its last user message recorded -- §5 R-4), so the launcher never has to
|
|
94
|
+
// reconcile a resume.
|
|
95
|
+
return { args: ['--model', model, ...stripOpencodeModelFlags(list)], applied: true, reason: '' };
|
|
96
|
+
}
|
|
67
97
|
return { args: list, applied: false, reason: 'unsupported_agent' };
|
|
68
98
|
}
|
|
69
99
|
|
|
@@ -204,6 +234,160 @@ function ensureCodexResumeTarget(argv, providerThreadId) {
|
|
|
204
234
|
return { ok: true, args };
|
|
205
235
|
}
|
|
206
236
|
|
|
237
|
+
// --- Claude native same-thread resume normalization (D-2) ----------------------------------------
|
|
238
|
+
// docs/claude-routed-native-history-resume-2026-10-24.html §5 D-2, §6. A Claude lead whose model or
|
|
239
|
+
// route changes continues the SAME native thread: the canonical source owner's provider thread is
|
|
240
|
+
// the authority, never a stale startup/parent selector in the recorded argv. This normalizer turns
|
|
241
|
+
// every conversation selector the installed CLI accepts (`--resume`/`-r`, `--continue`/`-c`,
|
|
242
|
+
// `--session-id`, `--from-pr`) into exactly one explicit `--resume <canonical>` placed FIRST, drops a
|
|
243
|
+
// fork (which would mint a different identity), and removes the original positional startup prompt so
|
|
244
|
+
// it cannot execute a second time. Every other option keeps its token and its operand boundary.
|
|
245
|
+
//
|
|
246
|
+
// Pure: no fs, no clock, never mutates `argv`, never reads a file, never changes model/auth.
|
|
247
|
+
const CLAUDE_THREAD_ID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
248
|
+
const CLAUDE_LONG_ARITY = new Map(CLAUDE_OPTION_SIGNATURES);
|
|
249
|
+
// Every option token that SELECTS which conversation the CLI opens, including the ones that would
|
|
250
|
+
// start a DIFFERENT one. Each is replaced by the canonical owner's own explicit resume: an old
|
|
251
|
+
// `--session-id` would START that id again (colliding with the recorded transcript), `--continue`/`-c`
|
|
252
|
+
// would not even name a thread, and `--from-pr` names a conversation that is not this one at all.
|
|
253
|
+
const CLAUDE_CONVERSATION_SELECTORS = new Set(['--resume', '--session-id', '--continue', '--from-pr']);
|
|
254
|
+
const CLAUDE_CONVERSATION_SELECTOR_SHORTS = new Set(['r', 'c']);
|
|
255
|
+
// A recorded thread is continued IN PLACE: a fork would mint a new session identity, which is not what
|
|
256
|
+
// this operation does, so it is dropped. `--replay-user-messages` is deliberately NOT here -- it only
|
|
257
|
+
// changes how output is streamed and names no conversation identity, so it is preserved untouched.
|
|
258
|
+
const CLAUDE_FORK_MODIFIERS = new Set(['--fork-session']);
|
|
259
|
+
|
|
260
|
+
// Commander's own option-likeness rule: a lone `-` is an OPERAND, `--` is the terminator.
|
|
261
|
+
function _isClaudeOptionLike(token) {
|
|
262
|
+
return typeof token === 'string' && token.length > 1 && token[0] === '-';
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// One pass over an installed-CLI Claude argv, modelling Commander's operand consumption exactly
|
|
266
|
+
// (`combineFlagAndOptionalValue` = true, so a short option's attached remainder is its value; a
|
|
267
|
+
// required operand is consumed unconditionally; an optional one only when the next token is not
|
|
268
|
+
// option-like; a variadic one takes its first operand plus every following non-option token). An
|
|
269
|
+
// operand that merely SPELLS `--resume`/`--session-id` is therefore never read as a selector.
|
|
270
|
+
//
|
|
271
|
+
// Selector tokens are dropped and every OTHER token is returned untouched, in its original order, with
|
|
272
|
+
// its own operand. A mixed short cluster keeps its non-selector members (rebuilt, with any attached
|
|
273
|
+
// value) instead of losing flags: `-pc` becomes `-p`, `-cd value` becomes `-d value`, `-dp` is left
|
|
274
|
+
// alone (`d` takes `p` as its value, so there is no selector in it at all).
|
|
275
|
+
function _claudeResumeKeptTokens(args) {
|
|
276
|
+
const kept = [];
|
|
277
|
+
let index = 0;
|
|
278
|
+
while (index < args.length) {
|
|
279
|
+
const token = String(args[index]);
|
|
280
|
+
// A real terminator: every remaining token is positional, i.e. this launch's own prompt.
|
|
281
|
+
if (token === '--') break;
|
|
282
|
+
if (token.startsWith('--') && token.length > 2) {
|
|
283
|
+
const equalsAt = token.indexOf('=');
|
|
284
|
+
const name = equalsAt === -1 ? token : token.slice(0, equalsAt);
|
|
285
|
+
const inlineValue = equalsAt === -1 ? null : token.slice(equalsAt + 1);
|
|
286
|
+
const arity = CLAUDE_LONG_ARITY.get(name);
|
|
287
|
+
if (!arity) return { ok: false };
|
|
288
|
+
if (arity === 'boolean') {
|
|
289
|
+
if (inlineValue !== null) return { ok: false };
|
|
290
|
+
if (!CLAUDE_CONVERSATION_SELECTORS.has(name) && !CLAUDE_FORK_MODIFIERS.has(name)) kept.push(args[index]);
|
|
291
|
+
index += 1;
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
let end = index + 1;
|
|
295
|
+
if (inlineValue === null) {
|
|
296
|
+
if (arity === 'required') {
|
|
297
|
+
if (index + 1 >= args.length) return { ok: false };
|
|
298
|
+
end = index + 2;
|
|
299
|
+
} else if (arity === 'optional') {
|
|
300
|
+
if (args[index + 1] !== undefined && !_isClaudeOptionLike(args[index + 1])) end = index + 2;
|
|
301
|
+
} else { // variadic
|
|
302
|
+
if (index + 1 >= args.length) return { ok: false };
|
|
303
|
+
end = index + 2;
|
|
304
|
+
while (end < args.length && args[end] !== '--' && !_isClaudeOptionLike(args[end])) end += 1;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (!CLAUDE_CONVERSATION_SELECTORS.has(name)) for (let i = index; i < end; i += 1) kept.push(args[i]);
|
|
308
|
+
index = end;
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
if (token.startsWith('-') && token.length > 1) {
|
|
312
|
+
const cluster = token.slice(1);
|
|
313
|
+
let position = 0;
|
|
314
|
+
let consumed = 1;
|
|
315
|
+
let rebuilt = '';
|
|
316
|
+
let selector = false;
|
|
317
|
+
let keepsOperand = false;
|
|
318
|
+
while (position < cluster.length) {
|
|
319
|
+
const character = cluster[position];
|
|
320
|
+
const spec = CLAUDE_SHORT_OPTIONS[character];
|
|
321
|
+
if (!spec) return { ok: false };
|
|
322
|
+
const isSelector = CLAUDE_CONVERSATION_SELECTOR_SHORTS.has(character);
|
|
323
|
+
const arity = spec[1];
|
|
324
|
+
if (arity === 'boolean') {
|
|
325
|
+
if (isSelector) selector = true; else rebuilt += character;
|
|
326
|
+
position += 1;
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
// `optional`/`required`: the whole attached remainder is this option's value, so the cluster
|
|
330
|
+
// has no further members.
|
|
331
|
+
const attached = cluster.slice(position + 1);
|
|
332
|
+
if (attached) {
|
|
333
|
+
if (isSelector) selector = true; else rebuilt += character + attached;
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
if (arity === 'required') {
|
|
337
|
+
if (index + 1 >= args.length) return { ok: false };
|
|
338
|
+
consumed = 2;
|
|
339
|
+
} else {
|
|
340
|
+
consumed = args[index + 1] !== undefined && !_isClaudeOptionLike(args[index + 1]) ? 2 : 1;
|
|
341
|
+
}
|
|
342
|
+
if (isSelector) selector = true; else { rebuilt += character; keepsOperand = consumed === 2; }
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
if (selector) {
|
|
346
|
+
// The non-selector members survive; a non-selector member that consumed the next token keeps
|
|
347
|
+
// that operand too.
|
|
348
|
+
if (rebuilt) kept.push(`-${rebuilt}`);
|
|
349
|
+
if (keepsOperand) kept.push(args[index + 1]);
|
|
350
|
+
index += consumed;
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
for (let i = index; i < index + consumed; i += 1) kept.push(args[i]);
|
|
354
|
+
index += consumed;
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
index += 1; // a positional token is this launch's own startup prompt: it is never replayed
|
|
358
|
+
}
|
|
359
|
+
return { ok: true, kept };
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Normalize an installed-CLI Claude argv to resume exactly the canonical source thread.
|
|
364
|
+
*
|
|
365
|
+
* @param {string[]} argv the recorded startup/restore arguments (never mutated)
|
|
366
|
+
* @param {string} providerThreadId the canonical source owner's provider thread (a UUID)
|
|
367
|
+
* @returns {{ok:true,args:string[]}|{ok:false,reason:string}}
|
|
368
|
+
* `claude_resume_target_invalid` — no canonical UUID was supplied;
|
|
369
|
+
* `claude_resume_argv_unsupported` — malformed/ambiguous argv, an unknown option, a subcommand, or
|
|
370
|
+
* the two installed parsers disagreeing about an operand span.
|
|
371
|
+
*/
|
|
372
|
+
function ensureClaudeResumeTarget(argv, providerThreadId) {
|
|
373
|
+
const args = Array.isArray(argv) ? argv : null;
|
|
374
|
+
const threadId = String(providerThreadId == null ? '' : providerThreadId).trim();
|
|
375
|
+
if (!args || !CLAUDE_THREAD_ID_RE.test(threadId)) return { ok: false, reason: 'claude_resume_target_invalid' };
|
|
376
|
+
for (const token of args) if (typeof token !== 'string') return { ok: false, reason: 'claude_resume_argv_unsupported' };
|
|
377
|
+
// The EXISTING settings/source adapter is the agreed-parse guard: a subcommand launch, an unknown
|
|
378
|
+
// option, or the two installed parsers disagreeing about a `--settings`/`--setting-sources` span
|
|
379
|
+
// is refused here instead of being reinterpreted as a conversation selector.
|
|
380
|
+
try { locateClaudeSettingsArg(args); }
|
|
381
|
+
catch { return { ok: false, reason: 'claude_resume_argv_unsupported' }; }
|
|
382
|
+
const scanned = _claudeResumeKeptTokens(args);
|
|
383
|
+
if (!scanned.ok) return { ok: false, reason: 'claude_resume_argv_unsupported' };
|
|
384
|
+
// The canonical resume goes FIRST, ahead of every preserved option token. That is what makes the
|
|
385
|
+
// result readable by the EXISTING `indexOf('--resume')` extractor even when another option's own
|
|
386
|
+
// operand spells `--resume`/`--session-id` (e.g. `--append-system-prompt --resume`): the first
|
|
387
|
+
// `--resume` in the produced argv is always this launch's canonical thread.
|
|
388
|
+
return { ok: true, args: ['--resume', threadId, ...scanned.kept] };
|
|
389
|
+
}
|
|
390
|
+
|
|
207
391
|
// --- Lead-model pin replay (claude-resume-managed-model-pin-2026-10-16.html §6 D-4/D-7) -----------
|
|
208
392
|
// A managed policy (`model=opusplan`) makes a plain `claude --resume` restart an Opus session on
|
|
209
393
|
// Sonnet, so the model the user explicitly chose is stored per session (WP-0 storage, WP-1 native
|
|
@@ -324,4 +508,5 @@ function applyLaunchEffortOverride(argv, agent, effort) {
|
|
|
324
508
|
}
|
|
325
509
|
|
|
326
510
|
module.exports = { applyLaunchModelOverride, isValidOverrideModel, applyLaunchEffortOverride, isValidEffort,
|
|
327
|
-
applyLaunchModelPin, stripModelFlags, insertBeforeCodexResume, rebindCodexForkLaunchPlan,
|
|
511
|
+
applyLaunchModelPin, stripModelFlags, stripOpencodeModelFlags, insertBeforeCodexResume, rebindCodexForkLaunchPlan,
|
|
512
|
+
ensureCodexResumeTarget, ensureClaudeResumeTarget };
|
|
@@ -1172,7 +1172,8 @@ function createLaunchPlanCoordinator(options = {}) {
|
|
|
1172
1172
|
// (or clearing it themselves) is an implicit "always recompute".
|
|
1173
1173
|
// An explicit replacement bypasses the cache: the caller is saying the previous plan is no
|
|
1174
1174
|
// longer valid, so replaying it would defeat the retry it asked for.
|
|
1175
|
-
const warmKey = !replacement && warmPlanCacheEnabled && spec?.warmPlanInputs ? buildWarmPlanKey(spec.warmPlanInputs
|
|
1175
|
+
const warmKey = !replacement && warmPlanCacheEnabled && spec?.warmPlanInputs ? buildWarmPlanKey({ ...spec.warmPlanInputs,
|
|
1176
|
+
requestedLaunch: JSON.stringify([String(spec.cmd || ''), Array.isArray(spec.args) ? spec.args.map(String) : [], String(spec.modelId || '')]) }) : '';
|
|
1176
1177
|
if (warmKey) {
|
|
1177
1178
|
const cachedPlan = warmPlanCache.get(sessionId, warmKey);
|
|
1178
1179
|
if (cachedPlan && states.get(sessionId)?.generation === generation
|
|
@@ -32,6 +32,11 @@ function buildWarmPlanKey({
|
|
|
32
32
|
// full-MCP argv and silently ignore the setting. Defaults to '' so a caller that never
|
|
33
33
|
// sets a profile keeps a stable key.
|
|
34
34
|
mcpProfile = '',
|
|
35
|
+
// The REQUESTED launch (cmd, argv, model) the plan is built from. A plan is a function of the
|
|
36
|
+
// argv it was handed, so a restore asking for `--session <id>` must never be served the plan of
|
|
37
|
+
// the earlier fresh launch: an OpenCode tab has no CTM transcript, so the other inputs never move
|
|
38
|
+
// after its first prompt (opencode-v2-model-switch-standalone-plugin-2026-10-30.html revision 2).
|
|
39
|
+
requestedLaunch = '',
|
|
35
40
|
} = {}) {
|
|
36
41
|
return [
|
|
37
42
|
Number(transcriptMtimeMs) || 0,
|
|
@@ -40,6 +45,7 @@ function buildWarmPlanKey({
|
|
|
40
45
|
Number(codexConfigMtimeMs) || 0,
|
|
41
46
|
String(cliVersionStamp || ''),
|
|
42
47
|
String(mcpProfile || ''),
|
|
48
|
+
String(requestedLaunch || ''),
|
|
43
49
|
].join('\u241F');
|
|
44
50
|
}
|
|
45
51
|
|
|
@@ -16,10 +16,11 @@ const {
|
|
|
16
16
|
} = require('./lifecycle-wake-experiment');
|
|
17
17
|
const projectConfig = require('./project-config');
|
|
18
18
|
const { resolveResumeCwdFallback } = require('./resume-cwd');
|
|
19
|
-
const { validateResumeTarget, withTrashLocation } = require('./resume-preflight');
|
|
19
|
+
const { validateResumeTarget, withTrashLocation, findClaudeResumeTranscript, transcriptHasConversation } = require('./resume-preflight');
|
|
20
20
|
const { findTrashedTranscript } = require('./session-transcript-trash');
|
|
21
21
|
const sessionHistory = require('./session-history');
|
|
22
22
|
const { extractResumeTarget, getCodexThreadResumeCwdInfo, locateCodexRollout } = sessionHistory;
|
|
23
|
+
const { ensureClaudeResumeTarget } = require('./launch-model-override');
|
|
23
24
|
const walleMcpAutoConfig = require('./walle-mcp-auto-config');
|
|
24
25
|
const { ensureWalleMcpForAgentSession } = walleMcpAutoConfig;
|
|
25
26
|
const {
|
|
@@ -228,7 +229,15 @@ async function prepareLaunchPlan(spec = {}, progressPort = parentPort) {
|
|
|
228
229
|
cwd = fallback.cwd || cwd;
|
|
229
230
|
|
|
230
231
|
let agentType = agentTypeForCommand(cmd);
|
|
231
|
-
|
|
232
|
+
// WP-0 D-2: for the PRIVATE Claude model-target operation below, the recorded source argv must reach
|
|
233
|
+
// the native-history classification UNTOUCHED. resolveResumeAlias is a naive
|
|
234
|
+
// `indexOf('--resume')` + metadata rewrite, and an argument that merely SPELLS `--resume` while being
|
|
235
|
+
// another option's operand (e.g. `--append-system-prompt --resume`) would be rewritten before the
|
|
236
|
+
// canonical normalizer ever sees it. Ordinary create/restore callers and Codex keep today's order.
|
|
237
|
+
const defersClaudeResumeAlias = agentType === 'claude' && spec.claudeResumeThreadId !== undefined;
|
|
238
|
+
let resumeResolution = defersClaudeResumeAlias
|
|
239
|
+
? { args, resume: extractResumeTarget(agentType, args) }
|
|
240
|
+
: resolveResumeAlias(agentType, args, metadata);
|
|
232
241
|
args = resumeResolution.args;
|
|
233
242
|
let resume = resumeResolution.resume;
|
|
234
243
|
|
|
@@ -283,6 +292,54 @@ async function prepareLaunchPlan(spec = {}, progressPort = parentPort) {
|
|
|
283
292
|
const cliResolution = resolvePublishedCliCommand(cmd, spec, env);
|
|
284
293
|
cmd = cliResolution.cmd;
|
|
285
294
|
agentType = agentTypeForCommand(cmd);
|
|
295
|
+
// WP-0 D-2 (same-harness, early): the project config above may have just rewritten this launch to a
|
|
296
|
+
// DIFFERENT harness, and the Codex-specific MCP/profile rewrites and prepareCodexLaunch() run long
|
|
297
|
+
// before a plan is returned. The private Claude model-target field names a Claude thread, so a launch
|
|
298
|
+
// that resolved to another harness is refused HERE -- before any of that preparation -- instead of
|
|
299
|
+
// executing Codex preparation and only then refusing the produced plan.
|
|
300
|
+
// Ordinary callers never set the private field, and Codex callers never set it either, so their
|
|
301
|
+
// behavior is unchanged. The planner's post-plan same-harness guard remains as the outer defence.
|
|
302
|
+
if (spec.claudeResumeThreadId !== undefined && agentType !== 'claude') {
|
|
303
|
+
const error = new TypeError('spec.claudeResumeThreadId names a Claude thread but the launch resolved to another harness');
|
|
304
|
+
error.code = 'launch_claude_target_harness_changed';
|
|
305
|
+
throw error;
|
|
306
|
+
}
|
|
307
|
+
// WP-0 (docs/claude-routed-native-history-resume-2026-10-24.html §5 D-2, §6): a Claude
|
|
308
|
+
// MODEL-TARGET preparation names the canonical source thread through the PRIVATE spec field
|
|
309
|
+
// `claudeResumeThreadId`, which only the lead-transition target planner sets after its canonical
|
|
310
|
+
// source proof. Claude keeps its own native transcript, so the launch must RESUME that exact
|
|
311
|
+
// thread instead of starting the recorded `--session-id` again (which would collide with the
|
|
312
|
+
// conversation already on disk). The classification below is the EXISTING native preflight --
|
|
313
|
+
// findClaudeResumeTranscript + transcriptHasConversation -- never a second reader, and nothing is
|
|
314
|
+
// written, moved, deleted or materialized here.
|
|
315
|
+
//
|
|
316
|
+
// A source with no recorded conversation is left EXACTLY as it is (today's fresh-launch
|
|
317
|
+
// behavior): forcing `--resume` onto a metadata-only stub is what the CLI answers with
|
|
318
|
+
// "No conversation found". The field is private to this worker spec, so an ordinary
|
|
319
|
+
// create/restore caller -- which never sets it -- cannot reach this block at all.
|
|
320
|
+
if (agentType === 'claude' && spec.claudeResumeThreadId !== undefined) {
|
|
321
|
+
const canonicalThreadId = String(spec.claudeResumeThreadId || '').trim();
|
|
322
|
+
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(canonicalThreadId)) {
|
|
323
|
+
const error = new TypeError('spec.claudeResumeThreadId must be the canonical Claude thread id');
|
|
324
|
+
error.code = 'launch_claude_resume_target_invalid';
|
|
325
|
+
throw error;
|
|
326
|
+
}
|
|
327
|
+
const canonicalTranscript = findClaudeResumeTranscript({
|
|
328
|
+
resumeId: canonicalThreadId,
|
|
329
|
+
jsonlPath: metadata.resumeAgent?.jsonl_path || metadata.resolved?.jsonl_path || '',
|
|
330
|
+
homeDir,
|
|
331
|
+
claudeConfigDir: env.CLAUDE_CONFIG_DIR || spec.claudeConfigDir,
|
|
332
|
+
});
|
|
333
|
+
if (canonicalTranscript && transcriptHasConversation(canonicalTranscript.path)) {
|
|
334
|
+
const normalized = ensureClaudeResumeTarget(args, canonicalThreadId);
|
|
335
|
+
if (!normalized.ok) {
|
|
336
|
+
const error = new TypeError(`the recorded Claude launch arguments cannot name the canonical thread: ${normalized.reason}`);
|
|
337
|
+
error.code = normalized.reason;
|
|
338
|
+
throw error;
|
|
339
|
+
}
|
|
340
|
+
args = normalized.args;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
286
343
|
resumeResolution = resolveResumeAlias(agentType, args, metadata);
|
|
287
344
|
args = resumeResolution.args;
|
|
288
345
|
resume = resumeResolution.resume;
|
|
@@ -53,10 +53,40 @@ function provenTurnOutcome(turn) {
|
|
|
53
53
|
return outcome && SETTLED_OUTCOMES.has(outcome) ? outcome : null;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
// WP-1: the owner fields every Claude observation derives from its result (`withCapturedRouteOwner`
|
|
57
|
+
// then overrides them from the item's captured owner when it has one).
|
|
58
|
+
function claudeObservedOwner(result) {
|
|
59
|
+
return {
|
|
60
|
+
...(Number.isSafeInteger(result.processGeneration) ? { processGeneration: result.processGeneration } : {}),
|
|
61
|
+
...(typeof result.providerSessionId === 'string' ? { providerThreadId: result.providerSessionId } : {}),
|
|
62
|
+
...(typeof result.profileFingerprint === 'string' ? { profileFingerprint: result.profileFingerprint } : {}),
|
|
63
|
+
...(typeof result.routeId === 'string' ? { routeId: result.routeId } : {}),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/*
|
|
68
|
+
* WP-1/D-1: a REFUSED Claude turn, as the switch consumes it. `model` is EMPTY on purpose -- the
|
|
69
|
+
* refusal names no model, which is exactly why the switch's `no_model` guard used to swallow it. The
|
|
70
|
+
* failure is only open while it is NEWER than the newest successful turn; a good turn after it wins.
|
|
71
|
+
*/
|
|
72
|
+
function claudeFailureObservation(failure, observedOwner) {
|
|
73
|
+
const atMs = Number(failure.atMs) || 0;
|
|
74
|
+
const status = Number.isSafeInteger(failure.status) ? failure.status : null;
|
|
75
|
+
return {
|
|
76
|
+
model: '', outcome: 'failed', apiErrorStatus: status, error: `API Error ${status == null ? 'unknown' : status}`,
|
|
77
|
+
source: 'transcript:turn', observedAtMs: atMs,
|
|
78
|
+
...(failure.turnId ? { turnId: String(failure.turnId) } : {}),
|
|
79
|
+
...observedOwner,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
56
83
|
function turnObservationFrom(item, result) {
|
|
57
84
|
if (!result) return null;
|
|
58
85
|
if (item?.agentType === 'claude') {
|
|
59
86
|
const truth = result.modelTruth;
|
|
87
|
+
if (truth && truth.lastTurnFailure && Number(truth.lastTurnFailure.atMs) > Number(truth.lastTurnAtMs || 0)) {
|
|
88
|
+
return withCapturedRouteOwner(claudeFailureObservation(truth.lastTurnFailure, claudeObservedOwner(result)), item);
|
|
89
|
+
}
|
|
60
90
|
if (truth && truth.lastTurn && Number(truth.lastTurnAtMs) > 0) {
|
|
61
91
|
return withCapturedRouteOwner({
|
|
62
92
|
model: String(truth.lastTurn), effort: truth.effort || null, source: 'transcript:turn', observedAtMs: Number(truth.lastTurnAtMs),
|
|
@@ -116,8 +146,20 @@ function nativeTurnObservation(item, result) {
|
|
|
116
146
|
const source = item?.agentType === 'claude' ? 'transcript:turn' : item?.agentType === 'codex' ? 'codex:turn-context' : null;
|
|
117
147
|
if (!source || !Array.isArray(result.observations)) return null;
|
|
118
148
|
let best = null;
|
|
149
|
+
// WP-1/D-1: a refused turn arrives as its OWN observation kind; it is not a turn, so it never
|
|
150
|
+
// competes for `best` -- it only wins by being newer than the newest completed turn.
|
|
151
|
+
let bestFailure = null;
|
|
119
152
|
for (const o of result.observations) {
|
|
120
|
-
if (!o || o.
|
|
153
|
+
if (!o || o.source !== source) continue;
|
|
154
|
+
if (o.kind === 'failed-turn') {
|
|
155
|
+
const at = Number(o.observedAtMs);
|
|
156
|
+
if (!Number.isFinite(at) || at < 0) continue;
|
|
157
|
+
if (!bestFailure || at > bestFailure.at) bestFailure = { at, status: o.apiErrorStatus, turnId: o.sourceRevision || null,
|
|
158
|
+
processGeneration: o.processGeneration, providerThreadId: o.providerSessionId || null,
|
|
159
|
+
profileFingerprint: o.profileFingerprint || null, routeId: o.routeId || null };
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (o.kind !== 'completed-turn') continue;
|
|
121
163
|
if (typeof o.value !== 'string' || !o.value.length) continue;
|
|
122
164
|
const at = Number(o.observedAtMs);
|
|
123
165
|
if (!Number.isFinite(at) || at < 0) continue;
|
|
@@ -128,6 +170,20 @@ function nativeTurnObservation(item, result) {
|
|
|
128
170
|
profileFingerprint: o.profileFingerprint || null, routeId: o.routeId || null,
|
|
129
171
|
};
|
|
130
172
|
}
|
|
173
|
+
// A refusal newer than the newest successful turn is the answer; equal timestamps keep the
|
|
174
|
+
// completed turn, matching the decoder's own (timestamp, index) preference.
|
|
175
|
+
if (bestFailure && (!best || bestFailure.at > best.observedAtMs)) {
|
|
176
|
+
return withCapturedRouteOwner({
|
|
177
|
+
model: '', outcome: 'failed', apiErrorStatus: Number.isSafeInteger(bestFailure.status) ? bestFailure.status : null,
|
|
178
|
+
error: `API Error ${Number.isSafeInteger(bestFailure.status) ? bestFailure.status : 'unknown'}`,
|
|
179
|
+
source, observedAtMs: bestFailure.at,
|
|
180
|
+
...(bestFailure.turnId ? { turnId: String(bestFailure.turnId) } : {}),
|
|
181
|
+
...(Number.isSafeInteger(bestFailure.processGeneration) ? { processGeneration: bestFailure.processGeneration } : {}),
|
|
182
|
+
...(bestFailure.providerThreadId ? { providerThreadId: String(bestFailure.providerThreadId) } : {}),
|
|
183
|
+
...(bestFailure.profileFingerprint ? { profileFingerprint: String(bestFailure.profileFingerprint) } : {}),
|
|
184
|
+
...(bestFailure.routeId ? { routeId: String(bestFailure.routeId) } : {}),
|
|
185
|
+
}, item);
|
|
186
|
+
}
|
|
131
187
|
if (!best) return null;
|
|
132
188
|
const obs = { model: String(best.model), effort: best.effort, source: best.source, observedAtMs: best.observedAtMs };
|
|
133
189
|
if (best.turnId) obs.turnId = String(best.turnId);
|