glimmervoid 0.41.1 → 0.42.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 (29) hide show
  1. package/dist/bin/glimmervoid.js +13 -13
  2. package/dist/chunks/{adapters-D8BJffFW.js → adapters-C8GfnK2r.js} +1 -1
  3. package/dist/chunks/{adapters-CyDflXHy.js → adapters-D2u85MEH.js} +5 -5
  4. package/dist/chunks/{agent-api-cli-CvCov9_e.js → agent-api-cli-B-1MqjKc.js} +1 -1
  5. package/dist/chunks/{agent-api-cli-B7-ToJul.js → agent-api-cli-D7JPxNso.js} +10 -5
  6. package/dist/chunks/{agent-api-core-CLxZAole.js → agent-api-core-PwO7fPoc.js} +19 -5
  7. package/dist/chunks/{agent-setup-cli-py1gUMvJ.js → agent-setup-cli-C9qDV2g5.js} +1 -1
  8. package/dist/chunks/config-store-BL8LDBuM.js +1 -0
  9. package/dist/chunks/{config-store-CxYqTNbe.js → config-store-BxCW2IwK.js} +2 -2
  10. package/dist/chunks/{contracts-C9Jj9iDo.js → contracts-LXlDbl4R.js} +2 -2
  11. package/dist/chunks/{control-messages-C6JGCTuy.js → control-messages-88sdxt-U.js} +7 -1
  12. package/dist/chunks/{git-version-D_iXgYTZ.js → git-version-DqagvnAZ.js} +1 -1
  13. package/dist/chunks/{grok-BUGgQVE3.js → grok-DwrAcNHC.js} +1 -1
  14. package/dist/chunks/{main-CRU5ahjl.js → main-DZzDU4Q4.js} +284 -95
  15. package/dist/chunks/{pair-cli-CL1D9xc7.js → pair-cli-3KKNhZ22.js} +2 -2
  16. package/dist/chunks/{remote-config-CaW0mpwr.js → remote-config-Ce5nN0zL.js} +1 -1
  17. package/dist/chunks/{session-C8IpFmGQ.js → session-3eSP3t1i.js} +8 -2
  18. package/dist/chunks/{session-routes-nySS7DUE.js → session-routes-B2oSzmQn.js} +1 -1
  19. package/dist/chunks/{settings-cli-Duculey3.js → settings-cli-BYY991YC.js} +5 -5
  20. package/dist/chunks/{settings-readout-core-CX7DmEuG.js → settings-readout-core-CWAhwZKN.js} +2 -2
  21. package/dist/chunks/{ssh-sign-cli-BEAAFjXg.js → ssh-sign-cli-BbqYIPwh.js} +2 -2
  22. package/dist/client/assets/index-C9wfiVqt.js +176 -0
  23. package/dist/client/assets/index-PnaYWtoe.css +2 -0
  24. package/dist/client/index.html +2 -2
  25. package/dist/server/index.js +1 -1
  26. package/package.json +1 -1
  27. package/dist/chunks/config-store-DcVWBJOV.js +0 -1
  28. package/dist/client/assets/index-CBjFGcSs.js +0 -176
  29. package/dist/client/assets/index-Cbb5NKHK.css +0 -2
