@ponythewhite/base-context 1.0.0 → 1.0.1
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/CHANGELOG.md +33 -0
- package/NOTICE +0 -5
- package/README.md +44 -27
- package/dist/NOTICE +0 -5
- package/dist/base-context-runtime/pyproject.toml +1 -1
- package/dist/base-context-runtime/src/rlm/__init__.py +7 -5
- package/dist/base-context-runtime/test/test_subagent_registry.py +28 -1
- package/dist/base-context-runtime/uv.lock +1 -1
- package/dist/build-info.json +1 -1
- package/dist/bundle/amazon-bedrock.js +21 -0
- package/dist/bundle/{anthropic-YY4S534V.js → anthropic-UV5GZDGU.js} +5 -5
- package/dist/bundle/{azure-openai-responses-JRP6MIM3.js → azure-openai-responses-WSNPXLYC.js} +6 -6
- package/dist/bundle/{bundled-modules-P5HARVZA.js → bundled-modules-TXUMJ2XQ.js} +71 -16
- package/dist/bundle/chunk-27QCJ2AZ.js +2578 -0
- package/dist/bundle/{chunk-MZHTNNVA.js → chunk-4GXPNXOJ.js} +8 -0
- package/dist/bundle/{chunk-SC5KG5R4.js → chunk-DGNX7HQ3.js} +1 -7
- package/dist/bundle/{chunk-A53O363M.js → chunk-GRJFXLBM.js} +0 -1
- package/dist/bundle/chunk-HKINIBP4.js +29 -0
- package/dist/bundle/{chunk-UDSW6FNG.js → chunk-KTNETTHI.js} +1 -1
- package/dist/bundle/{chunk-BYVP7LWV.js → chunk-S3INFPZZ.js} +1861 -4662
- package/dist/bundle/{chunk-73DCPU3D.js → chunk-V3L54UD6.js} +1019 -3427
- package/dist/bundle/{chunk-U7AUVG3B.js → chunk-VSIYFWYI.js} +24 -6
- package/dist/bundle/{chunk-IW77OXFS.js → chunk-W46VZFI6.js} +0 -2099
- package/dist/bundle/{cli-main-O4X7GFGY.js → cli-main-BYMSRPH6.js} +8 -6
- package/dist/bundle/cli.js +2 -2
- package/dist/bundle/{google-AUTVGDGZ.js → google-T32FMD4G.js} +6 -6
- package/dist/bundle/{google-vertex-Q75D7RKS.js → google-vertex-56KP6I3B.js} +3 -3
- package/dist/bundle/{main-XKOW2BV6.js → main-ODOYCEQC.js} +7 -5
- package/dist/bundle/{mistral-7ESB7QUD.js → mistral-WGBMYIVU.js} +5 -5
- package/dist/bundle/{openai-codex-responses-LV3QRPN4.js → openai-codex-responses-PIV2RQ3G.js} +6 -6
- package/dist/bundle/{openai-completions-OJECLPXJ.js → openai-completions-64C3JPR4.js} +11 -22
- package/dist/bundle/{openai-responses-FN6HZMBC.js → openai-responses-UI7RSTDV.js} +6 -6
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +108 -59
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/daemon-ps.d.ts +4 -3
- package/dist/cli/daemon-ps.d.ts.map +1 -1
- package/dist/cli/daemon-ps.js +6 -1
- package/dist/cli/daemon-ps.js.map +1 -1
- package/dist/cli/product-doctor.d.ts +0 -1
- package/dist/cli/product-doctor.d.ts.map +1 -1
- package/dist/cli/product-doctor.js +6 -3
- package/dist/cli/product-doctor.js.map +1 -1
- package/dist/config.d.ts +0 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +0 -8
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-config.d.ts +1 -2
- package/dist/core/agent-session-config.d.ts.map +1 -1
- package/dist/core/agent-session-config.js +0 -3
- package/dist/core/agent-session-config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +5 -4
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +5 -3
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +2 -27
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +10 -6
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +107 -107
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +8 -35
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +33 -243
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/cron-jobs.d.ts.map +1 -1
- package/dist/core/cron-jobs.js +7 -1
- package/dist/core/cron-jobs.js.map +1 -1
- package/dist/core/inference-coordinator.d.ts +6 -1
- package/dist/core/inference-coordinator.d.ts.map +1 -1
- package/dist/core/inference-coordinator.js +18 -2
- package/dist/core/inference-coordinator.js.map +1 -1
- package/dist/core/kernel/bootstrap.d.ts.map +1 -1
- package/dist/core/kernel/bootstrap.js +2 -2
- package/dist/core/kernel/bootstrap.js.map +1 -1
- package/dist/core/kernel/repl-manager.d.ts +2 -0
- package/dist/core/kernel/repl-manager.d.ts.map +1 -1
- package/dist/core/kernel/repl-manager.js +44 -1
- package/dist/core/kernel/repl-manager.js.map +1 -1
- package/dist/core/logging.d.ts +4 -3
- package/dist/core/logging.d.ts.map +1 -1
- package/dist/core/logging.js +6 -6
- package/dist/core/logging.js.map +1 -1
- package/dist/core/mcp/mcp-manager.d.ts.map +1 -1
- package/dist/core/mcp/mcp-manager.js +3 -3
- package/dist/core/mcp/mcp-manager.js.map +1 -1
- package/dist/core/model-registry.d.ts +1 -16
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +88 -196
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +2 -19
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +36 -266
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/provider-contracts.d.ts +5 -6
- package/dist/core/provider-contracts.d.ts.map +1 -1
- package/dist/core/provider-contracts.js +25 -36
- package/dist/core/provider-contracts.js.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/provider-display-names.js +0 -2
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/rlm-max-subagents.d.ts +32 -0
- package/dist/core/rlm-max-subagents.d.ts.map +1 -0
- package/dist/core/rlm-max-subagents.js +50 -0
- package/dist/core/rlm-max-subagents.js.map +1 -0
- package/dist/core/rlm-runtime.d.ts +3 -3
- package/dist/core/rlm-runtime.d.ts.map +1 -1
- package/dist/core/rlm-runtime.js.map +1 -1
- package/dist/core/sdk.d.ts +4 -3
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +27 -14
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +3 -16
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +12 -44
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +6 -6
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/installer.mjs +2 -3
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +39 -34
- package/dist/main.js.map +1 -1
- package/dist/modes/acp/acp-mode.d.ts.map +1 -1
- package/dist/modes/acp/acp-mode.js +1 -1
- package/dist/modes/acp/acp-mode.js.map +1 -1
- package/dist/modes/agent-connection/daemon-agent-connection.d.ts +6 -2
- package/dist/modes/agent-connection/daemon-agent-connection.d.ts.map +1 -1
- package/dist/modes/agent-connection/daemon-agent-connection.js +13 -2
- package/dist/modes/agent-connection/daemon-agent-connection.js.map +1 -1
- package/dist/modes/agent-connection/in-process-agent-connection.d.ts +2 -0
- package/dist/modes/agent-connection/in-process-agent-connection.d.ts.map +1 -1
- package/dist/modes/agent-connection/in-process-agent-connection.js +6 -0
- package/dist/modes/agent-connection/in-process-agent-connection.js.map +1 -1
- package/dist/modes/agent-connection/types.d.ts +3 -0
- package/dist/modes/agent-connection/types.d.ts.map +1 -1
- package/dist/modes/agent-connection/types.js.map +1 -1
- package/dist/modes/agents-view/agents-view-mode.d.ts.map +1 -1
- package/dist/modes/agents-view/agents-view-mode.js +2 -19
- package/dist/modes/agents-view/agents-view-mode.js.map +1 -1
- package/dist/modes/daemon/daemon-mode.d.ts +5 -0
- package/dist/modes/daemon/daemon-mode.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-mode.js +107 -12
- package/dist/modes/daemon/daemon-mode.js.map +1 -1
- package/dist/modes/daemon/daemon-protocol.d.ts +194 -165
- package/dist/modes/daemon/daemon-protocol.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-protocol.js +16 -11
- package/dist/modes/daemon/daemon-protocol.js.map +1 -1
- package/dist/modes/daemon/daemon-rlm-capacity-coordinator.d.ts +19 -0
- package/dist/modes/daemon/daemon-rlm-capacity-coordinator.d.ts.map +1 -0
- package/dist/modes/daemon/daemon-rlm-capacity-coordinator.js +74 -0
- package/dist/modes/daemon/daemon-rlm-capacity-coordinator.js.map +1 -0
- package/dist/modes/daemon/daemon-rlm-capacity.d.ts +19 -0
- package/dist/modes/daemon/daemon-rlm-capacity.d.ts.map +1 -0
- package/dist/modes/daemon/daemon-rlm-capacity.js +85 -0
- package/dist/modes/daemon/daemon-rlm-capacity.js.map +1 -0
- package/dist/modes/daemon/daemon-session-summarizer.d.ts +2 -3
- package/dist/modes/daemon/daemon-session-summarizer.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-session-summarizer.js +32 -23
- package/dist/modes/daemon/daemon-session-summarizer.js.map +1 -1
- package/dist/modes/daemon/daemon-state-root.d.ts +15 -0
- package/dist/modes/daemon/daemon-state-root.d.ts.map +1 -0
- package/dist/modes/daemon/daemon-state-root.js +40 -0
- package/dist/modes/daemon/daemon-state-root.js.map +1 -0
- package/dist/modes/daemon/daemon-supervisor-ownership.d.ts +2 -0
- package/dist/modes/daemon/daemon-supervisor-ownership.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-supervisor-ownership.js +27 -0
- package/dist/modes/daemon/daemon-supervisor-ownership.js.map +1 -1
- package/dist/modes/daemon/daemon-supervisor.d.ts +10 -1
- package/dist/modes/daemon/daemon-supervisor.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-supervisor.js +213 -20
- package/dist/modes/daemon/daemon-supervisor.js.map +1 -1
- package/dist/modes/daemon/daemon-worker-protocol.d.ts +28 -1
- package/dist/modes/daemon/daemon-worker-protocol.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-worker-protocol.js +16 -2
- package/dist/modes/daemon/daemon-worker-protocol.js.map +1 -1
- package/dist/modes/daemon/saved-session-catalog.d.ts.map +1 -1
- package/dist/modes/daemon/saved-session-catalog.js +2 -0
- package/dist/modes/daemon/saved-session-catalog.js.map +1 -1
- package/dist/modes/interactive/auth-flows.d.ts +0 -6
- package/dist/modes/interactive/auth-flows.d.ts.map +1 -1
- package/dist/modes/interactive/auth-flows.js +6 -126
- package/dist/modes/interactive/auth-flows.js.map +1 -1
- package/dist/modes/interactive/components/configuration-menu.d.ts +3 -0
- package/dist/modes/interactive/components/configuration-menu.d.ts.map +1 -1
- package/dist/modes/interactive/components/configuration-menu.js +13 -2
- package/dist/modes/interactive/components/configuration-menu.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +2 -2
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +0 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +0 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +0 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +3 -40
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +2 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +13 -2
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +2 -11
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/feature-hints.d.ts.map +1 -1
- package/dist/modes/interactive/feature-hints.js +0 -4
- package/dist/modes/interactive/feature-hints.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +3 -12
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +81 -507
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/onboarding.d.ts +0 -3
- package/dist/modes/interactive/onboarding.d.ts.map +1 -1
- package/dist/modes/interactive/onboarding.js +0 -17
- package/dist/modes/interactive/onboarding.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +2 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +24 -11
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/node/amazon-bedrock.d.ts +2 -0
- package/dist/node/amazon-bedrock.d.ts.map +1 -0
- package/dist/node/amazon-bedrock.js +6 -0
- package/dist/node/amazon-bedrock.js.map +1 -0
- package/dist/product-identity.d.ts +0 -1
- package/dist/product-identity.d.ts.map +1 -1
- package/dist/product-identity.js +0 -1
- package/dist/product-identity.js.map +1 -1
- package/docs/development.md +1 -1
- package/docs/fork-philosophy.md +4 -8
- package/docs/installation.md +83 -62
- package/docs/providers.md +23 -25
- package/docs/quickstart.md +19 -10
- package/docs/rlm-runtime.md +13 -5
- package/docs/rpc.md +4 -4
- package/docs/sdk.md +20 -11
- package/docs/sessions.md +0 -1
- package/docs/settings.md +9 -42
- package/docs/skills.md +0 -1
- package/docs/upstream-0.9.5.md +171 -0
- package/docs/usage.md +14 -10
- package/package.json +4 -4
- package/dist/core/agent-traces.d.ts +0 -149
- package/dist/core/agent-traces.d.ts.map +0 -1
- package/dist/core/agent-traces.js +0 -904
- package/dist/core/agent-traces.js.map +0 -1
- package/dist/core/prime-inference-auth.d.ts +0 -70
- package/dist/core/prime-inference-auth.d.ts.map +0 -1
- package/dist/core/prime-inference-auth.js +0 -352
- package/dist/core/prime-inference-auth.js.map +0 -1
- package/dist/core/prime-inference-model-selection.d.ts +0 -16
- package/dist/core/prime-inference-model-selection.d.ts.map +0 -1
- package/dist/core/prime-inference-model-selection.js +0 -16
- package/dist/core/prime-inference-model-selection.js.map +0 -1
- package/dist/core/prime-inference-models.d.ts +0 -6
- package/dist/core/prime-inference-models.d.ts.map +0 -1
- package/dist/core/prime-inference-models.js +0 -62
- package/dist/core/prime-inference-models.js.map +0 -1
- package/dist/core/telemetry.d.ts +0 -95
- package/dist/core/telemetry.d.ts.map +0 -1
- package/dist/core/telemetry.js +0 -637
- package/dist/core/telemetry.js.map +0 -1
- package/dist/modes/interactive/components/prime-onboarding-splash.d.ts +0 -39
- package/dist/modes/interactive/components/prime-onboarding-splash.d.ts.map +0 -1
- package/dist/modes/interactive/components/prime-onboarding-splash.js +0 -286
- package/dist/modes/interactive/components/prime-onboarding-splash.js.map +0 -1
- package/dist/modes/interactive/components/prime-team-selector.d.ts +0 -30
- package/dist/modes/interactive/components/prime-team-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/prime-team-selector.js +0 -166
- package/dist/modes/interactive/components/prime-team-selector.js.map +0 -1
- package/dist/skills/prime-intellect/SKILL.md +0 -87
- package/dist/skills/prime-intellect/references/compute.md +0 -45
- package/dist/skills/prime-intellect/references/environments.md +0 -73
- package/dist/skills/prime-intellect/references/inference.md +0 -47
- package/dist/skills/prime-intellect/references/sandboxes.md +0 -75
- package/skills/prime-intellect/SKILL.md +0 -87
- package/skills/prime-intellect/references/compute.md +0 -45
- package/skills/prime-intellect/references/environments.md +0 -73
- package/skills/prime-intellect/references/inference.md +0 -47
- package/skills/prime-intellect/references/sandboxes.md +0 -75
|
@@ -28,13 +28,14 @@ import { CompactAssistantStreamReconstructor, isCompactAssistantDelta } from "./
|
|
|
28
28
|
import { DAEMON_CATALOG_ROLE_ENV, DaemonCatalogClient } from "./daemon-catalog-process.js";
|
|
29
29
|
import { deserializeDaemonError, serializeDaemonError } from "./daemon-errors.js";
|
|
30
30
|
import { CANONICAL_SESSION_OWNERSHIP_COMPATIBILITY, collectDaemonClientEnv, createDaemonEventMeta, DAEMON_COMMAND_COMPATIBILITY, DAEMON_COMMAND_ENVELOPE_MIN_PROTOCOL_VERSION, DAEMON_DEFAULT_CLIENT_CAPABILITIES, DAEMON_DEFAULT_SERVER_CAPABILITIES, DAEMON_PROTOCOL_INFO, DAEMON_SCHEMA_ID, DAEMON_SCHEMA_REVISION, DAEMON_UPDATE_RESTART_FORMAT_VERSION, failure, isDaemonCommandEnvelope, isDaemonMutatingCommand, isLegacyDaemonInspection, salvageDaemonCommandId, success, UPDATE_RESTART_DRAIN_COMMANDS, } from "./daemon-protocol.js";
|
|
31
|
+
import { DaemonRlmCapacityCoordinator } from "./daemon-rlm-capacity-coordinator.js";
|
|
31
32
|
import { getDaemonRuntimeIdentity } from "./daemon-runtime-identity.js";
|
|
32
33
|
import { matchesSessionIdSuffix } from "./daemon-session-id.js";
|
|
33
34
|
import { classifySessionRosterStatus, isEvictableEmptySessionSummary, isSessionSummaryBusy, summaryForInactiveSession, } from "./daemon-session-list.js";
|
|
34
35
|
import { acquireDaemonSocketPathLease, cleanupDaemonSocketPath, defaultDaemonSocketDir, defaultDaemonSocketPath, getDaemonSocketIdentity, normalizeSocketPath, prepareDaemonSocketPath, restrictDaemonSocketPath, } from "./daemon-socket.js";
|
|
35
36
|
import { acquireDaemonSupervisorOwnership, isDaemonShutdownAdmissionActive, waitForDaemonStartupFence, } from "./daemon-supervisor-ownership.js";
|
|
36
37
|
import { DaemonWorkerAuthenticationError, DaemonWorkerClient, DaemonWorkerCompatibilityError, DaemonWorkerProbeTimeoutError, } from "./daemon-worker-client.js";
|
|
37
|
-
import { DAEMON_WORKER_ACTIVE_SESSION_ID_ENV, DAEMON_WORKER_INSTANCE_ID_ENV, DAEMON_WORKER_PEER_TRANSPORT_CAPABILITY, DAEMON_WORKER_RECOVERY_JOURNAL_ENV, DAEMON_WORKER_ROLE_ENV, DAEMON_WORKER_ROSTER_CAPABILITY, DAEMON_WORKER_STARTUP_GATE_COMMIT, DAEMON_WORKER_STARTUP_GATE_FD_ENV, DAEMON_WORKER_SUPERVISOR_SOCKET_ENV, DAEMON_WORKER_TOKEN_ENV, durableDaemonCreateCommand, durableDaemonWorkerDescriptor, ROSTER_HEARTBEAT_INTERVAL_MS, SESSION_LEASE_OWNER_ID_ENV, SESSION_LEASES_ENABLED_ENV, } from "./daemon-worker-protocol.js";
|
|
38
|
+
import { DAEMON_WORKER_ACTIVE_SESSION_ID_ENV, DAEMON_WORKER_INSTANCE_ID_ENV, DAEMON_WORKER_PEER_TRANSPORT_CAPABILITY, DAEMON_WORKER_RECOVERY_JOURNAL_ENV, DAEMON_WORKER_ROLE_ENV, DAEMON_WORKER_ROSTER_CAPABILITY, DAEMON_WORKER_STARTUP_GATE_COMMIT, DAEMON_WORKER_STARTUP_GATE_FD_ENV, DAEMON_WORKER_SUPERVISOR_SOCKET_ENV, DAEMON_WORKER_TOKEN_ENV, durableDaemonCreateCommand, durableDaemonWorkerDescriptor, isDaemonRlmCapacitySnapshot, ROSTER_HEARTBEAT_INTERVAL_MS, SESSION_LEASE_OWNER_ID_ENV, SESSION_LEASES_ENABLED_ENV, } from "./daemon-worker-protocol.js";
|
|
38
39
|
import { MutationDrainLatch } from "./mutation-drain-latch.js";
|
|
39
40
|
import { createRlmLedgerRegistrySeedSource, RlmSpawnLedger, rlmLedgerPath, tombstoneSavedSessionDelete, } from "./rlm-ledger.js";
|
|
40
41
|
import { captureSavedSessionPageQuery } from "./saved-session-page.js";
|
|
@@ -86,6 +87,7 @@ const DAEMON_COMMAND_TYPES = new Set([
|
|
|
86
87
|
"list",
|
|
87
88
|
"list_agent_peers",
|
|
88
89
|
"rlm_ledger_mutate",
|
|
90
|
+
"rlm_capacity",
|
|
89
91
|
"get_direct_worker_transport",
|
|
90
92
|
"roster_subscribe",
|
|
91
93
|
"roster_unsubscribe",
|
|
@@ -177,6 +179,8 @@ const DAEMON_COMMAND_TYPES = new Set([
|
|
|
177
179
|
"set_session_name",
|
|
178
180
|
"get_rlm_max_depth_status",
|
|
179
181
|
"set_rlm_max_depth",
|
|
182
|
+
"get_rlm_max_subagents_status",
|
|
183
|
+
"set_rlm_max_subagents",
|
|
180
184
|
"rename_saved_session",
|
|
181
185
|
"delete_saved_session",
|
|
182
186
|
"get_session_context",
|
|
@@ -448,6 +452,9 @@ export class DaemonSupervisor {
|
|
|
448
452
|
pendingSessionNames = new Set();
|
|
449
453
|
catalog;
|
|
450
454
|
settingsManager;
|
|
455
|
+
rlmCapacity;
|
|
456
|
+
pendingRlmCapacity = new Set();
|
|
457
|
+
releasedDuringCapacityRecovery = new Map();
|
|
451
458
|
rosterStore;
|
|
452
459
|
pendingRosterChanged = new Set();
|
|
453
460
|
pendingRosterRemoved = new Set();
|
|
@@ -482,6 +489,7 @@ export class DaemonSupervisor {
|
|
|
482
489
|
this.snapshotCacheRoot = join(this.descriptorDir, "snapshot-cache", this.generation);
|
|
483
490
|
this.catalog = new DaemonCatalogClient((message) => this.log(message));
|
|
484
491
|
this.settingsManager = SettingsManager.create(process.cwd(), this.defaultSessionConfig.agentDir ?? agentDir);
|
|
492
|
+
this.rlmCapacity = new DaemonRlmCapacityCoordinator(this.settingsManager);
|
|
485
493
|
}
|
|
486
494
|
async start() {
|
|
487
495
|
try {
|
|
@@ -515,6 +523,8 @@ export class DaemonSupervisor {
|
|
|
515
523
|
this.commandJournal = new CommandRecoveryJournal(join(this.descriptorDir, "command-journal.jsonl"));
|
|
516
524
|
this.loadWorkerDescriptors();
|
|
517
525
|
const workersToAdopt = [...this.workers.values()];
|
|
526
|
+
for (const worker of workersToAdopt)
|
|
527
|
+
this.pendingRlmCapacity.add(worker);
|
|
518
528
|
this.server = createServer((socket) => this.handleConnection(socket));
|
|
519
529
|
await this.listen();
|
|
520
530
|
this.assertSocketLeaseHeld();
|
|
@@ -542,7 +552,7 @@ export class DaemonSupervisor {
|
|
|
542
552
|
let adoptionFailed = false;
|
|
543
553
|
await Promise.all(workersToAdopt.map(async (worker) => {
|
|
544
554
|
try {
|
|
545
|
-
await this.adoptOrRecoverWorker(worker);
|
|
555
|
+
await this.adoptOrRecoverWorker(worker, this.ready);
|
|
546
556
|
}
|
|
547
557
|
catch (error) {
|
|
548
558
|
if (!adoptionFailed) {
|
|
@@ -1389,7 +1399,8 @@ export class DaemonSupervisor {
|
|
|
1389
1399
|
isWorkerLedgerEnvelope(line) {
|
|
1390
1400
|
try {
|
|
1391
1401
|
const parsed = JSON.parse(line);
|
|
1392
|
-
return isDaemonCommandEnvelope(parsed) &&
|
|
1402
|
+
return (isDaemonCommandEnvelope(parsed) &&
|
|
1403
|
+
(parsed.command.type === "rlm_ledger_mutate" || parsed.command.type === "rlm_capacity"));
|
|
1393
1404
|
}
|
|
1394
1405
|
catch {
|
|
1395
1406
|
return false;
|
|
@@ -1449,7 +1460,7 @@ export class DaemonSupervisor {
|
|
|
1449
1460
|
return;
|
|
1450
1461
|
}
|
|
1451
1462
|
try {
|
|
1452
|
-
await waitForPromptAdmission(this.assertServingCurrentOwnership(command.type === "rlm_ledger_mutate"), parsedAdmission?.controller.signal);
|
|
1463
|
+
await waitForPromptAdmission(this.assertServingCurrentOwnership(command.type === "rlm_ledger_mutate" || command.type === "rlm_capacity"), parsedAdmission?.controller.signal);
|
|
1453
1464
|
}
|
|
1454
1465
|
catch (error) {
|
|
1455
1466
|
if (parsedAdmission)
|
|
@@ -1481,7 +1492,7 @@ export class DaemonSupervisor {
|
|
|
1481
1492
|
const restartRejected = phase === "draining"
|
|
1482
1493
|
? !UPDATE_RESTART_DRAIN_COMMANDS.has(command.type)
|
|
1483
1494
|
: phase !== undefined && !(phase === "prepared" && command.type === "shutdown");
|
|
1484
|
-
if (restartRejected && mutation && command.type !== "rlm_ledger_mutate") {
|
|
1495
|
+
if (restartRejected && mutation && command.type !== "rlm_ledger_mutate" && command.type !== "rlm_capacity") {
|
|
1485
1496
|
if (parsedAdmission)
|
|
1486
1497
|
this.deletePromptAdmission(parsedAdmission);
|
|
1487
1498
|
this.write(client, failure(command.id, command.type, "Daemon is preparing an update restart"));
|
|
@@ -1492,7 +1503,7 @@ export class DaemonSupervisor {
|
|
|
1492
1503
|
if (idleEvictionFence) {
|
|
1493
1504
|
await idleEvictionFence;
|
|
1494
1505
|
try {
|
|
1495
|
-
await this.assertServingCurrentOwnership(command.type === "rlm_ledger_mutate");
|
|
1506
|
+
await this.assertServingCurrentOwnership(command.type === "rlm_ledger_mutate" || command.type === "rlm_capacity");
|
|
1496
1507
|
}
|
|
1497
1508
|
catch (error) {
|
|
1498
1509
|
if (parsedAdmission)
|
|
@@ -1569,6 +1580,146 @@ export class DaemonSupervisor {
|
|
|
1569
1580
|
this.mutationDrain.end();
|
|
1570
1581
|
}
|
|
1571
1582
|
}
|
|
1583
|
+
rlmCapacityOwner(worker) {
|
|
1584
|
+
return `${worker.descriptor.workerId}:${worker.descriptor.workerInstanceId ?? "unavailable"}`;
|
|
1585
|
+
}
|
|
1586
|
+
async rlmCapacityFamily(sessionFile, owner, sessionId) {
|
|
1587
|
+
if (!sessionFile)
|
|
1588
|
+
return `memory:${owner}:${sessionId}`;
|
|
1589
|
+
const parents = new Map((await this.rlmSpawnLedger().liveEdges({ strict: true })).map((edge) => [canonicalSessionPath(edge.child), canonicalSessionPath(edge.parent)]));
|
|
1590
|
+
let root = canonicalSessionPath(sessionFile);
|
|
1591
|
+
const visited = new Set();
|
|
1592
|
+
while (parents.has(root)) {
|
|
1593
|
+
if (visited.has(root))
|
|
1594
|
+
throw new Error("RLM family ancestry contains a cycle");
|
|
1595
|
+
visited.add(root);
|
|
1596
|
+
const parent = parents.get(root);
|
|
1597
|
+
if (parent === undefined)
|
|
1598
|
+
break;
|
|
1599
|
+
root = parent;
|
|
1600
|
+
}
|
|
1601
|
+
return `file:${root}`;
|
|
1602
|
+
}
|
|
1603
|
+
isRlmMainRoot(sessionFile, family) {
|
|
1604
|
+
return sessionFile === undefined || family === `file:${canonicalSessionPath(sessionFile)}`;
|
|
1605
|
+
}
|
|
1606
|
+
releaseWorkerRlmCapacity(worker) {
|
|
1607
|
+
this.rlmCapacity.releaseOwner(this.rlmCapacityOwner(worker));
|
|
1608
|
+
this.pendingRlmCapacity.delete(worker);
|
|
1609
|
+
this.releasedDuringCapacityRecovery.delete(worker);
|
|
1610
|
+
}
|
|
1611
|
+
async assertRlmCapacityKnown(family) {
|
|
1612
|
+
for (const worker of [...this.pendingRlmCapacity]) {
|
|
1613
|
+
const identity = this.processIdentity(worker.descriptor.pid, worker.descriptor.processStartId);
|
|
1614
|
+
if (identity === "gone" || identity === "replaced") {
|
|
1615
|
+
this.releaseWorkerRlmCapacity(worker);
|
|
1616
|
+
continue;
|
|
1617
|
+
}
|
|
1618
|
+
const path = worker.descriptor.sessionFile ?? worker.descriptor.createCommand.sessionPath;
|
|
1619
|
+
const pendingFamily = path
|
|
1620
|
+
? await this.rlmCapacityFamily(path, this.rlmCapacityOwner(worker), worker.descriptor.rootSessionId ?? "pending")
|
|
1621
|
+
: undefined;
|
|
1622
|
+
if (this.pendingRlmCapacity.has(worker) && (pendingFamily === undefined || pendingFamily === family)) {
|
|
1623
|
+
throw new Error("RLM family capacity is waiting for a live worker to reconnect");
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
async restoreWorkerRlmCapacity(worker, client) {
|
|
1628
|
+
if (!this.pendingRlmCapacity.has(worker))
|
|
1629
|
+
return;
|
|
1630
|
+
const owner = this.rlmCapacityOwner(worker);
|
|
1631
|
+
const response = await client.requestWorker({ type: "worker_get_rlm_capacity" }, 2000);
|
|
1632
|
+
if (!response.success)
|
|
1633
|
+
throw deserializeDaemonError(response);
|
|
1634
|
+
if (!isDaemonRlmCapacitySnapshot(response.data))
|
|
1635
|
+
throw new Error("Worker returned an invalid RLM capacity snapshot");
|
|
1636
|
+
const recovered = await Promise.all(response.data.reservations.map(async (reservation) => ({
|
|
1637
|
+
reservation,
|
|
1638
|
+
family: await this.rlmCapacityFamily(reservation.sessionFile, owner, reservation.sessionId),
|
|
1639
|
+
})));
|
|
1640
|
+
if (this.rlmCapacityOwner(worker) !== owner || !this.pendingRlmCapacity.has(worker))
|
|
1641
|
+
return;
|
|
1642
|
+
const released = this.releasedDuringCapacityRecovery.get(worker);
|
|
1643
|
+
for (const { reservation, family } of recovered) {
|
|
1644
|
+
if (released?.has(reservation.reservationId))
|
|
1645
|
+
continue;
|
|
1646
|
+
if (reservation.residentRoot && this.isRlmMainRoot(reservation.sessionFile, family))
|
|
1647
|
+
continue;
|
|
1648
|
+
this.rlmCapacity.restore(owner, reservation.reservationId, family);
|
|
1649
|
+
}
|
|
1650
|
+
this.pendingRlmCapacity.delete(worker);
|
|
1651
|
+
this.releasedDuringCapacityRecovery.delete(worker);
|
|
1652
|
+
}
|
|
1653
|
+
async handleRlmCapacity(command) {
|
|
1654
|
+
const worker = [...this.workers.values()].find((candidate) => candidate.descriptor.authenticationToken === command.workerToken &&
|
|
1655
|
+
candidate.descriptor.workerInstanceId === command.workerInstanceId);
|
|
1656
|
+
if (!worker ||
|
|
1657
|
+
!command.workerInstanceId ||
|
|
1658
|
+
worker.compatibilityError ||
|
|
1659
|
+
this.processIdentity(worker.descriptor.pid, worker.descriptor.processStartId) !== "current") {
|
|
1660
|
+
throw new Error("Worker authentication failed for RLM capacity");
|
|
1661
|
+
}
|
|
1662
|
+
const owner = this.rlmCapacityOwner(worker);
|
|
1663
|
+
const journal = this.assertRlmJournalAdmission();
|
|
1664
|
+
const scope = this.rlmJournalScope(worker.descriptor.sessionDir ?? this.defaultSessionConfig.sessionDir);
|
|
1665
|
+
if (canonicalSessionPath(scope.journalPath) !== journal.ledgerPath) {
|
|
1666
|
+
throw new Error("Worker RLM family is not owned by this supervisor");
|
|
1667
|
+
}
|
|
1668
|
+
const operation = command.operation;
|
|
1669
|
+
if (!operation || typeof operation !== "object")
|
|
1670
|
+
throw new Error("Invalid RLM capacity operation");
|
|
1671
|
+
if (operation.op === "release") {
|
|
1672
|
+
if (typeof operation.reservationId !== "string" || !operation.reservationId)
|
|
1673
|
+
throw new Error("Invalid RLM reservation id");
|
|
1674
|
+
this.rlmCapacity.release(owner, operation.reservationId);
|
|
1675
|
+
if (this.pendingRlmCapacity.has(worker)) {
|
|
1676
|
+
let released = this.releasedDuringCapacityRecovery.get(worker);
|
|
1677
|
+
if (!released) {
|
|
1678
|
+
released = new Set();
|
|
1679
|
+
this.releasedDuringCapacityRecovery.set(worker, released);
|
|
1680
|
+
}
|
|
1681
|
+
released.add(operation.reservationId);
|
|
1682
|
+
}
|
|
1683
|
+
return success(command.id, command.type);
|
|
1684
|
+
}
|
|
1685
|
+
if (operation.op !== "status" && operation.op !== "set" && operation.op !== "reserve")
|
|
1686
|
+
throw new Error("Unknown RLM capacity operation");
|
|
1687
|
+
if (typeof operation.sessionId !== "string" ||
|
|
1688
|
+
!operation.sessionId ||
|
|
1689
|
+
(operation.sessionFile !== undefined && (typeof operation.sessionFile !== "string" || !operation.sessionFile))) {
|
|
1690
|
+
throw new Error("Invalid RLM capacity origin");
|
|
1691
|
+
}
|
|
1692
|
+
const family = await this.rlmCapacityFamily(operation.sessionFile, owner, operation.sessionId);
|
|
1693
|
+
await this.assertServingCurrentOwnership(true);
|
|
1694
|
+
if (this.rlmCapacityOwner(worker) !== owner || worker.descriptor.authenticationToken !== command.workerToken) {
|
|
1695
|
+
throw new Error("RLM capacity worker incarnation changed");
|
|
1696
|
+
}
|
|
1697
|
+
if (operation.op === "status")
|
|
1698
|
+
return success(command.id, command.type, this.rlmCapacity.getStatus(family));
|
|
1699
|
+
if (this.shuttingDown || this.updateRestartPhase !== undefined || worker.descriptor.stopRequestedAt) {
|
|
1700
|
+
throw new Error("RLM capacity admission is closed while the worker or daemon is stopping");
|
|
1701
|
+
}
|
|
1702
|
+
if (operation.op === "set") {
|
|
1703
|
+
return success(command.id, command.type, await this.rlmCapacity.setMaxSubagents(family, operation.maxSubagents));
|
|
1704
|
+
}
|
|
1705
|
+
if (typeof operation.reservationId !== "string" ||
|
|
1706
|
+
!operation.reservationId ||
|
|
1707
|
+
(operation.residentRoot !== undefined && operation.residentRoot !== true))
|
|
1708
|
+
throw new Error("Invalid RLM reservation");
|
|
1709
|
+
if (operation.residentRoot && this.isRlmMainRoot(operation.sessionFile, family)) {
|
|
1710
|
+
return success(command.id, command.type, this.rlmCapacity.getStatus(family));
|
|
1711
|
+
}
|
|
1712
|
+
await this.assertRlmCapacityKnown(family);
|
|
1713
|
+
await this.assertServingCurrentOwnership();
|
|
1714
|
+
if (this.updateRestartPhase !== undefined ||
|
|
1715
|
+
worker.descriptor.stopRequestedAt ||
|
|
1716
|
+
this.rlmCapacityOwner(worker) !== owner ||
|
|
1717
|
+
this.workers.get(worker.descriptor.workerId) !== worker ||
|
|
1718
|
+
this.processIdentity(worker.descriptor.pid, worker.descriptor.processStartId) !== "current") {
|
|
1719
|
+
throw new Error("RLM capacity admission changed while resolving its family");
|
|
1720
|
+
}
|
|
1721
|
+
return success(command.id, command.type, this.rlmCapacity.reserve(owner, operation.reservationId, family));
|
|
1722
|
+
}
|
|
1572
1723
|
async handleCommand(client, command, cancellationAdmission) {
|
|
1573
1724
|
switch (command.type) {
|
|
1574
1725
|
case "cancel_prompt_admission": {
|
|
@@ -1631,6 +1782,8 @@ export class DaemonSupervisor {
|
|
|
1631
1782
|
});
|
|
1632
1783
|
return success(command.id, command.type, { peers });
|
|
1633
1784
|
}
|
|
1785
|
+
case "rlm_capacity":
|
|
1786
|
+
return this.handleRlmCapacity(command);
|
|
1634
1787
|
case "rlm_ledger_mutate": {
|
|
1635
1788
|
const worker = [...this.workers.values()].find((candidate) => candidate.descriptor.authenticationToken === command.workerToken);
|
|
1636
1789
|
if (!worker ||
|
|
@@ -2774,7 +2927,6 @@ export class DaemonSupervisor {
|
|
|
2774
2927
|
rootActiveSessionId,
|
|
2775
2928
|
ownerClientId: existing?.descriptor.ownerClientId ?? ownerClientId,
|
|
2776
2929
|
sessionDir: createCommand.config?.sessionDir,
|
|
2777
|
-
telemetryDisabled: createCommand.config?.telemetryDisabled,
|
|
2778
2930
|
createdAt: existing?.descriptor.createdAt ?? now,
|
|
2779
2931
|
updatedAt: now,
|
|
2780
2932
|
lifecycle: "starting",
|
|
@@ -2954,6 +3106,7 @@ export class DaemonSupervisor {
|
|
|
2954
3106
|
if (!workerAuthAdvertisesRoster(authResponse.data)) {
|
|
2955
3107
|
throw new PreRosterWorkerError("Session worker predates the roster protocol and must be restarted");
|
|
2956
3108
|
}
|
|
3109
|
+
await this.restoreWorkerRlmCapacity(worker, client);
|
|
2957
3110
|
worker.peerTransportCapable = workerAuthAdvertisesPeerTransport(authResponse.data);
|
|
2958
3111
|
worker.lastFrameAt = Date.now();
|
|
2959
3112
|
worker.client?.close();
|
|
@@ -3014,7 +3167,7 @@ export class DaemonSupervisor {
|
|
|
3014
3167
|
throw new Error(response.error);
|
|
3015
3168
|
}
|
|
3016
3169
|
}
|
|
3017
|
-
async adoptOrRecoverWorker(worker) {
|
|
3170
|
+
async adoptOrRecoverWorker(worker, recoveryReady) {
|
|
3018
3171
|
await this.assertRecoveryAllowed();
|
|
3019
3172
|
if (worker.descriptor.stopRequestedAt) {
|
|
3020
3173
|
try {
|
|
@@ -3078,6 +3231,17 @@ export class DaemonSupervisor {
|
|
|
3078
3231
|
return;
|
|
3079
3232
|
}
|
|
3080
3233
|
this.log(`Could not adopt worker ${worker.descriptor.workerId}: ${String(error)}`);
|
|
3234
|
+
if (recoveryReady) {
|
|
3235
|
+
// Recovery can create workers that call back for capacity. Keep it single-flight,
|
|
3236
|
+
// but let adoption finish before those callbacks need the normal ready gate.
|
|
3237
|
+
void this.recoverWorker(worker, {
|
|
3238
|
+
ready: recoveryReady,
|
|
3239
|
+
...(error instanceof PreRosterWorkerError && worker.descriptor.ownerClientId === undefined
|
|
3240
|
+
? { preRoster: { observedProcessStartId } }
|
|
3241
|
+
: {}),
|
|
3242
|
+
}).catch((recoveryError) => this.log(`Could not recover worker ${worker.descriptor.workerId}: ${String(recoveryError)}`));
|
|
3243
|
+
return;
|
|
3244
|
+
}
|
|
3081
3245
|
// A client-owned worker's launch env lives only with its owner; recoverWorker parks it instead.
|
|
3082
3246
|
if (error instanceof PreRosterWorkerError && worker.descriptor.ownerClientId === undefined) {
|
|
3083
3247
|
try {
|
|
@@ -3103,7 +3267,13 @@ export class DaemonSupervisor {
|
|
|
3103
3267
|
}
|
|
3104
3268
|
}
|
|
3105
3269
|
async restartPreRosterWorker(worker, observedProcessStartId) {
|
|
3270
|
+
const stopRevision = worker.stopRevision;
|
|
3271
|
+
const workerInstanceId = worker.descriptor.workerInstanceId;
|
|
3106
3272
|
await this.assertRecoveryAllowed();
|
|
3273
|
+
if (this.isWorkerRecoveryCancelled(worker) ||
|
|
3274
|
+
worker.stopRevision !== stopRevision ||
|
|
3275
|
+
worker.descriptor.workerInstanceId !== workerInstanceId)
|
|
3276
|
+
return;
|
|
3107
3277
|
if (worker.descriptor.processStartId === undefined && observedProcessStartId !== undefined) {
|
|
3108
3278
|
worker.descriptor.processStartId = observedProcessStartId;
|
|
3109
3279
|
}
|
|
@@ -3390,11 +3560,12 @@ export class DaemonSupervisor {
|
|
|
3390
3560
|
validation.resolve();
|
|
3391
3561
|
}
|
|
3392
3562
|
}
|
|
3393
|
-
async recoverWorker(worker) {
|
|
3563
|
+
async recoverWorker(worker, startup) {
|
|
3394
3564
|
if (this.isWorkerRecoveryCancelled(worker)) {
|
|
3395
3565
|
return;
|
|
3396
3566
|
}
|
|
3397
3567
|
if (worker.descriptor.ownerClientId && !worker.launchEnv && !isProcessAlive(worker.descriptor.pid)) {
|
|
3568
|
+
this.releaseWorkerRlmCapacity(worker);
|
|
3398
3569
|
worker.descriptor.lifecycle = "failed";
|
|
3399
3570
|
worker.descriptor.lastError = "Waiting for the owning client to reconnect";
|
|
3400
3571
|
this.persistWorker(worker);
|
|
@@ -3403,7 +3574,27 @@ export class DaemonSupervisor {
|
|
|
3403
3574
|
if (worker.recovery) {
|
|
3404
3575
|
return worker.recovery;
|
|
3405
3576
|
}
|
|
3577
|
+
const stopRevision = worker.stopRevision;
|
|
3578
|
+
const workerInstanceId = worker.descriptor.workerInstanceId;
|
|
3406
3579
|
worker.recovery = (async () => {
|
|
3580
|
+
if (startup) {
|
|
3581
|
+
await startup.ready;
|
|
3582
|
+
if (this.isWorkerRecoveryCancelled(worker) ||
|
|
3583
|
+
worker.stopRevision !== stopRevision ||
|
|
3584
|
+
worker.descriptor.workerInstanceId !== workerInstanceId)
|
|
3585
|
+
return;
|
|
3586
|
+
if (startup.preRoster) {
|
|
3587
|
+
try {
|
|
3588
|
+
await this.restartPreRosterWorker(worker, startup.preRoster.observedProcessStartId);
|
|
3589
|
+
return;
|
|
3590
|
+
}
|
|
3591
|
+
catch (restartError) {
|
|
3592
|
+
if (isSupervisorRecoveryCancelled(restartError))
|
|
3593
|
+
return;
|
|
3594
|
+
this.log(`Could not restart pre-roster worker ${worker.descriptor.workerId}: ${String(restartError)}`);
|
|
3595
|
+
}
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3407
3598
|
let keepProbingLiveWorker = false;
|
|
3408
3599
|
for (const retryDelay of WORKER_RETRY_DELAYS_MS) {
|
|
3409
3600
|
await delay(retryDelay);
|
|
@@ -3455,6 +3646,7 @@ export class DaemonSupervisor {
|
|
|
3455
3646
|
keepProbingLiveWorker = true;
|
|
3456
3647
|
throw new Error(`Cannot safely replace live session worker ${worker.descriptor.workerId} without a verified process identity`);
|
|
3457
3648
|
}
|
|
3649
|
+
this.releaseWorkerRlmCapacity(worker);
|
|
3458
3650
|
const recoveryCommand = worker.descriptor.ownerClientId ? worker.transientCreateCommand : undefined;
|
|
3459
3651
|
if (!recoveryCommand || !worker.launchEnv) {
|
|
3460
3652
|
await this.recoverUncertainWorkerOperations(worker);
|
|
@@ -3773,6 +3965,16 @@ export class DaemonSupervisor {
|
|
|
3773
3965
|
return worker === undefined || this.isVisibleWorker(worker);
|
|
3774
3966
|
}
|
|
3775
3967
|
writeRosterEntry(entry, worker, statusLabel) {
|
|
3968
|
+
const existing = entry.summary.sessionFile
|
|
3969
|
+
? this.roster().bySessionFile(entry.summary.sessionFile)
|
|
3970
|
+
: this.roster().get(entry.agentId);
|
|
3971
|
+
// A parent's saved-child row cannot replace that child's independent live worker.
|
|
3972
|
+
if (worker &&
|
|
3973
|
+
!entry.summary.activeSessionId &&
|
|
3974
|
+
existing?.summary.activeSessionId &&
|
|
3975
|
+
existing.workerId !== undefined &&
|
|
3976
|
+
existing.workerId !== worker.descriptor.workerId)
|
|
3977
|
+
return existing;
|
|
3776
3978
|
const previousDirect = this.roster().get(entry.agentId)?.summary.directAttachedClients ?? 0;
|
|
3777
3979
|
const stored = this.roster().write(entry, worker?.descriptor.workerId, statusLabel);
|
|
3778
3980
|
// Direct peers attach and detach on the worker socket, so their last detach arrives
|
|
@@ -4433,16 +4635,12 @@ export class DaemonSupervisor {
|
|
|
4433
4635
|
if (ownedWorker.descriptor.ownerClientId !== this.protocolClientId(client)) {
|
|
4434
4636
|
throw new Error(`Unknown active session: ${command.activeSessionId}`);
|
|
4435
4637
|
}
|
|
4436
|
-
this.assertTelemetryAttachAllowed(ownedWorker, command.telemetryDisabled);
|
|
4437
4638
|
ownedWorker.launchEnv = command.launchEnv ?? ownedWorker.launchEnv;
|
|
4438
4639
|
if (!ownedWorker.client || ownedWorker.descriptor.lifecycle !== "ready") {
|
|
4439
4640
|
if (command.recoveryConfig) {
|
|
4440
4641
|
ownedWorker.transientCreateCommand = {
|
|
4441
4642
|
...ownedWorker.descriptor.createCommand,
|
|
4442
|
-
config:
|
|
4443
|
-
...command.recoveryConfig,
|
|
4444
|
-
...(ownedWorker.descriptor.telemetryDisabled === true ? { telemetryDisabled: true } : {}),
|
|
4445
|
-
},
|
|
4643
|
+
config: command.recoveryConfig,
|
|
4446
4644
|
env: command.env,
|
|
4447
4645
|
launchEnv: command.launchEnv,
|
|
4448
4646
|
lifecycle: "client_owned",
|
|
@@ -4462,7 +4660,6 @@ export class DaemonSupervisor {
|
|
|
4462
4660
|
}
|
|
4463
4661
|
}
|
|
4464
4662
|
const match = await this.findWorkerForClient(client, command.activeSessionId);
|
|
4465
|
-
this.assertTelemetryAttachAllowed(match.worker, command.telemetryDisabled);
|
|
4466
4663
|
this.requireAvailableWorkerClient(match.worker);
|
|
4467
4664
|
const activeSessionId = match.summary.activeSessionId ?? match.summary.id;
|
|
4468
4665
|
const duplicateValidation = this.currentSnapshotGeneration(match.worker, activeSessionId)?.validation;
|
|
@@ -4609,11 +4806,6 @@ export class DaemonSupervisor {
|
|
|
4609
4806
|
throw error;
|
|
4610
4807
|
}
|
|
4611
4808
|
}
|
|
4612
|
-
assertTelemetryAttachAllowed(worker, telemetryDisabled) {
|
|
4613
|
-
if (telemetryDisabled && worker.descriptor.telemetryDisabled !== true) {
|
|
4614
|
-
throw new Error("Cannot attach to this active agent while telemetry is disabled for the current invocation. Stop the agent and retry so it can restart without telemetry.");
|
|
4615
|
-
}
|
|
4616
|
-
}
|
|
4617
4809
|
cacheLoadedSnapshot(worker, activeSessionId, loaded, observedSnapshotId) {
|
|
4618
4810
|
const currentTranscript = worker.transcriptCaches.get(activeSessionId);
|
|
4619
4811
|
const currentGeneration = this.currentSnapshotGeneration(worker, activeSessionId);
|
|
@@ -5721,6 +5913,7 @@ export class DaemonSupervisor {
|
|
|
5721
5913
|
if (removeDescriptor && worker.descriptor.ownerClientId !== undefined) {
|
|
5722
5914
|
ephemeralCancelSettled = await this.cancelEphemeralWorkerScheduledJobs(worker);
|
|
5723
5915
|
}
|
|
5916
|
+
this.releaseWorkerRlmCapacity(worker);
|
|
5724
5917
|
this.workers.delete(worker.descriptor.workerId);
|
|
5725
5918
|
this.flipWorkerRosterEntriesInactive(worker);
|
|
5726
5919
|
// A failed cancel keeps the stop tombstone as the durable intent; the enumeration retry or the next boot finishes it.
|