glimmervoid 0.34.1 → 0.35.0

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.
Files changed (52) hide show
  1. package/dist/bin/glimmervoid.js +31 -19
  2. package/dist/chunks/adapters-B37wqNti.js +1 -0
  3. package/dist/chunks/{adapters-D-cRFZ_Q.js → adapters-CADejSpq.js} +219 -9
  4. package/dist/chunks/agent-api-cli-CRj_FYbz.js +1 -0
  5. package/dist/chunks/{agent-api-cli-DuT7437B.js → agent-api-cli-vGwstJ1j.js} +57 -17
  6. package/dist/chunks/{agent-api-core-Ddg15j2j.js → agent-api-core-D1233u1U.js} +35 -9
  7. package/dist/chunks/{agent-setup-cli-CFielF2o.js → agent-setup-cli-BTAFcckd.js} +2 -2
  8. package/dist/chunks/child-process-safe-ChRmWAJP.js +1 -0
  9. package/dist/chunks/{config-DTwMFUjx.js → config-rPbbL4nW.js} +12 -21
  10. package/dist/chunks/config-store-BeIxAZNn.js +1 -0
  11. package/dist/chunks/{config-store-D0lRWsAM.js → config-store-BtsYbNC3.js} +44 -14
  12. package/dist/chunks/{contracts-DZV9H8px.js → contracts-DjIgIuDk.js} +27 -27
  13. package/dist/chunks/{git-version-CrLW4a6r.js → git-version-CUcDtF5k.js} +3 -3
  14. package/dist/chunks/{grok-BYKnBgdr.js → grok-KKgdSe-7.js} +7 -3
  15. package/dist/chunks/{ingest-editor-core-vR6Wv6bP.js → ingest-editor-core-B2tycW_m.js} +4 -4
  16. package/dist/chunks/{json-file-oEH9vt-0.js → json-file-BaxGcB2R.js} +1 -1
  17. package/dist/chunks/{knowledge-graph-cli-BBE3R9DJ.js → knowledge-graph-cli-Rj5nj87L.js} +4 -4
  18. package/dist/chunks/{main-VMWdsGC6.js → main-BTI0J5QE.js} +325 -424
  19. package/dist/chunks/{pair-cli-CI848omy.js → pair-cli-Dcyzv3In.js} +2 -2
  20. package/dist/chunks/paths-Bu4eH1Yd.js +27 -0
  21. package/dist/chunks/{remote-config-Y6YtqoiO.js → remote-config-Dd1T-VJA.js} +3 -3
  22. package/dist/chunks/{rtk-resolver-jJxy_Mrt.js → rtk-resolver-B9pzjLsM.js} +1 -1
  23. package/dist/chunks/rtk-resolver-SWU5VVM7.js +1 -0
  24. package/dist/chunks/{runtime-paths-BPoxENmK.js → runtime-paths-BkeftE60.js} +3 -4
  25. package/dist/chunks/runtime-paths-DSmormp7.js +1 -0
  26. package/dist/chunks/{sandbox-deps-C63o3mZs.js → sandbox-deps-CWiH1d1w.js} +3 -3
  27. package/dist/chunks/{session-C7rstCmA.js → session-D6xXN0UU.js} +26 -4
  28. package/dist/chunks/session-routes-BYy3am9m.js +127 -0
  29. package/dist/chunks/{ssh-sign-cli-SWtTF00D.js → ssh-sign-cli-DPHpT22B.js} +11 -7
  30. package/dist/chunks/{visions-cli-BhFdym5n.js → visions-cli-CYujESdJ.js} +2 -2
  31. package/dist/chunks/{visions-setup-CfgNHiG3.js → visions-setup-B-ZeRdsi.js} +9 -9
  32. package/dist/client/assets/index-DE2GUmqs.css +1 -0
  33. package/dist/client/assets/index-Ds4ngkHp.js +254 -0
  34. package/dist/client/index.html +2 -2
  35. package/dist/scripts/postinstall-path-check.js +1 -1
  36. package/dist/server/index.js +2 -2
  37. package/dist/session/hook-tool-relay.js +2 -2
  38. package/dist/session/sandbox-open-launcher.js +1 -1
  39. package/dist/session/statusline-relay.js +1 -1
  40. package/dist/session/visions-relay.js +3 -3
  41. package/dist/tools/vscode-visions/visions-lsp-core.js +1 -1
  42. package/package.json +8 -8
  43. package/dist/chunks/adapters-CgbcceU3.js +0 -2
  44. package/dist/chunks/agent-api-cli-CRJYxzVU.js +0 -2
  45. package/dist/chunks/child-process-safe-B3zcPdFM.js +0 -2
  46. package/dist/chunks/config-store-DwTxLe8Y.js +0 -2
  47. package/dist/chunks/paths-CeJl2Vcg.js +0 -55
  48. package/dist/chunks/rtk-resolver-CIVLE_xk.js +0 -2
  49. package/dist/chunks/runtime-paths-DU5jBEEO.js +0 -2
  50. package/dist/client/assets/index-BxU3Ww0L.css +0 -1
  51. package/dist/client/assets/index-b9goyXSa.js +0 -254
  52. package/dist/chunks/{child-process-safe-DDELk9XC.js → child-process-safe-CbQnyh7D.js} +1 -1
@@ -1,39 +1,40 @@
1
1
  import { i as sanitizeOneLine, n as requireExecutableSpawnHelper, r as firstLine$1 } from "./node-pty-preflight-C8QIlrtU.js";
2
2
  import { a as isMissingFileError, i as errorText$1, r as errorMessage, t as errorCode } from "./text-DoirglWV.js";
3
- import { a as isPathInside, c as sanitizeWorktreeName, n as caseFoldedPathKey, o as isSameDirectoryPath, r as comparableDirectoryPath, s as safePathSegment, t as canonicalizePath } from "./paths-CeJl2Vcg.js";
4
- import { a as packageRoot, n as cliPath, o as relayPath, r as clientDir, s as resolvePackageBin, t as bundled } from "./runtime-paths-BPoxENmK.js";
5
- import { A as KILLABLE_STATES, C as SshSignRequest, E as isSamePromptQuestion, M as RESTARTABLE_STATES, N as STATES, T as TaskTitle, _ as SIGN_URL_ENV, a as AgentDispatchRequest, c as AgentTicketRequest, h as SESSION_DOC_BODY_CAP_BYTES, j as MERGEABLE_LIVE_STATES, k as toolDetailLine, l as ORCHESTRATOR_AGENT_VERBS, m as RefinedTaskTitle, n as AGENT_URL_ENV, r as ASK_USER_QUESTION_TOOL_NAME, v as SSH_SIGN_BODY_CAP_BYTES, w as TASK_TITLE_CONTROL_CHARACTERS } from "./session-C7rstCmA.js";
6
- import { n as execFileAsync, o as spawn, r as execFileSync, t as execFile } from "./child-process-safe-DDELk9XC.js";
3
+ import { a as sanitizeWorktreeName, i as safePathSegment, r as isPathInside, t as caseFoldedPathKey } from "./paths-Bu4eH1Yd.js";
4
+ import { a as packageRoot, n as cliPath, o as relayPath, r as clientDir, s as resolvePackageBin, t as bundled } from "./runtime-paths-BkeftE60.js";
5
+ import { D as TaskTitle, E as TASK_TITLE_CONTROL_CHARACTERS, F as STATES, M as KILLABLE_STATES, N as MERGEABLE_LIVE_STATES, O as isSamePromptQuestion, P as RESTARTABLE_STATES, T as SshSignRequest, _ as SESSION_DOC_BODY_CAP_BYTES, a as AgentDispatchRequest, b as SSH_SIGN_BODY_CAP_BYTES, h as RefinedTaskTitle, j as toolDetailLine, l as AgentTicketRequest, n as AGENT_URL_ENV, r as ASK_USER_QUESTION_TOOL_NAME, u as ORCHESTRATOR_AGENT_VERBS, y as SIGN_URL_ENV } from "./session-D6xXN0UU.js";
6
+ import { n as execFileAsync, o as spawn, r as execFileSync, t as execFile } from "./child-process-safe-CbQnyh7D.js";
7
7
  import { n as glimmervoidHomeDir, t as decideConfigPath } from "./config-path-core-DFt-TemS.js";
8
- import { n as checkSandboxDependencies, t as allowSandboxedSpawn } from "./sandbox-deps-C63o3mZs.js";
9
- import { n as warnWhenGitIsTooOld } from "./git-version-CrLW4a6r.js";
8
+ import { n as checkSandboxDependencies, t as allowSandboxedSpawn } from "./sandbox-deps-CWiH1d1w.js";
9
+ import { n as warnWhenGitIsTooOld } from "./git-version-CUcDtF5k.js";
10
10
  import { t as HOOK_URL_ENV } from "./hook-relay-core-DA_bz2KA.js";
11
11
  import { t as HOOK_VIA_SANDBOX_PROXY_ENV } from "./sandbox-proxy-core-hnQgKR0T.js";
12
12
  import { t as refocusReplyFor } from "./refocus-core-BKQKllq7.js";
13
13
  import { a as positiveIntOr, c as textOr, i as numberOr, n as isRecord, o as positiveNumberOr, r as nonNegativeIntOr, s as rawTextOr, t as coercedNumberOr } from "./coerce-NSst8oRP.js";
14
14
  import { n as parseJsonRecord, t as parseJsonOrNull } from "./json-core-dfa_7Fak.js";
15
15
  import { i as SANE_YOLO_FILES } from "./rtk-hook-core-BmEz2aq9.js";
16
- import { _ as lineStartOffsets, a as projectForUri, b as replacedSpanOfWholeTextChange, c as visionsLaneReloadSignature, d as applyDidOpen, f as createDocStore, g as lineOfOffset, h as getDoc, i as isUriInProjects, l as applyDidChange, m as formatRange, n as applyEditorNotification, o as resolveVisionsScopeProjects, p as detectBlankLineBoundary, r as createEditorState, s as scopePathsOf, t as ACTIVITY_METHOD, u as applyDidClose, v as listDocs, x as uriOfParams, y as offsetOfPosition } from "./ingest-editor-core-vR6Wv6bP.js";
16
+ import { _ as lineStartOffsets, a as projectForUri, b as replacedSpanOfWholeTextChange, c as visionsLaneReloadSignature, d as applyDidOpen, f as createDocStore, g as lineOfOffset, h as getDoc, i as isUriInProjects, l as applyDidChange, m as formatRange, n as applyEditorNotification, o as resolveVisionsScopeProjects, p as detectBlankLineBoundary, r as createEditorState, s as scopePathsOf, t as ACTIVITY_METHOD, u as applyDidClose, v as listDocs, x as uriOfParams, y as offsetOfPosition } from "./ingest-editor-core-B2tycW_m.js";
17
17
  import { n as DEFAULT_MAX_MS, r as nextBackoffMs, t as DEFAULT_BASE_MS } from "./backoff-DjVpfHk7.js";
18
18
  import { n as unrefTimer, t as DEFAULT_TIMER_FNS } from "./timer-deps-u2DAQLok.js";
19
- import { a as decideTicketAction, i as decideSpawnAllowance, l as isOrchestratorAgentVerb, n as REFUSAL_REASON, o as deriveChildSessionName, r as decideAgentRequest, s as describePushLanding, t as PUSH_UNAVAILABLE_REASON, u as parseAgentVerb } from "./agent-api-core-Ddg15j2j.js";
20
- import { s as GLIMMERVOID_SECRET_KEYS } from "./grok-BYKnBgdr.js";
21
- import { _ as isQueueAdmissionTimeout, a as jsonStateLoadError, c as loadedJsonValue, d as writeJsonAtomicSync, f as writeTextAtomic, g as createSpawnGate, h as createSerialQueue, i as createJsonStateWriter, m as createKeyedSerialQueue, n as appendJsonLines, o as loadJsonStateFile, p as writeTextAtomicSync, r as createJsonStateStore, s as loadJsonStateFileSync, t as appendJsonLine, u as writeJsonAtomic } from "./json-file-oEH9vt-0.js";
22
- import { $ as TeamReviewCompareFiles, A as MyPrSearchResponse, At as CoherenceWorkInspect, B as PostingPlan, C as MyPrMergeMethod, Ct as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, D as MyPrMergeWhenReadyRequest, E as MyPrMergeStateResponse, F as CommitSha, G as ReviewDraft, H as QueuedReview, I as DECIDING_REVIEW_STATES, J as ReviewThreadId, K as ReviewFinding, L as FindingSeverity, M as MyPrThreadsResponse, N as MyPrsState, Ot as CoherenceTicketCreated, P as MyPrsStatus, R as GithubReviewDecision, Tt as CoherenceOrient, U as ReviewChecksState, V as PrDetail, W as ReviewComment, X as SearchedPr, Y as ReviewVerdict, Z as TeamReviewActionRequest, _ as WorkflowSearchNode, a as ConfigUpdate, at as TeamReviewThreadsRepository, b as MyPrAutoRebase, bt as USAGE_COST_MODES, c as TASK_TITLE_SOURCE_PRIORITY, ct as hasStandingViewerApproval, d as BRANCH_GC_CONTROL_NUMERIC_KEYS, dt as shortSha$1, et as TeamReviewResolveResponse, ft as GH_SEGMENT, g as WorkflowLabelName, h as WorkflowCommentBody, ht as repoParts, it as TeamReviewThreadResult, j as MyPrThreadNode, k as MyPrSearchNode, kt as CoherenceWorkCreated, l as configIssueMessage, lt as FULL_SHA_RE, m as DEFAULT_FACTORY_PROTECTED_PATHS, mt as REPO_SLUG_RE, nt as TeamReviewStatus, o as PersistedTaskTitle, ot as canApproveAfterComment, p as DEFAULT_FACTORY_CHECKS, pt as NODE_ID_RE, q as ReviewResult, r as BrowserConfig, rt as TeamReviewThreadCommentsResponse, s as RUNTIME_CONFIG_SCALAR_KEYS, st as decisionAsIfApprovalRequired, tt as TeamReviewStateEntry, u as BRANCH_GC_CONTROL_BOOLEAN_KEYS, ut as HEX_SHA_RE, v as WorkflowsSettings, w as MyPrMergeRequest, wt as USAGE_INTEGER_RANGES, x as MyPrKeepMergeableRequest, xt as USAGE_VENDOR_KEYS, y as WorkflowsState, yt as USAGE_BUDGET_KEYS, z as GithubReviewState } from "./config-DTwMFUjx.js";
23
- import { $ as sessionIdFromBranch, A as snapshotEvents, B as classifySessionExit, C as createIngestStore, D as resolveIngestConfig, E as publishEvent, F as adapterBucket, G as nodeMajorVersion, H as decideRemoteTelemetryState, I as buildAiGenerationEvents, J as stableConfigKey, K as parsePosthogReleaseId, L as buildBrowserExceptionProperties, M as FIRST_RUN_NOTICE, N as TELEMETRY_BATCH_URL, O as ringStats, P as TELEMETRY_FLAGS_URL, Q as planWorktreeGc, R as buildExceptionProperties, S as buildContextDigest, T as latestSeq, U as decideTelemetryConsent, V as decideIsDevInstall, W as exceptionFingerprint, X as matchedPrefix, Y as DEFAULT_BRANCH_GC_PREFIXES, Z as planBranchGc, _ as INGEST_SPEC, a as ensureProjectIds, b as DEFAULT_DIGEST_BUDGET_CHARS, d as assetForPlatform, et as usablePrefixes, f as decideRtkInstall, g as verifyDigest, h as isRtkBinaryName, i as createConfigStore, j as localDayKey, k as scrubText, m as installTargetPath, n as DEFAULT_CONFIG, o as generateProjectId, p as findEscapingArchiveMember, q as resolveProjectToken, s as glimmervoidHomeDir$1, t as ABORT_CONFIG_SAVE, tt as worktreeIntegrationTips, v as mergeSettingsBlock, w as enabledSourceNames, x as SOURCE_DEFAULTS, y as validateSettingsBlock, z as buildFactoryDecisionEvent } from "./config-store-D0lRWsAM.js";
24
- import { $ as FactoryHarnessVerdict, A as BenchmarkActionRequest, B as PrCheckoutCaseInput, C as IssueKey, D as IssuesStatus, E as IssuesState, F as BenchmarkStatus, G as TelemetryState, H as PendingCrashReport, I as BenchmarkSuite, J as FACTORY_ERROR_MAX_CHARS, K as FACTORY_DECISION_OUTPUT_MAX_BYTES, L as CommitComparison, M as BenchmarkId, N as BenchmarkJudgement, O as ChangeMap, P as BenchmarkRun, Q as FactoryHarnessStateLine, R as MergedPrListing, S as GithubIssueResponse, T as IssuesSearchResponse, U as TELEMETRY_EVENT_SCHEMAS, X as FactoryConsequences, Y as FACTORY_PROTECTED_PATH_FLOOR, Z as FactoryControlRequest, _ as PlanDecision, a as ClientMessage, at as FactoryWorkerEvent, b as planTitle, c as UpdateJournal, d as TraceRecord, et as FactoryLaneState, f as PLAN_BODY_CAP_BYTES, g as PLAN_TOOL_NAME, h as PLAN_RESULT_HOOK_EVENT, i as CONTROL_FRAME_MAX_BYTES, it as FactoryReviewerOutput, j as BenchmarkCase, k as changeMapFactId, l as MAX_RAW_LINE_CHARS, m as PLAN_HOOK_OUTPUT_MAX_CHARS, n as HookEnvelope, nt as FactoryQueueIntentRequest, o as DIFF_ANNOTATION_NOTE_MAX_CHARS, ot as isSingleFactoryPathSegment, p as PLAN_HOOK_EVENT, q as FactoryDecisionLogLine, r as parseDataClientMessage, rt as FactoryReviewVerdict, s as InstallFlavor, t as HTTP_URL_RE, tt as FactoryProjectState, u as TraceCheckpoint, v as PlanRevision, w as IssueUpdate, x as GithubIssuePullRequestsRepository, y as parseExitPlanModeHookPayload, z as MinedPrReviewData } from "./contracts-DZV9H8px.js";
25
- import { a as describeAgentResolvability, c as isKnownAgentId, d as setCustomAgents, f as claudeCode, i as customAgentFingerprint, l as listAgentIds, n as cachedAgentResolvability, o as getAdapter, r as commandFor, s as hookProfileOf, t as DEFAULT_AGENT_ID, u as resolveAdapter } from "./adapters-D-cRFZ_Q.js";
19
+ import { o as permitsHelpCommand, r as describeSessionLimits } from "./session-routes-BYy3am9m.js";
20
+ import { a as decideSpawnAllowance, c as describePushLanding, d as isOrchestratorAgentVerb, f as parseAgentVerb, i as decideEditAllowance, l as describePushRouteRefusal, n as decideAgentRequest, o as decideTicketAction, r as decideAttentionAllowance, s as deriveChildSessionName, t as REFUSAL_REASON } from "./agent-api-core-D1233u1U.js";
21
+ import { s as GLIMMERVOID_SECRET_KEYS } from "./grok-KKgdSe-7.js";
22
+ import { _ as isQueueAdmissionTimeout, a as jsonStateLoadError, c as loadedJsonValue, d as writeJsonAtomicSync, f as writeTextAtomic, g as createSpawnGate, h as createSerialQueue, i as createJsonStateWriter, m as createKeyedSerialQueue, n as appendJsonLines, o as loadJsonStateFile, p as writeTextAtomicSync, r as createJsonStateStore, s as loadJsonStateFileSync, t as appendJsonLine, u as writeJsonAtomic } from "./json-file-BaxGcB2R.js";
23
+ import { $ as TeamReviewCompareFiles, A as MyPrSearchResponse, At as CoherenceWorkInspect, B as PostingPlan, C as MyPrMergeMethod, Ct as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, D as MyPrMergeWhenReadyRequest, E as MyPrMergeStateResponse, F as CommitSha, G as ReviewDraft, H as QueuedReview, I as DECIDING_REVIEW_STATES, J as ReviewThreadId, K as ReviewFinding, L as FindingSeverity, M as MyPrThreadsResponse, N as MyPrsState, Ot as CoherenceTicketCreated, P as MyPrsStatus, R as GithubReviewDecision, Tt as CoherenceOrient, U as ReviewChecksState, V as PrDetail, W as ReviewComment, X as SearchedPr, Y as ReviewVerdict, Z as TeamReviewActionRequest, _ as WorkflowSearchNode, a as ConfigUpdate, at as TeamReviewThreadsRepository, b as MyPrAutoRebase, bt as USAGE_COST_MODES, c as TASK_TITLE_SOURCE_PRIORITY, ct as hasStandingViewerApproval, d as BRANCH_GC_CONTROL_NUMERIC_KEYS, dt as shortSha$1, et as TeamReviewResolveResponse, ft as GH_SEGMENT, g as WorkflowLabelName, h as WorkflowCommentBody, ht as repoParts, it as TeamReviewThreadResult, j as MyPrThreadNode, k as MyPrSearchNode, kt as CoherenceWorkCreated, l as configIssueMessage, lt as FULL_SHA_RE, m as DEFAULT_FACTORY_PROTECTED_PATHS, mt as REPO_SLUG_RE, nt as TeamReviewStatus, o as PersistedTaskTitle, ot as canApproveAfterComment, p as DEFAULT_FACTORY_CHECKS, pt as NODE_ID_RE, q as ReviewResult, r as BrowserConfig, rt as TeamReviewThreadCommentsResponse, s as RUNTIME_CONFIG_SCALAR_KEYS, st as decisionAsIfApprovalRequired, tt as TeamReviewStateEntry, u as BRANCH_GC_CONTROL_BOOLEAN_KEYS, ut as HEX_SHA_RE, v as WorkflowsSettings, w as MyPrMergeRequest, wt as USAGE_INTEGER_RANGES, x as MyPrKeepMergeableRequest, xt as USAGE_VENDOR_KEYS, y as WorkflowsState, yt as USAGE_BUDGET_KEYS, z as GithubReviewState } from "./config-rPbbL4nW.js";
24
+ import { $ as sessionIdFromBranch, A as snapshotEvents, B as classifySessionExit, C as createIngestStore, D as resolveIngestConfig, E as publishEvent, F as adapterBucket, G as nodeMajorVersion, H as decideRemoteTelemetryState, I as buildAiGenerationEvents, J as stableConfigKey, K as parsePosthogReleaseId, L as buildBrowserExceptionProperties, M as FIRST_RUN_NOTICE, N as TELEMETRY_BATCH_URL, O as ringStats, P as TELEMETRY_FLAGS_URL, Q as planWorktreeGc, R as buildExceptionProperties, S as buildContextDigest, T as latestSeq, U as decideTelemetryConsent, V as decideIsDevInstall, W as exceptionFingerprint, X as matchedPrefix, Y as DEFAULT_BRANCH_GC_PREFIXES, Z as planBranchGc, _ as INGEST_SPEC, a as ensureProjectIds, b as DEFAULT_DIGEST_BUDGET_CHARS, d as assetForPlatform, et as usablePrefixes, f as decideRtkInstall, g as verifyDigest, h as isRtkBinaryName, i as createConfigStore, it as isSameDirectoryPath, j as localDayKey, k as scrubText, m as installTargetPath, n as DEFAULT_CONFIG, nt as canonicalizePath, o as generateProjectId, p as findEscapingArchiveMember, q as resolveProjectToken, rt as comparableDirectoryPath, s as glimmervoidHomeDir$1, t as ABORT_CONFIG_SAVE, tt as worktreeIntegrationTips, v as mergeSettingsBlock, w as enabledSourceNames, x as SOURCE_DEFAULTS, y as validateSettingsBlock, z as buildFactoryDecisionEvent } from "./config-store-BtsYbNC3.js";
25
+ import { $ as FactoryHarnessVerdict, A as BenchmarkActionRequest, B as PrCheckoutCaseInput, C as IssueKey, D as IssuesStatus, E as IssuesState, F as BenchmarkStatus, G as TelemetryState, H as PendingCrashReport, I as BenchmarkSuite, J as FACTORY_ERROR_MAX_CHARS, K as FACTORY_DECISION_OUTPUT_MAX_BYTES, L as CommitComparison, M as BenchmarkId, N as BenchmarkJudgement, O as ChangeMap, P as BenchmarkRun, Q as FactoryHarnessStateLine, R as MergedPrListing, S as GithubIssueResponse, T as IssuesSearchResponse, U as TELEMETRY_EVENT_SCHEMAS, X as FactoryConsequences, Y as FACTORY_PROTECTED_PATH_FLOOR, Z as FactoryControlRequest, _ as PlanDecision, a as ClientMessage, at as FactoryWorkerEvent, b as planTitle, c as UpdateJournal, d as TraceRecord, et as FactoryLaneState, f as PLAN_BODY_CAP_BYTES, g as PLAN_TOOL_NAME, h as PLAN_RESULT_HOOK_EVENT, i as CONTROL_FRAME_MAX_BYTES, it as FactoryReviewerOutput, j as BenchmarkCase, k as changeMapFactId, l as MAX_RAW_LINE_CHARS, m as PLAN_HOOK_OUTPUT_MAX_CHARS, n as HookEnvelope, nt as FactoryQueueIntentRequest, o as DIFF_ANNOTATION_NOTE_MAX_CHARS, ot as isSingleFactoryPathSegment, p as PLAN_HOOK_EVENT, q as FactoryDecisionLogLine, r as parseDataClientMessage, rt as FactoryReviewVerdict, s as InstallFlavor, t as HTTP_URL_RE, tt as FactoryProjectState, u as TraceCheckpoint, v as PlanRevision, w as IssueUpdate, x as GithubIssuePullRequestsRepository, y as parseExitPlanModeHookPayload, z as MinedPrReviewData } from "./contracts-DjIgIuDk.js";
26
+ import { A as claudeCode, C as laneSpendStatus, D as shouldEvaluateDespiteIoFailures, E as resolveProjectsDirs, O as shouldPersistWarehouse, S as isUsageFile, T as projectDirCandidates, _ as decideFileRead, a as describeAgentResolvability, b as grokHomes, c as isKnownAgentId, d as setCustomAgents, f as codexFallbackRoots, g as continuationDelayMs, h as codexSessionIdFromPath, i as customAgentFingerprint, k as splitLines$1, l as listAgentIds, m as codexRootCandidates, n as cachedAgentResolvability, o as getAdapter, p as codexHomes, r as commandFor, s as hookProfileOf, t as DEFAULT_AGENT_ID, u as resolveAdapter, v as dedupeCodexFiles, w as passOutcome, x as grokRootCandidates, y as expandTilde } from "./adapters-CADejSpq.js";
26
27
  import { t as HOOK_TOOLS } from "./hook-tools-UX2fmt81.js";