@@ -2,13 +2,13 @@ import { i as sanitizeOneLine, n as requireExecutableSpawnHelper, r as firstLine
2
2
  import { a as isMissingFileError, i as errorText$1, r as errorMessage, t as errorCode } from "./text-DoirglWV.js";
3
3
  import { a as sanitizeWorktreeName, i as safePathSegment, n as equalsIgnoringCaseOnWindows, r as isPathInside, t as caseFoldedPathKey } from "./paths-Bu4eH1Yd.js";
4
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 { A as SIGN_URL_ENV, At as TeamReviewThreadCommentsResponse, B as MyPr, Bt as GH_SEGMENT, Ct as ReviewVerdict, Dt as TeamReviewResolveResponse, E as SESSION_DOC_BODY_CAP_BYTES, Et as TeamReviewCompareFiles, H as MyPrCheckContext, Ht as REPO_SLUG_RE, I as SshSignRequest, It as hasStandingViewerApproval, J as MyPrMergeRequest, Jt as BADGE_LABELS, K as MyPrLaneEntry, L as TASK_TITLE_CONTROL_CHARACTERS, Mt as TeamReviewThreadsRepository, Nt as canApproveAfterComment, O as SESSION_NAME_PATTERN, Ot as TeamReviewStateEntry, Pt as decisionAsIfApprovalRequired, Qt as STATES, R as TaskTitle, Rt as HEX_SHA_RE, S as ConversationQuestion, St as ReviewThreadId, U as MyPrCheckContextsResponse, Ut as repoParts, V as MyPrAutoRebase, Vt as NODE_ID_RE, W as MyPrKeepMergeableRequest, X as MyPrMergeStateResponse, Xt as MERGEABLE_LIVE_STATES, Yt as KILLABLE_STATES, Z as MyPrMergeWhenReadyRequest, Zt as RESTARTABLE_STATES, _ as CONVERSATION_TOOL_RESULT_HOOK_EVENT, bt as ReviewFinding, ct as CommitSha, dt as FindingSeverity, et as MyPrThreadNode, g as CONVERSATION_PERMISSION_HOOK_EVENT, gt as QueuedReview, h as CONVERSATION_APPROVAL_SUMMARY_MAX_CHARS, ht as PrDetail, j as SSH_SIGN_BODY_CAP_BYTES, jt as TeamReviewThreadResult, k as SESSION_NAME_RULE_TEXT, kt as TeamReviewStatus, lt as DECIDING_REVIEW_STATES, m as COHERENCE_HOOKS_INACTIVE, mt as PostingPlan, n as AGENT_URL_ENV, nt as MyPrsSnapshot, pt as GithubReviewState, q as MyPrMergeMethod, r as ASK_USER_QUESTION_TOOL_NAME, rt as MyPrsState, tt as MyPrThreadsResponse, ut as EarlierReview, vt as ReviewComment, w as RefinedTaskTitle, wt as TeamReviewActionRequest, xt as ReviewResult, yt as ReviewDraft, z as LinkedPr, zt as shortSha } from "./session-C8IpFmGQ.js";
5
+ import { $t as STATES, A as SIGN_URL_ENV, At as TeamReviewStatus, B as LinkedPr, Bt as shortSha, Ct as ReviewThreadId, Dt as TeamReviewCompareFiles, E as SESSION_DOC_BODY_CAP_BYTES, Ft as decisionAsIfApprovalRequired, G as MyPrKeepMergeableRequest, H as MyPrAutoRebase, Ht as NODE_ID_RE, I as SshSignRequest, J as MyPrMergeMethod, L as TASK_TITLE_CONTROL_CHARACTERS, Lt as hasStandingViewerApproval, Mt as TeamReviewThreadResult, Nt as TeamReviewThreadsRepository, O as SESSION_NAME_PATTERN, Ot as TeamReviewResolveResponse, Pt as canApproveAfterComment, Q as MyPrMergeWhenReadyRequest, Qt as RESTARTABLE_STATES, R as TaskTitle, S as ConversationQuestion, St as ReviewResult, Tt as TeamReviewActionRequest, U as MyPrCheckContext, Ut as REPO_SLUG_RE, V as MyPr, Vt as GH_SEGMENT, W as MyPrCheckContextsResponse, Wt as repoParts, Xt as KILLABLE_STATES, Y as MyPrMergeRequest, Yt as BADGE_LABELS, Z as MyPrMergeStateResponse, Zt as MERGEABLE_LIVE_STATES, _ as CONVERSATION_TOOL_RESULT_HOOK_EVENT, _t as QueuedReview, bt as ReviewDraft, dt as EarlierReview, ft as FindingSeverity, g as CONVERSATION_PERMISSION_HOOK_EVENT, gt as PrDetail, h as CONVERSATION_APPROVAL_SUMMARY_MAX_CHARS, ht as PostingPlan, it as MyPrsState, j as SSH_SIGN_BODY_CAP_BYTES, jt as TeamReviewThreadCommentsResponse, k as SESSION_NAME_RULE_TEXT, kt as TeamReviewStateEntry, lt as CommitSha, m as COHERENCE_HOOKS_INACTIVE, mt as GithubReviewState, n as AGENT_URL_ENV, nt as MyPrThreadsResponse, q as MyPrLaneEntry, r as ASK_USER_QUESTION_TOOL_NAME, rt as MyPrsSnapshot, tt as MyPrThreadNode, ut as DECIDING_REVIEW_STATES, w as RefinedTaskTitle, wt as ReviewVerdict, xt as ReviewFinding, yt as ReviewComment, zt as HEX_SHA_RE } from "./session-3eSP3t1i.js";
6
6
  import { n as execFileAsync, o as spawn, r as execFileSync, t as execFile } from "./child-process-safe-D4hyVIXj.js";
7
- import { At as planTitle, C as GithubPrsFrame, Ct as PLAN_HOOK_EVENT, D as WorkflowsSettings, Dt as PlanDecision, E as WorkflowLabelName, Et as PLAN_TOOL_NAME, Ft as IssuesSearchResponse, It as IssuesState, L as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, Lt as IssuesStatus, Mt as GithubIssueResponse, Nt as IssueKey, Ot as PlanRevision, Pt as IssueUpdate, Rt as issuePullRequestStateFromGithub, S as GithubPrLightSearchNode, St as PLAN_BODY_CAP_BYTES, T as WorkflowCommentBody, Tt as PLAN_RESULT_HOOK_EVENT, _ as MergedPrListing, _t as TraceCheckpoint, b as GithubPrDetailNode, bt as ChangeMap, c as pullRequestKeyFromReference, d as BenchmarkId, f as BenchmarkJudgement, g as CommitComparison, gt as MAX_RAW_LINE_CHARS, h as BenchmarkSuite, ht as SessionSetup, i as DIFF_ANNOTATION_NOTE_MAX_CHARS, jt as GithubIssuePullRequestsRepository, k as WorkflowsState, kt as parseExitPlanModeHookPayload, l as BenchmarkActionRequest, m as BenchmarkStatus, mt as UpdateJournal, n as ClientMessage, p as BenchmarkRun, rt as USAGE_INTEGER_RANGES, t as CONTROL_FRAME_MAX_BYTES, u as BenchmarkCase, v as MinedPrReviewData, vt as TraceRecord, w as comparablePrKey, wt as PLAN_HOOK_OUTPUT_MAX_CHARS, x as GithubPrKey, xt as changeMapFactId, y as PrCheckoutCaseInput, yt as CoherenceJournalOutput } from "./control-messages-C6JGCTuy.js";
8
- import { a as permitsHelpCommand, r as describeSessionLimits } from "./session-routes-nySS7DUE.js";
9
- import { a as decideSpawnAllowance, c as describeRoleRefusal, d as projectMyPrs, f as projectReviews, i as decideAgentRequest, n as REFUSAL_REASON, o as deriveChildSessionName, s as describePushLanding, u as parseAgentVerb } from "./agent-api-core-CLxZAole.js";
7
+ import { At as planTitle, C as GithubPrsFrame, Ct as PLAN_HOOK_EVENT, D as WorkflowsSettings, Dt as PlanDecision, E as WorkflowLabelName, Et as PLAN_TOOL_NAME, Ft as IssuesSearchResponse, It as IssuesState, L as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, Lt as IssuesStatus, Mt as GithubIssueResponse, Nt as IssueKey, Ot as PlanRevision, Pt as IssueUpdate, Rt as issuePullRequestStateFromGithub, S as GithubPrLightSearchNode, St as PLAN_BODY_CAP_BYTES, T as WorkflowCommentBody, Tt as PLAN_RESULT_HOOK_EVENT, _ as MergedPrListing, _t as TraceCheckpoint, b as GithubPrDetailNode, bt as ChangeMap, c as pullRequestKeyFromReference, d as BenchmarkId, f as BenchmarkJudgement, g as CommitComparison, gt as MAX_RAW_LINE_CHARS, h as BenchmarkSuite, ht as SessionSetup, i as DIFF_ANNOTATION_NOTE_MAX_CHARS, jt as GithubIssuePullRequestsRepository, k as WorkflowsState, kt as parseExitPlanModeHookPayload, l as BenchmarkActionRequest, m as BenchmarkStatus, mt as UpdateJournal, n as ClientMessage, p as BenchmarkRun, rt as USAGE_INTEGER_RANGES, t as CONTROL_FRAME_MAX_BYTES, u as BenchmarkCase, v as MinedPrReviewData, vt as TraceRecord, w as comparablePrKey, wt as PLAN_HOOK_OUTPUT_MAX_CHARS, x as GithubPrKey, xt as changeMapFactId, y as PrCheckoutCaseInput, yt as CoherenceJournalOutput } from "./control-messages-88sdxt-U.js";
8
+ import { a as permitsHelpCommand, r as describeSessionLimits } from "./session-routes-B2oSzmQn.js";
9
+ import { a as decideSpawnAllowance, c as describeKeptChildAttention, d as describeUnpushedCloseRefusal, h as projectReviews, i as decideAgentRequest, l as describePushLanding, m as projectMyPrs, n as REFUSAL_REASON, o as deriveChildSessionName, p as parseAgentVerb, s as describeChildEndNote, u as describeRoleRefusal } from "./agent-api-core-PwO7fPoc.js";
10
10
  import { n as glimmervoidHomeDir, t as decideConfigPath } from "./config-path-core-DFt-TemS.js";
11
- import { i as parseCommandLine, n as warnWhenGitIsTooOld } from "./git-version-D_iXgYTZ.js";
11
+ import { i as parseCommandLine, n as warnWhenGitIsTooOld } from "./git-version-DqagvnAZ.js";
12
12
  import { n as checkGuardrailsDependencies, t as allowGuardedSpawn } from "./guardrails-deps-BjPzk1rE.js";
13
13
  import { t as HOOK_URL_ENV } from "./hook-relay-core-DA_bz2KA.js";
14
14
  import { t as HOOK_VIA_GUARDRAILS_PROXY_ENV } from "./guardrails-proxy-core-BI3rdY-m.js";
@@ -21,13 +21,13 @@ import { n as DEFAULT_MAX_MS, r as nextBackoffMs, t as DEFAULT_BASE_MS } from ".
21
21
  import { n as unrefTimer, t as DEFAULT_TIMER_FNS } from "./timer-deps-u2DAQLok.js";
22
22
  import { n as shellQuote } from "./hook-command-core-qTNK-xMF.js";
23
23
  import { C as parseCgroupBytes, S as memoryReserveBytes, T as parseMemAvailableBytes, _ as createSpawnGate, a as jsonStateLoadError, b as cgroupLimitBytes, c as loadedJsonValue, d as writeJsonAtomicSync, f as writeTextAtomic, g as createSerialQueue, h as createMemoryAdmission, 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, v as isQueueAdmissionTimeout, w as parseCgroupV2Path, x as headroomFromReadings, y as cgroupAncestorPaths } from "./json-file-DFCTvPjj.js";
24
- import { $ as DEFAULT_BRANCH_GC_PREFIXES, B as buildExceptionProperties, F as TELEMETRY_BATCH_URL, G as exceptionFingerprint, H as decideIsDevInstall, I as TELEMETRY_FLAGS_URL, J as resolveProjectToken, K as nodeMajorVersion, L as adapterBucket, P as FIRST_RUN_NOTICE, R as buildAiGenerationEvents, U as decideRemoteTelemetryState, V as classifySessionExit, W as decideTelemetryConsent, Z as stableConfigKey, a as generateProjectId, at as worktreeIntegrationTips, b as validateSettingsBlock, ct as isSameDirectoryPath, d as assetForPlatform, et as matchedPrefix, f as decideRtkInstall, g as verifyDigest, h as isRtkBinaryName, i as ensureProjectIds, it as usablePrefixes, m as installTargetPath, n as DEFAULT_CONFIG, nt as planWorktreeGc, o as glimmervoidHomeDir$1, ot as canonicalizePath, p as findEscapingArchiveMember, q as parsePosthogReleaseId, r as createConfigStore, rt as sessionIdFromBranch, st as comparableDirectoryPath, t as ABORT_CONFIG_SAVE, tt as planBranchGc, v as mergeSettingsBlock, y as settingsBlockSpecFor, z as buildBrowserExceptionProperties } from "./config-store-CxYqTNbe.js";
25
- import { E as USAGE_VENDOR_KEYS, T as USAGE_COST_MODES, _ as PersistedTaskTitle, a as parseDataClientMessage, b as configIssueMessage, c as PendingCrashReport, d as TelemetryState, g as ConfigUpdate, i as parseDataAttachHistory, l as TELEMETRY_EVENT_SCHEMAS, m as BrowserConfig, n as HookEnvelope, o as DashboardTelemetryReport, r as DEEP_HISTORY_SCROLLBACK_LINES, t as HTTP_URL_RE, v as RUNTIME_CONFIG_SCALAR_KEYS, y as TASK_TITLE_SOURCE_PRIORITY } from "./contracts-C9Jj9iDo.js";
26
- import { A as dedupeCodexFiles, B as shouldPersistWarehouse, C as shortSha$1, D as codexSessionIdFromPath, E as codexRootCandidates, F as passOutcome, H as claudeCode, I as projectDirCandidates, L as resolveProjectsDirs, M as grokHomes, N as grokRootCandidates, O as continuationDelayMs, P as isUsageFile, R as scopedClaudeRoots, S as parseResolvedSha, T as codexHomes, V as splitLines$1, _ as isCheckFresh, a as describeAgentResolvability, b as parseRegistryDeprecation, c as isKnownAgentId, d as resolveAdapter, f as setCustomAgents, g as decideUpdateStatus, h as decideInstallFlavor, i as customAgentFingerprint, j as expandTilde, k as decideFileRead, l as listAgentIds, m as readHostCodexVersion, n as cachedAgentResolvability, o as getAdapter, p as codex, r as commandFor, s as hookProfileOf, t as DEFAULT_AGENT_ID, u as resetCommandCache, v as normalizeSha, w as codexFallbackRoots, x as parseRegistryLatest, y as normalizeUpdateChannel, z as shouldEvaluateDespiteIoFailures } from "./adapters-CyDflXHy.js";
24
+ import { $ as DEFAULT_BRANCH_GC_PREFIXES, B as buildExceptionProperties, F as TELEMETRY_BATCH_URL, G as exceptionFingerprint, H as decideIsDevInstall, I as TELEMETRY_FLAGS_URL, J as resolveProjectToken, K as nodeMajorVersion, L as adapterBucket, P as FIRST_RUN_NOTICE, R as buildAiGenerationEvents, U as decideRemoteTelemetryState, V as classifySessionExit, W as decideTelemetryConsent, Z as stableConfigKey, a as generateProjectId, at as worktreeIntegrationTips, b as validateSettingsBlock, ct as isSameDirectoryPath, d as assetForPlatform, et as matchedPrefix, f as decideRtkInstall, g as verifyDigest, h as isRtkBinaryName, i as ensureProjectIds, it as usablePrefixes, m as installTargetPath, n as DEFAULT_CONFIG, nt as planWorktreeGc, o as glimmervoidHomeDir$1, ot as canonicalizePath, p as findEscapingArchiveMember, q as parsePosthogReleaseId, r as createConfigStore, rt as sessionIdFromBranch, st as comparableDirectoryPath, t as ABORT_CONFIG_SAVE, tt as planBranchGc, v as mergeSettingsBlock, y as settingsBlockSpecFor, z as buildBrowserExceptionProperties } from "./config-store-BxCW2IwK.js";
25
+ import { E as USAGE_VENDOR_KEYS, T as USAGE_COST_MODES, _ as PersistedTaskTitle, a as parseDataClientMessage, b as configIssueMessage, c as PendingCrashReport, d as TelemetryState, g as ConfigUpdate, i as parseDataAttachHistory, l as TELEMETRY_EVENT_SCHEMAS, m as BrowserConfig, n as HookEnvelope, o as DashboardTelemetryReport, r as DEEP_HISTORY_SCROLLBACK_LINES, t as HTTP_URL_RE, v as RUNTIME_CONFIG_SCALAR_KEYS, y as TASK_TITLE_SOURCE_PRIORITY } from "./contracts-LXlDbl4R.js";
26
+ import { A as dedupeCodexFiles, B as shouldPersistWarehouse, C as shortSha$1, D as codexSessionIdFromPath, E as codexRootCandidates, F as passOutcome, H as claudeCode, I as projectDirCandidates, L as resolveProjectsDirs, M as grokHomes, N as grokRootCandidates, O as continuationDelayMs, P as isUsageFile, R as scopedClaudeRoots, S as parseResolvedSha, T as codexHomes, V as splitLines$1, _ as isCheckFresh, a as describeAgentResolvability, b as parseRegistryDeprecation, c as isKnownAgentId, d as resolveAdapter, f as setCustomAgents, g as decideUpdateStatus, h as decideInstallFlavor, i as customAgentFingerprint, j as expandTilde, k as decideFileRead, l as listAgentIds, m as readHostCodexVersion, n as cachedAgentResolvability, o as getAdapter, p as codex, r as commandFor, s as hookProfileOf, t as DEFAULT_AGENT_ID, u as resetCommandCache, v as normalizeSha, w as codexFallbackRoots, x as parseRegistryLatest, y as normalizeUpdateChannel, z as shouldEvaluateDespiteIoFailures } from "./adapters-D2u85MEH.js";
27
27
  import { t as HOOK_TOOLS } from "./hook-tools-Dl7-r2Eb.js";
28
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";
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-CaW0mpwr.js";
30
- import { n as configFileViewOf, u as readSettingsForAgent } from "./settings-readout-core-CX7DmEuG.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-Ce5nN0zL.js";
30
+ import { n as configFileViewOf, u as readSettingsForAgent } from "./settings-readout-core-CWAhwZKN.js";
31
31
  import { _ as escapeMarkup, g as createLaneLog, n as createVisionsSetup } from "./visions-setup-DB2P8JUL.js";
32
32
  import { t as getRtkPath } from "./rtk-resolver-BDHi6RMv.js";
33
33
  import { createRequire } from "node:module";
@@ -2040,6 +2040,7 @@ function projectSessionCard(source, { id, name }) {
2040
2040
  guardrailsReleased: source.isGuardrailsReleased === true,
2041
2041
  resumeSessionId: source.resumeSessionId || null,
2042
2042
  ...source.isWorkspace ? { workspace: true } : {},
2043
+ ...source.remoteWorkspace ? { remoteWorkspace: source.remoteWorkspace } : {},
2043
2044
  ...source.linkedPrs?.length ? { linkedPrs: source.linkedPrs } : {},
2044
2045
  ...source.ownerId ? { ownerId: source.ownerId } : {}
2045
2046
  };
@@ -2065,6 +2066,7 @@ function projectSessionSnapshots(source) {
2065
2066
  ownerId: source.ownerId ?? null,
2066
2067
  isWorktree: source.isWorktree,
2067
2068
  isWorkspace: source.isWorkspace,
2069
+ remoteWorkspace: source.remoteWorkspace ?? null,
2068
2070
  isGuarded: source.isGuarded === true,
2069
2071
  isGuardrailsReleased: source.isGuardrailsReleased === true,
2070
2072
  resumeSessionId: source.resumeSessionId,
@@ -2082,6 +2084,7 @@ function projectSessionSnapshots(source) {
2082
2084
  mergeReason: source.mergeReason,
2083
2085
  worktreeNotice: source.worktreeNotice,
2084
2086
  failureReason: source.failureReason ?? null,
2087
+ unseenOutcome: source.unseenOutcome ?? null,
2085
2088
  effectiveBase: source.effectiveBase ?? null,
2086
2089
  linkedPrs: source.linkedPrs,
2087
2090
  coherenceHooks: source.coherenceHooks ?? null,
@@ -2561,6 +2564,7 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
2561
2564
  const parentsWithChannelCleanup = /* @__PURE__ */ new WeakSet();
2562
2565
  const sessionsWithOperatorWatch = /* @__PURE__ */ new WeakSet();
2563
2566
  const lastOperatorInputAtBySession = /* @__PURE__ */ new WeakMap();
2567
+ const childIdsToDiscard = /* @__PURE__ */ new Set();
2564
2568
  function forgetLink(childId) {
2565
2569
  const link = linksByChildId.get(childId);
2566
2570
  if (link) for (const timer of link.retryTimersBySide.values()) clearTimeoutFn(timer);
@@ -2695,6 +2699,45 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
2695
2699
  parent.off("teardown", closeChildWithParent);
2696
2700
  };
2697
2701
  }
2702
+ async function keepOrDiscardChildWorktree(child, worktree, isParentRemoved) {
2703
+ const isDiscardRequested = childIdsToDiscard.delete(child.id);
2704
+ if (!worktree) return false;
2705
+ if (isDiscardRequested || isParentRemoved) {
2706
+ await child.discardWorktree();
2707
+ return false;
2708
+ }
2709
+ return !await child.discardWorktreeIfClean();
2710
+ }
2711
+ async function settleChildWorktree(parentId, child, childName, startAttempt, worktreeAtStart) {
2712
+ try {
2713
+ await startAttempt.catch(() => {});
2714
+ await child._awaitPendingReaps();
2715
+ const worktree = child.getWorktreeCarry();
2716
+ const registeredParent = listAllSessions().find((session) => session.id === parentId);
2717
+ const isKept = await keepOrDiscardChildWorktree(child, worktree, !registeredParent);
2718
+ if (registeredParent && worktree && isKept) {
2719
+ logger.warn(`[${AGENT_LANE_TAG} ${childName}] kept a worktree with unpushed work: ${worktree.worktreeDir}`);
2720
+ registeredParent.noteAttention(describeKeptChildAttention(childName, worktree));
2721
+ post(child.id, "toParent", {
2722
+ author: "glimmervoid",
2723
+ text: describeChildEndNote(childName, {
2724
+ kind: "kept",
2725
+ worktree
2726
+ }),
2727
+ at: now()
2728
+ });
2729
+ return;
2730
+ }
2731
+ const kind = worktree || worktreeAtStart ? "discarded" : "none";
2732
+ post(child.id, "toParent", {
2733
+ author: "glimmervoid",
2734
+ text: describeChildEndNote(childName, { kind }),
2735
+ at: now()
2736
+ });
2737
+ } catch (error) {
2738
+ logger.warn(`[${AGENT_LANE_TAG} ${childName}] could not settle the worktree: ${errorMessage(error)}`);
2739
+ }
2740
+ }
2698
2741
  function post(childId, side, entry) {
2699
2742
  const channel = channelsByChildId.get(childId);
2700
2743
  if (!channel) return;
@@ -2796,6 +2839,8 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
2796
2839
  unguarded: !parent.isGuarded
2797
2840
  };
2798
2841
  let child = null;
2842
+ let worktreeAtStart = null;
2843
+ let startAttempt = Promise.resolve();
2799
2844
  let released = false;
2800
2845
  let detachFromParent = () => {};
2801
2846
  const releaseChildSlot = () => {
@@ -2808,6 +2853,7 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
2808
2853
  id,
2809
2854
  session: name
2810
2855
  });
2856
+ if (child) settleChildWorktree(parent.id, child, name, startAttempt, worktreeAtStart);
2811
2857
  };
