glimmervoid 0.46.2-next.186 → 0.46.2-next.187
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/glimmervoid.js +12 -19
- package/dist/chunks/{adapters-et74Bn2H.js → adapters-DhlMJfnx.js} +36 -11
- package/dist/chunks/{adapters-HtJlbghp.js → adapters-EIrGn6uO.js} +1 -1
- package/dist/chunks/{agent-api-cli-BruqD463.js → agent-api-cli-DMk9Bnp9.js} +1 -1
- package/dist/chunks/{agent-api-cli-d5dxcIh9.js → agent-api-cli-Dj-N0-zx.js} +1 -1
- package/dist/chunks/{agent-api-core-CsHdBXDS.js → agent-api-core-DJgqub_y.js} +1 -1
- package/dist/chunks/{agent-setup-cli-DHqTFNcZ.js → agent-setup-cli-O13kzelz.js} +1 -1
- package/dist/chunks/{build-channel-Djjf1f0x.js → build-channel--LGdXvBX.js} +1 -1
- package/dist/chunks/{config-CaDGM35x.js → config-8byiytw0.js} +0 -2
- package/dist/chunks/{config-store-CiqDhUVP.js → config-store-BYytjlP7.js} +3 -121
- package/dist/chunks/config-store-VSLIhI5n.js +1 -0
- package/dist/chunks/{grok-DnkhGGf5.js → grok-DGTxQFMm.js} +1 -2
- package/dist/chunks/kimi--at8UtrS.js +1 -0
- package/dist/chunks/{kimi-CNmvb0ck.js → kimi-CEz0Gk4U.js} +2 -3
- package/dist/chunks/{main-D3pR1YKO.js → main-IiyQ2jvc.js} +379 -714
- package/dist/chunks/{pair-cli-DwhjWebA.js → pair-cli-DK39lRV7.js} +2 -2
- package/dist/chunks/{remote-config-B29JkK8B.js → remote-config-DR8Hz3vm.js} +1 -1
- package/dist/chunks/{rtk-hook-core-23_GM8RQ.js → sane-yolo-KmcTONAe.js} +2 -35
- package/dist/chunks/{settings-cli-CYnpaThg.js → settings-cli-BHQRW4RB.js} +4 -4
- package/dist/chunks/{settings-readout-core-BO8xY8nb.js → settings-readout-core-D1Fi4-Vq.js} +1 -1
- package/dist/chunks/{spawn-env-BFfAkGlR.js → spawn-env-SjY2UxQI.js} +2 -4
- package/dist/chunks/{ssh-sign-cli-cPbU7Geo.js → ssh-sign-cli-Dz039V3e.js} +1 -1
- package/dist/client/assets/{alert-sound-D_tS2b2l.js → alert-sound-D6bIZreO.js} +1 -1
- package/dist/client/assets/alert-sound-D6bIZreO.js.br +0 -0
- package/dist/client/assets/{benchmark-panel-pOukQuIw.js → benchmark-panel-CZ_T_oJs.js} +1 -1
- package/dist/client/assets/benchmark-panel-CZ_T_oJs.js.br +0 -0
- package/dist/client/assets/{celebration-player-NU_8olP0.js → celebration-player-B7EyDMSR.js} +1 -1
- package/dist/client/assets/celebration-player-B7EyDMSR.js.br +0 -0
- package/dist/client/assets/{dialogs-BQHsTv9r.js → dialogs-BLh8iyo6.js} +1 -1
- package/dist/client/assets/dialogs-BLh8iyo6.js.br +0 -0
- package/dist/client/assets/{doc-editor-ui-CHm9sWlk.js → doc-editor-ui-CzxVOQ12.js} +1 -1
- package/dist/client/assets/doc-editor-ui-CzxVOQ12.js.br +0 -0
- package/dist/client/assets/{feature-hint-BWkaz9NJ.js → feature-hint-7aYPkqtW.js} +1 -1
- package/dist/client/assets/feature-hint-7aYPkqtW.js.br +0 -0
- package/dist/client/assets/{first-run-checklist-DP8KwYUQ.js → first-run-checklist-_XB_ms6P.js} +1 -1
- package/dist/client/assets/first-run-checklist-_XB_ms6P.js.br +0 -0
- package/dist/client/assets/{hooks-panel-ddDSHNWT.js → hooks-panel-tfkpna1Q.js} +1 -1
- package/dist/client/assets/hooks-panel-tfkpna1Q.js.br +0 -0
- package/dist/client/assets/{index-CGKbRKeM.js → index-ClNYGwPM.js} +5 -5
- package/dist/client/assets/index-ClNYGwPM.js.br +0 -0
- package/dist/client/assets/{issues-panel-DUc606cY.js → issues-panel-D7-Cdbna.js} +1 -1
- package/dist/client/assets/issues-panel-D7-Cdbna.js.br +0 -0
- package/dist/client/assets/{nyan-cat-CiPfzHOf.js → nyan-cat-Dkd_17F0.js} +1 -1
- package/dist/client/assets/nyan-cat-Dkd_17F0.js.br +0 -0
- package/dist/client/assets/{phone-shell-B6ExkKC9.js → phone-shell-CojZCgLE.js} +1 -1
- package/dist/client/assets/phone-shell-CojZCgLE.js.br +0 -0
- package/dist/client/assets/{plan-face-D64gvZig.js → plan-face-DFM_mLz4.js} +1 -1
- package/dist/client/assets/plan-face-DFM_mLz4.js.br +0 -0
- package/dist/client/assets/{plan-render-C8bA6cI9.js → plan-render-D1SBQTA1.js} +1 -1
- package/dist/client/assets/plan-render-D1SBQTA1.js.br +0 -0
- package/dist/client/assets/{pr-queue-columns-RtwDK4kJ.js → pr-queue-columns-B19aJ75W.js} +1 -1
- package/dist/client/assets/pr-queue-columns-B19aJ75W.js.br +0 -0
- package/dist/client/assets/{radar-panel-B8ecLCqV.js → radar-panel-Dvx1Q4Qa.js} +1 -1
- package/dist/client/assets/radar-panel-Dvx1Q4Qa.js.br +0 -0
- package/dist/client/assets/{repo-roots-adder-ZXQcj1Yh.js → repo-roots-adder-DIWLAWp0.js} +1 -1
- package/dist/client/assets/repo-roots-adder-DIWLAWp0.js.br +0 -0
- package/dist/client/assets/{resume-dialog-DVdiqnK-.js → resume-dialog-BDbvaMPw.js} +1 -1
- package/dist/client/assets/resume-dialog-BDbvaMPw.js.br +0 -0
- package/dist/client/assets/{review-queue-panel-CLKpr6pv.js → review-queue-panel-Dgv7khGC.js} +1 -1
- package/dist/client/assets/review-queue-panel-Dgv7khGC.js.br +0 -0
- package/dist/client/assets/settings-panel-BLNMxXmb.js +4 -0
- package/dist/client/assets/settings-panel-BLNMxXmb.js.br +0 -0
- package/dist/client/assets/{shown-lightbox-DjUoeNKu.js → shown-lightbox-cXOC6bAZ.js} +1 -1
- package/dist/client/assets/shown-lightbox-cXOC6bAZ.js.br +0 -0
- package/dist/client/assets/{trace-panel-Ao4CulxM.js → trace-panel-BQhYpt8f.js} +1 -1
- package/dist/client/assets/trace-panel-BQhYpt8f.js.br +0 -0
- package/dist/client/assets/{usage-panel-CFMJ4H8h.js → usage-panel-5-M3sWj-.js} +1 -1
- package/dist/client/assets/usage-panel-5-M3sWj-.js.br +0 -0
- package/dist/client/assets/{visions-panel-DGl7vRtH.js → visions-panel-CVP42Db1.js} +1 -1
- package/dist/client/assets/visions-panel-CVP42Db1.js.br +0 -0
- package/dist/client/index.html +1 -1
- package/dist/client/index.html.br +0 -0
- package/dist/server/index.js +1 -1
- package/dist/session/hook-tool-relay.js +13 -15
- package/package.json +1 -1
- package/dist/chunks/config-store-DUe8sXEb.js +0 -1
- package/dist/chunks/hook-tools-Cr97Vdap.js +0 -65
- package/dist/chunks/kimi-1B-KsOSh.js +0 -1
- package/dist/chunks/rtk-resolver-BifDj_oS.js +0 -21
- package/dist/chunks/rtk-resolver-CUGNoQl2.js +0 -1
- package/dist/client/assets/alert-sound-D_tS2b2l.js.br +0 -0
- package/dist/client/assets/benchmark-panel-pOukQuIw.js.br +0 -0
- package/dist/client/assets/celebration-player-NU_8olP0.js.br +0 -0
- package/dist/client/assets/dialogs-BQHsTv9r.js.br +0 -0
- package/dist/client/assets/doc-editor-ui-CHm9sWlk.js.br +0 -0
- package/dist/client/assets/feature-hint-BWkaz9NJ.js.br +0 -0
- package/dist/client/assets/first-run-checklist-DP8KwYUQ.js.br +0 -0
- package/dist/client/assets/hooks-panel-ddDSHNWT.js.br +0 -0
- package/dist/client/assets/index-CGKbRKeM.js.br +0 -0
- package/dist/client/assets/issues-panel-DUc606cY.js.br +0 -0
- package/dist/client/assets/nyan-cat-CiPfzHOf.js.br +0 -0
- package/dist/client/assets/phone-shell-B6ExkKC9.js.br +0 -0
- package/dist/client/assets/plan-face-D64gvZig.js.br +0 -0
- package/dist/client/assets/plan-render-C8bA6cI9.js.br +0 -0
- package/dist/client/assets/pr-queue-columns-RtwDK4kJ.js.br +0 -0
- package/dist/client/assets/radar-panel-B8ecLCqV.js.br +0 -0
- package/dist/client/assets/repo-roots-adder-ZXQcj1Yh.js.br +0 -0
- package/dist/client/assets/resume-dialog-DVdiqnK-.js.br +0 -0
- package/dist/client/assets/review-queue-panel-CLKpr6pv.js.br +0 -0
- package/dist/client/assets/settings-panel-BIvOuJfr.js +0 -4
- package/dist/client/assets/settings-panel-BIvOuJfr.js.br +0 -0
- package/dist/client/assets/shown-lightbox-DjUoeNKu.js.br +0 -0
- package/dist/client/assets/trace-panel-Ao4CulxM.js.br +0 -0
- package/dist/client/assets/usage-panel-CFMJ4H8h.js.br +0 -0
- package/dist/client/assets/visions-panel-DGl7vRtH.js.br +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { a as showHomeAsTilde, i as sanitizeOneLine, n as requireExecutableSpawnHelper, r as firstLine$1 } from "./node-pty-preflight-DbfWP9Rc.js";
|
|
2
|
-
import { a as isMissingFileError,
|
|
2
|
+
import { a as isMissingFileError, 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 { c as resolvePackageBin, i as clientDir, n as bundled, o as packageRoot, r as cliPath, s as relayPath, t as assetRoot } from "./runtime-paths-ghcH9CeW.js";
|
|
5
5
|
import { n as glimmervoidHomeDir, r as isOperatorHomeUnderTest, t as decideConfigPath } from "./config-path-core-DUWk0Lui.js";
|
|
6
6
|
import { At as TeamReviewThreadCommentsResponse, B as MyPr, Bt as GH_SEGMENT, C as SESSION_DOC_BODY_CAP_BYTES, Ct as ReviewVerdict, D as SHOWN_FILE_CAP_BYTES, Dt as TeamReviewResolveResponse, E as SESSION_NAME_RULE_TEXT, Et as TeamReviewCompareFiles, F as SshSignRequest, H as MyPrCheckContext, Ht as REPO_SLUG_RE, It as hasStandingViewerApproval, J as MyPrMergeRequest, Jt as BADGE_LABELS, K as MyPrLaneEntry, L as TaskTitle, Mt as TeamReviewThreadsRepository, N as ShownFile, Nt as canApproveAfterComment, O as SIGN_URL_ENV, Ot as TeamReviewStateEntry, Pt as decisionAsIfApprovalRequired, Qt as STATES, Rt as HEX_SHA_RE, St as ReviewThreadId, T as SESSION_NAME_PATTERN, 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_PERMISSION_HOOK_EVENT, b as ConversationQuestion, bt as ReviewFinding, ct as CommitSha, dt as FindingSeverity, et as MyPrThreadNode, g as CONVERSATION_APPROVAL_SUMMARY_MAX_CHARS, gt as PrDetail, h as COHERENCE_HOOKS_INACTIVE, ht as PostingPlan, jt as TeamReviewThreadResult, k as SSH_SIGN_BODY_CAP_BYTES, kt as TeamReviewStatus, lt as DECIDING_REVIEW_STATES, mt as PostedReviewEvent, 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, v as CONVERSATION_TOOL_RESULT_HOOK_EVENT, vt as ReviewComment, wt as TeamReviewActionRequest, xt as ReviewResult, yt as ReviewDraft, z as LinkedPr, zt as shortSha } from "./session-B2Wieg0a.js";
|
|
7
7
|
import { n as execFileAsync, o as spawn, r as execFileSync, t as execFile } from "./child-process-safe-D4hyVIXj.js";
|
|
8
|
-
import { A as HINT_VIEW_BY_FEATURE, At as changeMapFactId, B as MergedPrListing, Bt as GithubIssuePullRequestsRepository, Ct as UpdateJournal, D as pullRequestKeyFromReference, Dt as TraceRecord, Et as TraceCheckpoint, F as BenchmarkJudgement, Ft as PLAN_TOOL_NAME, G as GithubPrLightSearchNode, Gt as IssuesState, H as PrCheckoutCaseInput, Ht as IssueKey, I as BenchmarkRun, It as PlanDecision, J as WorkflowCommentBody, K as GithubPrsFrame, Kt as IssuesStatus, L as BenchmarkStatus, Lt as PlanRevision, M as BenchmarkActionRequest, Mt as PLAN_HOOK_EVENT, N as BenchmarkCase, Nt as PLAN_HOOK_OUTPUT_MAX_CHARS, O as FeatureHintState, Ot as CoherenceJournalOutput, P as BenchmarkId, Pt as PLAN_RESULT_HOOK_EVENT, R as BenchmarkSuite, Rt as parseExitPlanModeHookPayload, Tt as MAX_RAW_LINE_CHARS, U as GithubPrDetailNode, Ut as IssueUpdate, V as MinedPrReviewData, Vt as GithubIssueResponse, W as GithubPrKey, Wt as IssuesSearchResponse, X as WorkflowsSettings, Y as WorkflowLabelName, Z as WorkflowsState, a as ConfigUpdate, b as ClientMessage, c as SHELL_AGENT_ID, f as ReviewAgentId, g as CHANGES_POLL_INTERVAL_MS, gt as USAGE_INTEGER_RANGES, jt as PLAN_BODY_CAP_BYTES, k as HINT_FEATURES, kt as ChangeMap, m as USAGE_VENDOR_KEYS, p as USAGE_COST_MODES, q as comparablePrKey, qt as issuePullRequestStateFromGithub, r as BrowserConfig, rt as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, s as RUNTIME_CONFIG_SCALAR_KEYS, u as configIssueMessage, v as CLIENT_LOG_TEXT_MAX_CHARS, wt as SessionSetup, y as CONTROL_FRAME_MAX_BYTES, z as CommitComparison, zt as planTitle } from "./config-
|
|
8
|
+
import { A as HINT_VIEW_BY_FEATURE, At as changeMapFactId, B as MergedPrListing, Bt as GithubIssuePullRequestsRepository, Ct as UpdateJournal, D as pullRequestKeyFromReference, Dt as TraceRecord, Et as TraceCheckpoint, F as BenchmarkJudgement, Ft as PLAN_TOOL_NAME, G as GithubPrLightSearchNode, Gt as IssuesState, H as PrCheckoutCaseInput, Ht as IssueKey, I as BenchmarkRun, It as PlanDecision, J as WorkflowCommentBody, K as GithubPrsFrame, Kt as IssuesStatus, L as BenchmarkStatus, Lt as PlanRevision, M as BenchmarkActionRequest, Mt as PLAN_HOOK_EVENT, N as BenchmarkCase, Nt as PLAN_HOOK_OUTPUT_MAX_CHARS, O as FeatureHintState, Ot as CoherenceJournalOutput, P as BenchmarkId, Pt as PLAN_RESULT_HOOK_EVENT, R as BenchmarkSuite, Rt as parseExitPlanModeHookPayload, Tt as MAX_RAW_LINE_CHARS, U as GithubPrDetailNode, Ut as IssueUpdate, V as MinedPrReviewData, Vt as GithubIssueResponse, W as GithubPrKey, Wt as IssuesSearchResponse, X as WorkflowsSettings, Y as WorkflowLabelName, Z as WorkflowsState, a as ConfigUpdate, b as ClientMessage, c as SHELL_AGENT_ID, f as ReviewAgentId, g as CHANGES_POLL_INTERVAL_MS, gt as USAGE_INTEGER_RANGES, jt as PLAN_BODY_CAP_BYTES, k as HINT_FEATURES, kt as ChangeMap, m as USAGE_VENDOR_KEYS, p as USAGE_COST_MODES, q as comparablePrKey, qt as issuePullRequestStateFromGithub, r as BrowserConfig, rt as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, s as RUNTIME_CONFIG_SCALAR_KEYS, u as configIssueMessage, v as CLIENT_LOG_TEXT_MAX_CHARS, wt as SessionSetup, y as CONTROL_FRAME_MAX_BYTES, z as CommitComparison, zt as planTitle } from "./config-8byiytw0.js";
|
|
9
9
|
import { a as permitsHelpCommand, o as supervisionLine, r as describeSessionLimits } from "./session-routes-Cr9S--Nf.js";
|
|
10
|
-
import { A as resolveTaskTitle, B as listRepoConversations, C as extractOscTaskTitle, D as parseRefinedSessionName, E as isSubstantivePrompt, F as resolveResumeTarget, H as isAutoNameOf, I as resumePromptFor, L as shouldAdoptReportedResumeId, M as AUTO_CONTINUE_PROMPT, N as RESUME_ID_RE, O as parseRefinedTaskTitle, P as pickAutoResume, R as claudeProjectsDir, S as extractHookTaskTitle, T as isSelfWakePrompt, U as nextSuggestedName, V as listRepoWorktreePaths, _ as buildTaskTitleRefinementPrompt, a as decideSpawnAllowance, b as decideTaskTitleRefinement, c as describeKeptChildAttention, d as describeUnpushedCloseRefusal, g as buildPersistedTaskTitle, h as projectReviews, i as decideAgentRequest, j as seedTaskTitleSources, k as resolveRefocusTaskTitle, l as describePushLanding, m as projectMyPrs, n as REFUSAL_REASON, o as deriveChildSessionName, p as parseAgentVerb, s as describeChildEndNote, u as describeRoleRefusal, v as chooseRefinedSessionName, w as extractPromptTaskTitle, x as extractAiTitle, y as cleanTaskPrompt, z as encodeProjectDir } from "./agent-api-core-
|
|
10
|
+
import { A as resolveTaskTitle, B as listRepoConversations, C as extractOscTaskTitle, D as parseRefinedSessionName, E as isSubstantivePrompt, F as resolveResumeTarget, H as isAutoNameOf, I as resumePromptFor, L as shouldAdoptReportedResumeId, M as AUTO_CONTINUE_PROMPT, N as RESUME_ID_RE, O as parseRefinedTaskTitle, P as pickAutoResume, R as claudeProjectsDir, S as extractHookTaskTitle, T as isSelfWakePrompt, U as nextSuggestedName, V as listRepoWorktreePaths, _ as buildTaskTitleRefinementPrompt, a as decideSpawnAllowance, b as decideTaskTitleRefinement, c as describeKeptChildAttention, d as describeUnpushedCloseRefusal, g as buildPersistedTaskTitle, h as projectReviews, i as decideAgentRequest, j as seedTaskTitleSources, k as resolveRefocusTaskTitle, l as describePushLanding, m as projectMyPrs, n as REFUSAL_REASON, o as deriveChildSessionName, p as parseAgentVerb, s as describeChildEndNote, u as describeRoleRefusal, v as chooseRefinedSessionName, w as extractPromptTaskTitle, x as extractAiTitle, y as cleanTaskPrompt, z as encodeProjectDir } from "./agent-api-core-DJgqub_y.js";
|
|
11
11
|
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";
|
|
12
12
|
import { i as parseCommandLine, n as warnWhenGitIsTooOld } from "./git-version-WyrLHANY.js";
|
|
13
13
|
import { n as checkGuardrailsDependencies, t as allowGuardedSpawn } from "./guardrails-deps-BjPzk1rE.js";
|
|
@@ -15,24 +15,22 @@ import { t as HOOK_URL_ENV } from "./hook-relay-core-DA_bz2KA.js";
|
|
|
15
15
|
import { t as HOOK_VIA_GUARDRAILS_PROXY_ENV } from "./guardrails-proxy-core-BI3rdY-m.js";
|
|
16
16
|
import { n as refocusReplyFor } from "./refocus-core-CwP_KIcU.js";
|
|
17
17
|
import { n as parseJsonRecord, t as parseJsonOrNull } from "./json-core-dfa_7Fak.js";
|
|
18
|
-
import {
|
|
18
|
+
import { i as saneYoloFiles } from "./sane-yolo-KmcTONAe.js";
|
|
19
19
|
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";
|
|
20
20
|
import { n as DEFAULT_MAX_MS, r as nextBackoffMs, t as DEFAULT_BASE_MS } from "./backoff-DjVpfHk7.js";
|
|
21
21
|
import { n as unrefTimer, t as DEFAULT_TIMER_FNS } from "./timer-deps-u2DAQLok.js";
|
|
22
22
|
import { a as readPageTitle, i as filesAfterRetention, n as decideShownKind, o as shownMimeForFilename, r as describeOverCap, t as SHOWN_SNIFF_BYTES } from "./shown-files-core-C7ER2sw2.js";
|
|
23
23
|
import { n as shellQuote } from "./hook-command-core-qTNK-xMF.js";
|
|
24
24
|
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-BjFK_eSH.js";
|
|
25
|
-
import { $ as
|
|
26
|
-
import { _ as TelemetryState, a as DEEP_HISTORY_SCROLLBACK_LINES, c as describeDataAttach, d as DashboardTelemetryReport, h as TELEMETRY_EVENT_SCHEMAS, i as HookEnvelope, l as parseDataAttach, m as PendingCrashReport, r as HTTP_URL_RE, s as LOGGED_FAST_CLOSE_COUNTS, u as parseDataClientMessage } from "./build-channel
|
|
27
|
-
import { $ as identityFromRelPath, A as decideFileRead, B as sessionsRootCandidates, C as pickNewestPublished, D as codexRootCandidates, E as codexHomes, F as kimiHomes, G as kimiSessionIdFromPath, H as shouldPersistWarehouse, I as passOutcome, J as dedupKeys, K as parseKimiUsageLine, L as projectDirCandidates, M as expandTilde, N as grokHomes, O as codexSessionIdFromPath, P as isUsageFile, Q as foldReplacementIntoGenerationRollup, R as resolveProjectsDirs, S as parseResolvedSha, T as codexFallbackRoots, U as splitLines$1, V as shouldEvaluateDespiteIoFailures, W as kimiDedupIdentity, X as expandAdvisorIterations, Y as emptyTotals, Z as foldEntryIntoGenerationRollup, _ as isCheckFresh, a as describeAgentResolvability, at as totalTokensOf$1, b as parseRegistryDeprecation, c as isKnownAgentId, d as resolveAdapter, et as isWithinGenerationRecencyWindow, f as setCustomAgents, g as decideUpdateStatus, h as decideInstallFlavor, i as customAgentFingerprint, it as shouldReplace, j as dedupeCodexFiles, k as continuationDelayMs, l as listAgentIds, m as readHostCodexVersion, n as cachedAgentResolvability, nt as parseJsonLine, o as getAdapter, ot as vendorUsageEntry, p as codex, q as addEntryToTotals, r as commandFor, rt as parseUsageLine, s as hookProfileOf, st as
|
|
28
|
-
import { t as HOOK_TOOLS } from "./hook-tools-Cr97Vdap.js";
|
|
25
|
+
import { $ as matchedPrefix, A as FIRST_RUN_NOTICE, B as codexUserIdOf, F as buildBrowserExceptionProperties, G as nodeMajorVersion, H as decideRemoteTelemetryState, I as buildExceptionProperties, K as parsePosthogReleaseId, L as buildPersonProperties, M as TELEMETRY_FLAGS_URL, N as adapterBucket, P as buildAiGenerationEvents, Q as DEFAULT_BRANCH_GC_PREFIXES, R as classifySessionExit, U as decideTelemetryConsent, V as decideIsDevInstall, W as exceptionFingerprint, X as stableConfigKey, a as ensureProjectIds, at as canonicalizePath, et as planBranchGc, g as validateSettingsBlock, h as settingsBlockSpecFor, i as createConfigStore, it as worktreeIntegrationTips, j as TELEMETRY_BATCH_URL, m as mergeSettingsBlock, n as DEFAULT_CONFIG, nt as sessionIdFromBranch, o as generateProjectId, ot as comparableDirectoryPath, q as resolveProjectToken, rt as usablePrefixes, s as glimmervoidHomeDir$1, st as isSameDirectoryPath, t as ABORT_CONFIG_SAVE, tt as planWorktreeGc, z as claudeAccountUuidOf } from "./config-store-BYytjlP7.js";
|
|
26
|
+
import { _ as TelemetryState, a as DEEP_HISTORY_SCROLLBACK_LINES, c as describeDataAttach, d as DashboardTelemetryReport, h as TELEMETRY_EVENT_SCHEMAS, i as HookEnvelope, l as parseDataAttach, m as PendingCrashReport, r as HTTP_URL_RE, s as LOGGED_FAST_CLOSE_COUNTS, u as parseDataClientMessage } from "./build-channel--LGdXvBX.js";
|
|
27
|
+
import { $ as identityFromRelPath, A as decideFileRead, B as sessionsRootCandidates, C as pickNewestPublished, D as codexRootCandidates, E as codexHomes, F as kimiHomes, G as kimiSessionIdFromPath, H as shouldPersistWarehouse, I as passOutcome, J as dedupKeys, K as parseKimiUsageLine, L as projectDirCandidates, M as expandTilde, N as grokHomes, O as codexSessionIdFromPath, P as isUsageFile, Q as foldReplacementIntoGenerationRollup, R as resolveProjectsDirs, S as parseResolvedSha, T as codexFallbackRoots, U as splitLines$1, V as shouldEvaluateDespiteIoFailures, W as kimiDedupIdentity, X as expandAdvisorIterations, Y as emptyTotals, Z as foldEntryIntoGenerationRollup, _ as isCheckFresh, a as describeAgentResolvability, at as totalTokensOf$1, b as parseRegistryDeprecation, c as isKnownAgentId, ct as claudeCode, d as resolveAdapter, et as isWithinGenerationRecencyWindow, f as setCustomAgents, g as decideUpdateStatus, h as decideInstallFlavor, i as customAgentFingerprint, it as shouldReplace, j as dedupeCodexFiles, k as continuationDelayMs, l as listAgentIds, m as readHostCodexVersion, n as cachedAgentResolvability, nt as parseJsonLine, o as getAdapter, ot as vendorUsageEntry, p as codex, q as addEntryToTotals, r as commandFor, rt as parseUsageLine, s as hookProfileOf, st as HOOK_TOOLS, t as DEFAULT_AGENT_ID, tt as mergeGenerationRollups, u as resetCommandCache, v as normalizeSha, w as shortSha$1, x as parseRegistryLatest, y as normalizeUpdateChannel, z as scopedClaudeRoots } from "./adapters-DhlMJfnx.js";
|
|
29
28
|
import { d as releaseSessionLock, f as sessionIdOfLockFile, l as releaseUnheldKimiHomeSecrets, n as generatedKimiHomePath, o as realKimiHome, p as trashSessionTempFolderOnceUnheld, u as createHeldSessionTempFolder } from "./kimi-home-CYJpt82i.js";
|
|
30
|
-
import { t as kimi } from "./kimi-
|
|
29
|
+
import { t as kimi } from "./kimi-CEz0Gk4U.js";
|
|
31
30
|
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";
|
|
32
|
-
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-
|
|
33
|
-
import { n as configFileViewOf, u as readSettingsForAgent } from "./settings-readout-core-
|
|
31
|
+
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-DR8Hz3vm.js";
|
|
32
|
+
import { n as configFileViewOf, u as readSettingsForAgent } from "./settings-readout-core-D1Fi4-Vq.js";
|
|
34
33
|
import { _ as escapeMarkup, g as createLaneLog, n as createVisionsSetup } from "./visions-setup-VMMyqOpl.js";
|
|
35
|
-
import { t as getRtkPath } from "./rtk-resolver-BifDj_oS.js";
|
|
36
34
|
import { createRequire } from "node:module";
|
|
37
35
|
import fs, { readFileSync, readlinkSync } from "node:fs";
|
|
38
36
|
import path, { join, resolve } from "node:path";
|
|
@@ -15988,359 +15986,9 @@ function createSessionOutput(options) {
|
|
|
15988
15986
|
};
|
|
15989
15987
|
}
|
|
15990
15988
|
//#endregion
|
|
15991
|
-
//#region server/ingest/core/ingest-shell-core.ts
|
|
15992
|
-
var SOURCE$4 = "shellHistory";
|
|
15993
|
-
var SHELLS = Object.freeze([
|
|
15994
|
-
"powershell",
|
|
15995
|
-
"fish",
|
|
15996
|
-
"bash",
|
|
15997
|
-
"zsh"
|
|
15998
|
-
]);
|
|
15999
|
-
var ZERO_SETUP_SHELLS = Object.freeze(["powershell", "fish"]);
|
|
16000
|
-
var ZERO_SETUP_SHELLS_ON_MACOS = Object.freeze(["zsh", "fish"]);
|
|
16001
|
-
var PSREADLINE_SUFFIX = "_history.txt";
|
|
16002
|
-
var MAX_COMMAND_CHARS = 4e3;
|
|
16003
|
-
var MAX_CONTINUATION_LINES = 64;
|
|
16004
|
-
var TRIVIAL_COMMANDS = /* @__PURE__ */ new Set([
|
|
16005
|
-
"",
|
|
16006
|
-
"l",
|
|
16007
|
-
"ls",
|
|
16008
|
-
"ll",
|
|
16009
|
-
"la",
|
|
16010
|
-
"dir",
|
|
16011
|
-
"cd",
|
|
16012
|
-
"cd ..",
|
|
16013
|
-
"cd -",
|
|
16014
|
-
"cd ~",
|
|
16015
|
-
"cd /",
|
|
16016
|
-
"pwd",
|
|
16017
|
-
"cls",
|
|
16018
|
-
"clear",
|
|
16019
|
-
"exit",
|
|
16020
|
-
"q",
|
|
16021
|
-
"history"
|
|
16022
|
-
]);
|
|
16023
|
-
function defaultShellsFor(platform) {
|
|
16024
|
-
return platform === "darwin" ? ZERO_SETUP_SHELLS_ON_MACOS : ZERO_SETUP_SHELLS;
|
|
16025
|
-
}
|
|
16026
|
-
function normalizeShells(raw, platform) {
|
|
16027
|
-
if (!Array.isArray(raw) || raw.length === 0) return {
|
|
16028
|
-
shells: [...defaultShellsFor(platform)],
|
|
16029
|
-
rejected: []
|
|
16030
|
-
};
|
|
16031
|
-
const shells = [];
|
|
16032
|
-
const rejected = [];
|
|
16033
|
-
for (const entry of raw) {
|
|
16034
|
-
const name = typeof entry === "string" ? entry.trim().toLowerCase() : "";
|
|
16035
|
-
const shell = name === "pwsh" || name === "powershell.exe" ? "powershell" : name;
|
|
16036
|
-
if (SHELLS.includes(shell)) {
|
|
16037
|
-
if (!shells.includes(shell)) shells.push(shell);
|
|
16038
|
-
continue;
|
|
16039
|
-
}
|
|
16040
|
-
const label = typeof entry === "string" ? entry.trim() : String(entry);
|
|
16041
|
-
if (rejected.includes(label)) continue;
|
|
16042
|
-
rejected.push(label);
|
|
16043
|
-
}
|
|
16044
|
-
return {
|
|
16045
|
-
shells,
|
|
16046
|
-
rejected
|
|
16047
|
-
};
|
|
16048
|
-
}
|
|
16049
|
-
function resolveHomeDir(env, homeDir) {
|
|
16050
|
-
return rawTextOr(env?.HOME, null) || rawTextOr(env?.USERPROFILE, null) || homeDir;
|
|
16051
|
-
}
|
|
16052
|
-
function dataHome(env, homeDir) {
|
|
16053
|
-
return rawTextOr(env?.XDG_DATA_HOME, null) || path.join(resolveHomeDir(env, homeDir), ".local", "share");
|
|
16054
|
-
}
|
|
16055
|
-
function configHome(env, homeDir) {
|
|
16056
|
-
return rawTextOr(env?.XDG_CONFIG_HOME, null) || path.join(resolveHomeDir(env, homeDir), ".config");
|
|
16057
|
-
}
|
|
16058
|
-
function powershellLocations(env, platform, homeDir) {
|
|
16059
|
-
if (platform === "win32") {
|
|
16060
|
-
const appData = rawTextOr(env?.APPDATA, null) || path.join(resolveHomeDir(env, homeDir), "AppData", "Roaming");
|
|
16061
|
-
return [{
|
|
16062
|
-
shell: "powershell",
|
|
16063
|
-
dir: path.join(appData, "Microsoft", "Windows", "PowerShell", "PSReadLine"),
|
|
16064
|
-
suffix: PSREADLINE_SUFFIX,
|
|
16065
|
-
name: null
|
|
16066
|
-
}];
|
|
16067
|
-
}
|
|
16068
|
-
return [{
|
|
16069
|
-
shell: "powershell",
|
|
16070
|
-
dir: path.join(dataHome(env, homeDir), "powershell", "PSReadLine"),
|
|
16071
|
-
suffix: PSREADLINE_SUFFIX,
|
|
16072
|
-
name: null
|
|
16073
|
-
}];
|
|
16074
|
-
}
|
|
16075
|
-
function fishLocations(env, homeDir) {
|
|
16076
|
-
return [{
|
|
16077
|
-
shell: "fish",
|
|
16078
|
-
dir: path.join(dataHome(env, homeDir), "fish"),
|
|
16079
|
-
suffix: null,
|
|
16080
|
-
name: "fish_history"
|
|
16081
|
-
}, {
|
|
16082
|
-
shell: "fish",
|
|
16083
|
-
dir: path.join(configHome(env, homeDir), "fish"),
|
|
16084
|
-
suffix: null,
|
|
16085
|
-
name: "fish_history"
|
|
16086
|
-
}];
|
|
16087
|
-
}
|
|
16088
|
-
function fileLocation(shell, filePath) {
|
|
16089
|
-
return {
|
|
16090
|
-
shell,
|
|
16091
|
-
dir: path.dirname(filePath),
|
|
16092
|
-
suffix: null,
|
|
16093
|
-
name: path.basename(filePath)
|
|
16094
|
-
};
|
|
16095
|
-
}
|
|
16096
|
-
function histFileLocation(wanted, env) {
|
|
16097
|
-
const posixShells = wanted.filter((shell) => shell === "bash" || shell === "zsh");
|
|
16098
|
-
if (posixShells.length !== 1) return [];
|
|
16099
|
-
const histFile = rawTextOr(env?.HISTFILE, null);
|
|
16100
|
-
if (!histFile) return [];
|
|
16101
|
-
return [fileLocation(posixShells[0], histFile)];
|
|
16102
|
-
}
|
|
16103
|
-
function defaultHistFiles(shell, env, homeDir) {
|
|
16104
|
-
const home = resolveHomeDir(env, homeDir);
|
|
16105
|
-
if (shell === "bash") return [fileLocation("bash", path.join(home, ".bash_history"))];
|
|
16106
|
-
return [fileLocation("zsh", path.join(home, ".zsh_history")), fileLocation("zsh", path.join(home, ".histfile"))];
|
|
16107
|
-
}
|
|
16108
|
-
function locationKey(location) {
|
|
16109
|
-
return `${path.resolve(location.dir)}|${location.name || location.suffix}`;
|
|
16110
|
-
}
|
|
16111
|
-
function historyLocations({ shells = null, env = {}, platform = process.platform, homeDir = null } = {}) {
|
|
16112
|
-
const wanted = normalizeShells(shells, platform).shells;
|
|
16113
|
-
const locations = [...histFileLocation(wanted, env)];
|
|
16114
|
-
for (const shell of wanted) {
|
|
16115
|
-
if (shell === "powershell") locations.push(...powershellLocations(env, platform, homeDir));
|
|
16116
|
-
if (shell === "fish") locations.push(...fishLocations(env, homeDir));
|
|
16117
|
-
if (shell === "bash" || shell === "zsh") locations.push(...defaultHistFiles(shell, env, homeDir));
|
|
16118
|
-
}
|
|
16119
|
-
const seen = /* @__PURE__ */ new Set();
|
|
16120
|
-
const deduped = [];
|
|
16121
|
-
for (const location of locations) {
|
|
16122
|
-
const key = locationKey(location);
|
|
16123
|
-
if (seen.has(key)) continue;
|
|
16124
|
-
seen.add(key);
|
|
16125
|
-
deduped.push(location);
|
|
16126
|
-
}
|
|
16127
|
-
return deduped;
|
|
16128
|
-
}
|
|
16129
|
-
function matchesLocation(location, filename) {
|
|
16130
|
-
if (typeof filename !== "string" || !filename) return false;
|
|
16131
|
-
if (location?.name) return filename === location.name;
|
|
16132
|
-
const suffix = location?.suffix;
|
|
16133
|
-
if (!suffix) return false;
|
|
16134
|
-
if (filename.length <= suffix.length) return false;
|
|
16135
|
-
return filename.toLowerCase().endsWith(suffix.toLowerCase());
|
|
16136
|
-
}
|
|
16137
|
-
function createParseState() {
|
|
16138
|
-
return {
|
|
16139
|
-
pending: [],
|
|
16140
|
-
pendingTs: null,
|
|
16141
|
-
entry: null
|
|
16142
|
-
};
|
|
16143
|
-
}
|
|
16144
|
-
function withinContinuationBounds(pending) {
|
|
16145
|
-
if (pending.length >= MAX_CONTINUATION_LINES) return false;
|
|
16146
|
-
let chars = 0;
|
|
16147
|
-
for (const line of pending) chars += line.length + 1;
|
|
16148
|
-
return chars < MAX_COMMAND_CHARS;
|
|
16149
|
-
}
|
|
16150
|
-
function parsePowershell(lines, state) {
|
|
16151
|
-
const commands = [];
|
|
16152
|
-
let pending = state.pending;
|
|
16153
|
-
for (const line of lines) {
|
|
16154
|
-
const continued = line.endsWith("`");
|
|
16155
|
-
pending = [...pending, continued ? line.slice(0, -1) : line];
|
|
16156
|
-
if (continued && withinContinuationBounds(pending)) continue;
|
|
16157
|
-
commands.push({
|
|
16158
|
-
text: pending.join("\n"),
|
|
16159
|
-
ts: null
|
|
16160
|
-
});
|
|
16161
|
-
pending = [];
|
|
16162
|
-
}
|
|
16163
|
-
return {
|
|
16164
|
-
commands,
|
|
16165
|
-
state: {
|
|
16166
|
-
...state,
|
|
16167
|
-
pending
|
|
16168
|
-
}
|
|
16169
|
-
};
|
|
16170
|
-
}
|
|
16171
|
-
var FISH_ENTRY = /^- cmd:\s?([\s\S]*)$/;
|
|
16172
|
-
var FISH_WHEN = /^\s+when:\s*(\d+)/;
|
|
16173
|
-
function unescapeFish(text) {
|
|
16174
|
-
let out = "";
|
|
16175
|
-
for (let index = 0; index < text.length; index += 1) {
|
|
16176
|
-
const char = text[index];
|
|
16177
|
-
if (char !== "\\") {
|
|
16178
|
-
out += char;
|
|
16179
|
-
continue;
|
|
16180
|
-
}
|
|
16181
|
-
const next = text[index + 1];
|
|
16182
|
-
if (next === "n") {
|
|
16183
|
-
out += "\n";
|
|
16184
|
-
index += 1;
|
|
16185
|
-
continue;
|
|
16186
|
-
}
|
|
16187
|
-
if (next === "\\") {
|
|
16188
|
-
out += "\\";
|
|
16189
|
-
index += 1;
|
|
16190
|
-
continue;
|
|
16191
|
-
}
|
|
16192
|
-
out += char;
|
|
16193
|
-
}
|
|
16194
|
-
return out;
|
|
16195
|
-
}
|
|
16196
|
-
function parseFish(lines, state) {
|
|
16197
|
-
const commands = [];
|
|
16198
|
-
let entry = state.entry;
|
|
16199
|
-
for (const line of lines) {
|
|
16200
|
-
const started = FISH_ENTRY.exec(line);
|
|
16201
|
-
if (started) {
|
|
16202
|
-
if (entry) commands.push(entry);
|
|
16203
|
-
entry = {
|
|
16204
|
-
text: unescapeFish(started[1]),
|
|
16205
|
-
ts: null
|
|
16206
|
-
};
|
|
16207
|
-
continue;
|
|
16208
|
-
}
|
|
16209
|
-
if (!entry) continue;
|
|
16210
|
-
const when = FISH_WHEN.exec(line);
|
|
16211
|
-
if (!when) continue;
|
|
16212
|
-
commands.push({
|
|
16213
|
-
text: entry.text,
|
|
16214
|
-
ts: Number(when[1]) * 1e3
|
|
16215
|
-
});
|
|
16216
|
-
entry = null;
|
|
16217
|
-
}
|
|
16218
|
-
return {
|
|
16219
|
-
commands,
|
|
16220
|
-
state: {
|
|
16221
|
-
...state,
|
|
16222
|
-
entry
|
|
16223
|
-
}
|
|
16224
|
-
};
|
|
16225
|
-
}
|
|
16226
|
-
var BASH_TIMESTAMP = /^#(\d{9,})\s*$/;
|
|
16227
|
-
function parseBash(lines, state) {
|
|
16228
|
-
const commands = [];
|
|
16229
|
-
let pendingTs = state.pendingTs;
|
|
16230
|
-
for (const line of lines) {
|
|
16231
|
-
const stamped = BASH_TIMESTAMP.exec(line);
|
|
16232
|
-
if (stamped) {
|
|
16233
|
-
pendingTs = Number(stamped[1]) * 1e3;
|
|
16234
|
-
continue;
|
|
16235
|
-
}
|
|
16236
|
-
if (!line.trim()) continue;
|
|
16237
|
-
commands.push({
|
|
16238
|
-
text: line,
|
|
16239
|
-
ts: pendingTs
|
|
16240
|
-
});
|
|
16241
|
-
pendingTs = null;
|
|
16242
|
-
}
|
|
16243
|
-
return {
|
|
16244
|
-
commands,
|
|
16245
|
-
state: {
|
|
16246
|
-
...state,
|
|
16247
|
-
pendingTs
|
|
16248
|
-
}
|
|
16249
|
-
};
|
|
16250
|
-
}
|
|
16251
|
-
var ZSH_EXTENDED = /^:\s(\d+):(\d+);([\s\S]*)$/;
|
|
16252
|
-
function parseZsh(lines, state) {
|
|
16253
|
-
const commands = [];
|
|
16254
|
-
let pending = state.pending;
|
|
16255
|
-
let pendingTs = state.pendingTs;
|
|
16256
|
-
for (const line of lines) {
|
|
16257
|
-
const starting = pending.length === 0;
|
|
16258
|
-
const extended = starting ? ZSH_EXTENDED.exec(line) : null;
|
|
16259
|
-
if (starting) pendingTs = extended ? Number(extended[1]) * 1e3 : null;
|
|
16260
|
-
const text = extended ? extended[3] : line;
|
|
16261
|
-
const continued = text.endsWith("\\");
|
|
16262
|
-
pending = [...pending, continued ? text.slice(0, -1) : text];
|
|
16263
|
-
if (continued && withinContinuationBounds(pending)) continue;
|
|
16264
|
-
const joined = pending.join("\n");
|
|
16265
|
-
pending = [];
|
|
16266
|
-
if (joined.trim()) commands.push({
|
|
16267
|
-
text: joined,
|
|
16268
|
-
ts: pendingTs
|
|
16269
|
-
});
|
|
16270
|
-
pendingTs = null;
|
|
16271
|
-
}
|
|
16272
|
-
return {
|
|
16273
|
-
commands,
|
|
16274
|
-
state: {
|
|
16275
|
-
...state,
|
|
16276
|
-
pending,
|
|
16277
|
-
pendingTs
|
|
16278
|
-
}
|
|
16279
|
-
};
|
|
16280
|
-
}
|
|
16281
|
-
var PARSERS = Object.freeze({
|
|
16282
|
-
powershell: parsePowershell,
|
|
16283
|
-
fish: parseFish,
|
|
16284
|
-
bash: parseBash,
|
|
16285
|
-
zsh: parseZsh
|
|
16286
|
-
});
|
|
16287
|
-
function parseHistoryLines({ shell, lines = [], state = null } = {}) {
|
|
16288
|
-
const current = state || createParseState();
|
|
16289
|
-
const parser = shell ? PARSERS[shell] : void 0;
|
|
16290
|
-
if (!parser || !Array.isArray(lines) || lines.length === 0) return {
|
|
16291
|
-
commands: [],
|
|
16292
|
-
state: current
|
|
16293
|
-
};
|
|
16294
|
-
return parser(lines, current);
|
|
16295
|
-
}
|
|
16296
|
-
function foldForCompare(text) {
|
|
16297
|
-
return String(text == null ? "" : text).replace(/\s+/g, " ").trim();
|
|
16298
|
-
}
|
|
16299
|
-
function isTrivialCommand(text) {
|
|
16300
|
-
if (typeof text !== "string") return true;
|
|
16301
|
-
return TRIVIAL_COMMANDS.has(text.trim().toLowerCase());
|
|
16302
|
-
}
|
|
16303
|
-
function decideCommandEvent({ shell = "", command = null, previous = null, now = 0 } = {}) {
|
|
16304
|
-
const text = typeof command?.text === "string" ? command.text : "";
|
|
16305
|
-
const compared = foldForCompare(text);
|
|
16306
|
-
if (!compared) return {
|
|
16307
|
-
event: null,
|
|
16308
|
-
previous
|
|
16309
|
-
};
|
|
16310
|
-
if (isTrivialCommand(compared)) return {
|
|
16311
|
-
event: null,
|
|
16312
|
-
previous: compared
|
|
16313
|
-
};
|
|
16314
|
-
if (compared === previous) return {
|
|
16315
|
-
event: null,
|
|
16316
|
-
previous: compared
|
|
16317
|
-
};
|
|
16318
|
-
const stamped = Number(command?.ts);
|
|
16319
|
-
const lineCount = text.split("\n").length;
|
|
16320
|
-
return {
|
|
16321
|
-
event: {
|
|
16322
|
-
source: SOURCE$4,
|
|
16323
|
-
kind: "command",
|
|
16324
|
-
ts: Number.isFinite(stamped) && stamped > 0 ? Math.floor(stamped) : now,
|
|
16325
|
-
scope: {
|
|
16326
|
-
root: null,
|
|
16327
|
-
sessionId: null
|
|
16328
|
-
},
|
|
16329
|
-
summary: `${shell}: ${text}`,
|
|
16330
|
-
detail: lineCount > 1 ? {
|
|
16331
|
-
shell,
|
|
16332
|
-
lines: lineCount
|
|
16333
|
-
} : { shell }
|
|
16334
|
-
},
|
|
16335
|
-
previous: compared
|
|
16336
|
-
};
|
|
16337
|
-
}
|
|
16338
|
-
//#endregion
|
|
16339
15989
|
//#region server/hook-tools.ts
|
|
16340
15990
|
var writtenHomes = /* @__PURE__ */ new Set();
|
|
16341
15991
|
var warnedTools = /* @__PURE__ */ new Set();
|
|
16342
|
-
var ensuredDataDirs = /* @__PURE__ */ new Set();
|
|
16343
|
-
var RTK_DATA_FOLDER = "rtk";
|
|
16344
15992
|
function currentGlimmervoidHome() {
|
|
16345
15993
|
return glimmervoidHomeDir(os.homedir(), process.env);
|
|
16346
15994
|
}
|
|
@@ -16366,37 +16014,6 @@ function writeSaneYoloPolicy(homeDir, glimmervoidHome = currentGlimmervoidHome()
|
|
|
16366
16014
|
}
|
|
16367
16015
|
writtenHomes.add(homeDir);
|
|
16368
16016
|
}
|
|
16369
|
-
function rtkDataDir(platform = process.platform, env = process.env, homeDir = os.homedir()) {
|
|
16370
|
-
if (platform === "darwin") return path.join(homeDir, "Library", "Application Support", RTK_DATA_FOLDER);
|
|
16371
|
-
if (platform !== "linux") return null;
|
|
16372
|
-
const dataHomeDir = dataHome(env, homeDir);
|
|
16373
|
-
return path.isAbsolute(dataHomeDir) ? path.join(dataHomeDir, RTK_DATA_FOLDER) : null;
|
|
16374
|
-
}
|
|
16375
|
-
function ensureDataDir(dataDir) {
|
|
16376
|
-
if (dataDir === null || ensuredDataDirs.has(dataDir)) return dataDir;
|
|
16377
|
-
fs.mkdirSync(dataDir, { recursive: true });
|
|
16378
|
-
ensuredDataDirs.add(dataDir);
|
|
16379
|
-
return dataDir;
|
|
16380
|
-
}
|
|
16381
|
-
function rtkHookTool(binPath, warn) {
|
|
16382
|
-
try {
|
|
16383
|
-
const dataDir = ensureDataDir(rtkDataDir());
|
|
16384
|
-
return dataDir === null ? {
|
|
16385
|
-
id: "rtk",
|
|
16386
|
-
binPath
|
|
16387
|
-
} : {
|
|
16388
|
-
id: "rtk",
|
|
16389
|
-
binPath,
|
|
16390
|
-
dataDir
|
|
16391
|
-
};
|
|
16392
|
-
} catch (error) {
|
|
16393
|
-
warnOnce("rtkDataDir", `[rtk] The rtk data folder could not be created: ${String(error)}. Guarded sessions will run rtk without savings tracking.`, warn);
|
|
16394
|
-
return {
|
|
16395
|
-
id: "rtk",
|
|
16396
|
-
binPath
|
|
16397
|
-
};
|
|
16398
|
-
}
|
|
16399
|
-
}
|
|
16400
16017
|
function warnOnce(toolId, message, warn) {
|
|
16401
16018
|
if (warnedTools.has(toolId)) return;
|
|
16402
16019
|
warnedTools.add(toolId);
|
|
@@ -16404,11 +16021,6 @@ function warnOnce(toolId, message, warn) {
|
|
|
16404
16021
|
}
|
|
16405
16022
|
function resolveHookTools(config, { skipPermissions, warn = console.warn }) {
|
|
16406
16023
|
const hookTools = [];
|
|
16407
|
-
if (config.rtk) {
|
|
16408
|
-
const rtkPath = getRtkPath();
|
|
16409
|
-
if (rtkPath) hookTools.push(rtkHookTool(rtkPath, warn));
|
|
16410
|
-
if (!rtkPath) warnOnce("rtk", "[rtk] config.rtk is true, but no rtk binary was found. Sessions will spawn without rtk hooks.", warn);
|
|
16411
|
-
}
|
|
16412
16024
|
if (config.saneYolo === false || !skipPermissions) return hookTools;
|
|
16413
16025
|
const binPath = resolvePackageBin("cc-safety-net", "cc-safety-net");
|
|
16414
16026
|
if (!binPath) {
|
|
@@ -16426,11 +16038,8 @@ function resolveHookTools(config, { skipPermissions, warn = console.warn }) {
|
|
|
16426
16038
|
}
|
|
16427
16039
|
return hookTools;
|
|
16428
16040
|
}
|
|
16429
|
-
function resolveRequiredSaneYoloHookTools(
|
|
16430
|
-
const hookTools = resolve({
|
|
16431
|
-
rtk: config.rtk,
|
|
16432
|
-
saneYolo: true
|
|
16433
|
-
}, { skipPermissions: true });
|
|
16041
|
+
function resolveRequiredSaneYoloHookTools({ resolve = resolveHookTools } = {}) {
|
|
16042
|
+
const hookTools = resolve({ saneYolo: true }, { skipPermissions: true });
|
|
16434
16043
|
return hookTools.some((tool) => tool.id === "saneYolo") ? hookTools : null;
|
|
16435
16044
|
}
|
|
16436
16045
|
//#endregion
|
|
@@ -16463,10 +16072,6 @@ function createSessionHookLifecycle(options) {
|
|
|
16463
16072
|
...isSaneYoloActive ? [saneYoloHomeDir()] : []
|
|
16464
16073
|
];
|
|
16465
16074
|
}
|
|
16466
|
-
function injectedWritablePaths(isSaneYoloActive) {
|
|
16467
|
-
if (token === null) return [];
|
|
16468
|
-
return injectedHookTools(isSaneYoloActive).flatMap((tool) => tool.dataDir === void 0 ? [] : [tool.dataDir]);
|
|
16469
|
-
}
|
|
16470
16075
|
function releaseGeneratedHome() {
|
|
16471
16076
|
if (!heldGeneratedHome) return;
|
|
16472
16077
|
heldGeneratedHome.injection.releaseHome(heldGeneratedHome.home);
|
|
@@ -16709,8 +16314,7 @@ function createSessionHookLifecycle(options) {
|
|
|
16709
16314
|
hasInjection: () => token !== null,
|
|
16710
16315
|
hasSettings: () => settingsHandle !== null,
|
|
16711
16316
|
isRequiredGuardrailsMissing: () => options.settingsGuardrails !== null && settingsHandle === null,
|
|
16712
|
-
injectedReadablePaths
|
|
16713
|
-
injectedWritablePaths
|
|
16317
|
+
injectedReadablePaths
|
|
16714
16318
|
};
|
|
16715
16319
|
}
|
|
16716
16320
|
//#endregion
|
|
@@ -19297,7 +18901,6 @@ var Session = class extends EventEmitter {
|
|
|
19297
18901
|
_spawnEnv;
|
|
19298
18902
|
_prependPathDirs;
|
|
19299
18903
|
_hookTools;
|
|
19300
|
-
_getHookTools;
|
|
19301
18904
|
_isSaneYoloActive;
|
|
19302
18905
|
_planLimits;
|
|
19303
18906
|
_planReviewPort;
|
|
@@ -19329,7 +18932,7 @@ var Session = class extends EventEmitter {
|
|
|
19329
18932
|
_resizeSeq;
|
|
19330
18933
|
_titleSource;
|
|
19331
18934
|
_statusSource;
|
|
19332
|
-
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, isMarkedUnguarded = false, isGuardrailsReleased = false, holdsQuestionsForParent = false, startCodexBridge = startCodexAppServerBridge, titleQuietFallbackMs = 3e4, spawnCommand = null, initialPrompt = null, extraClaudeArgs = [], ephemeral = false, resumeSessionId = null, taskTitleState = void 0, prLinks = void 0, settingsPermissions = null, settingsGuardrails = null, prepareGuardrails = null, getRemoteLaunch = null, spawnEnv = null, prependPathDirs = [], enableProjectMcp = false, hookTools = [],
|
|
18935
|
+
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, isMarkedUnguarded = false, isGuardrailsReleased = false, holdsQuestionsForParent = false, startCodexBridge = startCodexAppServerBridge, titleQuietFallbackMs = 3e4, spawnCommand = null, initialPrompt = null, extraClaudeArgs = [], ephemeral = false, resumeSessionId = null, taskTitleState = void 0, prLinks = void 0, settingsPermissions = null, settingsGuardrails = null, prepareGuardrails = null, getRemoteLaunch = null, spawnEnv = null, prependPathDirs = [], enableProjectMcp = false, hookTools = [], planReviewPort = null, planLimits = false, getUserHooks = null, extraUserHooks = [], prepareCoherence = null, ptySpawn = null, requireWorktree = false, screenKeeperFactory = null, killProc = null, signalProc = null, platform = process.platform, gitWorkspace = null, integrationBranch = null, autoRebase = true, syncOnStart = true, liveWorktreeReview = true, worktreeRoot = null, worktreeShare = null, workspaceRepos = void 0, agentDepth = 0, ownerId = null, commitSigningProgram = null }) {
|
|
19333
18936
|
super();
|
|
19334
18937
|
this.id = id;
|
|
19335
18938
|
this.ownerId = ownerId;
|
|
@@ -19447,7 +19050,6 @@ var Session = class extends EventEmitter {
|
|
|
19447
19050
|
this._spawnEnv = spawnEnv;
|
|
19448
19051
|
this._prependPathDirs = prependPathDirs;
|
|
19449
19052
|
this._hookTools = hookTools.filter((tool) => this._can(HOOK_TOOLS[tool.id].capability));
|
|
19450
|
-
this._getHookTools = getHookTools;
|
|
19451
19053
|
this._isSaneYoloActive = false;
|
|
19452
19054
|
this._planLimits = planLimits === true && this._can("statusLine");
|
|
19453
19055
|
this._planReviewPort = planReviewPort;
|
|
@@ -20348,10 +19950,6 @@ var Session = class extends EventEmitter {
|
|
|
20348
19950
|
this._output.reset();
|
|
20349
19951
|
this.emit("rebaseline");
|
|
20350
19952
|
this._resetDetectionSources({ quiet: false });
|
|
20351
|
-
if (this._getHookTools) {
|
|
20352
|
-
const currentHookTools = this._getHookTools().filter((tool) => this._can(HOOK_TOOLS[tool.id].capability));
|
|
20353
|
-
this._hookTools.splice(0, this._hookTools.length, ...currentHookTools);
|
|
20354
|
-
}
|
|
20355
19953
|
const remoteLaunch = this._getRemoteLaunch();
|
|
20356
19954
|
if (remoteLaunch !== null && this.agentId !== DEFAULT_AGENT_ID && this.agentId !== "codex") {
|
|
20357
19955
|
this._abandonSpawn(/* @__PURE__ */ new Error("A Coder workspace session runs Claude Code or Codex only"));
|
|
@@ -20381,9 +19979,7 @@ var Session = class extends EventEmitter {
|
|
|
20381
19979
|
...this._spawnEnv || {},
|
|
20382
19980
|
...injectedEnv
|
|
20383
19981
|
} : this._spawnEnv;
|
|
20384
|
-
const rtkTool = this._hookTools.find((tool) => tool.id === "rtk");
|
|
20385
19982
|
const env = this._buildSpawnEnv({
|
|
20386
|
-
prependPathDir: rtkTool ? path.dirname(rtkTool.binPath) : null,
|
|
20387
19983
|
prependPathDirs: this._prependPathDirs,
|
|
20388
19984
|
extraEnv: spawnExtraEnv
|
|
20389
19985
|
});
|
|
@@ -20782,7 +20378,7 @@ var Session = class extends EventEmitter {
|
|
|
20782
20378
|
cwd: this.effectiveCwd(),
|
|
20783
20379
|
hookPort: this._hooks.hasInjection() ? this._hooks.listenerPort() : null,
|
|
20784
20380
|
readablePaths: [...this._hooks.injectedReadablePaths(this._isSaneYoloActive), ...this._commitSigningProgram === null ? [] : [this._commitSigningProgram]],
|
|
20785
|
-
writablePaths:
|
|
20381
|
+
writablePaths: [],
|
|
20786
20382
|
agentSessionId
|
|
20787
20383
|
});
|
|
20788
20384
|
if (!prepared.ok) throw new Error(prepared.reason);
|
|
@@ -21302,7 +20898,7 @@ function toolDetailLine(toolName, toolInput) {
|
|
|
21302
20898
|
}
|
|
21303
20899
|
//#endregion
|
|
21304
20900
|
//#region server/ingest/core/ingest-agent-core.ts
|
|
21305
|
-
var SOURCE$
|
|
20901
|
+
var SOURCE$4 = "agentLogs";
|
|
21306
20902
|
var MAX_RAW_CHARS = 4e3;
|
|
21307
20903
|
var TOOL_TARGET_KEYS = Object.freeze([
|
|
21308
20904
|
"file_path",
|
|
@@ -21374,7 +20970,7 @@ function turnEvent({ ts, root, sessionId, vendor, text }) {
|
|
|
21374
20970
|
const summary = boundRaw(text).trim();
|
|
21375
20971
|
if (!summary) return null;
|
|
21376
20972
|
return {
|
|
21377
|
-
source: SOURCE$
|
|
20973
|
+
source: SOURCE$4,
|
|
21378
20974
|
kind: "agent-turn",
|
|
21379
20975
|
ts,
|
|
21380
20976
|
scope: {
|
|
@@ -21389,7 +20985,7 @@ function promptEvent({ ts, root, sessionId, vendor, text }) {
|
|
|
21389
20985
|
const prompt = boundRaw(text).trim();
|
|
21390
20986
|
if (!prompt) return null;
|
|
21391
20987
|
return {
|
|
21392
|
-
source: SOURCE$
|
|
20988
|
+
source: SOURCE$4,
|
|
21393
20989
|
kind: "agent-prompt",
|
|
21394
20990
|
ts,
|
|
21395
20991
|
scope: {
|
|
@@ -21404,7 +21000,7 @@ function toolEvent({ ts, root, sessionId, vendor, name, target }) {
|
|
|
21404
21000
|
const tool = boundRaw(textOr(name, null) || "tool");
|
|
21405
21001
|
const suffix = target ? ` ${target}` : "";
|
|
21406
21002
|
return {
|
|
21407
|
-
source: SOURCE$
|
|
21003
|
+
source: SOURCE$4,
|
|
21408
21004
|
kind: "agent-tool",
|
|
21409
21005
|
ts,
|
|
21410
21006
|
scope: {
|
|
@@ -22093,7 +21689,7 @@ function createLaneSpawn({ sessions = /* @__PURE__ */ new Map(), closeSessionDat
|
|
|
22093
21689
|
if (!isWrapped && (hasClaudeShell || isKimi)) throw new Error(`${laneName} lane needs the sandbox runtime, which does not run on ${platform}`);
|
|
22094
21690
|
const guardrailsRefusalReason = isWrapped ? guardrailsRefusal() : null;
|
|
22095
21691
|
if (guardrailsRefusalReason !== null) throw new Error(guardrailsRefusalReason);
|
|
22096
|
-
const guardHookTools = hasClaudeShell && hookRouter ? resolveRequiredSaneYoloHookTools(
|
|
21692
|
+
const guardHookTools = hasClaudeShell && hookRouter ? resolveRequiredSaneYoloHookTools() ?? [] : null;
|
|
22097
21693
|
if (guardHookTools && !guardHookTools.some((tool) => tool.id === "saneYolo")) throw new Error(GUARD_HOOK_UNAVAILABLE_ERROR);
|
|
22098
21694
|
await runLaneSession();
|
|
22099
21695
|
async function runLaneSession() {
|
|
@@ -22115,10 +21711,7 @@ function createLaneSpawn({ sessions = /* @__PURE__ */ new Map(), closeSessionDat
|
|
|
22115
21711
|
});
|
|
22116
21712
|
extraClaudeArgs.push(...promptLaunch.args);
|
|
22117
21713
|
const options = {
|
|
22118
|
-
...guardHookTools ? {
|
|
22119
|
-
hookTools: guardHookTools,
|
|
22120
|
-
getHookTools: null
|
|
22121
|
-
} : {},
|
|
21714
|
+
...guardHookTools ? { hookTools: guardHookTools } : {},
|
|
22122
21715
|
id,
|
|
22123
21716
|
name,
|
|
22124
21717
|
path: cwd,
|
|
@@ -32552,7 +32145,7 @@ function buildContextDigest(store, { scopes = null, budgetChars = DEFAULT_DIGEST
|
|
|
32552
32145
|
}
|
|
32553
32146
|
//#endregion
|
|
32554
32147
|
//#region server/ingest/core/ingest-fs-core.ts
|
|
32555
|
-
var SOURCE$
|
|
32148
|
+
var SOURCE$3 = "fs";
|
|
32556
32149
|
var KIND = "file-change";
|
|
32557
32150
|
var DEFAULT_BATCH_MS = SOURCE_DEFAULTS.fs.batchMs;
|
|
32558
32151
|
var MAX_FILES_PER_BATCH = SOURCE_DEFAULTS.fs.digestQuota;
|
|
@@ -32794,7 +32387,7 @@ function batchSize(batch) {
|
|
|
32794
32387
|
}
|
|
32795
32388
|
function fileChangeEvent({ root, relPath, change, now }) {
|
|
32796
32389
|
return {
|
|
32797
|
-
source: SOURCE$
|
|
32390
|
+
source: SOURCE$3,
|
|
32798
32391
|
kind: KIND,
|
|
32799
32392
|
ts: now,
|
|
32800
32393
|
scope: {
|
|
@@ -32849,7 +32442,7 @@ function decideFsEvents(batch, { root = null, now = 0 } = {}) {
|
|
|
32849
32442
|
}
|
|
32850
32443
|
const { summary, counts } = burstSummary(batch);
|
|
32851
32444
|
return [{
|
|
32852
|
-
source: SOURCE$
|
|
32445
|
+
source: SOURCE$3,
|
|
32853
32446
|
kind: KIND,
|
|
32854
32447
|
ts: now,
|
|
32855
32448
|
scope: {
|
|
@@ -34029,7 +33622,7 @@ function createFsIngest({ publish, sourceConfig = {}, configPath = null, logger
|
|
|
34029
33622
|
}
|
|
34030
33623
|
//#endregion
|
|
34031
33624
|
//#region server/ingest/core/ingest-git-core.ts
|
|
34032
|
-
var SOURCE$
|
|
33625
|
+
var SOURCE$2 = "git";
|
|
34033
33626
|
var DEFAULT_DEBOUNCE_MS = SOURCE_DEFAULTS.git.debounceMs;
|
|
34034
33627
|
var DEFAULT_POLL_MS$1 = SOURCE_DEFAULTS.git.pollMs;
|
|
34035
33628
|
var CLEAN_SIGNATURE = "clean";
|
|
@@ -34214,7 +33807,7 @@ function subjectSuffix(commit) {
|
|
|
34214
33807
|
function commitEvent({ status, commit, root = null, now = 0 }) {
|
|
34215
33808
|
const sha = shortSha(commit?.sha || status.oid) || null;
|
|
34216
33809
|
return {
|
|
34217
|
-
source: SOURCE$
|
|
33810
|
+
source: SOURCE$2,
|
|
34218
33811
|
kind: "commit",
|
|
34219
33812
|
ts: now,
|
|
34220
33813
|
scope: {
|
|
@@ -34234,7 +33827,7 @@ function branchChangeEvent({ status, commit, root = null, now = 0 }) {
|
|
|
34234
33827
|
const sha = shortSha(commit?.sha || status.oid) || null;
|
|
34235
33828
|
const at = sha ? ` at ${sha}` : "";
|
|
34236
33829
|
return {
|
|
34237
|
-
source: SOURCE$
|
|
33830
|
+
source: SOURCE$2,
|
|
34238
33831
|
kind: "branch-change",
|
|
34239
33832
|
ts: now,
|
|
34240
33833
|
scope: {
|
|
@@ -34257,7 +33850,7 @@ function statusChangeEvent({ status, root = null, now = 0 }) {
|
|
|
34257
33850
|
if (counts.untracked) parts.push(`${counts.untracked} untracked`);
|
|
34258
33851
|
if (counts.conflicted) parts.push(`${counts.conflicted} conflicted`);
|
|
34259
33852
|
return {
|
|
34260
|
-
source: SOURCE$
|
|
33853
|
+
source: SOURCE$2,
|
|
34261
33854
|
kind: "status-change",
|
|
34262
33855
|
ts: now,
|
|
34263
33856
|
scope: {
|
|
@@ -34711,6 +34304,354 @@ function createGitIngest({ publish, sourceConfig = {}, reposProvider = null, log
|
|
|
34711
34304
|
};
|
|
34712
34305
|
}
|
|
34713
34306
|
//#endregion
|
|
34307
|
+
//#region server/ingest/core/ingest-shell-core.ts
|
|
34308
|
+
var SOURCE$1 = "shellHistory";
|
|
34309
|
+
var SHELLS = Object.freeze([
|
|
34310
|
+
"powershell",
|
|
34311
|
+
"fish",
|
|
34312
|
+
"bash",
|
|
34313
|
+
"zsh"
|
|
34314
|
+
]);
|
|
34315
|
+
var ZERO_SETUP_SHELLS = Object.freeze(["powershell", "fish"]);
|
|
34316
|
+
var ZERO_SETUP_SHELLS_ON_MACOS = Object.freeze(["zsh", "fish"]);
|
|
34317
|
+
var PSREADLINE_SUFFIX = "_history.txt";
|
|
34318
|
+
var MAX_COMMAND_CHARS = 4e3;
|
|
34319
|
+
var MAX_CONTINUATION_LINES = 64;
|
|
34320
|
+
var TRIVIAL_COMMANDS = /* @__PURE__ */ new Set([
|
|
34321
|
+
"",
|
|
34322
|
+
"l",
|
|
34323
|
+
"ls",
|
|
34324
|
+
"ll",
|
|
34325
|
+
"la",
|
|
34326
|
+
"dir",
|
|
34327
|
+
"cd",
|
|
34328
|
+
"cd ..",
|
|
34329
|
+
"cd -",
|
|
34330
|
+
"cd ~",
|
|
34331
|
+
"cd /",
|
|
34332
|
+
"pwd",
|
|
34333
|
+
"cls",
|
|
34334
|
+
"clear",
|
|
34335
|
+
"exit",
|
|
34336
|
+
"q",
|
|
34337
|
+
"history"
|
|
34338
|
+
]);
|
|
34339
|
+
function defaultShellsFor(platform) {
|
|
34340
|
+
return platform === "darwin" ? ZERO_SETUP_SHELLS_ON_MACOS : ZERO_SETUP_SHELLS;
|
|
34341
|
+
}
|
|
34342
|
+
function normalizeShells(raw, platform) {
|
|
34343
|
+
if (!Array.isArray(raw) || raw.length === 0) return {
|
|
34344
|
+
shells: [...defaultShellsFor(platform)],
|
|
34345
|
+
rejected: []
|
|
34346
|
+
};
|
|
34347
|
+
const shells = [];
|
|
34348
|
+
const rejected = [];
|
|
34349
|
+
for (const entry of raw) {
|
|
34350
|
+
const name = typeof entry === "string" ? entry.trim().toLowerCase() : "";
|
|
34351
|
+
const shell = name === "pwsh" || name === "powershell.exe" ? "powershell" : name;
|
|
34352
|
+
if (SHELLS.includes(shell)) {
|
|
34353
|
+
if (!shells.includes(shell)) shells.push(shell);
|
|
34354
|
+
continue;
|
|
34355
|
+
}
|
|
34356
|
+
const label = typeof entry === "string" ? entry.trim() : String(entry);
|
|
34357
|
+
if (rejected.includes(label)) continue;
|
|
34358
|
+
rejected.push(label);
|
|
34359
|
+
}
|
|
34360
|
+
return {
|
|
34361
|
+
shells,
|
|
34362
|
+
rejected
|
|
34363
|
+
};
|
|
34364
|
+
}
|
|
34365
|
+
function resolveHomeDir(env, homeDir) {
|
|
34366
|
+
return rawTextOr(env?.HOME, null) || rawTextOr(env?.USERPROFILE, null) || homeDir;
|
|
34367
|
+
}
|
|
34368
|
+
function dataHome(env, homeDir) {
|
|
34369
|
+
return rawTextOr(env?.XDG_DATA_HOME, null) || path.join(resolveHomeDir(env, homeDir), ".local", "share");
|
|
34370
|
+
}
|
|
34371
|
+
function configHome(env, homeDir) {
|
|
34372
|
+
return rawTextOr(env?.XDG_CONFIG_HOME, null) || path.join(resolveHomeDir(env, homeDir), ".config");
|
|
34373
|
+
}
|
|
34374
|
+
function powershellLocations(env, platform, homeDir) {
|
|
34375
|
+
if (platform === "win32") {
|
|
34376
|
+
const appData = rawTextOr(env?.APPDATA, null) || path.join(resolveHomeDir(env, homeDir), "AppData", "Roaming");
|
|
34377
|
+
return [{
|
|
34378
|
+
shell: "powershell",
|
|
34379
|
+
dir: path.join(appData, "Microsoft", "Windows", "PowerShell", "PSReadLine"),
|
|
34380
|
+
suffix: PSREADLINE_SUFFIX,
|
|
34381
|
+
name: null
|
|
34382
|
+
}];
|
|
34383
|
+
}
|
|
34384
|
+
return [{
|
|
34385
|
+
shell: "powershell",
|
|
34386
|
+
dir: path.join(dataHome(env, homeDir), "powershell", "PSReadLine"),
|
|
34387
|
+
suffix: PSREADLINE_SUFFIX,
|
|
34388
|
+
name: null
|
|
34389
|
+
}];
|
|
34390
|
+
}
|
|
34391
|
+
function fishLocations(env, homeDir) {
|
|
34392
|
+
return [{
|
|
34393
|
+
shell: "fish",
|
|
34394
|
+
dir: path.join(dataHome(env, homeDir), "fish"),
|
|
34395
|
+
suffix: null,
|
|
34396
|
+
name: "fish_history"
|
|
34397
|
+
}, {
|
|
34398
|
+
shell: "fish",
|
|
34399
|
+
dir: path.join(configHome(env, homeDir), "fish"),
|
|
34400
|
+
suffix: null,
|
|
34401
|
+
name: "fish_history"
|
|
34402
|
+
}];
|
|
34403
|
+
}
|
|
34404
|
+
function fileLocation(shell, filePath) {
|
|
34405
|
+
return {
|
|
34406
|
+
shell,
|
|
34407
|
+
dir: path.dirname(filePath),
|
|
34408
|
+
suffix: null,
|
|
34409
|
+
name: path.basename(filePath)
|
|
34410
|
+
};
|
|
34411
|
+
}
|
|
34412
|
+
function histFileLocation(wanted, env) {
|
|
34413
|
+
const posixShells = wanted.filter((shell) => shell === "bash" || shell === "zsh");
|
|
34414
|
+
if (posixShells.length !== 1) return [];
|
|
34415
|
+
const histFile = rawTextOr(env?.HISTFILE, null);
|
|
34416
|
+
if (!histFile) return [];
|
|
34417
|
+
return [fileLocation(posixShells[0], histFile)];
|
|
34418
|
+
}
|
|
34419
|
+
function defaultHistFiles(shell, env, homeDir) {
|
|
34420
|
+
const home = resolveHomeDir(env, homeDir);
|
|
34421
|
+
if (shell === "bash") return [fileLocation("bash", path.join(home, ".bash_history"))];
|
|
34422
|
+
return [fileLocation("zsh", path.join(home, ".zsh_history")), fileLocation("zsh", path.join(home, ".histfile"))];
|
|
34423
|
+
}
|
|
34424
|
+
function locationKey(location) {
|
|
34425
|
+
return `${path.resolve(location.dir)}|${location.name || location.suffix}`;
|
|
34426
|
+
}
|
|
34427
|
+
function historyLocations({ shells = null, env = {}, platform = process.platform, homeDir = null } = {}) {
|
|
34428
|
+
const wanted = normalizeShells(shells, platform).shells;
|
|
34429
|
+
const locations = [...histFileLocation(wanted, env)];
|
|
34430
|
+
for (const shell of wanted) {
|
|
34431
|
+
if (shell === "powershell") locations.push(...powershellLocations(env, platform, homeDir));
|
|
34432
|
+
if (shell === "fish") locations.push(...fishLocations(env, homeDir));
|
|
34433
|
+
if (shell === "bash" || shell === "zsh") locations.push(...defaultHistFiles(shell, env, homeDir));
|
|
34434
|
+
}
|
|
34435
|
+
const seen = /* @__PURE__ */ new Set();
|
|
34436
|
+
const deduped = [];
|
|
34437
|
+
for (const location of locations) {
|
|
34438
|
+
const key = locationKey(location);
|
|
34439
|
+
if (seen.has(key)) continue;
|
|
34440
|
+
seen.add(key);
|
|
34441
|
+
deduped.push(location);
|
|
34442
|
+
}
|
|
34443
|
+
return deduped;
|
|
34444
|
+
}
|
|
34445
|
+
function matchesLocation(location, filename) {
|
|
34446
|
+
if (typeof filename !== "string" || !filename) return false;
|
|
34447
|
+
if (location?.name) return filename === location.name;
|
|
34448
|
+
const suffix = location?.suffix;
|
|
34449
|
+
if (!suffix) return false;
|
|
34450
|
+
if (filename.length <= suffix.length) return false;
|
|
34451
|
+
return filename.toLowerCase().endsWith(suffix.toLowerCase());
|
|
34452
|
+
}
|
|
34453
|
+
function createParseState() {
|
|
34454
|
+
return {
|
|
34455
|
+
pending: [],
|
|
34456
|
+
pendingTs: null,
|
|
34457
|
+
entry: null
|
|
34458
|
+
};
|
|
34459
|
+
}
|
|
34460
|
+
function withinContinuationBounds(pending) {
|
|
34461
|
+
if (pending.length >= MAX_CONTINUATION_LINES) return false;
|
|
34462
|
+
let chars = 0;
|
|
34463
|
+
for (const line of pending) chars += line.length + 1;
|
|
34464
|
+
return chars < MAX_COMMAND_CHARS;
|
|
34465
|
+
}
|
|
34466
|
+
function parsePowershell(lines, state) {
|
|
34467
|
+
const commands = [];
|
|
34468
|
+
let pending = state.pending;
|
|
34469
|
+
for (const line of lines) {
|
|
34470
|
+
const continued = line.endsWith("`");
|
|
34471
|
+
pending = [...pending, continued ? line.slice(0, -1) : line];
|
|
34472
|
+
if (continued && withinContinuationBounds(pending)) continue;
|
|
34473
|
+
commands.push({
|
|
34474
|
+
text: pending.join("\n"),
|
|
34475
|
+
ts: null
|
|
34476
|
+
});
|
|
34477
|
+
pending = [];
|
|
34478
|
+
}
|
|
34479
|
+
return {
|
|
34480
|
+
commands,
|
|
34481
|
+
state: {
|
|
34482
|
+
...state,
|
|
34483
|
+
pending
|
|
34484
|
+
}
|
|
34485
|
+
};
|
|
34486
|
+
}
|
|
34487
|
+
var FISH_ENTRY = /^- cmd:\s?([\s\S]*)$/;
|
|
34488
|
+
var FISH_WHEN = /^\s+when:\s*(\d+)/;
|
|
34489
|
+
function unescapeFish(text) {
|
|
34490
|
+
let out = "";
|
|
34491
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
34492
|
+
const char = text[index];
|
|
34493
|
+
if (char !== "\\") {
|
|
34494
|
+
out += char;
|
|
34495
|
+
continue;
|
|
34496
|
+
}
|
|
34497
|
+
const next = text[index + 1];
|
|
34498
|
+
if (next === "n") {
|
|
34499
|
+
out += "\n";
|
|
34500
|
+
index += 1;
|
|
34501
|
+
continue;
|
|
34502
|
+
}
|
|
34503
|
+
if (next === "\\") {
|
|
34504
|
+
out += "\\";
|
|
34505
|
+
index += 1;
|
|
34506
|
+
continue;
|
|
34507
|
+
}
|
|
34508
|
+
out += char;
|
|
34509
|
+
}
|
|
34510
|
+
return out;
|
|
34511
|
+
}
|
|
34512
|
+
function parseFish(lines, state) {
|
|
34513
|
+
const commands = [];
|
|
34514
|
+
let entry = state.entry;
|
|
34515
|
+
for (const line of lines) {
|
|
34516
|
+
const started = FISH_ENTRY.exec(line);
|
|
34517
|
+
if (started) {
|
|
34518
|
+
if (entry) commands.push(entry);
|
|
34519
|
+
entry = {
|
|
34520
|
+
text: unescapeFish(started[1]),
|
|
34521
|
+
ts: null
|
|
34522
|
+
};
|
|
34523
|
+
continue;
|
|
34524
|
+
}
|
|
34525
|
+
if (!entry) continue;
|
|
34526
|
+
const when = FISH_WHEN.exec(line);
|
|
34527
|
+
if (!when) continue;
|
|
34528
|
+
commands.push({
|
|
34529
|
+
text: entry.text,
|
|
34530
|
+
ts: Number(when[1]) * 1e3
|
|
34531
|
+
});
|
|
34532
|
+
entry = null;
|
|
34533
|
+
}
|
|
34534
|
+
return {
|
|
34535
|
+
commands,
|
|
34536
|
+
state: {
|
|
34537
|
+
...state,
|
|
34538
|
+
entry
|
|
34539
|
+
}
|
|
34540
|
+
};
|
|
34541
|
+
}
|
|
34542
|
+
var BASH_TIMESTAMP = /^#(\d{9,})\s*$/;
|
|
34543
|
+
function parseBash(lines, state) {
|
|
34544
|
+
const commands = [];
|
|
34545
|
+
let pendingTs = state.pendingTs;
|
|
34546
|
+
for (const line of lines) {
|
|
34547
|
+
const stamped = BASH_TIMESTAMP.exec(line);
|
|
34548
|
+
if (stamped) {
|
|
34549
|
+
pendingTs = Number(stamped[1]) * 1e3;
|
|
34550
|
+
continue;
|
|
34551
|
+
}
|
|
34552
|
+
if (!line.trim()) continue;
|
|
34553
|
+
commands.push({
|
|
34554
|
+
text: line,
|
|
34555
|
+
ts: pendingTs
|
|
34556
|
+
});
|
|
34557
|
+
pendingTs = null;
|
|
34558
|
+
}
|
|
34559
|
+
return {
|
|
34560
|
+
commands,
|
|
34561
|
+
state: {
|
|
34562
|
+
...state,
|
|
34563
|
+
pendingTs
|
|
34564
|
+
}
|
|
34565
|
+
};
|
|
34566
|
+
}
|
|
34567
|
+
var ZSH_EXTENDED = /^:\s(\d+):(\d+);([\s\S]*)$/;
|
|
34568
|
+
function parseZsh(lines, state) {
|
|
34569
|
+
const commands = [];
|
|
34570
|
+
let pending = state.pending;
|
|
34571
|
+
let pendingTs = state.pendingTs;
|
|
34572
|
+
for (const line of lines) {
|
|
34573
|
+
const starting = pending.length === 0;
|
|
34574
|
+
const extended = starting ? ZSH_EXTENDED.exec(line) : null;
|
|
34575
|
+
if (starting) pendingTs = extended ? Number(extended[1]) * 1e3 : null;
|
|
34576
|
+
const text = extended ? extended[3] : line;
|
|
34577
|
+
const continued = text.endsWith("\\");
|
|
34578
|
+
pending = [...pending, continued ? text.slice(0, -1) : text];
|
|
34579
|
+
if (continued && withinContinuationBounds(pending)) continue;
|
|
34580
|
+
const joined = pending.join("\n");
|
|
34581
|
+
pending = [];
|
|
34582
|
+
if (joined.trim()) commands.push({
|
|
34583
|
+
text: joined,
|
|
34584
|
+
ts: pendingTs
|
|
34585
|
+
});
|
|
34586
|
+
pendingTs = null;
|
|
34587
|
+
}
|
|
34588
|
+
return {
|
|
34589
|
+
commands,
|
|
34590
|
+
state: {
|
|
34591
|
+
...state,
|
|
34592
|
+
pending,
|
|
34593
|
+
pendingTs
|
|
34594
|
+
}
|
|
34595
|
+
};
|
|
34596
|
+
}
|
|
34597
|
+
var PARSERS = Object.freeze({
|
|
34598
|
+
powershell: parsePowershell,
|
|
34599
|
+
fish: parseFish,
|
|
34600
|
+
bash: parseBash,
|
|
34601
|
+
zsh: parseZsh
|
|
34602
|
+
});
|
|
34603
|
+
function parseHistoryLines({ shell, lines = [], state = null } = {}) {
|
|
34604
|
+
const current = state || createParseState();
|
|
34605
|
+
const parser = shell ? PARSERS[shell] : void 0;
|
|
34606
|
+
if (!parser || !Array.isArray(lines) || lines.length === 0) return {
|
|
34607
|
+
commands: [],
|
|
34608
|
+
state: current
|
|
34609
|
+
};
|
|
34610
|
+
return parser(lines, current);
|
|
34611
|
+
}
|
|
34612
|
+
function foldForCompare(text) {
|
|
34613
|
+
return String(text == null ? "" : text).replace(/\s+/g, " ").trim();
|
|
34614
|
+
}
|
|
34615
|
+
function isTrivialCommand(text) {
|
|
34616
|
+
if (typeof text !== "string") return true;
|
|
34617
|
+
return TRIVIAL_COMMANDS.has(text.trim().toLowerCase());
|
|
34618
|
+
}
|
|
34619
|
+
function decideCommandEvent({ shell = "", command = null, previous = null, now = 0 } = {}) {
|
|
34620
|
+
const text = typeof command?.text === "string" ? command.text : "";
|
|
34621
|
+
const compared = foldForCompare(text);
|
|
34622
|
+
if (!compared) return {
|
|
34623
|
+
event: null,
|
|
34624
|
+
previous
|
|
34625
|
+
};
|
|
34626
|
+
if (isTrivialCommand(compared)) return {
|
|
34627
|
+
event: null,
|
|
34628
|
+
previous: compared
|
|
34629
|
+
};
|
|
34630
|
+
if (compared === previous) return {
|
|
34631
|
+
event: null,
|
|
34632
|
+
previous: compared
|
|
34633
|
+
};
|
|
34634
|
+
const stamped = Number(command?.ts);
|
|
34635
|
+
const lineCount = text.split("\n").length;
|
|
34636
|
+
return {
|
|
34637
|
+
event: {
|
|
34638
|
+
source: SOURCE$1,
|
|
34639
|
+
kind: "command",
|
|
34640
|
+
ts: Number.isFinite(stamped) && stamped > 0 ? Math.floor(stamped) : now,
|
|
34641
|
+
scope: {
|
|
34642
|
+
root: null,
|
|
34643
|
+
sessionId: null
|
|
34644
|
+
},
|
|
34645
|
+
summary: `${shell}: ${text}`,
|
|
34646
|
+
detail: lineCount > 1 ? {
|
|
34647
|
+
shell,
|
|
34648
|
+
lines: lineCount
|
|
34649
|
+
} : { shell }
|
|
34650
|
+
},
|
|
34651
|
+
previous: compared
|
|
34652
|
+
};
|
|
34653
|
+
}
|
|
34654
|
+
//#endregion
|
|
34714
34655
|
//#region server/ingest/ingest-shell-history.ts
|
|
34715
34656
|
var DEFAULT_POLL_MS = 2e3;
|
|
34716
34657
|
var DEFAULT_DISCOVER_MS = 3e4;
|
|
@@ -50317,14 +50258,6 @@ async function resolveCoherence({ worktree, host, isSettingOn, confine = null, c
|
|
|
50317
50258
|
};
|
|
50318
50259
|
}
|
|
50319
50260
|
//#endregion
|
|
50320
|
-
//#region session/core/rtk-settings-core.ts
|
|
50321
|
-
function refreshRtkHookTools(originalTools, currentTools) {
|
|
50322
|
-
const currentRtkTool = currentTools.find((tool) => tool.id === "rtk");
|
|
50323
|
-
if (!currentRtkTool) return originalTools.filter((tool) => tool.id !== "rtk");
|
|
50324
|
-
if (!originalTools.some((tool) => tool.id === "rtk")) return [currentRtkTool, ...originalTools];
|
|
50325
|
-
return originalTools.map((tool) => tool.id === "rtk" ? currentRtkTool : tool);
|
|
50326
|
-
}
|
|
50327
|
-
//#endregion
|
|
50328
50261
|
//#region session/core/hook-payload-projection.ts
|
|
50329
50262
|
var DROPPED_PAYLOAD_FIELDS = /* @__PURE__ */ new Set(["last_assistant_message", "lastAssistantMessage"]);
|
|
50330
50263
|
var REDUCED_TASK_LIST_FIELDS = ["background_tasks", "backgroundTasks"];
|
|
@@ -50768,7 +50701,6 @@ function createSessionFactory(dependencies) {
|
|
|
50768
50701
|
detectBackgroundAgents: config.detectBackgroundAgents,
|
|
50769
50702
|
detectScheduledWakeups: config.detectScheduledWakeups,
|
|
50770
50703
|
hookTools: originalHookTools,
|
|
50771
|
-
getHookTools: () => refreshRtkHookTools(originalHookTools, dependencies.resolveHookTools(hookToolConfig(dependencies.getConfig?.() ?? config), { skipPermissions })),
|
|
50772
50704
|
resumeSessionId: project.resumeSessionId || null,
|
|
50773
50705
|
planReviewPort: dependencies.getPlanReviewPort(),
|
|
50774
50706
|
planLimits: planLimitsEnabled(config),
|
|
@@ -51193,13 +51125,11 @@ function summarizeCustomAgents(declarations) {
|
|
|
51193
51125
|
resolvable: cachedAgentResolvability(declaration.id).resolvable
|
|
51194
51126
|
}));
|
|
51195
51127
|
}
|
|
51196
|
-
function buildSettingsPayload({ configStore,
|
|
51128
|
+
function buildSettingsPayload({ configStore, telegramDelivery = null, coderEnvironments = null, agentLogins = null, readTeamReviewEnvironment = currentTeamReviewEnvironment }) {
|
|
51197
51129
|
return {
|
|
51198
51130
|
...configStore.getSettings(),
|
|
51199
51131
|
isExperimentalBuild: configStore.isExperimentalBuild === true,
|
|
51200
|
-
rtkAvailable: !!resolveRtk(),
|
|
51201
51132
|
saneYoloAvailable: !!resolvePackageBin("cc-safety-net", "cc-safety-net"),
|
|
51202
|
-
rtkInstall: rtkInstallStatus || { status: "idle" },
|
|
51203
51133
|
customAgents: summarizeCustomAgents(configStore.config.customAgents ?? []),
|
|
51204
51134
|
telegramDelivery,
|
|
51205
51135
|
coderEnvironments,
|
|
@@ -52811,7 +52741,7 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
52811
52741
|
issue: null,
|
|
52812
52742
|
error: "Issues polling is not running."
|
|
52813
52743
|
}
|
|
52814
|
-
}), issueProjectRepos = null, serverBuild = () => null, getUsageSessions = null, getUsageReport = null, requestUsageReport = null, getPlanLimits = null, controlReplayLog = null,
|
|
52744
|
+
}), issueProjectRepos = null, serverBuild = () => null, getUsageSessions = null, getUsageReport = null, requestUsageReport = null, getPlanLimits = null, controlReplayLog = null, telegramDelivery = null, conversationFs = fs, conversationGit = runGitForConversationHistory, conversationProjectsDir = claudeProjectsDir(process.env, os.homedir()), readTracePage = null, readPlanRevision = null, decidePlanReview = null, sessionDocs = null, coherenceFeed = null, coderEnv = null, remoteRepoGit = null, agentConnect = null, remoteSetup = null } = deps;
|
|
52815
52745
|
const changeMaps = createChangeMapService({ sessions });
|
|
52816
52746
|
const changesWatch = createChangesWatch({
|
|
52817
52747
|
findSession: (id) => sessions.get(id) ?? agentSessions.get(id) ?? null,
|
|
@@ -52820,7 +52750,6 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
52820
52750
|
function buildSettingsPayload$1() {
|
|
52821
52751
|
return buildSettingsPayload({
|
|
52822
52752
|
configStore,
|
|
52823
|
-
rtkInstallStatus: getRtkInstallStatus(),
|
|
52824
52753
|
telegramDelivery: telegramDelivery?.status() ?? null,
|
|
52825
52754
|
coderEnvironments: coderEnv?.availableEnvironments() ?? null,
|
|
52826
52755
|
agentLogins: agentConnect?.logins() ?? null
|
|
@@ -54259,11 +54188,6 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
54259
54188
|
}
|
|
54260
54189
|
function builtinHooksReport() {
|
|
54261
54190
|
const hookTools = [];
|
|
54262
|
-
const rtkPath = config.rtk ? resolveRtkPath() : null;
|
|
54263
|
-
if (rtkPath) hookTools.push({
|
|
54264
|
-
id: "rtk",
|
|
54265
|
-
binPath: rtkPath
|
|
54266
|
-
});
|
|
54267
54191
|
const saneYoloPath = config.saneYolo !== false ? resolvePackageBin("cc-safety-net", "cc-safety-net") : null;
|
|
54268
54192
|
if (saneYoloPath) hookTools.push({
|
|
54269
54193
|
id: "saneYolo",
|
|
@@ -54907,7 +54831,6 @@ function createBackendControl(dependencies) {
|
|
|
54907
54831
|
configStore,
|
|
54908
54832
|
broadcastControl,
|
|
54909
54833
|
controlReplayLog,
|
|
54910
|
-
getRtkInstallStatus: dependencies.getRtkInstallStatus,
|
|
54911
54834
|
telegramDelivery: dependencies.telegramDelivery,
|
|
54912
54835
|
generateProjectId: dependencies.generateProjectId,
|
|
54913
54836
|
makeSession: dependencies.makeSession,
|
|
@@ -55896,245 +55819,6 @@ var HookRouter = class {
|
|
|
55896
55819
|
}
|
|
55897
55820
|
};
|
|
55898
55821
|
//#endregion
|
|
55899
|
-
//#region server/rtk-installer.ts
|
|
55900
|
-
var DOWNLOAD_TIMEOUT_MS = 6e4;
|
|
55901
|
-
var MAX_DOWNLOAD_BYTES = 52428800;
|
|
55902
|
-
async function downloadCapped(url, { fetchImpl, timeoutMs = DOWNLOAD_TIMEOUT_MS }) {
|
|
55903
|
-
const abort = new AbortController();
|
|
55904
|
-
const timer = setTimeout(() => abort.abort(), timeoutMs);
|
|
55905
|
-
try {
|
|
55906
|
-
const response = await fetchImpl(url, {
|
|
55907
|
-
signal: abort.signal,
|
|
55908
|
-
redirect: "follow"
|
|
55909
|
-
});
|
|
55910
|
-
if (!response.ok) return {
|
|
55911
|
-
ok: false,
|
|
55912
|
-
reason: `download failed: HTTP ${response.status}`
|
|
55913
|
-
};
|
|
55914
|
-
const declared = Number(response.headers?.get?.("content-length"));
|
|
55915
|
-
if (Number.isFinite(declared) && declared > MAX_DOWNLOAD_BYTES) return {
|
|
55916
|
-
ok: false,
|
|
55917
|
-
reason: `download failed: asset is ${declared} bytes, over the ${MAX_DOWNLOAD_BYTES} byte cap`
|
|
55918
|
-
};
|
|
55919
|
-
if (!response.body) return {
|
|
55920
|
-
ok: false,
|
|
55921
|
-
reason: "download failed: response had no body"
|
|
55922
|
-
};
|
|
55923
|
-
const chunks = [];
|
|
55924
|
-
let total = 0;
|
|
55925
|
-
for await (const chunk of response.body) {
|
|
55926
|
-
const buf = Buffer.from(chunk);
|
|
55927
|
-
total += buf.length;
|
|
55928
|
-
if (total > MAX_DOWNLOAD_BYTES) return {
|
|
55929
|
-
ok: false,
|
|
55930
|
-
reason: `download failed: asset exceeded the ${MAX_DOWNLOAD_BYTES} byte cap`
|
|
55931
|
-
};
|
|
55932
|
-
chunks.push(buf);
|
|
55933
|
-
}
|
|
55934
|
-
return {
|
|
55935
|
-
ok: true,
|
|
55936
|
-
bytes: Buffer.concat(chunks, total)
|
|
55937
|
-
};
|
|
55938
|
-
} catch (err) {
|
|
55939
|
-
return {
|
|
55940
|
-
ok: false,
|
|
55941
|
-
reason: `download failed: ${err?.name === "AbortError" ? `timed out after ${timeoutMs}ms` : errorText$1(err)}`
|
|
55942
|
-
};
|
|
55943
|
-
} finally {
|
|
55944
|
-
clearTimeout(timer);
|
|
55945
|
-
}
|
|
55946
|
-
}
|
|
55947
|
-
async function findBinary(dir, platform) {
|
|
55948
|
-
const entries = await fs$1.readdir(dir, { withFileTypes: true });
|
|
55949
|
-
const nested = [];
|
|
55950
|
-
for (const entry of entries) {
|
|
55951
|
-
const full = path.join(dir, entry.name);
|
|
55952
|
-
if (entry.isDirectory()) {
|
|
55953
|
-
nested.push(full);
|
|
55954
|
-
continue;
|
|
55955
|
-
}
|
|
55956
|
-
if (entry.isFile() && isRtkBinaryName(entry.name, platform)) return full;
|
|
55957
|
-
}
|
|
55958
|
-
for (const child of nested) {
|
|
55959
|
-
const found = await findBinary(child, platform);
|
|
55960
|
-
if (found) return found;
|
|
55961
|
-
}
|
|
55962
|
-
return null;
|
|
55963
|
-
}
|
|
55964
|
-
async function removeQuietly(target) {
|
|
55965
|
-
try {
|
|
55966
|
-
await fs$1.rm(target, {
|
|
55967
|
-
recursive: true,
|
|
55968
|
-
force: true
|
|
55969
|
-
});
|
|
55970
|
-
} catch {}
|
|
55971
|
-
}
|
|
55972
|
-
async function moveIntoPlace(source, target, renameImpl = fs$1.rename) {
|
|
55973
|
-
try {
|
|
55974
|
-
await renameImpl(source, target);
|
|
55975
|
-
return;
|
|
55976
|
-
} catch (err) {
|
|
55977
|
-
if (errorCode(err) !== "EXDEV") throw err;
|
|
55978
|
-
}
|
|
55979
|
-
const partial = `${target}.partial`;
|
|
55980
|
-
try {
|
|
55981
|
-
await fs$1.copyFile(source, partial);
|
|
55982
|
-
await renameImpl(partial, target);
|
|
55983
|
-
} catch (err) {
|
|
55984
|
-
await removeQuietly(partial);
|
|
55985
|
-
throw err;
|
|
55986
|
-
}
|
|
55987
|
-
await fs$1.unlink(source);
|
|
55988
|
-
}
|
|
55989
|
-
async function installRtk({ homeDir = os.homedir(), glimmervoidHome = glimmervoidHomeDir(homeDir, process.env), platform = process.platform, arch = process.arch, fetchImpl = globalThis.fetch, execFileImpl = execFileAsync, renameImpl = fs$1.rename, timeoutMs = DOWNLOAD_TIMEOUT_MS, log = console, asset = assetForPlatform(platform, arch) } = {}) {
|
|
55990
|
-
if (!asset) return {
|
|
55991
|
-
ok: false,
|
|
55992
|
-
reason: `unsupported platform ${platform}-${arch}`
|
|
55993
|
-
};
|
|
55994
|
-
if (typeof fetchImpl !== "function") return {
|
|
55995
|
-
ok: false,
|
|
55996
|
-
reason: "no fetch implementation available"
|
|
55997
|
-
};
|
|
55998
|
-
const stagingDir = path.join(glimmervoidHome, "tmp", `rtk-${crypto.randomBytes(6).toString("hex")}`);
|
|
55999
|
-
try {
|
|
56000
|
-
await fs$1.mkdir(stagingDir, { recursive: true });
|
|
56001
|
-
} catch (err) {
|
|
56002
|
-
return {
|
|
56003
|
-
ok: false,
|
|
56004
|
-
reason: `could not create staging dir: ${errorText$1(err)}`
|
|
56005
|
-
};
|
|
56006
|
-
}
|
|
56007
|
-
try {
|
|
56008
|
-
log?.log?.(`[rtk] installing rtk ${asset.version} from ${asset.url}`);
|
|
56009
|
-
const downloaded = await downloadCapped(asset.url, {
|
|
56010
|
-
fetchImpl,
|
|
56011
|
-
timeoutMs
|
|
56012
|
-
});
|
|
56013
|
-
if (!downloaded.ok) return {
|
|
56014
|
-
ok: false,
|
|
56015
|
-
reason: downloaded.reason
|
|
56016
|
-
};
|
|
56017
|
-
const actualHex = crypto.createHash("sha256").update(downloaded.bytes).digest("hex");
|
|
56018
|
-
if (!verifyDigest(asset.sha256, actualHex)) return {
|
|
56019
|
-
ok: false,
|
|
56020
|
-
reason: `sha256 mismatch for ${asset.file}: expected ${asset.sha256}, got ${actualHex}`
|
|
56021
|
-
};
|
|
56022
|
-
const archivePath = path.join(stagingDir, asset.file);
|
|
56023
|
-
await fs$1.writeFile(archivePath, downloaded.bytes);
|
|
56024
|
-
const extractDir = path.join(stagingDir, "extract");
|
|
56025
|
-
await fs$1.mkdir(extractDir, { recursive: true });
|
|
56026
|
-
try {
|
|
56027
|
-
const listing = await execFileImpl("tar", ["-tf", archivePath]);
|
|
56028
|
-
const escaping = findEscapingArchiveMember(listing.stdout);
|
|
56029
|
-
if (escaping) return {
|
|
56030
|
-
ok: false,
|
|
56031
|
-
reason: `extract refused: archive member escapes the staging dir: ${escaping}`
|
|
56032
|
-
};
|
|
56033
|
-
await execFileImpl("tar", [
|
|
56034
|
-
"-xf",
|
|
56035
|
-
archivePath,
|
|
56036
|
-
"-C",
|
|
56037
|
-
extractDir
|
|
56038
|
-
]);
|
|
56039
|
-
} catch (err) {
|
|
56040
|
-
return {
|
|
56041
|
-
ok: false,
|
|
56042
|
-
reason: `extract failed: ${errorCode(err) === "ENOENT" ? "tar was not found on PATH" : errorText$1(err)}`
|
|
56043
|
-
};
|
|
56044
|
-
}
|
|
56045
|
-
const extracted = await findBinary(extractDir, platform);
|
|
56046
|
-
if (!extracted) return {
|
|
56047
|
-
ok: false,
|
|
56048
|
-
reason: `extract failed: no rtk binary inside ${asset.file}`
|
|
56049
|
-
};
|
|
56050
|
-
if (!(await fs$1.lstat(extracted)).isFile()) return {
|
|
56051
|
-
ok: false,
|
|
56052
|
-
reason: `extract failed: rtk inside ${asset.file} is not a regular file`
|
|
56053
|
-
};
|
|
56054
|
-
if (platform !== "win32") await fs$1.chmod(extracted, 493);
|
|
56055
|
-
const target = installTargetPath(glimmervoidHome, platform);
|
|
56056
|
-
await fs$1.mkdir(path.dirname(target), { recursive: true });
|
|
56057
|
-
await removeQuietly(target);
|
|
56058
|
-
await moveIntoPlace(extracted, target, renameImpl);
|
|
56059
|
-
log?.log?.(`[rtk] installed rtk ${asset.version} at ${target}`);
|
|
56060
|
-
return {
|
|
56061
|
-
ok: true,
|
|
56062
|
-
path: target,
|
|
56063
|
-
version: asset.version
|
|
56064
|
-
};
|
|
56065
|
-
} catch (err) {
|
|
56066
|
-
return {
|
|
56067
|
-
ok: false,
|
|
56068
|
-
reason: errorText$1(err)
|
|
56069
|
-
};
|
|
56070
|
-
} finally {
|
|
56071
|
-
await removeQuietly(stagingDir);
|
|
56072
|
-
}
|
|
56073
|
-
}
|
|
56074
|
-
//#endregion
|
|
56075
|
-
//#region server/rtk-install-wiring.ts
|
|
56076
|
-
function createRtkInstallWiring({ config, homeDir = os.homedir(), platform = process.platform, arch = process.arch, log = console, now = () => Date.now(), resolveRtk = getRtkPath, install = installRtk, onStatusChange = () => {} } = {}) {
|
|
56077
|
-
let status = { status: "idle" };
|
|
56078
|
-
let inFlight = false;
|
|
56079
|
-
let lastFailureAt = null;
|
|
56080
|
-
const getStatus = () => ({ ...status });
|
|
56081
|
-
function setStatus(next) {
|
|
56082
|
-
status = next;
|
|
56083
|
-
onStatusChange(getStatus());
|
|
56084
|
-
}
|
|
56085
|
-
async function maybeInstall() {
|
|
56086
|
-
const rtkEnabled = config?.rtk === true;
|
|
56087
|
-
const decision = decideRtkInstall({
|
|
56088
|
-
rtkEnabled,
|
|
56089
|
-
resolvedPath: rtkEnabled ? resolveRtk() : null,
|
|
56090
|
-
platform,
|
|
56091
|
-
arch,
|
|
56092
|
-
inFlight,
|
|
56093
|
-
lastFailureAt,
|
|
56094
|
-
nowMs: now()
|
|
56095
|
-
});
|
|
56096
|
-
if (decision.action === "skip") return decision;
|
|
56097
|
-
inFlight = true;
|
|
56098
|
-
setStatus({ status: "installing" });
|
|
56099
|
-
log?.log?.(`[rtk] no rtk binary resolved and config.rtk is on: installing ${decision.asset.version}`);
|
|
56100
|
-
try {
|
|
56101
|
-
const result = await install({
|
|
56102
|
-
homeDir,
|
|
56103
|
-
platform,
|
|
56104
|
-
arch,
|
|
56105
|
-
...log ? { log } : {}
|
|
56106
|
-
});
|
|
56107
|
-
if (result.ok) {
|
|
56108
|
-
lastFailureAt = null;
|
|
56109
|
-
setStatus({
|
|
56110
|
-
status: "installed",
|
|
56111
|
-
path: result.path
|
|
56112
|
-
});
|
|
56113
|
-
return {
|
|
56114
|
-
...decision,
|
|
56115
|
-
result
|
|
56116
|
-
};
|
|
56117
|
-
}
|
|
56118
|
-
lastFailureAt = now();
|
|
56119
|
-
log?.warn?.(`[rtk] install failed: ${result.reason}`);
|
|
56120
|
-
setStatus({
|
|
56121
|
-
status: "failed",
|
|
56122
|
-
reason: result.reason
|
|
56123
|
-
});
|
|
56124
|
-
return {
|
|
56125
|
-
...decision,
|
|
56126
|
-
result
|
|
56127
|
-
};
|
|
56128
|
-
} finally {
|
|
56129
|
-
inFlight = false;
|
|
56130
|
-
}
|
|
56131
|
-
}
|
|
56132
|
-
return {
|
|
56133
|
-
maybeInstall,
|
|
56134
|
-
getStatus
|
|
56135
|
-
};
|
|
56136
|
-
}
|
|
56137
|
-
//#endregion
|
|
56138
55822
|
//#region server/claude-trust.ts
|
|
56139
55823
|
function sleepFor(durationMs) {
|
|
56140
55824
|
return new Promise((resolve) => {
|
|
@@ -56726,20 +56410,6 @@ function createBackendSessionRuntime(dependencies) {
|
|
|
56726
56410
|
try {
|
|
56727
56411
|
sweepOrphans();
|
|
56728
56412
|
} catch {}
|
|
56729
|
-
const rtkInstall = createRtkInstallWiring({
|
|
56730
|
-
config: dependencies.config,
|
|
56731
|
-
onStatusChange: (status) => {
|
|
56732
|
-
const broadcast = dependencies.getBroadcastControl();
|
|
56733
|
-
if (!broadcast) return;
|
|
56734
|
-
broadcast({
|
|
56735
|
-
type: "settings-updated",
|
|
56736
|
-
settings: buildSettingsPayload({
|
|
56737
|
-
configStore: dependencies.configStore,
|
|
56738
|
-
rtkInstallStatus: status
|
|
56739
|
-
})
|
|
56740
|
-
});
|
|
56741
|
-
}
|
|
56742
|
-
});
|
|
56743
56413
|
const commitSigningProgram = installCommitSigningShim({
|
|
56744
56414
|
binDir: configSiblingPath(dependencies.configStore.configPath, "bin"),
|
|
56745
56415
|
nodePath: process.execPath,
|
|
@@ -56842,7 +56512,6 @@ function createBackendSessionRuntime(dependencies) {
|
|
|
56842
56512
|
log: dependencies.logger
|
|
56843
56513
|
})
|
|
56844
56514
|
}),
|
|
56845
|
-
rtkInstall,
|
|
56846
56515
|
sshSigner
|
|
56847
56516
|
};
|
|
56848
56517
|
}
|
|
@@ -58588,7 +58257,7 @@ function createBackend(httpServer, options = {}) {
|
|
|
58588
58257
|
recordOutcome,
|
|
58589
58258
|
logger: console
|
|
58590
58259
|
});
|
|
58591
|
-
const { agentConnect, agentIngressServer, getHookPort, hookRouter, makeSession,
|
|
58260
|
+
const { agentConnect, agentIngressServer, getHookPort, hookRouter, makeSession, sshSigner } = sessionRuntime;
|
|
58592
58261
|
const getCurrentIngestLane = () => laneAssembly.currentIngest();
|
|
58593
58262
|
const getCurrentVisionsLane = () => laneAssembly.currentVisions();
|
|
58594
58263
|
const agentIngressDependencies = {
|
|
@@ -58778,7 +58447,6 @@ function createBackend(httpServer, options = {}) {
|
|
|
58778
58447
|
});
|
|
58779
58448
|
sessionRegistry.initialize();
|
|
58780
58449
|
const reconcileProjectsOnReload = sessionRegistry.applyConfigReload;
|
|
58781
|
-
rtkInstall.maybeInstall();
|
|
58782
58450
|
sweepOrphanedGuardrailsLaunches();
|
|
58783
58451
|
reconcileOwnedPaths({
|
|
58784
58452
|
ledger: laneAssembly.ownedPaths,
|
|
@@ -58818,7 +58486,6 @@ function createBackend(httpServer, options = {}) {
|
|
|
58818
58486
|
for (const [, sess] of sessions) sess.updateSettings(config);
|
|
58819
58487
|
notifications.applySettings();
|
|
58820
58488
|
laneAssembly.restartServiceLanes();
|
|
58821
|
-
rtkInstall.maybeInstall();
|
|
58822
58489
|
visionsSetup.maybeApply();
|
|
58823
58490
|
laneAssembly.restartDynamicLanes();
|
|
58824
58491
|
}
|
|
@@ -58946,7 +58613,6 @@ function createBackend(httpServer, options = {}) {
|
|
|
58946
58613
|
configStore,
|
|
58947
58614
|
broadcastControl,
|
|
58948
58615
|
controlReplayLog,
|
|
58949
|
-
getRtkInstallStatus: () => rtkInstall.getStatus(),
|
|
58950
58616
|
agentConnect,
|
|
58951
58617
|
remoteSetup,
|
|
58952
58618
|
telegramDelivery: notifications.telegramDelivery,
|
|
@@ -58995,7 +58661,6 @@ function createBackend(httpServer, options = {}) {
|
|
|
58995
58661
|
type: "settings-updated",
|
|
58996
58662
|
settings: buildSettingsPayload({
|
|
58997
58663
|
configStore,
|
|
58998
|
-
rtkInstallStatus: rtkInstall.getStatus(),
|
|
58999
58664
|
coderEnvironments: laneAssembly.coderEnv.availableEnvironments(),
|
|
59000
58665
|
agentLogins: agentConnect.logins()
|
|
59001
58666
|
})
|