27
28
  import { a as formatSshPublicKey, c as orderAgentSockets, i as commitSigningShimText, l as parseSshPublicKey, n as NO_AGENT_HOLDS_KEY, o as isForwardedAgentDirName, r as agentListsKey, s as isSignableGitObject, t as COMMIT_SIGNING_SHIM_NAME } from "./ssh-signing-core-CRhVVWNW.js";
28
- import { a as configSiblingPath, c as defaultPairingsPath, d as decideDeviceAuth, f as deviceNameFromUserAgent, l as defaultSeenPath, n as normalizeRemoteConfig, o as createPairingsStore, p as hashSecret, r as validateRemoteConfig, s as createSeenStore, t as decideBindHost, u as DEFAULT_DEVICE_MAX_AGE_MS } from "./remote-config-Y6YtqoiO.js";
29
- import { _ as escapeMarkup, g as createLaneLog, n as createVisionsSetup } from "./visions-setup-CfgNHiG3.js";
30
- import { t as getRtkPath } from "./rtk-resolver-jJxy_Mrt.js";
29
+ import { a as configSiblingPath, c as defaultPairingsPath, d as decideDeviceAuth, f as deviceNameFromUserAgent, l as defaultSeenPath, n as normalizeRemoteConfig, o as createPairingsStore, p as hashSecret, r as validateRemoteConfig, s as createSeenStore, t as decideBindHost, u as DEFAULT_DEVICE_MAX_AGE_MS } from "./remote-config-Dd1T-VJA.js";
30
+ import { _ as escapeMarkup, g as createLaneLog, n as createVisionsSetup } from "./visions-setup-B-ZeRdsi.js";
31
+ import { t as getRtkPath } from "./rtk-resolver-B9pzjLsM.js";
31
32
  import { createRequire } from "node:module";
32
33
  import fs, { constants, readFileSync } from "node:fs";
33
34
  import path from "node:path";
34
- import { stripVTControlCharacters } from "node:util";
35
35
  import os from "node:os";
36
36
  import { z } from "zod";
37
+ import { stripVTControlCharacters } from "node:util";
37
38
  import http from "node:http";
38
39
  import { WebSocketServer } from "ws";
39
40
  import crypto, { createHash, randomBytes, randomUUID } from "node:crypto";
@@ -1418,7 +1419,7 @@ function isUploadFilename(name) {
1418
1419
  return UPLOAD_FILENAME_RE.test(name);
1419
1420
  }
1420
1421
  //#endregion
1421
- //#region server/backend-http.ts
1422
+ //#region server/backend/backend-http.ts
1422
1423
  var HOOK_BODY_CAP_BYTES = 65536;
1423
1424
  var UNNAMED_HOOK_EVENT = "an unknown event";