2812
2858
  const abandonChild = (reason) => {
2813
2859
  logger.warn(`[${AGENT_LANE_TAG} ${name}] ${reason}`);
@@ -2843,7 +2889,7 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
2843
2889
  });
2844
2890
  spawned.on("exit", releaseChildSlot);
2845
2891
  spawned.on("teardown", releaseChildSlot);
2846
- await spawnGate.run(() => {
2892
+ startAttempt = spawnGate.run(() => {
2847
2893
  if (spawned._destroyed) return void 0;
2848
2894
  broadcastControl({
2849
2895
  type: "session-added",
@@ -2854,7 +2900,9 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
2854
2900
  });
2855
2901
  return spawned.start();
2856
2902
  });
2903
+ await startAttempt;
2857
2904
  if (!spawned.hasLivePty) return abandonChild("the child never reached a live terminal");
2905
+ worktreeAtStart = spawned.getWorktreeCarry();
2858
2906
  return {
2859
2907
  ok: true,
2860
2908
  sessionId: id,
@@ -2981,7 +3029,7 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
2981
3029
  error: outcome.error
2982
3030
  }
2983
3031
  };
2984
- const note = `this session owns ${outcome.name} until the task is done: glimmervoid read ${outcome.sessionId} reads its messages, glimmervoid send ${outcome.sessionId} <text> steers it, and glimmervoid close ${outcome.sessionId} ends it`;
3032
+ const note = `this session owns ${outcome.name} until the task is done: glimmervoid read ${outcome.sessionId} reads its messages, glimmervoid send ${outcome.sessionId} <text> steers it, and glimmervoid close ${outcome.sessionId} ends it and discards its worktree, refusing while it holds work that is not on the integration branch unless you add --discard`;
2985
3033
  return {
2986
3034
  status: 200,
2987
3035
  body: {
@@ -3050,11 +3098,16 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
3050
3098
  }
3051
3099
  };
3052
3100
  }
