glimmervoid 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/glimmervoid.js +31 -19
- package/dist/chunks/adapters-B37wqNti.js +1 -0
- package/dist/chunks/{adapters-BY8slY95.js → adapters-CADejSpq.js} +219 -9
- package/dist/chunks/agent-api-cli-CRj_FYbz.js +1 -0
- package/dist/chunks/{agent-api-cli-DuT7437B.js → agent-api-cli-vGwstJ1j.js} +57 -17
- package/dist/chunks/{agent-api-core-Ddg15j2j.js → agent-api-core-D1233u1U.js} +35 -9
- package/dist/chunks/{agent-setup-cli-CFielF2o.js → agent-setup-cli-BTAFcckd.js} +2 -2
- package/dist/chunks/child-process-safe-ChRmWAJP.js +1 -0
- package/dist/chunks/{config-DTwMFUjx.js → config-rPbbL4nW.js} +12 -21
- package/dist/chunks/config-store-BeIxAZNn.js +1 -0
- package/dist/chunks/{config-store-CggAQLUB.js → config-store-BtsYbNC3.js} +44 -14
- package/dist/chunks/{contracts-D1wLN5iO.js → contracts-DjIgIuDk.js} +51 -27
- package/dist/chunks/{git-version-CrLW4a6r.js → git-version-CUcDtF5k.js} +3 -3
- package/dist/chunks/{grok-BYKnBgdr.js → grok-KKgdSe-7.js} +7 -3
- package/dist/chunks/{ingest-editor-core-vR6Wv6bP.js → ingest-editor-core-B2tycW_m.js} +4 -4
- package/dist/chunks/{json-file-oEH9vt-0.js → json-file-BaxGcB2R.js} +1 -1
- package/dist/chunks/{knowledge-graph-cli-BBE3R9DJ.js → knowledge-graph-cli-Rj5nj87L.js} +4 -4
- package/dist/chunks/{main-Dh4udE7P.js → main-BTI0J5QE.js} +499 -539
- package/dist/chunks/{pair-cli-Nnrd0il_.js → pair-cli-Dcyzv3In.js} +2 -2
- package/dist/chunks/paths-Bu4eH1Yd.js +27 -0
- package/dist/chunks/{remote-config-DKMQEIZh.js → remote-config-Dd1T-VJA.js} +3 -3
- package/dist/chunks/{rtk-resolver-jJxy_Mrt.js → rtk-resolver-B9pzjLsM.js} +1 -1
- package/dist/chunks/rtk-resolver-SWU5VVM7.js +1 -0
- package/dist/chunks/{runtime-paths-BPoxENmK.js → runtime-paths-BkeftE60.js} +3 -4
- package/dist/chunks/runtime-paths-DSmormp7.js +1 -0
- package/dist/chunks/{sandbox-deps-C63o3mZs.js → sandbox-deps-CWiH1d1w.js} +3 -3
- package/dist/chunks/{session-C7rstCmA.js → session-D6xXN0UU.js} +26 -4
- package/dist/chunks/session-routes-BYy3am9m.js +127 -0
- package/dist/chunks/{ssh-sign-cli-SWtTF00D.js → ssh-sign-cli-DPHpT22B.js} +11 -7
- package/dist/chunks/{visions-cli-BhFdym5n.js → visions-cli-CYujESdJ.js} +2 -2
- package/dist/chunks/{visions-setup-CfgNHiG3.js → visions-setup-B-ZeRdsi.js} +9 -9
- package/dist/client/assets/index-DE2GUmqs.css +1 -0
- package/dist/client/assets/index-Ds4ngkHp.js +254 -0
- package/dist/client/index.html +2 -2
- package/dist/scripts/postinstall-path-check.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/session/hook-tool-relay.js +2 -2
- package/dist/session/sandbox-open-launcher.js +23 -9
- package/dist/session/statusline-relay.js +1 -1
- package/dist/session/visions-relay.js +3 -3
- package/dist/tools/vscode-visions/visions-lsp-core.js +1 -1
- package/package.json +8 -8
- package/dist/chunks/adapters-_HwpLy0R.js +0 -2
- package/dist/chunks/agent-api-cli-CRJYxzVU.js +0 -2
- package/dist/chunks/child-process-safe-B3zcPdFM.js +0 -2
- package/dist/chunks/config-store-BmdXeUz1.js +0 -2
- package/dist/chunks/paths-CeJl2Vcg.js +0 -55
- package/dist/chunks/rtk-resolver-CIVLE_xk.js +0 -2
- package/dist/chunks/runtime-paths-DU5jBEEO.js +0 -2
- package/dist/client/assets/index-BiTwrj1H.js +0 -254
- package/dist/client/assets/index-BxU3Ww0L.css +0 -1
- package/dist/chunks/{child-process-safe-DDELk9XC.js → child-process-safe-CbQnyh7D.js} +1 -1
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
import { i as sanitizeOneLine, n as requireExecutableSpawnHelper, r as firstLine$1 } from "./node-pty-preflight-C8QIlrtU.js";
|
|
2
2
|
import { a as isMissingFileError, i as errorText$1, r as errorMessage, t as errorCode } from "./text-DoirglWV.js";
|
|
3
|
-
import { a as
|
|
4
|
-
import { a as packageRoot, n as cliPath, o as relayPath, r as clientDir, s as resolvePackageBin, t as bundled } from "./runtime-paths-
|
|
5
|
-
import {
|
|
6
|
-
import { n as execFileAsync, o as spawn, r as execFileSync, t as execFile } from "./child-process-safe-
|
|
3
|
+
import { a as sanitizeWorktreeName, i as safePathSegment, r as isPathInside, t as caseFoldedPathKey } from "./paths-Bu4eH1Yd.js";
|
|
4
|
+
import { a as packageRoot, n as cliPath, o as relayPath, r as clientDir, s as resolvePackageBin, t as bundled } from "./runtime-paths-BkeftE60.js";
|
|
5
|
+
import { D as TaskTitle, E as TASK_TITLE_CONTROL_CHARACTERS, F as STATES, M as KILLABLE_STATES, N as MERGEABLE_LIVE_STATES, O as isSamePromptQuestion, P as RESTARTABLE_STATES, T as SshSignRequest, _ as SESSION_DOC_BODY_CAP_BYTES, a as AgentDispatchRequest, b as SSH_SIGN_BODY_CAP_BYTES, h as RefinedTaskTitle, j as toolDetailLine, l as AgentTicketRequest, n as AGENT_URL_ENV, r as ASK_USER_QUESTION_TOOL_NAME, u as ORCHESTRATOR_AGENT_VERBS, y as SIGN_URL_ENV } from "./session-D6xXN0UU.js";
|
|
6
|
+
import { n as execFileAsync, o as spawn, r as execFileSync, t as execFile } from "./child-process-safe-CbQnyh7D.js";
|
|
7
7
|
import { n as glimmervoidHomeDir, t as decideConfigPath } from "./config-path-core-DFt-TemS.js";
|
|
8
|
-
import { n as checkSandboxDependencies, t as allowSandboxedSpawn } from "./sandbox-deps-
|
|
9
|
-
import { n as warnWhenGitIsTooOld } from "./git-version-
|
|
8
|
+
import { n as checkSandboxDependencies, t as allowSandboxedSpawn } from "./sandbox-deps-CWiH1d1w.js";
|
|
9
|
+
import { n as warnWhenGitIsTooOld } from "./git-version-CUcDtF5k.js";
|
|
10
10
|
import { t as HOOK_URL_ENV } from "./hook-relay-core-DA_bz2KA.js";
|
|
11
11
|
import { t as HOOK_VIA_SANDBOX_PROXY_ENV } from "./sandbox-proxy-core-hnQgKR0T.js";
|
|
12
12
|
import { t as refocusReplyFor } from "./refocus-core-BKQKllq7.js";
|
|
13
13
|
import { a as positiveIntOr, c as textOr, i as numberOr, n as isRecord, o as positiveNumberOr, r as nonNegativeIntOr, s as rawTextOr, t as coercedNumberOr } from "./coerce-NSst8oRP.js";
|
|
14
14
|
import { n as parseJsonRecord, t as parseJsonOrNull } from "./json-core-dfa_7Fak.js";
|
|
15
15
|
import { i as SANE_YOLO_FILES } from "./rtk-hook-core-BmEz2aq9.js";
|
|
16
|
-
import { _ as lineStartOffsets, a as projectForUri, b as replacedSpanOfWholeTextChange, c as visionsLaneReloadSignature, d as applyDidOpen, f as createDocStore, g as lineOfOffset, h as getDoc, i as isUriInProjects, l as applyDidChange, m as formatRange, n as applyEditorNotification, o as resolveVisionsScopeProjects, p as detectBlankLineBoundary, r as createEditorState, s as scopePathsOf, t as ACTIVITY_METHOD, u as applyDidClose, v as listDocs, x as uriOfParams, y as offsetOfPosition } from "./ingest-editor-core-
|
|
16
|
+
import { _ as lineStartOffsets, a as projectForUri, b as replacedSpanOfWholeTextChange, c as visionsLaneReloadSignature, d as applyDidOpen, f as createDocStore, g as lineOfOffset, h as getDoc, i as isUriInProjects, l as applyDidChange, m as formatRange, n as applyEditorNotification, o as resolveVisionsScopeProjects, p as detectBlankLineBoundary, r as createEditorState, s as scopePathsOf, t as ACTIVITY_METHOD, u as applyDidClose, v as listDocs, x as uriOfParams, y as offsetOfPosition } from "./ingest-editor-core-B2tycW_m.js";
|
|
17
17
|
import { n as DEFAULT_MAX_MS, r as nextBackoffMs, t as DEFAULT_BASE_MS } from "./backoff-DjVpfHk7.js";
|
|
18
18
|
import { n as unrefTimer, t as DEFAULT_TIMER_FNS } from "./timer-deps-u2DAQLok.js";
|
|
19
|
-
import {
|
|
20
|
-
import { s as
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { $ as
|
|
24
|
-
import { $ as
|
|
25
|
-
import { a as
|
|
19
|
+
import { o as permitsHelpCommand, r as describeSessionLimits } from "./session-routes-BYy3am9m.js";
|
|
20
|
+
import { a as decideSpawnAllowance, c as describePushLanding, d as isOrchestratorAgentVerb, f as parseAgentVerb, i as decideEditAllowance, l as describePushRouteRefusal, n as decideAgentRequest, o as decideTicketAction, r as decideAttentionAllowance, s as deriveChildSessionName, t as REFUSAL_REASON } from "./agent-api-core-D1233u1U.js";
|
|
21
|
+
import { s as GLIMMERVOID_SECRET_KEYS } from "./grok-KKgdSe-7.js";
|
|
22
|
+
import { _ as isQueueAdmissionTimeout, a as jsonStateLoadError, c as loadedJsonValue, d as writeJsonAtomicSync, f as writeTextAtomic, g as createSpawnGate, h as createSerialQueue, i as createJsonStateWriter, m as createKeyedSerialQueue, n as appendJsonLines, o as loadJsonStateFile, p as writeTextAtomicSync, r as createJsonStateStore, s as loadJsonStateFileSync, t as appendJsonLine, u as writeJsonAtomic } from "./json-file-BaxGcB2R.js";
|
|
23
|
+
import { $ as TeamReviewCompareFiles, A as MyPrSearchResponse, At as CoherenceWorkInspect, B as PostingPlan, C as MyPrMergeMethod, Ct as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, D as MyPrMergeWhenReadyRequest, E as MyPrMergeStateResponse, F as CommitSha, G as ReviewDraft, H as QueuedReview, I as DECIDING_REVIEW_STATES, J as ReviewThreadId, K as ReviewFinding, L as FindingSeverity, M as MyPrThreadsResponse, N as MyPrsState, Ot as CoherenceTicketCreated, P as MyPrsStatus, R as GithubReviewDecision, Tt as CoherenceOrient, U as ReviewChecksState, V as PrDetail, W as ReviewComment, X as SearchedPr, Y as ReviewVerdict, Z as TeamReviewActionRequest, _ as WorkflowSearchNode, a as ConfigUpdate, at as TeamReviewThreadsRepository, b as MyPrAutoRebase, bt as USAGE_COST_MODES, c as TASK_TITLE_SOURCE_PRIORITY, ct as hasStandingViewerApproval, d as BRANCH_GC_CONTROL_NUMERIC_KEYS, dt as shortSha$1, et as TeamReviewResolveResponse, ft as GH_SEGMENT, g as WorkflowLabelName, h as WorkflowCommentBody, ht as repoParts, it as TeamReviewThreadResult, j as MyPrThreadNode, k as MyPrSearchNode, kt as CoherenceWorkCreated, l as configIssueMessage, lt as FULL_SHA_RE, m as DEFAULT_FACTORY_PROTECTED_PATHS, mt as REPO_SLUG_RE, nt as TeamReviewStatus, o as PersistedTaskTitle, ot as canApproveAfterComment, p as DEFAULT_FACTORY_CHECKS, pt as NODE_ID_RE, q as ReviewResult, r as BrowserConfig, rt as TeamReviewThreadCommentsResponse, s as RUNTIME_CONFIG_SCALAR_KEYS, st as decisionAsIfApprovalRequired, tt as TeamReviewStateEntry, u as BRANCH_GC_CONTROL_BOOLEAN_KEYS, ut as HEX_SHA_RE, v as WorkflowsSettings, w as MyPrMergeRequest, wt as USAGE_INTEGER_RANGES, x as MyPrKeepMergeableRequest, xt as USAGE_VENDOR_KEYS, y as WorkflowsState, yt as USAGE_BUDGET_KEYS, z as GithubReviewState } from "./config-rPbbL4nW.js";
|
|
24
|
+
import { $ as sessionIdFromBranch, A as snapshotEvents, B as classifySessionExit, C as createIngestStore, D as resolveIngestConfig, E as publishEvent, F as adapterBucket, G as nodeMajorVersion, H as decideRemoteTelemetryState, I as buildAiGenerationEvents, J as stableConfigKey, K as parsePosthogReleaseId, L as buildBrowserExceptionProperties, M as FIRST_RUN_NOTICE, N as TELEMETRY_BATCH_URL, O as ringStats, P as TELEMETRY_FLAGS_URL, Q as planWorktreeGc, R as buildExceptionProperties, S as buildContextDigest, T as latestSeq, U as decideTelemetryConsent, V as decideIsDevInstall, W as exceptionFingerprint, X as matchedPrefix, Y as DEFAULT_BRANCH_GC_PREFIXES, Z as planBranchGc, _ as INGEST_SPEC, a as ensureProjectIds, b as DEFAULT_DIGEST_BUDGET_CHARS, d as assetForPlatform, et as usablePrefixes, f as decideRtkInstall, g as verifyDigest, h as isRtkBinaryName, i as createConfigStore, it as isSameDirectoryPath, j as localDayKey, k as scrubText, m as installTargetPath, n as DEFAULT_CONFIG, nt as canonicalizePath, o as generateProjectId, p as findEscapingArchiveMember, q as resolveProjectToken, rt as comparableDirectoryPath, s as glimmervoidHomeDir$1, t as ABORT_CONFIG_SAVE, tt as worktreeIntegrationTips, v as mergeSettingsBlock, w as enabledSourceNames, x as SOURCE_DEFAULTS, y as validateSettingsBlock, z as buildFactoryDecisionEvent } from "./config-store-BtsYbNC3.js";
|
|
25
|
+
import { $ as FactoryHarnessVerdict, A as BenchmarkActionRequest, B as PrCheckoutCaseInput, C as IssueKey, D as IssuesStatus, E as IssuesState, F as BenchmarkStatus, G as TelemetryState, H as PendingCrashReport, I as BenchmarkSuite, J as FACTORY_ERROR_MAX_CHARS, K as FACTORY_DECISION_OUTPUT_MAX_BYTES, L as CommitComparison, M as BenchmarkId, N as BenchmarkJudgement, O as ChangeMap, P as BenchmarkRun, Q as FactoryHarnessStateLine, R as MergedPrListing, S as GithubIssueResponse, T as IssuesSearchResponse, U as TELEMETRY_EVENT_SCHEMAS, X as FactoryConsequences, Y as FACTORY_PROTECTED_PATH_FLOOR, Z as FactoryControlRequest, _ as PlanDecision, a as ClientMessage, at as FactoryWorkerEvent, b as planTitle, c as UpdateJournal, d as TraceRecord, et as FactoryLaneState, f as PLAN_BODY_CAP_BYTES, g as PLAN_TOOL_NAME, h as PLAN_RESULT_HOOK_EVENT, i as CONTROL_FRAME_MAX_BYTES, it as FactoryReviewerOutput, j as BenchmarkCase, k as changeMapFactId, l as MAX_RAW_LINE_CHARS, m as PLAN_HOOK_OUTPUT_MAX_CHARS, n as HookEnvelope, nt as FactoryQueueIntentRequest, o as DIFF_ANNOTATION_NOTE_MAX_CHARS, ot as isSingleFactoryPathSegment, p as PLAN_HOOK_EVENT, q as FactoryDecisionLogLine, r as parseDataClientMessage, rt as FactoryReviewVerdict, s as InstallFlavor, t as HTTP_URL_RE, tt as FactoryProjectState, u as TraceCheckpoint, v as PlanRevision, w as IssueUpdate, x as GithubIssuePullRequestsRepository, y as parseExitPlanModeHookPayload, z as MinedPrReviewData } from "./contracts-DjIgIuDk.js";
|
|
26
|
+
import { A as claudeCode, C as laneSpendStatus, D as shouldEvaluateDespiteIoFailures, E as resolveProjectsDirs, O as shouldPersistWarehouse, S as isUsageFile, T as projectDirCandidates, _ as decideFileRead, a as describeAgentResolvability, b as grokHomes, c as isKnownAgentId, d as setCustomAgents, f as codexFallbackRoots, g as continuationDelayMs, h as codexSessionIdFromPath, i as customAgentFingerprint, k as splitLines$1, l as listAgentIds, m as codexRootCandidates, n as cachedAgentResolvability, o as getAdapter, p as codexHomes, r as commandFor, s as hookProfileOf, t as DEFAULT_AGENT_ID, u as resolveAdapter, v as dedupeCodexFiles, w as passOutcome, x as grokRootCandidates, y as expandTilde } from "./adapters-CADejSpq.js";
|
|
26
27
|
import { t as HOOK_TOOLS } from "./hook-tools-UX2fmt81.js";
|
|
27
28
|
import { a as formatSshPublicKey, c as orderAgentSockets, i as commitSigningShimText, l as parseSshPublicKey, n as NO_AGENT_HOLDS_KEY, o as isForwardedAgentDirName, r as agentListsKey, s as isSignableGitObject, t as COMMIT_SIGNING_SHIM_NAME } from "./ssh-signing-core-CRhVVWNW.js";
|
|
28
|
-
import { a as configSiblingPath, c as defaultPairingsPath, d as decideDeviceAuth, f as deviceNameFromUserAgent, l as defaultSeenPath, n as normalizeRemoteConfig, o as createPairingsStore, p as hashSecret, r as validateRemoteConfig, s as createSeenStore, t as decideBindHost, u as DEFAULT_DEVICE_MAX_AGE_MS } from "./remote-config-
|
|
29
|
-
import { _ as escapeMarkup, g as createLaneLog, n as createVisionsSetup } from "./visions-setup-
|
|
30
|
-
import { t as getRtkPath } from "./rtk-resolver-
|
|
29
|
+
import { a as configSiblingPath, c as defaultPairingsPath, d as decideDeviceAuth, f as deviceNameFromUserAgent, l as defaultSeenPath, n as normalizeRemoteConfig, o as createPairingsStore, p as hashSecret, r as validateRemoteConfig, s as createSeenStore, t as decideBindHost, u as DEFAULT_DEVICE_MAX_AGE_MS } from "./remote-config-Dd1T-VJA.js";
|
|
30
|
+
import { _ as escapeMarkup, g as createLaneLog, n as createVisionsSetup } from "./visions-setup-B-ZeRdsi.js";
|
|
31
|
+
import { t as getRtkPath } from "./rtk-resolver-B9pzjLsM.js";
|
|
31
32
|
import { createRequire } from "node:module";
|
|
32
33
|
import fs, { constants, readFileSync } from "node:fs";
|
|
33
34
|
import path from "node:path";
|
|
34
|
-
import { stripVTControlCharacters } from "node:util";
|
|
35
35
|
import os from "node:os";
|
|
36
36
|
import { z } from "zod";
|
|
37
|
+
import { stripVTControlCharacters } from "node:util";
|
|
37
38
|
import http from "node:http";
|
|
38
39
|
import { WebSocketServer } from "ws";
|
|
39
40
|
import crypto, { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
@@ -1418,7 +1419,7 @@ function isUploadFilename(name) {
|
|
|
1418
1419
|
return UPLOAD_FILENAME_RE.test(name);
|
|
1419
1420
|
}
|
|
1420
1421
|
//#endregion
|
|
1421
|
-
//#region server/backend-http.ts
|
|
1422
|
+
//#region server/backend/backend-http.ts
|
|
1422
1423
|
var HOOK_BODY_CAP_BYTES = 65536;
|
|
1423
1424
|
var UNNAMED_HOOK_EVENT = "an unknown event";
|
|
1424
1425
|
var KNOWN_HOOK_EVENTS = /* @__PURE__ */ new Set([
|
|
@@ -2036,7 +2037,7 @@ function projectSessionSnapshots(source) {
|
|
|
2036
2037
|
};
|
|
2037
2038
|
}
|
|
2038
2039
|
//#endregion
|
|
2039
|
-
//#region server/core/sandbox-roles-core.ts
|
|
2040
|
+
//#region server/sandbox/core/sandbox-roles-core.ts
|
|
2040
2041
|
var SESSION_VENDORS = Object.freeze(["claude", "codex"]);
|
|
2041
2042
|
var CONFINED_SESSION_VENDORS = Object.freeze(["claude"]);
|
|
2042
2043
|
var LANE_CREDENTIAL_ENV = Object.freeze({
|
|
@@ -2117,7 +2118,7 @@ function isWorktreeAdminDirOf({ adminDir, commonGitDir }) {
|
|
|
2117
2118
|
return path.dirname(path.resolve(adminDir)) === path.resolve(commonGitDir, "worktrees");
|
|
2118
2119
|
}
|
|
2119
2120
|
//#endregion
|
|
2120
|
-
//#region server/ephemeral-session.ts
|
|
2121
|
+
//#region server/lanes/ephemeral-session.ts
|
|
2121
2122
|
var JOB_RESULT_FILENAME = "result.json";
|
|
2122
2123
|
var ABORT_REAP_CAP_MS = 3e3;
|
|
2123
2124
|
async function awaitSessionExit(sess, { signal = null, spawnGate = null, reapCapMs = ABORT_REAP_CAP_MS } = {}) {
|
|
@@ -2275,7 +2276,11 @@ var SPAWN_FAILED_MESSAGE = "could not spawn the session";
|
|
|
2275
2276
|
function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoardSessions, makeSession, wireSessionEvents, closeSessionDataClients, broadcastControl, spawnGate, sessionDocs, recordLane = null, logger = console }) {
|
|
2276
2277
|
async function spawn(parent, request) {
|
|
2277
2278
|
const budget = parent.agentSpawnBudget();
|
|
2278
|
-
const allowance = decideSpawnAllowance(
|
|
2279
|
+
const allowance = decideSpawnAllowance({
|
|
2280
|
+
...budget,
|
|
2281
|
+
isFactoryWorker: parent.factoryRole === "worker",
|
|
2282
|
+
isEphemeral: parent.ephemeral
|
|
2283
|
+
});
|
|
2279
2284
|
if (!allowance.ok) return {
|
|
2280
2285
|
ok: false,
|
|
2281
2286
|
status: allowance.status,
|
|
@@ -2367,8 +2372,28 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
|
|
|
2367
2372
|
parent.finishAgentSpawn();
|
|
2368
2373
|
}
|
|
2369
2374
|
}
|
|
2370
|
-
function
|
|
2371
|
-
return
|
|
2375
|
+
function roleFactsOf(session) {
|
|
2376
|
+
return {
|
|
2377
|
+
isEphemeral: session.ephemeral,
|
|
2378
|
+
isSpawnedChild: agentSessions.has(session.id) && session.id.startsWith(`${AGENT_LANE_TAG}-`),
|
|
2379
|
+
factoryRole: session.factoryRole,
|
|
2380
|
+
hasOwnWorktree: session.hasOwnWorktree
|
|
2381
|
+
};
|
|
2382
|
+
}
|
|
2383
|
+
function attention(session, request) {
|
|
2384
|
+
const allowance = decideAttentionAllowance(roleFactsOf(session));
|
|
2385
|
+
if (!allowance.ok) return {
|
|
2386
|
+
status: allowance.status,
|
|
2387
|
+
body: {
|
|
2388
|
+
ok: false,
|
|
2389
|
+
error: allowance.reason
|
|
2390
|
+
}
|
|
2391
|
+
};
|
|
2392
|
+
const reply = session.noteAttention(request.note);
|
|
2393
|
+
return {
|
|
2394
|
+
status: reply.ok ? 200 : 429,
|
|
2395
|
+
body: reply
|
|
2396
|
+
};
|
|
2372
2397
|
}
|
|
2373
2398
|
function board() {
|
|
2374
2399
|
return listBoardSessions().map((session) => ({
|
|
@@ -2379,12 +2404,18 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
|
|
|
2379
2404
|
ephemeral: session.ephemeral
|
|
2380
2405
|
}));
|
|
2381
2406
|
}
|
|
2407
|
+
function limits(session) {
|
|
2408
|
+
return {
|
|
2409
|
+
ok: true,
|
|
2410
|
+
...describeSessionLimits({
|
|
2411
|
+
...roleFactsOf(session),
|
|
2412
|
+
isSandboxed: session.isConfined
|
|
2413
|
+
})
|
|
2414
|
+
};
|
|
2415
|
+
}
|
|
2382
2416
|
async function push(session) {
|
|
2383
|
-
const
|
|
2384
|
-
if (
|
|
2385
|
-
merged: false,
|
|
2386
|
-
reason: PUSH_UNAVAILABLE_REASON
|
|
2387
|
-
});
|
|
2417
|
+
const routeRefusal = describePushRouteRefusal(roleFactsOf(session));
|
|
2418
|
+
if (routeRefusal) return routeRefusal;
|
|
2388
2419
|
return describePushLanding(await session.mergeAndContinue({ force: true }));
|
|
2389
2420
|
}
|
|
2390
2421
|
async function handle(session, verb, payload) {
|
|
@@ -2411,14 +2442,20 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
|
|
|
2411
2442
|
}
|
|
2412
2443
|
};
|
|
2413
2444
|
if (parsed.verb === "push") return push(session);
|
|
2414
|
-
if (parsed.verb === "
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
};
|
|
2420
|
-
}
|
|
2445
|
+
if (parsed.verb === "limits") return {
|
|
2446
|
+
status: 200,
|
|
2447
|
+
body: limits(session)
|
|
2448
|
+
};
|
|
2449
|
+
if (parsed.verb === "attention") return attention(session, parsed.request);
|
|
2421
2450
|
if (parsed.verb === "edit") {
|
|
2451
|
+
const allowance = decideEditAllowance(roleFactsOf(session));
|
|
2452
|
+
if (!allowance.ok) return {
|
|
2453
|
+
status: allowance.status,
|
|
2454
|
+
body: {
|
|
2455
|
+
ok: false,
|
|
2456
|
+
error: allowance.reason
|
|
2457
|
+
}
|
|
2458
|
+
};
|
|
2422
2459
|
const reply = await sessionDocs.surface(session, parsed.request);
|
|
2423
2460
|
if (!reply.ok) return {
|
|
2424
2461
|
status: 400,
|
|
@@ -2453,7 +2490,7 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
|
|
|
2453
2490
|
return { handle };
|
|
2454
2491
|
}
|
|
2455
2492
|
//#endregion
|
|
2456
|
-
//#region server/control-replay-core.ts
|
|
2493
|
+
//#region server/core/control-replay-core.ts
|
|
2457
2494
|
var REPLAYABLE_EXACT = /* @__PURE__ */ new Set([
|
|
2458
2495
|
"notify",
|
|
2459
2496
|
"session-error",
|
|
@@ -2516,8 +2553,8 @@ var REFRESHABLE_TYPES = /* @__PURE__ */ new Set([
|
|
|
2516
2553
|
"plan-limits",
|
|
2517
2554
|
"ingest-activity",
|
|
2518
2555
|
"ingest-snapshot",
|
|
2519
|
-
"
|
|
2520
|
-
"
|
|
2556
|
+
"radar-status",
|
|
2557
|
+
"radar-investigation-activity",
|
|
2521
2558
|
"session-trace-changed",
|
|
2522
2559
|
"session-plan-changed"
|
|
2523
2560
|
]);
|
|
@@ -2798,7 +2835,7 @@ function createWsSender(ws, opts = {}) {
|
|
|
2798
2835
|
};
|
|
2799
2836
|
}
|
|
2800
2837
|
//#endregion
|
|
2801
|
-
//#region server/backend-websockets.ts
|
|
2838
|
+
//#region server/backend/backend-websockets.ts
|
|
2802
2839
|
function sendControlFrame(client, payload, type, logger) {
|
|
2803
2840
|
if (client.readyState !== 1) return;
|
|
2804
2841
|
const decision = decideControlSend({
|
|
@@ -3034,7 +3071,7 @@ function createBackendWebSockets(dependencies) {
|
|
|
3034
3071
|
};
|
|
3035
3072
|
}
|
|
3036
3073
|
//#endregion
|
|
3037
|
-
//#region server/backend-shutdown.ts
|
|
3074
|
+
//#region server/backend/backend-shutdown.ts
|
|
3038
3075
|
function destroySessions(sessionMaps, pendingReaps) {
|
|
3039
3076
|
for (const sessions of sessionMaps) for (const session of sessions.values()) {
|
|
3040
3077
|
session.destroy();
|
|
@@ -3300,7 +3337,7 @@ function createRemoteAuth({ remote, pairingsStore, seenStore = null, now = Date.
|
|
|
3300
3337
|
};
|
|
3301
3338
|
}
|
|
3302
3339
|
//#endregion
|
|
3303
|
-
//#region server/backend-trust.ts
|
|
3340
|
+
//#region server/backend/backend-trust.ts
|
|
3304
3341
|
function bootError(message) {
|
|
3305
3342
|
return Object.assign(new Error(message), { glimmervoidBoot: true });
|
|
3306
3343
|
}
|
|
@@ -3452,7 +3489,7 @@ function decideAcknowledge(isAcknowledgeDeferred, from, event, isIdleCompactionA
|
|
|
3452
3489
|
};
|
|
3453
3490
|
}
|
|
3454
3491
|
//#endregion
|
|
3455
|
-
//#region server/core/session-registry-core.ts
|
|
3492
|
+
//#region server/session/core/session-registry-core.ts
|
|
3456
3493
|
function machineSkipsPermissionsByDefault(config) {
|
|
3457
3494
|
return "skipPermissionsByDefault" in config && config.skipPermissionsByDefault === true;
|
|
3458
3495
|
}
|
|
@@ -3465,6 +3502,11 @@ function decideWasActiveFlip(to, event, pendingRestart) {
|
|
|
3465
3502
|
if (!pendingRestart && (event === "user_kill" || to === STATES.DONE || to === STATES.FAILED)) return false;
|
|
3466
3503
|
return null;
|
|
3467
3504
|
}
|
|
3505
|
+
function haveSameWorkspaceRepos(projectRepos, sessionRepos) {
|
|
3506
|
+
const configured = projectRepos ?? [];
|
|
3507
|
+
const running = sessionRepos ?? [];
|
|
3508
|
+
return configured.length === running.length && configured.every((repoPath, index) => repoPath === running[index]);
|
|
3509
|
+
}
|
|
3468
3510
|
function shouldStartAfterModify(previousState) {
|
|
3469
3511
|
return previousState !== STATES.DORMANT;
|
|
3470
3512
|
}
|
|
@@ -3492,7 +3534,8 @@ function diffProjects(currentSessions, newProjects, dependencies) {
|
|
|
3492
3534
|
const resolvedAgentId = dependencies.resolveAgentId(project.agent);
|
|
3493
3535
|
const agentChanged = resolvedAgentId !== session.agentId || agentFingerprintOf(resolvedAgentId) !== capturedAgentFingerprintOf(id);
|
|
3494
3536
|
const hookTrustChanged = project.codexBypassHookTrust === true !== session.bypassHookTrust;
|
|
3495
|
-
|
|
3537
|
+
const workspaceReposChanged = !haveSameWorkspaceRepos(project.repos, session.workspaceRepos);
|
|
3538
|
+
if (pathChanged || permissionsChanged || agentChanged || hookTrustChanged || workspaceReposChanged) {
|
|
3496
3539
|
modified.push(project);
|
|
3497
3540
|
continue;
|
|
3498
3541
|
}
|
|
@@ -3512,7 +3555,7 @@ function diffProjects(currentSessions, newProjects, dependencies) {
|
|
|
3512
3555
|
};
|
|
3513
3556
|
}
|
|
3514
3557
|
//#endregion
|
|
3515
|
-
//#region server/core/usage-lane-core.ts
|
|
3558
|
+
//#region server/usage/core/usage-lane-core.ts
|
|
3516
3559
|
var INTERACTIVE_LANE = "interactive";
|
|
3517
3560
|
var FIVE_HOUR_WINDOW_MS = 18e6;
|
|
3518
3561
|
var SEVEN_DAY_WINDOW_MS = 6048e5;
|
|
@@ -3905,7 +3948,7 @@ function looksBinary(buf) {
|
|
|
3905
3948
|
return false;
|
|
3906
3949
|
}
|
|
3907
3950
|
//#endregion
|
|
3908
|
-
//#region server/git-exec.ts
|
|
3951
|
+
//#region server/git/git-exec.ts
|
|
3909
3952
|
var DEFAULT_COMMAND_TIMEOUT_MS = 2e4;
|
|
3910
3953
|
function outputText(value) {
|
|
3911
3954
|
if (typeof value === "string") return value;
|
|
@@ -4219,7 +4262,7 @@ async function runPostTurnChecks({ cwd, config, sessionId, deps = {} } = {}) {
|
|
|
4219
4262
|
return finalReport;
|
|
4220
4263
|
}
|
|
4221
4264
|
//#endregion
|
|
4222
|
-
//#region server/session-event-wiring.ts
|
|
4265
|
+
//#region server/session/session-event-wiring.ts
|
|
4223
4266
|
var IDLE_COMPACTION_CONFIRM_MS = 1e4;
|
|
4224
4267
|
function waitingCopy(name, context) {
|
|
4225
4268
|
if (context.planTitle) return `${name} has a plan ready for review: ${context.planTitle}`;
|
|
@@ -4777,7 +4820,7 @@ function decideMarkerBase({ marker, fallbackBase, configuredIntegrationBranch, d
|
|
|
4777
4820
|
};
|
|
4778
4821
|
}
|
|
4779
4822
|
//#endregion
|
|
4780
|
-
//#region server/session-registry.ts
|
|
4823
|
+
//#region server/session/session-registry.ts
|
|
4781
4824
|
function runAutoResume(sessions, config, spawnGate, logger = console) {
|
|
4782
4825
|
const ids = pickAutoResume(config.projects, config);
|
|
4783
4826
|
const runs = [];
|
|
@@ -4793,7 +4836,15 @@ function runAutoResume(sessions, config, spawnGate, logger = console) {
|
|
|
4793
4836
|
}
|
|
4794
4837
|
return Promise.all(runs);
|
|
4795
4838
|
}
|
|
4796
|
-
function
|
|
4839
|
+
function releaseDroppedWorkspaceMembers(oldSession, newSession, currentSessionFor) {
|
|
4840
|
+
return Promise.resolve(oldSession._killReap).catch(() => {}).then(() => {
|
|
4841
|
+
const liveSession = currentSessionFor?.(oldSession.id) ?? newSession;
|
|
4842
|
+
const keepRepoPaths = isSameDirectoryPath(liveSession.path, oldSession.path) ? liveSession.workspaceRepos ?? [] : [];
|
|
4843
|
+
return oldSession.releaseDroppedWorkspaceMembers(keepRepoPaths);
|
|
4844
|
+
}).catch((error) => console.warn(`[config] releasing dropped workspace members failed for ${oldSession.name}: ${errorMessage(error)}`));
|
|
4845
|
+
}
|
|
4846
|
+
function carryWorktreeAcrossRecreate(oldSession, newSession, currentSessionFor) {
|
|
4847
|
+
if (oldSession?.workspaceRepos) return releaseDroppedWorkspaceMembers(oldSession, newSession, currentSessionFor);
|
|
4797
4848
|
const carry = oldSession?.getWorktreeCarry?.();
|
|
4798
4849
|
if (!oldSession || !carry) return;
|
|
4799
4850
|
if (isSameDirectoryPath(newSession.path, oldSession.path)) {
|
|
@@ -4961,7 +5012,7 @@ function createSessionRegistry(dependencies) {
|
|
|
4961
5012
|
sessions.set(project.id, newSession);
|
|
4962
5013
|
captureAgentFingerprint(project);
|
|
4963
5014
|
dependencies.wireSessionEvents(newSession);
|
|
4964
|
-
dependencies.carryWorktreeAcrossRecreate(oldSession, newSession);
|
|
5015
|
+
dependencies.carryWorktreeAcrossRecreate(oldSession, newSession, getSession);
|
|
4965
5016
|
dependencies.broadcastControl({
|
|
4966
5017
|
type: "session-modified",
|
|
4967
5018
|
...projectSessionCard(newSession, {
|
|
@@ -5355,7 +5406,7 @@ function intentPayload(state) {
|
|
|
5355
5406
|
};
|
|
5356
5407
|
}
|
|
5357
5408
|
//#endregion
|
|
5358
|
-
//#region server/core/visions-touch-core.ts
|
|
5409
|
+
//#region server/visions/core/visions-touch-core.ts
|
|
5359
5410
|
function createTouchState() {
|
|
5360
5411
|
return {
|
|
5361
5412
|
touchedByUri: /* @__PURE__ */ new Map(),
|
|
@@ -5577,7 +5628,7 @@ function formatTouchedRanges(ranges) {
|
|
|
5577
5628
|
return (Array.isArray(ranges) ? ranges : []).map((range) => range.start === range.end ? `${range.start}` : `${range.start}-${range.end}`).join(", ");
|
|
5578
5629
|
}
|
|
5579
5630
|
//#endregion
|
|
5580
|
-
//#region server/core/visions-dispatch-core.ts
|
|
5631
|
+
//#region server/visions/core/visions-dispatch-core.ts
|
|
5581
5632
|
var DEFAULT_QUIET_MS = 3e4;
|
|
5582
5633
|
var DEFAULT_COOLDOWN_MS = 3e5;
|
|
5583
5634
|
var DEFAULT_DISPATCH_MODEL = "opus";
|
|
@@ -6202,7 +6253,7 @@ function buildVisionsPrompt({ uri, text, findings = [], intent = "", digest = ""
|
|
|
6202
6253
|
].join("\n");
|
|
6203
6254
|
}
|
|
6204
6255
|
//#endregion
|
|
6205
|
-
//#region server/core/team-review-threads-core.ts
|
|
6256
|
+
//#region server/github/core/team-review-threads-core.ts
|
|
6206
6257
|
var THREAD_JUDGE_BACKOFF_MS = 9e5;
|
|
6207
6258
|
var THREAD_PLACEHOLDER_ERROR = "No local review draft. Review the answered threads below.";
|
|
6208
6259
|
var THREAD_COMMENTS_MAX_CHARS = 2e4;
|
|
@@ -6326,7 +6377,7 @@ function parseThreadJudgeResult(raw) {
|
|
|
6326
6377
|
return parsed.success ? parsed.data : null;
|
|
6327
6378
|
}
|
|
6328
6379
|
//#endregion
|
|
6329
|
-
//#region server/core/github-teams-core.ts
|
|
6380
|
+
//#region server/github/core/github-teams-core.ts
|
|
6330
6381
|
function readGithubTeams(config) {
|
|
6331
6382
|
const configuredTeams = config.github?.teams;
|
|
6332
6383
|
if (!configuredTeams?.length) {
|
|
@@ -6354,9 +6405,11 @@ function readGithubTeams(config) {
|
|
|
6354
6405
|
return [...teamsByName.values()];
|
|
6355
6406
|
}
|
|
6356
6407
|
//#endregion
|
|
6357
|
-
//#region server/core/team-review-core.ts
|
|
6408
|
+
//#region server/github/core/team-review-core.ts
|
|
6358
6409
|
var STAMP_MODEL = "sonnet";
|
|
6359
6410
|
var FULL_MODEL = "opus";
|
|
6411
|
+
var STAMP_MAX_LINES = 200;
|
|
6412
|
+
var STAMP_MAX_FILES = 10;
|
|
6360
6413
|
var REVIEW_TIMEOUT_SECONDS = 2400;
|
|
6361
6414
|
function advanceAwakeElapsed({ awakeElapsedMs, previousTickAt, nowMs, tickMs }) {
|
|
6362
6415
|
return awakeElapsedMs + Math.min(Math.max(0, nowMs - previousTickAt), 2 * tickMs);
|
|
@@ -6528,13 +6581,13 @@ function triagePr(detail) {
|
|
|
6528
6581
|
}
|
|
6529
6582
|
const countedFiles = detail.files.filter((file) => !isExcludedFromSize(file.path));
|
|
6530
6583
|
const countedLines = countedFiles.reduce((total, file) => total + file.additions + file.deletions, 0);
|
|
6531
|
-
if (countedLines >
|
|
6584
|
+
if (countedLines > STAMP_MAX_LINES) return {
|
|
6532
6585
|
tier: "full",
|
|
6533
|
-
reasons: [`${countedLines} counted lines over
|
|
6586
|
+
reasons: [`${countedLines} counted lines over ${STAMP_MAX_LINES}`]
|
|
6534
6587
|
};
|
|
6535
|
-
if (countedFiles.length >
|
|
6588
|
+
if (countedFiles.length > STAMP_MAX_FILES) return {
|
|
6536
6589
|
tier: "full",
|
|
6537
|
-
reasons: [`${countedFiles.length} counted files over
|
|
6590
|
+
reasons: [`${countedFiles.length} counted files over ${STAMP_MAX_FILES}`]
|
|
6538
6591
|
};
|
|
6539
6592
|
if (countedFiles.length === 0 && detail.files.length > 0 && detail.files.every((file) => isDocsOrTests(file.path))) return {
|
|
6540
6593
|
tier: "stamp",
|
|
@@ -7408,7 +7461,7 @@ function absolutePathReadRule(absolutePath) {
|
|
|
7408
7461
|
return `Read(/${absolutePath.replace(/\\/g, "/").replace(/^([A-Za-z]):/, (_drive, driveLetter) => `/${driveLetter.toLowerCase()}`).replace(/\/+$/, "")}/**)`;
|
|
7409
7462
|
}
|
|
7410
7463
|
//#endregion
|
|
7411
|
-
//#region server/core/issues-core.ts
|
|
7464
|
+
//#region server/github/core/issues-core.ts
|
|
7412
7465
|
var ISSUES_LANE_ID = "issues";
|
|
7413
7466
|
var ISSUES_STATE_FILENAME = "issues-cache.json";
|
|
7414
7467
|
var MAX_TOTAL_ISSUES = 1e3;
|
|
@@ -7551,7 +7604,7 @@ function issuesStatus({ ts, configured, reason = null, issues = [], lastSyncAt =
|
|
|
7551
7604
|
});
|
|
7552
7605
|
}
|
|
7553
7606
|
//#endregion
|
|
7554
|
-
//#region server/core/lane-backoff.ts
|
|
7607
|
+
//#region server/lanes/core/lane-backoff.ts
|
|
7555
7608
|
var QUICK_RETRY_DELAYS_MS = Object.freeze([
|
|
7556
7609
|
1e4,
|
|
7557
7610
|
3e4,
|
|
@@ -7591,7 +7644,7 @@ function secondaryRateLimitWaitMs(errorText) {
|
|
|
7591
7644
|
return Math.max(SECONDARY_RATE_LIMIT_MIN_WAIT_MS, retryAfterMs);
|
|
7592
7645
|
}
|
|
7593
7646
|
//#endregion
|
|
7594
|
-
//#region server/lane-runner.ts
|
|
7647
|
+
//#region server/lanes/lane-runner.ts
|
|
7595
7648
|
function createTickLoop({ tag, quickRetries = false, onScheduleChange = () => {}, rateLimitWaitMs = async () => null, intervalMs, tick: tickBody, writeState = async () => {}, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, clock, firstTickDelayMs = () => 0, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, backoffBaseMs = Math.max(intervalMs, DEFAULT_BASE_MS), backoffMaxMs = DEFAULT_MAX_MS, now = Date.now, random = Math.random, log = console }) {
|
|
7596
7649
|
let timer = null;
|
|
7597
7650
|
let unschedule = null;
|
|
@@ -7858,7 +7911,7 @@ function createLaneRunner({ tag, gate, cfgKey, emptyStatus, createPoller, broadc
|
|
|
7858
7911
|
};
|
|
7859
7912
|
}
|
|
7860
7913
|
//#endregion
|
|
7861
|
-
//#region server/core/github-rate-limit-core.ts
|
|
7914
|
+
//#region server/github/core/github-rate-limit-core.ts
|
|
7862
7915
|
var RateLimitResource = z.object({
|
|
7863
7916
|
remaining: z.number(),
|
|
7864
7917
|
reset: z.number()
|
|
@@ -7871,7 +7924,7 @@ function githubRateLimitWaitMs(resources, nowMs, resourceNames) {
|
|
|
7871
7924
|
return Math.max(...exhaustedResetsMs);
|
|
7872
7925
|
}
|
|
7873
7926
|
//#endregion
|
|
7874
|
-
//#region server/issues-poller.ts
|
|
7927
|
+
//#region server/github/issues-poller.ts
|
|
7875
7928
|
function createIssuesPoller(dependencies) {
|
|
7876
7929
|
const { teams, github, onTickComplete, now = Date.now, log = console } = dependencies;
|
|
7877
7930
|
let state = emptyIssuesState();
|
|
@@ -8049,7 +8102,7 @@ function bootStaggerDelay() {
|
|
|
8049
8102
|
return bootStaggerDelayMs(process.uptime() * 1e3, Math.random());
|
|
8050
8103
|
}
|
|
8051
8104
|
//#endregion
|
|
8052
|
-
//#region server/pr-gh.ts
|
|
8105
|
+
//#region server/github/pr-gh.ts
|
|
8053
8106
|
var GH_MERGE_FLAGS = {
|
|
8054
8107
|
MERGE: "--merge",
|
|
8055
8108
|
SQUASH: "--squash",
|
|
@@ -9283,7 +9336,7 @@ function createPrGh(cwd, commandRunner = run) {
|
|
|
9283
9336
|
};
|
|
9284
9337
|
}
|
|
9285
9338
|
//#endregion
|
|
9286
|
-
//#region server/issues-wiring.ts
|
|
9339
|
+
//#region server/github/issues-wiring.ts
|
|
9287
9340
|
function createIssuesStateIo(statePath, log) {
|
|
9288
9341
|
let loaded = emptyIssuesState();
|
|
9289
9342
|
let hasLoaded = false;
|
|
@@ -10628,190 +10681,6 @@ async function readTranscriptTaskTitle(transcriptPath) {
|
|
|
10628
10681
|
}
|
|
10629
10682
|
}
|
|
10630
10683
|
//#endregion
|
|
10631
|
-
//#region server/core/usage-scan-core.ts
|
|
10632
|
-
function laneSpendStatus({ isTrackingEnabled, scan }) {
|
|
10633
|
-
if (!isTrackingEnabled) return "tracking-off";
|
|
10634
|
-
if (scan === null) return "scanner-missing";
|
|
10635
|
-
if (scan.lastOutcome === "io-failed") return "read-failing";
|
|
10636
|
-
if (!scan.isHistoryCaughtUp || scan.lastOutcome === null) return "catching-up";
|
|
10637
|
-
return "known";
|
|
10638
|
-
}
|
|
10639
|
-
function decideFileRead(prior, stat) {
|
|
10640
|
-
if (!prior) return {
|
|
10641
|
-
action: "restart",
|
|
10642
|
-
readFrom: 0
|
|
10643
|
-
};
|
|
10644
|
-
if (!stat || typeof stat.size !== "number") return {
|
|
10645
|
-
action: "skip",
|
|
10646
|
-
readFrom: prior.offset || 0
|
|
10647
|
-
};
|
|
10648
|
-
if (stat.size < (prior.size || 0)) return {
|
|
10649
|
-
action: "restart",
|
|
10650
|
-
readFrom: 0
|
|
10651
|
-
};
|
|
10652
|
-
if (stat.size < (prior.offset || 0)) return {
|
|
10653
|
-
action: "restart",
|
|
10654
|
-
readFrom: 0
|
|
10655
|
-
};
|
|
10656
|
-
if (stat.size === (prior.offset || 0) && stat.mtimeMs === prior.mtimeMs) return {
|
|
10657
|
-
action: "skip",
|
|
10658
|
-
readFrom: prior.offset || 0
|
|
10659
|
-
};
|
|
10660
|
-
return {
|
|
10661
|
-
action: "append",
|
|
10662
|
-
readFrom: prior.offset || 0
|
|
10663
|
-
};
|
|
10664
|
-
}
|
|
10665
|
-
function splitLines$1(carry, chunkText) {
|
|
10666
|
-
const text = `${carry || ""}${chunkText || ""}`;
|
|
10667
|
-
const lines = text.split(/\r?\n/);
|
|
10668
|
-
const nextCarry = text.endsWith("\n") || text.endsWith("\r\n") ? "" : lines.pop();
|
|
10669
|
-
return {
|
|
10670
|
-
lines: lines.filter((line) => line.length > 0),
|
|
10671
|
-
carry: nextCarry || ""
|
|
10672
|
-
};
|
|
10673
|
-
}
|
|
10674
|
-
function resolveProjectsDirs(env = process.env, extraDirs = [], isDirectory, homeDir = null) {
|
|
10675
|
-
if (typeof isDirectory !== "function") throw new TypeError("resolveProjectsDirs requires an isDirectory function");
|
|
10676
|
-
const surviving = projectDirCandidates(env, extraDirs, homeDir).filter(isDirectory);
|
|
10677
|
-
if (!configDirOverride(env)) return surviving;
|
|
10678
|
-
if (projectDirCandidates(env, [], homeDir).filter(isDirectory).length === 0) throw new Error("CLAUDE_CONFIG_DIR is set but no projects directory exists");
|
|
10679
|
-
return surviving;
|
|
10680
|
-
}
|
|
10681
|
-
function projectDirCandidates(env = process.env, extraDirs = [], homeDir = null) {
|
|
10682
|
-
const override = configDirOverride(env);
|
|
10683
|
-
const extraHomes = normalizeHomeCandidates(extraDirs, env, homeDir);
|
|
10684
|
-
if (override) return uniqueStrings([...projectsDirsFromHomes(normalizeHomeCandidates(override.split(","), env, homeDir)), ...projectsDirsFromHomes(extraHomes)]);
|
|
10685
|
-
const resolvedHomeDir = resolveHomeDir$1(env, homeDir);
|
|
10686
|
-
if (!resolvedHomeDir) return uniqueStrings(projectsDirsFromHomes(extraHomes));
|
|
10687
|
-
const xdgConfigHome = rawTextOr(env.XDG_CONFIG_HOME, null) || path.join(resolvedHomeDir, ".config");
|
|
10688
|
-
return uniqueStrings([...projectsDirsFromHomes([path.join(xdgConfigHome, "claude"), path.join(resolvedHomeDir, ".claude")]), ...projectsDirsFromHomes(extraHomes)]);
|
|
10689
|
-
}
|
|
10690
|
-
function configDirOverride(env) {
|
|
10691
|
-
return (typeof env.CLAUDE_CONFIG_DIR === "string" ? env.CLAUDE_CONFIG_DIR : "").trim();
|
|
10692
|
-
}
|
|
10693
|
-
function projectsDirsFromHomes(homes) {
|
|
10694
|
-
const projectsDirs = [];
|
|
10695
|
-
for (const candidate of homes) {
|
|
10696
|
-
const home = path.basename(candidate) === "projects" ? path.dirname(candidate) : candidate;
|
|
10697
|
-
const projectsDir = path.join(home, "projects");
|
|
10698
|
-
projectsDirs.push(projectsDir);
|
|
10699
|
-
}
|
|
10700
|
-
return projectsDirs;
|
|
10701
|
-
}
|
|
10702
|
-
function normalizeHomeCandidates(candidates, env, homeDir) {
|
|
10703
|
-
if (!Array.isArray(candidates)) return [];
|
|
10704
|
-
return candidates.map((candidate) => expandTilde(String(candidate || "").trim(), env, homeDir)).filter(Boolean);
|
|
10705
|
-
}
|
|
10706
|
-
function expandTilde(candidate, env, homeDir) {
|
|
10707
|
-
if (!candidate.startsWith("~")) return candidate;
|
|
10708
|
-
const home = resolveHomeDir$1(env, homeDir);
|
|
10709
|
-
if (!home) return "";
|
|
10710
|
-
if (candidate === "~") return home;
|
|
10711
|
-
if (!candidate.startsWith(`~${path.sep}`) && !candidate.startsWith("~/")) return candidate;
|
|
10712
|
-
return path.join(home, candidate.slice(2));
|
|
10713
|
-
}
|
|
10714
|
-
function resolveHomeDir$1(env, homeDir) {
|
|
10715
|
-
return rawTextOr(env.HOME, null) || rawTextOr(env.USERPROFILE, null) || homeDir;
|
|
10716
|
-
}
|
|
10717
|
-
function uniqueStrings(values) {
|
|
10718
|
-
return Array.from(new Set(values));
|
|
10719
|
-
}
|
|
10720
|
-
function passOutcome({ byteLimited, ioFailures }) {
|
|
10721
|
-
if (ioFailures > 0) return "io-failed";
|
|
10722
|
-
if (byteLimited) return "byte-limited";
|
|
10723
|
-
return "complete";
|
|
10724
|
-
}
|
|
10725
|
-
function shouldPersistWarehouse({ outcome, storeReset }) {
|
|
10726
|
-
if (outcome === "complete") return true;
|
|
10727
|
-
if (outcome === "byte-limited") return false;
|
|
10728
|
-
return !storeReset;
|
|
10729
|
-
}
|
|
10730
|
-
function continuationDelayMs({ outcome, ioFailureStreak, partialMs }) {
|
|
10731
|
-
if (outcome === "complete") return null;
|
|
10732
|
-
if (outcome === "byte-limited") return partialMs;
|
|
10733
|
-
return nextBackoffMs({
|
|
10734
|
-
attempt: ioFailureStreak,
|
|
10735
|
-
baseMs: 3e4,
|
|
10736
|
-
maxMs: 3e5
|
|
10737
|
-
});
|
|
10738
|
-
}
|
|
10739
|
-
function shouldEvaluateDespiteIoFailures({ ioFailureStreak, limit }) {
|
|
10740
|
-
if (!Number.isFinite(ioFailureStreak) || !Number.isFinite(limit)) return false;
|
|
10741
|
-
if (limit <= 0) return false;
|
|
10742
|
-
return ioFailureStreak >= limit;
|
|
10743
|
-
}
|
|
10744
|
-
function vendorHomes(env, varName, defaultDirName, homeDir) {
|
|
10745
|
-
const rawOverride = env?.[varName];
|
|
10746
|
-
const override = typeof rawOverride === "string" ? rawOverride.trim() : "";
|
|
10747
|
-
if (override) return normalizeHomeCandidates(override.split(","), env, homeDir);
|
|
10748
|
-
const home = resolveHomeDir$1(env, homeDir);
|
|
10749
|
-
if (!home) return [];
|
|
10750
|
-
return [path.join(home, defaultDirName)];
|
|
10751
|
-
}
|
|
10752
|
-
function codexHomes(env = process.env, homeDir = null) {
|
|
10753
|
-
return vendorHomes(env, "CODEX_HOME", ".codex", homeDir);
|
|
10754
|
-
}
|
|
10755
|
-
function grokHomes(env = process.env, homeDir = null) {
|
|
10756
|
-
return vendorHomes(env, "GROK_HOME", ".grok", homeDir);
|
|
10757
|
-
}
|
|
10758
|
-
function codexRootCandidates(homes) {
|
|
10759
|
-
const candidates = [];
|
|
10760
|
-
for (const home of homes) {
|
|
10761
|
-
candidates.push({
|
|
10762
|
-
dir: path.join(home, "sessions"),
|
|
10763
|
-
kind: "active",
|
|
10764
|
-
home
|
|
10765
|
-
});
|
|
10766
|
-
candidates.push({
|
|
10767
|
-
dir: path.join(home, "archived_sessions"),
|
|
10768
|
-
kind: "archived",
|
|
10769
|
-
home
|
|
10770
|
-
});
|
|
10771
|
-
}
|
|
10772
|
-
return candidates;
|
|
10773
|
-
}
|
|
10774
|
-
function codexFallbackRoots(homes, survivingRoots) {
|
|
10775
|
-
const covered = new Set(survivingRoots.map((root) => root.home));
|
|
10776
|
-
return homes.filter((home) => !covered.has(home)).map((home) => ({
|
|
10777
|
-
dir: home,
|
|
10778
|
-
kind: "flat",
|
|
10779
|
-
home
|
|
10780
|
-
}));
|
|
10781
|
-
}
|
|
10782
|
-
function grokRootCandidates(homes) {
|
|
10783
|
-
return homes.map((home) => ({
|
|
10784
|
-
dir: path.join(home, "sessions"),
|
|
10785
|
-
kind: "active",
|
|
10786
|
-
home
|
|
10787
|
-
}));
|
|
10788
|
-
}
|
|
10789
|
-
var GROK_USAGE_FILENAME = "updates.jsonl";
|
|
10790
|
-
function isUsageFile(vendor, fileName) {
|
|
10791
|
-
if (typeof fileName !== "string") return false;
|
|
10792
|
-
if (vendor === "grok") return fileName === GROK_USAGE_FILENAME;
|
|
10793
|
-
return fileName.endsWith(".jsonl");
|
|
10794
|
-
}
|
|
10795
|
-
function dedupeCodexFiles(files) {
|
|
10796
|
-
const byName = /* @__PURE__ */ new Map();
|
|
10797
|
-
for (const file of files) {
|
|
10798
|
-
const name = path.basename(file.file);
|
|
10799
|
-
const existing = byName.get(name);
|
|
10800
|
-
if (!existing) {
|
|
10801
|
-
byName.set(name, file);
|
|
10802
|
-
continue;
|
|
10803
|
-
}
|
|
10804
|
-
if (existing.kind === "archived" && file.kind !== "archived") byName.set(name, file);
|
|
10805
|
-
}
|
|
10806
|
-
return Array.from(byName.values());
|
|
10807
|
-
}
|
|
10808
|
-
function codexSessionIdFromPath(filePath) {
|
|
10809
|
-
const base = path.basename(String(filePath || ""), ".jsonl");
|
|
10810
|
-
const match = /([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/.exec(base);
|
|
10811
|
-
if (match) return match[1];
|
|
10812
|
-
return base || null;
|
|
10813
|
-
}
|
|
10814
|
-
//#endregion
|
|
10815
10684
|
//#region session/core/commit-signing-env.ts
|
|
10816
10685
|
var GIT_CONFIG_PARAMETERS_ENV = "GIT_CONFIG_PARAMETERS";
|
|
10817
10686
|
function singleQuoteForGit(text) {
|
|
@@ -11629,13 +11498,16 @@ function pushDecision(log, entry, cap = 60) {
|
|
|
11629
11498
|
if (log.length > cap) log.splice(0, log.length - cap);
|
|
11630
11499
|
return "appended";
|
|
11631
11500
|
}
|
|
11501
|
+
//#endregion
|
|
11502
|
+
//#region session/session-observability.ts
|
|
11503
|
+
var AUDIT_LOG_MAX = 200;
|
|
11632
11504
|
function createSessionObservability({ agentId, getRecorder }) {
|
|
11633
11505
|
const auditLog = [];
|
|
11634
11506
|
const decisions = [];
|
|
11635
11507
|
function pushAuditEntry(entry) {
|
|
11636
11508
|
auditLog.push(entry);
|
|
11637
|
-
if (auditLog.length <=
|
|
11638
|
-
auditLog.splice(0, auditLog.length -
|
|
11509
|
+
if (auditLog.length <= AUDIT_LOG_MAX) return;
|
|
11510
|
+
auditLog.splice(0, auditLog.length - AUDIT_LOG_MAX);
|
|
11639
11511
|
}
|
|
11640
11512
|
function recordDecision(entry) {
|
|
11641
11513
|
const stamped = agentId === DEFAULT_AGENT_ID ? entry : {
|
|
@@ -11950,7 +11822,7 @@ function createSessionOutput(options) {
|
|
|
11950
11822
|
};
|
|
11951
11823
|
}
|
|
11952
11824
|
//#endregion
|
|
11953
|
-
//#region server/core/ingest-shell-core.ts
|
|
11825
|
+
//#region server/ingest/core/ingest-shell-core.ts
|
|
11954
11826
|
var SOURCE$4 = "shellHistory";
|
|
11955
11827
|
var SHELLS = Object.freeze([
|
|
11956
11828
|
"powershell",
|
|
@@ -12629,7 +12501,7 @@ function createSessionHookLifecycle(options) {
|
|
|
12629
12501
|
};
|
|
12630
12502
|
}
|
|
12631
12503
|
//#endregion
|
|
12632
|
-
//#region server/core/lane-permissions-core.ts
|
|
12504
|
+
//#region server/lanes/core/lane-permissions-core.ts
|
|
12633
12505
|
var ACCEPT_EDITS_MODE = "acceptEdits";
|
|
12634
12506
|
var LANE_CONFIG_EDIT_DENY_RULES = Object.freeze(["Edit(**/.git/**)", "Edit(**/.claude/**)"]);
|
|
12635
12507
|
var LANE_ENVIRONMENT_ARGS = Object.freeze([
|
|
@@ -12661,7 +12533,7 @@ function buildLanePermissions({ denyTools = [], allowTools = [] } = {}) {
|
|
|
12661
12533
|
};
|
|
12662
12534
|
}
|
|
12663
12535
|
//#endregion
|
|
12664
|
-
//#region server/core/factory-core.ts
|
|
12536
|
+
//#region server/factory/core/factory-core.ts
|
|
12665
12537
|
var FACTORY_NOTIFY_CATEGORY = "factory";
|
|
12666
12538
|
var FACTORY_LEDGER_SESSION = "glimmervoid-factory";
|
|
12667
12539
|
var FACTORY_TICK_INTERVAL_MS = 1e4;
|
|
@@ -13638,7 +13510,7 @@ function buildVerifierPrompt({ projectName, intent, children, tipSha, checkoutPa
|
|
|
13638
13510
|
].join("\n");
|
|
13639
13511
|
}
|
|
13640
13512
|
//#endregion
|
|
13641
|
-
//#region server/core/git-invocation-core.ts
|
|
13513
|
+
//#region server/git/core/git-invocation-core.ts
|
|
13642
13514
|
var GIT_CONFIG_LISTING_ARGS = Object.freeze([
|
|
13643
13515
|
"config",
|
|
13644
13516
|
"--null",
|
|
@@ -14028,7 +13900,7 @@ function proveMergedAcrossTips(probes) {
|
|
|
14028
13900
|
return mostCautiousProof;
|
|
14029
13901
|
}
|
|
14030
13902
|
//#endregion
|
|
14031
|
-
//#region server/core/sandbox-policy-core.ts
|
|
13903
|
+
//#region server/sandbox/core/sandbox-policy-core.ts
|
|
14032
13904
|
var VENDOR_PROFILES = Object.freeze({
|
|
14033
13905
|
claude: {
|
|
14034
13906
|
homeEntries: [".claude", ".claude.json"],
|
|
@@ -14092,6 +13964,7 @@ var CLOUD_CREDENTIAL_HOME_ENTRIES = Object.freeze([
|
|
|
14092
13964
|
".netrc",
|
|
14093
13965
|
".npmrc"
|
|
14094
13966
|
]);
|
|
13967
|
+
var STANDARD_LEVEL_USABLE_CREDENTIAL_ENTRIES = Object.freeze(["Library/Keychains"]);
|
|
14095
13968
|
var XDG_CONFIG_DEFAULT_HOME_PREFIX = ".config/";
|
|
14096
13969
|
var SHARED_TEMP_DIRS = Object.freeze(["/tmp/claude", "/private/tmp/claude"]);
|
|
14097
13970
|
var SHARED_HOME_WRITE_ENTRIES = Object.freeze([".npm/_logs"]);
|
|
@@ -14158,6 +14031,11 @@ var RUNTIME_MANDATORY_CLAUDE_DENY_FOLDERS = Object.freeze(["commands", "agents"]
|
|
|
14158
14031
|
var SANDBOXED_PROXY_BYPASS = "localhost,::1,169.254.0.0/16,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16";
|
|
14159
14032
|
var HOOK_LOOPBACK_HOST = "127.0.0.1";
|
|
14160
14033
|
var AGENT_SESSION_ID_SHAPE = /^[A-Za-z0-9][A-Za-z0-9_-]{7,127}$/;
|
|
14034
|
+
var STANDARD_OPEN_NETWORK = Object.freeze({
|
|
14035
|
+
allowAllUnixSockets: true,
|
|
14036
|
+
allowMachLookup: ["*"]
|
|
14037
|
+
});
|
|
14038
|
+
var STRICT_OPEN_NETWORK = Object.freeze({ allowAllUnixSockets: false });
|
|
14161
14039
|
function unique(entries) {
|
|
14162
14040
|
return [...new Set(entries)];
|
|
14163
14041
|
}
|
|
@@ -14275,8 +14153,13 @@ function relocatedXdgConfigPaths(host, homeEntries) {
|
|
|
14275
14153
|
function isStandardLevel(role) {
|
|
14276
14154
|
return role.guardrailLevel === "standard";
|
|
14277
14155
|
}
|
|
14278
|
-
function
|
|
14156
|
+
function blockedCredentialHomeEntries(role) {
|
|
14279
14157
|
const credentialHomeEntries = [...CREDENTIAL_HOME_ENTRIES, ...CLOUD_CREDENTIAL_HOME_ENTRIES];
|
|
14158
|
+
if (!isStandardLevel(role)) return credentialHomeEntries;
|
|
14159
|
+
return credentialHomeEntries.filter((entry) => !STANDARD_LEVEL_USABLE_CREDENTIAL_ENTRIES.includes(entry));
|
|
14160
|
+
}
|
|
14161
|
+
function credentialWriteBlocks(role, host) {
|
|
14162
|
+
const credentialHomeEntries = blockedCredentialHomeEntries(role);
|
|
14280
14163
|
return [...homePaths(host, credentialHomeEntries), ...relocatedXdgConfigPaths(host, credentialHomeEntries)];
|
|
14281
14164
|
}
|
|
14282
14165
|
function glimmervoidStateWriteBlocks(role, host) {
|
|
@@ -14297,7 +14180,7 @@ function glimmervoidStateWriteBlocks(role, host) {
|
|
|
14297
14180
|
function standardWriteBlockCandidates(role, host) {
|
|
14298
14181
|
if (!isStandardLevel(role)) return [];
|
|
14299
14182
|
return unique([
|
|
14300
|
-
...credentialWriteBlocks(host),
|
|
14183
|
+
...credentialWriteBlocks(role, host),
|
|
14301
14184
|
...glimmervoidStateWriteBlocks(role, host),
|
|
14302
14185
|
...role.blockedPaths ?? []
|
|
14303
14186
|
]);
|
|
@@ -14305,7 +14188,7 @@ function standardWriteBlockCandidates(role, host) {
|
|
|
14305
14188
|
function readDeniedPaths(role, host) {
|
|
14306
14189
|
const otherVendors = SANDBOX_VENDORS.filter((vendor) => !role.vendors.includes(vendor));
|
|
14307
14190
|
const otherVendorHomeEntries = [...otherVendors.flatMap((vendor) => VENDOR_PROFILES[vendor].homeEntries), ...UNWRAPPED_VENDOR_HOME_ENTRIES];
|
|
14308
|
-
const credentialHomeEntries =
|
|
14191
|
+
const credentialHomeEntries = blockedCredentialHomeEntries(role);
|
|
14309
14192
|
return [
|
|
14310
14193
|
...homePaths(host, [
|
|
14311
14194
|
...credentialHomeEntries,
|
|
@@ -14364,7 +14247,7 @@ function sandboxRoleRefusal(role, host) {
|
|
|
14364
14247
|
return null;
|
|
14365
14248
|
}
|
|
14366
14249
|
function networkPolicy(role) {
|
|
14367
|
-
if (role.network.access === "open") return {
|
|
14250
|
+
if (role.network.access === "open") return isStandardLevel(role) ? { ...STANDARD_OPEN_NETWORK } : { ...STRICT_OPEN_NETWORK };
|
|
14368
14251
|
if (role.network.access === "none") return {
|
|
14369
14252
|
allowedDomains: [],
|
|
14370
14253
|
deniedDomains: [],
|
|
@@ -14425,7 +14308,9 @@ function buildSandboxLaunchPlan(role, host) {
|
|
|
14425
14308
|
denyRead: literalEntries(readDenied),
|
|
14426
14309
|
allowRead: literalEntries([...writableWithinDenied, ...role.readableWithinDenied]),
|
|
14427
14310
|
...filesystemWrites(role, host, writablePaths)
|
|
14428
|
-
}
|
|
14311
|
+
},
|
|
14312
|
+
terminalScope: isStandardLevel(role) ? "any" : "own",
|
|
14313
|
+
allowAppleEvents: isStandardLevel(role)
|
|
14429
14314
|
},
|
|
14430
14315
|
launchEnv: Object.assign({ CLAUDE_CODE_TMPDIR: host.tempDir }, ...role.vendors.map((vendor) => VENDOR_PROFILES[vendor].launchEnv), launchHomeEnv(role, host)),
|
|
14431
14316
|
sandboxedEnv: sandboxedEnvFor(role, host),
|
|
@@ -14473,33 +14358,6 @@ function parseTagVersion(ref) {
|
|
|
14473
14358
|
if (!matched) return null;
|
|
14474
14359
|
return matched[1];
|
|
14475
14360
|
}
|
|
14476
|
-
function parseLsRemoteTags(stdout) {
|
|
14477
|
-
if (typeof stdout !== "string") return null;
|
|
14478
|
-
const tagsByVersion = /* @__PURE__ */ new Map();
|
|
14479
|
-
for (const line of stdout.split("\n")) {
|
|
14480
|
-
const fields = line.trim().split(/\s+/);
|
|
14481
|
-
if (fields.length < 2) continue;
|
|
14482
|
-
const sha = normalizeSha(fields[0]);
|
|
14483
|
-
if (!sha) continue;
|
|
14484
|
-
const ref = fields[1];
|
|
14485
|
-
const version = parseTagVersion(ref);
|
|
14486
|
-
if (!version) continue;
|
|
14487
|
-
if (tagsByVersion.get(version) && !ref.endsWith("^{}")) continue;
|
|
14488
|
-
tagsByVersion.set(version, {
|
|
14489
|
-
version,
|
|
14490
|
-
sha
|
|
14491
|
-
});
|
|
14492
|
-
}
|
|
14493
|
-
let latest = null;
|
|
14494
|
-
for (const entry of tagsByVersion.values()) {
|
|
14495
|
-
if (!latest) {
|
|
14496
|
-
latest = entry;
|
|
14497
|
-
continue;
|
|
14498
|
-
}
|
|
14499
|
-
if (compareSemver(entry.version, latest.version) > 0) latest = entry;
|
|
14500
|
-
}
|
|
14501
|
-
return latest;
|
|
14502
|
-
}
|
|
14503
14361
|
function isNpxCachePath(packageRoot) {
|
|
14504
14362
|
if (typeof packageRoot !== "string") return false;
|
|
14505
14363
|
return packageRoot.split(/[\\/]/).includes(NPX_CACHE_DIRECTORY_NAME);
|
|
@@ -14574,19 +14432,6 @@ function compareSemver(a, b) {
|
|
|
14574
14432
|
}
|
|
14575
14433
|
return 0;
|
|
14576
14434
|
}
|
|
14577
|
-
function parseLatestReleaseTag(doc) {
|
|
14578
|
-
if (!doc || typeof doc !== "object") return null;
|
|
14579
|
-
const version = parseTagVersion(doc.tag_name);
|
|
14580
|
-
if (!version) return null;
|
|
14581
|
-
return {
|
|
14582
|
-
version,
|
|
14583
|
-
sha: null
|
|
14584
|
-
};
|
|
14585
|
-
}
|
|
14586
|
-
function decideReleaseSource(flavor) {
|
|
14587
|
-
if (flavor === "npm-global" || flavor === "npx") return "npm-registry";
|
|
14588
|
-
return "github-tags";
|
|
14589
|
-
}
|
|
14590
14435
|
function parseRegistryLatest(doc) {
|
|
14591
14436
|
if (!doc || typeof doc !== "object") return null;
|
|
14592
14437
|
const registryDocument = doc;
|
|
@@ -14652,7 +14497,7 @@ function isCheckFresh(lastCheckAt, nowMs, ttlMs) {
|
|
|
14652
14497
|
return age < Number(ttlMs);
|
|
14653
14498
|
}
|
|
14654
14499
|
//#endregion
|
|
14655
|
-
//#region server/git-workspace.ts
|
|
14500
|
+
//#region server/git/git-workspace.ts
|
|
14656
14501
|
var fsp$1 = fs.promises;
|
|
14657
14502
|
var MERGE_PROBE_TIMEOUT_MS = 3e4;
|
|
14658
14503
|
var REMOTE_REF_PREFIX = "refs/remotes/origin/";
|
|
@@ -17122,12 +16967,12 @@ function buildMergePrompt({ branch, target, reason, conflicts = [], worktreeDir
|
|
|
17122
16967
|
for (const f of files) lines.push(` - ${f}`);
|
|
17123
16968
|
}
|
|
17124
16969
|
lines.push("");
|
|
16970
|
+
lines.push("Only rebase this session branch; do not force-push or rewrite any shared history.");
|
|
16971
|
+
lines.push("");
|
|
17125
16972
|
lines.push(`Glimmervoid merges by rebasing "${br}" onto ${tgt} and then fast-forwarding ${tgt}. To unblock it:`);
|
|
17126
16973
|
lines.push(` 1. From this worktree${worktreeDir ? ` (${worktreeDir})` : ""}, run: git rebase ${tgt}`);
|
|
17127
16974
|
lines.push(` 2. Resolve the conflicts${files.length ? " in the files listed above" : ""}, then: git add the resolved files and git rebase --continue.`);
|
|
17128
|
-
lines.push(" 3. When the working tree is clean and rebased,
|
|
17129
|
-
lines.push("");
|
|
17130
|
-
lines.push("Only rebase this session branch; do not force-push or rewrite any shared history.");
|
|
16975
|
+
lines.push(" 3. When the working tree is clean and rebased, run: glimmervoid push. If it answers no, do what its reply says; when the reply leaves nothing this session can do, say the work is ready and leave the merge to the operator.");
|
|
17131
16976
|
return lines.join("\n");
|
|
17132
16977
|
}
|
|
17133
16978
|
//#endregion
|
|
@@ -17269,6 +17114,10 @@ function planWorkspaceMembers({ folder, sessionId, repoPaths }) {
|
|
|
17269
17114
|
}
|
|
17270
17115
|
};
|
|
17271
17116
|
}
|
|
17117
|
+
function listDroppedRepoPaths(previousRepoPaths, nextRepoPaths) {
|
|
17118
|
+
const nextRepoKeys = new Set(nextRepoPaths.map((repoPath) => caseFoldedPathKey(path.resolve(repoPath))));
|
|
17119
|
+
return previousRepoPaths.filter((repoPath) => !nextRepoKeys.has(caseFoldedPathKey(path.resolve(repoPath))));
|
|
17120
|
+
}
|
|
17272
17121
|
function renderWorkspaceAgentsMd({ sessionName, branch, members }) {
|
|
17273
17122
|
const lines = [
|
|
17274
17123
|
`# ${sessionName}`,
|
|
@@ -17291,6 +17140,34 @@ async function writeWhenAbsent(filePath, contents) {
|
|
|
17291
17140
|
if (error.code !== "EEXIST") throw error;
|
|
17292
17141
|
});
|
|
17293
17142
|
}
|
|
17143
|
+
var WORKSPACE_MAP_FILE = "AGENTS.md";
|
|
17144
|
+
var WORKSPACE_POINTER_FILE = "CLAUDE.md";
|
|
17145
|
+
var WORKSPACE_MAP_HASH_FILE = ".glimmervoid-map-hash";
|
|
17146
|
+
var GENERATED_WORKSPACE_FILES = /* @__PURE__ */ new Set([
|
|
17147
|
+
WORKSPACE_MAP_FILE,
|
|
17148
|
+
WORKSPACE_POINTER_FILE,
|
|
17149
|
+
WORKSPACE_MAP_HASH_FILE
|
|
17150
|
+
]);
|
|
17151
|
+
function hashWorkspaceMap(contents) {
|
|
17152
|
+
return crypto.createHash("sha256").update(contents).digest("hex");
|
|
17153
|
+
}
|
|
17154
|
+
async function readWhenPresent(filePath) {
|
|
17155
|
+
return fs.promises.readFile(filePath, "utf8").catch((error) => {
|
|
17156
|
+
if (error.code === "ENOENT") return null;
|
|
17157
|
+
throw error;
|
|
17158
|
+
});
|
|
17159
|
+
}
|
|
17160
|
+
async function writeWorkspaceMap(folder, contents) {
|
|
17161
|
+
const mapPath = path.join(folder, WORKSPACE_MAP_FILE);
|
|
17162
|
+
const hashPath = path.join(folder, WORKSPACE_MAP_HASH_FILE);
|
|
17163
|
+
const existingMap = await readWhenPresent(mapPath);
|
|
17164
|
+
const recordedHash = (await readWhenPresent(hashPath))?.trim() ?? null;
|
|
17165
|
+
const renderedHash = hashWorkspaceMap(contents);
|
|
17166
|
+
if (existingMap !== null && existingMap !== contents && hashWorkspaceMap(existingMap) !== recordedHash) return;
|
|
17167
|
+
if (existingMap === contents && recordedHash === renderedHash) return;
|
|
17168
|
+
await fs.promises.writeFile(mapPath, contents);
|
|
17169
|
+
await fs.promises.writeFile(hashPath, `${renderedHash}\n`);
|
|
17170
|
+
}
|
|
17294
17171
|
function createSessionWorkspaceMembers({ plan, sessionName, shareList, gitWorkspace }) {
|
|
17295
17172
|
let activeProvision = null;
|
|
17296
17173
|
async function provisionBody() {
|
|
@@ -17313,12 +17190,12 @@ function createSessionWorkspaceMembers({ plan, sessionName, shareList, gitWorksp
|
|
|
17313
17190
|
base: ensured.base
|
|
17314
17191
|
});
|
|
17315
17192
|
}
|
|
17316
|
-
await
|
|
17193
|
+
await writeWorkspaceMap(plan.folder, renderWorkspaceAgentsMd({
|
|
17317
17194
|
sessionName,
|
|
17318
17195
|
branch: plan.branch,
|
|
17319
17196
|
members
|
|
17320
17197
|
}));
|
|
17321
|
-
await writeWhenAbsent(path.join(plan.folder,
|
|
17198
|
+
await writeWhenAbsent(path.join(plan.folder, WORKSPACE_POINTER_FILE), WORKSPACE_CLAUDE_MD);
|
|
17322
17199
|
return {
|
|
17323
17200
|
ok: true,
|
|
17324
17201
|
members
|
|
@@ -17339,10 +17216,12 @@ function createSessionWorkspaceMembers({ plan, sessionName, shareList, gitWorksp
|
|
|
17339
17216
|
});
|
|
17340
17217
|
return attempt;
|
|
17341
17218
|
}
|
|
17342
|
-
async function release() {
|
|
17219
|
+
async function release({ keepRepoPaths = [] } = {}) {
|
|
17343
17220
|
if (activeProvision) await activeProvision;
|
|
17221
|
+
const keptRepoKeys = new Set(keepRepoPaths.map((repoPath) => caseFoldedPathKey(path.resolve(repoPath))));
|
|
17344
17222
|
const keptDirs = [];
|
|
17345
17223
|
for (const member of plan.members) {
|
|
17224
|
+
if (keptRepoKeys.has(caseFoldedPathKey(member.repoPath))) continue;
|
|
17346
17225
|
if (!await fs.promises.stat(member.dir).then(() => true, () => false)) continue;
|
|
17347
17226
|
if (!(await gitWorkspace.removeWorkspaceMember({
|
|
17348
17227
|
projectPath: member.repoPath,
|
|
@@ -17351,7 +17230,7 @@ function createSessionWorkspaceMembers({ plan, sessionName, shareList, gitWorksp
|
|
|
17351
17230
|
})).ok) keptDirs.push(member.dir);
|
|
17352
17231
|
}
|
|
17353
17232
|
const entries = await fs.promises.readdir(plan.folder).catch(() => []);
|
|
17354
|
-
if (entries.some((entry) =>
|
|
17233
|
+
if (entries.some((entry) => !GENERATED_WORKSPACE_FILES.has(entry))) return { keptDirs };
|
|
17355
17234
|
for (const entry of entries) await fs.promises.rm(path.join(plan.folder, entry), { force: true });
|
|
17356
17235
|
await fs.promises.rmdir(plan.folder).catch(() => {});
|
|
17357
17236
|
return { keptDirs };
|
|
@@ -17362,6 +17241,9 @@ function createSessionWorkspaceMembers({ plan, sessionName, shareList, gitWorksp
|
|
|
17362
17241
|
branch: plan.branch
|
|
17363
17242
|
};
|
|
17364
17243
|
}
|
|
17244
|
+
//#endregion
|
|
17245
|
+
//#region session/session-worktree-lifecycle.ts
|
|
17246
|
+
var WORKTREE_CHECK_DEBOUNCE_MS = 400;
|
|
17365
17247
|
var GIT_NOT_FOUND_EXIT_CODE = 1;
|
|
17366
17248
|
async function readGitStrict(args, options) {
|
|
17367
17249
|
const command = await runGit(args, {
|
|
@@ -17476,7 +17358,7 @@ function createSessionWorktreeLifecycle({ id, projectPath, integrationBranch = n
|
|
|
17476
17358
|
rerereWatcher: null,
|
|
17477
17359
|
checkTimer: createCoalescedTimer({
|
|
17478
17360
|
mode: "leading",
|
|
17479
|
-
delayMs:
|
|
17361
|
+
delayMs: WORKTREE_CHECK_DEBOUNCE_MS,
|
|
17480
17362
|
run: () => {
|
|
17481
17363
|
api.checkWorktreeChange().catch(recordWorktreeCheckFailure);
|
|
17482
17364
|
}
|
|
@@ -17513,6 +17395,9 @@ function createSessionWorktreeLifecycle({ id, projectPath, integrationBranch = n
|
|
|
17513
17395
|
base: lifecycleState.workspace.base || null
|
|
17514
17396
|
};
|
|
17515
17397
|
}
|
|
17398
|
+
function hasOwnWorktree() {
|
|
17399
|
+
return Boolean(gitWorkspace && lifecycleState.workspace);
|
|
17400
|
+
}
|
|
17516
17401
|
function setMergeStatus(status, detail = {}, { emit = true } = {}) {
|
|
17517
17402
|
Object.assign(lifecycleState, projectMergeState(status, detail));
|
|
17518
17403
|
if (!emit) return;
|
|
@@ -17825,10 +17710,14 @@ function createSessionWorktreeLifecycle({ id, projectPath, integrationBranch = n
|
|
|
17825
17710
|
lifecycleState.isWorktree = false;
|
|
17826
17711
|
setMergeStatus(status);
|
|
17827
17712
|
}
|
|
17828
|
-
async function releaseWorkspaceMembers(members) {
|
|
17829
|
-
const released = await members.release();
|
|
17713
|
+
async function releaseWorkspaceMembers(members, keepRepoPaths = []) {
|
|
17714
|
+
const released = await members.release({ keepRepoPaths });
|
|
17830
17715
|
if (released.keptDirs.length > 0) console.warn(`[session ${id}] kept workspace members with uncommitted work: ${released.keptDirs.join(", ")}`);
|
|
17831
17716
|
}
|
|
17717
|
+
async function releaseDroppedWorkspaceMembers(keepRepoPaths) {
|
|
17718
|
+
if (!workspaceMembers?.ok) return;
|
|
17719
|
+
await releaseWorkspaceMembers(workspaceMembers.members, keepRepoPaths);
|
|
17720
|
+
}
|
|
17832
17721
|
async function discardWorktree() {
|
|
17833
17722
|
if (workspaceMembers?.ok) return releaseWorkspaceMembers(workspaceMembers.members);
|
|
17834
17723
|
stopWatching();
|
|
@@ -18580,6 +18469,7 @@ function createSessionWorktreeLifecycle({ id, projectPath, integrationBranch = n
|
|
|
18580
18469
|
const api = {
|
|
18581
18470
|
snapshot,
|
|
18582
18471
|
getCarry,
|
|
18472
|
+
hasOwnWorktree,
|
|
18583
18473
|
effectiveCwd,
|
|
18584
18474
|
refreshGitContext,
|
|
18585
18475
|
provision,
|
|
@@ -18601,7 +18491,8 @@ function createSessionWorktreeLifecycle({ id, projectPath, integrationBranch = n
|
|
|
18601
18491
|
mergeWorktree,
|
|
18602
18492
|
mergeAndContinue,
|
|
18603
18493
|
adoptWorktree,
|
|
18604
|
-
discardWorktree
|
|
18494
|
+
discardWorktree,
|
|
18495
|
+
releaseDroppedWorkspaceMembers
|
|
18605
18496
|
};
|
|
18606
18497
|
return api;
|
|
18607
18498
|
}
|
|
@@ -19106,6 +18997,7 @@ var Session = class extends EventEmitter {
|
|
|
19106
18997
|
_initialPrompt;
|
|
19107
18998
|
_extraClaudeArgs;
|
|
19108
18999
|
_resumeSessionId;
|
|
19000
|
+
workspaceRepos;
|
|
19109
19001
|
_transcriptPath;
|
|
19110
19002
|
_lastClaudeSessionReport;
|
|
19111
19003
|
_suppressResumeCapture;
|
|
@@ -19119,10 +19011,10 @@ var Session = class extends EventEmitter {
|
|
|
19119
19011
|
_hooks;
|
|
19120
19012
|
_agentDepth;
|
|
19121
19013
|
_agentToken;
|
|
19122
|
-
_agentApiEnabled;
|
|
19123
19014
|
_commitSigningProgram;
|
|
19124
19015
|
_commitSigningToken;
|
|
19125
19016
|
_factoryRole;
|
|
19017
|
+
_canRunHelpCommand;
|
|
19126
19018
|
_agentLiveChildren;
|
|
19127
19019
|
_agentLifetimeSpawns;
|
|
19128
19020
|
_agentSpawnsInFlight;
|
|
@@ -19137,7 +19029,7 @@ var Session = class extends EventEmitter {
|
|
|
19137
19029
|
_resizeSeq;
|
|
19138
19030
|
_titleSource;
|
|
19139
19031
|
_statusSource;
|
|
19140
|
-
constructor({ customTitle, id, name, path: projectPath, dangerouslySkipPermissions = false, replayBufferKB = 512, hookRouter = null, getHookPort = null, hooksBaseDir = void 0, titleStabilizationMs = 1500, statusConflictMs = void 0, statusDedupMs = void 0, detectBackgroundAgents = true, agentTtlMs = DEFAULT_AGENT_TTL_MS, shellTaskTtlMs = DEFAULT_SHELL_TASK_TTL_MS, teammateTaskTtlMs = DEFAULT_TEAMMATE_TASK_TTL_MS, gateReleaseSettleMs = DEFAULT_GATE_RELEASE_SETTLE_MS, detectScheduledWakeups = true, observeToolCalls = false, agent = DEFAULT_AGENT_ID, adapter = null, bypassHookTrust = false, titleQuietFallbackMs = 3e4, spawnCommand = null, initialPrompt = null, extraClaudeArgs = [], ephemeral = false, resumeSessionId = null, taskTitleState = void 0, settingsPermissions = null, settingsSandbox = null, prepareSandbox = null, spawnEnv = null, prependPathDirs = [], enableProjectMcp = false, hookTools = [], getHookTools = null, planReviewPort = null, planLimits = false, getUserHooks = null, extraUserHooks = [], ptySpawn = null, requireWorktree = false, screenKeeperFactory = null, killProc = null, signalProc = null, platform = process.platform, gitWorkspace = null, gitIsolation, integrationBranch = null, autoRebase = true, syncOnStart = true, liveWorktreeReview = true, worktreeRoot = null, worktreeShare = null, workspaceRepos = void 0, agentDepth = 0,
|
|
19032
|
+
constructor({ customTitle, id, name, path: projectPath, dangerouslySkipPermissions = false, replayBufferKB = 512, hookRouter = null, getHookPort = null, hooksBaseDir = void 0, titleStabilizationMs = 1500, statusConflictMs = void 0, statusDedupMs = void 0, detectBackgroundAgents = true, agentTtlMs = DEFAULT_AGENT_TTL_MS, shellTaskTtlMs = DEFAULT_SHELL_TASK_TTL_MS, teammateTaskTtlMs = DEFAULT_TEAMMATE_TASK_TTL_MS, gateReleaseSettleMs = DEFAULT_GATE_RELEASE_SETTLE_MS, detectScheduledWakeups = true, observeToolCalls = false, agent = DEFAULT_AGENT_ID, adapter = null, bypassHookTrust = false, titleQuietFallbackMs = 3e4, spawnCommand = null, initialPrompt = null, extraClaudeArgs = [], ephemeral = false, resumeSessionId = null, taskTitleState = void 0, settingsPermissions = null, settingsSandbox = null, prepareSandbox = null, spawnEnv = null, prependPathDirs = [], enableProjectMcp = false, hookTools = [], getHookTools = null, planReviewPort = null, planLimits = false, getUserHooks = null, extraUserHooks = [], ptySpawn = null, requireWorktree = false, screenKeeperFactory = null, killProc = null, signalProc = null, platform = process.platform, gitWorkspace = null, gitIsolation, integrationBranch = null, autoRebase = true, syncOnStart = true, liveWorktreeReview = true, worktreeRoot = null, worktreeShare = null, workspaceRepos = void 0, agentDepth = 0, commitSigningProgram = null, factoryRole = null }) {
|
|
19141
19033
|
super();
|
|
19142
19034
|
this.id = id;
|
|
19143
19035
|
this.name = name;
|
|
@@ -19239,6 +19131,7 @@ var Session = class extends EventEmitter {
|
|
|
19239
19131
|
this._initialPrompt = initialPrompt;
|
|
19240
19132
|
this._extraClaudeArgs = Array.isArray(extraClaudeArgs) ? extraClaudeArgs : [];
|
|
19241
19133
|
this._resumeSessionId = resumeSessionId || null;
|
|
19134
|
+
this.workspaceRepos = workspaceRepos ? [...workspaceRepos] : null;
|
|
19242
19135
|
this._transcriptPath = null;
|
|
19243
19136
|
this._lastClaudeSessionReport = null;
|
|
19244
19137
|
this._suppressResumeCapture = false;
|
|
@@ -19281,10 +19174,10 @@ var Session = class extends EventEmitter {
|
|
|
19281
19174
|
});
|
|
19282
19175
|
this._agentDepth = agentDepth;
|
|
19283
19176
|
this._agentToken = generateToken();
|
|
19284
|
-
this._agentApiEnabled = agentApi === true;
|
|
19285
19177
|
this._commitSigningProgram = commitSigningProgram;
|
|
19286
19178
|
this._commitSigningToken = commitSigningProgram === null ? null : generateToken();
|
|
19287
19179
|
this._factoryRole = factoryRole;
|
|
19180
|
+
this._canRunHelpCommand = permitsHelpCommand(settingsPermissions);
|
|
19288
19181
|
this._agentLiveChildren = 0;
|
|
19289
19182
|
this._agentLifetimeSpawns = 0;
|
|
19290
19183
|
this._agentSpawnsInFlight = 0;
|
|
@@ -19683,7 +19576,7 @@ var Session = class extends EventEmitter {
|
|
|
19683
19576
|
return this._factoryRole;
|
|
19684
19577
|
}
|
|
19685
19578
|
_agentApiEnv() {
|
|
19686
|
-
if (!this.
|
|
19579
|
+
if (!this._agentToken) return {};
|
|
19687
19580
|
const port = this._hooks.listenerPort();
|
|
19688
19581
|
if (!port) return {};
|
|
19689
19582
|
const url = `http://127.0.0.1:${port}/agent/${encodeURIComponent(this.id)}?t=${encodeURIComponent(this._agentToken)}`;
|
|
@@ -19826,6 +19719,9 @@ var Session = class extends EventEmitter {
|
|
|
19826
19719
|
getWorktreeCarry() {
|
|
19827
19720
|
return this.worktreeLifecycle.getCarry();
|
|
19828
19721
|
}
|
|
19722
|
+
get hasOwnWorktree() {
|
|
19723
|
+
return this.worktreeLifecycle.hasOwnWorktree();
|
|
19724
|
+
}
|
|
19829
19725
|
refreshGitContext() {
|
|
19830
19726
|
return this.worktreeLifecycle.refreshGitContext();
|
|
19831
19727
|
}
|
|
@@ -19849,6 +19745,9 @@ var Session = class extends EventEmitter {
|
|
|
19849
19745
|
discardWorktreeIfClean() {
|
|
19850
19746
|
return this.worktreeLifecycle.discardIfClean();
|
|
19851
19747
|
}
|
|
19748
|
+
releaseDroppedWorkspaceMembers(keepRepoPaths) {
|
|
19749
|
+
return this.worktreeLifecycle.releaseDroppedWorkspaceMembers(keepRepoPaths);
|
|
19750
|
+
}
|
|
19852
19751
|
pasteMergePrompt() {
|
|
19853
19752
|
return this.worktreeLifecycle.pasteMergePrompt();
|
|
19854
19753
|
}
|
|
@@ -20115,7 +20014,9 @@ var Session = class extends EventEmitter {
|
|
|
20115
20014
|
resumeSessionId: spawnResumeSessionId,
|
|
20116
20015
|
extraArgs: launchSession?.extraArgs ?? this._extraClaudeArgs,
|
|
20117
20016
|
initialPrompt: this._initialPrompt,
|
|
20118
|
-
hasOuterSandbox: this._prepareSandbox !== null
|
|
20017
|
+
hasOuterSandbox: this._prepareSandbox !== null,
|
|
20018
|
+
hasOperatorInstructions: this._hasOperatorInstructions(env),
|
|
20019
|
+
canRunHelpCommand: this._canRunHelpCommand
|
|
20119
20020
|
});
|
|
20120
20021
|
const spawnCommand = await this._sandboxedSpawnCommand(this._adapter.buildSpawnCommand({
|
|
20121
20022
|
platform: this._platform,
|
|
@@ -20176,6 +20077,15 @@ var Session = class extends EventEmitter {
|
|
|
20176
20077
|
this.transition("spawn_fail", { error: errorMessage(cause) });
|
|
20177
20078
|
this.emit("error", cause);
|
|
20178
20079
|
}
|
|
20080
|
+
_hasOperatorInstructions(env) {
|
|
20081
|
+
const operatorConfigPath = this._adapter.operatorConfigPath?.(env) ?? null;
|
|
20082
|
+
if (operatorConfigPath === null) return false;
|
|
20083
|
+
try {
|
|
20084
|
+
return this._adapter.setsOperatorInstructions?.(fs.readFileSync(operatorConfigPath, "utf8")) === true;
|
|
20085
|
+
} catch (error) {
|
|
20086
|
+
return !isMissingFileError(error);
|
|
20087
|
+
}
|
|
20088
|
+
}
|
|
20179
20089
|
async _sandboxedSpawnCommand(command, agentSessionId) {
|
|
20180
20090
|
if (!this._prepareSandbox) return {
|
|
20181
20091
|
...command,
|
|
@@ -20656,6 +20566,9 @@ function startAwakeStopwatch({ tickMs = DEFAULT_TICK_MS, now = Date.now } = {})
|
|
|
20656
20566
|
stop: () => clearInterval(ticks.interval)
|
|
20657
20567
|
};
|
|
20658
20568
|
}
|
|
20569
|
+
//#endregion
|
|
20570
|
+
//#region server/core/investigation-trail-core.ts
|
|
20571
|
+
var TRAIL_MAX_STEPS = 80;
|
|
20659
20572
|
var TRAIL_TOOL_MAX_CHARS = 64;
|
|
20660
20573
|
function describeToolStep(toolName, toolInput) {
|
|
20661
20574
|
const trimmed = typeof toolName === "string" ? toolName.trim() : "";
|
|
@@ -20676,7 +20589,7 @@ function createInvestigationTrail(startedAt) {
|
|
|
20676
20589
|
steps: []
|
|
20677
20590
|
};
|
|
20678
20591
|
}
|
|
20679
|
-
function appendTrailStep(trail, step, maxSteps =
|
|
20592
|
+
function appendTrailStep(trail, step, maxSteps = TRAIL_MAX_STEPS) {
|
|
20680
20593
|
const steps = [...trail.steps, step];
|
|
20681
20594
|
return {
|
|
20682
20595
|
startedAt: trail.startedAt,
|
|
@@ -20767,7 +20680,7 @@ function decideFolderTrust(configText, repositoryRoot, platform) {
|
|
|
20767
20680
|
};
|
|
20768
20681
|
}
|
|
20769
20682
|
//#endregion
|
|
20770
|
-
//#region server/sandbox-launch.ts
|
|
20683
|
+
//#region server/sandbox/sandbox-launch.ts
|
|
20771
20684
|
var LAUNCH_ID_SHAPE = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
20772
20685
|
var SANDBOXED_ENV_COMMAND = "/usr/bin/env";
|
|
20773
20686
|
var POLICY_FOLDER = "sandbox-policies";
|
|
@@ -21058,7 +20971,7 @@ async function prepareSandboxLaunch({ role, launchId, tempDir, enterDir }) {
|
|
|
21058
20971
|
}
|
|
21059
20972
|
}
|
|
21060
20973
|
//#endregion
|
|
21061
|
-
//#region server/lane-spawn.ts
|
|
20974
|
+
//#region server/lanes/lane-spawn.ts
|
|
21062
20975
|
var SETTINGS_DIR_PREFIX = "glimmervoid-lane-settings-";
|
|
21063
20976
|
var UNWRAPPED_PLATFORM$2 = "win32";
|
|
21064
20977
|
var UNWRAPPED_CODEX_SANDBOX_ARGS = Object.freeze(["-s", "read-only"]);
|
|
@@ -21176,7 +21089,7 @@ async function readLaneResultFile(resultPath) {
|
|
|
21176
21089
|
}
|
|
21177
21090
|
}
|
|
21178
21091
|
//#endregion
|
|
21179
|
-
//#region server/team-review-thread-judge.ts
|
|
21092
|
+
//#region server/github/team-review-thread-judge.ts
|
|
21180
21093
|
var THREAD_JUDGE_TOOLS = Object.freeze(["Read", "Write"]);
|
|
21181
21094
|
var THREAD_JUDGE_TIMEOUT_MS = 12e4;
|
|
21182
21095
|
function createThreadJudge(spawn, shutdownSignal) {
|
|
@@ -21209,7 +21122,7 @@ function createThreadJudge(spawn, shutdownSignal) {
|
|
|
21209
21122
|
};
|
|
21210
21123
|
}
|
|
21211
21124
|
//#endregion
|
|
21212
|
-
//#region server/repo-cache.ts
|
|
21125
|
+
//#region server/git/repo-cache.ts
|
|
21213
21126
|
var NETWORK_GIT_ENV = { GIT_TERMINAL_PROMPT: "0" };
|
|
21214
21127
|
var GIT_COMMAND_TIMEOUT_MS = 12e4;
|
|
21215
21128
|
var HEAD_TREE_HYDRATE_TIMEOUT_MS = 6e5;
|
|
@@ -21472,7 +21385,7 @@ function createRepoCache({ rootDir, commandRunner = defaultCommandRunner, remote
|
|
|
21472
21385
|
};
|
|
21473
21386
|
}
|
|
21474
21387
|
//#endregion
|
|
21475
|
-
//#region server/core/team-review-reaper-core.ts
|
|
21388
|
+
//#region server/github/core/team-review-reaper-core.ts
|
|
21476
21389
|
var CLAUDE_BASH_SIGNATURE = "/.claude/shell-snapshots/snapshot-";
|
|
21477
21390
|
function parseProcessTable(output) {
|
|
21478
21391
|
const rows = [];
|
|
@@ -21549,7 +21462,7 @@ function selectTeamReviewProcessIds(rows, ownedDirectories, protectedPids) {
|
|
|
21549
21462
|
return [...selectedPids].sort((leftPid, rightPid) => leftPid - rightPid);
|
|
21550
21463
|
}
|
|
21551
21464
|
//#endregion
|
|
21552
|
-
//#region server/team-review-reaper.ts
|
|
21465
|
+
//#region server/github/team-review-reaper.ts
|
|
21553
21466
|
var PROCESS_LIST_TIMEOUT_MS = 5e3;
|
|
21554
21467
|
var TERMINATION_GRACE_MS = 2e3;
|
|
21555
21468
|
var EXIT_POLL_MS = 100;
|
|
@@ -21648,7 +21561,7 @@ async function reapTeamReviewProcesses({ ownedDirectories, reviewRoots, scope, l
|
|
|
21648
21561
|
}
|
|
21649
21562
|
}
|
|
21650
21563
|
//#endregion
|
|
21651
|
-
//#region server/team-review-poller.ts
|
|
21564
|
+
//#region server/github/team-review-poller.ts
|
|
21652
21565
|
var TEAM_REVIEW_RATE_LIMIT_RESOURCES = [
|
|
21653
21566
|
"search",
|
|
21654
21567
|
"graphql",
|
|
@@ -22275,7 +22188,7 @@ function createTeamReviewPoller(deps) {
|
|
|
22275
22188
|
};
|
|
22276
22189
|
}
|
|
22277
22190
|
//#endregion
|
|
22278
|
-
//#region server/team-review-wiring.ts
|
|
22191
|
+
//#region server/github/team-review-wiring.ts
|
|
22279
22192
|
var TEAM_REVIEW_DENY_RULES = Object.freeze([
|
|
22280
22193
|
"Bash(gh:*)",
|
|
22281
22194
|
"Bash(git push:*)",
|
|
@@ -24231,7 +24144,7 @@ function createBenchmarkWiring({ benchmarksRoot, runsRoot, isEnabled, broadcast,
|
|
|
24231
24144
|
};
|
|
24232
24145
|
}
|
|
24233
24146
|
//#endregion
|
|
24234
|
-
//#region server/core/factory-decision-log-core.ts
|
|
24147
|
+
//#region server/factory/core/factory-decision-log-core.ts
|
|
24235
24148
|
function factoryDecisionDayFileName(timestamp) {
|
|
24236
24149
|
return `${timestamp.slice(0, 10)}.jsonl`;
|
|
24237
24150
|
}
|
|
@@ -24390,7 +24303,7 @@ function factoryCloseOutFailureClass(fence, checks, review) {
|
|
|
24390
24303
|
return null;
|
|
24391
24304
|
}
|
|
24392
24305
|
//#endregion
|
|
24393
|
-
//#region server/factory-check-sandbox.ts
|
|
24306
|
+
//#region server/factory/factory-check-sandbox.ts
|
|
24394
24307
|
function capturedStreamTail(failure, stream) {
|
|
24395
24308
|
if (!(failure instanceof Error)) return "";
|
|
24396
24309
|
const captured = Reflect.get(failure, stream);
|
|
@@ -24448,7 +24361,7 @@ var prepareSandboxedCheckRunner = async ({ scratchParent, writablePaths, readabl
|
|
|
24448
24361
|
};
|
|
24449
24362
|
};
|
|
24450
24363
|
//#endregion
|
|
24451
|
-
//#region server/core/git-changed-paths-core.ts
|
|
24364
|
+
//#region server/git/core/git-changed-paths-core.ts
|
|
24452
24365
|
var WORKFLOW_PATH_PREFIX = ".github/workflows/";
|
|
24453
24366
|
var WORKFLOW_ANCESTOR_ENTRIES = /* @__PURE__ */ new Set([".github", ".github/workflows"]);
|
|
24454
24367
|
var GITHUB_DIRECTORY_ENTRY = ".github";
|
|
@@ -24480,7 +24393,7 @@ function isCredentialLikePath(filePath) {
|
|
|
24480
24393
|
return CREDENTIAL_LIKE_FILE_NAMES.some((pattern) => pattern.test(fileName));
|
|
24481
24394
|
}
|
|
24482
24395
|
//#endregion
|
|
24483
|
-
//#region server/factory-closeout.ts
|
|
24396
|
+
//#region server/factory/factory-closeout.ts
|
|
24484
24397
|
var FACTORY_REVIEWER_TOOLS = Object.freeze([
|
|
24485
24398
|
"Read",
|
|
24486
24399
|
"Glob",
|
|
@@ -24506,6 +24419,8 @@ var CASE_INSENSITIVE_LEDGER_PATHSPEC = ":(icase).coherence";
|
|
|
24506
24419
|
var WORK_OUTSIDE_LEDGER_PATHSPECS = [".", ":(exclude,icase).coherence"];
|
|
24507
24420
|
var FACTORY_REVIEW_TOO_LARGE_FEEDBACK = "change too large for review; split it into smaller tickets";
|
|
24508
24421
|
var FAILED_CHECK_FEEDBACK_MAX_CHARS = 3500;
|
|
24422
|
+
var FACTORY_TICKET_BLOCK_CAP = 3;
|
|
24423
|
+
var FACTORY_INTENT_CAP_CANCEL_LIMIT = 3;
|
|
24509
24424
|
function createMemoryCapCounter() {
|
|
24510
24425
|
const counts = /* @__PURE__ */ new Map();
|
|
24511
24426
|
return async (projectId, id) => {
|
|
@@ -25034,7 +24949,7 @@ function createFactoryCloseOut({ config, spawnReviewer, gitWorkspace, serializeP
|
|
|
25034
24949
|
attempts.delete(worker.workId);
|
|
25035
24950
|
failingFilesOutsideScopesByWork.delete(worker.workId);
|
|
25036
24951
|
worker.session.destroy();
|
|
25037
|
-
const capNotice = blockCount >=
|
|
24952
|
+
const capNotice = blockCount >= FACTORY_TICKET_BLOCK_CAP ? await cancelTicketAtCap(worker, ledger.cwd, blockCount) : null;
|
|
25038
24953
|
notifyOrchestrator(worker.projectId, {
|
|
25039
24954
|
workId: worker.workId,
|
|
25040
24955
|
intentId: worker.intentId,
|
|
@@ -25080,7 +24995,7 @@ function createFactoryCloseOut({ config, spawnReviewer, gitWorkspace, serializeP
|
|
|
25080
24995
|
}
|
|
25081
24996
|
async function cancelIntentAtCap(worker, cwd) {
|
|
25082
24997
|
const capCancelCount = await countIntentCapCancel(worker.projectId, worker.intentId);
|
|
25083
|
-
if (capCancelCount <
|
|
24998
|
+
if (capCancelCount < FACTORY_INTENT_CAP_CANCEL_LIMIT) return;
|
|
25084
24999
|
const notice = `Glimmervoid cancelled intent ${worker.intentId} after ${capCancelCount} of its tickets were cancelled at the block cap; the queue moves to the next intent.`;
|
|
25085
25000
|
try {
|
|
25086
25001
|
const intentClosings = listIntentCapClosings(CoherenceWorkInspect.parse(JSON.parse(await runCoherence({
|
|
@@ -25421,7 +25336,7 @@ function buildCoherenceShims({ nodePath, cliPath, glimmervoidCliPath }) {
|
|
|
25421
25336
|
];
|
|
25422
25337
|
}
|
|
25423
25338
|
//#endregion
|
|
25424
|
-
//#region server/factory-ledger.ts
|
|
25339
|
+
//#region server/factory/factory-ledger.ts
|
|
25425
25340
|
var LEDGER_GIT_OPTIONS = {
|
|
25426
25341
|
encoding: "utf8",
|
|
25427
25342
|
timeout: 3e4,
|
|
@@ -25789,7 +25704,7 @@ async function pruneAgedFiles({ directory, suffixes, retainDays, now = Date.now(
|
|
|
25789
25704
|
return removedIds;
|
|
25790
25705
|
}
|
|
25791
25706
|
//#endregion
|
|
25792
|
-
//#region server/factory-decision-log.ts
|
|
25707
|
+
//#region server/factory/factory-decision-log.ts
|
|
25793
25708
|
function createFactoryDecisionLog({ homeDir = glimmervoidHomeDir$1(), now = Date.now, log = console, redact = (text) => text, onDecision } = {}) {
|
|
25794
25709
|
const prunedDayByProject = /* @__PURE__ */ new Map();
|
|
25795
25710
|
let lastScannedDayFileName = null;
|
|
@@ -25862,7 +25777,7 @@ function createFactoryDecisionLog({ homeDir = glimmervoidHomeDir$1(), now = Date
|
|
|
25862
25777
|
};
|
|
25863
25778
|
}
|
|
25864
25779
|
//#endregion
|
|
25865
|
-
//#region server/work-lane.ts
|
|
25780
|
+
//#region server/lanes/work-lane.ts
|
|
25866
25781
|
var UNWRAPPED_PLATFORM$1 = "win32";
|
|
25867
25782
|
var GUARD_HOOK_UNAVAILABLE_ERROR = "Sane YOLO is unavailable";
|
|
25868
25783
|
function prepareRoleSandbox(describeRole, { prepareSandbox = prepareSandboxLaunch, sandboxRefusal = allowSandboxedSpawn, platform = process.platform } = {}) {
|
|
@@ -26002,7 +25917,7 @@ async function resolveWorkLane(input, { hookToolConfig = {}, resolveSaneYoloHook
|
|
|
26002
25917
|
}
|
|
26003
25918
|
}
|
|
26004
25919
|
//#endregion
|
|
26005
|
-
//#region server/factory-dispatch.ts
|
|
25920
|
+
//#region server/factory/factory-dispatch.ts
|
|
26006
25921
|
var FACTORY_WORKER_DENY = Object.freeze([
|
|
26007
25922
|
"Bash(git push:*)",
|
|
26008
25923
|
"Bash(gh:*)",
|
|
@@ -26232,7 +26147,7 @@ function createFactoryDispatch({ config, sessions, makeSession, wireSessionEvent
|
|
|
26232
26147
|
...posture.sessionOverrides,
|
|
26233
26148
|
agent: "claude-code",
|
|
26234
26149
|
ephemeral: true,
|
|
26235
|
-
|
|
26150
|
+
factoryRole: "worker",
|
|
26236
26151
|
requireWorktree: true,
|
|
26237
26152
|
dangerouslySkipPermissions: false,
|
|
26238
26153
|
gitIsolation: { disableRepoCommands: true },
|
|
@@ -26465,7 +26380,7 @@ function createFactoryDispatch({ config, sessions, makeSession, wireSessionEvent
|
|
|
26465
26380
|
};
|
|
26466
26381
|
}
|
|
26467
26382
|
//#endregion
|
|
26468
|
-
//#region server/factory-orchestrator.ts
|
|
26383
|
+
//#region server/factory/factory-orchestrator.ts
|
|
26469
26384
|
var FACTORY_ORCHESTRATOR_ALLOW = Object.freeze([
|
|
26470
26385
|
"Bash(coherence work create:*)",
|
|
26471
26386
|
"Bash(coherence orient:*)",
|
|
@@ -26685,7 +26600,6 @@ function createFactoryOrchestrator({ config, sessions, makeSession, wireSessionE
|
|
|
26685
26600
|
},
|
|
26686
26601
|
agent: "claude-code",
|
|
26687
26602
|
ephemeral: true,
|
|
26688
|
-
agentApi: true,
|
|
26689
26603
|
factoryRole: "orchestrator",
|
|
26690
26604
|
gitWorkspace: null,
|
|
26691
26605
|
dangerouslySkipPermissions: false,
|
|
@@ -26861,7 +26775,7 @@ function createFactoryOrchestrator({ config, sessions, makeSession, wireSessionE
|
|
|
26861
26775
|
};
|
|
26862
26776
|
}
|
|
26863
26777
|
//#endregion
|
|
26864
|
-
//#region server/factory-poller.ts
|
|
26778
|
+
//#region server/factory/factory-poller.ts
|
|
26865
26779
|
function createFactoryPoller({ shouldHoldCheckout = () => false, beforeTick = () => {}, listFactoryProjects, resolveIntegrationBranch, readBranchSha, hasCoherenceConfigAt, ensureControlCheckout, releaseControlCheckout, runCoherence, readPaused = async () => false, readIntentWriteScopes = async () => /* @__PURE__ */ new Map(), processProjectState = async (project) => project, releaseOrchestrator = () => {}, listObservedProjects = async () => [], broadcast, now = Date.now, ...loopOptions }) {
|
|
26866
26780
|
const log = loopOptions.log ?? console;
|
|
26867
26781
|
let state = null;
|
|
@@ -27044,7 +26958,7 @@ function stdoutOfFailedCommand(error) {
|
|
|
27044
26958
|
return stdout;
|
|
27045
26959
|
}
|
|
27046
26960
|
//#endregion
|
|
27047
|
-
//#region server/factory-verifier.ts
|
|
26961
|
+
//#region server/factory/factory-verifier.ts
|
|
27048
26962
|
function createFactoryVerifier({ config, spawnVerifier, serializeProject, ensureLedger, ensureControlCheckout, hasCodeChangedSince, readIntentDiff = async () => null, readLaneState, writeLaneState, runCoherence, commitAndLand, pause, setException, notifyOrchestrator, stopOrchestrator, onChanged }) {
|
|
27049
26963
|
const readyByProject = /* @__PURE__ */ new Map();
|
|
27050
26964
|
const notesByProject = /* @__PURE__ */ new Map();
|
|
@@ -27352,7 +27266,7 @@ function createFactoryVerifier({ config, spawnVerifier, serializeProject, ensure
|
|
|
27352
27266
|
};
|
|
27353
27267
|
}
|
|
27354
27268
|
//#endregion
|
|
27355
|
-
//#region server/factory-wiring.ts
|
|
27269
|
+
//#region server/factory/factory-wiring.ts
|
|
27356
27270
|
var COHERENCE_CONFIG_PROBE_TIMEOUT_MS = 5e3;
|
|
27357
27271
|
var ORCHESTRATOR_EXCEPTION_PREFIX = "factory-exception";
|
|
27358
27272
|
function createFactoryWiring({ config, broadcast, gitWorkspace = createGitWorkspace(), homeDir = glimmervoidHomeDir$1(), createPoller = createFactoryPoller, log = console, telemetry, orchestratorOptions, trustClaudeFolder, spawnReviewer, prepareCheckRunner, spawnVerifier = spawnReviewer, readSpentTodayUsd = () => ({
|
|
@@ -28294,7 +28208,7 @@ function createFactoryWiring({ config, broadcast, gitWorkspace = createGitWorksp
|
|
|
28294
28208
|
};
|
|
28295
28209
|
}
|
|
28296
28210
|
//#endregion
|
|
28297
|
-
//#region server/core/factory-harness-mirror-core.ts
|
|
28211
|
+
//#region server/factory/core/factory-harness-mirror-core.ts
|
|
28298
28212
|
var HARNESS_MIRROR_MAX_IDLE_MS = 864e5;
|
|
28299
28213
|
var HARNESS_MIRROR_PROJECT_PREFIX = "harness-";
|
|
28300
28214
|
var BATCH_NAME_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-\d{3}Z-[0-9a-f]{8}$/;
|
|
@@ -28344,7 +28258,7 @@ function mirrorHarnessProjects(state, observedRun) {
|
|
|
28344
28258
|
}));
|
|
28345
28259
|
}
|
|
28346
28260
|
//#endregion
|
|
28347
|
-
//#region server/factory-harness-mirror.ts
|
|
28261
|
+
//#region server/factory/factory-harness-mirror.ts
|
|
28348
28262
|
var STATE_TAIL_MAX_BYTES = 4194304;
|
|
28349
28263
|
var NON_BLOCKING_READ_FLAGS = constants.O_RDONLY | constants.O_NONBLOCK;
|
|
28350
28264
|
function isMissingPath(error) {
|
|
@@ -29175,7 +29089,7 @@ function createBranchGcPoller(deps) {
|
|
|
29175
29089
|
};
|
|
29176
29090
|
}
|
|
29177
29091
|
//#endregion
|
|
29178
|
-
//#region server/lane-status.ts
|
|
29092
|
+
//#region server/lanes/lane-status.ts
|
|
29179
29093
|
function emptyLaneStatus(type, gate) {
|
|
29180
29094
|
return {
|
|
29181
29095
|
type,
|
|
@@ -29597,7 +29511,7 @@ function decideFsEvents(batch, { root = null, now = 0 } = {}) {
|
|
|
29597
29511
|
}];
|
|
29598
29512
|
}
|
|
29599
29513
|
//#endregion
|
|
29600
|
-
//#region server/core/ingest-batch-log-core.ts
|
|
29514
|
+
//#region server/ingest/core/ingest-batch-log-core.ts
|
|
29601
29515
|
function emptyBatchLogState() {
|
|
29602
29516
|
return {
|
|
29603
29517
|
batches: 0,
|
|
@@ -29629,7 +29543,7 @@ function drainBatchLog(state) {
|
|
|
29629
29543
|
};
|
|
29630
29544
|
}
|
|
29631
29545
|
//#endregion
|
|
29632
|
-
//#region server/core/ingest-tail-core.ts
|
|
29546
|
+
//#region server/ingest/core/ingest-tail-core.ts
|
|
29633
29547
|
var MAX_CATCH_UP_BYTES = 262144;
|
|
29634
29548
|
var LISTING_SETTLE_MS = 2e3;
|
|
29635
29549
|
function fileIdentity(stat) {
|
|
@@ -29754,7 +29668,7 @@ function pickStaleByMtime(entriesByKey, { maxTracked = 256 } = {}) {
|
|
|
29754
29668
|
return entries.slice(0, entries.length - bound).map(([key]) => key);
|
|
29755
29669
|
}
|
|
29756
29670
|
//#endregion
|
|
29757
|
-
//#region server/core/ingest-agent-core.ts
|
|
29671
|
+
//#region server/ingest/core/ingest-agent-core.ts
|
|
29758
29672
|
var SOURCE$2 = "agentLogs";
|
|
29759
29673
|
var MAX_RAW_CHARS = 4e3;
|
|
29760
29674
|
var TOOL_TARGET_KEYS = Object.freeze([
|
|
@@ -30007,7 +29921,7 @@ function mapAgentLine({ vendor = "", rawLine = null, ctx = {}, vendorState = nul
|
|
|
30007
29921
|
return mapped;
|
|
30008
29922
|
}
|
|
30009
29923
|
//#endregion
|
|
30010
|
-
//#region server/ingest-agent-logs.ts
|
|
29924
|
+
//#region server/ingest/ingest-agent-logs.ts
|
|
30011
29925
|
var DEFAULT_POLL_MS$2 = 2e3;
|
|
30012
29926
|
var DEFAULT_DISCOVER_MS$1 = 3e4;
|
|
30013
29927
|
var DEFAULT_ACTIVE_WITHIN_MS = 6e5;
|
|
@@ -30038,7 +29952,7 @@ async function readCodexRoot(filePath, fsPromises = fs.promises) {
|
|
|
30038
29952
|
const buffer = Buffer.alloc(CODEX_HEAD_BYTES);
|
|
30039
29953
|
const { bytesRead } = await handle.read(buffer, 0, CODEX_HEAD_BYTES, 0);
|
|
30040
29954
|
const lines = buffer.subarray(0, bytesRead).toString("utf8").split(/\r?\n/);
|
|
30041
|
-
if (bytesRead ===
|
|
29955
|
+
if (bytesRead === CODEX_HEAD_BYTES) lines.pop();
|
|
30042
29956
|
for (const line of lines) {
|
|
30043
29957
|
if (!line) continue;
|
|
30044
29958
|
let parsed = null;
|
|
@@ -30610,7 +30524,7 @@ function createAgentLogIngest({ publish, sourceConfig = {}, laneMap = null, logg
|
|
|
30610
30524
|
};
|
|
30611
30525
|
}
|
|
30612
30526
|
//#endregion
|
|
30613
|
-
//#region server/ingest-editor.ts
|
|
30527
|
+
//#region server/ingest/ingest-editor.ts
|
|
30614
30528
|
function createEditorIngest({ publish, roots = () => [], pathsFoldCase = process.platform === "darwin", logger = console, nowFn = Date.now, debug = false }) {
|
|
30615
30529
|
const { debugNote, warn } = createLaneLog({
|
|
30616
30530
|
prefix: "[ingest:editor]",
|
|
@@ -30654,6 +30568,9 @@ function createEditorIngest({ publish, roots = () => [], pathsFoldCase = process
|
|
|
30654
30568
|
stop
|
|
30655
30569
|
};
|
|
30656
30570
|
}
|
|
30571
|
+
//#endregion
|
|
30572
|
+
//#region server/ingest/ingest-fs.ts
|
|
30573
|
+
var DEFAULT_MAX_ROOTS = 8;
|
|
30657
30574
|
var CONFIG_HOLDER = "config:fs.roots";
|
|
30658
30575
|
var requireFromHere = createRequire(import.meta.url);
|
|
30659
30576
|
function defaultLoadWatcher() {
|
|
@@ -30663,11 +30580,11 @@ function isWatcherModule(value) {
|
|
|
30663
30580
|
if (typeof value !== "object" || value === null) return false;
|
|
30664
30581
|
return "subscribe" in value && typeof value.subscribe === "function";
|
|
30665
30582
|
}
|
|
30666
|
-
function createFsIngest({ publish, sourceConfig = {}, configPath = null, logger = console, loadWatcher = defaultLoadWatcher, canonicalize = canonicalizePath, nowFn = Date.now, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, maxRoots =
|
|
30583
|
+
function createFsIngest({ publish, sourceConfig = {}, configPath = null, logger = console, loadWatcher = defaultLoadWatcher, canonicalize = canonicalizePath, nowFn = Date.now, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, maxRoots = DEFAULT_MAX_ROOTS } = {}) {
|
|
30667
30584
|
if (typeof publish !== "function") throw new Error("createFsIngest requires publish");
|
|
30668
30585
|
const publishEvent = publish;
|
|
30669
30586
|
const batchMs = positiveIntOr(sourceConfig.batchMs, DEFAULT_BATCH_MS);
|
|
30670
|
-
const rootLimit = Math.max(1, positiveIntOr(maxRoots,
|
|
30587
|
+
const rootLimit = Math.max(1, positiveIntOr(maxRoots, DEFAULT_MAX_ROOTS));
|
|
30671
30588
|
const ignorePatterns = buildIgnorePatterns();
|
|
30672
30589
|
const daemonRules = daemonWriteRules(configPath);
|
|
30673
30590
|
const configuredRoots = normalizeRoots(sourceConfig.roots);
|
|
@@ -31243,14 +31160,17 @@ function classifyGitStatusFailure(error) {
|
|
|
31243
31160
|
if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") return "check-root";
|
|
31244
31161
|
return "transient";
|
|
31245
31162
|
}
|
|
31163
|
+
//#endregion
|
|
31164
|
+
//#region server/ingest/ingest-git.ts
|
|
31165
|
+
var DEFAULT_MAX_REPOS = 16;
|
|
31246
31166
|
var DEFAULT_GIT_TIMEOUT_MS = 15e3;
|
|
31247
31167
|
var MAX_GIT_BUFFER_BYTES = 8388608;
|
|
31248
|
-
function createGitIngest({ publish, sourceConfig = {}, reposProvider = null, logger = console, execFileFn = execFileAsync, createWatch = createWatchDebounce, canonicalize = canonicalizePath, statRepoDir = (dir) => fsp.stat(dir), nowFn = Date.now, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, maxRepos =
|
|
31168
|
+
function createGitIngest({ publish, sourceConfig = {}, reposProvider = null, logger = console, execFileFn = execFileAsync, createWatch = createWatchDebounce, canonicalize = canonicalizePath, statRepoDir = (dir) => fsp.stat(dir), nowFn = Date.now, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, maxRepos = DEFAULT_MAX_REPOS, gitTimeoutMs = DEFAULT_GIT_TIMEOUT_MS, gitPath = "git" } = {}) {
|
|
31249
31169
|
if (typeof publish !== "function") throw new Error("createGitIngest requires publish");
|
|
31250
31170
|
const publishEvent = publish;
|
|
31251
31171
|
const settleMs = positiveIntOr(sourceConfig.debounceMs, DEFAULT_DEBOUNCE_MS);
|
|
31252
31172
|
const pollIntervalMs = positiveIntOr(sourceConfig.pollMs, DEFAULT_POLL_MS$1);
|
|
31253
|
-
const repoLimit = Math.max(1, positiveIntOr(maxRepos,
|
|
31173
|
+
const repoLimit = Math.max(1, positiveIntOr(maxRepos, DEFAULT_MAX_REPOS));
|
|
31254
31174
|
const candidateLimit = repoLimit * 4;
|
|
31255
31175
|
const repos = /* @__PURE__ */ new Map();
|
|
31256
31176
|
const canonicalCache = /* @__PURE__ */ new Map();
|
|
@@ -31631,12 +31551,13 @@ function createGitIngest({ publish, sourceConfig = {}, reposProvider = null, log
|
|
|
31631
31551
|
};
|
|
31632
31552
|
}
|
|
31633
31553
|
//#endregion
|
|
31634
|
-
//#region server/ingest-shell-history.ts
|
|
31554
|
+
//#region server/ingest/ingest-shell-history.ts
|
|
31635
31555
|
var DEFAULT_POLL_MS = 2e3;
|
|
31636
31556
|
var DEFAULT_DISCOVER_MS = 3e4;
|
|
31557
|
+
var DEFAULT_MAX_COMMANDS_PER_DRAIN = 50;
|
|
31637
31558
|
var WATCH_POLL_DEBOUNCE_MS = 100;
|
|
31638
31559
|
var WATCH_SWEEP_DEBOUNCE_MS = 500;
|
|
31639
|
-
function createShellHistoryIngest({ publish, sourceConfig = {}, logger = console, env = process.env, homeDir = os.homedir(), platform = process.platform, fsPromises = fs.promises, watchFn = fs.watch, nowFn = Date.now, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, discoverIntervalMs = DEFAULT_DISCOVER_MS, maxTrackedFiles = 8, maxCommandsPerDrain =
|
|
31560
|
+
function createShellHistoryIngest({ publish, sourceConfig = {}, logger = console, env = process.env, homeDir = os.homedir(), platform = process.platform, fsPromises = fs.promises, watchFn = fs.watch, nowFn = Date.now, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, discoverIntervalMs = DEFAULT_DISCOVER_MS, maxTrackedFiles = 8, maxCommandsPerDrain = DEFAULT_MAX_COMMANDS_PER_DRAIN, maxCatchUpBytes = MAX_CATCH_UP_BYTES } = {}) {
|
|
31640
31561
|
if (typeof publish !== "function") throw new Error("createShellHistoryIngest requires publish");
|
|
31641
31562
|
const publishEvent = publish;
|
|
31642
31563
|
const pollMs = positiveIntOr(sourceConfig.pollMs, DEFAULT_POLL_MS);
|
|
@@ -31885,7 +31806,7 @@ function createShellHistoryIngest({ publish, sourceConfig = {}, logger = console
|
|
|
31885
31806
|
context.previous = decided.previous;
|
|
31886
31807
|
if (decided.event) events.push(decided.event);
|
|
31887
31808
|
}
|
|
31888
|
-
const bound = positiveIntOr(maxCommandsPerDrain,
|
|
31809
|
+
const bound = positiveIntOr(maxCommandsPerDrain, DEFAULT_MAX_COMMANDS_PER_DRAIN);
|
|
31889
31810
|
const recent = events.slice(-bound);
|
|
31890
31811
|
const dropped = events.length - recent.length;
|
|
31891
31812
|
if (dropped > 0) {
|
|
@@ -32006,7 +31927,7 @@ function createShellHistoryIngest({ publish, sourceConfig = {}, logger = console
|
|
|
32006
31927
|
};
|
|
32007
31928
|
}
|
|
32008
31929
|
//#endregion
|
|
32009
|
-
//#region server/core/ingest-terminal-core.ts
|
|
31930
|
+
//#region server/ingest/core/ingest-terminal-core.ts
|
|
32010
31931
|
var DEFAULT_ACCUMULATOR_BYTES = SOURCE_DEFAULTS.terminal.accumulatorBytes;
|
|
32011
31932
|
var DEFAULT_WINDOW_BYTES = SOURCE_DEFAULTS.terminal.windowBytes;
|
|
32012
31933
|
var DEFAULT_FLUSH_MS = SOURCE_DEFAULTS.terminal.flushMs;
|
|
@@ -32240,7 +32161,7 @@ function flushAccumulator(state, { now = Date.now() } = {}) {
|
|
|
32240
32161
|
};
|
|
32241
32162
|
}
|
|
32242
32163
|
//#endregion
|
|
32243
|
-
//#region server/ingest-terminal.ts
|
|
32164
|
+
//#region server/ingest/ingest-terminal.ts
|
|
32244
32165
|
function createTerminalIngest({ publish, sourceConfig = {}, logger = console, nowFn = Date.now, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn } = {}) {
|
|
32245
32166
|
if (typeof publish !== "function") throw new Error("createTerminalIngest requires publish");
|
|
32246
32167
|
const publishEvent = publish;
|
|
@@ -32364,7 +32285,7 @@ function createTerminalIngest({ publish, sourceConfig = {}, logger = console, no
|
|
|
32364
32285
|
};
|
|
32365
32286
|
}
|
|
32366
32287
|
//#endregion
|
|
32367
|
-
//#region server/ingest-wiring.ts
|
|
32288
|
+
//#region server/ingest/ingest-wiring.ts
|
|
32368
32289
|
var BATCH_INTERVAL_MS = 1e3;
|
|
32369
32290
|
function createIngestLane({ config = null, broadcast = null, logger = console, laneMap = null, agentLogOptions = null, fsOptions = null, shellHistoryOptions = null, configPath = null, repoRoots = null, editorRoots = () => [], onActivity = null, nowFn = Date.now, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, batchIntervalMs = BATCH_INTERVAL_MS, maxEventsPerFrame = 50, snapshotEventLimit = 100, debug = false } = {}) {
|
|
32370
32291
|
const resolved = config?.sources ? config : resolveIngestConfig(config);
|
|
@@ -32647,7 +32568,7 @@ function createIngestLane({ config = null, broadcast = null, logger = console, l
|
|
|
32647
32568
|
};
|
|
32648
32569
|
}
|
|
32649
32570
|
//#endregion
|
|
32650
|
-
//#region server/core/change-narrative-core.ts
|
|
32571
|
+
//#region server/change-map/core/change-narrative-core.ts
|
|
32651
32572
|
var FACT_GROUPS = [
|
|
32652
32573
|
"files",
|
|
32653
32574
|
"subsystems",
|
|
@@ -32754,7 +32675,7 @@ function validateNarrative({ raw, knownFactIds, factsHash, model }) {
|
|
|
32754
32675
|
};
|
|
32755
32676
|
}
|
|
32756
32677
|
//#endregion
|
|
32757
|
-
//#region server/change-narrator.ts
|
|
32678
|
+
//#region server/change-map/change-narrator.ts
|
|
32758
32679
|
var MAX_CACHED_HASHES = 64;
|
|
32759
32680
|
var PROMPT_FILE$2 = "change-narrative-prompt.txt";
|
|
32760
32681
|
var RESULT_FILE$2 = "change-narrative-result.json";
|
|
@@ -33646,6 +33567,7 @@ var PLAN_DRAFT_DEBOUNCE_MS = 250;
|
|
|
33646
33567
|
var PLANS_DIRECTORY_NAME = "plans";
|
|
33647
33568
|
var PLAN_RESULT_BODY_CAP_BYTES = 2 * PLAN_BODY_CAP_BYTES;
|
|
33648
33569
|
var PLAN_SUFFIX = ".jsonl";
|
|
33570
|
+
var PLAN_RETAIN_DAYS = 30;
|
|
33649
33571
|
var PRUNE_INTERVAL_MS$2 = 864e5;
|
|
33650
33572
|
var FILE_MODE = 384;
|
|
33651
33573
|
function carriesPlanBody(event) {
|
|
@@ -33694,7 +33616,7 @@ function createPlanReviewWiring({ configPath = null, logger = console, nowFn = D
|
|
|
33694
33616
|
const heldByKey = /* @__PURE__ */ new Map();
|
|
33695
33617
|
const draftWatchByKey = /* @__PURE__ */ new Map();
|
|
33696
33618
|
let nextHoldId = 0;
|
|
33697
|
-
for (const entry of readPlanDirectorySync()) if (entry.endsWith(
|
|
33619
|
+
for (const entry of readPlanDirectorySync()) if (entry.endsWith(PLAN_SUFFIX)) sessionIdsWithPlans.add(entry.slice(0, -6));
|
|
33698
33620
|
function readPlanDirectorySync() {
|
|
33699
33621
|
try {
|
|
33700
33622
|
return fs.readdirSync(plansDirectory);
|
|
@@ -34165,7 +34087,7 @@ function createPlanReviewWiring({ configPath = null, logger = console, nowFn = D
|
|
|
34165
34087
|
const removed = await pruneAgedFiles({
|
|
34166
34088
|
directory: plansDirectory,
|
|
34167
34089
|
suffixes: [PLAN_SUFFIX],
|
|
34168
|
-
retainDays:
|
|
34090
|
+
retainDays: PLAN_RETAIN_DAYS,
|
|
34169
34091
|
now: nowFn(),
|
|
34170
34092
|
isRetainedId: (sessionId) => attachedSessionIds.has(sessionId)
|
|
34171
34093
|
});
|
|
@@ -34681,7 +34603,7 @@ function buildIssueSessionPrompt({ issue, projectName, host, url } = {}) {
|
|
|
34681
34603
|
return lines.join("\n");
|
|
34682
34604
|
}
|
|
34683
34605
|
//#endregion
|
|
34684
|
-
//#region server/posthog-api.ts
|
|
34606
|
+
//#region server/radar/posthog-api.ts
|
|
34685
34607
|
var DEFAULT_ISSUE_LIMIT = 50;
|
|
34686
34608
|
var DEFAULT_DATE_RANGE_HOURS = 24;
|
|
34687
34609
|
var CURRENT_WINDOW_MINUTES = 60;
|
|
@@ -35252,7 +35174,7 @@ function decideTrafficSpike({ currentUsers, baseline, prev, now, cfg } = {}) {
|
|
|
35252
35174
|
}), multiple);
|
|
35253
35175
|
}
|
|
35254
35176
|
//#endregion
|
|
35255
|
-
//#region server/
|
|
35177
|
+
//#region server/radar/radar-poller.ts
|
|
35256
35178
|
var OBSERVATION_PINGS = {
|
|
35257
35179
|
spiking: {
|
|
35258
35180
|
kind: "spike",
|
|
@@ -35284,7 +35206,7 @@ function issueEntryOf(state, key) {
|
|
|
35284
35206
|
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
35285
35207
|
return value;
|
|
35286
35208
|
}
|
|
35287
|
-
function
|
|
35209
|
+
function createRadarPoller(deps) {
|
|
35288
35210
|
const { api, host = "", resolveProjects = async () => [], spawnInvestigation, telegram = () => {}, readState = async () => ({}), writeState = async () => {}, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, log = console, onTickComplete = () => {}, onInvestigationActivity = () => {}, now = () => Date.now() } = deps;
|
|
35289
35211
|
const intervalMinutes = deps.intervalMinutes || 15;
|
|
35290
35212
|
const maxConcurrentInvestigations = deps.maxConcurrentInvestigations || 2;
|
|
@@ -35439,7 +35361,7 @@ function createPosthogPoller(deps) {
|
|
|
35439
35361
|
cancelPendingActivity(change.key);
|
|
35440
35362
|
const trail = trails.get(change.key);
|
|
35441
35363
|
onInvestigationActivity({
|
|
35442
|
-
type: "
|
|
35364
|
+
type: "radar-investigation-finished",
|
|
35443
35365
|
projectId: change.projectId,
|
|
35444
35366
|
issueId: String(change.issue.issueId),
|
|
35445
35367
|
verdict,
|
|
@@ -35468,7 +35390,7 @@ function createPosthogPoller(deps) {
|
|
|
35468
35390
|
const trail = trails.get(change.key);
|
|
35469
35391
|
if (!trail) return;
|
|
35470
35392
|
onInvestigationActivity({
|
|
35471
|
-
type: "
|
|
35393
|
+
type: "radar-investigation-activity",
|
|
35472
35394
|
projectId: change.projectId,
|
|
35473
35395
|
issueId: String(change.issue.issueId),
|
|
35474
35396
|
inFlight: true,
|
|
@@ -35818,7 +35740,7 @@ function createPosthogPoller(deps) {
|
|
|
35818
35740
|
projects
|
|
35819
35741
|
};
|
|
35820
35742
|
onTickComplete({
|
|
35821
|
-
type: "
|
|
35743
|
+
type: "radar-status",
|
|
35822
35744
|
ts,
|
|
35823
35745
|
intervalMinutes,
|
|
35824
35746
|
projects,
|
|
@@ -35851,7 +35773,7 @@ function createPosthogPoller(deps) {
|
|
|
35851
35773
|
};
|
|
35852
35774
|
}
|
|
35853
35775
|
//#endregion
|
|
35854
|
-
//#region server/
|
|
35776
|
+
//#region server/radar/radar-report.ts
|
|
35855
35777
|
var DEFAULT_POSTHOG_REPORT_DIR = path.join(glimmervoidHomeDir$1(), "posthog-reports");
|
|
35856
35778
|
var POSTHOG_REPORT_ID_RE = /^[A-Za-z0-9_-]{1,128}$/;
|
|
35857
35779
|
function confinePath(baseDir, ...segments) {
|
|
@@ -35985,7 +35907,7 @@ async function sendTelegramMessage({ botToken, chatId, text, tag = "telegram", t
|
|
|
35985
35907
|
}
|
|
35986
35908
|
}
|
|
35987
35909
|
//#endregion
|
|
35988
|
-
//#region server/
|
|
35910
|
+
//#region server/radar/radar-wiring.ts
|
|
35989
35911
|
var POSTHOG_DENY = { deny: [
|
|
35990
35912
|
"Bash(gh pr merge:*)",
|
|
35991
35913
|
"Bash(gh pr create:*)",
|
|
@@ -36010,8 +35932,9 @@ var FIX_DENY = { deny: [
|
|
|
36010
35932
|
] };
|
|
36011
35933
|
var REPORT_DIR = DEFAULT_POSTHOG_REPORT_DIR;
|
|
36012
35934
|
var WORK_DIR = path.join(glimmervoidHomeDir$1(), "posthog-work");
|
|
35935
|
+
var REPORT_RETAIN_FILES = 20;
|
|
36013
35936
|
var FORCE_TICK_DEBOUNCE_MS = 3e3;
|
|
36014
|
-
async function
|
|
35937
|
+
async function radarLaneRole(facts, { writableRoots, commitCheckout }) {
|
|
36015
35938
|
const commitCheckouts = commitCheckout === null ? [] : [{
|
|
36016
35939
|
checkout: commitCheckout,
|
|
36017
35940
|
gitDir: await readLaneCommonGitDir(commitCheckout)
|
|
@@ -36152,7 +36075,7 @@ function buildFixPrompt({ issueId, projectId, host, resultPath, repoPath, branch
|
|
|
36152
36075
|
"preamble, no emoji, no em or en dashes."
|
|
36153
36076
|
].join("\n");
|
|
36154
36077
|
}
|
|
36155
|
-
async function sweepReports(dir = REPORT_DIR, retain =
|
|
36078
|
+
async function sweepReports(dir = REPORT_DIR, retain = REPORT_RETAIN_FILES) {
|
|
36156
36079
|
try {
|
|
36157
36080
|
const names = (await fs.promises.readdir(dir)).filter((n) => n.endsWith(".html") || n.endsWith(".md"));
|
|
36158
36081
|
if (names.length <= retain) return;
|
|
@@ -36311,7 +36234,7 @@ function fallbackPrBody({ issueUrl, reproduced, summary }) {
|
|
|
36311
36234
|
`Agent summary: ${summaryLineFromReportText(summary) || "(none written)"}`
|
|
36312
36235
|
].join("\n");
|
|
36313
36236
|
}
|
|
36314
|
-
function
|
|
36237
|
+
function radarShouldStart(cfg) {
|
|
36315
36238
|
const p = cfg.posthog;
|
|
36316
36239
|
if (!p || !p.enabled) return {
|
|
36317
36240
|
start: false,
|
|
@@ -36366,7 +36289,7 @@ function makeResolveProjects(api, config) {
|
|
|
36366
36289
|
return out;
|
|
36367
36290
|
};
|
|
36368
36291
|
}
|
|
36369
|
-
function
|
|
36292
|
+
function createRadarWiring({ config, investigationSessions, closeSessionDataClients, hookRouter, getHookPort, spawnGate, gitWorkspace = null, runCommand = runCli, broadcast = () => {}, recordLane = null, makeSession = (options) => new Session(options), resolveHookTools: resolveHookTools$1 = resolveHookTools, sandbox = {} }) {
|
|
36370
36293
|
function activePosthogConfig() {
|
|
36371
36294
|
const posthogConfig = config.posthog;
|
|
36372
36295
|
if (!posthogConfig?.apiKey) throw new Error("PostHog lane started without its required configuration");
|
|
@@ -36377,7 +36300,7 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
|
|
|
36377
36300
|
};
|
|
36378
36301
|
}
|
|
36379
36302
|
function makeInvestigationSession({ id, name, path: cwd, initialPrompt, spawnEnv, access, permissions = POSTHOG_DENY, onActivity = null }) {
|
|
36380
|
-
const prepareSandbox = prepareRoleSandbox((facts) =>
|
|
36303
|
+
const prepareSandbox = prepareRoleSandbox((facts) => radarLaneRole(facts, access), sandbox);
|
|
36381
36304
|
const sess = makeSession({
|
|
36382
36305
|
id,
|
|
36383
36306
|
name,
|
|
@@ -36457,7 +36380,7 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
|
|
|
36457
36380
|
signal,
|
|
36458
36381
|
spawnGate
|
|
36459
36382
|
});
|
|
36460
|
-
async function
|
|
36383
|
+
async function radarFixSpawn({ issue, projectId, projectName, url, signal, onActivity = null }) {
|
|
36461
36384
|
const posthogConfig = activePosthogConfig();
|
|
36462
36385
|
if (!gitWorkspace) return null;
|
|
36463
36386
|
const repoPath = resolveRepoPath(projectId);
|
|
@@ -36556,10 +36479,10 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
|
|
|
36556
36479
|
})).catch((e) => console.warn(`[posthog-poller] fix worktree discard failed: ${errorMessage(e)}`));
|
|
36557
36480
|
}
|
|
36558
36481
|
}
|
|
36559
|
-
async function
|
|
36482
|
+
async function radarInvestigationSpawn({ issue, projectId, projectName, url, mode, signal, onActivity }) {
|
|
36560
36483
|
const posthogConfig = activePosthogConfig();
|
|
36561
36484
|
if (normalizeJobMode(mode) === JOB_MODES.fix) {
|
|
36562
|
-
const fixed = await
|
|
36485
|
+
const fixed = await radarFixSpawn({
|
|
36563
36486
|
issue,
|
|
36564
36487
|
projectId,
|
|
36565
36488
|
projectName,
|
|
@@ -36655,13 +36578,13 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
|
|
|
36655
36578
|
const runner = createLaneRunner({
|
|
36656
36579
|
tag: "posthog-poller",
|
|
36657
36580
|
gate: () => {
|
|
36658
|
-
const verdict =
|
|
36581
|
+
const verdict = radarShouldStart(config);
|
|
36659
36582
|
if (verdict.reason) return verdict;
|
|
36660
36583
|
return { start: verdict.start };
|
|
36661
36584
|
},
|
|
36662
36585
|
cfgKey: () => posthogCfgKey(config),
|
|
36663
36586
|
emptyStatus: () => ({
|
|
36664
|
-
...emptyLaneStatus("
|
|
36587
|
+
...emptyLaneStatus("radar-status", radarShouldStart(config)),
|
|
36665
36588
|
intervalMinutes: config.posthog?.intervalMinutes || 15,
|
|
36666
36589
|
investigations: []
|
|
36667
36590
|
}),
|
|
@@ -36677,12 +36600,12 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
|
|
|
36677
36600
|
host: posthogConfig.host,
|
|
36678
36601
|
apiKey: posthogConfig.apiKey
|
|
36679
36602
|
});
|
|
36680
|
-
return
|
|
36603
|
+
return createRadarPoller({
|
|
36681
36604
|
firstTickDelayMs: bootStaggerDelay,
|
|
36682
36605
|
api,
|
|
36683
36606
|
host: posthogConfig.host,
|
|
36684
36607
|
resolveProjects: makeResolveProjects(api, config),
|
|
36685
|
-
spawnInvestigation:
|
|
36608
|
+
spawnInvestigation: radarInvestigationSpawn,
|
|
36686
36609
|
telegram: (text) => {
|
|
36687
36610
|
sendTelegramMessage({
|
|
36688
36611
|
botToken,
|
|
@@ -36757,7 +36680,7 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
|
|
|
36757
36680
|
setIssueStatus,
|
|
36758
36681
|
archiveInvestigation,
|
|
36759
36682
|
_makeInvestigationSession: makeInvestigationSession,
|
|
36760
|
-
_investigationSpawn:
|
|
36683
|
+
_investigationSpawn: radarInvestigationSpawn
|
|
36761
36684
|
};
|
|
36762
36685
|
}
|
|
36763
36686
|
//#endregion
|
|
@@ -36781,7 +36704,7 @@ function myPrMergeRefusal(pr, seenHeadRefOid) {
|
|
|
36781
36704
|
return null;
|
|
36782
36705
|
}
|
|
36783
36706
|
//#endregion
|
|
36784
|
-
//#region server/core/my-prs-core.ts
|
|
36707
|
+
//#region server/github/core/my-prs-core.ts
|
|
36785
36708
|
var FailedAutoRebaseRecord = z.strictObject({
|
|
36786
36709
|
attemptKey: MyPrsState.shape.keepMergeableAttemptKeys.element,
|
|
36787
36710
|
autoRebase: MyPrAutoRebase
|
|
@@ -37280,7 +37203,7 @@ function myPrsShouldStart(settings) {
|
|
|
37280
37203
|
return { start: true };
|
|
37281
37204
|
}
|
|
37282
37205
|
//#endregion
|
|
37283
|
-
//#region server/my-prs-poller.ts
|
|
37206
|
+
//#region server/github/my-prs-poller.ts
|
|
37284
37207
|
var MY_PRS_RATE_LIMIT_RESOURCES = ["graphql"];
|
|
37285
37208
|
function createMyPrsPoller(dependencies) {
|
|
37286
37209
|
const { org, shouldAutoRebase = false, isKeepMergeableEnabled = true, isMergeQueueEnabled = true, github, onTickComplete, now = Date.now, intervalMinutes = 5, setIntervalFn, clearIntervalFn, setTimeoutFn, clearTimeoutFn, clock, firstTickDelayMs, log } = dependencies;
|
|
@@ -37803,7 +37726,7 @@ function installCommitSigningShim({ binDir, nodePath, cliPath, platform = proces
|
|
|
37803
37726
|
}
|
|
37804
37727
|
}
|
|
37805
37728
|
//#endregion
|
|
37806
|
-
//#region server/my-prs-wiring.ts
|
|
37729
|
+
//#region server/github/my-prs-wiring.ts
|
|
37807
37730
|
var MERGE_ERROR_MAX_CHARACTERS = 300;
|
|
37808
37731
|
var TRUSTED_GIT_TIMEOUT_MS = 6e5;
|
|
37809
37732
|
var EMPTY_TREE_SHA = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
|
|
@@ -39054,13 +38977,13 @@ function createWorkflowsWiring({ config, notificationManager, spawnSession, log
|
|
|
39054
38977
|
};
|
|
39055
38978
|
}
|
|
39056
38979
|
//#endregion
|
|
39057
|
-
//#region server/core/github-clock-core.ts
|
|
38980
|
+
//#region server/github/core/github-clock-core.ts
|
|
39058
38981
|
function runsEveryTicks(intervalMs, baseIntervalMs) {
|
|
39059
38982
|
if (!Number.isFinite(intervalMs) || !Number.isFinite(baseIntervalMs) || baseIntervalMs <= 0) return 1;
|
|
39060
38983
|
return Math.max(1, Math.round(intervalMs / baseIntervalMs));
|
|
39061
38984
|
}
|
|
39062
38985
|
//#endregion
|
|
39063
|
-
//#region server/github-clock.ts
|
|
38986
|
+
//#region server/github/github-clock.ts
|
|
39064
38987
|
function createGithubClock({ baseIntervalMs, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, log = console }) {
|
|
39065
38988
|
const subscriptions = /* @__PURE__ */ new Set();
|
|
39066
38989
|
let timer = null;
|
|
@@ -39207,7 +39130,7 @@ function createTelegramChannel({ getConfig, getConnectionCount, getActiveAgentCo
|
|
|
39207
39130
|
};
|
|
39208
39131
|
}
|
|
39209
39132
|
//#endregion
|
|
39210
|
-
//#region server/core/usage-budget-core.ts
|
|
39133
|
+
//#region server/usage/core/usage-budget-core.ts
|
|
39211
39134
|
var BUDGET_THRESHOLDS = Object.freeze([
|
|
39212
39135
|
50,
|
|
39213
39136
|
75,
|
|
@@ -39348,7 +39271,7 @@ function toneForPct(pct) {
|
|
|
39348
39271
|
return "ok";
|
|
39349
39272
|
}
|
|
39350
39273
|
//#endregion
|
|
39351
|
-
//#region server/core/usage-pricing-core.ts
|
|
39274
|
+
//#region server/usage/core/usage-pricing-core.ts
|
|
39352
39275
|
var MARGINAL_TIER_THRESHOLD = 2e5;
|
|
39353
39276
|
function normalizePricingTable(rawLiteLlmJson) {
|
|
39354
39277
|
const container = rawLiteLlmJson;
|
|
@@ -39476,7 +39399,7 @@ function resolvedPrice(key, price, isExact) {
|
|
|
39476
39399
|
};
|
|
39477
39400
|
}
|
|
39478
39401
|
//#endregion
|
|
39479
|
-
//#region server/core/usage-entry-core.ts
|
|
39402
|
+
//#region server/usage/core/usage-entry-core.ts
|
|
39480
39403
|
var NULL_REJECT_FIELDS = Object.freeze([
|
|
39481
39404
|
["id"],
|
|
39482
39405
|
["cwd"],
|
|
@@ -39766,7 +39689,7 @@ function presentEmpty(value) {
|
|
|
39766
39689
|
return typeof value === "string" && value.trim() === "";
|
|
39767
39690
|
}
|
|
39768
39691
|
//#endregion
|
|
39769
|
-
//#region server/core/usage-aggregate-core.ts
|
|
39692
|
+
//#region server/usage/core/usage-aggregate-core.ts
|
|
39770
39693
|
function buildUsageReport(entries, { now = Date.now(), blockHours = 5, retainDays = 90, sessionsById = /* @__PURE__ */ new Map(), tz = null } = {}) {
|
|
39771
39694
|
const keptEntries = pruneEntries(entries, {
|
|
39772
39695
|
now,
|
|
@@ -39889,7 +39812,7 @@ function serializeDailyBucket(bucket) {
|
|
|
39889
39812
|
};
|
|
39890
39813
|
}
|
|
39891
39814
|
//#endregion
|
|
39892
|
-
//#region server/core/usage-savings-core.ts
|
|
39815
|
+
//#region server/usage/core/usage-savings-core.ts
|
|
39893
39816
|
var DAY_KEY_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
39894
39817
|
function normalizeRtkGain(parsed) {
|
|
39895
39818
|
if (!isRecord(parsed)) return null;
|
|
@@ -39949,7 +39872,7 @@ function computeCacheSavings(modelRows, pricingTable) {
|
|
|
39949
39872
|
};
|
|
39950
39873
|
}
|
|
39951
39874
|
//#endregion
|
|
39952
|
-
//#region server/core/usage-statusline-core.ts
|
|
39875
|
+
//#region server/usage/core/usage-statusline-core.ts
|
|
39953
39876
|
var PCT_DECIMALS = 1;
|
|
39954
39877
|
var SECONDS_CEILING = 0xe8d4a51000;
|
|
39955
39878
|
function roundPct(value) {
|
|
@@ -40037,7 +39960,7 @@ var claude_pricing_default = {
|
|
|
40037
39960
|
models: /* @__PURE__ */ JSON.parse("{\"claude-3-5-haiku-20241022\":{\"input_cost_per_token\":8e-7,\"output_cost_per_token\":0.000004,\"cache_creation_input_token_cost\":0.000001,\"cache_read_input_token_cost\":8e-8,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-5-haiku-latest\":{\"input_cost_per_token\":8e-7,\"output_cost_per_token\":0.000004,\"cache_creation_input_token_cost\":0.000001,\"cache_read_input_token_cost\":8e-8,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-5-sonnet-20240620\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-5-sonnet-20241022\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-5-sonnet-latest\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-7-sonnet-20250219\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-haiku-20240307\":{\"input_cost_per_token\":2.5e-7,\"output_cost_per_token\":0.00000125,\"cache_creation_input_token_cost\":3e-7,\"cache_read_input_token_cost\":3e-8,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-opus-20240229\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.000075,\"cache_creation_input_token_cost\":0.00001875,\"cache_read_input_token_cost\":0.0000015,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-4-opus-20250514\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.000075,\"cache_creation_input_token_cost\":0.00001875,\"cache_read_input_token_cost\":0.0000015,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-4-sonnet-20250514\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\",\"cache_creation_input_token_cost_above_200k_tokens\":0.0000075,\"cache_read_input_token_cost_above_200k_tokens\":6e-7,\"input_cost_per_token_above_200k_tokens\":0.000006,\"output_cost_per_token_above_200k_tokens\":0.0000225},\"claude-fable-5\":{\"input_cost_per_token\":0.00001,\"output_cost_per_token\":0.00005,\"cache_creation_input_token_cost\":0.0000125,\"cache_read_input_token_cost\":0.000001,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-fable-5-1\":{\"input_cost_per_token\":0.00001,\"output_cost_per_token\":0.00005,\"cache_creation_input_token_cost\":0.0000125,\"cache_read_input_token_cost\":2.5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-haiku-4-5\":{\"input_cost_per_token\":0.000001,\"output_cost_per_token\":0.000005,\"cache_creation_input_token_cost\":0.00000125,\"cache_read_input_token_cost\":1e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-haiku-4-5-20251001\":{\"input_cost_per_token\":0.000001,\"output_cost_per_token\":0.000005,\"cache_creation_input_token_cost\":0.00000125,\"cache_read_input_token_cost\":1e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-haiku-5-5\":{\"input_cost_per_token\":1e-7,\"output_cost_per_token\":5e-7,\"cache_creation_input_token_cost\":1.25e-7,\"cache_read_input_token_cost\":1e-8,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\",\"long_context_threshold\":100000,\"input_cost_per_token_above_200k_tokens\":5e-7,\"output_cost_per_token_above_200k_tokens\":0.0000025,\"cache_creation_input_token_cost_above_200k_tokens\":6.25e-7,\"cache_read_input_token_cost_above_200k_tokens\":5e-8},\"claude-mythos-5\":{\"input_cost_per_token\":0.00001,\"output_cost_per_token\":0.00005,\"cache_creation_input_token_cost\":0.0000125,\"cache_read_input_token_cost\":0.000001,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-mythos-5-1\":{\"input_cost_per_token\":0.00001,\"output_cost_per_token\":0.00005,\"cache_creation_input_token_cost\":0.0000125,\"cache_read_input_token_cost\":2.5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-mythos-preview\":{\"input_cost_per_token\":0.00001,\"output_cost_per_token\":0.00005,\"cache_creation_input_token_cost\":0.0000125,\"cache_read_input_token_cost\":0.000001,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-1\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.000075,\"cache_creation_input_token_cost\":0.00001875,\"cache_read_input_token_cost\":0.0000015,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-1-20250805\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.000075,\"cache_creation_input_token_cost\":0.00001875,\"cache_read_input_token_cost\":0.0000015,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-20250514\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.000075,\"cache_creation_input_token_cost\":0.00001875,\"cache_read_input_token_cost\":0.0000015,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-5\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-5-20251101\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-6\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-6-20260205\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-7\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-7-20260416\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-8\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-5\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-5-5\":{\"input_cost_per_token\":0.000004,\"output_cost_per_token\":0.00002,\"cache_creation_input_token_cost\":0.000005,\"cache_read_input_token_cost\":2e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-sonnet-4-20250514\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\",\"cache_creation_input_token_cost_above_200k_tokens\":0.0000075,\"cache_read_input_token_cost_above_200k_tokens\":6e-7,\"input_cost_per_token_above_200k_tokens\":0.000006,\"output_cost_per_token_above_200k_tokens\":0.0000225},\"claude-sonnet-4-5\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\",\"cache_creation_input_token_cost_above_1hr_above_200k_tokens\":0.000012,\"cache_creation_input_token_cost_above_200k_tokens\":0.0000075,\"cache_read_input_token_cost_above_200k_tokens\":6e-7,\"input_cost_per_token_above_200k_tokens\":0.000006,\"output_cost_per_token_above_200k_tokens\":0.0000225},\"claude-sonnet-4-5-20250929\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\",\"cache_creation_input_token_cost_above_1hr_above_200k_tokens\":0.000012,\"cache_creation_input_token_cost_above_200k_tokens\":0.0000075,\"cache_read_input_token_cost_above_200k_tokens\":6e-7,\"input_cost_per_token_above_200k_tokens\":0.000006,\"output_cost_per_token_above_200k_tokens\":0.0000225},\"claude-sonnet-4-6\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-sonnet-5\":{\"input_cost_per_token\":0.000002,\"output_cost_per_token\":0.00001,\"cache_creation_input_token_cost\":0.0000025,\"cache_read_input_token_cost\":2e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-sonnet-5-5\":{\"input_cost_per_token\":0.000002,\"output_cost_per_token\":0.00001,\"cache_creation_input_token_cost\":0.0000025,\"cache_read_input_token_cost\":2e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"gpt-5\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-2025-08-07\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-chat\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":128000,\"litellm_provider\":\"openai\"},\"gpt-5-chat-latest\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":128000,\"litellm_provider\":\"openai\"},\"gpt-5-codex\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-mini\":{\"input_cost_per_token\":2.5e-7,\"output_cost_per_token\":0.000002,\"cache_read_input_token_cost\":2.5e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-mini-2025-08-07\":{\"input_cost_per_token\":2.5e-7,\"output_cost_per_token\":0.000002,\"cache_read_input_token_cost\":2.5e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-nano\":{\"input_cost_per_token\":5e-8,\"output_cost_per_token\":4e-7,\"cache_read_input_token_cost\":5e-9,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-nano-2025-08-07\":{\"input_cost_per_token\":5e-8,\"output_cost_per_token\":4e-7,\"cache_read_input_token_cost\":5e-9,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-pro\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.00012,\"max_input_tokens\":400000,\"litellm_provider\":\"openai\"},\"gpt-5-pro-2025-10-06\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.00012,\"max_input_tokens\":400000,\"litellm_provider\":\"openai\"},\"gpt-5-search-api\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-search-api-2025-10-14\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.1\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.1-2025-11-13\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.1-chat-latest\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":128000,\"litellm_provider\":\"openai\"},\"gpt-5.1-codex\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.1-codex-max\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.1-codex-mini\":{\"input_cost_per_token\":2.5e-7,\"output_cost_per_token\":0.000002,\"cache_read_input_token_cost\":2.5e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.2\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.2-2025-12-11\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.2-chat-latest\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":128000,\"litellm_provider\":\"openai\"},\"gpt-5.2-codex\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.2-pro\":{\"input_cost_per_token\":0.000021,\"output_cost_per_token\":0.000168,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.2-pro-2025-12-11\":{\"input_cost_per_token\":0.000021,\"output_cost_per_token\":0.000168,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.3-chat-latest\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":128000,\"litellm_provider\":\"openai\"},\"gpt-5.3-codex\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.4\":{\"input_cost_per_token\":0.0000025,\"output_cost_per_token\":0.000015,\"cache_read_input_token_cost\":2.5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.4-2026-03-05\":{\"input_cost_per_token\":0.0000025,\"output_cost_per_token\":0.000015,\"cache_read_input_token_cost\":2.5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.4-mini\":{\"input_cost_per_token\":7.5e-7,\"output_cost_per_token\":0.0000045,\"cache_read_input_token_cost\":7.5e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.4-mini-2026-03-17\":{\"input_cost_per_token\":7.5e-7,\"output_cost_per_token\":0.0000045,\"cache_read_input_token_cost\":7.5e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.4-nano\":{\"input_cost_per_token\":2e-7,\"output_cost_per_token\":0.00000125,\"cache_read_input_token_cost\":2e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.4-nano-2026-03-17\":{\"input_cost_per_token\":2e-7,\"output_cost_per_token\":0.00000125,\"cache_read_input_token_cost\":2e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.4-pro\":{\"input_cost_per_token\":0.00003,\"output_cost_per_token\":0.00018,\"cache_read_input_token_cost\":0.000003,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.4-pro-2026-03-05\":{\"input_cost_per_token\":0.00003,\"output_cost_per_token\":0.00018,\"cache_read_input_token_cost\":0.000003,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.5\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.00003,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.5-2026-04-23\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.00003,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.5-pro\":{\"input_cost_per_token\":0.00003,\"output_cost_per_token\":0.00018,\"cache_read_input_token_cost\":0.000003,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.5-pro-2026-04-23\":{\"input_cost_per_token\":0.00003,\"output_cost_per_token\":0.00018,\"cache_read_input_token_cost\":0.000003,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.6\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.00003,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.6-luna\":{\"input_cost_per_token\":2e-7,\"output_cost_per_token\":0.0000012,\"cache_creation_input_token_cost\":2.5e-7,\"cache_read_input_token_cost\":2e-8,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.6-sol\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.00003,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.6-terra\":{\"input_cost_per_token\":0.000002,\"output_cost_per_token\":0.000012,\"cache_creation_input_token_cost\":0.0000025,\"cache_read_input_token_cost\":2e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"}}")
|
|
40038
39961
|
};
|
|
40039
39962
|
//#endregion
|
|
40040
|
-
//#region server/usage-pricing.ts
|
|
39963
|
+
//#region server/usage/usage-pricing.ts
|
|
40041
39964
|
var LITELLM_PRICING_URL = "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json";
|
|
40042
39965
|
var CACHE_TTL_MS = 864e5;
|
|
40043
39966
|
var SNAPSHOT_FIELDS = Object.freeze([
|
|
@@ -40199,7 +40122,7 @@ async function loadPricing({ fetchEnabled, fsPromises = fsp, fetchFn = globalThi
|
|
|
40199
40122
|
};
|
|
40200
40123
|
}
|
|
40201
40124
|
//#endregion
|
|
40202
|
-
//#region server/core/usage-anomaly-core.ts
|
|
40125
|
+
//#region server/usage/core/usage-anomaly-core.ts
|
|
40203
40126
|
function dailyBaseline(dailyRows, { excludeDay } = {}) {
|
|
40204
40127
|
const usableRows = (dailyRows || []).filter((row) => isUsableDailyRow(row, excludeDay));
|
|
40205
40128
|
if (usableRows.length < 7) return null;
|
|
@@ -40253,7 +40176,7 @@ function tokensPerMinute(block) {
|
|
|
40253
40176
|
return numberOr(block.tokens, 0) / (durationMs / 6e4);
|
|
40254
40177
|
}
|
|
40255
40178
|
//#endregion
|
|
40256
|
-
//#region server/core/usage-blocks-core.ts
|
|
40179
|
+
//#region server/usage/core/usage-blocks-core.ts
|
|
40257
40180
|
var HOUR_MS = 36e5;
|
|
40258
40181
|
function buildBlocks(entriesAsc, { blockHours = 5, now = Date.now() } = {}) {
|
|
40259
40182
|
const duration = blockHours * HOUR_MS;
|
|
@@ -40342,7 +40265,7 @@ function hourFloor(timestampMs) {
|
|
|
40342
40265
|
return Math.floor(timestampMs / HOUR_MS) * HOUR_MS;
|
|
40343
40266
|
}
|
|
40344
40267
|
//#endregion
|
|
40345
|
-
//#region server/core/usage-codex-core.ts
|
|
40268
|
+
//#region server/usage/core/usage-codex-core.ts
|
|
40346
40269
|
function createCodexUsageState() {
|
|
40347
40270
|
return {
|
|
40348
40271
|
model: null,
|
|
@@ -40424,7 +40347,7 @@ function deltaFromTotal(totalUsage, previousTotalUsage) {
|
|
|
40424
40347
|
};
|
|
40425
40348
|
}
|
|
40426
40349
|
//#endregion
|
|
40427
|
-
//#region server/core/usage-grok-core.ts
|
|
40350
|
+
//#region server/usage/core/usage-grok-core.ts
|
|
40428
40351
|
function parseGrokUsageLine(line) {
|
|
40429
40352
|
const raw = parseJsonLine(line, "\"turn_completed\"");
|
|
40430
40353
|
if (!raw) return null;
|
|
@@ -40492,7 +40415,7 @@ function normalizeGrokModel(model) {
|
|
|
40492
40415
|
return stripped.endsWith("-build") ? stripped.slice(0, -6) : stripped;
|
|
40493
40416
|
}
|
|
40494
40417
|
//#endregion
|
|
40495
|
-
//#region server/core/usage-warehouse-core.ts
|
|
40418
|
+
//#region server/usage/core/usage-warehouse-core.ts
|
|
40496
40419
|
function rollupFromReport(daily) {
|
|
40497
40420
|
const records = [];
|
|
40498
40421
|
for (const dayRow of daily || []) {
|
|
@@ -40607,7 +40530,7 @@ function compareRecords(a, b) {
|
|
|
40607
40530
|
return a.model.localeCompare(b.model);
|
|
40608
40531
|
}
|
|
40609
40532
|
//#endregion
|
|
40610
|
-
//#region server/usage-scanner.ts
|
|
40533
|
+
//#region server/usage/usage-scanner.ts
|
|
40611
40534
|
var DEFAULT_BYTE_BUDGET = 67108864;
|
|
40612
40535
|
var DEFAULT_CHUNK_SIZE = 1048576;
|
|
40613
40536
|
var LINE_YIELD_INTERVAL = 5e3;
|
|
@@ -41546,7 +41469,7 @@ function createUsageScanner(deps = {}) {
|
|
|
41546
41469
|
return api;
|
|
41547
41470
|
}
|
|
41548
41471
|
//#endregion
|
|
41549
|
-
//#region server/usage-wiring.ts
|
|
41472
|
+
//#region server/usage/usage-wiring.ts
|
|
41550
41473
|
var DEFAULT_USAGE_CONFIG = Object.freeze({
|
|
41551
41474
|
enabled: true,
|
|
41552
41475
|
fetchPricing: true,
|
|
@@ -42148,7 +42071,7 @@ function createUsageWiring({ config, sessions = /* @__PURE__ */ new Map(), broad
|
|
|
42148
42071
|
};
|
|
42149
42072
|
}
|
|
42150
42073
|
//#endregion
|
|
42151
|
-
//#region server/usage-lane-ledger.ts
|
|
42074
|
+
//#region server/usage/usage-lane-ledger.ts
|
|
42152
42075
|
function createLaneLedger({ ledgerPath = null, fsPromises = fsp, nowFn = Date.now, retainDays = 365, logger = null } = {}) {
|
|
42153
42076
|
const laneLog = createLaneLog({
|
|
42154
42077
|
prefix: "[usage]",
|
|
@@ -42458,7 +42381,7 @@ function traceRecordsFromTranscriptLine(rawLine, context) {
|
|
|
42458
42381
|
return [rawRecord(rawLine, line, context)];
|
|
42459
42382
|
}
|
|
42460
42383
|
//#endregion
|
|
42461
|
-
//#region server/core/session-trace-core.ts
|
|
42384
|
+
//#region server/session/core/session-trace-core.ts
|
|
42462
42385
|
var MAX_SESSION_TRACE_READ_BYTES = 524288;
|
|
42463
42386
|
function unreadableRecordNotice(request, lineByteCount) {
|
|
42464
42387
|
return {
|
|
@@ -43347,7 +43270,7 @@ function createUploadsWiring({ configPath, liveSessionIds, setIntervalFn = DEFAU
|
|
|
43347
43270
|
};
|
|
43348
43271
|
}
|
|
43349
43272
|
//#endregion
|
|
43350
|
-
//#region server/visions-dispatch.ts
|
|
43273
|
+
//#region server/visions/visions-dispatch.ts
|
|
43351
43274
|
var RESULT_VERDICTS = /* @__PURE__ */ new Set([
|
|
43352
43275
|
"COMMENTS",
|
|
43353
43276
|
"NONE",
|
|
@@ -43707,7 +43630,7 @@ function fix(sourceDiagnostic, editRange, newText) {
|
|
|
43707
43630
|
};
|
|
43708
43631
|
}
|
|
43709
43632
|
//#endregion
|
|
43710
|
-
//#region server/core/visions-fix-core.ts
|
|
43633
|
+
//#region server/visions/core/visions-fix-core.ts
|
|
43711
43634
|
var AUTO_SAFE_CODES = Object.freeze(["repeated-word"]);
|
|
43712
43635
|
var QUICKFIX_KIND = "quickfix";
|
|
43713
43636
|
var FIX_TITLES = {
|
|
@@ -44825,7 +44748,7 @@ function createVisionsWiring({ debounceMs = 300, setTimeoutFn = DEFAULT_TIMER_FN
|
|
|
44825
44748
|
};
|
|
44826
44749
|
}
|
|
44827
44750
|
//#endregion
|
|
44828
|
-
//#region server/backend-lanes.ts
|
|
44751
|
+
//#region server/backend/backend-lanes.ts
|
|
44829
44752
|
function createBackendLanes(dependencies) {
|
|
44830
44753
|
const { config, makeSession, wireSessionEvents, configStore, sessions, agentSessions, sandboxRefusal, reviewSessions, investigationSessions, closeSessionDataClients, hookRouter, getHookPort, broadcastControl, broadcastLocalControl, controlWss, options, notificationManager, telemetry, logger } = dependencies;
|
|
44831
44754
|
const spawnGate = createSpawnGate();
|
|
@@ -44838,16 +44761,24 @@ function createBackendLanes(dependencies) {
|
|
|
44838
44761
|
});
|
|
44839
44762
|
laneLedger.load();
|
|
44840
44763
|
const recordLane = laneLedger.record;
|
|
44841
|
-
const
|
|
44842
|
-
|
|
44843
|
-
|
|
44844
|
-
|
|
44845
|
-
|
|
44846
|
-
|
|
44847
|
-
|
|
44848
|
-
|
|
44849
|
-
|
|
44764
|
+
const liveSessionMaps = () => [
|
|
44765
|
+
sessions,
|
|
44766
|
+
agentSessions,
|
|
44767
|
+
reviewSessions,
|
|
44768
|
+
investigationSessions,
|
|
44769
|
+
visionsSessions,
|
|
44770
|
+
changeMapSessions,
|
|
44771
|
+
taskTitleSessions,
|
|
44772
|
+
benchmarkSessions
|
|
44850
44773
|
];
|
|
44774
|
+
const allLiveSessions = () => liveSessionMaps().flatMap((sessionsById) => [...sessionsById.values()]);
|
|
44775
|
+
const findLiveSession = (id) => {
|
|
44776
|
+
for (const sessionsById of liveSessionMaps()) {
|
|
44777
|
+
const session = sessionsById.get(id);
|
|
44778
|
+
if (session) return session;
|
|
44779
|
+
}
|
|
44780
|
+
return null;
|
|
44781
|
+
};
|
|
44851
44782
|
const branchGc = createBranchGcWiring({
|
|
44852
44783
|
config,
|
|
44853
44784
|
gitWorkspace,
|
|
@@ -44904,7 +44835,7 @@ function createBackendLanes(dependencies) {
|
|
|
44904
44835
|
workLane: { sandboxRefusal }
|
|
44905
44836
|
}
|
|
44906
44837
|
});
|
|
44907
|
-
const posthog =
|
|
44838
|
+
const posthog = createRadarWiring({
|
|
44908
44839
|
config,
|
|
44909
44840
|
investigationSessions,
|
|
44910
44841
|
closeSessionDataClients,
|
|
@@ -45281,6 +45212,7 @@ function createBackendLanes(dependencies) {
|
|
|
45281
45212
|
}
|
|
45282
45213
|
return {
|
|
45283
45214
|
allLiveSessions,
|
|
45215
|
+
findLiveSession,
|
|
45284
45216
|
benchmarks,
|
|
45285
45217
|
benchmarkSessions,
|
|
45286
45218
|
branchGc,
|
|
@@ -45318,7 +45250,7 @@ function createBackendLanes(dependencies) {
|
|
|
45318
45250
|
};
|
|
45319
45251
|
}
|
|
45320
45252
|
//#endregion
|
|
45321
|
-
//#region server/backend-health.ts
|
|
45253
|
+
//#region server/backend/backend-health.ts
|
|
45322
45254
|
var HEALTH_SNAPSHOT_INTERVAL_MS = 1e4;
|
|
45323
45255
|
function createBackendHealth(dependencies) {
|
|
45324
45256
|
function buildHealthSnapshot() {
|
|
@@ -45822,6 +45754,9 @@ function planReplay(entries, { now = Date.now(), maxAgeMs = DEFAULT_MAX_AGE_MS,
|
|
|
45822
45754
|
expired
|
|
45823
45755
|
};
|
|
45824
45756
|
}
|
|
45757
|
+
//#endregion
|
|
45758
|
+
//#region notifications/telegram-outbox.ts
|
|
45759
|
+
var OUTBOX_VERSION = 1;
|
|
45825
45760
|
var DEFAULT_RETRY_INTERVAL_MS = 6e4;
|
|
45826
45761
|
function createTelegramOutbox({ filePath, send, now = Date.now, maxEntries = 50, maxAttempts = 5, maxAgeMs = DEFAULT_MAX_AGE_MS, retryIntervalMs = DEFAULT_RETRY_INTERVAL_MS, warn = console.warn, readFileSync = fs.readFileSync, writeJson = writeJsonAtomic, recordOutcome = () => {} }) {
|
|
45827
45762
|
let entries = [];
|
|
@@ -45871,7 +45806,7 @@ function createTelegramOutbox({ filePath, send, now = Date.now, maxEntries = 50,
|
|
|
45871
45806
|
}
|
|
45872
45807
|
function persist() {
|
|
45873
45808
|
const snapshot = {
|
|
45874
|
-
version:
|
|
45809
|
+
version: OUTBOX_VERSION,
|
|
45875
45810
|
entries: entries.slice()
|
|
45876
45811
|
};
|
|
45877
45812
|
return writeQueue.run(() => writeJson(filePath, snapshot, { mkdir: true })).catch((error) => warn(`[telegram-outbox] write failed: ${errorMessage(error)}`));
|
|
@@ -46028,7 +45963,7 @@ function createHeartbeat({ servers = [], intervalMs = DEFAULT_INTERVAL_MS, deadl
|
|
|
46028
45963
|
};
|
|
46029
45964
|
}
|
|
46030
45965
|
//#endregion
|
|
46031
|
-
//#region server/backend-notifications.ts
|
|
45966
|
+
//#region server/backend/backend-notifications.ts
|
|
46032
45967
|
var ESCALATION_INTERVAL_MS = 3e5;
|
|
46033
45968
|
var DEFAULT_PHONE_ESCALATION_MS = 3e5;
|
|
46034
45969
|
function createBackendNotifications(dependencies) {
|
|
@@ -46159,7 +46094,7 @@ function formatDiffAnnotationMessage(annotations) {
|
|
|
46159
46094
|
].join("\n");
|
|
46160
46095
|
}
|
|
46161
46096
|
//#endregion
|
|
46162
|
-
//#region server/core/github-issues-core.ts
|
|
46097
|
+
//#region server/github/core/github-issues-core.ts
|
|
46163
46098
|
var GITHUB_ISSUE_BODY_MAX_CHARS = 12e3;
|
|
46164
46099
|
function fencedBody(body) {
|
|
46165
46100
|
const longestBacktickRun = Math.max(0, ...Array.from(body.matchAll(/`+/g), (match) => match[0].length));
|
|
@@ -46209,7 +46144,7 @@ function buildSettingsPayload({ configStore, rtkInstallStatus = null, resolveRtk
|
|
|
46209
46144
|
};
|
|
46210
46145
|
}
|
|
46211
46146
|
//#endregion
|
|
46212
|
-
//#region server/core/change-map-core.ts
|
|
46147
|
+
//#region server/change-map/core/change-map-core.ts
|
|
46213
46148
|
var STATUS_BY_LETTER = {
|
|
46214
46149
|
A: "added",
|
|
46215
46150
|
C: "added",
|
|
@@ -46389,7 +46324,7 @@ function computeCoChange({ repoName, commits, changedPaths }) {
|
|
|
46389
46324
|
};
|
|
46390
46325
|
}
|
|
46391
46326
|
//#endregion
|
|
46392
|
-
//#region server/core/change-ownership-core.ts
|
|
46327
|
+
//#region server/change-map/core/change-ownership-core.ts
|
|
46393
46328
|
function readAgentsTitle(markdown) {
|
|
46394
46329
|
return markdown.match(/^# (.*)$/m)?.[1].trim() ?? "";
|
|
46395
46330
|
}
|
|
@@ -46973,7 +46908,7 @@ function computeCrossRepoLinks(repos) {
|
|
|
46973
46908
|
return linksByConsumer;
|
|
46974
46909
|
}
|
|
46975
46910
|
//#endregion
|
|
46976
|
-
//#region server/change-map-wiring.ts
|
|
46911
|
+
//#region server/change-map/change-map-wiring.ts
|
|
46977
46912
|
var GIT_TIMEOUT_MS = 15e3;
|
|
46978
46913
|
var GIT_MAX_BUFFER_BYTES = 67108864;
|
|
46979
46914
|
var FILE_READ_BATCH = 64;
|
|
@@ -47494,7 +47429,6 @@ Object.freeze([
|
|
|
47494
47429
|
...USAGE_VENDOR_KEYS.map((key) => `usage.vendors.${key}`),
|
|
47495
47430
|
...USAGE_BUDGET_KEYS.map((key) => `usage.budget.${key}`),
|
|
47496
47431
|
...TELEGRAM_STRING_KEYS.map((key) => `telegram.${key}`),
|
|
47497
|
-
"agentApi.enabled",
|
|
47498
47432
|
"guardrails.unguardedRepos",
|
|
47499
47433
|
"guardrails.blockedPaths",
|
|
47500
47434
|
"guardrails.unreadablePaths",
|
|
@@ -47567,16 +47501,16 @@ function requestValidationErrorReply(msg, message) {
|
|
|
47567
47501
|
agents: [],
|
|
47568
47502
|
error: message
|
|
47569
47503
|
}),
|
|
47570
|
-
"get-
|
|
47571
|
-
type: "
|
|
47504
|
+
"get-radar-report": () => ({
|
|
47505
|
+
type: "radar-report",
|
|
47572
47506
|
requestId,
|
|
47573
47507
|
ok: false,
|
|
47574
47508
|
found: false,
|
|
47575
47509
|
issueId: null,
|
|
47576
47510
|
error: message
|
|
47577
47511
|
}),
|
|
47578
|
-
"
|
|
47579
|
-
type: "
|
|
47512
|
+
"radar-open-session": () => ({
|
|
47513
|
+
type: "radar-open-session-result",
|
|
47580
47514
|
requestId,
|
|
47581
47515
|
ok: false,
|
|
47582
47516
|
error: message
|
|
@@ -47594,14 +47528,14 @@ function requestValidationErrorReply(msg, message) {
|
|
|
47594
47528
|
ok: false,
|
|
47595
47529
|
error: message
|
|
47596
47530
|
}),
|
|
47597
|
-
"
|
|
47598
|
-
type: "
|
|
47531
|
+
"radar-issue-action": () => ({
|
|
47532
|
+
type: "radar-issue-action-result",
|
|
47599
47533
|
requestId,
|
|
47600
47534
|
ok: false,
|
|
47601
47535
|
error: message
|
|
47602
47536
|
}),
|
|
47603
|
-
"
|
|
47604
|
-
type: "
|
|
47537
|
+
"radar-archive-investigation": () => ({
|
|
47538
|
+
type: "radar-archive-investigation-result",
|
|
47605
47539
|
requestId,
|
|
47606
47540
|
ok: false,
|
|
47607
47541
|
error: message
|
|
@@ -47613,8 +47547,8 @@ function requestValidationErrorReply(msg, message) {
|
|
|
47613
47547
|
ok: false,
|
|
47614
47548
|
error: message
|
|
47615
47549
|
}),
|
|
47616
|
-
"
|
|
47617
|
-
type: "
|
|
47550
|
+
"github-polling-refresh": () => ({
|
|
47551
|
+
type: "github-polling-refresh-result",
|
|
47618
47552
|
requestId,
|
|
47619
47553
|
ok: false,
|
|
47620
47554
|
error: message
|
|
@@ -47736,7 +47670,7 @@ function parseSinceParam(url) {
|
|
|
47736
47670
|
return Number.isFinite(n) ? n : null;
|
|
47737
47671
|
}
|
|
47738
47672
|
function registerControlHandlers(controlWss, deps) {
|
|
47739
|
-
const { sessions, agentSessions = /* @__PURE__ */ new Map(), config, configStore, broadcastControl, generateProjectId, applyConfigReload, applySettingsReload, requestShutdown, requestRestart, handleClientFocus, buildHealthSnapshot, getUpdateStatus, getUpdateJournal = null, checkNow = null, applyUpdate = null, isStaging = null, noteRestartRequested = null,
|
|
47673
|
+
const { sessions, agentSessions = /* @__PURE__ */ new Map(), config, configStore, broadcastControl, generateProjectId, applyConfigReload, applySettingsReload, requestShutdown, requestRestart, handleClientFocus, buildHealthSnapshot, getUpdateStatus, getUpdateJournal = null, checkNow = null, applyUpdate = null, isStaging = null, noteRestartRequested = null, getRadarStatus, posthogReportsDir = null, posthogSetIssueStatus = null, radarArchiveInvestigation = null, getTeamReviewStatus = null, getMyPrsStatus = null, getIssuesStatus = null, issues = null, teamReview = null, myPrs = null, getBenchmarkStatus = null, getFactoryState = null, benchmarks = null, factory = null, createGithubClient = createPrGh, issueProjectRepos = null, serverBuild = () => null, getUsageSessions = null, getUsageReport = null, requestUsageReport = null, getPlanLimits = null, controlReplayLog = null, getRtkInstallStatus = () => null, resolveRtkPath = () => getRtkPath(), conversationFs = fs, conversationGit = runGitForConversationHistory, conversationProjectsDir = claudeProjectsDir(process.env, os.homedir()), readTracePage = null, readPlanRevision = null, decidePlanReview = null, sessionDocs = null, changeMapNarrator = null } = deps;
|
|
47740
47674
|
const changeMaps = createChangeMapService({
|
|
47741
47675
|
sessions,
|
|
47742
47676
|
narrator: changeMapNarrator,
|
|
@@ -47821,7 +47755,7 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
47821
47755
|
repos,
|
|
47822
47756
|
agent: requestedAgent && requestedAgent !== DEFAULT_AGENT_ID ? requestedAgent : void 0,
|
|
47823
47757
|
dangerouslySkipPermissions: skipPerms,
|
|
47824
|
-
|
|
47758
|
+
unguarded: msg.unguarded === true,
|
|
47825
47759
|
requireExistingPath: !repos
|
|
47826
47760
|
});
|
|
47827
47761
|
if (!created.ok) {
|
|
@@ -47883,6 +47817,89 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
47883
47817
|
});
|
|
47884
47818
|
if (freshConfig) applyConfigReload(freshConfig);
|
|
47885
47819
|
}
|
|
47820
|
+
function handleGetWorkspaceRepos(msg, ws) {
|
|
47821
|
+
const project = findConfiguredProject(msg.id);
|
|
47822
|
+
if (!project?.repos) {
|
|
47823
|
+
replyTo(ws, msg, "workspace-repos", {
|
|
47824
|
+
id: msg.id,
|
|
47825
|
+
ok: false,
|
|
47826
|
+
repos: [],
|
|
47827
|
+
error: "This session is not a workspace"
|
|
47828
|
+
});
|
|
47829
|
+
return;
|
|
47830
|
+
}
|
|
47831
|
+
replyTo(ws, msg, "workspace-repos", {
|
|
47832
|
+
id: msg.id,
|
|
47833
|
+
ok: true,
|
|
47834
|
+
repos: project.repos,
|
|
47835
|
+
error: null
|
|
47836
|
+
});
|
|
47837
|
+
}
|
|
47838
|
+
async function findDroppedMemberWithUncommittedWork(workspaceFolder, droppedRepoPaths) {
|
|
47839
|
+
for (const repoPath of droppedRepoPaths) {
|
|
47840
|
+
const memberName = path.basename(path.resolve(repoPath));
|
|
47841
|
+
const memberDir = path.join(workspaceFolder, memberName);
|
|
47842
|
+
if (!await fs.promises.stat(memberDir).then(() => true, () => false)) continue;
|
|
47843
|
+
const memberStatus = await runGit([
|
|
47844
|
+
"--no-optional-locks",
|
|
47845
|
+
"status",
|
|
47846
|
+
"--porcelain"
|
|
47847
|
+
], { cwd: memberDir });
|
|
47848
|
+
if (!memberStatus.ok) throw memberStatus.error;
|
|
47849
|
+
if (memberStatus.out !== "") return memberName;
|
|
47850
|
+
}
|
|
47851
|
+
return null;
|
|
47852
|
+
}
|
|
47853
|
+
async function handleSetWorkspaceRepos(msg, ws) {
|
|
47854
|
+
const reply = (error) => replyTo(ws, msg, "set-workspace-repos-result", {
|
|
47855
|
+
id: msg.id,
|
|
47856
|
+
ok: error === null,
|
|
47857
|
+
error
|
|
47858
|
+
});
|
|
47859
|
+
const project = findConfiguredProject(msg.id);
|
|
47860
|
+
const session = sessions.get(msg.id);
|
|
47861
|
+
if (!project?.repos || !session) {
|
|
47862
|
+
reply("This session is not a workspace");
|
|
47863
|
+
return;
|
|
47864
|
+
}
|
|
47865
|
+
const missingRepo = msg.repos.find((repoPath) => !isExistingDirectory(repoPath));
|
|
47866
|
+
if (missingRepo) {
|
|
47867
|
+
reply(`Repository path does not exist: ${missingRepo}`);
|
|
47868
|
+
return;
|
|
47869
|
+
}
|
|
47870
|
+
const planned = planWorkspaceMembers({
|
|
47871
|
+
folder: project.path,
|
|
47872
|
+
sessionId: project.id,
|
|
47873
|
+
repoPaths: msg.repos
|
|
47874
|
+
});
|
|
47875
|
+
if (!planned.ok) {
|
|
47876
|
+
reply(planned.error);
|
|
47877
|
+
return;
|
|
47878
|
+
}
|
|
47879
|
+
const nextRepos = planned.plan.members.map((member) => member.repoPath);
|
|
47880
|
+
try {
|
|
47881
|
+
const dirtyMemberName = await findDroppedMemberWithUncommittedWork(project.path, listDroppedRepoPaths(project.repos, nextRepos));
|
|
47882
|
+
if (dirtyMemberName) {
|
|
47883
|
+
reply(`${dirtyMemberName} has uncommitted changes. Commit or discard them before removing it from the workspace.`);
|
|
47884
|
+
return;
|
|
47885
|
+
}
|
|
47886
|
+
} catch (error) {
|
|
47887
|
+
reply(`Could not check the workspace for uncommitted changes: ${errorMessage(error)}`);
|
|
47888
|
+
return;
|
|
47889
|
+
}
|
|
47890
|
+
const freshConfig = configStore.save((cfg) => {
|
|
47891
|
+
const configured = cfg.projects.find((entry) => entry.id === project.id);
|
|
47892
|
+
if (!configured) return ABORT_CONFIG_SAVE;
|
|
47893
|
+
configured.repos = nextRepos;
|
|
47894
|
+
});
|
|
47895
|
+
if (!freshConfig) {
|
|
47896
|
+
reply(`Could not save session "${project.name}"`);
|
|
47897
|
+
return;
|
|
47898
|
+
}
|
|
47899
|
+
applyConfigReload(freshConfig);
|
|
47900
|
+
console.log(`[control] Workspace repositories updated via UI: ${project.name} (${nextRepos.length} repos)`);
|
|
47901
|
+
reply(null);
|
|
47902
|
+
}
|
|
47886
47903
|
function handleSetSessionTitle(msg, ws) {
|
|
47887
47904
|
const session = findSession(msg);
|
|
47888
47905
|
const parsedTitle = TaskTitle.safeParse(msg.title);
|
|
@@ -48077,7 +48094,6 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48077
48094
|
if (s.usage != null) cfg.usage = s.usage;
|
|
48078
48095
|
if (incoming.ingest != null) cfg.ingest = mergeSettingsBlock(cfg.ingest, incoming.ingest, INGEST_SPEC);
|
|
48079
48096
|
if (s.telegram != null) cfg.telegram = mergeSettingsBlockOverStored(cfg.telegram, s.telegram);
|
|
48080
|
-
if (s.agentApi != null) cfg.agentApi = mergeSettingsBlockOverStored(cfg.agentApi, s.agentApi);
|
|
48081
48097
|
if (s.guardrails != null) cfg.guardrails = mergeSettingsBlockOverStored(cfg.guardrails, s.guardrails);
|
|
48082
48098
|
if (s.telemetry != null) cfg.telemetry = mergeSettingsBlockOverStored(cfg.telemetry, s.telemetry);
|
|
48083
48099
|
if (!workflowsUpdate) return void 0;
|
|
@@ -48139,16 +48155,16 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48139
48155
|
directories
|
|
48140
48156
|
}));
|
|
48141
48157
|
}
|
|
48142
|
-
async function
|
|
48158
|
+
async function handleGetRadarReport(msg, ws) {
|
|
48143
48159
|
const result = await readPosthogReport(msg.issueId, { reportDir: posthogReportsDir || void 0 });
|
|
48144
48160
|
ws.send(JSON.stringify({
|
|
48145
|
-
type: "
|
|
48161
|
+
type: "radar-report",
|
|
48146
48162
|
requestId: msg.requestId || null,
|
|
48147
48163
|
...result
|
|
48148
48164
|
}));
|
|
48149
48165
|
}
|
|
48150
48166
|
function findPosthogIssue(projectId, issueId) {
|
|
48151
|
-
const status = typeof
|
|
48167
|
+
const status = typeof getRadarStatus === "function" ? getRadarStatus() : null;
|
|
48152
48168
|
const projects = Array.isArray(status?.projects) ? status.projects : [];
|
|
48153
48169
|
for (const project of projects) {
|
|
48154
48170
|
if (String(project.projectId) !== String(projectId)) continue;
|
|
@@ -48191,7 +48207,7 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48191
48207
|
}
|
|
48192
48208
|
return entries;
|
|
48193
48209
|
}
|
|
48194
|
-
function createProjectSession({ name, path: projectPath, repos, agent, dangerouslySkipPermissions,
|
|
48210
|
+
function createProjectSession({ name, path: projectPath, repos, agent, dangerouslySkipPermissions, unguarded, requireExistingPath }) {
|
|
48195
48211
|
for (const [, session] of sessions) {
|
|
48196
48212
|
if (session.name !== name) continue;
|
|
48197
48213
|
return {
|
|
@@ -48232,7 +48248,7 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48232
48248
|
};
|
|
48233
48249
|
if (workspaceRepos) project.repos = workspaceRepos;
|
|
48234
48250
|
if (typeof dangerouslySkipPermissions === "boolean") project.dangerouslySkipPermissions = dangerouslySkipPermissions;
|
|
48235
|
-
if (
|
|
48251
|
+
if (unguarded) project.unguarded = true;
|
|
48236
48252
|
if (agent) project.agent = agent;
|
|
48237
48253
|
const freshConfig = configStore.save((cfg) => {
|
|
48238
48254
|
cfg.projects.push(project);
|
|
@@ -48346,7 +48362,7 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48346
48362
|
path: project.path,
|
|
48347
48363
|
agent: project.agent,
|
|
48348
48364
|
dangerouslySkipPermissions: project.dangerouslySkipPermissions,
|
|
48349
|
-
|
|
48365
|
+
unguarded: project.unguarded
|
|
48350
48366
|
});
|
|
48351
48367
|
if (!created.ok) {
|
|
48352
48368
|
reply({ error: created.error });
|
|
@@ -48378,8 +48394,8 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48378
48394
|
reply({ error: `Could not open GitHub issue session: ${errorMessage(error)}` });
|
|
48379
48395
|
}
|
|
48380
48396
|
}
|
|
48381
|
-
function
|
|
48382
|
-
const reply = (payload) => replyTo(ws, msg, "
|
|
48397
|
+
function handleRadarOpenSession(msg, ws) {
|
|
48398
|
+
const reply = (payload) => replyTo(ws, msg, "radar-open-session-result", {
|
|
48383
48399
|
ok: false,
|
|
48384
48400
|
error: null,
|
|
48385
48401
|
...payload
|
|
@@ -48423,8 +48439,8 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48423
48439
|
});
|
|
48424
48440
|
console.log(`[control] posthog-open-session: issue=${ref.issueId} -> session=${sess.name}`);
|
|
48425
48441
|
}
|
|
48426
|
-
async function
|
|
48427
|
-
const reply = (payload) => replyTo(ws, msg, "
|
|
48442
|
+
async function handleRadarIssueAction(msg, ws) {
|
|
48443
|
+
const reply = (payload) => replyTo(ws, msg, "radar-issue-action-result", {
|
|
48428
48444
|
ok: false,
|
|
48429
48445
|
error: null,
|
|
48430
48446
|
...payload
|
|
@@ -48481,20 +48497,20 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48481
48497
|
}
|
|
48482
48498
|
reply(await teamReview.submitAction(parsed.data));
|
|
48483
48499
|
}
|
|
48484
|
-
async function
|
|
48500
|
+
async function handleGithubPollingRefresh(msg, ws) {
|
|
48485
48501
|
const lane = {
|
|
48486
48502
|
"my-prs": myPrs,
|
|
48487
48503
|
"team-review": teamReview,
|
|
48488
48504
|
issues
|
|
48489
48505
|
}[msg.lane];
|
|
48490
48506
|
if (!lane?.refresh) {
|
|
48491
|
-
replyTo(ws, msg, "
|
|
48507
|
+
replyTo(ws, msg, "github-polling-refresh-result", {
|
|
48492
48508
|
ok: false,
|
|
48493
48509
|
error: "Reviews polling is not running."
|
|
48494
48510
|
});
|
|
48495
48511
|
return;
|
|
48496
48512
|
}
|
|
48497
|
-
replyTo(ws, msg, "
|
|
48513
|
+
replyTo(ws, msg, "github-polling-refresh-result", await lane.refresh());
|
|
48498
48514
|
}
|
|
48499
48515
|
async function handleMyPrMerge(msg, ws) {
|
|
48500
48516
|
const reply = (outcome) => replyTo(ws, msg, "my-pr-merge-result", {
|
|
@@ -48613,8 +48629,8 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48613
48629
|
}
|
|
48614
48630
|
replyTo(ws, msg, "benchmark-action-result", await benchmarks.submitAction(parsed.data));
|
|
48615
48631
|
}
|
|
48616
|
-
async function
|
|
48617
|
-
const reply = (payload) => replyTo(ws, msg, "
|
|
48632
|
+
async function handleRadarArchiveInvestigation(msg, ws) {
|
|
48633
|
+
const reply = (payload) => replyTo(ws, msg, "radar-archive-investigation-result", {
|
|
48618
48634
|
ok: false,
|
|
48619
48635
|
error: null,
|
|
48620
48636
|
...payload
|
|
@@ -48624,11 +48640,11 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48624
48640
|
reply({ error: ref.error });
|
|
48625
48641
|
return;
|
|
48626
48642
|
}
|
|
48627
|
-
if (!
|
|
48643
|
+
if (!radarArchiveInvestigation) {
|
|
48628
48644
|
reply({ error: "PostHog monitoring is not running" });
|
|
48629
48645
|
return;
|
|
48630
48646
|
}
|
|
48631
|
-
const res = await
|
|
48647
|
+
const res = await radarArchiveInvestigation({ id: ref.id });
|
|
48632
48648
|
reply({
|
|
48633
48649
|
ok: res.ok === true,
|
|
48634
48650
|
error: res.error || null
|
|
@@ -48840,6 +48856,8 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48840
48856
|
"resume-conversation": handleResumeConversation,
|
|
48841
48857
|
"remove-session": handleRemoveSession,
|
|
48842
48858
|
"rename-session": handleRenameSession,
|
|
48859
|
+
"get-workspace-repos": handleGetWorkspaceRepos,
|
|
48860
|
+
"set-workspace-repos": handleSetWorkspaceRepos,
|
|
48843
48861
|
"set-session-title": handleSetSessionTitle,
|
|
48844
48862
|
"reorder-sessions": handleReorderSessions,
|
|
48845
48863
|
"ping": handlePing,
|
|
@@ -48847,17 +48865,17 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48847
48865
|
"update-settings": handleUpdateSettings,
|
|
48848
48866
|
"scan-repo-roots": handleScanRepoRoots,
|
|
48849
48867
|
"list-agents": handleListAgents,
|
|
48850
|
-
"get-
|
|
48851
|
-
"
|
|
48868
|
+
"get-radar-report": handleGetRadarReport,
|
|
48869
|
+
"radar-open-session": handleRadarOpenSession,
|
|
48852
48870
|
"issue-detail": handleIssueDetail,
|
|
48853
48871
|
"open-issue-session": (msg, ws) => issueOpenQueue.run(`${msg.repo.toLowerCase()}#${msg.issueNumber}`, () => handleOpenIssueSession(msg, ws)),
|
|
48854
|
-
"
|
|
48855
|
-
"
|
|
48872
|
+
"radar-issue-action": handleRadarIssueAction,
|
|
48873
|
+
"radar-archive-investigation": handleRadarArchiveInvestigation,
|
|
48856
48874
|
"team-review-action": handleTeamReviewAction,
|
|
48857
48875
|
"my-pr-merge": handleMyPrMerge,
|
|
48858
48876
|
"my-pr-keep-mergeable": handleMyPrKeepMergeable,
|
|
48859
48877
|
"my-pr-merge-when-ready": handleMyPrMergeWhenReady,
|
|
48860
|
-
"
|
|
48878
|
+
"github-polling-refresh": handleGithubPollingRefresh,
|
|
48861
48879
|
"benchmark-action": handleBenchmarkAction,
|
|
48862
48880
|
"factory-queue-intent": handleFactoryQueueIntent,
|
|
48863
48881
|
"factory-control": handleFactoryControl,
|
|
@@ -49162,8 +49180,8 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
49162
49180
|
type: "update-progress",
|
|
49163
49181
|
journal: updateJournal
|
|
49164
49182
|
}));
|
|
49165
|
-
const
|
|
49166
|
-
if (
|
|
49183
|
+
const radarStatus = typeof getRadarStatus === "function" ? getRadarStatus() : null;
|
|
49184
|
+
if (radarStatus) ws.send(JSON.stringify(radarStatus));
|
|
49167
49185
|
const teamReviewStatus = typeof getTeamReviewStatus === "function" ? getTeamReviewStatus() : null;
|
|
49168
49186
|
if (teamReviewStatus) ws.send(JSON.stringify(teamReviewStatus));
|
|
49169
49187
|
const myPrsStatus = typeof getMyPrsStatus === "function" ? getMyPrsStatus() : null;
|
|
@@ -49214,7 +49232,7 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
49214
49232
|
return { buildSnapshot };
|
|
49215
49233
|
}
|
|
49216
49234
|
//#endregion
|
|
49217
|
-
//#region server/backend-control.ts
|
|
49235
|
+
//#region server/backend/backend-control.ts
|
|
49218
49236
|
function createBackendControl(dependencies) {
|
|
49219
49237
|
const { controlWss, sessions, config, configStore, broadcastControl, controlReplayLog, laneAssembly, posthog, teamReview, myPrs, issues, benchmarks, usage, logger } = dependencies;
|
|
49220
49238
|
registerControlHandlers(controlWss, {
|
|
@@ -49240,9 +49258,9 @@ function createBackendControl(dependencies) {
|
|
|
49240
49258
|
applyUpdate: dependencies.applyUpdate,
|
|
49241
49259
|
isStaging: dependencies.isStaging,
|
|
49242
49260
|
noteRestartRequested: dependencies.noteRestartRequested,
|
|
49243
|
-
|
|
49261
|
+
getRadarStatus: () => posthog.getStatus(),
|
|
49244
49262
|
posthogSetIssueStatus: (args) => posthog.setIssueStatus(args),
|
|
49245
|
-
|
|
49263
|
+
radarArchiveInvestigation: (args) => posthog.archiveInvestigation(args),
|
|
49246
49264
|
getTeamReviewStatus: () => teamReview.getStatus(),
|
|
49247
49265
|
getMyPrsStatus: () => myPrs.getStatus(),
|
|
49248
49266
|
getIssuesStatus: () => issues.getStatus(),
|
|
@@ -49601,12 +49619,9 @@ function markInterrupted(journal, { reason, now }) {
|
|
|
49601
49619
|
}
|
|
49602
49620
|
//#endregion
|
|
49603
49621
|
//#region server/update-check.ts
|
|
49604
|
-
var GIT_REMOTE_URL = `https://github.com/${REPO_SLUG}.git`;
|
|
49605
|
-
var GITHUB_LATEST_RELEASE_URL = `https://api.github.com/repos/${REPO_SLUG}/releases/latest`;
|
|
49606
49622
|
var NPM_REGISTRY_LATEST_URL = "https://registry.npmjs.org/glimmervoid/latest";
|
|
49607
49623
|
var DEFAULT_TIMEOUT_MS = 8e3;
|
|
49608
49624
|
var GIT_HEAD_TIMEOUT_MS = 3e3;
|
|
49609
|
-
var LS_REMOTE_TIMEOUT_MS = 5e3;
|
|
49610
49625
|
var RELEASE_ANCESTRY_TIMEOUT_MS = 3e3;
|
|
49611
49626
|
var MAIN_CHANNEL_BUDGET_MS = DEFAULT_TIMEOUT_MS;
|
|
49612
49627
|
var MAIN_FETCH_TIMEOUT_MS = Math.floor(MAIN_CHANNEL_BUDGET_MS / 2);
|
|
@@ -49614,6 +49629,7 @@ var MAIN_REMOTE_TIP_TIMEOUT_MS = Math.floor(MAIN_CHANNEL_BUDGET_MS / 4);
|
|
|
49614
49629
|
var MAIN_BEHIND_COUNT_TIMEOUT_MS = Math.floor(MAIN_CHANNEL_BUDGET_MS / 4);
|
|
49615
49630
|
var STATE_FILE_NAME = "update-check.json";
|
|
49616
49631
|
var STATE_TTL_MS = 216e5;
|
|
49632
|
+
var RELEASE_SOURCE = "npm-registry";
|
|
49617
49633
|
function defaultStatePath() {
|
|
49618
49634
|
return path.join(glimmervoidHomeDir$1(), STATE_FILE_NAME);
|
|
49619
49635
|
}
|
|
@@ -49757,59 +49773,6 @@ async function resolveLatestRegistryVersion({ fetchFn, signal }) {
|
|
|
49757
49773
|
};
|
|
49758
49774
|
}
|
|
49759
49775
|
}
|
|
49760
|
-
async function resolveLatestRelease({ flavor, runCommand, fetchFn, signal }) {
|
|
49761
|
-
if (decideReleaseSource(flavor) === "npm-registry") return resolveLatestRegistryVersion({
|
|
49762
|
-
fetchFn,
|
|
49763
|
-
signal
|
|
49764
|
-
});
|
|
49765
|
-
const fromRemote = parseLsRemoteTags((await runGitProbe(runCommand, [
|
|
49766
|
-
"ls-remote",
|
|
49767
|
-
"--tags",
|
|
49768
|
-
GIT_REMOTE_URL
|
|
49769
|
-
], {
|
|
49770
|
-
timeout: LS_REMOTE_TIMEOUT_MS,
|
|
49771
|
-
signal
|
|
49772
|
-
})).out);
|
|
49773
|
-
if (fromRemote) return {
|
|
49774
|
-
...fromRemote,
|
|
49775
|
-
behindCount: null,
|
|
49776
|
-
reason: null
|
|
49777
|
-
};
|
|
49778
|
-
try {
|
|
49779
|
-
const response = await fetchFn(GITHUB_LATEST_RELEASE_URL, {
|
|
49780
|
-
signal,
|
|
49781
|
-
headers: {
|
|
49782
|
-
Accept: "application/vnd.github+json",
|
|
49783
|
-
"User-Agent": "glimmervoid-update-check"
|
|
49784
|
-
}
|
|
49785
|
-
});
|
|
49786
|
-
if (!response?.ok) return {
|
|
49787
|
-
version: null,
|
|
49788
|
-
sha: null,
|
|
49789
|
-
behindCount: null,
|
|
49790
|
-
reason: "release-check-failed"
|
|
49791
|
-
};
|
|
49792
|
-
const release = parseLatestReleaseTag(await response.json());
|
|
49793
|
-
if (!release) return {
|
|
49794
|
-
version: null,
|
|
49795
|
-
sha: null,
|
|
49796
|
-
behindCount: null,
|
|
49797
|
-
reason: "release-check-failed"
|
|
49798
|
-
};
|
|
49799
|
-
return {
|
|
49800
|
-
...release,
|
|
49801
|
-
behindCount: null,
|
|
49802
|
-
reason: null
|
|
49803
|
-
};
|
|
49804
|
-
} catch {
|
|
49805
|
-
return {
|
|
49806
|
-
version: null,
|
|
49807
|
-
sha: null,
|
|
49808
|
-
behindCount: null,
|
|
49809
|
-
reason: "release-check-failed"
|
|
49810
|
-
};
|
|
49811
|
-
}
|
|
49812
|
-
}
|
|
49813
49776
|
function upstreamBranch(upstream) {
|
|
49814
49777
|
const slashIndex = upstream.indexOf("/");
|
|
49815
49778
|
if (slashIndex < 0 || slashIndex === upstream.length - 1) return null;
|
|
@@ -49982,13 +49945,11 @@ async function checkForUpdate({ currentVersion, updateChannel = "release", fetch
|
|
|
49982
49945
|
});
|
|
49983
49946
|
const cached = readCheckState(statePath);
|
|
49984
49947
|
const cacheOutrunByInstall = normalizeSha(cached?.latestSha) !== null && normalizeSha(cached?.latestSha) === installed.installedSha;
|
|
49985
|
-
const expectedReleaseSource = updateChannel === "release" ?
|
|
49948
|
+
const expectedReleaseSource = updateChannel === "release" ? RELEASE_SOURCE : null;
|
|
49986
49949
|
const isCacheFromSameSource = expectedReleaseSource === null || cached?.releaseSource === expectedReleaseSource;
|
|
49987
49950
|
if (cached?.channel === updateChannel && isCacheFromSameSource && !cacheOutrunByInstall && isCheckFresh(cached.lastCheckAt, now, ttlMs)) return finish(installed, targetFromCache(cached), currentVersion, updateChannel, platform, now, packageRoot$1, runCommand, signal);
|
|
49988
49951
|
signal.throwIfAborted();
|
|
49989
|
-
const latestTarget = updateChannel === "main" ? await resolveLatestMain(installed, packageRoot$1, runCommand, fetchOrigin, signal) : await
|
|
49990
|
-
flavor: installed.flavor,
|
|
49991
|
-
runCommand,
|
|
49952
|
+
const latestTarget = updateChannel === "main" ? await resolveLatestMain(installed, packageRoot$1, runCommand, fetchOrigin, signal) : await resolveLatestRegistryVersion({
|
|
49992
49953
|
fetchFn,
|
|
49993
49954
|
signal
|
|
49994
49955
|
});
|
|
@@ -50014,7 +49975,7 @@ async function checkForUpdate({ currentVersion, updateChannel = "release", fetch
|
|
|
50014
49975
|
}
|
|
50015
49976
|
}
|
|
50016
49977
|
//#endregion
|
|
50017
|
-
//#region server/backend-update.ts
|
|
49978
|
+
//#region server/backend/backend-update.ts
|
|
50018
49979
|
var UPDATE_RECHECK_MS = 864e5;
|
|
50019
49980
|
function journalSummary(journal) {
|
|
50020
49981
|
if (!journal) return null;
|
|
@@ -50885,7 +50846,7 @@ function createRecorder(sessionName, captureConfig, recordSignals = true) {
|
|
|
50885
50846
|
});
|
|
50886
50847
|
}
|
|
50887
50848
|
//#endregion
|
|
50888
|
-
//#region server/session-factory.ts
|
|
50849
|
+
//#region server/session/session-factory.ts
|
|
50889
50850
|
function createSessionFactory(dependencies) {
|
|
50890
50851
|
function planLimitsEnabled(config) {
|
|
50891
50852
|
const usageConfig = resolveUsageConfig(config.usage);
|
|
@@ -50935,7 +50896,6 @@ function createSessionFactory(dependencies) {
|
|
|
50935
50896
|
planReviewPort: dependencies.getPlanReviewPort(),
|
|
50936
50897
|
planLimits: planLimitsEnabled(config),
|
|
50937
50898
|
getUserHooks: () => dependencies.getUserHooks(project.id),
|
|
50938
|
-
agentApi: config.agentApi?.enabled === true,
|
|
50939
50899
|
commitSigningProgram: dependencies.commitSigningProgram ?? null,
|
|
50940
50900
|
...overrides,
|
|
50941
50901
|
prepareSandbox: "prepareSandbox" in overrides ? overrides.prepareSandbox : defaultSandboxFor(project, config, overrides)
|
|
@@ -50950,7 +50910,7 @@ function createSessionFactory(dependencies) {
|
|
|
50950
50910
|
};
|
|
50951
50911
|
}
|
|
50952
50912
|
//#endregion
|
|
50953
|
-
//#region server/session-sandbox.ts
|
|
50913
|
+
//#region server/sandbox/session-sandbox.ts
|
|
50954
50914
|
var UNWRAPPED_PLATFORM = "win32";
|
|
50955
50915
|
var GITHUB_TOKEN_TIMEOUT_MS = 5e3;
|
|
50956
50916
|
var OPT_OUT_HINT = "Mark the session or its repository unguarded to start it without guardrails.";
|
|
@@ -51035,7 +50995,7 @@ function createSessionSandbox({ getSettings, uploadsRoot, sandboxRefusal = allow
|
|
|
51035
50995
|
return { prepareFor };
|
|
51036
50996
|
}
|
|
51037
50997
|
//#endregion
|
|
51038
|
-
//#region server/backend-session-runtime.ts
|
|
50998
|
+
//#region server/backend/backend-session-runtime.ts
|
|
51039
50999
|
function createBackendSessionRuntime(dependencies) {
|
|
51040
51000
|
const hookRouter = new HookRouter({ recordOutcome: dependencies.recordOutcome });
|
|
51041
51001
|
const agentIngressServer = http.createServer();
|
|
@@ -52072,7 +52032,7 @@ function createTelemetry(options) {
|
|
|
52072
52032
|
};
|
|
52073
52033
|
}
|
|
52074
52034
|
//#endregion
|
|
52075
|
-
//#region server/core/session-docs-core.ts
|
|
52035
|
+
//#region server/session/core/session-docs-core.ts
|
|
52076
52036
|
var NUL_CHARACTER = String.fromCharCode(0);
|
|
52077
52037
|
var DOC_REFUSAL_COPY = Object.freeze({
|
|
52078
52038
|
missing: "no file exists at that path, so write it first and surface it again",
|
|
@@ -52149,7 +52109,7 @@ function withSurfacedDoc(docs, surfaced, maxDocs) {
|
|
|
52149
52109
|
return [surfaced, ...docs.filter((doc) => doc.path !== surfaced.path)].slice(0, maxDocs);
|
|
52150
52110
|
}
|
|
52151
52111
|
//#endregion
|
|
52152
|
-
//#region server/session-docs-wiring.ts
|
|
52112
|
+
//#region server/session/session-docs-wiring.ts
|
|
52153
52113
|
async function readAtMostCapPlusOneByte(handle) {
|
|
52154
52114
|
const buffer = Buffer.alloc(SESSION_DOC_BODY_CAP_BYTES + 1);
|
|
52155
52115
|
let filledBytes = 0;
|
|
@@ -52347,7 +52307,7 @@ function createSessionDocsWiring({ broadcastControl, now = Date.now }) {
|
|
|
52347
52307
|
};
|
|
52348
52308
|
}
|
|
52349
52309
|
//#endregion
|
|
52350
|
-
//#region server/backend.ts
|
|
52310
|
+
//#region server/backend/backend.ts
|
|
52351
52311
|
var AGENT_INGRESS_HOST = "127.0.0.1";
|
|
52352
52312
|
function createBackend(httpServer, options = {}) {
|
|
52353
52313
|
const { staticDir = "auto", settingsDefaults } = options;
|
|
@@ -52407,7 +52367,7 @@ function createBackend(httpServer, options = {}) {
|
|
|
52407
52367
|
const agentIngressDependencies = {
|
|
52408
52368
|
allowedHosts,
|
|
52409
52369
|
hookRouter,
|
|
52410
|
-
getSession:
|
|
52370
|
+
getSession: (glimmervoidId) => laneAssembly.findLiveSession(glimmervoidId),
|
|
52411
52371
|
getUsage: () => usage,
|
|
52412
52372
|
getPlanReview: () => laneAssembly.planReview,
|
|
52413
52373
|
refocusContextFor: (glimmervoidId) => ({
|