1424
1425
  var KNOWN_HOOK_EVENTS = /* @__PURE__ */ new Set([
@@ -2036,7 +2037,7 @@ function projectSessionSnapshots(source) {
2036
2037
  };
2037
2038
  }
2038
2039
  //#endregion
2039
- //#region server/core/sandbox-roles-core.ts
2040
+ //#region server/sandbox/core/sandbox-roles-core.ts
2040
2041
  var SESSION_VENDORS = Object.freeze(["claude", "codex"]);
2041
2042
  var CONFINED_SESSION_VENDORS = Object.freeze(["claude"]);
2042
2043
  var LANE_CREDENTIAL_ENV = Object.freeze({
@@ -2117,7 +2118,7 @@ function isWorktreeAdminDirOf({ adminDir, commonGitDir }) {
2117
2118
  return path.dirname(path.resolve(adminDir)) === path.resolve(commonGitDir, "worktrees");
2118
2119
  }
2119
2120
  //#endregion
2120
- //#region server/ephemeral-session.ts
2121
+ //#region server/lanes/ephemeral-session.ts
2121
2122
  var JOB_RESULT_FILENAME = "result.json";
2122
2123
  var ABORT_REAP_CAP_MS = 3e3;
2123
2124
  async function awaitSessionExit(sess, { signal = null, spawnGate = null, reapCapMs = ABORT_REAP_CAP_MS } = {}) {
@@ -2275,7 +2276,11 @@ var SPAWN_FAILED_MESSAGE = "could not spawn the session";
2275
2276
  function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoardSessions, makeSession, wireSessionEvents, closeSessionDataClients, broadcastControl, spawnGate, sessionDocs, recordLane = null, logger = console }) {
2276
2277
  async function spawn(parent, request) {
2277
2278
  const budget = parent.agentSpawnBudget();
2278
- const allowance = decideSpawnAllowance(budget);
2279
+ const allowance = decideSpawnAllowance({
2280
+ ...budget,
2281
+ isFactoryWorker: parent.factoryRole === "worker",
2282
+ isEphemeral: parent.ephemeral
2283
+ });
2279
2284
  if (!allowance.ok) return {
2280
2285
  ok: false,
2281
2286
  status: allowance.status,
@@ -2367,8 +2372,28 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
2367
2372
  parent.finishAgentSpawn();
2368
2373
  }
2369
2374
  }
2370
- function attention(parent, request) {
2371
- return parent.noteAttention(request.note);
2375
+ function roleFactsOf(session) {
2376
+ return {
2377
+ isEphemeral: session.ephemeral,
2378
+ isSpawnedChild: agentSessions.has(session.id) && session.id.startsWith(`${AGENT_LANE_TAG}-`),
2379
+ factoryRole: session.factoryRole,
2380
+ hasOwnWorktree: session.hasOwnWorktree
2381
+ };
2382
+ }
2383
+ function attention(session, request) {
2384
+ const allowance = decideAttentionAllowance(roleFactsOf(session));
2385
+ if (!allowance.ok) return {
2386
+ status: allowance.status,
2387
+ body: {
2388
+ ok: false,
2389
+ error: allowance.reason
2390
+ }
2391
+ };
2392
+ const reply = session.noteAttention(request.note);
2393
+ return {
2394
+ status: reply.ok ? 200 : 429,
2395
+ body: reply
2396
+ };
2372
2397
  }
2373
2398
  function board() {
2374
2399
  return listBoardSessions().map((session) => ({
@@ -2379,12 +2404,18 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
2379
2404
  ephemeral: session.ephemeral
2380
2405
  }));
2381
2406
  }
2407
+ function limits(session) {
2408
+ return {
2409
+ ok: true,
2410
+ ...describeSessionLimits({
2411
+ ...roleFactsOf(session),
2412
+ isSandboxed: session.isConfined
2413
+ })
2414
+ };
2415
+ }
2382
2416
  async function push(session) {
2383
- const isSpawnedChild = agentSessions.has(session.id) && session.id.startsWith(`${AGENT_LANE_TAG}-`);
2384
- if (session.ephemeral && !isSpawnedChild) return describePushLanding({
2385
- merged: false,
2386
- reason: PUSH_UNAVAILABLE_REASON
2387
- });
2417
+ const routeRefusal = describePushRouteRefusal(roleFactsOf(session));
2418
+ if (routeRefusal) return routeRefusal;
2388
2419
  return describePushLanding(await session.mergeAndContinue({ force: true }));
2389
2420
  }
2390
2421
  async function handle(session, verb, payload) {
@@ -2411,14 +2442,20 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
2411
2442
  }
2412
2443
  };
2413
2444
  if (parsed.verb === "push") return push(session);
2414
- if (parsed.verb === "attention") {
2415
- const reply = attention(session, parsed.request);
2416
- return {
2417
- status: reply.ok ? 200 : 429,
2418
- body: reply
2419
- };
2420
- }
2445
+ if (parsed.verb === "limits") return {
2446
+ status: 200,
2447
+ body: limits(session)
2448
+ };
2449
+ if (parsed.verb === "attention") return attention(session, parsed.request);
2421
2450
  if (parsed.verb === "edit") {
2451
+ const allowance = decideEditAllowance(roleFactsOf(session));
2452
+ if (!allowance.ok) return {
2453
+ status: allowance.status,
2454
+ body: {
2455
+ ok: false,
2456
+ error: allowance.reason
2457
+ }
2458
+ };
2422
2459
  const reply = await sessionDocs.surface(session, parsed.request);
2423
2460
  if (!reply.ok) return {
2424
2461
  status: 400,
@@ -2453,7 +2490,7 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
2453
2490
  return { handle };
2454
2491
  }
2455
2492
  //#endregion
2456
- //#region server/control-replay-core.ts
2493
+ //#region server/core/control-replay-core.ts
2457
2494
  var REPLAYABLE_EXACT = /* @__PURE__ */ new Set([
2458
2495
  "notify",
2459
2496
  "session-error",
@@ -2516,8 +2553,8 @@ var REFRESHABLE_TYPES = /* @__PURE__ */ new Set([
2516
2553
  "plan-limits",
2517
2554
  "ingest-activity",
2518
2555
  "ingest-snapshot",
2519
- "posthog-status",
2520
- "posthog-investigation-activity",
2556
+ "radar-status",
2557
+ "radar-investigation-activity",
2521
2558
  "session-trace-changed",
2522
2559
  "session-plan-changed"
2523
2560
  ]);
@@ -2798,7 +2835,7 @@ function createWsSender(ws, opts = {}) {
2798
2835
  };
2799
2836
  }
2800
2837
  //#endregion
2801
- //#region server/backend-websockets.ts
2838
+ //#region server/backend/backend-websockets.ts
2802
2839
  function sendControlFrame(client, payload, type, logger) {
2803
2840
  if (client.readyState !== 1) return;
2804
2841
  const decision = decideControlSend({
@@ -3034,7 +3071,7 @@ function createBackendWebSockets(dependencies) {
3034
3071
  };
3035
3072
  }
3036
3073
  //#endregion
3037
- //#region server/backend-shutdown.ts
3074
+ //#region server/backend/backend-shutdown.ts
3038
3075
  function destroySessions(sessionMaps, pendingReaps) {
3039
3076
  for (const sessions of sessionMaps) for (const session of sessions.values()) {
3040
3077
  session.destroy();
@@ -3300,7 +3337,7 @@ function createRemoteAuth({ remote, pairingsStore, seenStore = null, now = Date.
3300
3337
  };
3301
3338
  }
3302
3339
  //#endregion
3303
- //#region server/backend-trust.ts
3340
+ //#region server/backend/backend-trust.ts
3304
3341
  function bootError(message) {
3305
3342
  return Object.assign(new Error(message), { glimmervoidBoot: true });
3306
3343
  }
@@ -3452,7 +3489,7 @@ function decideAcknowledge(isAcknowledgeDeferred, from, event, isIdleCompactionA
3452
3489
  };
3453
3490
  }
3454
3491
  //#endregion
3455
- //#region server/core/session-registry-core.ts
3492
+ //#region server/session/core/session-registry-core.ts
3456
3493
  function machineSkipsPermissionsByDefault(config) {
3457
3494
  return "skipPermissionsByDefault" in config && config.skipPermissionsByDefault === true;
3458
3495
  }
@@ -3518,7 +3555,7 @@ function diffProjects(currentSessions, newProjects, dependencies) {
3518
3555
  };
3519
3556
  }
3520
3557
  //#endregion
3521
- //#region server/core/usage-lane-core.ts
3558
+ //#region server/usage/core/usage-lane-core.ts
3522
3559
  var INTERACTIVE_LANE = "interactive";
3523
3560
  var FIVE_HOUR_WINDOW_MS = 18e6;
3524
3561
  var SEVEN_DAY_WINDOW_MS = 6048e5;
@@ -3911,7 +3948,7 @@ function looksBinary(buf) {
3911
3948
  return false;
3912
3949
  }
3913
3950
  //#endregion
3914
- //#region server/git-exec.ts
3951
+ //#region server/git/git-exec.ts
3915
3952
  var DEFAULT_COMMAND_TIMEOUT_MS = 2e4;
3916
3953
  function outputText(value) {
3917
3954
  if (typeof value === "string") return value;
@@ -4225,7 +4262,7 @@ async function runPostTurnChecks({ cwd, config, sessionId, deps = {} } = {}) {
4225
4262
  return finalReport;
4226
4263
  }
4227
4264
  //#endregion
4228
- //#region server/session-event-wiring.ts
4265
+ //#region server/session/session-event-wiring.ts
4229
4266
  var IDLE_COMPACTION_CONFIRM_MS = 1e4;
4230
4267
  function waitingCopy(name, context) {
4231
4268
  if (context.planTitle) return `${name} has a plan ready for review: ${context.planTitle}`;
@@ -4783,7 +4820,7 @@ function decideMarkerBase({ marker, fallbackBase, configuredIntegrationBranch, d
4783
4820
  };
4784
4821
  }
4785
4822
  //#endregion
4786
- //#region server/session-registry.ts
4823
+ //#region server/session/session-registry.ts
4787
4824
  function runAutoResume(sessions, config, spawnGate, logger = console) {
4788
4825
  const ids = pickAutoResume(config.projects, config);
4789
4826
  const runs = [];
@@ -5369,7 +5406,7 @@ function intentPayload(state) {
5369
5406
  };
5370
5407
  }
5371
5408
  //#endregion
5372
- //#region server/core/visions-touch-core.ts
5409
+ //#region server/visions/core/visions-touch-core.ts
5373
5410
  function createTouchState() {
5374
5411
  return {
5375
5412
  touchedByUri: /* @__PURE__ */ new Map(),
@@ -5591,7 +5628,7 @@ function formatTouchedRanges(ranges) {
5591
5628
  return (Array.isArray(ranges) ? ranges : []).map((range) => range.start === range.end ? `${range.start}` : `${range.start}-${range.end}`).join(", ");
5592
5629
  }
5593
5630
  //#endregion
5594
- //#region server/core/visions-dispatch-core.ts
5631
+ //#region server/visions/core/visions-dispatch-core.ts
5595
5632
  var DEFAULT_QUIET_MS = 3e4;
5596
5633
  var DEFAULT_COOLDOWN_MS = 3e5;
5597
5634
  var DEFAULT_DISPATCH_MODEL = "opus";
@@ -6216,7 +6253,7 @@ function buildVisionsPrompt({ uri, text, findings = [], intent = "", digest = ""
6216
6253
  ].join("\n");
6217
6254
  }
6218
6255
  //#endregion
6219
- //#region server/core/team-review-threads-core.ts
6256
+ //#region server/github/core/team-review-threads-core.ts
6220
6257
  var THREAD_JUDGE_BACKOFF_MS = 9e5;
6221
6258
  var THREAD_PLACEHOLDER_ERROR = "No local review draft. Review the answered threads below.";
6222
6259
  var THREAD_COMMENTS_MAX_CHARS = 2e4;
@@ -6340,7 +6377,7 @@ function parseThreadJudgeResult(raw) {
6340
6377
  return parsed.success ? parsed.data : null;
6341
6378
  }
6342
6379
  //#endregion
6343
- //#region server/core/github-teams-core.ts
6380
+ //#region server/github/core/github-teams-core.ts
6344
6381
  function readGithubTeams(config) {
6345
6382
  const configuredTeams = config.github?.teams;
6346
6383
  if (!configuredTeams?.length) {
@@ -6368,9 +6405,11 @@ function readGithubTeams(config) {
6368
6405
  return [...teamsByName.values()];
6369
6406
  }
6370
6407
  //#endregion
6371
- //#region server/core/team-review-core.ts
6408
+ //#region server/github/core/team-review-core.ts
6372
6409
  var STAMP_MODEL = "sonnet";
6373
6410
  var FULL_MODEL = "opus";
6411
+ var STAMP_MAX_LINES = 200;
6412
+ var STAMP_MAX_FILES = 10;
6374
6413
  var REVIEW_TIMEOUT_SECONDS = 2400;
6375
6414
  function advanceAwakeElapsed({ awakeElapsedMs, previousTickAt, nowMs, tickMs }) {
6376
6415
  return awakeElapsedMs + Math.min(Math.max(0, nowMs - previousTickAt), 2 * tickMs);
@@ -6542,13 +6581,13 @@ function triagePr(detail) {
6542
6581
  }
6543
6582
  const countedFiles = detail.files.filter((file) => !isExcludedFromSize(file.path));
6544
6583
  const countedLines = countedFiles.reduce((total, file) => total + file.additions + file.deletions, 0);
6545
- if (countedLines > 200) return {
6584
+ if (countedLines > STAMP_MAX_LINES) return {
6546
6585
  tier: "full",
6547
- reasons: [`${countedLines} counted lines over 200`]
6586
+ reasons: [`${countedLines} counted lines over ${STAMP_MAX_LINES}`]
6548
6587
  };
6549
- if (countedFiles.length > 10) return {
6588
+ if (countedFiles.length > STAMP_MAX_FILES) return {
6550
6589
  tier: "full",
6551
- reasons: [`${countedFiles.length} counted files over 10`]
6590
+ reasons: [`${countedFiles.length} counted files over ${STAMP_MAX_FILES}`]
6552
6591
  };
6553
6592
  if (countedFiles.length === 0 && detail.files.length > 0 && detail.files.every((file) => isDocsOrTests(file.path))) return {
6554
6593
  tier: "stamp",
@@ -7422,7 +7461,7 @@ function absolutePathReadRule(absolutePath) {
7422
7461
  return `Read(/${absolutePath.replace(/\\/g, "/").replace(/^([A-Za-z]):/, (_drive, driveLetter) => `/${driveLetter.toLowerCase()}`).replace(/\/+$/, "")}/**)`;
7423
7462
  }
7424
7463
  //#endregion
7425
- //#region server/core/issues-core.ts
7464
+ //#region server/github/core/issues-core.ts
7426
7465
  var ISSUES_LANE_ID = "issues";
7427
7466
  var ISSUES_STATE_FILENAME = "issues-cache.json";
7428
7467
  var MAX_TOTAL_ISSUES = 1e3;
@@ -7565,7 +7604,7 @@ function issuesStatus({ ts, configured, reason = null, issues = [], lastSyncAt =
7565
7604
  });
7566
7605
  }
7567
7606
  //#endregion
7568
- //#region server/core/lane-backoff.ts
7607
+ //#region server/lanes/core/lane-backoff.ts
7569
7608
  var QUICK_RETRY_DELAYS_MS = Object.freeze([
7570
7609
  1e4,
7571
7610
  3e4,
@@ -7605,7 +7644,7 @@ function secondaryRateLimitWaitMs(errorText) {
7605
7644
  return Math.max(SECONDARY_RATE_LIMIT_MIN_WAIT_MS, retryAfterMs);
7606
7645
  }
7607
7646
  //#endregion
7608
- //#region server/lane-runner.ts
7647
+ //#region server/lanes/lane-runner.ts
7609
7648
  function createTickLoop({ tag, quickRetries = false, onScheduleChange = () => {}, rateLimitWaitMs = async () => null, intervalMs, tick: tickBody, writeState = async () => {}, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, clock, firstTickDelayMs = () => 0, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, backoffBaseMs = Math.max(intervalMs, DEFAULT_BASE_MS), backoffMaxMs = DEFAULT_MAX_MS, now = Date.now, random = Math.random, log = console }) {
7610
7649
  let timer = null;
7611
7650
  let unschedule = null;
@@ -7872,7 +7911,7 @@ function createLaneRunner({ tag, gate, cfgKey, emptyStatus, createPoller, broadc
7872
7911
  };
7873
7912
  }
7874
7913
  //#endregion
7875
- //#region server/core/github-rate-limit-core.ts
7914
+ //#region server/github/core/github-rate-limit-core.ts
7876
7915
  var RateLimitResource = z.object({
7877
7916
  remaining: z.number(),
7878
7917
  reset: z.number()
@@ -7885,7 +7924,7 @@ function githubRateLimitWaitMs(resources, nowMs, resourceNames) {
7885
7924
  return Math.max(...exhaustedResetsMs);
7886
7925
  }
7887
7926
  //#endregion
7888
- //#region server/issues-poller.ts
7927
+ //#region server/github/issues-poller.ts
7889
7928
  function createIssuesPoller(dependencies) {
7890
7929
  const { teams, github, onTickComplete, now = Date.now, log = console } = dependencies;
7891
7930
  let state = emptyIssuesState();
@@ -8063,7 +8102,7 @@ function bootStaggerDelay() {
8063
8102
  return bootStaggerDelayMs(process.uptime() * 1e3, Math.random());
8064
8103
  }
8065
8104
  //#endregion
8066
- //#region server/pr-gh.ts
8105
+ //#region server/github/pr-gh.ts
8067
8106
  var GH_MERGE_FLAGS = {
8068
8107
  MERGE: "--merge",
8069
8108
  SQUASH: "--squash",
@@ -9297,7 +9336,7 @@ function createPrGh(cwd, commandRunner = run) {
9297
9336
  };
9298
9337
  }
9299
9338
  //#endregion
9300
- //#region server/issues-wiring.ts
9339
+ //#region server/github/issues-wiring.ts
9301
9340
  function createIssuesStateIo(statePath, log) {
9302
9341
  let loaded = emptyIssuesState();
9303
9342
  let hasLoaded = false;
@@ -10642,190 +10681,6 @@ async function readTranscriptTaskTitle(transcriptPath) {
10642
10681
  }
10643
10682
  }
10644
10683
  //#endregion
10645
- //#region server/core/usage-scan-core.ts
10646
- function laneSpendStatus({ isTrackingEnabled, scan }) {
10647
- if (!isTrackingEnabled) return "tracking-off";
10648
- if (scan === null) return "scanner-missing";
10649
- if (scan.lastOutcome === "io-failed") return "read-failing";
10650
- if (!scan.isHistoryCaughtUp || scan.lastOutcome === null) return "catching-up";
10651
- return "known";
10652
- }
10653
- function decideFileRead(prior, stat) {
10654
- if (!prior) return {
10655
- action: "restart",
10656
- readFrom: 0
10657
- };
10658
- if (!stat || typeof stat.size !== "number") return {
10659
- action: "skip",
10660
- readFrom: prior.offset || 0
10661
- };
10662
- if (stat.size < (prior.size || 0)) return {
10663
- action: "restart",
10664
- readFrom: 0
10665
- };
10666
- if (stat.size < (prior.offset || 0)) return {
10667
- action: "restart",
10668
- readFrom: 0
10669
- };
10670
- if (stat.size === (prior.offset || 0) && stat.mtimeMs === prior.mtimeMs) return {
10671
- action: "skip",
10672
- readFrom: prior.offset || 0
10673
- };
10674
- return {
10675
- action: "append",
10676
- readFrom: prior.offset || 0
10677
- };
10678
- }
10679
- function splitLines$1(carry, chunkText) {
10680
- const text = `${carry || ""}${chunkText || ""}`;
10681
- const lines = text.split(/\r?\n/);
10682
- const nextCarry = text.endsWith("\n") || text.endsWith("\r\n") ? "" : lines.pop();
10683
- return {
10684
- lines: lines.filter((line) => line.length > 0),
10685
- carry: nextCarry || ""
10686
- };
10687
- }
10688
- function resolveProjectsDirs(env = process.env, extraDirs = [], isDirectory, homeDir = null) {
10689
- if (typeof isDirectory !== "function") throw new TypeError("resolveProjectsDirs requires an isDirectory function");
10690
- const surviving = projectDirCandidates(env, extraDirs, homeDir).filter(isDirectory);
10691
- if (!configDirOverride(env)) return surviving;
10692
- if (projectDirCandidates(env, [], homeDir).filter(isDirectory).length === 0) throw new Error("CLAUDE_CONFIG_DIR is set but no projects directory exists");
10693
- return surviving;
10694
- }
10695
- function projectDirCandidates(env = process.env, extraDirs = [], homeDir = null) {
10696
- const override = configDirOverride(env);
10697
- const extraHomes = normalizeHomeCandidates(extraDirs, env, homeDir);
10698
- if (override) return uniqueStrings([...projectsDirsFromHomes(normalizeHomeCandidates(override.split(","), env, homeDir)), ...projectsDirsFromHomes(extraHomes)]);
10699
- const resolvedHomeDir = resolveHomeDir$1(env, homeDir);
10700
- if (!resolvedHomeDir) return uniqueStrings(projectsDirsFromHomes(extraHomes));
10701
- const xdgConfigHome = rawTextOr(env.XDG_CONFIG_HOME, null) || path.join(resolvedHomeDir, ".config");
10702
- return uniqueStrings([...projectsDirsFromHomes([path.join(xdgConfigHome, "claude"), path.join(resolvedHomeDir, ".claude")]), ...projectsDirsFromHomes(extraHomes)]);
10703
- }
10704
- function configDirOverride(env) {
10705
- return (typeof env.CLAUDE_CONFIG_DIR === "string" ? env.CLAUDE_CONFIG_DIR : "").trim();
10706
- }
10707
- function projectsDirsFromHomes(homes) {
10708
- const projectsDirs = [];
10709
- for (const candidate of homes) {
10710
- const home = path.basename(candidate) === "projects" ? path.dirname(candidate) : candidate;
10711
- const projectsDir = path.join(home, "projects");
10712
- projectsDirs.push(projectsDir);
10713
- }
10714
- return projectsDirs;
10715
- }
10716
- function normalizeHomeCandidates(candidates, env, homeDir) {
10717
- if (!Array.isArray(candidates)) return [];
10718
- return candidates.map((candidate) => expandTilde(String(candidate || "").trim(), env, homeDir)).filter(Boolean);
10719
- }
10720
- function expandTilde(candidate, env, homeDir) {
10721
- if (!candidate.startsWith("~")) return candidate;
10722
- const home = resolveHomeDir$1(env, homeDir);
10723
- if (!home) return "";
10724
- if (candidate === "~") return home;
10725
- if (!candidate.startsWith(`~${path.sep}`) && !candidate.startsWith("~/")) return candidate;
10726
- return path.join(home, candidate.slice(2));
10727
- }
10728
- function resolveHomeDir$1(env, homeDir) {
10729
- return rawTextOr(env.HOME, null) || rawTextOr(env.USERPROFILE, null) || homeDir;
10730
- }
10731
- function uniqueStrings(values) {
10732
- return Array.from(new Set(values));
10733
- }
10734
- function passOutcome({ byteLimited, ioFailures }) {
10735
- if (ioFailures > 0) return "io-failed";
10736
- if (byteLimited) return "byte-limited";
10737
- return "complete";
10738
- }
10739
- function shouldPersistWarehouse({ outcome, storeReset }) {
10740
- if (outcome === "complete") return true;
10741
- if (outcome === "byte-limited") return false;
10742
- return !storeReset;
10743
- }
10744
- function continuationDelayMs({ outcome, ioFailureStreak, partialMs }) {
10745
- if (outcome === "complete") return null;
10746
- if (outcome === "byte-limited") return partialMs;
10747
- return nextBackoffMs({
10748
- attempt: ioFailureStreak,
10749
- baseMs: 3e4,
10750
- maxMs: 3e5
10751
- });
10752
- }
10753
- function shouldEvaluateDespiteIoFailures({ ioFailureStreak, limit }) {
10754
- if (!Number.isFinite(ioFailureStreak) || !Number.isFinite(limit)) return false;
10755
- if (limit <= 0) return false;
10756
- return ioFailureStreak >= limit;
10757
- }
10758
- function vendorHomes(env, varName, defaultDirName, homeDir) {
10759
- const rawOverride = env?.[varName];
10760
- const override = typeof rawOverride === "string" ? rawOverride.trim() : "";
10761
- if (override) return normalizeHomeCandidates(override.split(","), env, homeDir);
10762
- const home = resolveHomeDir$1(env, homeDir);
10763
- if (!home) return [];
10764
- return [path.join(home, defaultDirName)];
10765
- }
10766
- function codexHomes(env = process.env, homeDir = null) {
10767
- return vendorHomes(env, "CODEX_HOME", ".codex", homeDir);
10768
- }
10769
- function grokHomes(env = process.env, homeDir = null) {
10770
- return vendorHomes(env, "GROK_HOME", ".grok", homeDir);
10771
- }
10772
- function codexRootCandidates(homes) {
10773
- const candidates = [];
10774
- for (const home of homes) {
10775
- candidates.push({
10776
- dir: path.join(home, "sessions"),
10777
- kind: "active",
10778
- home
10779
- });
10780
- candidates.push({
10781
- dir: path.join(home, "archived_sessions"),
10782
- kind: "archived",
10783
- home
10784
- });
10785
- }
10786
- return candidates;
10787
- }
10788
- function codexFallbackRoots(homes, survivingRoots) {
10789
- const covered = new Set(survivingRoots.map((root) => root.home));
10790
- return homes.filter((home) => !covered.has(home)).map((home) => ({
10791
- dir: home,
10792
- kind: "flat",
10793
- home
10794
- }));
10795
- }
10796
- function grokRootCandidates(homes) {
10797
- return homes.map((home) => ({
10798
- dir: path.join(home, "sessions"),
10799
- kind: "active",
10800
- home
10801
- }));
10802
- }
10803
- var GROK_USAGE_FILENAME = "updates.jsonl";
10804
- function isUsageFile(vendor, fileName) {
10805
- if (typeof fileName !== "string") return false;
10806
- if (vendor === "grok") return fileName === GROK_USAGE_FILENAME;
10807
- return fileName.endsWith(".jsonl");
10808
- }
10809
- function dedupeCodexFiles(files) {
10810
- const byName = /* @__PURE__ */ new Map();
10811
- for (const file of files) {
10812
- const name = path.basename(file.file);
10813
- const existing = byName.get(name);
10814
- if (!existing) {
10815
- byName.set(name, file);
10816
- continue;
10817
- }
10818
- if (existing.kind === "archived" && file.kind !== "archived") byName.set(name, file);
10819
- }
10820
- return Array.from(byName.values());
10821
- }
10822
- function codexSessionIdFromPath(filePath) {
10823
- const base = path.basename(String(filePath || ""), ".jsonl");
10824
- const match = /([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/.exec(base);
10825
- if (match) return match[1];
10826
- return base || null;
10827
- }
10828
- //#endregion
10829
10684
  //#region session/core/commit-signing-env.ts
10830
10685
  var GIT_CONFIG_PARAMETERS_ENV = "GIT_CONFIG_PARAMETERS";
10831
10686
  function singleQuoteForGit(text) {
@@ -11643,13 +11498,16 @@ function pushDecision(log, entry, cap = 60) {
11643
11498
  if (log.length > cap) log.splice(0, log.length - cap);
11644
11499
  return "appended";
11645
11500
  }
11501
+ //#endregion
11502
+ //#region session/session-observability.ts
11503
+ var AUDIT_LOG_MAX = 200;
11646
11504
  function createSessionObservability({ agentId, getRecorder }) {
11647
11505
  const auditLog = [];
11648
11506
  const decisions = [];
11649
11507
  function pushAuditEntry(entry) {
11650
11508
  auditLog.push(entry);
11651
- if (auditLog.length <= 200) return;
11652
- auditLog.splice(0, auditLog.length - 200);
11509
+ if (auditLog.length <= AUDIT_LOG_MAX) return;
11510
+ auditLog.splice(0, auditLog.length - AUDIT_LOG_MAX);
11653
11511
  }
11654
11512
  function recordDecision(entry) {
11655
11513
  const stamped = agentId === DEFAULT_AGENT_ID ? entry : {
@@ -11964,7 +11822,7 @@ function createSessionOutput(options) {
11964
11822
  };
11965
11823
  }
11966
11824
  //#endregion
11967
- //#region server/core/ingest-shell-core.ts
11825
+ //#region server/ingest/core/ingest-shell-core.ts
11968
11826
  var SOURCE$4 = "shellHistory";
11969
11827
  var SHELLS = Object.freeze([
11970
11828
  "powershell",
@@ -12643,7 +12501,7 @@ function createSessionHookLifecycle(options) {
12643
12501
  };
12644
12502
  }
12645
12503
  //#endregion
12646
- //#region server/core/lane-permissions-core.ts
12504
+ //#region server/lanes/core/lane-permissions-core.ts
12647
12505
  var ACCEPT_EDITS_MODE = "acceptEdits";
12648
12506
  var LANE_CONFIG_EDIT_DENY_RULES = Object.freeze(["Edit(**/.git/**)", "Edit(**/.claude/**)"]);
12649
12507
  var LANE_ENVIRONMENT_ARGS = Object.freeze([
@@ -12675,7 +12533,7 @@ function buildLanePermissions({ denyTools = [], allowTools = [] } = {}) {
12675
12533
  };
12676
12534
  }
12677
12535
  //#endregion
12678
- //#region server/core/factory-core.ts
12536
+ //#region server/factory/core/factory-core.ts
12679
12537
  var FACTORY_NOTIFY_CATEGORY = "factory";
12680
12538
  var FACTORY_LEDGER_SESSION = "glimmervoid-factory";
12681
12539
  var FACTORY_TICK_INTERVAL_MS = 1e4;
@@ -13652,7 +13510,7 @@ function buildVerifierPrompt({ projectName, intent, children, tipSha, checkoutPa
13652
13510
  ].join("\n");
13653
13511
  }
13654
13512
  //#endregion
13655
- //#region server/core/git-invocation-core.ts
13513
+ //#region server/git/core/git-invocation-core.ts
13656
13514
  var GIT_CONFIG_LISTING_ARGS = Object.freeze([
13657
13515
  "config",
13658
13516
  "--null",
@@ -14042,7 +13900,7 @@ function proveMergedAcrossTips(probes) {
14042
13900
  return mostCautiousProof;
14043
13901
  }
14044
13902
  //#endregion
14045
- //#region server/core/sandbox-policy-core.ts
13903
+ //#region server/sandbox/core/sandbox-policy-core.ts
14046
13904
  var VENDOR_PROFILES = Object.freeze({
14047
13905
  claude: {
14048
13906
  homeEntries: [".claude", ".claude.json"],
@@ -14639,7 +14497,7 @@ function isCheckFresh(lastCheckAt, nowMs, ttlMs) {
14639
14497
  return age < Number(ttlMs);
14640
14498
  }
14641
14499
  //#endregion
14642
- //#region server/git-workspace.ts
14500
+ //#region server/git/git-workspace.ts
14643
14501
  var fsp$1 = fs.promises;
14644
14502
  var MERGE_PROBE_TIMEOUT_MS = 3e4;
14645
14503
  var REMOTE_REF_PREFIX = "refs/remotes/origin/";
@@ -17109,12 +16967,12 @@ function buildMergePrompt({ branch, target, reason, conflicts = [], worktreeDir
17109
16967
  for (const f of files) lines.push(` - ${f}`);
17110
16968
  }
17111
16969
  lines.push("");
16970
+ lines.push("Only rebase this session branch; do not force-push or rewrite any shared history.");
16971
+ lines.push("");
17112
16972
  lines.push(`Glimmervoid merges by rebasing "${br}" onto ${tgt} and then fast-forwarding ${tgt}. To unblock it:`);
17113
16973
  lines.push(` 1. From this worktree${worktreeDir ? ` (${worktreeDir})` : ""}, run: git rebase ${tgt}`);
17114
16974
  lines.push(` 2. Resolve the conflicts${files.length ? " in the files listed above" : ""}, then: git add the resolved files and git rebase --continue.`);
17115
- lines.push(" 3. When the working tree is clean and rebased, tell me it is ready, or click Merge in the Review panel: the merge will fast-forward.");
17116
- lines.push("");
17117
- lines.push("Only rebase this session branch; do not force-push or rewrite any shared history.");
16975
+ lines.push(" 3. When the working tree is clean and rebased, run: glimmervoid push. If it answers no, do what its reply says; when the reply leaves nothing this session can do, say the work is ready and leave the merge to the operator.");
17118
16976
  return lines.join("\n");
17119
16977
  }
17120
16978
  //#endregion
@@ -17383,6 +17241,9 @@ function createSessionWorkspaceMembers({ plan, sessionName, shareList, gitWorksp
17383
17241
  branch: plan.branch
17384
17242
  };
17385
17243
  }
17244
+ //#endregion
17245
+ //#region session/session-worktree-lifecycle.ts
17246
+ var WORKTREE_CHECK_DEBOUNCE_MS = 400;
17386
17247
  var GIT_NOT_FOUND_EXIT_CODE = 1;
17387
17248
  async function readGitStrict(args, options) {
17388
17249
  const command = await runGit(args, {
@@ -17497,7 +17358,7 @@ function createSessionWorktreeLifecycle({ id, projectPath, integrationBranch = n
17497
17358
  rerereWatcher: null,
17498
17359
  checkTimer: createCoalescedTimer({
17499
17360
  mode: "leading",
17500
- delayMs: 400,
17361
+ delayMs: WORKTREE_CHECK_DEBOUNCE_MS,
17501
17362
  run: () => {
17502
17363
  api.checkWorktreeChange().catch(recordWorktreeCheckFailure);
17503
17364
  }
@@ -17534,6 +17395,9 @@ function createSessionWorktreeLifecycle({ id, projectPath, integrationBranch = n
17534
17395
  base: lifecycleState.workspace.base || null
17535
17396
  };
17536
17397
  }
17398
+ function hasOwnWorktree() {
17399
+ return Boolean(gitWorkspace && lifecycleState.workspace);
17400
+ }
17537
17401
  function setMergeStatus(status, detail = {}, { emit = true } = {}) {
17538
17402
  Object.assign(lifecycleState, projectMergeState(status, detail));
17539
17403
  if (!emit) return;
@@ -18605,6 +18469,7 @@ function createSessionWorktreeLifecycle({ id, projectPath, integrationBranch = n
18605
18469
  const api = {
18606
18470
  snapshot,
18607
18471
  getCarry,
18472
+ hasOwnWorktree,
18608
18473
  effectiveCwd,
18609
18474
  refreshGitContext,
18610
18475
  provision,
@@ -19146,10 +19011,10 @@ var Session = class extends EventEmitter {
19146
19011
  _hooks;
19147
19012
  _agentDepth;
19148
19013
  _agentToken;
19149
- _agentApiEnabled;
19150
19014
  _commitSigningProgram;
19151
19015
  _commitSigningToken;
19152
19016
  _factoryRole;
19017
+ _canRunHelpCommand;
19153
19018
  _agentLiveChildren;
19154
19019
  _agentLifetimeSpawns;
19155
19020
  _agentSpawnsInFlight;
@@ -19164,7 +19029,7 @@ var Session = class extends EventEmitter {
19164
19029
  _resizeSeq;
19165
19030
  _titleSource;
19166
19031
  _statusSource;
19167
- constructor({ customTitle, id, name, path: projectPath, dangerouslySkipPermissions = false, replayBufferKB = 512, hookRouter = null, getHookPort = null, hooksBaseDir = void 0, titleStabilizationMs = 1500, statusConflictMs = void 0, statusDedupMs = void 0, detectBackgroundAgents = true, agentTtlMs = DEFAULT_AGENT_TTL_MS, shellTaskTtlMs = DEFAULT_SHELL_TASK_TTL_MS, teammateTaskTtlMs = DEFAULT_TEAMMATE_TASK_TTL_MS, gateReleaseSettleMs = DEFAULT_GATE_RELEASE_SETTLE_MS, detectScheduledWakeups = true, observeToolCalls = false, agent = DEFAULT_AGENT_ID, adapter = null, bypassHookTrust = false, titleQuietFallbackMs = 3e4, spawnCommand = null, initialPrompt = null, extraClaudeArgs = [], ephemeral = false, resumeSessionId = null, taskTitleState = void 0, settingsPermissions = null, settingsSandbox = null, prepareSandbox = null, spawnEnv = null, prependPathDirs = [], enableProjectMcp = false, hookTools = [], getHookTools = null, planReviewPort = null, planLimits = false, getUserHooks = null, extraUserHooks = [], ptySpawn = null, requireWorktree = false, screenKeeperFactory = null, killProc = null, signalProc = null, platform = process.platform, gitWorkspace = null, gitIsolation, integrationBranch = null, autoRebase = true, syncOnStart = true, liveWorktreeReview = true, worktreeRoot = null, worktreeShare = null, workspaceRepos = void 0, agentDepth = 0, agentApi = false, commitSigningProgram = null, factoryRole = null }) {
19032
+ constructor({ customTitle, id, name, path: projectPath, dangerouslySkipPermissions = false, replayBufferKB = 512, hookRouter = null, getHookPort = null, hooksBaseDir = void 0, titleStabilizationMs = 1500, statusConflictMs = void 0, statusDedupMs = void 0, detectBackgroundAgents = true, agentTtlMs = DEFAULT_AGENT_TTL_MS, shellTaskTtlMs = DEFAULT_SHELL_TASK_TTL_MS, teammateTaskTtlMs = DEFAULT_TEAMMATE_TASK_TTL_MS, gateReleaseSettleMs = DEFAULT_GATE_RELEASE_SETTLE_MS, detectScheduledWakeups = true, observeToolCalls = false, agent = DEFAULT_AGENT_ID, adapter = null, bypassHookTrust = false, titleQuietFallbackMs = 3e4, spawnCommand = null, initialPrompt = null, extraClaudeArgs = [], ephemeral = false, resumeSessionId = null, taskTitleState = void 0, settingsPermissions = null, settingsSandbox = null, prepareSandbox = null, spawnEnv = null, prependPathDirs = [], enableProjectMcp = false, hookTools = [], getHookTools = null, planReviewPort = null, planLimits = false, getUserHooks = null, extraUserHooks = [], ptySpawn = null, requireWorktree = false, screenKeeperFactory = null, killProc = null, signalProc = null, platform = process.platform, gitWorkspace = null, gitIsolation, integrationBranch = null, autoRebase = true, syncOnStart = true, liveWorktreeReview = true, worktreeRoot = null, worktreeShare = null, workspaceRepos = void 0, agentDepth = 0, commitSigningProgram = null, factoryRole = null }) {
19168
19033
  super();
19169
19034
  this.id = id;
19170
19035
  this.name = name;
@@ -19309,10 +19174,10 @@ var Session = class extends EventEmitter {
19309
19174
  });
19310
19175
  this._agentDepth = agentDepth;
19311
19176
  this._agentToken = generateToken();
19312
- this._agentApiEnabled = agentApi === true;
19313
19177
  this._commitSigningProgram = commitSigningProgram;
19314
19178
  this._commitSigningToken = commitSigningProgram === null ? null : generateToken();
19315
19179
  this._factoryRole = factoryRole;
19180
+ this._canRunHelpCommand = permitsHelpCommand(settingsPermissions);
19316
19181
  this._agentLiveChildren = 0;
19317
19182
  this._agentLifetimeSpawns = 0;
19318
19183
  this._agentSpawnsInFlight = 0;
@@ -19711,7 +19576,7 @@ var Session = class extends EventEmitter {
19711
19576
  return this._factoryRole;
19712
19577
  }
19713
19578
  _agentApiEnv() {
19714
- if (!this._agentApiEnabled || !this._agentToken) return {};
19579
+ if (!this._agentToken) return {};
19715
19580
  const port = this._hooks.listenerPort();
19716
19581
  if (!port) return {};
19717
19582
  const url = `http://127.0.0.1:${port}/agent/${encodeURIComponent(this.id)}?t=${encodeURIComponent(this._agentToken)}`;
@@ -19854,6 +19719,9 @@ var Session = class extends EventEmitter {
19854
19719
  getWorktreeCarry() {
19855
19720
  return this.worktreeLifecycle.getCarry();
19856
19721
  }
19722
+ get hasOwnWorktree() {
19723
+ return this.worktreeLifecycle.hasOwnWorktree();
19724
+ }
19857
19725
  refreshGitContext() {
19858
19726
  return this.worktreeLifecycle.refreshGitContext();
19859
19727
  }
@@ -20146,7 +20014,9 @@ var Session = class extends EventEmitter {
20146
20014
  resumeSessionId: spawnResumeSessionId,
20147
20015
  extraArgs: launchSession?.extraArgs ?? this._extraClaudeArgs,
20148
20016
  initialPrompt: this._initialPrompt,
20149
- hasOuterSandbox: this._prepareSandbox !== null
20017
+ hasOuterSandbox: this._prepareSandbox !== null,
20018
+ hasOperatorInstructions: this._hasOperatorInstructions(env),
20019
+ canRunHelpCommand: this._canRunHelpCommand
20150
20020
  });
20151
20021
  const spawnCommand = await this._sandboxedSpawnCommand(this._adapter.buildSpawnCommand({
20152
20022
  platform: this._platform,
@@ -20207,6 +20077,15 @@ var Session = class extends EventEmitter {
20207
20077
  this.transition("spawn_fail", { error: errorMessage(cause) });
20208
20078
  this.emit("error", cause);
20209
20079
  }
20080
+ _hasOperatorInstructions(env) {
20081
+ const operatorConfigPath = this._adapter.operatorConfigPath?.(env) ?? null;
20082
+ if (operatorConfigPath === null) return false;
20083
+ try {
20084
+ return this._adapter.setsOperatorInstructions?.(fs.readFileSync(operatorConfigPath, "utf8")) === true;
20085
+ } catch (error) {
20086
+ return !isMissingFileError(error);
20087
+ }
20088
+ }
20210
20089
  async _sandboxedSpawnCommand(command, agentSessionId) {
20211
20090
  if (!this._prepareSandbox) return {
20212
20091
  ...command,
@@ -20687,6 +20566,9 @@ function startAwakeStopwatch({ tickMs = DEFAULT_TICK_MS, now = Date.now } = {})
20687
20566
  stop: () => clearInterval(ticks.interval)
20688
20567
  };
20689
20568
  }
20569
+ //#endregion
20570
+ //#region server/core/investigation-trail-core.ts
20571
+ var TRAIL_MAX_STEPS = 80;
20690
20572
  var TRAIL_TOOL_MAX_CHARS = 64;
20691
20573
  function describeToolStep(toolName, toolInput) {
20692
20574
  const trimmed = typeof toolName === "string" ? toolName.trim() : "";
@@ -20707,7 +20589,7 @@ function createInvestigationTrail(startedAt) {
20707
20589
  steps: []
20708
20590
  };
20709
20591
  }
20710
- function appendTrailStep(trail, step, maxSteps = 80) {
20592
+ function appendTrailStep(trail, step, maxSteps = TRAIL_MAX_STEPS) {
20711
20593
  const steps = [...trail.steps, step];
20712
20594
  return {
20713
20595
  startedAt: trail.startedAt,
@@ -20798,7 +20680,7 @@ function decideFolderTrust(configText, repositoryRoot, platform) {
20798
20680
  };
20799
20681
  }
20800
20682
  //#endregion
20801
- //#region server/sandbox-launch.ts
20683
+ //#region server/sandbox/sandbox-launch.ts
20802
20684
  var LAUNCH_ID_SHAPE = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
20803
20685
  var SANDBOXED_ENV_COMMAND = "/usr/bin/env";
20804
20686
  var POLICY_FOLDER = "sandbox-policies";
@@ -21089,7 +20971,7 @@ async function prepareSandboxLaunch({ role, launchId, tempDir, enterDir }) {
21089
20971
  }
21090
20972
  }
21091
20973
  //#endregion
21092
- //#region server/lane-spawn.ts
20974
+ //#region server/lanes/lane-spawn.ts
21093
20975
  var SETTINGS_DIR_PREFIX = "glimmervoid-lane-settings-";
21094
20976
  var UNWRAPPED_PLATFORM$2 = "win32";
21095
20977
  var UNWRAPPED_CODEX_SANDBOX_ARGS = Object.freeze(["-s", "read-only"]);
@@ -21207,7 +21089,7 @@ async function readLaneResultFile(resultPath) {
21207
21089
  }
21208
21090
  }
21209
21091
  //#endregion
21210
- //#region server/team-review-thread-judge.ts
21092
+ //#region server/github/team-review-thread-judge.ts
21211
21093
  var THREAD_JUDGE_TOOLS = Object.freeze(["Read", "Write"]);
21212
21094
  var THREAD_JUDGE_TIMEOUT_MS = 12e4;
21213
21095
  function createThreadJudge(spawn, shutdownSignal) {
@@ -21240,7 +21122,7 @@ function createThreadJudge(spawn, shutdownSignal) {
21240
21122
  };
21241
21123
  }
21242
21124
  //#endregion
21243
- //#region server/repo-cache.ts
21125
+ //#region server/git/repo-cache.ts
21244
21126
  var NETWORK_GIT_ENV = { GIT_TERMINAL_PROMPT: "0" };
21245
21127
  var GIT_COMMAND_TIMEOUT_MS = 12e4;
21246
21128
  var HEAD_TREE_HYDRATE_TIMEOUT_MS = 6e5;
@@ -21503,7 +21385,7 @@ function createRepoCache({ rootDir, commandRunner = defaultCommandRunner, remote
21503
21385
  };
21504
21386
  }
21505
21387
  //#endregion
21506
- //#region server/core/team-review-reaper-core.ts
21388
+ //#region server/github/core/team-review-reaper-core.ts
21507
21389
  var CLAUDE_BASH_SIGNATURE = "/.claude/shell-snapshots/snapshot-";
21508
21390
  function parseProcessTable(output) {
21509
21391
  const rows = [];
@@ -21580,7 +21462,7 @@ function selectTeamReviewProcessIds(rows, ownedDirectories, protectedPids) {
21580
21462
  return [...selectedPids].sort((leftPid, rightPid) => leftPid - rightPid);
21581
21463
  }
21582
21464
  //#endregion
21583
- //#region server/team-review-reaper.ts
21465
+ //#region server/github/team-review-reaper.ts
21584
21466
  var PROCESS_LIST_TIMEOUT_MS = 5e3;
21585
21467
  var TERMINATION_GRACE_MS = 2e3;
21586
21468
  var EXIT_POLL_MS = 100;
@@ -21679,7 +21561,7 @@ async function reapTeamReviewProcesses({ ownedDirectories, reviewRoots, scope, l
21679
21561
  }
21680
21562
  }
21681
21563
  //#endregion
21682
- //#region server/team-review-poller.ts
21564
+ //#region server/github/team-review-poller.ts
21683
21565
  var TEAM_REVIEW_RATE_LIMIT_RESOURCES = [
21684
21566
  "search",
21685
21567
  "graphql",
@@ -22306,7 +22188,7 @@ function createTeamReviewPoller(deps) {
22306
22188
  };
22307
22189
  }
22308
22190
  //#endregion
22309
- //#region server/team-review-wiring.ts
22191
+ //#region server/github/team-review-wiring.ts
22310
22192
  var TEAM_REVIEW_DENY_RULES = Object.freeze([
22311
22193
  "Bash(gh:*)",
22312
22194
  "Bash(git push:*)",
@@ -24262,7 +24144,7 @@ function createBenchmarkWiring({ benchmarksRoot, runsRoot, isEnabled, broadcast,
24262
24144
  };
24263
24145
  }
24264
24146
  //#endregion
24265
- //#region server/core/factory-decision-log-core.ts
24147
+ //#region server/factory/core/factory-decision-log-core.ts
24266
24148
  function factoryDecisionDayFileName(timestamp) {
24267
24149
  return `${timestamp.slice(0, 10)}.jsonl`;
24268
24150
  }
@@ -24421,7 +24303,7 @@ function factoryCloseOutFailureClass(fence, checks, review) {
24421
24303
  return null;
24422
24304
  }
24423
24305
  //#endregion
24424
- //#region server/factory-check-sandbox.ts
24306
+ //#region server/factory/factory-check-sandbox.ts
24425
24307
  function capturedStreamTail(failure, stream) {
24426
24308
  if (!(failure instanceof Error)) return "";
24427
24309
  const captured = Reflect.get(failure, stream);
@@ -24479,7 +24361,7 @@ var prepareSandboxedCheckRunner = async ({ scratchParent, writablePaths, readabl
24479
24361
  };
24480
24362
  };
24481
24363
  //#endregion
24482
- //#region server/core/git-changed-paths-core.ts
24364
+ //#region server/git/core/git-changed-paths-core.ts
24483
24365
  var WORKFLOW_PATH_PREFIX = ".github/workflows/";
24484
24366
  var WORKFLOW_ANCESTOR_ENTRIES = /* @__PURE__ */ new Set([".github", ".github/workflows"]);
24485
24367
  var GITHUB_DIRECTORY_ENTRY = ".github";
@@ -24511,7 +24393,7 @@ function isCredentialLikePath(filePath) {
24511
24393
  return CREDENTIAL_LIKE_FILE_NAMES.some((pattern) => pattern.test(fileName));
24512
24394
  }
24513
24395
  //#endregion
24514
- //#region server/factory-closeout.ts
24396
+ //#region server/factory/factory-closeout.ts
24515
24397
  var FACTORY_REVIEWER_TOOLS = Object.freeze([
24516
24398
  "Read",
24517
24399
  "Glob",
@@ -24537,6 +24419,8 @@ var CASE_INSENSITIVE_LEDGER_PATHSPEC = ":(icase).coherence";
24537
24419
  var WORK_OUTSIDE_LEDGER_PATHSPECS = [".", ":(exclude,icase).coherence"];
24538
24420
  var FACTORY_REVIEW_TOO_LARGE_FEEDBACK = "change too large for review; split it into smaller tickets";
24539
24421
  var FAILED_CHECK_FEEDBACK_MAX_CHARS = 3500;
24422
+ var FACTORY_TICKET_BLOCK_CAP = 3;
24423
+ var FACTORY_INTENT_CAP_CANCEL_LIMIT = 3;
24540
24424
  function createMemoryCapCounter() {
24541
24425
  const counts = /* @__PURE__ */ new Map();
24542
24426
  return async (projectId, id) => {
@@ -25065,7 +24949,7 @@ function createFactoryCloseOut({ config, spawnReviewer, gitWorkspace, serializeP
25065
24949
  attempts.delete(worker.workId);
25066
24950
  failingFilesOutsideScopesByWork.delete(worker.workId);
25067
24951
  worker.session.destroy();
25068
- const capNotice = blockCount >= 3 ? await cancelTicketAtCap(worker, ledger.cwd, blockCount) : null;
24952
+ const capNotice = blockCount >= FACTORY_TICKET_BLOCK_CAP ? await cancelTicketAtCap(worker, ledger.cwd, blockCount) : null;
25069
24953
  notifyOrchestrator(worker.projectId, {
25070
24954
  workId: worker.workId,
25071
24955
  intentId: worker.intentId,
@@ -25111,7 +24995,7 @@ function createFactoryCloseOut({ config, spawnReviewer, gitWorkspace, serializeP
25111
24995
  }
25112
24996
  async function cancelIntentAtCap(worker, cwd) {
25113
24997
  const capCancelCount = await countIntentCapCancel(worker.projectId, worker.intentId);
25114
- if (capCancelCount < 3) return;
24998
+ if (capCancelCount < FACTORY_INTENT_CAP_CANCEL_LIMIT) return;
25115
24999
  const notice = `Glimmervoid cancelled intent ${worker.intentId} after ${capCancelCount} of its tickets were cancelled at the block cap; the queue moves to the next intent.`;
25116
25000
  try {
25117
25001
  const intentClosings = listIntentCapClosings(CoherenceWorkInspect.parse(JSON.parse(await runCoherence({
@@ -25452,7 +25336,7 @@ function buildCoherenceShims({ nodePath, cliPath, glimmervoidCliPath }) {
25452
25336
  ];
25453
25337
  }
25454
25338
  //#endregion
25455
- //#region server/factory-ledger.ts
25339
+ //#region server/factory/factory-ledger.ts
25456
25340
  var LEDGER_GIT_OPTIONS = {
25457
25341
  encoding: "utf8",
25458
25342
  timeout: 3e4,
@@ -25820,7 +25704,7 @@ async function pruneAgedFiles({ directory, suffixes, retainDays, now = Date.now(
25820
25704
  return removedIds;
25821
25705
  }
25822
25706
  //#endregion
25823
- //#region server/factory-decision-log.ts
25707
+ //#region server/factory/factory-decision-log.ts
25824
25708
  function createFactoryDecisionLog({ homeDir = glimmervoidHomeDir$1(), now = Date.now, log = console, redact = (text) => text, onDecision } = {}) {
25825
25709
  const prunedDayByProject = /* @__PURE__ */ new Map();
25826
25710
  let lastScannedDayFileName = null;
@@ -25893,7 +25777,7 @@ function createFactoryDecisionLog({ homeDir = glimmervoidHomeDir$1(), now = Date
25893
25777
  };
25894
25778
  }
25895
25779
  //#endregion
25896
- //#region server/work-lane.ts
25780
+ //#region server/lanes/work-lane.ts
25897
25781
  var UNWRAPPED_PLATFORM$1 = "win32";
25898
25782
  var GUARD_HOOK_UNAVAILABLE_ERROR = "Sane YOLO is unavailable";
25899
25783
  function prepareRoleSandbox(describeRole, { prepareSandbox = prepareSandboxLaunch, sandboxRefusal = allowSandboxedSpawn, platform = process.platform } = {}) {
@@ -26033,7 +25917,7 @@ async function resolveWorkLane(input, { hookToolConfig = {}, resolveSaneYoloHook
26033
25917
  }
26034
25918
  }
26035
25919
  //#endregion
26036
- //#region server/factory-dispatch.ts
25920
+ //#region server/factory/factory-dispatch.ts
26037
25921
  var FACTORY_WORKER_DENY = Object.freeze([
26038
25922
  "Bash(git push:*)",
26039
25923
  "Bash(gh:*)",
@@ -26263,7 +26147,7 @@ function createFactoryDispatch({ config, sessions, makeSession, wireSessionEvent
26263
26147
  ...posture.sessionOverrides,
26264
26148
  agent: "claude-code",
26265
26149
  ephemeral: true,
26266
- agentApi: false,
26150
+ factoryRole: "worker",
26267
26151
  requireWorktree: true,
26268
26152
  dangerouslySkipPermissions: false,
26269
26153
  gitIsolation: { disableRepoCommands: true },
@@ -26496,7 +26380,7 @@ function createFactoryDispatch({ config, sessions, makeSession, wireSessionEvent
26496
26380
  };
26497
26381
  }
26498
26382
  //#endregion
26499
- //#region server/factory-orchestrator.ts
26383
+ //#region server/factory/factory-orchestrator.ts
26500
26384
  var FACTORY_ORCHESTRATOR_ALLOW = Object.freeze([
26501
26385
  "Bash(coherence work create:*)",
26502
26386
  "Bash(coherence orient:*)",
@@ -26716,7 +26600,6 @@ function createFactoryOrchestrator({ config, sessions, makeSession, wireSessionE
26716
26600
  },
26717
26601
  agent: "claude-code",
26718
26602
  ephemeral: true,
26719
- agentApi: true,
26720
26603
  factoryRole: "orchestrator",
26721
26604
  gitWorkspace: null,
26722
26605
  dangerouslySkipPermissions: false,
@@ -26892,7 +26775,7 @@ function createFactoryOrchestrator({ config, sessions, makeSession, wireSessionE
26892
26775
  };
26893
26776
  }
26894
26777
  //#endregion
26895
- //#region server/factory-poller.ts
26778
+ //#region server/factory/factory-poller.ts
26896
26779
  function createFactoryPoller({ shouldHoldCheckout = () => false, beforeTick = () => {}, listFactoryProjects, resolveIntegrationBranch, readBranchSha, hasCoherenceConfigAt, ensureControlCheckout, releaseControlCheckout, runCoherence, readPaused = async () => false, readIntentWriteScopes = async () => /* @__PURE__ */ new Map(), processProjectState = async (project) => project, releaseOrchestrator = () => {}, listObservedProjects = async () => [], broadcast, now = Date.now, ...loopOptions }) {
26897
26780
  const log = loopOptions.log ?? console;
26898
26781
  let state = null;
@@ -27075,7 +26958,7 @@ function stdoutOfFailedCommand(error) {
27075
26958
  return stdout;
27076
26959
  }
27077
26960
  //#endregion
27078
- //#region server/factory-verifier.ts
26961
+ //#region server/factory/factory-verifier.ts
27079
26962
  function createFactoryVerifier({ config, spawnVerifier, serializeProject, ensureLedger, ensureControlCheckout, hasCodeChangedSince, readIntentDiff = async () => null, readLaneState, writeLaneState, runCoherence, commitAndLand, pause, setException, notifyOrchestrator, stopOrchestrator, onChanged }) {
27080
26963
  const readyByProject = /* @__PURE__ */ new Map();
27081
26964
  const notesByProject = /* @__PURE__ */ new Map();
@@ -27383,7 +27266,7 @@ function createFactoryVerifier({ config, spawnVerifier, serializeProject, ensure
27383
27266
  };
27384
27267
  }
27385
27268
  //#endregion
27386
- //#region server/factory-wiring.ts
27269
+ //#region server/factory/factory-wiring.ts
27387
27270
  var COHERENCE_CONFIG_PROBE_TIMEOUT_MS = 5e3;
27388
27271
  var ORCHESTRATOR_EXCEPTION_PREFIX = "factory-exception";
27389
27272
  function createFactoryWiring({ config, broadcast, gitWorkspace = createGitWorkspace(), homeDir = glimmervoidHomeDir$1(), createPoller = createFactoryPoller, log = console, telemetry, orchestratorOptions, trustClaudeFolder, spawnReviewer, prepareCheckRunner, spawnVerifier = spawnReviewer, readSpentTodayUsd = () => ({
@@ -28325,7 +28208,7 @@ function createFactoryWiring({ config, broadcast, gitWorkspace = createGitWorksp
28325
28208
  };
28326
28209
  }
28327
28210
  //#endregion
28328
- //#region server/core/factory-harness-mirror-core.ts
28211
+ //#region server/factory/core/factory-harness-mirror-core.ts
28329
28212
  var HARNESS_MIRROR_MAX_IDLE_MS = 864e5;
28330
28213
  var HARNESS_MIRROR_PROJECT_PREFIX = "harness-";
28331
28214
  var BATCH_NAME_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-\d{3}Z-[0-9a-f]{8}$/;
@@ -28375,7 +28258,7 @@ function mirrorHarnessProjects(state, observedRun) {
28375
28258
  }));
28376
28259
  }
28377
28260
  //#endregion
28378
- //#region server/factory-harness-mirror.ts
28261
+ //#region server/factory/factory-harness-mirror.ts
28379
28262
  var STATE_TAIL_MAX_BYTES = 4194304;
28380
28263
  var NON_BLOCKING_READ_FLAGS = constants.O_RDONLY | constants.O_NONBLOCK;
28381
28264
  function isMissingPath(error) {
@@ -29206,7 +29089,7 @@ function createBranchGcPoller(deps) {
29206
29089
  };
29207
29090
  }
29208
29091
  //#endregion
29209
- //#region server/lane-status.ts
29092
+ //#region server/lanes/lane-status.ts
29210
29093
  function emptyLaneStatus(type, gate) {
29211
29094
  return {
29212
29095
  type,
@@ -29628,7 +29511,7 @@ function decideFsEvents(batch, { root = null, now = 0 } = {}) {
29628
29511
  }];
29629
29512
  }
29630
29513
  //#endregion
29631
- //#region server/core/ingest-batch-log-core.ts
29514
+ //#region server/ingest/core/ingest-batch-log-core.ts
29632
29515
  function emptyBatchLogState() {
29633
29516
  return {
29634
29517
  batches: 0,
@@ -29660,7 +29543,7 @@ function drainBatchLog(state) {
29660
29543
  };
29661
29544
  }
29662
29545
  //#endregion
29663
- //#region server/core/ingest-tail-core.ts
29546
+ //#region server/ingest/core/ingest-tail-core.ts
29664
29547
  var MAX_CATCH_UP_BYTES = 262144;
29665
29548
  var LISTING_SETTLE_MS = 2e3;
29666
29549
  function fileIdentity(stat) {
@@ -29785,7 +29668,7 @@ function pickStaleByMtime(entriesByKey, { maxTracked = 256 } = {}) {
29785
29668
  return entries.slice(0, entries.length - bound).map(([key]) => key);
29786
29669
  }
29787
29670
  //#endregion
29788
- //#region server/core/ingest-agent-core.ts
29671
+ //#region server/ingest/core/ingest-agent-core.ts
29789
29672
  var SOURCE$2 = "agentLogs";
29790
29673
  var MAX_RAW_CHARS = 4e3;
29791
29674
  var TOOL_TARGET_KEYS = Object.freeze([
@@ -30038,7 +29921,7 @@ function mapAgentLine({ vendor = "", rawLine = null, ctx = {}, vendorState = nul
30038
29921
  return mapped;
30039
29922
  }
30040
29923
  //#endregion
30041
- //#region server/ingest-agent-logs.ts
29924
+ //#region server/ingest/ingest-agent-logs.ts
30042
29925
  var DEFAULT_POLL_MS$2 = 2e3;
30043
29926
  var DEFAULT_DISCOVER_MS$1 = 3e4;
30044
29927
  var DEFAULT_ACTIVE_WITHIN_MS = 6e5;
@@ -30069,7 +29952,7 @@ async function readCodexRoot(filePath, fsPromises = fs.promises) {
30069
29952
  const buffer = Buffer.alloc(CODEX_HEAD_BYTES);
30070
29953
  const { bytesRead } = await handle.read(buffer, 0, CODEX_HEAD_BYTES, 0);
30071
29954
  const lines = buffer.subarray(0, bytesRead).toString("utf8").split(/\r?\n/);
30072
- if (bytesRead === 131072) lines.pop();
29955
+ if (bytesRead === CODEX_HEAD_BYTES) lines.pop();
30073
29956
  for (const line of lines) {
30074
29957
  if (!line) continue;
30075
29958
  let parsed = null;
@@ -30641,7 +30524,7 @@ function createAgentLogIngest({ publish, sourceConfig = {}, laneMap = null, logg
30641
30524
  };
30642
30525
  }
30643
30526
  //#endregion
30644
- //#region server/ingest-editor.ts
30527
+ //#region server/ingest/ingest-editor.ts
30645
30528
  function createEditorIngest({ publish, roots = () => [], pathsFoldCase = process.platform === "darwin", logger = console, nowFn = Date.now, debug = false }) {
30646
30529
  const { debugNote, warn } = createLaneLog({
30647
30530
  prefix: "[ingest:editor]",
@@ -30685,6 +30568,9 @@ function createEditorIngest({ publish, roots = () => [], pathsFoldCase = process
30685
30568
  stop
30686
30569
  };
30687
30570
  }
30571
+ //#endregion
30572
+ //#region server/ingest/ingest-fs.ts
30573
+ var DEFAULT_MAX_ROOTS = 8;
30688
30574
  var CONFIG_HOLDER = "config:fs.roots";
30689
30575
  var requireFromHere = createRequire(import.meta.url);
30690
30576
  function defaultLoadWatcher() {
@@ -30694,11 +30580,11 @@ function isWatcherModule(value) {
30694
30580
  if (typeof value !== "object" || value === null) return false;
30695
30581
  return "subscribe" in value && typeof value.subscribe === "function";
30696
30582
  }
30697
- function createFsIngest({ publish, sourceConfig = {}, configPath = null, logger = console, loadWatcher = defaultLoadWatcher, canonicalize = canonicalizePath, nowFn = Date.now, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, maxRoots = 8 } = {}) {
30583
+ function createFsIngest({ publish, sourceConfig = {}, configPath = null, logger = console, loadWatcher = defaultLoadWatcher, canonicalize = canonicalizePath, nowFn = Date.now, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, maxRoots = DEFAULT_MAX_ROOTS } = {}) {
30698
30584
  if (typeof publish !== "function") throw new Error("createFsIngest requires publish");
30699
30585
  const publishEvent = publish;
30700
30586
  const batchMs = positiveIntOr(sourceConfig.batchMs, DEFAULT_BATCH_MS);
30701
- const rootLimit = Math.max(1, positiveIntOr(maxRoots, 8));
30587
+ const rootLimit = Math.max(1, positiveIntOr(maxRoots, DEFAULT_MAX_ROOTS));
30702
30588
  const ignorePatterns = buildIgnorePatterns();
30703
30589
  const daemonRules = daemonWriteRules(configPath);
30704
30590
  const configuredRoots = normalizeRoots(sourceConfig.roots);
@@ -31274,14 +31160,17 @@ function classifyGitStatusFailure(error) {
31274
31160
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") return "check-root";
31275
31161
  return "transient";
31276
31162
  }
31163
+ //#endregion
31164
+ //#region server/ingest/ingest-git.ts
31165
+ var DEFAULT_MAX_REPOS = 16;
31277
31166
  var DEFAULT_GIT_TIMEOUT_MS = 15e3;
31278
31167
  var MAX_GIT_BUFFER_BYTES = 8388608;
31279
- function createGitIngest({ publish, sourceConfig = {}, reposProvider = null, logger = console, execFileFn = execFileAsync, createWatch = createWatchDebounce, canonicalize = canonicalizePath, statRepoDir = (dir) => fsp.stat(dir), nowFn = Date.now, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, maxRepos = 16, gitTimeoutMs = DEFAULT_GIT_TIMEOUT_MS, gitPath = "git" } = {}) {
31168
+ function createGitIngest({ publish, sourceConfig = {}, reposProvider = null, logger = console, execFileFn = execFileAsync, createWatch = createWatchDebounce, canonicalize = canonicalizePath, statRepoDir = (dir) => fsp.stat(dir), nowFn = Date.now, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, maxRepos = DEFAULT_MAX_REPOS, gitTimeoutMs = DEFAULT_GIT_TIMEOUT_MS, gitPath = "git" } = {}) {
31280
31169
  if (typeof publish !== "function") throw new Error("createGitIngest requires publish");
31281
31170
  const publishEvent = publish;
31282
31171
  const settleMs = positiveIntOr(sourceConfig.debounceMs, DEFAULT_DEBOUNCE_MS);
31283
31172
  const pollIntervalMs = positiveIntOr(sourceConfig.pollMs, DEFAULT_POLL_MS$1);
31284
- const repoLimit = Math.max(1, positiveIntOr(maxRepos, 16));
31173
+ const repoLimit = Math.max(1, positiveIntOr(maxRepos, DEFAULT_MAX_REPOS));
31285
31174
  const candidateLimit = repoLimit * 4;
31286
31175
  const repos = /* @__PURE__ */ new Map();
31287
31176
  const canonicalCache = /* @__PURE__ */ new Map();
@@ -31662,12 +31551,13 @@ function createGitIngest({ publish, sourceConfig = {}, reposProvider = null, log
31662
31551
  };
31663
31552
  }
31664
31553
  //#endregion
31665
- //#region server/ingest-shell-history.ts
31554
+ //#region server/ingest/ingest-shell-history.ts
31666
31555
  var DEFAULT_POLL_MS = 2e3;
31667
31556
  var DEFAULT_DISCOVER_MS = 3e4;
31557
+ var DEFAULT_MAX_COMMANDS_PER_DRAIN = 50;
31668
31558
  var WATCH_POLL_DEBOUNCE_MS = 100;
31669
31559
  var WATCH_SWEEP_DEBOUNCE_MS = 500;
31670
- function createShellHistoryIngest({ publish, sourceConfig = {}, logger = console, env = process.env, homeDir = os.homedir(), platform = process.platform, fsPromises = fs.promises, watchFn = fs.watch, nowFn = Date.now, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, discoverIntervalMs = DEFAULT_DISCOVER_MS, maxTrackedFiles = 8, maxCommandsPerDrain = 50, maxCatchUpBytes = MAX_CATCH_UP_BYTES } = {}) {
31560
+ function createShellHistoryIngest({ publish, sourceConfig = {}, logger = console, env = process.env, homeDir = os.homedir(), platform = process.platform, fsPromises = fs.promises, watchFn = fs.watch, nowFn = Date.now, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, discoverIntervalMs = DEFAULT_DISCOVER_MS, maxTrackedFiles = 8, maxCommandsPerDrain = DEFAULT_MAX_COMMANDS_PER_DRAIN, maxCatchUpBytes = MAX_CATCH_UP_BYTES } = {}) {
31671
31561
  if (typeof publish !== "function") throw new Error("createShellHistoryIngest requires publish");
31672
31562
  const publishEvent = publish;
31673
31563
  const pollMs = positiveIntOr(sourceConfig.pollMs, DEFAULT_POLL_MS);
@@ -31916,7 +31806,7 @@ function createShellHistoryIngest({ publish, sourceConfig = {}, logger = console
31916
31806
  context.previous = decided.previous;
31917
31807
  if (decided.event) events.push(decided.event);
31918
31808
  }
31919
- const bound = positiveIntOr(maxCommandsPerDrain, 50);
31809
+ const bound = positiveIntOr(maxCommandsPerDrain, DEFAULT_MAX_COMMANDS_PER_DRAIN);
31920
31810
  const recent = events.slice(-bound);
31921
31811
  const dropped = events.length - recent.length;
31922
31812
  if (dropped > 0) {
@@ -32037,7 +31927,7 @@ function createShellHistoryIngest({ publish, sourceConfig = {}, logger = console
32037
31927
  };
32038
31928
  }
32039
31929
  //#endregion
32040
- //#region server/core/ingest-terminal-core.ts
31930
+ //#region server/ingest/core/ingest-terminal-core.ts
32041
31931
  var DEFAULT_ACCUMULATOR_BYTES = SOURCE_DEFAULTS.terminal.accumulatorBytes;
32042
31932
  var DEFAULT_WINDOW_BYTES = SOURCE_DEFAULTS.terminal.windowBytes;
32043
31933
  var DEFAULT_FLUSH_MS = SOURCE_DEFAULTS.terminal.flushMs;
@@ -32271,7 +32161,7 @@ function flushAccumulator(state, { now = Date.now() } = {}) {
32271
32161
  };
32272
32162
  }
32273
32163
  //#endregion
32274
- //#region server/ingest-terminal.ts
32164
+ //#region server/ingest/ingest-terminal.ts
32275
32165
  function createTerminalIngest({ publish, sourceConfig = {}, logger = console, nowFn = Date.now, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn } = {}) {
32276
32166
  if (typeof publish !== "function") throw new Error("createTerminalIngest requires publish");
32277
32167
  const publishEvent = publish;
@@ -32395,7 +32285,7 @@ function createTerminalIngest({ publish, sourceConfig = {}, logger = console, no
32395
32285
  };
32396
32286
  }
32397
32287
  //#endregion
32398
- //#region server/ingest-wiring.ts
32288
+ //#region server/ingest/ingest-wiring.ts
32399
32289
  var BATCH_INTERVAL_MS = 1e3;
32400
32290
  function createIngestLane({ config = null, broadcast = null, logger = console, laneMap = null, agentLogOptions = null, fsOptions = null, shellHistoryOptions = null, configPath = null, repoRoots = null, editorRoots = () => [], onActivity = null, nowFn = Date.now, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, batchIntervalMs = BATCH_INTERVAL_MS, maxEventsPerFrame = 50, snapshotEventLimit = 100, debug = false } = {}) {
32401
32291
  const resolved = config?.sources ? config : resolveIngestConfig(config);
@@ -32678,7 +32568,7 @@ function createIngestLane({ config = null, broadcast = null, logger = console, l
32678
32568
  };
32679
32569
  }
32680
32570
  //#endregion
32681
- //#region server/core/change-narrative-core.ts
32571
+ //#region server/change-map/core/change-narrative-core.ts
32682
32572
  var FACT_GROUPS = [
32683
32573
  "files",
32684
32574
  "subsystems",
@@ -32785,7 +32675,7 @@ function validateNarrative({ raw, knownFactIds, factsHash, model }) {
32785
32675
  };
32786
32676
  }
32787
32677
  //#endregion
32788
- //#region server/change-narrator.ts
32678
+ //#region server/change-map/change-narrator.ts
32789
32679
  var MAX_CACHED_HASHES = 64;
32790
32680
  var PROMPT_FILE$2 = "change-narrative-prompt.txt";
32791
32681
  var RESULT_FILE$2 = "change-narrative-result.json";
@@ -33677,6 +33567,7 @@ var PLAN_DRAFT_DEBOUNCE_MS = 250;
33677
33567
  var PLANS_DIRECTORY_NAME = "plans";
33678
33568
  var PLAN_RESULT_BODY_CAP_BYTES = 2 * PLAN_BODY_CAP_BYTES;
33679
33569
  var PLAN_SUFFIX = ".jsonl";
33570
+ var PLAN_RETAIN_DAYS = 30;
33680
33571
  var PRUNE_INTERVAL_MS$2 = 864e5;
33681
33572
  var FILE_MODE = 384;
33682
33573
  function carriesPlanBody(event) {
@@ -33725,7 +33616,7 @@ function createPlanReviewWiring({ configPath = null, logger = console, nowFn = D
33725
33616
  const heldByKey = /* @__PURE__ */ new Map();
33726
33617
  const draftWatchByKey = /* @__PURE__ */ new Map();
33727
33618
  let nextHoldId = 0;
33728
- for (const entry of readPlanDirectorySync()) if (entry.endsWith(".jsonl")) sessionIdsWithPlans.add(entry.slice(0, -6));
33619
+ for (const entry of readPlanDirectorySync()) if (entry.endsWith(PLAN_SUFFIX)) sessionIdsWithPlans.add(entry.slice(0, -6));
33729
33620
  function readPlanDirectorySync() {
33730
33621
  try {
33731
33622
  return fs.readdirSync(plansDirectory);
@@ -34196,7 +34087,7 @@ function createPlanReviewWiring({ configPath = null, logger = console, nowFn = D
34196
34087
  const removed = await pruneAgedFiles({
34197
34088
  directory: plansDirectory,
34198
34089
  suffixes: [PLAN_SUFFIX],
34199
- retainDays: 30,
34090
+ retainDays: PLAN_RETAIN_DAYS,
34200
34091
  now: nowFn(),
34201
34092
  isRetainedId: (sessionId) => attachedSessionIds.has(sessionId)
34202
34093
  });
@@ -34712,7 +34603,7 @@ function buildIssueSessionPrompt({ issue, projectName, host, url } = {}) {
34712
34603
  return lines.join("\n");
34713
34604
  }
34714
34605
  //#endregion
34715
- //#region server/posthog-api.ts
34606
+ //#region server/radar/posthog-api.ts
34716
34607
  var DEFAULT_ISSUE_LIMIT = 50;
34717
34608
  var DEFAULT_DATE_RANGE_HOURS = 24;
34718
34609
  var CURRENT_WINDOW_MINUTES = 60;
@@ -35283,7 +35174,7 @@ function decideTrafficSpike({ currentUsers, baseline, prev, now, cfg } = {}) {
35283
35174
  }), multiple);
35284
35175
  }
35285
35176
  //#endregion
35286
- //#region server/posthog-poller.ts
35177
+ //#region server/radar/radar-poller.ts
35287
35178
  var OBSERVATION_PINGS = {
35288
35179
  spiking: {
35289
35180
  kind: "spike",
@@ -35315,7 +35206,7 @@ function issueEntryOf(state, key) {
35315
35206
  if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
35316
35207
  return value;
35317
35208
  }
35318
- function createPosthogPoller(deps) {
35209
+ function createRadarPoller(deps) {
35319
35210
  const { api, host = "", resolveProjects = async () => [], spawnInvestigation, telegram = () => {}, readState = async () => ({}), writeState = async () => {}, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, log = console, onTickComplete = () => {}, onInvestigationActivity = () => {}, now = () => Date.now() } = deps;
35320
35211
  const intervalMinutes = deps.intervalMinutes || 15;
35321
35212
  const maxConcurrentInvestigations = deps.maxConcurrentInvestigations || 2;
@@ -35470,7 +35361,7 @@ function createPosthogPoller(deps) {
35470
35361
  cancelPendingActivity(change.key);
35471
35362
  const trail = trails.get(change.key);
35472
35363
  onInvestigationActivity({
35473
- type: "posthog-investigation-finished",
35364
+ type: "radar-investigation-finished",
35474
35365
  projectId: change.projectId,
35475
35366
  issueId: String(change.issue.issueId),
35476
35367
  verdict,
@@ -35499,7 +35390,7 @@ function createPosthogPoller(deps) {
35499
35390
  const trail = trails.get(change.key);
35500
35391
  if (!trail) return;
35501
35392
  onInvestigationActivity({
35502
- type: "posthog-investigation-activity",
35393
+ type: "radar-investigation-activity",
35503
35394
  projectId: change.projectId,
35504
35395
  issueId: String(change.issue.issueId),
35505
35396
  inFlight: true,
@@ -35849,7 +35740,7 @@ function createPosthogPoller(deps) {
35849
35740
  projects
35850
35741
  };
35851
35742
  onTickComplete({
35852
- type: "posthog-status",
35743
+ type: "radar-status",
35853
35744
  ts,
35854
35745
  intervalMinutes,
35855
35746
  projects,
@@ -35882,7 +35773,7 @@ function createPosthogPoller(deps) {
35882
35773
  };
35883
35774
  }
35884
35775
  //#endregion
35885
- //#region server/posthog-report.ts
35776
+ //#region server/radar/radar-report.ts
35886
35777
  var DEFAULT_POSTHOG_REPORT_DIR = path.join(glimmervoidHomeDir$1(), "posthog-reports");
35887
35778
  var POSTHOG_REPORT_ID_RE = /^[A-Za-z0-9_-]{1,128}$/;
35888
35779
  function confinePath(baseDir, ...segments) {
@@ -36016,7 +35907,7 @@ async function sendTelegramMessage({ botToken, chatId, text, tag = "telegram", t
36016
35907
  }
36017
35908
  }
36018
35909
  //#endregion
36019
- //#region server/posthog-wiring.ts
35910
+ //#region server/radar/radar-wiring.ts
36020
35911
  var POSTHOG_DENY = { deny: [
36021
35912
  "Bash(gh pr merge:*)",
36022
35913
  "Bash(gh pr create:*)",
@@ -36041,8 +35932,9 @@ var FIX_DENY = { deny: [
36041
35932
  ] };
36042
35933
  var REPORT_DIR = DEFAULT_POSTHOG_REPORT_DIR;
36043
35934
  var WORK_DIR = path.join(glimmervoidHomeDir$1(), "posthog-work");
35935
+ var REPORT_RETAIN_FILES = 20;
36044
35936
  var FORCE_TICK_DEBOUNCE_MS = 3e3;
36045
- async function posthogLaneRole(facts, { writableRoots, commitCheckout }) {
35937
+ async function radarLaneRole(facts, { writableRoots, commitCheckout }) {
36046
35938
  const commitCheckouts = commitCheckout === null ? [] : [{
36047
35939
  checkout: commitCheckout,
36048
35940
  gitDir: await readLaneCommonGitDir(commitCheckout)
@@ -36183,7 +36075,7 @@ function buildFixPrompt({ issueId, projectId, host, resultPath, repoPath, branch
36183
36075
  "preamble, no emoji, no em or en dashes."
36184
36076
  ].join("\n");
36185
36077
  }
36186
- async function sweepReports(dir = REPORT_DIR, retain = 20) {
36078
+ async function sweepReports(dir = REPORT_DIR, retain = REPORT_RETAIN_FILES) {
36187
36079
  try {
36188
36080
  const names = (await fs.promises.readdir(dir)).filter((n) => n.endsWith(".html") || n.endsWith(".md"));
36189
36081
  if (names.length <= retain) return;
@@ -36342,7 +36234,7 @@ function fallbackPrBody({ issueUrl, reproduced, summary }) {
36342
36234
  `Agent summary: ${summaryLineFromReportText(summary) || "(none written)"}`
36343
36235
  ].join("\n");
36344
36236
  }
36345
- function posthogShouldStart(cfg) {
36237
+ function radarShouldStart(cfg) {
36346
36238
  const p = cfg.posthog;
36347
36239
  if (!p || !p.enabled) return {
36348
36240
  start: false,
@@ -36397,7 +36289,7 @@ function makeResolveProjects(api, config) {
36397
36289
  return out;
36398
36290
  };
36399
36291
  }
36400
- function createPosthogWiring({ config, investigationSessions, closeSessionDataClients, hookRouter, getHookPort, spawnGate, gitWorkspace = null, runCommand = runCli, broadcast = () => {}, recordLane = null, makeSession = (options) => new Session(options), resolveHookTools: resolveHookTools$1 = resolveHookTools, sandbox = {} }) {
36292
+ function createRadarWiring({ config, investigationSessions, closeSessionDataClients, hookRouter, getHookPort, spawnGate, gitWorkspace = null, runCommand = runCli, broadcast = () => {}, recordLane = null, makeSession = (options) => new Session(options), resolveHookTools: resolveHookTools$1 = resolveHookTools, sandbox = {} }) {
36401
36293
  function activePosthogConfig() {
36402
36294
  const posthogConfig = config.posthog;
36403
36295
  if (!posthogConfig?.apiKey) throw new Error("PostHog lane started without its required configuration");
@@ -36408,7 +36300,7 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
36408
36300
  };
36409
36301
  }
36410
36302
  function makeInvestigationSession({ id, name, path: cwd, initialPrompt, spawnEnv, access, permissions = POSTHOG_DENY, onActivity = null }) {
36411
- const prepareSandbox = prepareRoleSandbox((facts) => posthogLaneRole(facts, access), sandbox);
36303
+ const prepareSandbox = prepareRoleSandbox((facts) => radarLaneRole(facts, access), sandbox);
36412
36304
  const sess = makeSession({
36413
36305
  id,
36414
36306
  name,
@@ -36488,7 +36380,7 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
36488
36380
  signal,
36489
36381
  spawnGate
36490
36382
  });
36491
- async function posthogFixSpawn({ issue, projectId, projectName, url, signal, onActivity = null }) {
36383
+ async function radarFixSpawn({ issue, projectId, projectName, url, signal, onActivity = null }) {
36492
36384
  const posthogConfig = activePosthogConfig();
36493
36385
  if (!gitWorkspace) return null;
36494
36386
  const repoPath = resolveRepoPath(projectId);
@@ -36587,10 +36479,10 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
36587
36479
  })).catch((e) => console.warn(`[posthog-poller] fix worktree discard failed: ${errorMessage(e)}`));
36588
36480
  }
36589
36481
  }
36590
- async function posthogInvestigationSpawn({ issue, projectId, projectName, url, mode, signal, onActivity }) {
36482
+ async function radarInvestigationSpawn({ issue, projectId, projectName, url, mode, signal, onActivity }) {
36591
36483
  const posthogConfig = activePosthogConfig();
36592
36484
  if (normalizeJobMode(mode) === JOB_MODES.fix) {
36593
- const fixed = await posthogFixSpawn({
36485
+ const fixed = await radarFixSpawn({
36594
36486
  issue,
36595
36487
  projectId,
36596
36488
  projectName,
@@ -36686,13 +36578,13 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
36686
36578
  const runner = createLaneRunner({
36687
36579
  tag: "posthog-poller",
36688
36580
  gate: () => {
36689
- const verdict = posthogShouldStart(config);
36581
+ const verdict = radarShouldStart(config);
36690
36582
  if (verdict.reason) return verdict;
36691
36583
  return { start: verdict.start };
36692
36584
  },
36693
36585
  cfgKey: () => posthogCfgKey(config),
36694
36586
  emptyStatus: () => ({
36695
- ...emptyLaneStatus("posthog-status", posthogShouldStart(config)),
36587
+ ...emptyLaneStatus("radar-status", radarShouldStart(config)),
36696
36588
  intervalMinutes: config.posthog?.intervalMinutes || 15,
36697
36589
  investigations: []
36698
36590
  }),
@@ -36708,12 +36600,12 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
36708
36600
  host: posthogConfig.host,
36709
36601
  apiKey: posthogConfig.apiKey
36710
36602
  });
36711
- return createPosthogPoller({
36603
+ return createRadarPoller({
36712
36604
  firstTickDelayMs: bootStaggerDelay,
36713
36605
  api,
36714
36606
  host: posthogConfig.host,
36715
36607
  resolveProjects: makeResolveProjects(api, config),
36716
- spawnInvestigation: posthogInvestigationSpawn,
36608
+ spawnInvestigation: radarInvestigationSpawn,
36717
36609
  telegram: (text) => {
36718
36610
  sendTelegramMessage({
36719
36611
  botToken,
@@ -36788,7 +36680,7 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
36788
36680
  setIssueStatus,
36789
36681
  archiveInvestigation,
36790
36682
  _makeInvestigationSession: makeInvestigationSession,
36791
- _investigationSpawn: posthogInvestigationSpawn
36683
+ _investigationSpawn: radarInvestigationSpawn
36792
36684
  };
36793
36685
  }
36794
36686
  //#endregion
@@ -36812,7 +36704,7 @@ function myPrMergeRefusal(pr, seenHeadRefOid) {
36812
36704
  return null;
36813
36705
  }
36814
36706
  //#endregion
36815
- //#region server/core/my-prs-core.ts
36707
+ //#region server/github/core/my-prs-core.ts
36816
36708
  var FailedAutoRebaseRecord = z.strictObject({
36817
36709
  attemptKey: MyPrsState.shape.keepMergeableAttemptKeys.element,
36818
36710
  autoRebase: MyPrAutoRebase
@@ -37311,7 +37203,7 @@ function myPrsShouldStart(settings) {
37311
37203
  return { start: true };
37312
37204
  }
37313
37205
  //#endregion
37314
- //#region server/my-prs-poller.ts
37206
+ //#region server/github/my-prs-poller.ts
37315
37207
  var MY_PRS_RATE_LIMIT_RESOURCES = ["graphql"];
37316
37208
  function createMyPrsPoller(dependencies) {
37317
37209
  const { org, shouldAutoRebase = false, isKeepMergeableEnabled = true, isMergeQueueEnabled = true, github, onTickComplete, now = Date.now, intervalMinutes = 5, setIntervalFn, clearIntervalFn, setTimeoutFn, clearTimeoutFn, clock, firstTickDelayMs, log } = dependencies;
@@ -37834,7 +37726,7 @@ function installCommitSigningShim({ binDir, nodePath, cliPath, platform = proces
37834
37726
  }
37835
37727
  }
37836
37728
  //#endregion
37837
- //#region server/my-prs-wiring.ts
37729
+ //#region server/github/my-prs-wiring.ts
37838
37730
  var MERGE_ERROR_MAX_CHARACTERS = 300;
37839
37731
  var TRUSTED_GIT_TIMEOUT_MS = 6e5;
37840
37732
  var EMPTY_TREE_SHA = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
@@ -39085,13 +38977,13 @@ function createWorkflowsWiring({ config, notificationManager, spawnSession, log
39085
38977
  };
39086
38978
  }
39087
38979
  //#endregion
39088
- //#region server/core/github-clock-core.ts
38980
+ //#region server/github/core/github-clock-core.ts
39089
38981
  function runsEveryTicks(intervalMs, baseIntervalMs) {
39090
38982
  if (!Number.isFinite(intervalMs) || !Number.isFinite(baseIntervalMs) || baseIntervalMs <= 0) return 1;
39091
38983
  return Math.max(1, Math.round(intervalMs / baseIntervalMs));
39092
38984
  }
39093
38985
  //#endregion
39094
- //#region server/github-clock.ts
38986
+ //#region server/github/github-clock.ts
39095
38987
  function createGithubClock({ baseIntervalMs, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, log = console }) {
39096
38988
  const subscriptions = /* @__PURE__ */ new Set();
39097
38989
  let timer = null;
@@ -39238,7 +39130,7 @@ function createTelegramChannel({ getConfig, getConnectionCount, getActiveAgentCo
39238
39130
  };
39239
39131
  }
39240
39132
  //#endregion
39241
- //#region server/core/usage-budget-core.ts
39133
+ //#region server/usage/core/usage-budget-core.ts
39242
39134
  var BUDGET_THRESHOLDS = Object.freeze([
39243
39135
  50,
39244
39136
  75,
@@ -39379,7 +39271,7 @@ function toneForPct(pct) {
39379
39271
  return "ok";
39380
39272
  }
39381
39273
  //#endregion
39382
- //#region server/core/usage-pricing-core.ts
39274
+ //#region server/usage/core/usage-pricing-core.ts
39383
39275
  var MARGINAL_TIER_THRESHOLD = 2e5;
39384
39276
  function normalizePricingTable(rawLiteLlmJson) {
39385
39277
  const container = rawLiteLlmJson;
@@ -39507,7 +39399,7 @@ function resolvedPrice(key, price, isExact) {
39507
39399
  };
39508
39400
  }
39509
39401
  //#endregion
39510
- //#region server/core/usage-entry-core.ts
39402
+ //#region server/usage/core/usage-entry-core.ts
39511
39403
  var NULL_REJECT_FIELDS = Object.freeze([
39512
39404
  ["id"],
39513
39405
  ["cwd"],
@@ -39797,7 +39689,7 @@ function presentEmpty(value) {
39797
39689
  return typeof value === "string" && value.trim() === "";
39798
39690
  }
39799
39691
  //#endregion
39800
- //#region server/core/usage-aggregate-core.ts
39692
+ //#region server/usage/core/usage-aggregate-core.ts
39801
39693
  function buildUsageReport(entries, { now = Date.now(), blockHours = 5, retainDays = 90, sessionsById = /* @__PURE__ */ new Map(), tz = null } = {}) {
39802
39694
  const keptEntries = pruneEntries(entries, {
39803
39695
  now,
@@ -39920,7 +39812,7 @@ function serializeDailyBucket(bucket) {
39920
39812
  };
39921
39813
  }
39922
39814
  //#endregion
39923
- //#region server/core/usage-savings-core.ts
39815
+ //#region server/usage/core/usage-savings-core.ts
39924
39816
  var DAY_KEY_RE = /^\d{4}-\d{2}-\d{2}$/;
39925
39817
  function normalizeRtkGain(parsed) {
39926
39818
  if (!isRecord(parsed)) return null;
@@ -39980,7 +39872,7 @@ function computeCacheSavings(modelRows, pricingTable) {
39980
39872
  };
39981
39873
  }
39982
39874
  //#endregion
39983
- //#region server/core/usage-statusline-core.ts
39875
+ //#region server/usage/core/usage-statusline-core.ts
39984
39876
  var PCT_DECIMALS = 1;
39985
39877
  var SECONDS_CEILING = 0xe8d4a51000;
39986
39878
  function roundPct(value) {
@@ -40068,7 +39960,7 @@ var claude_pricing_default = {
40068
39960
  models: /* @__PURE__ */ JSON.parse("{\"claude-3-5-haiku-20241022\":{\"input_cost_per_token\":8e-7,\"output_cost_per_token\":0.000004,\"cache_creation_input_token_cost\":0.000001,\"cache_read_input_token_cost\":8e-8,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-5-haiku-latest\":{\"input_cost_per_token\":8e-7,\"output_cost_per_token\":0.000004,\"cache_creation_input_token_cost\":0.000001,\"cache_read_input_token_cost\":8e-8,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-5-sonnet-20240620\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-5-sonnet-20241022\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-5-sonnet-latest\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-7-sonnet-20250219\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-haiku-20240307\":{\"input_cost_per_token\":2.5e-7,\"output_cost_per_token\":0.00000125,\"cache_creation_input_token_cost\":3e-7,\"cache_read_input_token_cost\":3e-8,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-opus-20240229\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.000075,\"cache_creation_input_token_cost\":0.00001875,\"cache_read_input_token_cost\":0.0000015,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-4-opus-20250514\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.000075,\"cache_creation_input_token_cost\":0.00001875,\"cache_read_input_token_cost\":0.0000015,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-4-sonnet-20250514\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\",\"cache_creation_input_token_cost_above_200k_tokens\":0.0000075,\"cache_read_input_token_cost_above_200k_tokens\":6e-7,\"input_cost_per_token_above_200k_tokens\":0.000006,\"output_cost_per_token_above_200k_tokens\":0.0000225},\"claude-fable-5\":{\"input_cost_per_token\":0.00001,\"output_cost_per_token\":0.00005,\"cache_creation_input_token_cost\":0.0000125,\"cache_read_input_token_cost\":0.000001,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-fable-5-1\":{\"input_cost_per_token\":0.00001,\"output_cost_per_token\":0.00005,\"cache_creation_input_token_cost\":0.0000125,\"cache_read_input_token_cost\":2.5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-haiku-4-5\":{\"input_cost_per_token\":0.000001,\"output_cost_per_token\":0.000005,\"cache_creation_input_token_cost\":0.00000125,\"cache_read_input_token_cost\":1e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-haiku-4-5-20251001\":{\"input_cost_per_token\":0.000001,\"output_cost_per_token\":0.000005,\"cache_creation_input_token_cost\":0.00000125,\"cache_read_input_token_cost\":1e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-haiku-5-5\":{\"input_cost_per_token\":1e-7,\"output_cost_per_token\":5e-7,\"cache_creation_input_token_cost\":1.25e-7,\"cache_read_input_token_cost\":1e-8,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\",\"long_context_threshold\":100000,\"input_cost_per_token_above_200k_tokens\":5e-7,\"output_cost_per_token_above_200k_tokens\":0.0000025,\"cache_creation_input_token_cost_above_200k_tokens\":6.25e-7,\"cache_read_input_token_cost_above_200k_tokens\":5e-8},\"claude-mythos-5\":{\"input_cost_per_token\":0.00001,\"output_cost_per_token\":0.00005,\"cache_creation_input_token_cost\":0.0000125,\"cache_read_input_token_cost\":0.000001,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-mythos-5-1\":{\"input_cost_per_token\":0.00001,\"output_cost_per_token\":0.00005,\"cache_creation_input_token_cost\":0.0000125,\"cache_read_input_token_cost\":2.5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-mythos-preview\":{\"input_cost_per_token\":0.00001,\"output_cost_per_token\":0.00005,\"cache_creation_input_token_cost\":0.0000125,\"cache_read_input_token_cost\":0.000001,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-1\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.000075,\"cache_creation_input_token_cost\":0.00001875,\"cache_read_input_token_cost\":0.0000015,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-1-20250805\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.000075,\"cache_creation_input_token_cost\":0.00001875,\"cache_read_input_token_cost\":0.0000015,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-20250514\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.000075,\"cache_creation_input_token_cost\":0.00001875,\"cache_read_input_token_cost\":0.0000015,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-5\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-5-20251101\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-6\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-6-20260205\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-7\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-7-20260416\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-8\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-5\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-5-5\":{\"input_cost_per_token\":0.000004,\"output_cost_per_token\":0.00002,\"cache_creation_input_token_cost\":0.000005,\"cache_read_input_token_cost\":2e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-sonnet-4-20250514\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\",\"cache_creation_input_token_cost_above_200k_tokens\":0.0000075,\"cache_read_input_token_cost_above_200k_tokens\":6e-7,\"input_cost_per_token_above_200k_tokens\":0.000006,\"output_cost_per_token_above_200k_tokens\":0.0000225},\"claude-sonnet-4-5\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\",\"cache_creation_input_token_cost_above_1hr_above_200k_tokens\":0.000012,\"cache_creation_input_token_cost_above_200k_tokens\":0.0000075,\"cache_read_input_token_cost_above_200k_tokens\":6e-7,\"input_cost_per_token_above_200k_tokens\":0.000006,\"output_cost_per_token_above_200k_tokens\":0.0000225},\"claude-sonnet-4-5-20250929\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\",\"cache_creation_input_token_cost_above_1hr_above_200k_tokens\":0.000012,\"cache_creation_input_token_cost_above_200k_tokens\":0.0000075,\"cache_read_input_token_cost_above_200k_tokens\":6e-7,\"input_cost_per_token_above_200k_tokens\":0.000006,\"output_cost_per_token_above_200k_tokens\":0.0000225},\"claude-sonnet-4-6\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-sonnet-5\":{\"input_cost_per_token\":0.000002,\"output_cost_per_token\":0.00001,\"cache_creation_input_token_cost\":0.0000025,\"cache_read_input_token_cost\":2e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-sonnet-5-5\":{\"input_cost_per_token\":0.000002,\"output_cost_per_token\":0.00001,\"cache_creation_input_token_cost\":0.0000025,\"cache_read_input_token_cost\":2e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"gpt-5\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-2025-08-07\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-chat\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":128000,\"litellm_provider\":\"openai\"},\"gpt-5-chat-latest\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":128000,\"litellm_provider\":\"openai\"},\"gpt-5-codex\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-mini\":{\"input_cost_per_token\":2.5e-7,\"output_cost_per_token\":0.000002,\"cache_read_input_token_cost\":2.5e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-mini-2025-08-07\":{\"input_cost_per_token\":2.5e-7,\"output_cost_per_token\":0.000002,\"cache_read_input_token_cost\":2.5e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-nano\":{\"input_cost_per_token\":5e-8,\"output_cost_per_token\":4e-7,\"cache_read_input_token_cost\":5e-9,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-nano-2025-08-07\":{\"input_cost_per_token\":5e-8,\"output_cost_per_token\":4e-7,\"cache_read_input_token_cost\":5e-9,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-pro\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.00012,\"max_input_tokens\":400000,\"litellm_provider\":\"openai\"},\"gpt-5-pro-2025-10-06\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.00012,\"max_input_tokens\":400000,\"litellm_provider\":\"openai\"},\"gpt-5-search-api\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-search-api-2025-10-14\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.1\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.1-2025-11-13\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.1-chat-latest\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":128000,\"litellm_provider\":\"openai\"},\"gpt-5.1-codex\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.1-codex-max\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.1-codex-mini\":{\"input_cost_per_token\":2.5e-7,\"output_cost_per_token\":0.000002,\"cache_read_input_token_cost\":2.5e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.2\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.2-2025-12-11\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.2-chat-latest\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":128000,\"litellm_provider\":\"openai\"},\"gpt-5.2-codex\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.2-pro\":{\"input_cost_per_token\":0.000021,\"output_cost_per_token\":0.000168,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.2-pro-2025-12-11\":{\"input_cost_per_token\":0.000021,\"output_cost_per_token\":0.000168,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.3-chat-latest\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":128000,\"litellm_provider\":\"openai\"},\"gpt-5.3-codex\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.4\":{\"input_cost_per_token\":0.0000025,\"output_cost_per_token\":0.000015,\"cache_read_input_token_cost\":2.5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.4-2026-03-05\":{\"input_cost_per_token\":0.0000025,\"output_cost_per_token\":0.000015,\"cache_read_input_token_cost\":2.5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.4-mini\":{\"input_cost_per_token\":7.5e-7,\"output_cost_per_token\":0.0000045,\"cache_read_input_token_cost\":7.5e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.4-mini-2026-03-17\":{\"input_cost_per_token\":7.5e-7,\"output_cost_per_token\":0.0000045,\"cache_read_input_token_cost\":7.5e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.4-nano\":{\"input_cost_per_token\":2e-7,\"output_cost_per_token\":0.00000125,\"cache_read_input_token_cost\":2e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.4-nano-2026-03-17\":{\"input_cost_per_token\":2e-7,\"output_cost_per_token\":0.00000125,\"cache_read_input_token_cost\":2e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.4-pro\":{\"input_cost_per_token\":0.00003,\"output_cost_per_token\":0.00018,\"cache_read_input_token_cost\":0.000003,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.4-pro-2026-03-05\":{\"input_cost_per_token\":0.00003,\"output_cost_per_token\":0.00018,\"cache_read_input_token_cost\":0.000003,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.5\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.00003,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.5-2026-04-23\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.00003,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.5-pro\":{\"input_cost_per_token\":0.00003,\"output_cost_per_token\":0.00018,\"cache_read_input_token_cost\":0.000003,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.5-pro-2026-04-23\":{\"input_cost_per_token\":0.00003,\"output_cost_per_token\":0.00018,\"cache_read_input_token_cost\":0.000003,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.6\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.00003,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.6-luna\":{\"input_cost_per_token\":2e-7,\"output_cost_per_token\":0.0000012,\"cache_creation_input_token_cost\":2.5e-7,\"cache_read_input_token_cost\":2e-8,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.6-sol\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.00003,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.6-terra\":{\"input_cost_per_token\":0.000002,\"output_cost_per_token\":0.000012,\"cache_creation_input_token_cost\":0.0000025,\"cache_read_input_token_cost\":2e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"}}")
40069
39961
  };
40070
39962
  //#endregion
40071
- //#region server/usage-pricing.ts
39963
+ //#region server/usage/usage-pricing.ts
40072
39964
  var LITELLM_PRICING_URL = "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json";
40073
39965
  var CACHE_TTL_MS = 864e5;
40074
39966
  var SNAPSHOT_FIELDS = Object.freeze([
@@ -40230,7 +40122,7 @@ async function loadPricing({ fetchEnabled, fsPromises = fsp, fetchFn = globalThi
40230
40122
  };
40231
40123
  }
40232
40124
  //#endregion
40233
- //#region server/core/usage-anomaly-core.ts
40125
+ //#region server/usage/core/usage-anomaly-core.ts
40234
40126
  function dailyBaseline(dailyRows, { excludeDay } = {}) {
40235
40127
  const usableRows = (dailyRows || []).filter((row) => isUsableDailyRow(row, excludeDay));
40236
40128
  if (usableRows.length < 7) return null;
@@ -40284,7 +40176,7 @@ function tokensPerMinute(block) {
40284
40176
  return numberOr(block.tokens, 0) / (durationMs / 6e4);
40285
40177
  }
40286
40178
  //#endregion
40287
- //#region server/core/usage-blocks-core.ts
40179
+ //#region server/usage/core/usage-blocks-core.ts
40288
40180
  var HOUR_MS = 36e5;
40289
40181
  function buildBlocks(entriesAsc, { blockHours = 5, now = Date.now() } = {}) {
40290
40182
  const duration = blockHours * HOUR_MS;
@@ -40373,7 +40265,7 @@ function hourFloor(timestampMs) {
40373
40265
  return Math.floor(timestampMs / HOUR_MS) * HOUR_MS;
40374
40266
  }
40375
40267
  //#endregion
40376
- //#region server/core/usage-codex-core.ts
40268
+ //#region server/usage/core/usage-codex-core.ts
40377
40269
  function createCodexUsageState() {
40378
40270
  return {
40379
40271
  model: null,
@@ -40455,7 +40347,7 @@ function deltaFromTotal(totalUsage, previousTotalUsage) {
40455
40347
  };
40456
40348
  }
40457
40349
  //#endregion
40458
- //#region server/core/usage-grok-core.ts
40350
+ //#region server/usage/core/usage-grok-core.ts
40459
40351
  function parseGrokUsageLine(line) {
40460
40352
  const raw = parseJsonLine(line, "\"turn_completed\"");
40461
40353
  if (!raw) return null;
@@ -40523,7 +40415,7 @@ function normalizeGrokModel(model) {
40523
40415
  return stripped.endsWith("-build") ? stripped.slice(0, -6) : stripped;
40524
40416
  }
40525
40417
  //#endregion
40526
- //#region server/core/usage-warehouse-core.ts
40418
+ //#region server/usage/core/usage-warehouse-core.ts
40527
40419
  function rollupFromReport(daily) {
40528
40420
  const records = [];
40529
40421
  for (const dayRow of daily || []) {
@@ -40638,7 +40530,7 @@ function compareRecords(a, b) {
40638
40530
  return a.model.localeCompare(b.model);
40639
40531
  }
40640
40532
  //#endregion
40641
- //#region server/usage-scanner.ts
40533
+ //#region server/usage/usage-scanner.ts
40642
40534
  var DEFAULT_BYTE_BUDGET = 67108864;
40643
40535
  var DEFAULT_CHUNK_SIZE = 1048576;
40644
40536
  var LINE_YIELD_INTERVAL = 5e3;
@@ -41577,7 +41469,7 @@ function createUsageScanner(deps = {}) {
41577
41469
  return api;
41578
41470
  }
41579
41471
  //#endregion
41580
- //#region server/usage-wiring.ts
41472
+ //#region server/usage/usage-wiring.ts
41581
41473
  var DEFAULT_USAGE_CONFIG = Object.freeze({
41582
41474
  enabled: true,
41583
41475
  fetchPricing: true,
@@ -42179,7 +42071,7 @@ function createUsageWiring({ config, sessions = /* @__PURE__ */ new Map(), broad
42179
42071
  };
42180
42072
  }
42181
42073
  //#endregion
42182
- //#region server/usage-lane-ledger.ts
42074
+ //#region server/usage/usage-lane-ledger.ts
42183
42075
  function createLaneLedger({ ledgerPath = null, fsPromises = fsp, nowFn = Date.now, retainDays = 365, logger = null } = {}) {
42184
42076
  const laneLog = createLaneLog({
42185
42077
  prefix: "[usage]",
@@ -42489,7 +42381,7 @@ function traceRecordsFromTranscriptLine(rawLine, context) {
42489
42381
  return [rawRecord(rawLine, line, context)];
42490
42382
  }
42491
42383
  //#endregion
42492
- //#region server/core/session-trace-core.ts
42384
+ //#region server/session/core/session-trace-core.ts
42493
42385
  var MAX_SESSION_TRACE_READ_BYTES = 524288;
42494
42386
  function unreadableRecordNotice(request, lineByteCount) {
42495
42387
  return {
@@ -43378,7 +43270,7 @@ function createUploadsWiring({ configPath, liveSessionIds, setIntervalFn = DEFAU
43378
43270
  };
43379
43271
  }
43380
43272
  //#endregion
43381
- //#region server/visions-dispatch.ts
43273
+ //#region server/visions/visions-dispatch.ts
43382
43274
  var RESULT_VERDICTS = /* @__PURE__ */ new Set([
43383
43275
  "COMMENTS",
43384
43276
  "NONE",
@@ -43738,7 +43630,7 @@ function fix(sourceDiagnostic, editRange, newText) {
43738
43630
  };
43739
43631
  }
43740
43632
  //#endregion
43741
- //#region server/core/visions-fix-core.ts
43633
+ //#region server/visions/core/visions-fix-core.ts
43742
43634
  var AUTO_SAFE_CODES = Object.freeze(["repeated-word"]);
43743
43635
  var QUICKFIX_KIND = "quickfix";
43744
43636
  var FIX_TITLES = {
@@ -44856,7 +44748,7 @@ function createVisionsWiring({ debounceMs = 300, setTimeoutFn = DEFAULT_TIMER_FN
44856
44748
  };
44857
44749
  }
44858
44750
  //#endregion
44859
- //#region server/backend-lanes.ts
44751
+ //#region server/backend/backend-lanes.ts
44860
44752
  function createBackendLanes(dependencies) {
44861
44753
  const { config, makeSession, wireSessionEvents, configStore, sessions, agentSessions, sandboxRefusal, reviewSessions, investigationSessions, closeSessionDataClients, hookRouter, getHookPort, broadcastControl, broadcastLocalControl, controlWss, options, notificationManager, telemetry, logger } = dependencies;
44862
44754
  const spawnGate = createSpawnGate();
@@ -44869,16 +44761,24 @@ function createBackendLanes(dependencies) {
44869
44761
  });
44870
44762
  laneLedger.load();
44871
44763
  const recordLane = laneLedger.record;
44872
- const allLiveSessions = () => [
44873
- ...sessions.values(),
44874
- ...agentSessions.values(),
44875
- ...reviewSessions.values(),
44876
- ...investigationSessions.values(),
44877
- ...visionsSessions.values(),
44878
- ...changeMapSessions.values(),
44879
- ...taskTitleSessions.values(),
44880
- ...benchmarkSessions.values()
44764
+ const liveSessionMaps = () => [
44765
+ sessions,
44766
+ agentSessions,
44767
+ reviewSessions,
44768
+ investigationSessions,
44769
+ visionsSessions,
44770
+ changeMapSessions,
44771
+ taskTitleSessions,
44772
+ benchmarkSessions
44881
44773
  ];
44774
+ const allLiveSessions = () => liveSessionMaps().flatMap((sessionsById) => [...sessionsById.values()]);
44775
+ const findLiveSession = (id) => {
44776
+ for (const sessionsById of liveSessionMaps()) {
44777
+ const session = sessionsById.get(id);
44778
+ if (session) return session;
44779
+ }
44780
+ return null;
44781
+ };
44882
44782
  const branchGc = createBranchGcWiring({
44883
44783
  config,
44884
44784
  gitWorkspace,
@@ -44935,7 +44835,7 @@ function createBackendLanes(dependencies) {
44935
44835
  workLane: { sandboxRefusal }
44936
44836
  }
44937
44837
  });
44938
- const posthog = createPosthogWiring({
44838
+ const posthog = createRadarWiring({
44939
44839
  config,
44940
44840
  investigationSessions,
44941
44841
  closeSessionDataClients,
@@ -45312,6 +45212,7 @@ function createBackendLanes(dependencies) {
45312
45212
  }
45313
45213
  return {
45314
45214
  allLiveSessions,
45215
+ findLiveSession,
45315
45216
  benchmarks,
45316
45217
  benchmarkSessions,
45317
45218
  branchGc,
@@ -45349,7 +45250,7 @@ function createBackendLanes(dependencies) {
45349
45250
  };
45350
45251
  }
45351
45252
  //#endregion
45352
- //#region server/backend-health.ts
45253
+ //#region server/backend/backend-health.ts
45353
45254
  var HEALTH_SNAPSHOT_INTERVAL_MS = 1e4;
45354
45255
  function createBackendHealth(dependencies) {
45355
45256
  function buildHealthSnapshot() {
@@ -45853,6 +45754,9 @@ function planReplay(entries, { now = Date.now(), maxAgeMs = DEFAULT_MAX_AGE_MS,
45853
45754
  expired
45854
45755
  };
45855
45756
  }
45757
+ //#endregion
45758
+ //#region notifications/telegram-outbox.ts
45759
+ var OUTBOX_VERSION = 1;
45856
45760
  var DEFAULT_RETRY_INTERVAL_MS = 6e4;
45857
45761
  function createTelegramOutbox({ filePath, send, now = Date.now, maxEntries = 50, maxAttempts = 5, maxAgeMs = DEFAULT_MAX_AGE_MS, retryIntervalMs = DEFAULT_RETRY_INTERVAL_MS, warn = console.warn, readFileSync = fs.readFileSync, writeJson = writeJsonAtomic, recordOutcome = () => {} }) {
45858
45762
  let entries = [];
@@ -45902,7 +45806,7 @@ function createTelegramOutbox({ filePath, send, now = Date.now, maxEntries = 50,
45902
45806
  }
45903
45807
  function persist() {
45904
45808
  const snapshot = {
45905
- version: 1,
45809
+ version: OUTBOX_VERSION,
45906
45810
  entries: entries.slice()
45907
45811
  };
45908
45812
  return writeQueue.run(() => writeJson(filePath, snapshot, { mkdir: true })).catch((error) => warn(`[telegram-outbox] write failed: ${errorMessage(error)}`));
@@ -46059,7 +45963,7 @@ function createHeartbeat({ servers = [], intervalMs = DEFAULT_INTERVAL_MS, deadl
46059
45963
  };
46060
45964
  }
46061
45965
  //#endregion
46062
- //#region server/backend-notifications.ts
45966
+ //#region server/backend/backend-notifications.ts
46063
45967
  var ESCALATION_INTERVAL_MS = 3e5;
46064
45968
  var DEFAULT_PHONE_ESCALATION_MS = 3e5;
46065
45969
  function createBackendNotifications(dependencies) {
@@ -46190,7 +46094,7 @@ function formatDiffAnnotationMessage(annotations) {
46190
46094
  ].join("\n");
46191
46095
  }
46192
46096
  //#endregion
46193
- //#region server/core/github-issues-core.ts
46097
+ //#region server/github/core/github-issues-core.ts
46194
46098
  var GITHUB_ISSUE_BODY_MAX_CHARS = 12e3;
46195
46099
  function fencedBody(body) {
46196
46100
  const longestBacktickRun = Math.max(0, ...Array.from(body.matchAll(/`+/g), (match) => match[0].length));
@@ -46240,7 +46144,7 @@ function buildSettingsPayload({ configStore, rtkInstallStatus = null, resolveRtk
46240
46144
  };
46241
46145
  }
46242
46146
  //#endregion
46243
- //#region server/core/change-map-core.ts
46147
+ //#region server/change-map/core/change-map-core.ts
46244
46148
  var STATUS_BY_LETTER = {
46245
46149
  A: "added",
46246
46150
  C: "added",
@@ -46420,7 +46324,7 @@ function computeCoChange({ repoName, commits, changedPaths }) {
46420
46324
  };
46421
46325
  }
46422
46326
  //#endregion
46423
- //#region server/core/change-ownership-core.ts
46327
+ //#region server/change-map/core/change-ownership-core.ts
46424
46328
  function readAgentsTitle(markdown) {
46425
46329
  return markdown.match(/^# (.*)$/m)?.[1].trim() ?? "";
46426
46330
  }
@@ -47004,7 +46908,7 @@ function computeCrossRepoLinks(repos) {
47004
46908
  return linksByConsumer;
47005
46909
  }
47006
46910
  //#endregion
47007
- //#region server/change-map-wiring.ts
46911
+ //#region server/change-map/change-map-wiring.ts
47008
46912
  var GIT_TIMEOUT_MS = 15e3;
47009
46913
  var GIT_MAX_BUFFER_BYTES = 67108864;
47010
46914
  var FILE_READ_BATCH = 64;
@@ -47525,7 +47429,6 @@ Object.freeze([
47525
47429
  ...USAGE_VENDOR_KEYS.map((key) => `usage.vendors.${key}`),
47526
47430
  ...USAGE_BUDGET_KEYS.map((key) => `usage.budget.${key}`),
47527
47431
  ...TELEGRAM_STRING_KEYS.map((key) => `telegram.${key}`),
47528
- "agentApi.enabled",
47529
47432
  "guardrails.unguardedRepos",
47530
47433
  "guardrails.blockedPaths",
47531
47434
  "guardrails.unreadablePaths",
@@ -47598,16 +47501,16 @@ function requestValidationErrorReply(msg, message) {
47598
47501
  agents: [],
47599
47502
  error: message
47600
47503
  }),
47601
- "get-posthog-report": () => ({
47602
- type: "posthog-report",
47504
+ "get-radar-report": () => ({
47505
+ type: "radar-report",
47603
47506
  requestId,
47604
47507
  ok: false,
47605
47508
  found: false,
47606
47509
  issueId: null,
47607
47510
  error: message
47608
47511
  }),
47609
- "posthog-open-session": () => ({
47610
- type: "posthog-open-session-result",
47512
+ "radar-open-session": () => ({
47513
+ type: "radar-open-session-result",
47611
47514
  requestId,
47612
47515
  ok: false,
47613
47516
  error: message
@@ -47625,14 +47528,14 @@ function requestValidationErrorReply(msg, message) {
47625
47528
  ok: false,
47626
47529
  error: message
47627
47530
  }),
47628
- "posthog-issue-action": () => ({
47629
- type: "posthog-issue-action-result",
47531
+ "radar-issue-action": () => ({
47532
+ type: "radar-issue-action-result",
47630
47533
  requestId,
47631
47534
  ok: false,
47632
47535
  error: message
47633
47536
  }),
47634
- "posthog-archive-investigation": () => ({
47635
- type: "posthog-archive-investigation-result",
47537
+ "radar-archive-investigation": () => ({
47538
+ type: "radar-archive-investigation-result",
47636
47539
  requestId,
47637
47540
  ok: false,
47638
47541
  error: message
@@ -47644,8 +47547,8 @@ function requestValidationErrorReply(msg, message) {
47644
47547
  ok: false,
47645
47548
  error: message
47646
47549
  }),
47647
- "reviews-refresh": () => ({
47648
- type: "reviews-refresh-result",
47550
+ "github-polling-refresh": () => ({
47551
+ type: "github-polling-refresh-result",
47649
47552
  requestId,
47650
47553
  ok: false,
47651
47554
  error: message
@@ -47767,7 +47670,7 @@ function parseSinceParam(url) {
47767
47670
  return Number.isFinite(n) ? n : null;
47768
47671
  }
47769
47672
  function registerControlHandlers(controlWss, deps) {
47770
- const { sessions, agentSessions = /* @__PURE__ */ new Map(), config, configStore, broadcastControl, generateProjectId, applyConfigReload, applySettingsReload, requestShutdown, requestRestart, handleClientFocus, buildHealthSnapshot, getUpdateStatus, getUpdateJournal = null, checkNow = null, applyUpdate = null, isStaging = null, noteRestartRequested = null, getPosthogStatus, posthogReportsDir = null, posthogSetIssueStatus = null, posthogArchiveInvestigation = null, getTeamReviewStatus = null, getMyPrsStatus = null, getIssuesStatus = null, issues = null, teamReview = null, myPrs = null, getBenchmarkStatus = null, getFactoryState = null, benchmarks = null, factory = null, createGithubClient = createPrGh, issueProjectRepos = null, serverBuild = () => null, getUsageSessions = null, getUsageReport = null, requestUsageReport = null, getPlanLimits = null, controlReplayLog = null, getRtkInstallStatus = () => null, resolveRtkPath = () => getRtkPath(), conversationFs = fs, conversationGit = runGitForConversationHistory, conversationProjectsDir = claudeProjectsDir(process.env, os.homedir()), readTracePage = null, readPlanRevision = null, decidePlanReview = null, sessionDocs = null, changeMapNarrator = null } = deps;
47673
+ const { sessions, agentSessions = /* @__PURE__ */ new Map(), config, configStore, broadcastControl, generateProjectId, applyConfigReload, applySettingsReload, requestShutdown, requestRestart, handleClientFocus, buildHealthSnapshot, getUpdateStatus, getUpdateJournal = null, checkNow = null, applyUpdate = null, isStaging = null, noteRestartRequested = null, getRadarStatus, posthogReportsDir = null, posthogSetIssueStatus = null, radarArchiveInvestigation = null, getTeamReviewStatus = null, getMyPrsStatus = null, getIssuesStatus = null, issues = null, teamReview = null, myPrs = null, getBenchmarkStatus = null, getFactoryState = null, benchmarks = null, factory = null, createGithubClient = createPrGh, issueProjectRepos = null, serverBuild = () => null, getUsageSessions = null, getUsageReport = null, requestUsageReport = null, getPlanLimits = null, controlReplayLog = null, getRtkInstallStatus = () => null, resolveRtkPath = () => getRtkPath(), conversationFs = fs, conversationGit = runGitForConversationHistory, conversationProjectsDir = claudeProjectsDir(process.env, os.homedir()), readTracePage = null, readPlanRevision = null, decidePlanReview = null, sessionDocs = null, changeMapNarrator = null } = deps;
47771
47674
  const changeMaps = createChangeMapService({
47772
47675
  sessions,
47773
47676
  narrator: changeMapNarrator,
@@ -47852,7 +47755,7 @@ function registerControlHandlers(controlWss, deps) {
47852
47755
  repos,
47853
47756
  agent: requestedAgent && requestedAgent !== DEFAULT_AGENT_ID ? requestedAgent : void 0,
47854
47757
  dangerouslySkipPermissions: skipPerms,
47855
- unconfined: msg.unconfined === true,
47758
+ unguarded: msg.unguarded === true,
47856
47759
  requireExistingPath: !repos
47857
47760
  });
47858
47761
  if (!created.ok) {
@@ -48191,7 +48094,6 @@ function registerControlHandlers(controlWss, deps) {
48191
48094
  if (s.usage != null) cfg.usage = s.usage;
48192
48095
  if (incoming.ingest != null) cfg.ingest = mergeSettingsBlock(cfg.ingest, incoming.ingest, INGEST_SPEC);
48193
48096
  if (s.telegram != null) cfg.telegram = mergeSettingsBlockOverStored(cfg.telegram, s.telegram);
48194
- if (s.agentApi != null) cfg.agentApi = mergeSettingsBlockOverStored(cfg.agentApi, s.agentApi);
48195
48097
  if (s.guardrails != null) cfg.guardrails = mergeSettingsBlockOverStored(cfg.guardrails, s.guardrails);
48196
48098
  if (s.telemetry != null) cfg.telemetry = mergeSettingsBlockOverStored(cfg.telemetry, s.telemetry);
48197
48099
  if (!workflowsUpdate) return void 0;
@@ -48253,16 +48155,16 @@ function registerControlHandlers(controlWss, deps) {
48253
48155
  directories
48254
48156
  }));
48255
48157
  }
48256
- async function handleGetPosthogReport(msg, ws) {
48158
+ async function handleGetRadarReport(msg, ws) {
48257
48159
  const result = await readPosthogReport(msg.issueId, { reportDir: posthogReportsDir || void 0 });
48258
48160
  ws.send(JSON.stringify({
48259
- type: "posthog-report",
48161
+ type: "radar-report",
48260
48162
  requestId: msg.requestId || null,
48261
48163
  ...result
48262
48164
  }));
48263
48165
  }
48264
48166
  function findPosthogIssue(projectId, issueId) {
48265
- const status = typeof getPosthogStatus === "function" ? getPosthogStatus() : null;
48167
+ const status = typeof getRadarStatus === "function" ? getRadarStatus() : null;
48266
48168
  const projects = Array.isArray(status?.projects) ? status.projects : [];
48267
48169
  for (const project of projects) {
48268
48170
  if (String(project.projectId) !== String(projectId)) continue;
@@ -48305,7 +48207,7 @@ function registerControlHandlers(controlWss, deps) {
48305
48207
  }
48306
48208
  return entries;
48307
48209
  }
48308
- function createProjectSession({ name, path: projectPath, repos, agent, dangerouslySkipPermissions, unconfined, requireExistingPath }) {
48210
+ function createProjectSession({ name, path: projectPath, repos, agent, dangerouslySkipPermissions, unguarded, requireExistingPath }) {
48309
48211
  for (const [, session] of sessions) {
48310
48212
  if (session.name !== name) continue;
48311
48213
  return {
@@ -48346,7 +48248,7 @@ function registerControlHandlers(controlWss, deps) {
48346
48248
  };
48347
48249
  if (workspaceRepos) project.repos = workspaceRepos;
48348
48250
  if (typeof dangerouslySkipPermissions === "boolean") project.dangerouslySkipPermissions = dangerouslySkipPermissions;
48349
- if (unconfined) project.unguarded = true;
48251
+ if (unguarded) project.unguarded = true;
48350
48252
  if (agent) project.agent = agent;
48351
48253
  const freshConfig = configStore.save((cfg) => {
48352
48254
  cfg.projects.push(project);
@@ -48460,7 +48362,7 @@ function registerControlHandlers(controlWss, deps) {
48460
48362
  path: project.path,
48461
48363
  agent: project.agent,
48462
48364
  dangerouslySkipPermissions: project.dangerouslySkipPermissions,
48463
- unconfined: project.unguarded
48365
+ unguarded: project.unguarded
48464
48366
  });
48465
48367
  if (!created.ok) {
48466
48368
  reply({ error: created.error });
@@ -48492,8 +48394,8 @@ function registerControlHandlers(controlWss, deps) {
48492
48394
  reply({ error: `Could not open GitHub issue session: ${errorMessage(error)}` });
48493
48395
  }
48494
48396
  }
48495
- function handlePosthogOpenSession(msg, ws) {
48496
- const reply = (payload) => replyTo(ws, msg, "posthog-open-session-result", {
48397
+ function handleRadarOpenSession(msg, ws) {
48398
+ const reply = (payload) => replyTo(ws, msg, "radar-open-session-result", {
48497
48399
  ok: false,
48498
48400
  error: null,
48499
48401
  ...payload
@@ -48537,8 +48439,8 @@ function registerControlHandlers(controlWss, deps) {
48537
48439
  });
48538
48440
  console.log(`[control] posthog-open-session: issue=${ref.issueId} -> session=${sess.name}`);
48539
48441
  }
48540
- async function handlePosthogIssueAction(msg, ws) {
48541
- const reply = (payload) => replyTo(ws, msg, "posthog-issue-action-result", {
48442
+ async function handleRadarIssueAction(msg, ws) {
48443
+ const reply = (payload) => replyTo(ws, msg, "radar-issue-action-result", {
48542
48444
  ok: false,
48543
48445
  error: null,
48544
48446
  ...payload
@@ -48595,20 +48497,20 @@ function registerControlHandlers(controlWss, deps) {
48595
48497
  }
48596
48498
  reply(await teamReview.submitAction(parsed.data));
48597
48499
  }
48598
- async function handleReviewsRefresh(msg, ws) {
48500
+ async function handleGithubPollingRefresh(msg, ws) {
48599
48501
  const lane = {
48600
48502
  "my-prs": myPrs,
48601
48503
  "team-review": teamReview,
48602
48504
  issues
48603
48505
  }[msg.lane];
48604
48506
  if (!lane?.refresh) {
48605
- replyTo(ws, msg, "reviews-refresh-result", {
48507
+ replyTo(ws, msg, "github-polling-refresh-result", {
48606
48508
  ok: false,
48607
48509
  error: "Reviews polling is not running."
48608
48510
  });
48609
48511
  return;
48610
48512
  }
48611
- replyTo(ws, msg, "reviews-refresh-result", await lane.refresh());
48513
+ replyTo(ws, msg, "github-polling-refresh-result", await lane.refresh());
48612
48514
  }
48613
48515
  async function handleMyPrMerge(msg, ws) {
48614
48516
  const reply = (outcome) => replyTo(ws, msg, "my-pr-merge-result", {
@@ -48727,8 +48629,8 @@ function registerControlHandlers(controlWss, deps) {
48727
48629
  }
48728
48630
  replyTo(ws, msg, "benchmark-action-result", await benchmarks.submitAction(parsed.data));
48729
48631
  }
48730
- async function handlePosthogArchiveInvestigation(msg, ws) {
48731
- const reply = (payload) => replyTo(ws, msg, "posthog-archive-investigation-result", {
48632
+ async function handleRadarArchiveInvestigation(msg, ws) {
48633
+ const reply = (payload) => replyTo(ws, msg, "radar-archive-investigation-result", {
48732
48634
  ok: false,
48733
48635
  error: null,
48734
48636
  ...payload
@@ -48738,11 +48640,11 @@ function registerControlHandlers(controlWss, deps) {
48738
48640
  reply({ error: ref.error });
48739
48641
  return;
48740
48642
  }
48741
- if (!posthogArchiveInvestigation) {
48643
+ if (!radarArchiveInvestigation) {
48742
48644
  reply({ error: "PostHog monitoring is not running" });
48743
48645
  return;
48744
48646
  }
48745
- const res = await posthogArchiveInvestigation({ id: ref.id });
48647
+ const res = await radarArchiveInvestigation({ id: ref.id });
48746
48648
  reply({
48747
48649
  ok: res.ok === true,
48748
48650
  error: res.error || null
@@ -48963,17 +48865,17 @@ function registerControlHandlers(controlWss, deps) {
48963
48865
  "update-settings": handleUpdateSettings,
48964
48866
  "scan-repo-roots": handleScanRepoRoots,
48965
48867
  "list-agents": handleListAgents,
48966
- "get-posthog-report": handleGetPosthogReport,
48967
- "posthog-open-session": handlePosthogOpenSession,
48868
+ "get-radar-report": handleGetRadarReport,
48869
+ "radar-open-session": handleRadarOpenSession,
48968
48870
  "issue-detail": handleIssueDetail,
48969
48871
  "open-issue-session": (msg, ws) => issueOpenQueue.run(`${msg.repo.toLowerCase()}#${msg.issueNumber}`, () => handleOpenIssueSession(msg, ws)),
48970
- "posthog-issue-action": handlePosthogIssueAction,
48971
- "posthog-archive-investigation": handlePosthogArchiveInvestigation,
48872
+ "radar-issue-action": handleRadarIssueAction,
48873
+ "radar-archive-investigation": handleRadarArchiveInvestigation,
48972
48874
  "team-review-action": handleTeamReviewAction,
48973
48875
  "my-pr-merge": handleMyPrMerge,
48974
48876
  "my-pr-keep-mergeable": handleMyPrKeepMergeable,
48975
48877
  "my-pr-merge-when-ready": handleMyPrMergeWhenReady,
48976
- "reviews-refresh": handleReviewsRefresh,
48878
+ "github-polling-refresh": handleGithubPollingRefresh,
48977
48879
  "benchmark-action": handleBenchmarkAction,
48978
48880
  "factory-queue-intent": handleFactoryQueueIntent,
48979
48881
  "factory-control": handleFactoryControl,
@@ -49278,8 +49180,8 @@ function registerControlHandlers(controlWss, deps) {
49278
49180
  type: "update-progress",
49279
49181
  journal: updateJournal
49280
49182
  }));
49281
- const posthogStatus = typeof getPosthogStatus === "function" ? getPosthogStatus() : null;
49282
- if (posthogStatus) ws.send(JSON.stringify(posthogStatus));
49183
+ const radarStatus = typeof getRadarStatus === "function" ? getRadarStatus() : null;
49184
+ if (radarStatus) ws.send(JSON.stringify(radarStatus));
49283
49185
  const teamReviewStatus = typeof getTeamReviewStatus === "function" ? getTeamReviewStatus() : null;
49284
49186
  if (teamReviewStatus) ws.send(JSON.stringify(teamReviewStatus));
49285
49187
  const myPrsStatus = typeof getMyPrsStatus === "function" ? getMyPrsStatus() : null;
@@ -49330,7 +49232,7 @@ function registerControlHandlers(controlWss, deps) {
49330
49232
  return { buildSnapshot };
49331
49233
  }
49332
49234
  //#endregion
49333
- //#region server/backend-control.ts
49235
+ //#region server/backend/backend-control.ts
49334
49236
  function createBackendControl(dependencies) {
49335
49237
  const { controlWss, sessions, config, configStore, broadcastControl, controlReplayLog, laneAssembly, posthog, teamReview, myPrs, issues, benchmarks, usage, logger } = dependencies;
49336
49238
  registerControlHandlers(controlWss, {
@@ -49356,9 +49258,9 @@ function createBackendControl(dependencies) {
49356
49258
  applyUpdate: dependencies.applyUpdate,
49357
49259
  isStaging: dependencies.isStaging,
49358
49260
  noteRestartRequested: dependencies.noteRestartRequested,
49359
- getPosthogStatus: () => posthog.getStatus(),
49261
+ getRadarStatus: () => posthog.getStatus(),
49360
49262
  posthogSetIssueStatus: (args) => posthog.setIssueStatus(args),
49361
- posthogArchiveInvestigation: (args) => posthog.archiveInvestigation(args),
49263
+ radarArchiveInvestigation: (args) => posthog.archiveInvestigation(args),
49362
49264
  getTeamReviewStatus: () => teamReview.getStatus(),
49363
49265
  getMyPrsStatus: () => myPrs.getStatus(),
49364
49266
  getIssuesStatus: () => issues.getStatus(),
@@ -50073,7 +49975,7 @@ async function checkForUpdate({ currentVersion, updateChannel = "release", fetch
50073
49975
  }
50074
49976
  }
50075
49977
  //#endregion
50076
- //#region server/backend-update.ts
49978
+ //#region server/backend/backend-update.ts
50077
49979
  var UPDATE_RECHECK_MS = 864e5;
50078
49980
  function journalSummary(journal) {
50079
49981
  if (!journal) return null;
@@ -50944,7 +50846,7 @@ function createRecorder(sessionName, captureConfig, recordSignals = true) {
50944
50846
  });
50945
50847
  }
50946
50848
  //#endregion
50947
- //#region server/session-factory.ts
50849
+ //#region server/session/session-factory.ts
50948
50850
  function createSessionFactory(dependencies) {
50949
50851
  function planLimitsEnabled(config) {
50950
50852
  const usageConfig = resolveUsageConfig(config.usage);
@@ -50994,7 +50896,6 @@ function createSessionFactory(dependencies) {
50994
50896
  planReviewPort: dependencies.getPlanReviewPort(),
50995
50897
  planLimits: planLimitsEnabled(config),
50996
50898
  getUserHooks: () => dependencies.getUserHooks(project.id),
50997
- agentApi: config.agentApi?.enabled === true,
50998
50899
  commitSigningProgram: dependencies.commitSigningProgram ?? null,
50999
50900
  ...overrides,
51000
50901
  prepareSandbox: "prepareSandbox" in overrides ? overrides.prepareSandbox : defaultSandboxFor(project, config, overrides)
@@ -51009,7 +50910,7 @@ function createSessionFactory(dependencies) {
51009
50910
  };
51010
50911
  }
51011
50912
  //#endregion
51012
- //#region server/session-sandbox.ts
50913
+ //#region server/sandbox/session-sandbox.ts
51013
50914
  var UNWRAPPED_PLATFORM = "win32";
51014
50915
  var GITHUB_TOKEN_TIMEOUT_MS = 5e3;
51015
50916
  var OPT_OUT_HINT = "Mark the session or its repository unguarded to start it without guardrails.";
@@ -51094,7 +50995,7 @@ function createSessionSandbox({ getSettings, uploadsRoot, sandboxRefusal = allow
51094
50995
  return { prepareFor };
51095
50996
  }
51096
50997
  //#endregion
51097
- //#region server/backend-session-runtime.ts
50998
+ //#region server/backend/backend-session-runtime.ts
51098
50999
  function createBackendSessionRuntime(dependencies) {
51099
51000
  const hookRouter = new HookRouter({ recordOutcome: dependencies.recordOutcome });
51100
51001
  const agentIngressServer = http.createServer();
@@ -52131,7 +52032,7 @@ function createTelemetry(options) {
52131
52032
  };
52132
52033
  }
52133
52034
  //#endregion
52134
- //#region server/core/session-docs-core.ts
52035
+ //#region server/session/core/session-docs-core.ts
52135
52036
  var NUL_CHARACTER = String.fromCharCode(0);
52136
52037
  var DOC_REFUSAL_COPY = Object.freeze({
52137
52038
  missing: "no file exists at that path, so write it first and surface it again",
@@ -52208,7 +52109,7 @@ function withSurfacedDoc(docs, surfaced, maxDocs) {
52208
52109
  return [surfaced, ...docs.filter((doc) => doc.path !== surfaced.path)].slice(0, maxDocs);
52209
52110
  }
52210
52111
  //#endregion
52211
- //#region server/session-docs-wiring.ts
52112
+ //#region server/session/session-docs-wiring.ts
52212
52113
  async function readAtMostCapPlusOneByte(handle) {
52213
52114
  const buffer = Buffer.alloc(SESSION_DOC_BODY_CAP_BYTES + 1);
52214
52115
  let filledBytes = 0;
@@ -52406,7 +52307,7 @@ function createSessionDocsWiring({ broadcastControl, now = Date.now }) {
52406
52307
  };
52407
52308
  }
52408
52309
  //#endregion
52409
- //#region server/backend.ts
52310
+ //#region server/backend/backend.ts
52410
52311
  var AGENT_INGRESS_HOST = "127.0.0.1";
52411
52312
  function createBackend(httpServer, options = {}) {
52412
52313
  const { staticDir = "auto", settingsDefaults } = options;
@@ -52466,7 +52367,7 @@ function createBackend(httpServer, options = {}) {
52466
52367
  const agentIngressDependencies = {
52467
52368
  allowedHosts,
52468
52369
  hookRouter,
52469
- getSession: getSessionAny,
52370
+ getSession: (glimmervoidId) => laneAssembly.findLiveSession(glimmervoidId),
52470
52371
  getUsage: () => usage,
52471
52372
  getPlanReview: () => laneAssembly.planReview,
52472
52373
  refocusContextFor: (glimmervoidId) => ({