3053
- function close(session, { child }) {
3101
+ async function close(session, { child, discard = false }) {
3054
3102
  const owned = findChildOf(session, child);
3055
3103
  if (!owned.ok) return refusal(404, owned.error);
3056
3104
  const childSession = agentSessions.get(owned.channel.childId);
3057
- if (!childSession) return refusal(409, `${owned.channel.childName} has already ended`);
3105
+ const alreadyEnded = refusal(409, `${owned.channel.childName} has already ended`);
3106
+ if (!childSession) return alreadyEnded;
3107
+ const worktree = childSession.getWorktreeCarry();
3108
+ if (!discard && worktree && await childSession.hasUnmergedWork()) return refusal(409, describeUnpushedCloseRefusal(owned.channel.childName, owned.channel.childId, worktree));
3109
+ if (agentSessions.get(owned.channel.childId) !== childSession) return alreadyEnded;
3110
+ if (discard) childIdsToDiscard.add(childSession.id);
3058
3111
  childSession.destroy();
3059
3112
  return {
3060
3113
  status: 200,
@@ -4113,7 +4166,7 @@ function explainNotification(to, gate, event, opts) {
4113
4166
  };
4114
4167
  }
4115
4168
  if (to === STATES.RUNNING) {
4116
- if (event === "user_input" || Boolean(opts && opts.signal === "resume") || !opts || !opts.hookSeen) {
4169
+ if (event === "user_input" || !opts || !opts.hookSeen) {
4117
4170
  gate.reset();
4118
4171
  return {
4119
4172
  category: null,
@@ -5371,10 +5424,10 @@ function createSessionEventWiring(dependencies) {
5371
5424
  session.on("agent-attention", ({ note }) => {
5372
5425
  pendingAgentNote = pendingAgentNote === null ? note : `${pendingAgentNote} | ${note}`;
5373
5426
  });
5374
- session.on("user-prompt", () => {
5427
+ session.on("user-prompt", ({ isSelfWake }) => {
5375
5428
  markTurnWorking();
5376
5429
  pendingAgentNote = null;
5377
- notifyGate.reset();
5430
+ if (!isSelfWake) notifyGate.reset();
5378
5431
  releaseDeferredAcknowledge();
5379
5432
  });
5380
5433
  session.on("waiting-input-acknowledged", () => dependencies.notificationManager.acknowledge(session.id));
@@ -5405,6 +5458,7 @@ function createSessionEventWiring(dependencies) {
5405
5458
  relay("wakeup-change", "session-wakeup");
5406
5459
  session.on("wakeup-change", persistWasWorking);
5407
5460
  relay("prompt-kind-change", "session-prompt");
5461
+ relay("unseen-outcome-change", "session-unseen");
5408
5462
  relay("conversation-change", "session-conversation");
5409
5463
  session.on("merge-status", ({ mergeStatus, reason, parked }) => {
5410
5464
  dependencies.broadcastControl({
@@ -6569,6 +6623,18 @@ function formatTouchedRanges(ranges) {
6569
6623
  return (Array.isArray(ranges) ? ranges : []).map((range) => range.start === range.end ? `${range.start}` : `${range.start}-${range.end}`).join(", ");
6570
6624
  }
6571
6625
  //#endregion
6626
+ //#region shared/fnv-hash.ts
6627
+ var FNV_OFFSET_BASIS = 2166136261;
6628
+ var FNV_PRIME = 16777619;
6629
+ function fnv1a32(text) {
6630
+ let hash = FNV_OFFSET_BASIS;
6631
+ for (let index = 0; index < text.length; index += 1) {
6632
+ hash ^= text.charCodeAt(index);
6633
+ hash = Math.imul(hash, FNV_PRIME) >>> 0;
6634
+ }
6635
+ return hash;
6636
+ }
6637
+ //#endregion
6572
6638
  //#region server/visions/core/visions-dispatch-core.ts
6573
6639
  var DEFAULT_QUIET_MS = 3e4;
6574
6640
  var DEFAULT_COOLDOWN_MS = 3e5;
@@ -6647,12 +6713,7 @@ function resolveVisionsConfig(raw) {
6647
6713
  }
6648
6714
  function hashText$1(text) {
6649
6715
  const value = typeof text === "string" ? text : "";
6650
- let hash = 2166136261;
6651
- for (let index = 0; index < value.length; index += 1) {
6652
- hash ^= value.charCodeAt(index);
6653
- hash = Math.imul(hash, 16777619) >>> 0;
6654
- }
6655
- return `${value.length.toString(36)}-${hash.toString(36)}`;
6716
+ return `${value.length.toString(36)}-${fnv1a32(value).toString(36)}`;
6656
6717
  }
6657
6718
  function createDispatchState(dispatchTimes = []) {
6658
6719
  return {
@@ -12813,11 +12874,13 @@ function seedTaskTitleSources({ persistedTitle, resumeSessionId, customTitle, in
12813
12874
  customTitle
12814
12875
  };
12815
12876
  }
12877
+ var envelopePattern = (tag) => new RegExp(`<${tag}\\b[^>]*>[\\s\\S]*?</${tag}\\s*>`, "gi");
12878
+ var TASK_NOTIFICATION_ENVELOPE_PATTERN = envelopePattern("task-notification");
12816
12879
  var PROMPT_ENVELOPE_PATTERNS = [
12817
- "pasted_content",
12818
- "system-reminder",
12819
- "task-notification"
12820
- ].map((tag) => new RegExp(`<${tag}\\b[^>]*>[\\s\\S]*?</${tag}\\s*>`, "gi"));
12880
+ envelopePattern("pasted_content"),
12881
+ envelopePattern("system-reminder"),
12882
+ TASK_NOTIFICATION_ENVELOPE_PATTERN
12883
+ ];
12821
12884
  var MIN_SUBSTANTIVE_WORDS = 3;
12822
12885
  var CONTINUATION_PROMPTS = new Set([
12823
12886
  "yes please continue",
@@ -12837,6 +12900,10 @@ function cleanTaskPrompt(prompt) {
12837
12900
  for (const pattern of PROMPT_ENVELOPE_PATTERNS) cleanedPrompt = cleanedPrompt.replace(pattern, " ");
12838
12901
  return cleanedPrompt.replace(/\s+/g, " ").trim();
12839
12902
  }
12903
+ function isSelfWakePrompt(prompt) {
12904
+ if (typeof prompt !== "string") return false;
12905
+ return prompt.replace(TASK_NOTIFICATION_ENVELOPE_PATTERN, " ").trim() === "" && prompt.trim() !== "";
12906
+ }
12840
12907
  function isSubstantivePrompt(prompt) {
12841
12908
  if (typeof prompt !== "string") return false;
12842
12909
  const cleanedPrompt = cleanTaskPrompt(prompt);
@@ -14469,6 +14536,13 @@ var ENTRY_HOOKS = {
14469
14536
  session.emit("session-done", { name: session.name });
14470
14537
  }
14471
14538
  };
14539
+ var UNSEEN_OUTCOME_ON_ENTRY = /* @__PURE__ */ new Map([
14540
+ [STATES.COMPLETE, "finished"],
14541
+ [STATES.FAILED, "failed"],
14542
+ [STATES.INITIALIZING, null],
14543
+ [STATES.DORMANT, null],
14544
+ [STATES.DONE, null]
14545
+ ]);
14472
14546
  var EXIT_HOOKS = { [STATES.WAITING](session) {
14473
14547
  session.emit("attention-cleared", { name: session.name });
14474
14548
  } };
@@ -18349,6 +18423,7 @@ var Session = class extends EventEmitter {
18349
18423
  state;
18350
18424
  stateSince;
18351
18425
  failureReason;
18426
+ unseenOutcome;
18352
18427
  ephemeral;
18353
18428
  agentId;
18354
18429
  usageVendor;
@@ -18456,6 +18531,7 @@ var Session = class extends EventEmitter {
18456
18531
  this.state = STATES.DORMANT;
18457
18532
  this.stateSince = Date.now();
18458
18533
  this.failureReason = null;
18534
+ this.unseenOutcome = null;
18459
18535
  this._receivedFirstOutput = false;
18460
18536
  this._killPollTimer = null;
18461
18537
  this._killReapTimer = null;
@@ -18696,13 +18772,8 @@ var Session = class extends EventEmitter {
18696
18772
  get recentTaskPrompts() {
18697
18773
  return [...this._recentTaskPrompts];
18698
18774
  }
18699
- setPendingTaskTitle(prompt) {
18700
- this._taskTitleSources.pendingPromptTitle = extractPromptTaskTitle(prompt);
18701
- this._updateTaskTitle();
18702
- }
18703
18775
  applyTaskTitleRefinement(refinement) {
18704
18776
  if (refinement.action === "replace") this._taskTitleSources.refinedTitle = refinement.title;
18705
- this._taskTitleSources.pendingPromptTitle = null;
18706
18777
  this._updateTaskTitle();
18707
18778
  }
18708
18779
  _updateTaskTitle() {
@@ -18829,7 +18900,8 @@ var Session = class extends EventEmitter {
18829
18900
  this.emit("user-prompt", {
18830
18901
  state: this.state,
18831
18902
  stateSince: this.stateSince,
18832
- ts: Date.now()
18903
+ ts: Date.now(),
18904
+ isSelfWake: isSelfWakePrompt(raw.payload?.prompt)
18833
18905
  });
18834
18906
  }
18835
18907
  if (raw && raw.signal === "ready" && raw.source === "hook") this.backgroundTracking.applyBackgroundTasks(raw.payload);
@@ -19153,6 +19225,9 @@ var Session = class extends EventEmitter {
19153
19225
  get isWorkspace() {
19154
19226
  return this.worktreeLifecycle.snapshot().isWorkspace;
19155
19227
  }
19228
+ get remoteWorkspace() {
19229
+ return this._getRemoteLaunch()?.workspace ?? null;
19230
+ }
19156
19231
  getWorktreeCarry() {
19157
19232
  return this.worktreeLifecycle.getCarry();
19158
19233
  }
@@ -19274,6 +19349,7 @@ var Session = class extends EventEmitter {
19274
19349
  ownerId: this.ownerId,
19275
19350
  isWorktree: this.isWorktree,
19276
19351
  isWorkspace: this.isWorkspace,
19352
+ remoteWorkspace: this.remoteWorkspace,
19277
19353
  isGuarded: this.isGuarded,
19278
19354
  isGuardrailsReleased: this.isGuardrailsReleased,
19279
19355
  resumeSessionId: this._resumeSessionId,
@@ -19291,6 +19367,7 @@ var Session = class extends EventEmitter {
19291
19367
  mergeReason: this.mergeReason,
19292
19368
  worktreeNotice: this.worktreeNotice,
19293
19369
  failureReason: this.failureReason,
19370
+ unseenOutcome: this.unseenOutcome,
19294
19371
  effectiveBase: this.worktreeLifecycle.snapshot().effectiveBase,
19295
19372
  linkedPrs: this.linkedPrs,
19296
19373
  coherenceHooks: this.coherenceHooks,
@@ -19335,6 +19412,8 @@ var Session = class extends EventEmitter {
19335
19412
  this.state = to;
19336
19413
  if (event === "spawn_fail") this.failureReason = describeSpawnFailure(detail);
19337
19414
  if (to === STATES.INITIALIZING) this.failureReason = null;
19415
+ const unseenOutcomeOnEntry = UNSEEN_OUTCOME_ON_ENTRY.get(to);
19416
+ if (unseenOutcomeOnEntry !== void 0 && !isCompactionRestoreEvent(event)) this._setUnseenOutcome(unseenOutcomeOnEntry);
19338
19417
  if (to === STATES.IDLE || to === STATES.COMPLETE) this._observeCompaction("settled");
19339
19418
  const entryHook = ENTRY_HOOKS[to];
19340
19419
  if (entryHook && !isCompactionRestoreEvent(event)) entryHook(this);
@@ -20182,9 +20261,16 @@ var Session = class extends EventEmitter {
20182
20261
  this._armTimer("_killPollTimer", KILL_POLL_INTERVAL_MS, poll);
20183
20262
  }
20184
20263
  dismiss() {
20185
- if (!DISMISSIBLE_STATES.has(this.state)) return false;
20264
+ const hadUnseenOutcome = this.unseenOutcome !== null;
20265
+ this._setUnseenOutcome(null);
20266
+ if (!DISMISSIBLE_STATES.has(this.state)) return hadUnseenOutcome;
20186
20267
  return this.transition("user_dismiss");
20187
20268
  }
20269
+ _setUnseenOutcome(nextUnseenOutcome) {
20270
+ if (this.unseenOutcome === nextUnseenOutcome) return;
20271
+ this.unseenOutcome = nextUnseenOutcome;
20272
+ this.emit("unseen-outcome-change", { unseenOutcome: nextUnseenOutcome });
20273
+ }
20188
20274
  _teardownPending() {
20189
20275
  return this._pendingRestart || this._finishing;
20190
20276
  }
@@ -29594,7 +29680,9 @@ var GLIMMERVOID_WORKSPACE_RE = /^gv-[0-9a-f]{12}$/;
29594
29680
  var IDLE_STOP_STATES = /* @__PURE__ */ new Set([
29595
29681
  STATES.IDLE,
29596
29682
  STATES.COMPLETE,
29597
- STATES.DORMANT
29683
+ STATES.DORMANT,
29684
+ STATES.FAILED,
29685
+ STATES.DONE
29598
29686
  ]);
29599
29687
  var CODER_ENVIRONMENT_DEFAULTS = Object.freeze({
29600
29688
  idleStopMinutes: 30,
@@ -29679,19 +29767,24 @@ function shouldIdleStop({ sessionState, idleSinceMs, nowMs, idleStopMinutes }) {
29679
29767
  if (!IDLE_STOP_STATES.has(sessionState) || idleSinceMs === null) return false;
29680
29768
  return nowMs - idleSinceMs >= idleStopMinutes * 6e4;
29681
29769
  }
29682
- function planReconcile({ workspaces, mappings, busyWorkspaces, nowMs, deleteAfterStoppedDays }) {
29770
+ function planReconcile({ workspaces, mappings, busyWorkspaces, ownedWorkspaces, nowMs, deleteAfterStoppedDays }) {
29683
29771
  const mappedNames = new Set(mappings.map((mapping) => mapping.workspace));
29684
29772
  const listedNames = new Set(workspaces.map((workspace) => workspace.name));
29685
29773
  const presentMappings = mappings.filter((mapping) => !busyWorkspaces.has(mapping.workspace)).filter((mapping) => listedNames.has(mapping.workspace));
29686
- const unmapped = workspaces.filter((workspace) => !mappedNames.has(workspace.name) && !busyWorkspaces.has(workspace.name) && workspace.status !== "deleting");
29774
+ const unmapped = workspaces.filter((workspace) => !mappedNames.has(workspace.name) && !busyWorkspaces.has(workspace.name) && workspace.status !== "deleting" && ownedWorkspaces.has(workspace.name));
29687
29775
  const isStale = (workspace) => workspace.stoppedAtMs !== null && nowMs - workspace.stoppedAtMs >= deleteAfterStoppedDays * DAY_MS;
29688
29776
  return {
29689
29777
  resume: presentMappings.filter((mapping) => mapping.wasActive),
29690
29778
  stop: presentMappings.filter((mapping) => !mapping.wasActive),
29691
29779
  delete: unmapped.filter(isStale).map((workspace) => workspace.name),
29692
- keptUnmapped: unmapped.filter((workspace) => !isStale(workspace)).map((workspace) => workspace.name)
29780
+ stopUnmapped: unmapped.filter((workspace) => workspace.status === "running").map((workspace) => workspace.name)
29693
29781
  };
29694
29782
  }
29783
+ function retainedOwnedWorkspaces({ ownedWorkspaces, workspaces, mappings, busyWorkspaces }) {
29784
+ const listedNames = new Set(workspaces.map((workspace) => workspace.name));
29785
+ const mappedNames = new Set(mappings.map((mapping) => mapping.workspace));
29786
+ return new Set([...ownedWorkspaces].filter((workspace) => listedNames.has(workspace) || mappedNames.has(workspace) || busyWorkspaces.has(workspace)));
29787
+ }
29695
29788
  function failedProvisionCleanup({ didCreate, didStart }) {
29696
29789
  if (didCreate) return "delete";
29697
29790
  if (didStart) return "stop";
@@ -29711,14 +29804,28 @@ function remoteCheckoutDirectory({ checkoutRoot, workspace }) {
29711
29804
  }
29712
29805
  function coderErrorDetail(stderr) {
29713
29806
  if (typeof stderr !== "string") return null;
29714
- const errorLine = stderr.split("\n").map((line) => line.trim()).findLast((line) => line.startsWith("error:"));
29715
- if (!errorLine) return null;
29716
- return errorLine.slice(6).trim().slice(0, CODER_ERROR_DETAIL_LIMIT) || null;
29807
+ const lines = stderr.split("\n").map((line) => line.trim());
29808
+ const errorLineIndex = lines.findLastIndex((line) => line.startsWith("error:"));
29809
+ if (errorLineIndex === -1) return null;
29810
+ return lines.slice(errorLineIndex).filter(Boolean).join(" ").slice(6).trim().slice(0, CODER_ERROR_DETAIL_LIMIT) || null;
29811
+ }
29812
+ function isCoderSignedOutError(stderr) {
29813
+ return typeof stderr === "string" && stderr.includes("You are signed out or your session has expired");
29814
+ }
29815
+ function coderNotSignedInReason(failure) {
29816
+ return `The coder CLI on this host is not signed in. Run coder login, then try again. (${failure})`;
29717
29817
  }
29718
29818
  //#endregion
29719
29819
  //#region server/coder/coder-env-poller.ts
29720
- function createCoderEnvPoller({ listWorkspaces, stopWorkspace, deleteWorkspace, sessionsForIdleCheck, mappings, busyWorkspaces, isReconcilePending, deleteAfterStoppedDays, onReconciled, now = Date.now, log = console, ...loopOptions }) {
29820
+ function createCoderEnvPoller({ listWorkspaces, stopWorkspace, deleteWorkspace, sessionsForIdleCheck, mappings, busyWorkspaces, ownedWorkspaces, isReconcilePending, deleteAfterStoppedDays, onReconciled, now = Date.now, log = console, ...loopOptions }) {
29721
29821
  const stoppedIdlePeriods = /* @__PURE__ */ new Map();
29822
+ async function mutateUnmappedWorkspace(mutate, workspace) {
29823
+ try {
29824
+ await mutate(workspace);
29825
+ } catch (error) {
29826
+ log.warn(`[coder-env] ${errorMessage(error)}; skipping ${workspace}`);
29827
+ }
29828
+ }
29722
29829
  async function runTick() {
29723
29830
  try {
29724
29831
  const workspaces = parseGlimmervoidWorkspaces(await listWorkspaces());
@@ -29726,20 +29833,24 @@ function createCoderEnvPoller({ listWorkspaces, stopWorkspace, deleteWorkspace,
29726
29833
  if (loop.isStopped()) return;
29727
29834
  const workspaceByName = new Map(workspaces.map((workspace) => [workspace.name, workspace]));
29728
29835
  const stoppedThisTick = /* @__PURE__ */ new Set();
29836
+ const plan = planReconcile({
29837
+ workspaces,
29838
+ mappings: mappings(),
29839
+ busyWorkspaces: busyWorkspaces(),
29840
+ ownedWorkspaces: ownedWorkspaces(),
29841
+ nowMs: now(),
29842
+ deleteAfterStoppedDays: deleteAfterStoppedDays()
29843
+ });
29844
+ for (const workspace of plan.delete) {
29845
+ if (loop.isStopped()) return;
29846
+ await mutateUnmappedWorkspace(deleteWorkspace, workspace);
29847
+ }
29848
+ for (const workspace of plan.stopUnmapped) {
29849
+ if (loop.isStopped()) return;
29850
+ log.warn(`[coder-env] stopping unmapped workspace ${workspace}`);
29851
+ await mutateUnmappedWorkspace(stopWorkspace, workspace);
29852
+ }
29729
29853
  if (isReconcilePending()) {
29730
- const staleAfterDays = deleteAfterStoppedDays();
29731
- const plan = planReconcile({
29732
- workspaces,
29733
- mappings: mappings(),
29734
- busyWorkspaces: busyWorkspaces(),
29735
- nowMs: now(),
29736
- deleteAfterStoppedDays: staleAfterDays
29737
- });
29738
- if (plan.keptUnmapped.length > 0) log.warn(`[coder-env] keeping unmapped workspaces until stopped for ${staleAfterDays} days: ${plan.keptUnmapped.join(", ")}`);
29739
- for (const workspace of plan.delete) {
29740
- if (loop.isStopped()) return;
29741
- await deleteWorkspace(workspace);
29742
- }
29743
29854
  for (const mapping of plan.stop) {
29744
29855
  if (loop.isStopped()) return;
29745
29856
  const status = workspaceByName.get(mapping.workspace)?.status;
@@ -29792,15 +29903,50 @@ function createCoderEnvPoller({ listWorkspaces, stopWorkspace, deleteWorkspace,
29792
29903
  }
29793
29904
  //#endregion
29794
29905
  //#region server/coder/coder-env-wiring.ts
29795
- function createCoderEnvWiring({ config, persistMapping, onReconciled = () => {}, runCoder: executeCoder, env = process.env, platform = process.platform, fetch: fetchReady = globalThis.fetch, createPoller = createCoderEnvPoller, now = Date.now, log = console, ...pollerDeps }) {
29906
+ var CODER_UNAVAILABLE_REASON = "Coder environments are unavailable on this host";
29907
+ function createCoderEnvWiring({ config, persistMapping, onReconciled = () => {}, loadOwnedWorkspaces, saveOwnedWorkspaces, runCoder: executeCoder, env = process.env, platform = process.platform, fetch: fetchReady = globalThis.fetch, createPoller = createCoderEnvPoller, now = Date.now, log = console, ...pollerDeps }) {
29796
29908
  let binaryProbe = null;
29797
29909
  let isCoderAvailable = false;
29910
+ let unavailableReason = CODER_UNAVAILABLE_REASON;
29911
+ const signedOutErrors = /* @__PURE__ */ new WeakSet();
29798
29912
  let hasReconciled = false;
29799
29913
  const operationCountByWorkspace = /* @__PURE__ */ new Map();
29800
29914
  const lastSeenStatusByWorkspace = /* @__PURE__ */ new Map();
29801
29915
  const provisionByProject = /* @__PURE__ */ new Map();
29802
29916
  const failedProvisionByProject = /* @__PURE__ */ new Map();
29803
29917
  const setTimeoutFn = pollerDeps.setTimeoutFn ?? DEFAULT_TIMER_FNS.setTimeoutFn;
29918
+ let ownedWorkspaces = /* @__PURE__ */ new Set([...loadOwnedWorkspaces(), ...currentMappings().map((mapping) => mapping.workspace)]);
29919
+ let ownedSaveChain = Promise.resolve();
29920
+ function currentMappings() {
29921
+ return config.projects.flatMap((project) => project.id && project.environment ? [{
29922
+ projectId: project.id,
29923
+ workspace: project.environment.workspace,
29924
+ wasActive: project.wasActive === true
29925
+ }] : []);
29926
+ }
29927
+ function busyWorkspaces() {
29928
+ return new Set(operationCountByWorkspace.keys());
29929
+ }
29930
+ function saveOwned() {
29931
+ const save = ownedSaveChain.then(() => saveOwnedWorkspaces([...ownedWorkspaces]));
29932
+ ownedSaveChain = save.catch(() => {});
29933
+ return save;
29934
+ }
29935
+ async function pruneOwned(workspaces) {
29936
+ const retained = retainedOwnedWorkspaces({
29937
+ ownedWorkspaces,
29938
+ workspaces,
29939
+ mappings: currentMappings(),
29940
+ busyWorkspaces: busyWorkspaces()
29941
+ });
29942
+ if (retained.size === ownedWorkspaces.size) return;
29943
+ ownedWorkspaces = retained;
29944
+ try {
29945
+ await saveOwned();
29946
+ } catch (error) {
29947
+ log.warn(`[coder-env] could not save owned Coder workspaces: ${errorMessage(error)}`);
29948
+ }
29949
+ }
29804
29950
  async function runCoder(args, { timeoutMs, input = "", env: commandEnv }) {
29805
29951
  try {
29806
29952
  const options = {
@@ -29820,10 +29966,21 @@ function createCoderEnvWiring({ config, persistMapping, onReconciled = () => {},
29820
29966
  maxBuffer: 16777216
29821
29967
  });
29822
29968
  } catch (error) {
29823
- const detail = coderErrorDetail(error instanceof Error && "stderr" in error ? error.stderr : null);
29824
- throw new Error(detail ? `Coder ${args[0]} failed: ${detail}` : `Coder ${args[0]} failed`);
29969
+ const stderr = error instanceof Error && "stderr" in error ? error.stderr : null;
29970
+ const detail = coderErrorDetail(stderr);
29971
+ const failure = detail ? `Coder ${args[0]} failed: ${detail}` : `Coder ${args[0]} failed`;
29972
+ if (!isCoderSignedOutError(stderr)) throw new Error(failure);
29973
+ throw markSignedOut(failure);
29825
29974
  }
29826
29975
  }
29976
+ function markSignedOut(failure) {
29977
+ binaryProbe = null;
29978
+ isCoderAvailable = false;
29979
+ unavailableReason = coderNotSignedInReason(failure);
29980
+ const signedOutError = new Error(unavailableReason);
29981
+ signedOutErrors.add(signedOutError);
29982
+ return signedOutError;
29983
+ }
29827
29984
  function command(args, timeoutMs = 3e4) {
29828
29985
  return runCoder(args, { timeoutMs });
29829
29986
  }
@@ -29840,7 +29997,8 @@ function createCoderEnvWiring({ config, persistMapping, onReconciled = () => {},
29840
29997
  "-o",
29841
29998
  "json"
29842
29999
  ])).stdout;
29843
- recordListing(listingJson);
30000
+ const workspaces = recordListing(listingJson);
30001
+ if (workspaces !== null) await pruneOwned(workspaces);
29844
30002
  return listingJson;
29845
30003
  }
29846
30004
  async function listWorkspaces() {
@@ -29861,12 +30019,20 @@ function createCoderEnvWiring({ config, persistMapping, onReconciled = () => {},
29861
30019
  async function probeBinary() {
29862
30020
  try {
29863
30021
  await command(["version"], 5e3);
29864
- isCoderAvailable = true;
29865
- return true;
29866
30022
  } catch {
30023
+ unavailableReason = CODER_UNAVAILABLE_REASON;
29867
30024
  log.warn("[coder-env] coder binary is unavailable");
29868
30025
  return false;
29869
30026
  }
30027
+ try {
30028
+ await command(["whoami"], 15e3);
30029
+ } catch (error) {
30030
+ if (!(error instanceof Error && signedOutErrors.has(error))) unavailableReason = `${CODER_UNAVAILABLE_REASON}: ${errorMessage(error)}`;
30031
+ log.warn(`[coder-env] ${errorMessage(error)}`);
30032
+ return false;
30033
+ }
30034
+ isCoderAvailable = true;
30035
+ return true;
29870
30036
  }
29871
30037
  async function ensureAvailable() {
29872
30038
  if (!isConfigured()) return false;
@@ -29910,12 +30076,9 @@ function createCoderEnvWiring({ config, persistMapping, onReconciled = () => {},
29910
30076
  "--yes"
29911
30077
  ]);
29912
30078
  },
29913
- mappings: () => config.projects.flatMap((project) => project.id && project.environment ? [{
29914
- projectId: project.id,
29915
- workspace: project.environment.workspace,
29916
- wasActive: project.wasActive === true
29917
- }] : []),
29918
- busyWorkspaces: () => new Set(operationCountByWorkspace.keys()),
30079
+ mappings: currentMappings,
30080
+ busyWorkspaces,
30081
+ ownedWorkspaces: () => ownedWorkspaces,
29919
30082
  isReconcilePending: () => !hasReconciled,
29920
30083
  deleteAfterStoppedDays: () => Math.max(...(config.coder?.environments ?? []).map((environment) => resolveCoderEnvironment(environment).deleteAfterStoppedDays)),
29921
30084
  onReconciled: async (plan) => {
@@ -29961,8 +30124,16 @@ function createCoderEnvWiring({ config, persistMapping, onReconciled = () => {},
29961
30124
  }
29962
30125
  async function waitForReady(workspaceName, environment) {
29963
30126
  const startedAtMs = now();
30127
+ let consecutiveListFailures = 0;
29964
30128
  for (;;) {
29965
- const workspace = (await listWorkspaces()).find((candidate) => candidate.name === workspaceName);
30129
+ const workspace = (await listWorkspaces().then((listed) => {
30130
+ consecutiveListFailures = 0;
30131
+ return listed;
30132
+ }, (listError) => {
30133
+ consecutiveListFailures += 1;
30134
+ if (consecutiveListFailures >= 3) throw listError;
30135
+ return [];
30136
+ })).find((candidate) => candidate.name === workspaceName);
29966
30137
  let isReadyUrlUp = null;
29967
30138
  if (environment.readyUrl) {
29968
30139
  isReadyUrlUp = false;
@@ -30004,7 +30175,7 @@ function createCoderEnvWiring({ config, persistMapping, onReconciled = () => {},
30004
30175
  cleanup,
30005
30176
  workspace,
30006
30177
  "--yes"
30007
- ]);
30178
+ ], 12e5);
30008
30179
  } catch {
30009
30180
  if (await isWorkspaceListed(workspace)) reasons.push(`Coder cleanup ${cleanup} failed for ${workspace}`);
30010
30181
  }
@@ -30038,7 +30209,7 @@ function createCoderEnvWiring({ config, persistMapping, onReconciled = () => {},
30038
30209
  };
30039
30210
  if (!await ensureAvailable()) return {
30040
30211
  ok: false,
30041
- reason: "Coder environments are unavailable on this host"
30212
+ reason: unavailableReason
30042
30213
  };
30043
30214
  const workspace = workspaceNameFromHex(randomBytes(6).toString("hex"));
30044
30215
  if (workspace === null) return {
@@ -30083,7 +30254,7 @@ function createCoderEnvWiring({ config, persistMapping, onReconciled = () => {},
30083
30254
  try {
30084
30255
  const environment = resolveEnvironment(mapping.name);
30085
30256
  if (!environment) throw new Error(`Unknown Coder environment: ${mapping.name}`);
30086
- if (!await ensureAvailable()) throw new Error("Coder environments are unavailable on this host");
30257
+ if (!await ensureAvailable()) throw new Error(unavailableReason);
30087
30258
  const createArgs = coderCreateArgs({
30088
30259
  workspace,
30089
30260
  template: environment.template,
@@ -30095,8 +30266,14 @@ function createCoderEnvWiring({ config, persistMapping, onReconciled = () => {},
30095
30266
  checkoutRoot: environment.checkoutRoot,
30096
30267
  workspace
30097
30268
  });
30269
+ ownedWorkspaces.add(workspace);
30270
+ await saveOwned().catch((saveError) => {
30271
+ throw new Error(`Could not record Coder workspace ${workspace} as owned by this host: ${errorMessage(saveError)}`);
30272
+ });
30098
30273
  didCreate = true;
30099
- await command(createArgs, 12e5);
30274
+ await command(createArgs, 12e5).catch(async (createError) => {
30275
+ if (!(await listWorkspaces().catch(() => [])).some((candidate) => candidate.name === workspace)) throw createError;
30276
+ });
30100
30277
  await waitForReady(workspace, environment);
30101
30278
  await checkSharing(workspace);
30102
30279
  const nodeVersion = await command([
@@ -30170,7 +30347,7 @@ function createCoderEnvWiring({ config, persistMapping, onReconciled = () => {},
30170
30347
  };
30171
30348
  if (!await ensureAvailable()) return {
30172
30349
  ok: false,
30173
- reason: "Coder environments are unavailable on this host"
30350
+ reason: unavailableReason
30174
30351
  };
30175
30352
  return whileWorkspaceBusy(mapping.workspace, () => startWorkspace({
30176
30353
  mapping,
@@ -30211,7 +30388,7 @@ function createCoderEnvWiring({ config, persistMapping, onReconciled = () => {},
30211
30388
  if (!mapping) return { ok: true };
30212
30389
  if (!await ensureAvailable()) return {
30213
30390
  ok: false,
30214
- reason: "Coder environments are unavailable on this host"
30391
+ reason: unavailableReason
30215
30392
  };
30216
30393
  return whileWorkspaceBusy(mapping.workspace, async () => {
30217
30394
  try {
@@ -30235,7 +30412,7 @@ function createCoderEnvWiring({ config, persistMapping, onReconciled = () => {},
30235
30412
  const fileMode = typeof mode === "number" ? mode.toString(8) : mode;
30236
30413
  if (!/^[0-7]{3,4}$/.test(fileMode)) throw new Error("Invalid remote file mode");
30237
30414
  if (!path.posix.isAbsolute(remotePath)) throw new Error("Remote upload path must be absolute");
30238
- if (!await ensureAvailable()) throw new Error("Coder environments are unavailable on this host");
30415
+ if (!await ensureAvailable()) throw new Error(unavailableReason);
30239
30416
  await runCoder([
30240
30417
  "ssh",
30241
30418
  workspace,
@@ -30879,6 +31056,12 @@ function createBranchGcWiring({ config, gitWorkspace, liveSessionIds, liveWorktr
30879
31056
  };
30880
31057
  }
30881
31058
  //#endregion
31059
+ //#region shared/contracts/coder-owned-workspaces.ts
31060
+ var CoderOwnedWorkspaces = z.object({
31061
+ version: z.literal(1),
31062
+ workspaces: z.array(z.string().regex(/^gv-[0-9a-f]{12}$/))
31063
+ });
31064
+ //#endregion
30882
31065
  //#region shared/display-text.ts
30883
31066
  var SECONDS_PER_MINUTE = 60;
30884
31067
  var HOURS_PER_DAY = 24;
@@ -34793,9 +34976,6 @@ function createTaskTitleRefiner({ getConfig, spawnLane, renameSession, nowFn = (
34793
34976
  function canRefine(session) {
34794
34977
  return !isStopped && !session._destroyed && !session.ephemeral && !session.customTitle && settings().enabled;
34795
34978
  }
34796
- function clearPending(session) {
34797
- session.setPendingTaskTitle(null);
34798
- }
34799
34979
  function clearRecheck(session) {
34800
34980
  const state = statesBySession.get(session);
34801
34981
  if (!state?.recheckTimer) return;
@@ -34830,11 +35010,8 @@ function createTaskTitleRefiner({ getConfig, spawnLane, renameSession, nowFn = (
34830
35010
  for (const [session, request] of queuedBySession) {
34831
35011
  queuedBySession.delete(session);
34832
35012
  if (session.taskTitlePromptRevision !== request.revision) continue;
34833
- if (!canRefine(session)) {
34834
- clearPending(session);
34835
- continue;
34836
- }
34837
- if (session.state !== STATES.IDLE && session.state !== STATES.COMPLETE) {
35013
+ if (!canRefine(session)) continue;
35014
+ if (request.currentTitle !== null && session.state !== STATES.IDLE && session.state !== STATES.COMPLETE) {
34838
35015
  scheduleRecheck(session);
34839
35016
  continue;
34840
35017
  }
@@ -34889,7 +35066,6 @@ function createTaskTitleRefiner({ getConfig, spawnLane, renameSession, nowFn = (
34889
35066
  clearRecheck(session);
34890
35067
  if (!canRefine(session)) {
34891
35068
  queuedBySession.delete(session);
34892
- clearPending(session);
34893
35069
  return;
34894
35070
  }
34895
35071
  const decision = decisionFor(session);
@@ -34917,13 +35093,9 @@ function createTaskTitleRefiner({ getConfig, spawnLane, renameSession, nowFn = (
34917
35093
  detach
34918
35094
  };
34919
35095
  statesBySession.set(session, state);
34920
- function onPrompt({ prompt }) {
35096
+ function onPrompt() {
34921
35097
  state.substantivePromptsSinceRefinement++;
34922
- if (!canRefine(session)) {
34923
- clearPending(session);
34924
- return;
34925
- }
34926
- session.setPendingTaskTitle(prompt);
35098
+ if (session.refinedTaskTitle === null) onTurnEnd(session);
34927
35099
  }
34928
35100
  function onReset() {
34929
35101
  clearRecheck(session);
@@ -34937,7 +35109,6 @@ function createTaskTitleRefiner({ getConfig, spawnLane, renameSession, nowFn = (
34937
35109
  clearRecheck(session);
34938
35110
  queuedBySession.delete(session);
34939
35111
  if (active?.request.session === session) active.controller.abort();
34940
- clearPending(session);
34941
35112
  }
34942
35113
  function detach() {
34943
35114
  session.off("task-prompt", onPrompt);
@@ -34956,10 +35127,7 @@ function createTaskTitleRefiner({ getConfig, spawnLane, renameSession, nowFn = (
34956
35127
  }
34957
35128
  async function stop() {
34958
35129
  isStopped = true;
34959
- for (const [session, state] of statesBySession) {
34960
- state.detach();
34961
- clearPending(session);
34962
- }
35130
+ for (const state of statesBySession.values()) state.detach();
34963
35131
  queuedBySession.clear();
34964
35132
  active?.controller.abort();
34965
35133
  await active?.settled;
@@ -46132,8 +46300,29 @@ function createBackendLanes(dependencies) {
46132
46300
  log: logger
46133
46301
  });
46134
46302
  const laneTelemetry = telemetry;
46303
+ const coderOwnedWorkspacesPath = path.join(glimmervoidHomeDir$1(), "coder-owned-workspaces.json");
46135
46304
  const coderEnv = createCoderEnvWiring({
46136
46305
  config,
46306
+ loadOwnedWorkspaces: () => {
46307
+ const outcome = loadJsonStateFileSync({
46308
+ filePath: coderOwnedWorkspacesPath,
46309
+ fsSync: fs,
46310
+ parse: (raw) => CoderOwnedWorkspaces.safeParse(raw).data?.workspaces ?? null,
46311
+ quarantine: false,
46312
+ includeNotDir: false
46313
+ });
46314
+ if (outcome.status === "loaded") return outcome.value;
46315
+ if (outcome.status === "missing") return [];
46316
+ logger.warn(`[coder-env] ignoring ${coderOwnedWorkspacesPath}: ${errorMessage(jsonStateLoadError(outcome))}`);
46317
+ return [];
46318
+ },
46319
+ saveOwnedWorkspaces: (workspaces) => writeJsonAtomic(coderOwnedWorkspacesPath, {
46320
+ version: 1,
46321
+ workspaces
46322
+ }, {
46323
+ mode: 384,
46324
+ mkdir: true
46325
+ }),
46137
46326
  persistMapping: (projectId, mapping) => persistSessionField(configStore, config, projectId, "environment", mapping),
46138
46327
  sessionsForIdleCheck: () => {
46139
46328
  const environmentsByName = new Map((config.coder?.environments ?? []).map((environment) => [environment.name, resolveCoderEnvironment(environment)]));