glimmervoid 0.34.1 → 0.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/glimmervoid.js +31 -19
- package/dist/chunks/adapters-B37wqNti.js +1 -0
- package/dist/chunks/{adapters-D-cRFZ_Q.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-D0lRWsAM.js → config-store-BtsYbNC3.js} +44 -14
- package/dist/chunks/{contracts-DZV9H8px.js → contracts-DjIgIuDk.js} +27 -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-VMWdsGC6.js → main-C-T2Uk20.js} +337 -426
- package/dist/chunks/{pair-cli-CI848omy.js → pair-cli-Dcyzv3In.js} +2 -2
- package/dist/chunks/paths-Bu4eH1Yd.js +27 -0
- package/dist/chunks/{remote-config-Y6YtqoiO.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-CUxRHbCS.js +254 -0
- package/dist/client/assets/index-DE2GUmqs.css +1 -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 +1 -1
- 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-CgbcceU3.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-DwTxLe8Y.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-BxU3Ww0L.css +0 -1
- package/dist/client/assets/index-b9goyXSa.js +0 -254
- 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
|
}
|
|
@@ -3518,7 +3555,7 @@ function diffProjects(currentSessions, newProjects, dependencies) {
|
|
|
3518
3555
|
};
|
|
3519
3556
|
}
|
|
3520
3557
|
//#endregion
|
|
3521
|
-
//#region server/core/usage-lane-core.ts
|
|
3558
|
+
//#region server/usage/core/usage-lane-core.ts
|
|
3522
3559
|
var INTERACTIVE_LANE = "interactive";
|
|
3523
3560
|
var FIVE_HOUR_WINDOW_MS = 18e6;
|
|
3524
3561
|
var SEVEN_DAY_WINDOW_MS = 6048e5;
|
|
@@ -3911,7 +3948,7 @@ function looksBinary(buf) {
|
|
|
3911
3948
|
return false;
|
|
3912
3949
|
}
|
|
3913
3950
|
//#endregion
|
|
3914
|
-
//#region server/git-exec.ts
|
|
3951
|
+
//#region server/git/git-exec.ts
|
|
3915
3952
|
var DEFAULT_COMMAND_TIMEOUT_MS = 2e4;
|
|
3916
3953
|
function outputText(value) {
|
|
3917
3954
|
if (typeof value === "string") return value;
|
|
@@ -4225,7 +4262,7 @@ async function runPostTurnChecks({ cwd, config, sessionId, deps = {} } = {}) {
|
|
|
4225
4262
|
return finalReport;
|
|
4226
4263
|
}
|
|
4227
4264
|
//#endregion
|
|
4228
|
-
//#region server/session-event-wiring.ts
|
|
4265
|
+
//#region server/session/session-event-wiring.ts
|
|
4229
4266
|
var IDLE_COMPACTION_CONFIRM_MS = 1e4;
|
|
4230
4267
|
function waitingCopy(name, context) {
|
|
4231
4268
|
if (context.planTitle) return `${name} has a plan ready for review: ${context.planTitle}`;
|
|
@@ -4783,7 +4820,7 @@ function decideMarkerBase({ marker, fallbackBase, configuredIntegrationBranch, d
|
|
|
4783
4820
|
};
|
|
4784
4821
|
}
|
|
4785
4822
|
//#endregion
|
|
4786
|
-
//#region server/session-registry.ts
|
|
4823
|
+
//#region server/session/session-registry.ts
|
|
4787
4824
|
function runAutoResume(sessions, config, spawnGate, logger = console) {
|
|
4788
4825
|
const ids = pickAutoResume(config.projects, config);
|
|
4789
4826
|
const runs = [];
|
|
@@ -5369,7 +5406,7 @@ function intentPayload(state) {
|
|
|
5369
5406
|
};
|
|
5370
5407
|
}
|
|
5371
5408
|
//#endregion
|
|
5372
|
-
//#region server/core/visions-touch-core.ts
|
|
5409
|
+
//#region server/visions/core/visions-touch-core.ts
|
|
5373
5410
|
function createTouchState() {
|
|
5374
5411
|
return {
|
|
5375
5412
|
touchedByUri: /* @__PURE__ */ new Map(),
|
|
@@ -5591,7 +5628,7 @@ function formatTouchedRanges(ranges) {
|
|
|
5591
5628
|
return (Array.isArray(ranges) ? ranges : []).map((range) => range.start === range.end ? `${range.start}` : `${range.start}-${range.end}`).join(", ");
|
|
5592
5629
|
}
|
|
5593
5630
|
//#endregion
|
|
5594
|
-
//#region server/core/visions-dispatch-core.ts
|
|
5631
|
+
//#region server/visions/core/visions-dispatch-core.ts
|
|
5595
5632
|
var DEFAULT_QUIET_MS = 3e4;
|
|
5596
5633
|
var DEFAULT_COOLDOWN_MS = 3e5;
|
|
5597
5634
|
var DEFAULT_DISPATCH_MODEL = "opus";
|
|
@@ -6216,7 +6253,7 @@ function buildVisionsPrompt({ uri, text, findings = [], intent = "", digest = ""
|
|
|
6216
6253
|
].join("\n");
|
|
6217
6254
|
}
|
|
6218
6255
|
//#endregion
|
|
6219
|
-
//#region server/core/team-review-threads-core.ts
|
|
6256
|
+
//#region server/github/core/team-review-threads-core.ts
|
|
6220
6257
|
var THREAD_JUDGE_BACKOFF_MS = 9e5;
|
|
6221
6258
|
var THREAD_PLACEHOLDER_ERROR = "No local review draft. Review the answered threads below.";
|
|
6222
6259
|
var THREAD_COMMENTS_MAX_CHARS = 2e4;
|
|
@@ -6340,7 +6377,7 @@ function parseThreadJudgeResult(raw) {
|
|
|
6340
6377
|
return parsed.success ? parsed.data : null;
|
|
6341
6378
|
}
|
|
6342
6379
|
//#endregion
|
|
6343
|
-
//#region server/core/github-teams-core.ts
|
|
6380
|
+
//#region server/github/core/github-teams-core.ts
|
|
6344
6381
|
function readGithubTeams(config) {
|
|
6345
6382
|
const configuredTeams = config.github?.teams;
|
|
6346
6383
|
if (!configuredTeams?.length) {
|
|
@@ -6368,9 +6405,11 @@ function readGithubTeams(config) {
|
|
|
6368
6405
|
return [...teamsByName.values()];
|
|
6369
6406
|
}
|
|
6370
6407
|
//#endregion
|
|
6371
|
-
//#region server/core/team-review-core.ts
|
|
6408
|
+
//#region server/github/core/team-review-core.ts
|
|
6372
6409
|
var STAMP_MODEL = "sonnet";
|
|
6373
6410
|
var FULL_MODEL = "opus";
|
|
6411
|
+
var STAMP_MAX_LINES = 200;
|
|
6412
|
+
var STAMP_MAX_FILES = 10;
|
|
6374
6413
|
var REVIEW_TIMEOUT_SECONDS = 2400;
|
|
6375
6414
|
function advanceAwakeElapsed({ awakeElapsedMs, previousTickAt, nowMs, tickMs }) {
|
|
6376
6415
|
return awakeElapsedMs + Math.min(Math.max(0, nowMs - previousTickAt), 2 * tickMs);
|
|
@@ -6542,13 +6581,13 @@ function triagePr(detail) {
|
|
|
6542
6581
|
}
|
|
6543
6582
|
const countedFiles = detail.files.filter((file) => !isExcludedFromSize(file.path));
|
|
6544
6583
|
const countedLines = countedFiles.reduce((total, file) => total + file.additions + file.deletions, 0);
|
|
6545
|
-
if (countedLines >
|
|
6584
|
+
if (countedLines > STAMP_MAX_LINES) return {
|
|
6546
6585
|
tier: "full",
|
|
6547
|
-
reasons: [`${countedLines} counted lines over
|
|
6586
|
+
reasons: [`${countedLines} counted lines over ${STAMP_MAX_LINES}`]
|
|
6548
6587
|
};
|
|
6549
|
-
if (countedFiles.length >
|
|
6588
|
+
if (countedFiles.length > STAMP_MAX_FILES) return {
|
|
6550
6589
|
tier: "full",
|
|
6551
|
-
reasons: [`${countedFiles.length} counted files over
|
|
6590
|
+
reasons: [`${countedFiles.length} counted files over ${STAMP_MAX_FILES}`]
|
|
6552
6591
|
};
|
|
6553
6592
|
if (countedFiles.length === 0 && detail.files.length > 0 && detail.files.every((file) => isDocsOrTests(file.path))) return {
|
|
6554
6593
|
tier: "stamp",
|
|
@@ -7422,7 +7461,7 @@ function absolutePathReadRule(absolutePath) {
|
|
|
7422
7461
|
return `Read(/${absolutePath.replace(/\\/g, "/").replace(/^([A-Za-z]):/, (_drive, driveLetter) => `/${driveLetter.toLowerCase()}`).replace(/\/+$/, "")}/**)`;
|
|
7423
7462
|
}
|
|
7424
7463
|
//#endregion
|
|
7425
|
-
//#region server/core/issues-core.ts
|
|
7464
|
+
//#region server/github/core/issues-core.ts
|
|
7426
7465
|
var ISSUES_LANE_ID = "issues";
|
|
7427
7466
|
var ISSUES_STATE_FILENAME = "issues-cache.json";
|
|
7428
7467
|
var MAX_TOTAL_ISSUES = 1e3;
|
|
@@ -7565,7 +7604,7 @@ function issuesStatus({ ts, configured, reason = null, issues = [], lastSyncAt =
|
|
|
7565
7604
|
});
|
|
7566
7605
|
}
|
|
7567
7606
|
//#endregion
|
|
7568
|
-
//#region server/core/lane-backoff.ts
|
|
7607
|
+
//#region server/lanes/core/lane-backoff.ts
|
|
7569
7608
|
var QUICK_RETRY_DELAYS_MS = Object.freeze([
|
|
7570
7609
|
1e4,
|
|
7571
7610
|
3e4,
|
|
@@ -7605,7 +7644,7 @@ function secondaryRateLimitWaitMs(errorText) {
|
|
|
7605
7644
|
return Math.max(SECONDARY_RATE_LIMIT_MIN_WAIT_MS, retryAfterMs);
|
|
7606
7645
|
}
|
|
7607
7646
|
//#endregion
|
|
7608
|
-
//#region server/lane-runner.ts
|
|
7647
|
+
//#region server/lanes/lane-runner.ts
|
|
7609
7648
|
function createTickLoop({ tag, quickRetries = false, onScheduleChange = () => {}, rateLimitWaitMs = async () => null, intervalMs, tick: tickBody, writeState = async () => {}, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, clock, firstTickDelayMs = () => 0, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, backoffBaseMs = Math.max(intervalMs, DEFAULT_BASE_MS), backoffMaxMs = DEFAULT_MAX_MS, now = Date.now, random = Math.random, log = console }) {
|
|
7610
7649
|
let timer = null;
|
|
7611
7650
|
let unschedule = null;
|
|
@@ -7872,7 +7911,7 @@ function createLaneRunner({ tag, gate, cfgKey, emptyStatus, createPoller, broadc
|
|
|
7872
7911
|
};
|
|
7873
7912
|
}
|
|
7874
7913
|
//#endregion
|
|
7875
|
-
//#region server/core/github-rate-limit-core.ts
|
|
7914
|
+
//#region server/github/core/github-rate-limit-core.ts
|
|
7876
7915
|
var RateLimitResource = z.object({
|
|
7877
7916
|
remaining: z.number(),
|
|
7878
7917
|
reset: z.number()
|
|
@@ -7885,7 +7924,7 @@ function githubRateLimitWaitMs(resources, nowMs, resourceNames) {
|
|
|
7885
7924
|
return Math.max(...exhaustedResetsMs);
|
|
7886
7925
|
}
|
|
7887
7926
|
//#endregion
|
|
7888
|
-
//#region server/issues-poller.ts
|
|
7927
|
+
//#region server/github/issues-poller.ts
|
|
7889
7928
|
function createIssuesPoller(dependencies) {
|
|
7890
7929
|
const { teams, github, onTickComplete, now = Date.now, log = console } = dependencies;
|
|
7891
7930
|
let state = emptyIssuesState();
|
|
@@ -8063,7 +8102,7 @@ function bootStaggerDelay() {
|
|
|
8063
8102
|
return bootStaggerDelayMs(process.uptime() * 1e3, Math.random());
|
|
8064
8103
|
}
|
|
8065
8104
|
//#endregion
|
|
8066
|
-
//#region server/pr-gh.ts
|
|
8105
|
+
//#region server/github/pr-gh.ts
|
|
8067
8106
|
var GH_MERGE_FLAGS = {
|
|
8068
8107
|
MERGE: "--merge",
|
|
8069
8108
|
SQUASH: "--squash",
|
|
@@ -9297,7 +9336,7 @@ function createPrGh(cwd, commandRunner = run) {
|
|
|
9297
9336
|
};
|
|
9298
9337
|
}
|
|
9299
9338
|
//#endregion
|
|
9300
|
-
//#region server/issues-wiring.ts
|
|
9339
|
+
//#region server/github/issues-wiring.ts
|
|
9301
9340
|
function createIssuesStateIo(statePath, log) {
|
|
9302
9341
|
let loaded = emptyIssuesState();
|
|
9303
9342
|
let hasLoaded = false;
|
|
@@ -10642,190 +10681,6 @@ async function readTranscriptTaskTitle(transcriptPath) {
|
|
|
10642
10681
|
}
|
|
10643
10682
|
}
|
|
10644
10683
|
//#endregion
|
|
10645
|
-
//#region server/core/usage-scan-core.ts
|
|
10646
|
-
function laneSpendStatus({ isTrackingEnabled, scan }) {
|
|
10647
|
-
if (!isTrackingEnabled) return "tracking-off";
|
|
10648
|
-
if (scan === null) return "scanner-missing";
|
|
10649
|
-
if (scan.lastOutcome === "io-failed") return "read-failing";
|
|
10650
|
-
if (!scan.isHistoryCaughtUp || scan.lastOutcome === null) return "catching-up";
|
|
10651
|
-
return "known";
|
|
10652
|
-
}
|
|
10653
|
-
function decideFileRead(prior, stat) {
|
|
10654
|
-
if (!prior) return {
|
|
10655
|
-
action: "restart",
|
|
10656
|
-
readFrom: 0
|
|
10657
|
-
};
|
|
10658
|
-
if (!stat || typeof stat.size !== "number") return {
|
|
10659
|
-
action: "skip",
|
|
10660
|
-
readFrom: prior.offset || 0
|
|
10661
|
-
};
|
|
10662
|
-
if (stat.size < (prior.size || 0)) return {
|
|
10663
|
-
action: "restart",
|
|
10664
|
-
readFrom: 0
|
|
10665
|
-
};
|
|
10666
|
-
if (stat.size < (prior.offset || 0)) return {
|
|
10667
|
-
action: "restart",
|
|
10668
|
-
readFrom: 0
|
|
10669
|
-
};
|
|
10670
|
-
if (stat.size === (prior.offset || 0) && stat.mtimeMs === prior.mtimeMs) return {
|
|
10671
|
-
action: "skip",
|
|
10672
|
-
readFrom: prior.offset || 0
|
|
10673
|
-
};
|
|
10674
|
-
return {
|
|
10675
|
-
action: "append",
|
|
10676
|
-
readFrom: prior.offset || 0
|
|
10677
|
-
};
|
|
10678
|
-
}
|
|
10679
|
-
function splitLines$1(carry, chunkText) {
|
|
10680
|
-
const text = `${carry || ""}${chunkText || ""}`;
|
|
10681
|
-
const lines = text.split(/\r?\n/);
|
|
10682
|
-
const nextCarry = text.endsWith("\n") || text.endsWith("\r\n") ? "" : lines.pop();
|
|
10683
|
-
return {
|
|
10684
|
-
lines: lines.filter((line) => line.length > 0),
|
|
10685
|
-
carry: nextCarry || ""
|
|
10686
|
-
};
|
|
10687
|
-
}
|
|
10688
|
-
function resolveProjectsDirs(env = process.env, extraDirs = [], isDirectory, homeDir = null) {
|
|
10689
|
-
if (typeof isDirectory !== "function") throw new TypeError("resolveProjectsDirs requires an isDirectory function");
|
|
10690
|
-
const surviving = projectDirCandidates(env, extraDirs, homeDir).filter(isDirectory);
|
|
10691
|
-
if (!configDirOverride(env)) return surviving;
|
|
10692
|
-
if (projectDirCandidates(env, [], homeDir).filter(isDirectory).length === 0) throw new Error("CLAUDE_CONFIG_DIR is set but no projects directory exists");
|
|
10693
|
-
return surviving;
|
|
10694
|
-
}
|
|
10695
|
-
function projectDirCandidates(env = process.env, extraDirs = [], homeDir = null) {
|
|
10696
|
-
const override = configDirOverride(env);
|
|
10697
|
-
const extraHomes = normalizeHomeCandidates(extraDirs, env, homeDir);
|
|
10698
|
-
if (override) return uniqueStrings([...projectsDirsFromHomes(normalizeHomeCandidates(override.split(","), env, homeDir)), ...projectsDirsFromHomes(extraHomes)]);
|
|
10699
|
-
const resolvedHomeDir = resolveHomeDir$1(env, homeDir);
|
|
10700
|
-
if (!resolvedHomeDir) return uniqueStrings(projectsDirsFromHomes(extraHomes));
|
|
10701
|
-
const xdgConfigHome = rawTextOr(env.XDG_CONFIG_HOME, null) || path.join(resolvedHomeDir, ".config");
|
|
10702
|
-
return uniqueStrings([...projectsDirsFromHomes([path.join(xdgConfigHome, "claude"), path.join(resolvedHomeDir, ".claude")]), ...projectsDirsFromHomes(extraHomes)]);
|
|
10703
|
-
}
|
|
10704
|
-
function configDirOverride(env) {
|
|
10705
|
-
return (typeof env.CLAUDE_CONFIG_DIR === "string" ? env.CLAUDE_CONFIG_DIR : "").trim();
|
|
10706
|
-
}
|
|
10707
|
-
function projectsDirsFromHomes(homes) {
|
|
10708
|
-
const projectsDirs = [];
|
|
10709
|
-
for (const candidate of homes) {
|
|
10710
|
-
const home = path.basename(candidate) === "projects" ? path.dirname(candidate) : candidate;
|
|
10711
|
-
const projectsDir = path.join(home, "projects");
|
|
10712
|
-
projectsDirs.push(projectsDir);
|
|
10713
|
-
}
|
|
10714
|
-
return projectsDirs;
|
|
10715
|
-
}
|
|
10716
|
-
function normalizeHomeCandidates(candidates, env, homeDir) {
|
|
10717
|
-
if (!Array.isArray(candidates)) return [];
|
|
10718
|
-
return candidates.map((candidate) => expandTilde(String(candidate || "").trim(), env, homeDir)).filter(Boolean);
|
|
10719
|
-
}
|
|
10720
|
-
function expandTilde(candidate, env, homeDir) {
|
|
10721
|
-
if (!candidate.startsWith("~")) return candidate;
|
|
10722
|
-
const home = resolveHomeDir$1(env, homeDir);
|
|
10723
|
-
if (!home) return "";
|
|
10724
|
-
if (candidate === "~") return home;
|
|
10725
|
-
if (!candidate.startsWith(`~${path.sep}`) && !candidate.startsWith("~/")) return candidate;
|
|
10726
|
-
return path.join(home, candidate.slice(2));
|
|
10727
|
-
}
|
|
10728
|
-
function resolveHomeDir$1(env, homeDir) {
|
|
10729
|
-
return rawTextOr(env.HOME, null) || rawTextOr(env.USERPROFILE, null) || homeDir;
|
|
10730
|
-
}
|
|
10731
|
-
function uniqueStrings(values) {
|
|
10732
|
-
return Array.from(new Set(values));
|
|
10733
|
-
}
|
|
10734
|
-
function passOutcome({ byteLimited, ioFailures }) {
|
|
10735
|
-
if (ioFailures > 0) return "io-failed";
|
|
10736
|
-
if (byteLimited) return "byte-limited";
|
|
10737
|
-
return "complete";
|
|
10738
|
-
}
|
|
10739
|
-
function shouldPersistWarehouse({ outcome, storeReset }) {
|
|
10740
|
-
if (outcome === "complete") return true;
|
|
10741
|
-
if (outcome === "byte-limited") return false;
|
|
10742
|
-
return !storeReset;
|
|
10743
|
-
}
|
|
10744
|
-
function continuationDelayMs({ outcome, ioFailureStreak, partialMs }) {
|
|
10745
|
-
if (outcome === "complete") return null;
|
|
10746
|
-
if (outcome === "byte-limited") return partialMs;
|
|
10747
|
-
return nextBackoffMs({
|
|
10748
|
-
attempt: ioFailureStreak,
|
|
10749
|
-
baseMs: 3e4,
|
|
10750
|
-
maxMs: 3e5
|
|
10751
|
-
});
|
|
10752
|
-
}
|
|
10753
|
-
function shouldEvaluateDespiteIoFailures({ ioFailureStreak, limit }) {
|
|
10754
|
-
if (!Number.isFinite(ioFailureStreak) || !Number.isFinite(limit)) return false;
|
|
10755
|
-
if (limit <= 0) return false;
|
|
10756
|
-
return ioFailureStreak >= limit;
|
|
10757
|
-
}
|
|
10758
|
-
function vendorHomes(env, varName, defaultDirName, homeDir) {
|
|
10759
|
-
const rawOverride = env?.[varName];
|
|
10760
|
-
const override = typeof rawOverride === "string" ? rawOverride.trim() : "";
|
|
10761
|
-
if (override) return normalizeHomeCandidates(override.split(","), env, homeDir);
|
|
10762
|
-
const home = resolveHomeDir$1(env, homeDir);
|
|
10763
|
-
if (!home) return [];
|
|
10764
|
-
return [path.join(home, defaultDirName)];
|
|
10765
|
-
}
|
|
10766
|
-
function codexHomes(env = process.env, homeDir = null) {
|
|
10767
|
-
return vendorHomes(env, "CODEX_HOME", ".codex", homeDir);
|
|
10768
|
-
}
|
|
10769
|
-
function grokHomes(env = process.env, homeDir = null) {
|
|
10770
|
-
return vendorHomes(env, "GROK_HOME", ".grok", homeDir);
|
|
10771
|
-
}
|
|
10772
|
-
function codexRootCandidates(homes) {
|
|
10773
|
-
const candidates = [];
|
|
10774
|
-
for (const home of homes) {
|
|
10775
|
-
candidates.push({
|
|
10776
|
-
dir: path.join(home, "sessions"),
|
|
10777
|
-
kind: "active",
|
|
10778
|
-
home
|
|
10779
|
-
});
|
|
10780
|
-
candidates.push({
|
|
10781
|
-
dir: path.join(home, "archived_sessions"),
|
|
10782
|
-
kind: "archived",
|
|
10783
|
-
home
|
|
10784
|
-
});
|
|
10785
|
-
}
|
|
10786
|
-
return candidates;
|
|
10787
|
-
}
|
|
10788
|
-
function codexFallbackRoots(homes, survivingRoots) {
|
|
10789
|
-
const covered = new Set(survivingRoots.map((root) => root.home));
|
|
10790
|
-
return homes.filter((home) => !covered.has(home)).map((home) => ({
|
|
10791
|
-
dir: home,
|
|
10792
|
-
kind: "flat",
|
|
10793
|
-
home
|
|
10794
|
-
}));
|
|
10795
|
-
}
|
|
10796
|
-
function grokRootCandidates(homes) {
|
|
10797
|
-
return homes.map((home) => ({
|
|
10798
|
-
dir: path.join(home, "sessions"),
|
|
10799
|
-
kind: "active",
|
|
10800
|
-
home
|
|
10801
|
-
}));
|
|
10802
|
-
}
|
|
10803
|
-
var GROK_USAGE_FILENAME = "updates.jsonl";
|
|
10804
|
-
function isUsageFile(vendor, fileName) {
|
|
10805
|
-
if (typeof fileName !== "string") return false;
|
|
10806
|
-
if (vendor === "grok") return fileName === GROK_USAGE_FILENAME;
|
|
10807
|
-
return fileName.endsWith(".jsonl");
|
|
10808
|
-
}
|
|
10809
|
-
function dedupeCodexFiles(files) {
|
|
10810
|
-
const byName = /* @__PURE__ */ new Map();
|
|
10811
|
-
for (const file of files) {
|
|
10812
|
-
const name = path.basename(file.file);
|
|
10813
|
-
const existing = byName.get(name);
|
|
10814
|
-
if (!existing) {
|
|
10815
|
-
byName.set(name, file);
|
|
10816
|
-
continue;
|
|
10817
|
-
}
|
|
10818
|
-
if (existing.kind === "archived" && file.kind !== "archived") byName.set(name, file);
|
|
10819
|
-
}
|
|
10820
|
-
return Array.from(byName.values());
|
|
10821
|
-
}
|
|
10822
|
-
function codexSessionIdFromPath(filePath) {
|
|
10823
|
-
const base = path.basename(String(filePath || ""), ".jsonl");
|
|
10824
|
-
const match = /([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/.exec(base);
|
|
10825
|
-
if (match) return match[1];
|
|
10826
|
-
return base || null;
|
|
10827
|
-
}
|
|
10828
|
-
//#endregion
|
|
10829
10684
|
//#region session/core/commit-signing-env.ts
|
|
10830
10685
|
var GIT_CONFIG_PARAMETERS_ENV = "GIT_CONFIG_PARAMETERS";
|
|
10831
10686
|
function singleQuoteForGit(text) {
|
|
@@ -11643,13 +11498,16 @@ function pushDecision(log, entry, cap = 60) {
|
|
|
11643
11498
|
if (log.length > cap) log.splice(0, log.length - cap);
|
|
11644
11499
|
return "appended";
|
|
11645
11500
|
}
|
|
11501
|
+
//#endregion
|
|
11502
|
+
//#region session/session-observability.ts
|
|
11503
|
+
var AUDIT_LOG_MAX = 200;
|
|
11646
11504
|
function createSessionObservability({ agentId, getRecorder }) {
|
|
11647
11505
|
const auditLog = [];
|
|
11648
11506
|
const decisions = [];
|
|
11649
11507
|
function pushAuditEntry(entry) {
|
|
11650
11508
|
auditLog.push(entry);
|
|
11651
|
-
if (auditLog.length <=
|
|
11652
|
-
auditLog.splice(0, auditLog.length -
|
|
11509
|
+
if (auditLog.length <= AUDIT_LOG_MAX) return;
|
|
11510
|
+
auditLog.splice(0, auditLog.length - AUDIT_LOG_MAX);
|
|
11653
11511
|
}
|
|
11654
11512
|
function recordDecision(entry) {
|
|
11655
11513
|
const stamped = agentId === DEFAULT_AGENT_ID ? entry : {
|
|
@@ -11964,7 +11822,7 @@ function createSessionOutput(options) {
|
|
|
11964
11822
|
};
|
|
11965
11823
|
}
|
|
11966
11824
|
//#endregion
|
|
11967
|
-
//#region server/core/ingest-shell-core.ts
|
|
11825
|
+
//#region server/ingest/core/ingest-shell-core.ts
|
|
11968
11826
|
var SOURCE$4 = "shellHistory";
|
|
11969
11827
|
var SHELLS = Object.freeze([
|
|
11970
11828
|
"powershell",
|
|
@@ -12643,7 +12501,7 @@ function createSessionHookLifecycle(options) {
|
|
|
12643
12501
|
};
|
|
12644
12502
|
}
|
|
12645
12503
|
//#endregion
|
|
12646
|
-
//#region server/core/lane-permissions-core.ts
|
|
12504
|
+
//#region server/lanes/core/lane-permissions-core.ts
|
|
12647
12505
|
var ACCEPT_EDITS_MODE = "acceptEdits";
|
|
12648
12506
|
var LANE_CONFIG_EDIT_DENY_RULES = Object.freeze(["Edit(**/.git/**)", "Edit(**/.claude/**)"]);
|
|
12649
12507
|
var LANE_ENVIRONMENT_ARGS = Object.freeze([
|
|
@@ -12675,7 +12533,7 @@ function buildLanePermissions({ denyTools = [], allowTools = [] } = {}) {
|
|
|
12675
12533
|
};
|
|
12676
12534
|
}
|
|
12677
12535
|
//#endregion
|
|
12678
|
-
//#region server/core/factory-core.ts
|
|
12536
|
+
//#region server/factory/core/factory-core.ts
|
|
12679
12537
|
var FACTORY_NOTIFY_CATEGORY = "factory";
|
|
12680
12538
|
var FACTORY_LEDGER_SESSION = "glimmervoid-factory";
|
|
12681
12539
|
var FACTORY_TICK_INTERVAL_MS = 1e4;
|
|
@@ -13652,7 +13510,7 @@ function buildVerifierPrompt({ projectName, intent, children, tipSha, checkoutPa
|
|
|
13652
13510
|
].join("\n");
|
|
13653
13511
|
}
|
|
13654
13512
|
//#endregion
|
|
13655
|
-
//#region server/core/git-invocation-core.ts
|
|
13513
|
+
//#region server/git/core/git-invocation-core.ts
|
|
13656
13514
|
var GIT_CONFIG_LISTING_ARGS = Object.freeze([
|
|
13657
13515
|
"config",
|
|
13658
13516
|
"--null",
|
|
@@ -14042,7 +13900,7 @@ function proveMergedAcrossTips(probes) {
|
|
|
14042
13900
|
return mostCautiousProof;
|
|
14043
13901
|
}
|
|
14044
13902
|
//#endregion
|
|
14045
|
-
//#region server/core/sandbox-policy-core.ts
|
|
13903
|
+
//#region server/sandbox/core/sandbox-policy-core.ts
|
|
14046
13904
|
var VENDOR_PROFILES = Object.freeze({
|
|
14047
13905
|
claude: {
|
|
14048
13906
|
homeEntries: [".claude", ".claude.json"],
|
|
@@ -14639,7 +14497,7 @@ function isCheckFresh(lastCheckAt, nowMs, ttlMs) {
|
|
|
14639
14497
|
return age < Number(ttlMs);
|
|
14640
14498
|
}
|
|
14641
14499
|
//#endregion
|
|
14642
|
-
//#region server/git-workspace.ts
|
|
14500
|
+
//#region server/git/git-workspace.ts
|
|
14643
14501
|
var fsp$1 = fs.promises;
|
|
14644
14502
|
var MERGE_PROBE_TIMEOUT_MS = 3e4;
|
|
14645
14503
|
var REMOTE_REF_PREFIX = "refs/remotes/origin/";
|
|
@@ -17109,12 +16967,12 @@ function buildMergePrompt({ branch, target, reason, conflicts = [], worktreeDir
|
|
|
17109
16967
|
for (const f of files) lines.push(` - ${f}`);
|
|
17110
16968
|
}
|
|
17111
16969
|
lines.push("");
|
|
16970
|
+
lines.push("Only rebase this session branch; do not force-push or rewrite any shared history.");
|
|
16971
|
+
lines.push("");
|
|
17112
16972
|
lines.push(`Glimmervoid merges by rebasing "${br}" onto ${tgt} and then fast-forwarding ${tgt}. To unblock it:`);
|
|
17113
16973
|
lines.push(` 1. From this worktree${worktreeDir ? ` (${worktreeDir})` : ""}, run: git rebase ${tgt}`);
|
|
17114
16974
|
lines.push(` 2. Resolve the conflicts${files.length ? " in the files listed above" : ""}, then: git add the resolved files and git rebase --continue.`);
|
|
17115
|
-
lines.push(" 3. When the working tree is clean and rebased,
|
|
17116
|
-
lines.push("");
|
|
17117
|
-
lines.push("Only rebase this session branch; do not force-push or rewrite any shared history.");
|
|
16975
|
+
lines.push(" 3. When the working tree is clean and rebased, run: glimmervoid push. If it answers no, do what its reply says; when the reply leaves nothing this session can do, say the work is ready and leave the merge to the operator.");
|
|
17118
16976
|
return lines.join("\n");
|
|
17119
16977
|
}
|
|
17120
16978
|
//#endregion
|
|
@@ -17383,6 +17241,9 @@ function createSessionWorkspaceMembers({ plan, sessionName, shareList, gitWorksp
|
|
|
17383
17241
|
branch: plan.branch
|
|
17384
17242
|
};
|
|
17385
17243
|
}
|
|
17244
|
+
//#endregion
|
|
17245
|
+
//#region session/session-worktree-lifecycle.ts
|
|
17246
|
+
var WORKTREE_CHECK_DEBOUNCE_MS = 400;
|
|
17386
17247
|
var GIT_NOT_FOUND_EXIT_CODE = 1;
|
|
17387
17248
|
async function readGitStrict(args, options) {
|
|
17388
17249
|
const command = await runGit(args, {
|
|
@@ -17497,7 +17358,7 @@ function createSessionWorktreeLifecycle({ id, projectPath, integrationBranch = n
|
|
|
17497
17358
|
rerereWatcher: null,
|
|
17498
17359
|
checkTimer: createCoalescedTimer({
|
|
17499
17360
|
mode: "leading",
|
|
17500
|
-
delayMs:
|
|
17361
|
+
delayMs: WORKTREE_CHECK_DEBOUNCE_MS,
|
|
17501
17362
|
run: () => {
|
|
17502
17363
|
api.checkWorktreeChange().catch(recordWorktreeCheckFailure);
|
|
17503
17364
|
}
|
|
@@ -17534,6 +17395,9 @@ function createSessionWorktreeLifecycle({ id, projectPath, integrationBranch = n
|
|
|
17534
17395
|
base: lifecycleState.workspace.base || null
|
|
17535
17396
|
};
|
|
17536
17397
|
}
|
|
17398
|
+
function hasOwnWorktree() {
|
|
17399
|
+
return Boolean(gitWorkspace && lifecycleState.workspace);
|
|
17400
|
+
}
|
|
17537
17401
|
function setMergeStatus(status, detail = {}, { emit = true } = {}) {
|
|
17538
17402
|
Object.assign(lifecycleState, projectMergeState(status, detail));
|
|
17539
17403
|
if (!emit) return;
|
|
@@ -18605,6 +18469,7 @@ function createSessionWorktreeLifecycle({ id, projectPath, integrationBranch = n
|
|
|
18605
18469
|
const api = {
|
|
18606
18470
|
snapshot,
|
|
18607
18471
|
getCarry,
|
|
18472
|
+
hasOwnWorktree,
|
|
18608
18473
|
effectiveCwd,
|
|
18609
18474
|
refreshGitContext,
|
|
18610
18475
|
provision,
|
|
@@ -19146,10 +19011,10 @@ var Session = class extends EventEmitter {
|
|
|
19146
19011
|
_hooks;
|
|
19147
19012
|
_agentDepth;
|
|
19148
19013
|
_agentToken;
|
|
19149
|
-
_agentApiEnabled;
|
|
19150
19014
|
_commitSigningProgram;
|
|
19151
19015
|
_commitSigningToken;
|
|
19152
19016
|
_factoryRole;
|
|
19017
|
+
_canRunHelpCommand;
|
|
19153
19018
|
_agentLiveChildren;
|
|
19154
19019
|
_agentLifetimeSpawns;
|
|
19155
19020
|
_agentSpawnsInFlight;
|
|
@@ -19164,7 +19029,7 @@ var Session = class extends EventEmitter {
|
|
|
19164
19029
|
_resizeSeq;
|
|
19165
19030
|
_titleSource;
|
|
19166
19031
|
_statusSource;
|
|
19167
|
-
constructor({ customTitle, id, name, path: projectPath, dangerouslySkipPermissions = false, replayBufferKB = 512, hookRouter = null, getHookPort = null, hooksBaseDir = void 0, titleStabilizationMs = 1500, statusConflictMs = void 0, statusDedupMs = void 0, detectBackgroundAgents = true, agentTtlMs = DEFAULT_AGENT_TTL_MS, shellTaskTtlMs = DEFAULT_SHELL_TASK_TTL_MS, teammateTaskTtlMs = DEFAULT_TEAMMATE_TASK_TTL_MS, gateReleaseSettleMs = DEFAULT_GATE_RELEASE_SETTLE_MS, detectScheduledWakeups = true, observeToolCalls = false, agent = DEFAULT_AGENT_ID, adapter = null, bypassHookTrust = false, titleQuietFallbackMs = 3e4, spawnCommand = null, initialPrompt = null, extraClaudeArgs = [], ephemeral = false, resumeSessionId = null, taskTitleState = void 0, settingsPermissions = null, settingsSandbox = null, prepareSandbox = null, spawnEnv = null, prependPathDirs = [], enableProjectMcp = false, hookTools = [], getHookTools = null, planReviewPort = null, planLimits = false, getUserHooks = null, extraUserHooks = [], ptySpawn = null, requireWorktree = false, screenKeeperFactory = null, killProc = null, signalProc = null, platform = process.platform, gitWorkspace = null, gitIsolation, integrationBranch = null, autoRebase = true, syncOnStart = true, liveWorktreeReview = true, worktreeRoot = null, worktreeShare = null, workspaceRepos = void 0, agentDepth = 0,
|
|
19032
|
+
constructor({ customTitle, id, name, path: projectPath, dangerouslySkipPermissions = false, replayBufferKB = 512, hookRouter = null, getHookPort = null, hooksBaseDir = void 0, titleStabilizationMs = 1500, statusConflictMs = void 0, statusDedupMs = void 0, detectBackgroundAgents = true, agentTtlMs = DEFAULT_AGENT_TTL_MS, shellTaskTtlMs = DEFAULT_SHELL_TASK_TTL_MS, teammateTaskTtlMs = DEFAULT_TEAMMATE_TASK_TTL_MS, gateReleaseSettleMs = DEFAULT_GATE_RELEASE_SETTLE_MS, detectScheduledWakeups = true, observeToolCalls = false, agent = DEFAULT_AGENT_ID, adapter = null, bypassHookTrust = false, titleQuietFallbackMs = 3e4, spawnCommand = null, initialPrompt = null, extraClaudeArgs = [], ephemeral = false, resumeSessionId = null, taskTitleState = void 0, settingsPermissions = null, settingsSandbox = null, prepareSandbox = null, spawnEnv = null, prependPathDirs = [], enableProjectMcp = false, hookTools = [], getHookTools = null, planReviewPort = null, planLimits = false, getUserHooks = null, extraUserHooks = [], ptySpawn = null, requireWorktree = false, screenKeeperFactory = null, killProc = null, signalProc = null, platform = process.platform, gitWorkspace = null, gitIsolation, integrationBranch = null, autoRebase = true, syncOnStart = true, liveWorktreeReview = true, worktreeRoot = null, worktreeShare = null, workspaceRepos = void 0, agentDepth = 0, commitSigningProgram = null, factoryRole = null }) {
|
|
19168
19033
|
super();
|
|
19169
19034
|
this.id = id;
|
|
19170
19035
|
this.name = name;
|
|
@@ -19309,10 +19174,10 @@ var Session = class extends EventEmitter {
|
|
|
19309
19174
|
});
|
|
19310
19175
|
this._agentDepth = agentDepth;
|
|
19311
19176
|
this._agentToken = generateToken();
|
|
19312
|
-
this._agentApiEnabled = agentApi === true;
|
|
19313
19177
|
this._commitSigningProgram = commitSigningProgram;
|
|
19314
19178
|
this._commitSigningToken = commitSigningProgram === null ? null : generateToken();
|
|
19315
19179
|
this._factoryRole = factoryRole;
|
|
19180
|
+
this._canRunHelpCommand = permitsHelpCommand(settingsPermissions);
|
|
19316
19181
|
this._agentLiveChildren = 0;
|
|
19317
19182
|
this._agentLifetimeSpawns = 0;
|
|
19318
19183
|
this._agentSpawnsInFlight = 0;
|
|
@@ -19711,7 +19576,7 @@ var Session = class extends EventEmitter {
|
|
|
19711
19576
|
return this._factoryRole;
|
|
19712
19577
|
}
|
|
19713
19578
|
_agentApiEnv() {
|
|
19714
|
-
if (!this.
|
|
19579
|
+
if (!this._agentToken) return {};
|
|
19715
19580
|
const port = this._hooks.listenerPort();
|
|
19716
19581
|
if (!port) return {};
|
|
19717
19582
|
const url = `http://127.0.0.1:${port}/agent/${encodeURIComponent(this.id)}?t=${encodeURIComponent(this._agentToken)}`;
|
|
@@ -19854,6 +19719,9 @@ var Session = class extends EventEmitter {
|
|
|
19854
19719
|
getWorktreeCarry() {
|
|
19855
19720
|
return this.worktreeLifecycle.getCarry();
|
|
19856
19721
|
}
|
|
19722
|
+
get hasOwnWorktree() {
|
|
19723
|
+
return this.worktreeLifecycle.hasOwnWorktree();
|
|
19724
|
+
}
|
|
19857
19725
|
refreshGitContext() {
|
|
19858
19726
|
return this.worktreeLifecycle.refreshGitContext();
|
|
19859
19727
|
}
|
|
@@ -20146,7 +20014,9 @@ var Session = class extends EventEmitter {
|
|
|
20146
20014
|
resumeSessionId: spawnResumeSessionId,
|
|
20147
20015
|
extraArgs: launchSession?.extraArgs ?? this._extraClaudeArgs,
|
|
20148
20016
|
initialPrompt: this._initialPrompt,
|
|
20149
|
-
hasOuterSandbox: this._prepareSandbox !== null
|
|
20017
|
+
hasOuterSandbox: this._prepareSandbox !== null,
|
|
20018
|
+
hasOperatorInstructions: this._hasOperatorInstructions(env),
|
|
20019
|
+
canRunHelpCommand: this._canRunHelpCommand
|
|
20150
20020
|
});
|
|
20151
20021
|
const spawnCommand = await this._sandboxedSpawnCommand(this._adapter.buildSpawnCommand({
|
|
20152
20022
|
platform: this._platform,
|
|
@@ -20207,6 +20077,15 @@ var Session = class extends EventEmitter {
|
|
|
20207
20077
|
this.transition("spawn_fail", { error: errorMessage(cause) });
|
|
20208
20078
|
this.emit("error", cause);
|
|
20209
20079
|
}
|
|
20080
|
+
_hasOperatorInstructions(env) {
|
|
20081
|
+
const operatorConfigPath = this._adapter.operatorConfigPath?.(env) ?? null;
|
|
20082
|
+
if (operatorConfigPath === null) return false;
|
|
20083
|
+
try {
|
|
20084
|
+
return this._adapter.setsOperatorInstructions?.(fs.readFileSync(operatorConfigPath, "utf8")) === true;
|
|
20085
|
+
} catch (error) {
|
|
20086
|
+
return !isMissingFileError(error);
|
|
20087
|
+
}
|
|
20088
|
+
}
|
|
20210
20089
|
async _sandboxedSpawnCommand(command, agentSessionId) {
|
|
20211
20090
|
if (!this._prepareSandbox) return {
|
|
20212
20091
|
...command,
|
|
@@ -20687,6 +20566,9 @@ function startAwakeStopwatch({ tickMs = DEFAULT_TICK_MS, now = Date.now } = {})
|
|
|
20687
20566
|
stop: () => clearInterval(ticks.interval)
|
|
20688
20567
|
};
|
|
20689
20568
|
}
|
|
20569
|
+
//#endregion
|
|
20570
|
+
//#region server/core/investigation-trail-core.ts
|
|
20571
|
+
var TRAIL_MAX_STEPS = 80;
|
|
20690
20572
|
var TRAIL_TOOL_MAX_CHARS = 64;
|
|
20691
20573
|
function describeToolStep(toolName, toolInput) {
|
|
20692
20574
|
const trimmed = typeof toolName === "string" ? toolName.trim() : "";
|
|
@@ -20707,7 +20589,7 @@ function createInvestigationTrail(startedAt) {
|
|
|
20707
20589
|
steps: []
|
|
20708
20590
|
};
|
|
20709
20591
|
}
|
|
20710
|
-
function appendTrailStep(trail, step, maxSteps =
|
|
20592
|
+
function appendTrailStep(trail, step, maxSteps = TRAIL_MAX_STEPS) {
|
|
20711
20593
|
const steps = [...trail.steps, step];
|
|
20712
20594
|
return {
|
|
20713
20595
|
startedAt: trail.startedAt,
|
|
@@ -20798,7 +20680,7 @@ function decideFolderTrust(configText, repositoryRoot, platform) {
|
|
|
20798
20680
|
};
|
|
20799
20681
|
}
|
|
20800
20682
|
//#endregion
|
|
20801
|
-
//#region server/sandbox-launch.ts
|
|
20683
|
+
//#region server/sandbox/sandbox-launch.ts
|
|
20802
20684
|
var LAUNCH_ID_SHAPE = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
20803
20685
|
var SANDBOXED_ENV_COMMAND = "/usr/bin/env";
|
|
20804
20686
|
var POLICY_FOLDER = "sandbox-policies";
|
|
@@ -21089,7 +20971,7 @@ async function prepareSandboxLaunch({ role, launchId, tempDir, enterDir }) {
|
|
|
21089
20971
|
}
|
|
21090
20972
|
}
|
|
21091
20973
|
//#endregion
|
|
21092
|
-
//#region server/lane-spawn.ts
|
|
20974
|
+
//#region server/lanes/lane-spawn.ts
|
|
21093
20975
|
var SETTINGS_DIR_PREFIX = "glimmervoid-lane-settings-";
|
|
21094
20976
|
var UNWRAPPED_PLATFORM$2 = "win32";
|
|
21095
20977
|
var UNWRAPPED_CODEX_SANDBOX_ARGS = Object.freeze(["-s", "read-only"]);
|
|
@@ -21207,7 +21089,7 @@ async function readLaneResultFile(resultPath) {
|
|
|
21207
21089
|
}
|
|
21208
21090
|
}
|
|
21209
21091
|
//#endregion
|
|
21210
|
-
//#region server/team-review-thread-judge.ts
|
|
21092
|
+
//#region server/github/team-review-thread-judge.ts
|
|
21211
21093
|
var THREAD_JUDGE_TOOLS = Object.freeze(["Read", "Write"]);
|
|
21212
21094
|
var THREAD_JUDGE_TIMEOUT_MS = 12e4;
|
|
21213
21095
|
function createThreadJudge(spawn, shutdownSignal) {
|
|
@@ -21240,7 +21122,7 @@ function createThreadJudge(spawn, shutdownSignal) {
|
|
|
21240
21122
|
};
|
|
21241
21123
|
}
|
|
21242
21124
|
//#endregion
|
|
21243
|
-
//#region server/repo-cache.ts
|
|
21125
|
+
//#region server/git/repo-cache.ts
|
|
21244
21126
|
var NETWORK_GIT_ENV = { GIT_TERMINAL_PROMPT: "0" };
|
|
21245
21127
|
var GIT_COMMAND_TIMEOUT_MS = 12e4;
|
|
21246
21128
|
var HEAD_TREE_HYDRATE_TIMEOUT_MS = 6e5;
|
|
@@ -21503,7 +21385,7 @@ function createRepoCache({ rootDir, commandRunner = defaultCommandRunner, remote
|
|
|
21503
21385
|
};
|
|
21504
21386
|
}
|
|
21505
21387
|
//#endregion
|
|
21506
|
-
//#region server/core/team-review-reaper-core.ts
|
|
21388
|
+
//#region server/github/core/team-review-reaper-core.ts
|
|
21507
21389
|
var CLAUDE_BASH_SIGNATURE = "/.claude/shell-snapshots/snapshot-";
|
|
21508
21390
|
function parseProcessTable(output) {
|
|
21509
21391
|
const rows = [];
|
|
@@ -21580,7 +21462,7 @@ function selectTeamReviewProcessIds(rows, ownedDirectories, protectedPids) {
|
|
|
21580
21462
|
return [...selectedPids].sort((leftPid, rightPid) => leftPid - rightPid);
|
|
21581
21463
|
}
|
|
21582
21464
|
//#endregion
|
|
21583
|
-
//#region server/team-review-reaper.ts
|
|
21465
|
+
//#region server/github/team-review-reaper.ts
|
|
21584
21466
|
var PROCESS_LIST_TIMEOUT_MS = 5e3;
|
|
21585
21467
|
var TERMINATION_GRACE_MS = 2e3;
|
|
21586
21468
|
var EXIT_POLL_MS = 100;
|
|
@@ -21679,7 +21561,7 @@ async function reapTeamReviewProcesses({ ownedDirectories, reviewRoots, scope, l
|
|
|
21679
21561
|
}
|
|
21680
21562
|
}
|
|
21681
21563
|
//#endregion
|
|
21682
|
-
//#region server/team-review-poller.ts
|
|
21564
|
+
//#region server/github/team-review-poller.ts
|
|
21683
21565
|
var TEAM_REVIEW_RATE_LIMIT_RESOURCES = [
|
|
21684
21566
|
"search",
|
|
21685
21567
|
"graphql",
|
|
@@ -22306,7 +22188,7 @@ function createTeamReviewPoller(deps) {
|
|
|
22306
22188
|
};
|
|
22307
22189
|
}
|
|
22308
22190
|
//#endregion
|
|
22309
|
-
//#region server/team-review-wiring.ts
|
|
22191
|
+
//#region server/github/team-review-wiring.ts
|
|
22310
22192
|
var TEAM_REVIEW_DENY_RULES = Object.freeze([
|
|
22311
22193
|
"Bash(gh:*)",
|
|
22312
22194
|
"Bash(git push:*)",
|
|
@@ -24262,7 +24144,7 @@ function createBenchmarkWiring({ benchmarksRoot, runsRoot, isEnabled, broadcast,
|
|
|
24262
24144
|
};
|
|
24263
24145
|
}
|
|
24264
24146
|
//#endregion
|
|
24265
|
-
//#region server/core/factory-decision-log-core.ts
|
|
24147
|
+
//#region server/factory/core/factory-decision-log-core.ts
|
|
24266
24148
|
function factoryDecisionDayFileName(timestamp) {
|
|
24267
24149
|
return `${timestamp.slice(0, 10)}.jsonl`;
|
|
24268
24150
|
}
|
|
@@ -24421,7 +24303,7 @@ function factoryCloseOutFailureClass(fence, checks, review) {
|
|
|
24421
24303
|
return null;
|
|
24422
24304
|
}
|
|
24423
24305
|
//#endregion
|
|
24424
|
-
//#region server/factory-check-sandbox.ts
|
|
24306
|
+
//#region server/factory/factory-check-sandbox.ts
|
|
24425
24307
|
function capturedStreamTail(failure, stream) {
|
|
24426
24308
|
if (!(failure instanceof Error)) return "";
|
|
24427
24309
|
const captured = Reflect.get(failure, stream);
|
|
@@ -24479,7 +24361,7 @@ var prepareSandboxedCheckRunner = async ({ scratchParent, writablePaths, readabl
|
|
|
24479
24361
|
};
|
|
24480
24362
|
};
|
|
24481
24363
|
//#endregion
|
|
24482
|
-
//#region server/core/git-changed-paths-core.ts
|
|
24364
|
+
//#region server/git/core/git-changed-paths-core.ts
|
|
24483
24365
|
var WORKFLOW_PATH_PREFIX = ".github/workflows/";
|
|
24484
24366
|
var WORKFLOW_ANCESTOR_ENTRIES = /* @__PURE__ */ new Set([".github", ".github/workflows"]);
|
|
24485
24367
|
var GITHUB_DIRECTORY_ENTRY = ".github";
|
|
@@ -24511,7 +24393,7 @@ function isCredentialLikePath(filePath) {
|
|
|
24511
24393
|
return CREDENTIAL_LIKE_FILE_NAMES.some((pattern) => pattern.test(fileName));
|
|
24512
24394
|
}
|
|
24513
24395
|
//#endregion
|
|
24514
|
-
//#region server/factory-closeout.ts
|
|
24396
|
+
//#region server/factory/factory-closeout.ts
|
|
24515
24397
|
var FACTORY_REVIEWER_TOOLS = Object.freeze([
|
|
24516
24398
|
"Read",
|
|
24517
24399
|
"Glob",
|
|
@@ -24537,6 +24419,8 @@ var CASE_INSENSITIVE_LEDGER_PATHSPEC = ":(icase).coherence";
|
|
|
24537
24419
|
var WORK_OUTSIDE_LEDGER_PATHSPECS = [".", ":(exclude,icase).coherence"];
|
|
24538
24420
|
var FACTORY_REVIEW_TOO_LARGE_FEEDBACK = "change too large for review; split it into smaller tickets";
|
|
24539
24421
|
var FAILED_CHECK_FEEDBACK_MAX_CHARS = 3500;
|
|
24422
|
+
var FACTORY_TICKET_BLOCK_CAP = 3;
|
|
24423
|
+
var FACTORY_INTENT_CAP_CANCEL_LIMIT = 3;
|
|
24540
24424
|
function createMemoryCapCounter() {
|
|
24541
24425
|
const counts = /* @__PURE__ */ new Map();
|
|
24542
24426
|
return async (projectId, id) => {
|
|
@@ -25065,7 +24949,7 @@ function createFactoryCloseOut({ config, spawnReviewer, gitWorkspace, serializeP
|
|
|
25065
24949
|
attempts.delete(worker.workId);
|
|
25066
24950
|
failingFilesOutsideScopesByWork.delete(worker.workId);
|
|
25067
24951
|
worker.session.destroy();
|
|
25068
|
-
const capNotice = blockCount >=
|
|
24952
|
+
const capNotice = blockCount >= FACTORY_TICKET_BLOCK_CAP ? await cancelTicketAtCap(worker, ledger.cwd, blockCount) : null;
|
|
25069
24953
|
notifyOrchestrator(worker.projectId, {
|
|
25070
24954
|
workId: worker.workId,
|
|
25071
24955
|
intentId: worker.intentId,
|
|
@@ -25111,7 +24995,7 @@ function createFactoryCloseOut({ config, spawnReviewer, gitWorkspace, serializeP
|
|
|
25111
24995
|
}
|
|
25112
24996
|
async function cancelIntentAtCap(worker, cwd) {
|
|
25113
24997
|
const capCancelCount = await countIntentCapCancel(worker.projectId, worker.intentId);
|
|
25114
|
-
if (capCancelCount <
|
|
24998
|
+
if (capCancelCount < FACTORY_INTENT_CAP_CANCEL_LIMIT) return;
|
|
25115
24999
|
const notice = `Glimmervoid cancelled intent ${worker.intentId} after ${capCancelCount} of its tickets were cancelled at the block cap; the queue moves to the next intent.`;
|
|
25116
25000
|
try {
|
|
25117
25001
|
const intentClosings = listIntentCapClosings(CoherenceWorkInspect.parse(JSON.parse(await runCoherence({
|
|
@@ -25452,7 +25336,7 @@ function buildCoherenceShims({ nodePath, cliPath, glimmervoidCliPath }) {
|
|
|
25452
25336
|
];
|
|
25453
25337
|
}
|
|
25454
25338
|
//#endregion
|
|
25455
|
-
//#region server/factory-ledger.ts
|
|
25339
|
+
//#region server/factory/factory-ledger.ts
|
|
25456
25340
|
var LEDGER_GIT_OPTIONS = {
|
|
25457
25341
|
encoding: "utf8",
|
|
25458
25342
|
timeout: 3e4,
|
|
@@ -25820,7 +25704,7 @@ async function pruneAgedFiles({ directory, suffixes, retainDays, now = Date.now(
|
|
|
25820
25704
|
return removedIds;
|
|
25821
25705
|
}
|
|
25822
25706
|
//#endregion
|
|
25823
|
-
//#region server/factory-decision-log.ts
|
|
25707
|
+
//#region server/factory/factory-decision-log.ts
|
|
25824
25708
|
function createFactoryDecisionLog({ homeDir = glimmervoidHomeDir$1(), now = Date.now, log = console, redact = (text) => text, onDecision } = {}) {
|
|
25825
25709
|
const prunedDayByProject = /* @__PURE__ */ new Map();
|
|
25826
25710
|
let lastScannedDayFileName = null;
|
|
@@ -25893,7 +25777,7 @@ function createFactoryDecisionLog({ homeDir = glimmervoidHomeDir$1(), now = Date
|
|
|
25893
25777
|
};
|
|
25894
25778
|
}
|
|
25895
25779
|
//#endregion
|
|
25896
|
-
//#region server/work-lane.ts
|
|
25780
|
+
//#region server/lanes/work-lane.ts
|
|
25897
25781
|
var UNWRAPPED_PLATFORM$1 = "win32";
|
|
25898
25782
|
var GUARD_HOOK_UNAVAILABLE_ERROR = "Sane YOLO is unavailable";
|
|
25899
25783
|
function prepareRoleSandbox(describeRole, { prepareSandbox = prepareSandboxLaunch, sandboxRefusal = allowSandboxedSpawn, platform = process.platform } = {}) {
|
|
@@ -26033,7 +25917,7 @@ async function resolveWorkLane(input, { hookToolConfig = {}, resolveSaneYoloHook
|
|
|
26033
25917
|
}
|
|
26034
25918
|
}
|
|
26035
25919
|
//#endregion
|
|
26036
|
-
//#region server/factory-dispatch.ts
|
|
25920
|
+
//#region server/factory/factory-dispatch.ts
|
|
26037
25921
|
var FACTORY_WORKER_DENY = Object.freeze([
|
|
26038
25922
|
"Bash(git push:*)",
|
|
26039
25923
|
"Bash(gh:*)",
|
|
@@ -26263,7 +26147,7 @@ function createFactoryDispatch({ config, sessions, makeSession, wireSessionEvent
|
|
|
26263
26147
|
...posture.sessionOverrides,
|
|
26264
26148
|
agent: "claude-code",
|
|
26265
26149
|
ephemeral: true,
|
|
26266
|
-
|
|
26150
|
+
factoryRole: "worker",
|
|
26267
26151
|
requireWorktree: true,
|
|
26268
26152
|
dangerouslySkipPermissions: false,
|
|
26269
26153
|
gitIsolation: { disableRepoCommands: true },
|
|
@@ -26496,7 +26380,7 @@ function createFactoryDispatch({ config, sessions, makeSession, wireSessionEvent
|
|
|
26496
26380
|
};
|
|
26497
26381
|
}
|
|
26498
26382
|
//#endregion
|
|
26499
|
-
//#region server/factory-orchestrator.ts
|
|
26383
|
+
//#region server/factory/factory-orchestrator.ts
|
|
26500
26384
|
var FACTORY_ORCHESTRATOR_ALLOW = Object.freeze([
|
|
26501
26385
|
"Bash(coherence work create:*)",
|
|
26502
26386
|
"Bash(coherence orient:*)",
|
|
@@ -26716,7 +26600,6 @@ function createFactoryOrchestrator({ config, sessions, makeSession, wireSessionE
|
|
|
26716
26600
|
},
|
|
26717
26601
|
agent: "claude-code",
|
|
26718
26602
|
ephemeral: true,
|
|
26719
|
-
agentApi: true,
|
|
26720
26603
|
factoryRole: "orchestrator",
|
|
26721
26604
|
gitWorkspace: null,
|
|
26722
26605
|
dangerouslySkipPermissions: false,
|
|
@@ -26892,7 +26775,7 @@ function createFactoryOrchestrator({ config, sessions, makeSession, wireSessionE
|
|
|
26892
26775
|
};
|
|
26893
26776
|
}
|
|
26894
26777
|
//#endregion
|
|
26895
|
-
//#region server/factory-poller.ts
|
|
26778
|
+
//#region server/factory/factory-poller.ts
|
|
26896
26779
|
function createFactoryPoller({ shouldHoldCheckout = () => false, beforeTick = () => {}, listFactoryProjects, resolveIntegrationBranch, readBranchSha, hasCoherenceConfigAt, ensureControlCheckout, releaseControlCheckout, runCoherence, readPaused = async () => false, readIntentWriteScopes = async () => /* @__PURE__ */ new Map(), processProjectState = async (project) => project, releaseOrchestrator = () => {}, listObservedProjects = async () => [], broadcast, now = Date.now, ...loopOptions }) {
|
|
26897
26780
|
const log = loopOptions.log ?? console;
|
|
26898
26781
|
let state = null;
|
|
@@ -27075,7 +26958,7 @@ function stdoutOfFailedCommand(error) {
|
|
|
27075
26958
|
return stdout;
|
|
27076
26959
|
}
|
|
27077
26960
|
//#endregion
|
|
27078
|
-
//#region server/factory-verifier.ts
|
|
26961
|
+
//#region server/factory/factory-verifier.ts
|
|
27079
26962
|
function createFactoryVerifier({ config, spawnVerifier, serializeProject, ensureLedger, ensureControlCheckout, hasCodeChangedSince, readIntentDiff = async () => null, readLaneState, writeLaneState, runCoherence, commitAndLand, pause, setException, notifyOrchestrator, stopOrchestrator, onChanged }) {
|
|
27080
26963
|
const readyByProject = /* @__PURE__ */ new Map();
|
|
27081
26964
|
const notesByProject = /* @__PURE__ */ new Map();
|
|
@@ -27383,7 +27266,7 @@ function createFactoryVerifier({ config, spawnVerifier, serializeProject, ensure
|
|
|
27383
27266
|
};
|
|
27384
27267
|
}
|
|
27385
27268
|
//#endregion
|
|
27386
|
-
//#region server/factory-wiring.ts
|
|
27269
|
+
//#region server/factory/factory-wiring.ts
|
|
27387
27270
|
var COHERENCE_CONFIG_PROBE_TIMEOUT_MS = 5e3;
|
|
27388
27271
|
var ORCHESTRATOR_EXCEPTION_PREFIX = "factory-exception";
|
|
27389
27272
|
function createFactoryWiring({ config, broadcast, gitWorkspace = createGitWorkspace(), homeDir = glimmervoidHomeDir$1(), createPoller = createFactoryPoller, log = console, telemetry, orchestratorOptions, trustClaudeFolder, spawnReviewer, prepareCheckRunner, spawnVerifier = spawnReviewer, readSpentTodayUsd = () => ({
|
|
@@ -28325,7 +28208,7 @@ function createFactoryWiring({ config, broadcast, gitWorkspace = createGitWorksp
|
|
|
28325
28208
|
};
|
|
28326
28209
|
}
|
|
28327
28210
|
//#endregion
|
|
28328
|
-
//#region server/core/factory-harness-mirror-core.ts
|
|
28211
|
+
//#region server/factory/core/factory-harness-mirror-core.ts
|
|
28329
28212
|
var HARNESS_MIRROR_MAX_IDLE_MS = 864e5;
|
|
28330
28213
|
var HARNESS_MIRROR_PROJECT_PREFIX = "harness-";
|
|
28331
28214
|
var BATCH_NAME_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-\d{3}Z-[0-9a-f]{8}$/;
|
|
@@ -28375,7 +28258,7 @@ function mirrorHarnessProjects(state, observedRun) {
|
|
|
28375
28258
|
}));
|
|
28376
28259
|
}
|
|
28377
28260
|
//#endregion
|
|
28378
|
-
//#region server/factory-harness-mirror.ts
|
|
28261
|
+
//#region server/factory/factory-harness-mirror.ts
|
|
28379
28262
|
var STATE_TAIL_MAX_BYTES = 4194304;
|
|
28380
28263
|
var NON_BLOCKING_READ_FLAGS = constants.O_RDONLY | constants.O_NONBLOCK;
|
|
28381
28264
|
function isMissingPath(error) {
|
|
@@ -29206,7 +29089,7 @@ function createBranchGcPoller(deps) {
|
|
|
29206
29089
|
};
|
|
29207
29090
|
}
|
|
29208
29091
|
//#endregion
|
|
29209
|
-
//#region server/lane-status.ts
|
|
29092
|
+
//#region server/lanes/lane-status.ts
|
|
29210
29093
|
function emptyLaneStatus(type, gate) {
|
|
29211
29094
|
return {
|
|
29212
29095
|
type,
|
|
@@ -29628,7 +29511,7 @@ function decideFsEvents(batch, { root = null, now = 0 } = {}) {
|
|
|
29628
29511
|
}];
|
|
29629
29512
|
}
|
|
29630
29513
|
//#endregion
|
|
29631
|
-
//#region server/core/ingest-batch-log-core.ts
|
|
29514
|
+
//#region server/ingest/core/ingest-batch-log-core.ts
|
|
29632
29515
|
function emptyBatchLogState() {
|
|
29633
29516
|
return {
|
|
29634
29517
|
batches: 0,
|
|
@@ -29660,7 +29543,7 @@ function drainBatchLog(state) {
|
|
|
29660
29543
|
};
|
|
29661
29544
|
}
|
|
29662
29545
|
//#endregion
|
|
29663
|
-
//#region server/core/ingest-tail-core.ts
|
|
29546
|
+
//#region server/ingest/core/ingest-tail-core.ts
|
|
29664
29547
|
var MAX_CATCH_UP_BYTES = 262144;
|
|
29665
29548
|
var LISTING_SETTLE_MS = 2e3;
|
|
29666
29549
|
function fileIdentity(stat) {
|
|
@@ -29785,7 +29668,7 @@ function pickStaleByMtime(entriesByKey, { maxTracked = 256 } = {}) {
|
|
|
29785
29668
|
return entries.slice(0, entries.length - bound).map(([key]) => key);
|
|
29786
29669
|
}
|
|
29787
29670
|
//#endregion
|
|
29788
|
-
//#region server/core/ingest-agent-core.ts
|
|
29671
|
+
//#region server/ingest/core/ingest-agent-core.ts
|
|
29789
29672
|
var SOURCE$2 = "agentLogs";
|
|
29790
29673
|
var MAX_RAW_CHARS = 4e3;
|
|
29791
29674
|
var TOOL_TARGET_KEYS = Object.freeze([
|
|
@@ -30038,7 +29921,7 @@ function mapAgentLine({ vendor = "", rawLine = null, ctx = {}, vendorState = nul
|
|
|
30038
29921
|
return mapped;
|
|
30039
29922
|
}
|
|
30040
29923
|
//#endregion
|
|
30041
|
-
//#region server/ingest-agent-logs.ts
|
|
29924
|
+
//#region server/ingest/ingest-agent-logs.ts
|
|
30042
29925
|
var DEFAULT_POLL_MS$2 = 2e3;
|
|
30043
29926
|
var DEFAULT_DISCOVER_MS$1 = 3e4;
|
|
30044
29927
|
var DEFAULT_ACTIVE_WITHIN_MS = 6e5;
|
|
@@ -30069,7 +29952,7 @@ async function readCodexRoot(filePath, fsPromises = fs.promises) {
|
|
|
30069
29952
|
const buffer = Buffer.alloc(CODEX_HEAD_BYTES);
|
|
30070
29953
|
const { bytesRead } = await handle.read(buffer, 0, CODEX_HEAD_BYTES, 0);
|
|
30071
29954
|
const lines = buffer.subarray(0, bytesRead).toString("utf8").split(/\r?\n/);
|
|
30072
|
-
if (bytesRead ===
|
|
29955
|
+
if (bytesRead === CODEX_HEAD_BYTES) lines.pop();
|
|
30073
29956
|
for (const line of lines) {
|
|
30074
29957
|
if (!line) continue;
|
|
30075
29958
|
let parsed = null;
|
|
@@ -30641,7 +30524,7 @@ function createAgentLogIngest({ publish, sourceConfig = {}, laneMap = null, logg
|
|
|
30641
30524
|
};
|
|
30642
30525
|
}
|
|
30643
30526
|
//#endregion
|
|
30644
|
-
//#region server/ingest-editor.ts
|
|
30527
|
+
//#region server/ingest/ingest-editor.ts
|
|
30645
30528
|
function createEditorIngest({ publish, roots = () => [], pathsFoldCase = process.platform === "darwin", logger = console, nowFn = Date.now, debug = false }) {
|
|
30646
30529
|
const { debugNote, warn } = createLaneLog({
|
|
30647
30530
|
prefix: "[ingest:editor]",
|
|
@@ -30685,6 +30568,9 @@ function createEditorIngest({ publish, roots = () => [], pathsFoldCase = process
|
|
|
30685
30568
|
stop
|
|
30686
30569
|
};
|
|
30687
30570
|
}
|
|
30571
|
+
//#endregion
|
|
30572
|
+
//#region server/ingest/ingest-fs.ts
|
|
30573
|
+
var DEFAULT_MAX_ROOTS = 8;
|
|
30688
30574
|
var CONFIG_HOLDER = "config:fs.roots";
|
|
30689
30575
|
var requireFromHere = createRequire(import.meta.url);
|
|
30690
30576
|
function defaultLoadWatcher() {
|
|
@@ -30694,11 +30580,11 @@ function isWatcherModule(value) {
|
|
|
30694
30580
|
if (typeof value !== "object" || value === null) return false;
|
|
30695
30581
|
return "subscribe" in value && typeof value.subscribe === "function";
|
|
30696
30582
|
}
|
|
30697
|
-
function createFsIngest({ publish, sourceConfig = {}, configPath = null, logger = console, loadWatcher = defaultLoadWatcher, canonicalize = canonicalizePath, nowFn = Date.now, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, maxRoots =
|
|
30583
|
+
function createFsIngest({ publish, sourceConfig = {}, configPath = null, logger = console, loadWatcher = defaultLoadWatcher, canonicalize = canonicalizePath, nowFn = Date.now, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, maxRoots = DEFAULT_MAX_ROOTS } = {}) {
|
|
30698
30584
|
if (typeof publish !== "function") throw new Error("createFsIngest requires publish");
|
|
30699
30585
|
const publishEvent = publish;
|
|
30700
30586
|
const batchMs = positiveIntOr(sourceConfig.batchMs, DEFAULT_BATCH_MS);
|
|
30701
|
-
const rootLimit = Math.max(1, positiveIntOr(maxRoots,
|
|
30587
|
+
const rootLimit = Math.max(1, positiveIntOr(maxRoots, DEFAULT_MAX_ROOTS));
|
|
30702
30588
|
const ignorePatterns = buildIgnorePatterns();
|
|
30703
30589
|
const daemonRules = daemonWriteRules(configPath);
|
|
30704
30590
|
const configuredRoots = normalizeRoots(sourceConfig.roots);
|
|
@@ -31274,14 +31160,17 @@ function classifyGitStatusFailure(error) {
|
|
|
31274
31160
|
if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") return "check-root";
|
|
31275
31161
|
return "transient";
|
|
31276
31162
|
}
|
|
31163
|
+
//#endregion
|
|
31164
|
+
//#region server/ingest/ingest-git.ts
|
|
31165
|
+
var DEFAULT_MAX_REPOS = 16;
|
|
31277
31166
|
var DEFAULT_GIT_TIMEOUT_MS = 15e3;
|
|
31278
31167
|
var MAX_GIT_BUFFER_BYTES = 8388608;
|
|
31279
|
-
function createGitIngest({ publish, sourceConfig = {}, reposProvider = null, logger = console, execFileFn = execFileAsync, createWatch = createWatchDebounce, canonicalize = canonicalizePath, statRepoDir = (dir) => fsp.stat(dir), nowFn = Date.now, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, maxRepos =
|
|
31168
|
+
function createGitIngest({ publish, sourceConfig = {}, reposProvider = null, logger = console, execFileFn = execFileAsync, createWatch = createWatchDebounce, canonicalize = canonicalizePath, statRepoDir = (dir) => fsp.stat(dir), nowFn = Date.now, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, maxRepos = DEFAULT_MAX_REPOS, gitTimeoutMs = DEFAULT_GIT_TIMEOUT_MS, gitPath = "git" } = {}) {
|
|
31280
31169
|
if (typeof publish !== "function") throw new Error("createGitIngest requires publish");
|
|
31281
31170
|
const publishEvent = publish;
|
|
31282
31171
|
const settleMs = positiveIntOr(sourceConfig.debounceMs, DEFAULT_DEBOUNCE_MS);
|
|
31283
31172
|
const pollIntervalMs = positiveIntOr(sourceConfig.pollMs, DEFAULT_POLL_MS$1);
|
|
31284
|
-
const repoLimit = Math.max(1, positiveIntOr(maxRepos,
|
|
31173
|
+
const repoLimit = Math.max(1, positiveIntOr(maxRepos, DEFAULT_MAX_REPOS));
|
|
31285
31174
|
const candidateLimit = repoLimit * 4;
|
|
31286
31175
|
const repos = /* @__PURE__ */ new Map();
|
|
31287
31176
|
const canonicalCache = /* @__PURE__ */ new Map();
|
|
@@ -31662,12 +31551,13 @@ function createGitIngest({ publish, sourceConfig = {}, reposProvider = null, log
|
|
|
31662
31551
|
};
|
|
31663
31552
|
}
|
|
31664
31553
|
//#endregion
|
|
31665
|
-
//#region server/ingest-shell-history.ts
|
|
31554
|
+
//#region server/ingest/ingest-shell-history.ts
|
|
31666
31555
|
var DEFAULT_POLL_MS = 2e3;
|
|
31667
31556
|
var DEFAULT_DISCOVER_MS = 3e4;
|
|
31557
|
+
var DEFAULT_MAX_COMMANDS_PER_DRAIN = 50;
|
|
31668
31558
|
var WATCH_POLL_DEBOUNCE_MS = 100;
|
|
31669
31559
|
var WATCH_SWEEP_DEBOUNCE_MS = 500;
|
|
31670
|
-
function createShellHistoryIngest({ publish, sourceConfig = {}, logger = console, env = process.env, homeDir = os.homedir(), platform = process.platform, fsPromises = fs.promises, watchFn = fs.watch, nowFn = Date.now, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, discoverIntervalMs = DEFAULT_DISCOVER_MS, maxTrackedFiles = 8, maxCommandsPerDrain =
|
|
31560
|
+
function createShellHistoryIngest({ publish, sourceConfig = {}, logger = console, env = process.env, homeDir = os.homedir(), platform = process.platform, fsPromises = fs.promises, watchFn = fs.watch, nowFn = Date.now, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, discoverIntervalMs = DEFAULT_DISCOVER_MS, maxTrackedFiles = 8, maxCommandsPerDrain = DEFAULT_MAX_COMMANDS_PER_DRAIN, maxCatchUpBytes = MAX_CATCH_UP_BYTES } = {}) {
|
|
31671
31561
|
if (typeof publish !== "function") throw new Error("createShellHistoryIngest requires publish");
|
|
31672
31562
|
const publishEvent = publish;
|
|
31673
31563
|
const pollMs = positiveIntOr(sourceConfig.pollMs, DEFAULT_POLL_MS);
|
|
@@ -31916,7 +31806,7 @@ function createShellHistoryIngest({ publish, sourceConfig = {}, logger = console
|
|
|
31916
31806
|
context.previous = decided.previous;
|
|
31917
31807
|
if (decided.event) events.push(decided.event);
|
|
31918
31808
|
}
|
|
31919
|
-
const bound = positiveIntOr(maxCommandsPerDrain,
|
|
31809
|
+
const bound = positiveIntOr(maxCommandsPerDrain, DEFAULT_MAX_COMMANDS_PER_DRAIN);
|
|
31920
31810
|
const recent = events.slice(-bound);
|
|
31921
31811
|
const dropped = events.length - recent.length;
|
|
31922
31812
|
if (dropped > 0) {
|
|
@@ -32037,7 +31927,7 @@ function createShellHistoryIngest({ publish, sourceConfig = {}, logger = console
|
|
|
32037
31927
|
};
|
|
32038
31928
|
}
|
|
32039
31929
|
//#endregion
|
|
32040
|
-
//#region server/core/ingest-terminal-core.ts
|
|
31930
|
+
//#region server/ingest/core/ingest-terminal-core.ts
|
|
32041
31931
|
var DEFAULT_ACCUMULATOR_BYTES = SOURCE_DEFAULTS.terminal.accumulatorBytes;
|
|
32042
31932
|
var DEFAULT_WINDOW_BYTES = SOURCE_DEFAULTS.terminal.windowBytes;
|
|
32043
31933
|
var DEFAULT_FLUSH_MS = SOURCE_DEFAULTS.terminal.flushMs;
|
|
@@ -32271,7 +32161,7 @@ function flushAccumulator(state, { now = Date.now() } = {}) {
|
|
|
32271
32161
|
};
|
|
32272
32162
|
}
|
|
32273
32163
|
//#endregion
|
|
32274
|
-
//#region server/ingest-terminal.ts
|
|
32164
|
+
//#region server/ingest/ingest-terminal.ts
|
|
32275
32165
|
function createTerminalIngest({ publish, sourceConfig = {}, logger = console, nowFn = Date.now, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn } = {}) {
|
|
32276
32166
|
if (typeof publish !== "function") throw new Error("createTerminalIngest requires publish");
|
|
32277
32167
|
const publishEvent = publish;
|
|
@@ -32395,7 +32285,7 @@ function createTerminalIngest({ publish, sourceConfig = {}, logger = console, no
|
|
|
32395
32285
|
};
|
|
32396
32286
|
}
|
|
32397
32287
|
//#endregion
|
|
32398
|
-
//#region server/ingest-wiring.ts
|
|
32288
|
+
//#region server/ingest/ingest-wiring.ts
|
|
32399
32289
|
var BATCH_INTERVAL_MS = 1e3;
|
|
32400
32290
|
function createIngestLane({ config = null, broadcast = null, logger = console, laneMap = null, agentLogOptions = null, fsOptions = null, shellHistoryOptions = null, configPath = null, repoRoots = null, editorRoots = () => [], onActivity = null, nowFn = Date.now, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, batchIntervalMs = BATCH_INTERVAL_MS, maxEventsPerFrame = 50, snapshotEventLimit = 100, debug = false } = {}) {
|
|
32401
32291
|
const resolved = config?.sources ? config : resolveIngestConfig(config);
|
|
@@ -32678,7 +32568,7 @@ function createIngestLane({ config = null, broadcast = null, logger = console, l
|
|
|
32678
32568
|
};
|
|
32679
32569
|
}
|
|
32680
32570
|
//#endregion
|
|
32681
|
-
//#region server/core/change-narrative-core.ts
|
|
32571
|
+
//#region server/change-map/core/change-narrative-core.ts
|
|
32682
32572
|
var FACT_GROUPS = [
|
|
32683
32573
|
"files",
|
|
32684
32574
|
"subsystems",
|
|
@@ -32785,7 +32675,7 @@ function validateNarrative({ raw, knownFactIds, factsHash, model }) {
|
|
|
32785
32675
|
};
|
|
32786
32676
|
}
|
|
32787
32677
|
//#endregion
|
|
32788
|
-
//#region server/change-narrator.ts
|
|
32678
|
+
//#region server/change-map/change-narrator.ts
|
|
32789
32679
|
var MAX_CACHED_HASHES = 64;
|
|
32790
32680
|
var PROMPT_FILE$2 = "change-narrative-prompt.txt";
|
|
32791
32681
|
var RESULT_FILE$2 = "change-narrative-result.json";
|
|
@@ -33677,6 +33567,7 @@ var PLAN_DRAFT_DEBOUNCE_MS = 250;
|
|
|
33677
33567
|
var PLANS_DIRECTORY_NAME = "plans";
|
|
33678
33568
|
var PLAN_RESULT_BODY_CAP_BYTES = 2 * PLAN_BODY_CAP_BYTES;
|
|
33679
33569
|
var PLAN_SUFFIX = ".jsonl";
|
|
33570
|
+
var PLAN_RETAIN_DAYS = 30;
|
|
33680
33571
|
var PRUNE_INTERVAL_MS$2 = 864e5;
|
|
33681
33572
|
var FILE_MODE = 384;
|
|
33682
33573
|
function carriesPlanBody(event) {
|
|
@@ -33725,7 +33616,7 @@ function createPlanReviewWiring({ configPath = null, logger = console, nowFn = D
|
|
|
33725
33616
|
const heldByKey = /* @__PURE__ */ new Map();
|
|
33726
33617
|
const draftWatchByKey = /* @__PURE__ */ new Map();
|
|
33727
33618
|
let nextHoldId = 0;
|
|
33728
|
-
for (const entry of readPlanDirectorySync()) if (entry.endsWith(
|
|
33619
|
+
for (const entry of readPlanDirectorySync()) if (entry.endsWith(PLAN_SUFFIX)) sessionIdsWithPlans.add(entry.slice(0, -6));
|
|
33729
33620
|
function readPlanDirectorySync() {
|
|
33730
33621
|
try {
|
|
33731
33622
|
return fs.readdirSync(plansDirectory);
|
|
@@ -34196,7 +34087,7 @@ function createPlanReviewWiring({ configPath = null, logger = console, nowFn = D
|
|
|
34196
34087
|
const removed = await pruneAgedFiles({
|
|
34197
34088
|
directory: plansDirectory,
|
|
34198
34089
|
suffixes: [PLAN_SUFFIX],
|
|
34199
|
-
retainDays:
|
|
34090
|
+
retainDays: PLAN_RETAIN_DAYS,
|
|
34200
34091
|
now: nowFn(),
|
|
34201
34092
|
isRetainedId: (sessionId) => attachedSessionIds.has(sessionId)
|
|
34202
34093
|
});
|
|
@@ -34712,7 +34603,7 @@ function buildIssueSessionPrompt({ issue, projectName, host, url } = {}) {
|
|
|
34712
34603
|
return lines.join("\n");
|
|
34713
34604
|
}
|
|
34714
34605
|
//#endregion
|
|
34715
|
-
//#region server/posthog-api.ts
|
|
34606
|
+
//#region server/radar/posthog-api.ts
|
|
34716
34607
|
var DEFAULT_ISSUE_LIMIT = 50;
|
|
34717
34608
|
var DEFAULT_DATE_RANGE_HOURS = 24;
|
|
34718
34609
|
var CURRENT_WINDOW_MINUTES = 60;
|
|
@@ -35283,7 +35174,7 @@ function decideTrafficSpike({ currentUsers, baseline, prev, now, cfg } = {}) {
|
|
|
35283
35174
|
}), multiple);
|
|
35284
35175
|
}
|
|
35285
35176
|
//#endregion
|
|
35286
|
-
//#region server/
|
|
35177
|
+
//#region server/radar/radar-poller.ts
|
|
35287
35178
|
var OBSERVATION_PINGS = {
|
|
35288
35179
|
spiking: {
|
|
35289
35180
|
kind: "spike",
|
|
@@ -35315,7 +35206,7 @@ function issueEntryOf(state, key) {
|
|
|
35315
35206
|
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
35316
35207
|
return value;
|
|
35317
35208
|
}
|
|
35318
|
-
function
|
|
35209
|
+
function createRadarPoller(deps) {
|
|
35319
35210
|
const { api, host = "", resolveProjects = async () => [], spawnInvestigation, telegram = () => {}, readState = async () => ({}), writeState = async () => {}, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, setTimeoutFn = DEFAULT_TIMER_FNS.setTimeoutFn, clearTimeoutFn = DEFAULT_TIMER_FNS.clearTimeoutFn, log = console, onTickComplete = () => {}, onInvestigationActivity = () => {}, now = () => Date.now() } = deps;
|
|
35320
35211
|
const intervalMinutes = deps.intervalMinutes || 15;
|
|
35321
35212
|
const maxConcurrentInvestigations = deps.maxConcurrentInvestigations || 2;
|
|
@@ -35470,7 +35361,7 @@ function createPosthogPoller(deps) {
|
|
|
35470
35361
|
cancelPendingActivity(change.key);
|
|
35471
35362
|
const trail = trails.get(change.key);
|
|
35472
35363
|
onInvestigationActivity({
|
|
35473
|
-
type: "
|
|
35364
|
+
type: "radar-investigation-finished",
|
|
35474
35365
|
projectId: change.projectId,
|
|
35475
35366
|
issueId: String(change.issue.issueId),
|
|
35476
35367
|
verdict,
|
|
@@ -35499,7 +35390,7 @@ function createPosthogPoller(deps) {
|
|
|
35499
35390
|
const trail = trails.get(change.key);
|
|
35500
35391
|
if (!trail) return;
|
|
35501
35392
|
onInvestigationActivity({
|
|
35502
|
-
type: "
|
|
35393
|
+
type: "radar-investigation-activity",
|
|
35503
35394
|
projectId: change.projectId,
|
|
35504
35395
|
issueId: String(change.issue.issueId),
|
|
35505
35396
|
inFlight: true,
|
|
@@ -35849,7 +35740,7 @@ function createPosthogPoller(deps) {
|
|
|
35849
35740
|
projects
|
|
35850
35741
|
};
|
|
35851
35742
|
onTickComplete({
|
|
35852
|
-
type: "
|
|
35743
|
+
type: "radar-status",
|
|
35853
35744
|
ts,
|
|
35854
35745
|
intervalMinutes,
|
|
35855
35746
|
projects,
|
|
@@ -35882,7 +35773,7 @@ function createPosthogPoller(deps) {
|
|
|
35882
35773
|
};
|
|
35883
35774
|
}
|
|
35884
35775
|
//#endregion
|
|
35885
|
-
//#region server/
|
|
35776
|
+
//#region server/radar/radar-report.ts
|
|
35886
35777
|
var DEFAULT_POSTHOG_REPORT_DIR = path.join(glimmervoidHomeDir$1(), "posthog-reports");
|
|
35887
35778
|
var POSTHOG_REPORT_ID_RE = /^[A-Za-z0-9_-]{1,128}$/;
|
|
35888
35779
|
function confinePath(baseDir, ...segments) {
|
|
@@ -36016,7 +35907,7 @@ async function sendTelegramMessage({ botToken, chatId, text, tag = "telegram", t
|
|
|
36016
35907
|
}
|
|
36017
35908
|
}
|
|
36018
35909
|
//#endregion
|
|
36019
|
-
//#region server/
|
|
35910
|
+
//#region server/radar/radar-wiring.ts
|
|
36020
35911
|
var POSTHOG_DENY = { deny: [
|
|
36021
35912
|
"Bash(gh pr merge:*)",
|
|
36022
35913
|
"Bash(gh pr create:*)",
|
|
@@ -36041,8 +35932,9 @@ var FIX_DENY = { deny: [
|
|
|
36041
35932
|
] };
|
|
36042
35933
|
var REPORT_DIR = DEFAULT_POSTHOG_REPORT_DIR;
|
|
36043
35934
|
var WORK_DIR = path.join(glimmervoidHomeDir$1(), "posthog-work");
|
|
35935
|
+
var REPORT_RETAIN_FILES = 20;
|
|
36044
35936
|
var FORCE_TICK_DEBOUNCE_MS = 3e3;
|
|
36045
|
-
async function
|
|
35937
|
+
async function radarLaneRole(facts, { writableRoots, commitCheckout }) {
|
|
36046
35938
|
const commitCheckouts = commitCheckout === null ? [] : [{
|
|
36047
35939
|
checkout: commitCheckout,
|
|
36048
35940
|
gitDir: await readLaneCommonGitDir(commitCheckout)
|
|
@@ -36183,7 +36075,7 @@ function buildFixPrompt({ issueId, projectId, host, resultPath, repoPath, branch
|
|
|
36183
36075
|
"preamble, no emoji, no em or en dashes."
|
|
36184
36076
|
].join("\n");
|
|
36185
36077
|
}
|
|
36186
|
-
async function sweepReports(dir = REPORT_DIR, retain =
|
|
36078
|
+
async function sweepReports(dir = REPORT_DIR, retain = REPORT_RETAIN_FILES) {
|
|
36187
36079
|
try {
|
|
36188
36080
|
const names = (await fs.promises.readdir(dir)).filter((n) => n.endsWith(".html") || n.endsWith(".md"));
|
|
36189
36081
|
if (names.length <= retain) return;
|
|
@@ -36342,7 +36234,7 @@ function fallbackPrBody({ issueUrl, reproduced, summary }) {
|
|
|
36342
36234
|
`Agent summary: ${summaryLineFromReportText(summary) || "(none written)"}`
|
|
36343
36235
|
].join("\n");
|
|
36344
36236
|
}
|
|
36345
|
-
function
|
|
36237
|
+
function radarShouldStart(cfg) {
|
|
36346
36238
|
const p = cfg.posthog;
|
|
36347
36239
|
if (!p || !p.enabled) return {
|
|
36348
36240
|
start: false,
|
|
@@ -36397,7 +36289,7 @@ function makeResolveProjects(api, config) {
|
|
|
36397
36289
|
return out;
|
|
36398
36290
|
};
|
|
36399
36291
|
}
|
|
36400
|
-
function
|
|
36292
|
+
function createRadarWiring({ config, investigationSessions, closeSessionDataClients, hookRouter, getHookPort, spawnGate, gitWorkspace = null, runCommand = runCli, broadcast = () => {}, recordLane = null, makeSession = (options) => new Session(options), resolveHookTools: resolveHookTools$1 = resolveHookTools, sandbox = {} }) {
|
|
36401
36293
|
function activePosthogConfig() {
|
|
36402
36294
|
const posthogConfig = config.posthog;
|
|
36403
36295
|
if (!posthogConfig?.apiKey) throw new Error("PostHog lane started without its required configuration");
|
|
@@ -36408,7 +36300,7 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
|
|
|
36408
36300
|
};
|
|
36409
36301
|
}
|
|
36410
36302
|
function makeInvestigationSession({ id, name, path: cwd, initialPrompt, spawnEnv, access, permissions = POSTHOG_DENY, onActivity = null }) {
|
|
36411
|
-
const prepareSandbox = prepareRoleSandbox((facts) =>
|
|
36303
|
+
const prepareSandbox = prepareRoleSandbox((facts) => radarLaneRole(facts, access), sandbox);
|
|
36412
36304
|
const sess = makeSession({
|
|
36413
36305
|
id,
|
|
36414
36306
|
name,
|
|
@@ -36488,7 +36380,7 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
|
|
|
36488
36380
|
signal,
|
|
36489
36381
|
spawnGate
|
|
36490
36382
|
});
|
|
36491
|
-
async function
|
|
36383
|
+
async function radarFixSpawn({ issue, projectId, projectName, url, signal, onActivity = null }) {
|
|
36492
36384
|
const posthogConfig = activePosthogConfig();
|
|
36493
36385
|
if (!gitWorkspace) return null;
|
|
36494
36386
|
const repoPath = resolveRepoPath(projectId);
|
|
@@ -36587,10 +36479,10 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
|
|
|
36587
36479
|
})).catch((e) => console.warn(`[posthog-poller] fix worktree discard failed: ${errorMessage(e)}`));
|
|
36588
36480
|
}
|
|
36589
36481
|
}
|
|
36590
|
-
async function
|
|
36482
|
+
async function radarInvestigationSpawn({ issue, projectId, projectName, url, mode, signal, onActivity }) {
|
|
36591
36483
|
const posthogConfig = activePosthogConfig();
|
|
36592
36484
|
if (normalizeJobMode(mode) === JOB_MODES.fix) {
|
|
36593
|
-
const fixed = await
|
|
36485
|
+
const fixed = await radarFixSpawn({
|
|
36594
36486
|
issue,
|
|
36595
36487
|
projectId,
|
|
36596
36488
|
projectName,
|
|
@@ -36686,13 +36578,13 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
|
|
|
36686
36578
|
const runner = createLaneRunner({
|
|
36687
36579
|
tag: "posthog-poller",
|
|
36688
36580
|
gate: () => {
|
|
36689
|
-
const verdict =
|
|
36581
|
+
const verdict = radarShouldStart(config);
|
|
36690
36582
|
if (verdict.reason) return verdict;
|
|
36691
36583
|
return { start: verdict.start };
|
|
36692
36584
|
},
|
|
36693
36585
|
cfgKey: () => posthogCfgKey(config),
|
|
36694
36586
|
emptyStatus: () => ({
|
|
36695
|
-
...emptyLaneStatus("
|
|
36587
|
+
...emptyLaneStatus("radar-status", radarShouldStart(config)),
|
|
36696
36588
|
intervalMinutes: config.posthog?.intervalMinutes || 15,
|
|
36697
36589
|
investigations: []
|
|
36698
36590
|
}),
|
|
@@ -36708,12 +36600,12 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
|
|
|
36708
36600
|
host: posthogConfig.host,
|
|
36709
36601
|
apiKey: posthogConfig.apiKey
|
|
36710
36602
|
});
|
|
36711
|
-
return
|
|
36603
|
+
return createRadarPoller({
|
|
36712
36604
|
firstTickDelayMs: bootStaggerDelay,
|
|
36713
36605
|
api,
|
|
36714
36606
|
host: posthogConfig.host,
|
|
36715
36607
|
resolveProjects: makeResolveProjects(api, config),
|
|
36716
|
-
spawnInvestigation:
|
|
36608
|
+
spawnInvestigation: radarInvestigationSpawn,
|
|
36717
36609
|
telegram: (text) => {
|
|
36718
36610
|
sendTelegramMessage({
|
|
36719
36611
|
botToken,
|
|
@@ -36788,7 +36680,7 @@ function createPosthogWiring({ config, investigationSessions, closeSessionDataCl
|
|
|
36788
36680
|
setIssueStatus,
|
|
36789
36681
|
archiveInvestigation,
|
|
36790
36682
|
_makeInvestigationSession: makeInvestigationSession,
|
|
36791
|
-
_investigationSpawn:
|
|
36683
|
+
_investigationSpawn: radarInvestigationSpawn
|
|
36792
36684
|
};
|
|
36793
36685
|
}
|
|
36794
36686
|
//#endregion
|
|
@@ -36812,7 +36704,7 @@ function myPrMergeRefusal(pr, seenHeadRefOid) {
|
|
|
36812
36704
|
return null;
|
|
36813
36705
|
}
|
|
36814
36706
|
//#endregion
|
|
36815
|
-
//#region server/core/my-prs-core.ts
|
|
36707
|
+
//#region server/github/core/my-prs-core.ts
|
|
36816
36708
|
var FailedAutoRebaseRecord = z.strictObject({
|
|
36817
36709
|
attemptKey: MyPrsState.shape.keepMergeableAttemptKeys.element,
|
|
36818
36710
|
autoRebase: MyPrAutoRebase
|
|
@@ -37311,7 +37203,7 @@ function myPrsShouldStart(settings) {
|
|
|
37311
37203
|
return { start: true };
|
|
37312
37204
|
}
|
|
37313
37205
|
//#endregion
|
|
37314
|
-
//#region server/my-prs-poller.ts
|
|
37206
|
+
//#region server/github/my-prs-poller.ts
|
|
37315
37207
|
var MY_PRS_RATE_LIMIT_RESOURCES = ["graphql"];
|
|
37316
37208
|
function createMyPrsPoller(dependencies) {
|
|
37317
37209
|
const { org, shouldAutoRebase = false, isKeepMergeableEnabled = true, isMergeQueueEnabled = true, github, onTickComplete, now = Date.now, intervalMinutes = 5, setIntervalFn, clearIntervalFn, setTimeoutFn, clearTimeoutFn, clock, firstTickDelayMs, log } = dependencies;
|
|
@@ -37708,6 +37600,8 @@ function createMyPrsPoller(dependencies) {
|
|
|
37708
37600
|
//#region server/ssh-signing.ts
|
|
37709
37601
|
var AGENT_LISTING_TIMEOUT_MS = 5e3;
|
|
37710
37602
|
var SIGNING_TIMEOUT_MS = 6e4;
|
|
37603
|
+
var FORWARDED_AGENT_RECONNECT_WAIT_MS = 3e4;
|
|
37604
|
+
var AGENT_RESCAN_INTERVAL_MS = 1e3;
|
|
37711
37605
|
function defaultAgentSearchRoots() {
|
|
37712
37606
|
const roots = ["/tmp", os.tmpdir()];
|
|
37713
37607
|
return roots.filter((root, index) => roots.indexOf(root) === index);
|
|
@@ -37729,7 +37623,7 @@ async function forwardedSocketsIn(searchRoot, ownerUid) {
|
|
|
37729
37623
|
const socketPaths = (await Promise.all(agentDirs.map(async (agentDir) => (await readEntryNames(agentDir)).map((entryName) => path.join(agentDir, entryName))))).flat();
|
|
37730
37624
|
return (await Promise.all(socketPaths.map((socketPath) => ownedSocketAt(socketPath, ownerUid)))).filter((candidate) => candidate !== null);
|
|
37731
37625
|
}
|
|
37732
|
-
function createSshSigner({ env = process.env, agentSearchRoots = defaultAgentSearchRoots(), ownerUid = process.getuid?.() ?? null } = {}) {
|
|
37626
|
+
function createSshSigner({ env = process.env, agentSearchRoots = defaultAgentSearchRoots(), ownerUid = process.getuid?.() ?? null, agentWaitMs = FORWARDED_AGENT_RECONNECT_WAIT_MS } = {}) {
|
|
37733
37627
|
async function agentHolds(socketPath, publicKey) {
|
|
37734
37628
|
const listing = await execFileAsync("ssh-add", ["-L"], {
|
|
37735
37629
|
env: {
|
|
@@ -37750,8 +37644,16 @@ function createSshSigner({ env = process.env, agentSearchRoots = defaultAgentSea
|
|
|
37750
37644
|
for (const socketPath of candidates) if (await agentHolds(socketPath, publicKey)) return { SSH_AUTH_SOCK: socketPath };
|
|
37751
37645
|
return null;
|
|
37752
37646
|
}
|
|
37753
|
-
async function
|
|
37647
|
+
async function agentEnvBefore(publicKey, deadlineMs) {
|
|
37754
37648
|
const agentEnv = await agentEnvFor(publicKey);
|
|
37649
|
+
if (agentEnv || Date.now() >= deadlineMs) return agentEnv;
|
|
37650
|
+
await new Promise((resolve) => {
|
|
37651
|
+
setTimeout(resolve, AGENT_RESCAN_INTERVAL_MS);
|
|
37652
|
+
});
|
|
37653
|
+
return agentEnvBefore(publicKey, deadlineMs);
|
|
37654
|
+
}
|
|
37655
|
+
async function signWithAgent({ publicKey, namespace, payload }) {
|
|
37656
|
+
const agentEnv = await agentEnvBefore(publicKey, Date.now() + agentWaitMs);
|
|
37755
37657
|
if (!agentEnv) return {
|
|
37756
37658
|
ok: false,
|
|
37757
37659
|
error: NO_AGENT_HOLDS_KEY
|
|
@@ -37834,7 +37736,7 @@ function installCommitSigningShim({ binDir, nodePath, cliPath, platform = proces
|
|
|
37834
37736
|
}
|
|
37835
37737
|
}
|
|
37836
37738
|
//#endregion
|
|
37837
|
-
//#region server/my-prs-wiring.ts
|
|
37739
|
+
//#region server/github/my-prs-wiring.ts
|
|
37838
37740
|
var MERGE_ERROR_MAX_CHARACTERS = 300;
|
|
37839
37741
|
var TRUSTED_GIT_TIMEOUT_MS = 6e5;
|
|
37840
37742
|
var EMPTY_TREE_SHA = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
|
|
@@ -39085,13 +38987,13 @@ function createWorkflowsWiring({ config, notificationManager, spawnSession, log
|
|
|
39085
38987
|
};
|
|
39086
38988
|
}
|
|
39087
38989
|
//#endregion
|
|
39088
|
-
//#region server/core/github-clock-core.ts
|
|
38990
|
+
//#region server/github/core/github-clock-core.ts
|
|
39089
38991
|
function runsEveryTicks(intervalMs, baseIntervalMs) {
|
|
39090
38992
|
if (!Number.isFinite(intervalMs) || !Number.isFinite(baseIntervalMs) || baseIntervalMs <= 0) return 1;
|
|
39091
38993
|
return Math.max(1, Math.round(intervalMs / baseIntervalMs));
|
|
39092
38994
|
}
|
|
39093
38995
|
//#endregion
|
|
39094
|
-
//#region server/github-clock.ts
|
|
38996
|
+
//#region server/github/github-clock.ts
|
|
39095
38997
|
function createGithubClock({ baseIntervalMs, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn, log = console }) {
|
|
39096
38998
|
const subscriptions = /* @__PURE__ */ new Set();
|
|
39097
38999
|
let timer = null;
|
|
@@ -39238,7 +39140,7 @@ function createTelegramChannel({ getConfig, getConnectionCount, getActiveAgentCo
|
|
|
39238
39140
|
};
|
|
39239
39141
|
}
|
|
39240
39142
|
//#endregion
|
|
39241
|
-
//#region server/core/usage-budget-core.ts
|
|
39143
|
+
//#region server/usage/core/usage-budget-core.ts
|
|
39242
39144
|
var BUDGET_THRESHOLDS = Object.freeze([
|
|
39243
39145
|
50,
|
|
39244
39146
|
75,
|
|
@@ -39379,7 +39281,7 @@ function toneForPct(pct) {
|
|
|
39379
39281
|
return "ok";
|
|
39380
39282
|
}
|
|
39381
39283
|
//#endregion
|
|
39382
|
-
//#region server/core/usage-pricing-core.ts
|
|
39284
|
+
//#region server/usage/core/usage-pricing-core.ts
|
|
39383
39285
|
var MARGINAL_TIER_THRESHOLD = 2e5;
|
|
39384
39286
|
function normalizePricingTable(rawLiteLlmJson) {
|
|
39385
39287
|
const container = rawLiteLlmJson;
|
|
@@ -39507,7 +39409,7 @@ function resolvedPrice(key, price, isExact) {
|
|
|
39507
39409
|
};
|
|
39508
39410
|
}
|
|
39509
39411
|
//#endregion
|
|
39510
|
-
//#region server/core/usage-entry-core.ts
|
|
39412
|
+
//#region server/usage/core/usage-entry-core.ts
|
|
39511
39413
|
var NULL_REJECT_FIELDS = Object.freeze([
|
|
39512
39414
|
["id"],
|
|
39513
39415
|
["cwd"],
|
|
@@ -39797,7 +39699,7 @@ function presentEmpty(value) {
|
|
|
39797
39699
|
return typeof value === "string" && value.trim() === "";
|
|
39798
39700
|
}
|
|
39799
39701
|
//#endregion
|
|
39800
|
-
//#region server/core/usage-aggregate-core.ts
|
|
39702
|
+
//#region server/usage/core/usage-aggregate-core.ts
|
|
39801
39703
|
function buildUsageReport(entries, { now = Date.now(), blockHours = 5, retainDays = 90, sessionsById = /* @__PURE__ */ new Map(), tz = null } = {}) {
|
|
39802
39704
|
const keptEntries = pruneEntries(entries, {
|
|
39803
39705
|
now,
|
|
@@ -39920,7 +39822,7 @@ function serializeDailyBucket(bucket) {
|
|
|
39920
39822
|
};
|
|
39921
39823
|
}
|
|
39922
39824
|
//#endregion
|
|
39923
|
-
//#region server/core/usage-savings-core.ts
|
|
39825
|
+
//#region server/usage/core/usage-savings-core.ts
|
|
39924
39826
|
var DAY_KEY_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
39925
39827
|
function normalizeRtkGain(parsed) {
|
|
39926
39828
|
if (!isRecord(parsed)) return null;
|
|
@@ -39980,7 +39882,7 @@ function computeCacheSavings(modelRows, pricingTable) {
|
|
|
39980
39882
|
};
|
|
39981
39883
|
}
|
|
39982
39884
|
//#endregion
|
|
39983
|
-
//#region server/core/usage-statusline-core.ts
|
|
39885
|
+
//#region server/usage/core/usage-statusline-core.ts
|
|
39984
39886
|
var PCT_DECIMALS = 1;
|
|
39985
39887
|
var SECONDS_CEILING = 0xe8d4a51000;
|
|
39986
39888
|
function roundPct(value) {
|
|
@@ -40068,7 +39970,7 @@ var claude_pricing_default = {
|
|
|
40068
39970
|
models: /* @__PURE__ */ JSON.parse("{\"claude-3-5-haiku-20241022\":{\"input_cost_per_token\":8e-7,\"output_cost_per_token\":0.000004,\"cache_creation_input_token_cost\":0.000001,\"cache_read_input_token_cost\":8e-8,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-5-haiku-latest\":{\"input_cost_per_token\":8e-7,\"output_cost_per_token\":0.000004,\"cache_creation_input_token_cost\":0.000001,\"cache_read_input_token_cost\":8e-8,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-5-sonnet-20240620\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-5-sonnet-20241022\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-5-sonnet-latest\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-7-sonnet-20250219\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-haiku-20240307\":{\"input_cost_per_token\":2.5e-7,\"output_cost_per_token\":0.00000125,\"cache_creation_input_token_cost\":3e-7,\"cache_read_input_token_cost\":3e-8,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-3-opus-20240229\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.000075,\"cache_creation_input_token_cost\":0.00001875,\"cache_read_input_token_cost\":0.0000015,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-4-opus-20250514\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.000075,\"cache_creation_input_token_cost\":0.00001875,\"cache_read_input_token_cost\":0.0000015,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-4-sonnet-20250514\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\",\"cache_creation_input_token_cost_above_200k_tokens\":0.0000075,\"cache_read_input_token_cost_above_200k_tokens\":6e-7,\"input_cost_per_token_above_200k_tokens\":0.000006,\"output_cost_per_token_above_200k_tokens\":0.0000225},\"claude-fable-5\":{\"input_cost_per_token\":0.00001,\"output_cost_per_token\":0.00005,\"cache_creation_input_token_cost\":0.0000125,\"cache_read_input_token_cost\":0.000001,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-fable-5-1\":{\"input_cost_per_token\":0.00001,\"output_cost_per_token\":0.00005,\"cache_creation_input_token_cost\":0.0000125,\"cache_read_input_token_cost\":2.5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-haiku-4-5\":{\"input_cost_per_token\":0.000001,\"output_cost_per_token\":0.000005,\"cache_creation_input_token_cost\":0.00000125,\"cache_read_input_token_cost\":1e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-haiku-4-5-20251001\":{\"input_cost_per_token\":0.000001,\"output_cost_per_token\":0.000005,\"cache_creation_input_token_cost\":0.00000125,\"cache_read_input_token_cost\":1e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-haiku-5-5\":{\"input_cost_per_token\":1e-7,\"output_cost_per_token\":5e-7,\"cache_creation_input_token_cost\":1.25e-7,\"cache_read_input_token_cost\":1e-8,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\",\"long_context_threshold\":100000,\"input_cost_per_token_above_200k_tokens\":5e-7,\"output_cost_per_token_above_200k_tokens\":0.0000025,\"cache_creation_input_token_cost_above_200k_tokens\":6.25e-7,\"cache_read_input_token_cost_above_200k_tokens\":5e-8},\"claude-mythos-5\":{\"input_cost_per_token\":0.00001,\"output_cost_per_token\":0.00005,\"cache_creation_input_token_cost\":0.0000125,\"cache_read_input_token_cost\":0.000001,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-mythos-5-1\":{\"input_cost_per_token\":0.00001,\"output_cost_per_token\":0.00005,\"cache_creation_input_token_cost\":0.0000125,\"cache_read_input_token_cost\":2.5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-mythos-preview\":{\"input_cost_per_token\":0.00001,\"output_cost_per_token\":0.00005,\"cache_creation_input_token_cost\":0.0000125,\"cache_read_input_token_cost\":0.000001,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-1\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.000075,\"cache_creation_input_token_cost\":0.00001875,\"cache_read_input_token_cost\":0.0000015,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-1-20250805\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.000075,\"cache_creation_input_token_cost\":0.00001875,\"cache_read_input_token_cost\":0.0000015,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-20250514\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.000075,\"cache_creation_input_token_cost\":0.00001875,\"cache_read_input_token_cost\":0.0000015,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-5\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-5-20251101\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-6\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-6-20260205\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-7\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-7-20260416\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-4-8\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-5\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.000025,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-opus-5-5\":{\"input_cost_per_token\":0.000004,\"output_cost_per_token\":0.00002,\"cache_creation_input_token_cost\":0.000005,\"cache_read_input_token_cost\":2e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-sonnet-4-20250514\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\",\"cache_creation_input_token_cost_above_200k_tokens\":0.0000075,\"cache_read_input_token_cost_above_200k_tokens\":6e-7,\"input_cost_per_token_above_200k_tokens\":0.000006,\"output_cost_per_token_above_200k_tokens\":0.0000225},\"claude-sonnet-4-5\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\",\"cache_creation_input_token_cost_above_1hr_above_200k_tokens\":0.000012,\"cache_creation_input_token_cost_above_200k_tokens\":0.0000075,\"cache_read_input_token_cost_above_200k_tokens\":6e-7,\"input_cost_per_token_above_200k_tokens\":0.000006,\"output_cost_per_token_above_200k_tokens\":0.0000225},\"claude-sonnet-4-5-20250929\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":200000,\"litellm_provider\":\"anthropic\",\"cache_creation_input_token_cost_above_1hr_above_200k_tokens\":0.000012,\"cache_creation_input_token_cost_above_200k_tokens\":0.0000075,\"cache_read_input_token_cost_above_200k_tokens\":6e-7,\"input_cost_per_token_above_200k_tokens\":0.000006,\"output_cost_per_token_above_200k_tokens\":0.0000225},\"claude-sonnet-4-6\":{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015,\"cache_creation_input_token_cost\":0.00000375,\"cache_read_input_token_cost\":3e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-sonnet-5\":{\"input_cost_per_token\":0.000002,\"output_cost_per_token\":0.00001,\"cache_creation_input_token_cost\":0.0000025,\"cache_read_input_token_cost\":2e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"claude-sonnet-5-5\":{\"input_cost_per_token\":0.000002,\"output_cost_per_token\":0.00001,\"cache_creation_input_token_cost\":0.0000025,\"cache_read_input_token_cost\":2e-7,\"max_input_tokens\":1000000,\"litellm_provider\":\"anthropic\"},\"gpt-5\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-2025-08-07\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-chat\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":128000,\"litellm_provider\":\"openai\"},\"gpt-5-chat-latest\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":128000,\"litellm_provider\":\"openai\"},\"gpt-5-codex\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-mini\":{\"input_cost_per_token\":2.5e-7,\"output_cost_per_token\":0.000002,\"cache_read_input_token_cost\":2.5e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-mini-2025-08-07\":{\"input_cost_per_token\":2.5e-7,\"output_cost_per_token\":0.000002,\"cache_read_input_token_cost\":2.5e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-nano\":{\"input_cost_per_token\":5e-8,\"output_cost_per_token\":4e-7,\"cache_read_input_token_cost\":5e-9,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-nano-2025-08-07\":{\"input_cost_per_token\":5e-8,\"output_cost_per_token\":4e-7,\"cache_read_input_token_cost\":5e-9,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-pro\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.00012,\"max_input_tokens\":400000,\"litellm_provider\":\"openai\"},\"gpt-5-pro-2025-10-06\":{\"input_cost_per_token\":0.000015,\"output_cost_per_token\":0.00012,\"max_input_tokens\":400000,\"litellm_provider\":\"openai\"},\"gpt-5-search-api\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5-search-api-2025-10-14\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.1\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.1-2025-11-13\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.1-chat-latest\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":128000,\"litellm_provider\":\"openai\"},\"gpt-5.1-codex\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.1-codex-max\":{\"input_cost_per_token\":0.00000125,\"output_cost_per_token\":0.00001,\"cache_read_input_token_cost\":1.25e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.1-codex-mini\":{\"input_cost_per_token\":2.5e-7,\"output_cost_per_token\":0.000002,\"cache_read_input_token_cost\":2.5e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.2\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.2-2025-12-11\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.2-chat-latest\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":128000,\"litellm_provider\":\"openai\"},\"gpt-5.2-codex\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.2-pro\":{\"input_cost_per_token\":0.000021,\"output_cost_per_token\":0.000168,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.2-pro-2025-12-11\":{\"input_cost_per_token\":0.000021,\"output_cost_per_token\":0.000168,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.3-chat-latest\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":128000,\"litellm_provider\":\"openai\"},\"gpt-5.3-codex\":{\"input_cost_per_token\":0.00000175,\"output_cost_per_token\":0.000014,\"cache_read_input_token_cost\":1.75e-7,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.4\":{\"input_cost_per_token\":0.0000025,\"output_cost_per_token\":0.000015,\"cache_read_input_token_cost\":2.5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.4-2026-03-05\":{\"input_cost_per_token\":0.0000025,\"output_cost_per_token\":0.000015,\"cache_read_input_token_cost\":2.5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.4-mini\":{\"input_cost_per_token\":7.5e-7,\"output_cost_per_token\":0.0000045,\"cache_read_input_token_cost\":7.5e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.4-mini-2026-03-17\":{\"input_cost_per_token\":7.5e-7,\"output_cost_per_token\":0.0000045,\"cache_read_input_token_cost\":7.5e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.4-nano\":{\"input_cost_per_token\":2e-7,\"output_cost_per_token\":0.00000125,\"cache_read_input_token_cost\":2e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.4-nano-2026-03-17\":{\"input_cost_per_token\":2e-7,\"output_cost_per_token\":0.00000125,\"cache_read_input_token_cost\":2e-8,\"max_input_tokens\":272000,\"litellm_provider\":\"openai\"},\"gpt-5.4-pro\":{\"input_cost_per_token\":0.00003,\"output_cost_per_token\":0.00018,\"cache_read_input_token_cost\":0.000003,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.4-pro-2026-03-05\":{\"input_cost_per_token\":0.00003,\"output_cost_per_token\":0.00018,\"cache_read_input_token_cost\":0.000003,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.5\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.00003,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.5-2026-04-23\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.00003,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.5-pro\":{\"input_cost_per_token\":0.00003,\"output_cost_per_token\":0.00018,\"cache_read_input_token_cost\":0.000003,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.5-pro-2026-04-23\":{\"input_cost_per_token\":0.00003,\"output_cost_per_token\":0.00018,\"cache_read_input_token_cost\":0.000003,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.6\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.00003,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.6-luna\":{\"input_cost_per_token\":2e-7,\"output_cost_per_token\":0.0000012,\"cache_creation_input_token_cost\":2.5e-7,\"cache_read_input_token_cost\":2e-8,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.6-sol\":{\"input_cost_per_token\":0.000005,\"output_cost_per_token\":0.00003,\"cache_creation_input_token_cost\":0.00000625,\"cache_read_input_token_cost\":5e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"},\"gpt-5.6-terra\":{\"input_cost_per_token\":0.000002,\"output_cost_per_token\":0.000012,\"cache_creation_input_token_cost\":0.0000025,\"cache_read_input_token_cost\":2e-7,\"max_input_tokens\":1050000,\"litellm_provider\":\"openai\"}}")
|
|
40069
39971
|
};
|
|
40070
39972
|
//#endregion
|
|
40071
|
-
//#region server/usage-pricing.ts
|
|
39973
|
+
//#region server/usage/usage-pricing.ts
|
|
40072
39974
|
var LITELLM_PRICING_URL = "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json";
|
|
40073
39975
|
var CACHE_TTL_MS = 864e5;
|
|
40074
39976
|
var SNAPSHOT_FIELDS = Object.freeze([
|
|
@@ -40230,7 +40132,7 @@ async function loadPricing({ fetchEnabled, fsPromises = fsp, fetchFn = globalThi
|
|
|
40230
40132
|
};
|
|
40231
40133
|
}
|
|
40232
40134
|
//#endregion
|
|
40233
|
-
//#region server/core/usage-anomaly-core.ts
|
|
40135
|
+
//#region server/usage/core/usage-anomaly-core.ts
|
|
40234
40136
|
function dailyBaseline(dailyRows, { excludeDay } = {}) {
|
|
40235
40137
|
const usableRows = (dailyRows || []).filter((row) => isUsableDailyRow(row, excludeDay));
|
|
40236
40138
|
if (usableRows.length < 7) return null;
|
|
@@ -40284,7 +40186,7 @@ function tokensPerMinute(block) {
|
|
|
40284
40186
|
return numberOr(block.tokens, 0) / (durationMs / 6e4);
|
|
40285
40187
|
}
|
|
40286
40188
|
//#endregion
|
|
40287
|
-
//#region server/core/usage-blocks-core.ts
|
|
40189
|
+
//#region server/usage/core/usage-blocks-core.ts
|
|
40288
40190
|
var HOUR_MS = 36e5;
|
|
40289
40191
|
function buildBlocks(entriesAsc, { blockHours = 5, now = Date.now() } = {}) {
|
|
40290
40192
|
const duration = blockHours * HOUR_MS;
|
|
@@ -40373,7 +40275,7 @@ function hourFloor(timestampMs) {
|
|
|
40373
40275
|
return Math.floor(timestampMs / HOUR_MS) * HOUR_MS;
|
|
40374
40276
|
}
|
|
40375
40277
|
//#endregion
|
|
40376
|
-
//#region server/core/usage-codex-core.ts
|
|
40278
|
+
//#region server/usage/core/usage-codex-core.ts
|
|
40377
40279
|
function createCodexUsageState() {
|
|
40378
40280
|
return {
|
|
40379
40281
|
model: null,
|
|
@@ -40455,7 +40357,7 @@ function deltaFromTotal(totalUsage, previousTotalUsage) {
|
|
|
40455
40357
|
};
|
|
40456
40358
|
}
|
|
40457
40359
|
//#endregion
|
|
40458
|
-
//#region server/core/usage-grok-core.ts
|
|
40360
|
+
//#region server/usage/core/usage-grok-core.ts
|
|
40459
40361
|
function parseGrokUsageLine(line) {
|
|
40460
40362
|
const raw = parseJsonLine(line, "\"turn_completed\"");
|
|
40461
40363
|
if (!raw) return null;
|
|
@@ -40523,7 +40425,7 @@ function normalizeGrokModel(model) {
|
|
|
40523
40425
|
return stripped.endsWith("-build") ? stripped.slice(0, -6) : stripped;
|
|
40524
40426
|
}
|
|
40525
40427
|
//#endregion
|
|
40526
|
-
//#region server/core/usage-warehouse-core.ts
|
|
40428
|
+
//#region server/usage/core/usage-warehouse-core.ts
|
|
40527
40429
|
function rollupFromReport(daily) {
|
|
40528
40430
|
const records = [];
|
|
40529
40431
|
for (const dayRow of daily || []) {
|
|
@@ -40638,7 +40540,7 @@ function compareRecords(a, b) {
|
|
|
40638
40540
|
return a.model.localeCompare(b.model);
|
|
40639
40541
|
}
|
|
40640
40542
|
//#endregion
|
|
40641
|
-
//#region server/usage-scanner.ts
|
|
40543
|
+
//#region server/usage/usage-scanner.ts
|
|
40642
40544
|
var DEFAULT_BYTE_BUDGET = 67108864;
|
|
40643
40545
|
var DEFAULT_CHUNK_SIZE = 1048576;
|
|
40644
40546
|
var LINE_YIELD_INTERVAL = 5e3;
|
|
@@ -41577,7 +41479,7 @@ function createUsageScanner(deps = {}) {
|
|
|
41577
41479
|
return api;
|
|
41578
41480
|
}
|
|
41579
41481
|
//#endregion
|
|
41580
|
-
//#region server/usage-wiring.ts
|
|
41482
|
+
//#region server/usage/usage-wiring.ts
|
|
41581
41483
|
var DEFAULT_USAGE_CONFIG = Object.freeze({
|
|
41582
41484
|
enabled: true,
|
|
41583
41485
|
fetchPricing: true,
|
|
@@ -42179,7 +42081,7 @@ function createUsageWiring({ config, sessions = /* @__PURE__ */ new Map(), broad
|
|
|
42179
42081
|
};
|
|
42180
42082
|
}
|
|
42181
42083
|
//#endregion
|
|
42182
|
-
//#region server/usage-lane-ledger.ts
|
|
42084
|
+
//#region server/usage/usage-lane-ledger.ts
|
|
42183
42085
|
function createLaneLedger({ ledgerPath = null, fsPromises = fsp, nowFn = Date.now, retainDays = 365, logger = null } = {}) {
|
|
42184
42086
|
const laneLog = createLaneLog({
|
|
42185
42087
|
prefix: "[usage]",
|
|
@@ -42489,7 +42391,7 @@ function traceRecordsFromTranscriptLine(rawLine, context) {
|
|
|
42489
42391
|
return [rawRecord(rawLine, line, context)];
|
|
42490
42392
|
}
|
|
42491
42393
|
//#endregion
|
|
42492
|
-
//#region server/core/session-trace-core.ts
|
|
42394
|
+
//#region server/session/core/session-trace-core.ts
|
|
42493
42395
|
var MAX_SESSION_TRACE_READ_BYTES = 524288;
|
|
42494
42396
|
function unreadableRecordNotice(request, lineByteCount) {
|
|
42495
42397
|
return {
|
|
@@ -43378,7 +43280,7 @@ function createUploadsWiring({ configPath, liveSessionIds, setIntervalFn = DEFAU
|
|
|
43378
43280
|
};
|
|
43379
43281
|
}
|
|
43380
43282
|
//#endregion
|
|
43381
|
-
//#region server/visions-dispatch.ts
|
|
43283
|
+
//#region server/visions/visions-dispatch.ts
|
|
43382
43284
|
var RESULT_VERDICTS = /* @__PURE__ */ new Set([
|
|
43383
43285
|
"COMMENTS",
|
|
43384
43286
|
"NONE",
|
|
@@ -43738,7 +43640,7 @@ function fix(sourceDiagnostic, editRange, newText) {
|
|
|
43738
43640
|
};
|
|
43739
43641
|
}
|
|
43740
43642
|
//#endregion
|
|
43741
|
-
//#region server/core/visions-fix-core.ts
|
|
43643
|
+
//#region server/visions/core/visions-fix-core.ts
|
|
43742
43644
|
var AUTO_SAFE_CODES = Object.freeze(["repeated-word"]);
|
|
43743
43645
|
var QUICKFIX_KIND = "quickfix";
|
|
43744
43646
|
var FIX_TITLES = {
|
|
@@ -44856,7 +44758,7 @@ function createVisionsWiring({ debounceMs = 300, setTimeoutFn = DEFAULT_TIMER_FN
|
|
|
44856
44758
|
};
|
|
44857
44759
|
}
|
|
44858
44760
|
//#endregion
|
|
44859
|
-
//#region server/backend-lanes.ts
|
|
44761
|
+
//#region server/backend/backend-lanes.ts
|
|
44860
44762
|
function createBackendLanes(dependencies) {
|
|
44861
44763
|
const { config, makeSession, wireSessionEvents, configStore, sessions, agentSessions, sandboxRefusal, reviewSessions, investigationSessions, closeSessionDataClients, hookRouter, getHookPort, broadcastControl, broadcastLocalControl, controlWss, options, notificationManager, telemetry, logger } = dependencies;
|
|
44862
44764
|
const spawnGate = createSpawnGate();
|
|
@@ -44869,16 +44771,24 @@ function createBackendLanes(dependencies) {
|
|
|
44869
44771
|
});
|
|
44870
44772
|
laneLedger.load();
|
|
44871
44773
|
const recordLane = laneLedger.record;
|
|
44872
|
-
const
|
|
44873
|
-
|
|
44874
|
-
|
|
44875
|
-
|
|
44876
|
-
|
|
44877
|
-
|
|
44878
|
-
|
|
44879
|
-
|
|
44880
|
-
|
|
44774
|
+
const liveSessionMaps = () => [
|
|
44775
|
+
sessions,
|
|
44776
|
+
agentSessions,
|
|
44777
|
+
reviewSessions,
|
|
44778
|
+
investigationSessions,
|
|
44779
|
+
visionsSessions,
|
|
44780
|
+
changeMapSessions,
|
|
44781
|
+
taskTitleSessions,
|
|
44782
|
+
benchmarkSessions
|
|
44881
44783
|
];
|
|
44784
|
+
const allLiveSessions = () => liveSessionMaps().flatMap((sessionsById) => [...sessionsById.values()]);
|
|
44785
|
+
const findLiveSession = (id) => {
|
|
44786
|
+
for (const sessionsById of liveSessionMaps()) {
|
|
44787
|
+
const session = sessionsById.get(id);
|
|
44788
|
+
if (session) return session;
|
|
44789
|
+
}
|
|
44790
|
+
return null;
|
|
44791
|
+
};
|
|
44882
44792
|
const branchGc = createBranchGcWiring({
|
|
44883
44793
|
config,
|
|
44884
44794
|
gitWorkspace,
|
|
@@ -44935,7 +44845,7 @@ function createBackendLanes(dependencies) {
|
|
|
44935
44845
|
workLane: { sandboxRefusal }
|
|
44936
44846
|
}
|
|
44937
44847
|
});
|
|
44938
|
-
const posthog =
|
|
44848
|
+
const posthog = createRadarWiring({
|
|
44939
44849
|
config,
|
|
44940
44850
|
investigationSessions,
|
|
44941
44851
|
closeSessionDataClients,
|
|
@@ -45312,6 +45222,7 @@ function createBackendLanes(dependencies) {
|
|
|
45312
45222
|
}
|
|
45313
45223
|
return {
|
|
45314
45224
|
allLiveSessions,
|
|
45225
|
+
findLiveSession,
|
|
45315
45226
|
benchmarks,
|
|
45316
45227
|
benchmarkSessions,
|
|
45317
45228
|
branchGc,
|
|
@@ -45349,7 +45260,7 @@ function createBackendLanes(dependencies) {
|
|
|
45349
45260
|
};
|
|
45350
45261
|
}
|
|
45351
45262
|
//#endregion
|
|
45352
|
-
//#region server/backend-health.ts
|
|
45263
|
+
//#region server/backend/backend-health.ts
|
|
45353
45264
|
var HEALTH_SNAPSHOT_INTERVAL_MS = 1e4;
|
|
45354
45265
|
function createBackendHealth(dependencies) {
|
|
45355
45266
|
function buildHealthSnapshot() {
|
|
@@ -45853,6 +45764,9 @@ function planReplay(entries, { now = Date.now(), maxAgeMs = DEFAULT_MAX_AGE_MS,
|
|
|
45853
45764
|
expired
|
|
45854
45765
|
};
|
|
45855
45766
|
}
|
|
45767
|
+
//#endregion
|
|
45768
|
+
//#region notifications/telegram-outbox.ts
|
|
45769
|
+
var OUTBOX_VERSION = 1;
|
|
45856
45770
|
var DEFAULT_RETRY_INTERVAL_MS = 6e4;
|
|
45857
45771
|
function createTelegramOutbox({ filePath, send, now = Date.now, maxEntries = 50, maxAttempts = 5, maxAgeMs = DEFAULT_MAX_AGE_MS, retryIntervalMs = DEFAULT_RETRY_INTERVAL_MS, warn = console.warn, readFileSync = fs.readFileSync, writeJson = writeJsonAtomic, recordOutcome = () => {} }) {
|
|
45858
45772
|
let entries = [];
|
|
@@ -45902,7 +45816,7 @@ function createTelegramOutbox({ filePath, send, now = Date.now, maxEntries = 50,
|
|
|
45902
45816
|
}
|
|
45903
45817
|
function persist() {
|
|
45904
45818
|
const snapshot = {
|
|
45905
|
-
version:
|
|
45819
|
+
version: OUTBOX_VERSION,
|
|
45906
45820
|
entries: entries.slice()
|
|
45907
45821
|
};
|
|
45908
45822
|
return writeQueue.run(() => writeJson(filePath, snapshot, { mkdir: true })).catch((error) => warn(`[telegram-outbox] write failed: ${errorMessage(error)}`));
|
|
@@ -46059,7 +45973,7 @@ function createHeartbeat({ servers = [], intervalMs = DEFAULT_INTERVAL_MS, deadl
|
|
|
46059
45973
|
};
|
|
46060
45974
|
}
|
|
46061
45975
|
//#endregion
|
|
46062
|
-
//#region server/backend-notifications.ts
|
|
45976
|
+
//#region server/backend/backend-notifications.ts
|
|
46063
45977
|
var ESCALATION_INTERVAL_MS = 3e5;
|
|
46064
45978
|
var DEFAULT_PHONE_ESCALATION_MS = 3e5;
|
|
46065
45979
|
function createBackendNotifications(dependencies) {
|
|
@@ -46190,7 +46104,7 @@ function formatDiffAnnotationMessage(annotations) {
|
|
|
46190
46104
|
].join("\n");
|
|
46191
46105
|
}
|
|
46192
46106
|
//#endregion
|
|
46193
|
-
//#region server/core/github-issues-core.ts
|
|
46107
|
+
//#region server/github/core/github-issues-core.ts
|
|
46194
46108
|
var GITHUB_ISSUE_BODY_MAX_CHARS = 12e3;
|
|
46195
46109
|
function fencedBody(body) {
|
|
46196
46110
|
const longestBacktickRun = Math.max(0, ...Array.from(body.matchAll(/`+/g), (match) => match[0].length));
|
|
@@ -46240,7 +46154,7 @@ function buildSettingsPayload({ configStore, rtkInstallStatus = null, resolveRtk
|
|
|
46240
46154
|
};
|
|
46241
46155
|
}
|
|
46242
46156
|
//#endregion
|
|
46243
|
-
//#region server/core/change-map-core.ts
|
|
46157
|
+
//#region server/change-map/core/change-map-core.ts
|
|
46244
46158
|
var STATUS_BY_LETTER = {
|
|
46245
46159
|
A: "added",
|
|
46246
46160
|
C: "added",
|
|
@@ -46420,7 +46334,7 @@ function computeCoChange({ repoName, commits, changedPaths }) {
|
|
|
46420
46334
|
};
|
|
46421
46335
|
}
|
|
46422
46336
|
//#endregion
|
|
46423
|
-
//#region server/core/change-ownership-core.ts
|
|
46337
|
+
//#region server/change-map/core/change-ownership-core.ts
|
|
46424
46338
|
function readAgentsTitle(markdown) {
|
|
46425
46339
|
return markdown.match(/^# (.*)$/m)?.[1].trim() ?? "";
|
|
46426
46340
|
}
|
|
@@ -47004,7 +46918,7 @@ function computeCrossRepoLinks(repos) {
|
|
|
47004
46918
|
return linksByConsumer;
|
|
47005
46919
|
}
|
|
47006
46920
|
//#endregion
|
|
47007
|
-
//#region server/change-map-wiring.ts
|
|
46921
|
+
//#region server/change-map/change-map-wiring.ts
|
|
47008
46922
|
var GIT_TIMEOUT_MS = 15e3;
|
|
47009
46923
|
var GIT_MAX_BUFFER_BYTES = 67108864;
|
|
47010
46924
|
var FILE_READ_BATCH = 64;
|
|
@@ -47525,7 +47439,6 @@ Object.freeze([
|
|
|
47525
47439
|
...USAGE_VENDOR_KEYS.map((key) => `usage.vendors.${key}`),
|
|
47526
47440
|
...USAGE_BUDGET_KEYS.map((key) => `usage.budget.${key}`),
|
|
47527
47441
|
...TELEGRAM_STRING_KEYS.map((key) => `telegram.${key}`),
|
|
47528
|
-
"agentApi.enabled",
|
|
47529
47442
|
"guardrails.unguardedRepos",
|
|
47530
47443
|
"guardrails.blockedPaths",
|
|
47531
47444
|
"guardrails.unreadablePaths",
|
|
@@ -47598,16 +47511,16 @@ function requestValidationErrorReply(msg, message) {
|
|
|
47598
47511
|
agents: [],
|
|
47599
47512
|
error: message
|
|
47600
47513
|
}),
|
|
47601
|
-
"get-
|
|
47602
|
-
type: "
|
|
47514
|
+
"get-radar-report": () => ({
|
|
47515
|
+
type: "radar-report",
|
|
47603
47516
|
requestId,
|
|
47604
47517
|
ok: false,
|
|
47605
47518
|
found: false,
|
|
47606
47519
|
issueId: null,
|
|
47607
47520
|
error: message
|
|
47608
47521
|
}),
|
|
47609
|
-
"
|
|
47610
|
-
type: "
|
|
47522
|
+
"radar-open-session": () => ({
|
|
47523
|
+
type: "radar-open-session-result",
|
|
47611
47524
|
requestId,
|
|
47612
47525
|
ok: false,
|
|
47613
47526
|
error: message
|
|
@@ -47625,14 +47538,14 @@ function requestValidationErrorReply(msg, message) {
|
|
|
47625
47538
|
ok: false,
|
|
47626
47539
|
error: message
|
|
47627
47540
|
}),
|
|
47628
|
-
"
|
|
47629
|
-
type: "
|
|
47541
|
+
"radar-issue-action": () => ({
|
|
47542
|
+
type: "radar-issue-action-result",
|
|
47630
47543
|
requestId,
|
|
47631
47544
|
ok: false,
|
|
47632
47545
|
error: message
|
|
47633
47546
|
}),
|
|
47634
|
-
"
|
|
47635
|
-
type: "
|
|
47547
|
+
"radar-archive-investigation": () => ({
|
|
47548
|
+
type: "radar-archive-investigation-result",
|
|
47636
47549
|
requestId,
|
|
47637
47550
|
ok: false,
|
|
47638
47551
|
error: message
|
|
@@ -47644,8 +47557,8 @@ function requestValidationErrorReply(msg, message) {
|
|
|
47644
47557
|
ok: false,
|
|
47645
47558
|
error: message
|
|
47646
47559
|
}),
|
|
47647
|
-
"
|
|
47648
|
-
type: "
|
|
47560
|
+
"github-polling-refresh": () => ({
|
|
47561
|
+
type: "github-polling-refresh-result",
|
|
47649
47562
|
requestId,
|
|
47650
47563
|
ok: false,
|
|
47651
47564
|
error: message
|
|
@@ -47767,7 +47680,7 @@ function parseSinceParam(url) {
|
|
|
47767
47680
|
return Number.isFinite(n) ? n : null;
|
|
47768
47681
|
}
|
|
47769
47682
|
function registerControlHandlers(controlWss, deps) {
|
|
47770
|
-
const { sessions, agentSessions = /* @__PURE__ */ new Map(), config, configStore, broadcastControl, generateProjectId, applyConfigReload, applySettingsReload, requestShutdown, requestRestart, handleClientFocus, buildHealthSnapshot, getUpdateStatus, getUpdateJournal = null, checkNow = null, applyUpdate = null, isStaging = null, noteRestartRequested = null,
|
|
47683
|
+
const { sessions, agentSessions = /* @__PURE__ */ new Map(), config, configStore, broadcastControl, generateProjectId, applyConfigReload, applySettingsReload, requestShutdown, requestRestart, handleClientFocus, buildHealthSnapshot, getUpdateStatus, getUpdateJournal = null, checkNow = null, applyUpdate = null, isStaging = null, noteRestartRequested = null, getRadarStatus, posthogReportsDir = null, posthogSetIssueStatus = null, radarArchiveInvestigation = null, getTeamReviewStatus = null, getMyPrsStatus = null, getIssuesStatus = null, issues = null, teamReview = null, myPrs = null, getBenchmarkStatus = null, getFactoryState = null, benchmarks = null, factory = null, createGithubClient = createPrGh, issueProjectRepos = null, serverBuild = () => null, getUsageSessions = null, getUsageReport = null, requestUsageReport = null, getPlanLimits = null, controlReplayLog = null, getRtkInstallStatus = () => null, resolveRtkPath = () => getRtkPath(), conversationFs = fs, conversationGit = runGitForConversationHistory, conversationProjectsDir = claudeProjectsDir(process.env, os.homedir()), readTracePage = null, readPlanRevision = null, decidePlanReview = null, sessionDocs = null, changeMapNarrator = null } = deps;
|
|
47771
47684
|
const changeMaps = createChangeMapService({
|
|
47772
47685
|
sessions,
|
|
47773
47686
|
narrator: changeMapNarrator,
|
|
@@ -47852,7 +47765,7 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
47852
47765
|
repos,
|
|
47853
47766
|
agent: requestedAgent && requestedAgent !== DEFAULT_AGENT_ID ? requestedAgent : void 0,
|
|
47854
47767
|
dangerouslySkipPermissions: skipPerms,
|
|
47855
|
-
|
|
47768
|
+
unguarded: msg.unguarded === true,
|
|
47856
47769
|
requireExistingPath: !repos
|
|
47857
47770
|
});
|
|
47858
47771
|
if (!created.ok) {
|
|
@@ -48191,7 +48104,6 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48191
48104
|
if (s.usage != null) cfg.usage = s.usage;
|
|
48192
48105
|
if (incoming.ingest != null) cfg.ingest = mergeSettingsBlock(cfg.ingest, incoming.ingest, INGEST_SPEC);
|
|
48193
48106
|
if (s.telegram != null) cfg.telegram = mergeSettingsBlockOverStored(cfg.telegram, s.telegram);
|
|
48194
|
-
if (s.agentApi != null) cfg.agentApi = mergeSettingsBlockOverStored(cfg.agentApi, s.agentApi);
|
|
48195
48107
|
if (s.guardrails != null) cfg.guardrails = mergeSettingsBlockOverStored(cfg.guardrails, s.guardrails);
|
|
48196
48108
|
if (s.telemetry != null) cfg.telemetry = mergeSettingsBlockOverStored(cfg.telemetry, s.telemetry);
|
|
48197
48109
|
if (!workflowsUpdate) return void 0;
|
|
@@ -48253,16 +48165,16 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48253
48165
|
directories
|
|
48254
48166
|
}));
|
|
48255
48167
|
}
|
|
48256
|
-
async function
|
|
48168
|
+
async function handleGetRadarReport(msg, ws) {
|
|
48257
48169
|
const result = await readPosthogReport(msg.issueId, { reportDir: posthogReportsDir || void 0 });
|
|
48258
48170
|
ws.send(JSON.stringify({
|
|
48259
|
-
type: "
|
|
48171
|
+
type: "radar-report",
|
|
48260
48172
|
requestId: msg.requestId || null,
|
|
48261
48173
|
...result
|
|
48262
48174
|
}));
|
|
48263
48175
|
}
|
|
48264
48176
|
function findPosthogIssue(projectId, issueId) {
|
|
48265
|
-
const status = typeof
|
|
48177
|
+
const status = typeof getRadarStatus === "function" ? getRadarStatus() : null;
|
|
48266
48178
|
const projects = Array.isArray(status?.projects) ? status.projects : [];
|
|
48267
48179
|
for (const project of projects) {
|
|
48268
48180
|
if (String(project.projectId) !== String(projectId)) continue;
|
|
@@ -48305,7 +48217,7 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48305
48217
|
}
|
|
48306
48218
|
return entries;
|
|
48307
48219
|
}
|
|
48308
|
-
function createProjectSession({ name, path: projectPath, repos, agent, dangerouslySkipPermissions,
|
|
48220
|
+
function createProjectSession({ name, path: projectPath, repos, agent, dangerouslySkipPermissions, unguarded, requireExistingPath }) {
|
|
48309
48221
|
for (const [, session] of sessions) {
|
|
48310
48222
|
if (session.name !== name) continue;
|
|
48311
48223
|
return {
|
|
@@ -48346,7 +48258,7 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48346
48258
|
};
|
|
48347
48259
|
if (workspaceRepos) project.repos = workspaceRepos;
|
|
48348
48260
|
if (typeof dangerouslySkipPermissions === "boolean") project.dangerouslySkipPermissions = dangerouslySkipPermissions;
|
|
48349
|
-
if (
|
|
48261
|
+
if (unguarded) project.unguarded = true;
|
|
48350
48262
|
if (agent) project.agent = agent;
|
|
48351
48263
|
const freshConfig = configStore.save((cfg) => {
|
|
48352
48264
|
cfg.projects.push(project);
|
|
@@ -48460,7 +48372,7 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48460
48372
|
path: project.path,
|
|
48461
48373
|
agent: project.agent,
|
|
48462
48374
|
dangerouslySkipPermissions: project.dangerouslySkipPermissions,
|
|
48463
|
-
|
|
48375
|
+
unguarded: project.unguarded
|
|
48464
48376
|
});
|
|
48465
48377
|
if (!created.ok) {
|
|
48466
48378
|
reply({ error: created.error });
|
|
@@ -48492,8 +48404,8 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48492
48404
|
reply({ error: `Could not open GitHub issue session: ${errorMessage(error)}` });
|
|
48493
48405
|
}
|
|
48494
48406
|
}
|
|
48495
|
-
function
|
|
48496
|
-
const reply = (payload) => replyTo(ws, msg, "
|
|
48407
|
+
function handleRadarOpenSession(msg, ws) {
|
|
48408
|
+
const reply = (payload) => replyTo(ws, msg, "radar-open-session-result", {
|
|
48497
48409
|
ok: false,
|
|
48498
48410
|
error: null,
|
|
48499
48411
|
...payload
|
|
@@ -48537,8 +48449,8 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48537
48449
|
});
|
|
48538
48450
|
console.log(`[control] posthog-open-session: issue=${ref.issueId} -> session=${sess.name}`);
|
|
48539
48451
|
}
|
|
48540
|
-
async function
|
|
48541
|
-
const reply = (payload) => replyTo(ws, msg, "
|
|
48452
|
+
async function handleRadarIssueAction(msg, ws) {
|
|
48453
|
+
const reply = (payload) => replyTo(ws, msg, "radar-issue-action-result", {
|
|
48542
48454
|
ok: false,
|
|
48543
48455
|
error: null,
|
|
48544
48456
|
...payload
|
|
@@ -48595,20 +48507,20 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48595
48507
|
}
|
|
48596
48508
|
reply(await teamReview.submitAction(parsed.data));
|
|
48597
48509
|
}
|
|
48598
|
-
async function
|
|
48510
|
+
async function handleGithubPollingRefresh(msg, ws) {
|
|
48599
48511
|
const lane = {
|
|
48600
48512
|
"my-prs": myPrs,
|
|
48601
48513
|
"team-review": teamReview,
|
|
48602
48514
|
issues
|
|
48603
48515
|
}[msg.lane];
|
|
48604
48516
|
if (!lane?.refresh) {
|
|
48605
|
-
replyTo(ws, msg, "
|
|
48517
|
+
replyTo(ws, msg, "github-polling-refresh-result", {
|
|
48606
48518
|
ok: false,
|
|
48607
48519
|
error: "Reviews polling is not running."
|
|
48608
48520
|
});
|
|
48609
48521
|
return;
|
|
48610
48522
|
}
|
|
48611
|
-
replyTo(ws, msg, "
|
|
48523
|
+
replyTo(ws, msg, "github-polling-refresh-result", await lane.refresh());
|
|
48612
48524
|
}
|
|
48613
48525
|
async function handleMyPrMerge(msg, ws) {
|
|
48614
48526
|
const reply = (outcome) => replyTo(ws, msg, "my-pr-merge-result", {
|
|
@@ -48727,8 +48639,8 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48727
48639
|
}
|
|
48728
48640
|
replyTo(ws, msg, "benchmark-action-result", await benchmarks.submitAction(parsed.data));
|
|
48729
48641
|
}
|
|
48730
|
-
async function
|
|
48731
|
-
const reply = (payload) => replyTo(ws, msg, "
|
|
48642
|
+
async function handleRadarArchiveInvestigation(msg, ws) {
|
|
48643
|
+
const reply = (payload) => replyTo(ws, msg, "radar-archive-investigation-result", {
|
|
48732
48644
|
ok: false,
|
|
48733
48645
|
error: null,
|
|
48734
48646
|
...payload
|
|
@@ -48738,11 +48650,11 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48738
48650
|
reply({ error: ref.error });
|
|
48739
48651
|
return;
|
|
48740
48652
|
}
|
|
48741
|
-
if (!
|
|
48653
|
+
if (!radarArchiveInvestigation) {
|
|
48742
48654
|
reply({ error: "PostHog monitoring is not running" });
|
|
48743
48655
|
return;
|
|
48744
48656
|
}
|
|
48745
|
-
const res = await
|
|
48657
|
+
const res = await radarArchiveInvestigation({ id: ref.id });
|
|
48746
48658
|
reply({
|
|
48747
48659
|
ok: res.ok === true,
|
|
48748
48660
|
error: res.error || null
|
|
@@ -48963,17 +48875,17 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
48963
48875
|
"update-settings": handleUpdateSettings,
|
|
48964
48876
|
"scan-repo-roots": handleScanRepoRoots,
|
|
48965
48877
|
"list-agents": handleListAgents,
|
|
48966
|
-
"get-
|
|
48967
|
-
"
|
|
48878
|
+
"get-radar-report": handleGetRadarReport,
|
|
48879
|
+
"radar-open-session": handleRadarOpenSession,
|
|
48968
48880
|
"issue-detail": handleIssueDetail,
|
|
48969
48881
|
"open-issue-session": (msg, ws) => issueOpenQueue.run(`${msg.repo.toLowerCase()}#${msg.issueNumber}`, () => handleOpenIssueSession(msg, ws)),
|
|
48970
|
-
"
|
|
48971
|
-
"
|
|
48882
|
+
"radar-issue-action": handleRadarIssueAction,
|
|
48883
|
+
"radar-archive-investigation": handleRadarArchiveInvestigation,
|
|
48972
48884
|
"team-review-action": handleTeamReviewAction,
|
|
48973
48885
|
"my-pr-merge": handleMyPrMerge,
|
|
48974
48886
|
"my-pr-keep-mergeable": handleMyPrKeepMergeable,
|
|
48975
48887
|
"my-pr-merge-when-ready": handleMyPrMergeWhenReady,
|
|
48976
|
-
"
|
|
48888
|
+
"github-polling-refresh": handleGithubPollingRefresh,
|
|
48977
48889
|
"benchmark-action": handleBenchmarkAction,
|
|
48978
48890
|
"factory-queue-intent": handleFactoryQueueIntent,
|
|
48979
48891
|
"factory-control": handleFactoryControl,
|
|
@@ -49278,8 +49190,8 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
49278
49190
|
type: "update-progress",
|
|
49279
49191
|
journal: updateJournal
|
|
49280
49192
|
}));
|
|
49281
|
-
const
|
|
49282
|
-
if (
|
|
49193
|
+
const radarStatus = typeof getRadarStatus === "function" ? getRadarStatus() : null;
|
|
49194
|
+
if (radarStatus) ws.send(JSON.stringify(radarStatus));
|
|
49283
49195
|
const teamReviewStatus = typeof getTeamReviewStatus === "function" ? getTeamReviewStatus() : null;
|
|
49284
49196
|
if (teamReviewStatus) ws.send(JSON.stringify(teamReviewStatus));
|
|
49285
49197
|
const myPrsStatus = typeof getMyPrsStatus === "function" ? getMyPrsStatus() : null;
|
|
@@ -49330,7 +49242,7 @@ function registerControlHandlers(controlWss, deps) {
|
|
|
49330
49242
|
return { buildSnapshot };
|
|
49331
49243
|
}
|
|
49332
49244
|
//#endregion
|
|
49333
|
-
//#region server/backend-control.ts
|
|
49245
|
+
//#region server/backend/backend-control.ts
|
|
49334
49246
|
function createBackendControl(dependencies) {
|
|
49335
49247
|
const { controlWss, sessions, config, configStore, broadcastControl, controlReplayLog, laneAssembly, posthog, teamReview, myPrs, issues, benchmarks, usage, logger } = dependencies;
|
|
49336
49248
|
registerControlHandlers(controlWss, {
|
|
@@ -49356,9 +49268,9 @@ function createBackendControl(dependencies) {
|
|
|
49356
49268
|
applyUpdate: dependencies.applyUpdate,
|
|
49357
49269
|
isStaging: dependencies.isStaging,
|
|
49358
49270
|
noteRestartRequested: dependencies.noteRestartRequested,
|
|
49359
|
-
|
|
49271
|
+
getRadarStatus: () => posthog.getStatus(),
|
|
49360
49272
|
posthogSetIssueStatus: (args) => posthog.setIssueStatus(args),
|
|
49361
|
-
|
|
49273
|
+
radarArchiveInvestigation: (args) => posthog.archiveInvestigation(args),
|
|
49362
49274
|
getTeamReviewStatus: () => teamReview.getStatus(),
|
|
49363
49275
|
getMyPrsStatus: () => myPrs.getStatus(),
|
|
49364
49276
|
getIssuesStatus: () => issues.getStatus(),
|
|
@@ -50073,7 +49985,7 @@ async function checkForUpdate({ currentVersion, updateChannel = "release", fetch
|
|
|
50073
49985
|
}
|
|
50074
49986
|
}
|
|
50075
49987
|
//#endregion
|
|
50076
|
-
//#region server/backend-update.ts
|
|
49988
|
+
//#region server/backend/backend-update.ts
|
|
50077
49989
|
var UPDATE_RECHECK_MS = 864e5;
|
|
50078
49990
|
function journalSummary(journal) {
|
|
50079
49991
|
if (!journal) return null;
|
|
@@ -50944,7 +50856,7 @@ function createRecorder(sessionName, captureConfig, recordSignals = true) {
|
|
|
50944
50856
|
});
|
|
50945
50857
|
}
|
|
50946
50858
|
//#endregion
|
|
50947
|
-
//#region server/session-factory.ts
|
|
50859
|
+
//#region server/session/session-factory.ts
|
|
50948
50860
|
function createSessionFactory(dependencies) {
|
|
50949
50861
|
function planLimitsEnabled(config) {
|
|
50950
50862
|
const usageConfig = resolveUsageConfig(config.usage);
|
|
@@ -50994,7 +50906,6 @@ function createSessionFactory(dependencies) {
|
|
|
50994
50906
|
planReviewPort: dependencies.getPlanReviewPort(),
|
|
50995
50907
|
planLimits: planLimitsEnabled(config),
|
|
50996
50908
|
getUserHooks: () => dependencies.getUserHooks(project.id),
|
|
50997
|
-
agentApi: config.agentApi?.enabled === true,
|
|
50998
50909
|
commitSigningProgram: dependencies.commitSigningProgram ?? null,
|
|
50999
50910
|
...overrides,
|
|
51000
50911
|
prepareSandbox: "prepareSandbox" in overrides ? overrides.prepareSandbox : defaultSandboxFor(project, config, overrides)
|
|
@@ -51009,7 +50920,7 @@ function createSessionFactory(dependencies) {
|
|
|
51009
50920
|
};
|
|
51010
50921
|
}
|
|
51011
50922
|
//#endregion
|
|
51012
|
-
//#region server/session-sandbox.ts
|
|
50923
|
+
//#region server/sandbox/session-sandbox.ts
|
|
51013
50924
|
var UNWRAPPED_PLATFORM = "win32";
|
|
51014
50925
|
var GITHUB_TOKEN_TIMEOUT_MS = 5e3;
|
|
51015
50926
|
var OPT_OUT_HINT = "Mark the session or its repository unguarded to start it without guardrails.";
|
|
@@ -51094,7 +51005,7 @@ function createSessionSandbox({ getSettings, uploadsRoot, sandboxRefusal = allow
|
|
|
51094
51005
|
return { prepareFor };
|
|
51095
51006
|
}
|
|
51096
51007
|
//#endregion
|
|
51097
|
-
//#region server/backend-session-runtime.ts
|
|
51008
|
+
//#region server/backend/backend-session-runtime.ts
|
|
51098
51009
|
function createBackendSessionRuntime(dependencies) {
|
|
51099
51010
|
const hookRouter = new HookRouter({ recordOutcome: dependencies.recordOutcome });
|
|
51100
51011
|
const agentIngressServer = http.createServer();
|
|
@@ -52131,7 +52042,7 @@ function createTelemetry(options) {
|
|
|
52131
52042
|
};
|
|
52132
52043
|
}
|
|
52133
52044
|
//#endregion
|
|
52134
|
-
//#region server/core/session-docs-core.ts
|
|
52045
|
+
//#region server/session/core/session-docs-core.ts
|
|
52135
52046
|
var NUL_CHARACTER = String.fromCharCode(0);
|
|
52136
52047
|
var DOC_REFUSAL_COPY = Object.freeze({
|
|
52137
52048
|
missing: "no file exists at that path, so write it first and surface it again",
|
|
@@ -52208,7 +52119,7 @@ function withSurfacedDoc(docs, surfaced, maxDocs) {
|
|
|
52208
52119
|
return [surfaced, ...docs.filter((doc) => doc.path !== surfaced.path)].slice(0, maxDocs);
|
|
52209
52120
|
}
|
|
52210
52121
|
//#endregion
|
|
52211
|
-
//#region server/session-docs-wiring.ts
|
|
52122
|
+
//#region server/session/session-docs-wiring.ts
|
|
52212
52123
|
async function readAtMostCapPlusOneByte(handle) {
|
|
52213
52124
|
const buffer = Buffer.alloc(SESSION_DOC_BODY_CAP_BYTES + 1);
|
|
52214
52125
|
let filledBytes = 0;
|
|
@@ -52406,7 +52317,7 @@ function createSessionDocsWiring({ broadcastControl, now = Date.now }) {
|
|
|
52406
52317
|
};
|
|
52407
52318
|
}
|
|
52408
52319
|
//#endregion
|
|
52409
|
-
//#region server/backend.ts
|
|
52320
|
+
//#region server/backend/backend.ts
|
|
52410
52321
|
var AGENT_INGRESS_HOST = "127.0.0.1";
|
|
52411
52322
|
function createBackend(httpServer, options = {}) {
|
|
52412
52323
|
const { staticDir = "auto", settingsDefaults } = options;
|
|
@@ -52466,7 +52377,7 @@ function createBackend(httpServer, options = {}) {
|
|
|
52466
52377
|
const agentIngressDependencies = {
|
|
52467
52378
|
allowedHosts,
|
|
52468
52379
|
hookRouter,
|
|
52469
|
-
getSession:
|
|
52380
|
+
getSession: (glimmervoidId) => laneAssembly.findLiveSession(glimmervoidId),
|
|
52470
52381
|
getUsage: () => usage,
|
|
52471
52382
|
getPlanReview: () => laneAssembly.planReview,
|
|
52472
52383
|
refocusContextFor: (glimmervoidId) => ({
|