@cmmd-center/forge 0.13.15 → 0.13.17
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.cjs +258 -836
- package/dist/bin.mjs +228 -806
- package/dist/client/assets/{CanvasPanel-RpD9Eh_S.js → CanvasPanel-uofZ5KUR.js} +2 -2
- package/dist/client/assets/{CompositeItem-DEIBUHJR.js → CompositeItem-C5YSRi5B.js} +2 -2
- package/dist/client/assets/{DiffPanel-D-NIms_l.js → DiffPanel-DBxERq43.js} +3 -3
- package/dist/client/assets/{DiffPanel.logic-DwoeNGnH.js → DiffPanel.logic-CVvbOj4s.js} +2 -2
- package/dist/client/assets/DiffPanelShell-3FSe-Ixv.js +2533 -0
- package/dist/client/assets/{DiffWorkerPoolProvider-DHNvSWPo.js → DiffWorkerPoolProvider-DGz1EBXf.js} +9 -9
- package/dist/client/assets/PullRequestCodePanel-BsTzlXhi.js +5 -0
- package/dist/client/assets/{Virtualizer-Cm4G15Gy.js → Virtualizer-BABEZSz9.js} +2 -2
- package/dist/client/assets/{canvasStateStore-NrAxDqvM.js → canvasStateStore-IBP3QM_C.js} +2 -2
- package/dist/client/assets/{cmmdAuthRedirect-BahlX0gF.js → cmmdAuthRedirect-Ck1QfYaS.js} +2 -2
- package/dist/client/assets/index-DBkypII5.js +153 -0
- package/dist/client/assets/index-EZbGVDT4.css +1 -0
- package/dist/client/assets/{popover-Z8Tvl-OD.js → popover-BQaoSlk7.js} +2 -2
- package/dist/client/assets/{src-BU7yHzO9.js → src-Bj8vTcnP.js} +2 -2
- package/dist/client/assets/{toggle-CWYdWYBn.js → toggle-CE2NHkQL.js} +2 -2
- package/dist/client/index.html +11 -11
- package/dist/forge-build.json +1 -1
- package/dist/runtimeBootstrap.cjs +1 -1
- package/dist/runtimeBootstrap.mjs +1 -1
- package/dist/{runtimeControlAuthority-BkVB0uAA.cjs → runtimeControlAuthority-DCitZFTk.cjs} +3 -1
- package/dist/{runtimeControlAuthority-E_kdeD_P.mjs → runtimeControlAuthority-DpRIoWqP.mjs} +3 -1
- package/package.json +1 -1
- package/dist/client/assets/DiffPanelShell-BI5poBl7.js +0 -2532
- package/dist/client/assets/PullRequestCodePanel-apgvV8hi.js +0 -5
- package/dist/client/assets/index-C3pC5t1K.css +0 -1
- package/dist/client/assets/index-DdqgGbOQ.js +0 -154
package/dist/bin.cjs
CHANGED
|
@@ -12,7 +12,7 @@ const require_Cache = require("./Cache-BmGc_2BZ.cjs");
|
|
|
12
12
|
const require_SqlError = require("./SqlError-g4pLzNWR.cjs");
|
|
13
13
|
const require_Mime = require("./Mime-Bilnh8zE.cjs");
|
|
14
14
|
const require_esm = require("./esm-BZhXwX5p.cjs");
|
|
15
|
-
const require_runtimeControlAuthority = require("./runtimeControlAuthority-
|
|
15
|
+
const require_runtimeControlAuthority = require("./runtimeControlAuthority-DCitZFTk.cjs");
|
|
16
16
|
const require_PTY = require("./PTY-B4ZctbwQ.cjs");
|
|
17
17
|
let node_child_process = require("node:child_process");
|
|
18
18
|
node_child_process = require_chunk.__toESM(node_child_process);
|
|
@@ -25802,160 +25802,6 @@ const WorkspaceEnsureScratchResult = require_Schema$1.Struct({
|
|
|
25802
25802
|
workspaceRoot: require_Schema$1.String,
|
|
25803
25803
|
title: require_Schema$1.String
|
|
25804
25804
|
});
|
|
25805
|
-
const CodeGraphRelation = require_Schema$1.Literals([
|
|
25806
|
-
"contains",
|
|
25807
|
-
"imports",
|
|
25808
|
-
"calls",
|
|
25809
|
-
"imports_from",
|
|
25810
|
-
"method",
|
|
25811
|
-
"references",
|
|
25812
|
-
"re_exports",
|
|
25813
|
-
"indirect_call",
|
|
25814
|
-
"dynamic_import",
|
|
25815
|
-
"inherits",
|
|
25816
|
-
"rationale_for",
|
|
25817
|
-
"implements",
|
|
25818
|
-
"cites",
|
|
25819
|
-
"triggers"
|
|
25820
|
-
]);
|
|
25821
|
-
const CodeGraphConfidence = require_Schema$1.Literals(["EXTRACTED", "INFERRED"]);
|
|
25822
|
-
const CodeGraphEdgeClass = require_Schema$1.Literals([
|
|
25823
|
-
"containment",
|
|
25824
|
-
"dependency",
|
|
25825
|
-
"behavior"
|
|
25826
|
-
]);
|
|
25827
|
-
/**
|
|
25828
|
-
* Relation to drawn class. Exhaustive over CODE_GRAPH_RELATIONS by construction
|
|
25829
|
-
* — `codeGraph.test.ts` fails if a relation is added without a class.
|
|
25830
|
-
*/
|
|
25831
|
-
const CODE_GRAPH_RELATION_CLASS = {
|
|
25832
|
-
contains: "containment",
|
|
25833
|
-
method: "containment",
|
|
25834
|
-
imports: "dependency",
|
|
25835
|
-
imports_from: "dependency",
|
|
25836
|
-
re_exports: "dependency",
|
|
25837
|
-
dynamic_import: "dependency",
|
|
25838
|
-
inherits: "dependency",
|
|
25839
|
-
implements: "dependency",
|
|
25840
|
-
calls: "behavior",
|
|
25841
|
-
indirect_call: "behavior",
|
|
25842
|
-
references: "behavior",
|
|
25843
|
-
triggers: "behavior",
|
|
25844
|
-
cites: "behavior",
|
|
25845
|
-
rationale_for: "behavior"
|
|
25846
|
-
};
|
|
25847
|
-
const CodeGraphNodeKind = require_Schema$1.Literals(["file", "symbol"]);
|
|
25848
|
-
/**
|
|
25849
|
-
* One community, positioned.
|
|
25850
|
-
*
|
|
25851
|
-
* Positions are computed server-side and are stable for a given graph build, so
|
|
25852
|
-
* the map does not rearrange itself between openings. A map you have to re-learn
|
|
25853
|
-
* every time is not a map.
|
|
25854
|
-
*/
|
|
25855
|
-
const CodeGraphRegion = require_Schema$1.Struct({
|
|
25856
|
-
id: NonNegativeInt,
|
|
25857
|
-
label: TrimmedNonEmptyString,
|
|
25858
|
-
nodeCount: PositiveInt,
|
|
25859
|
-
x: require_Schema$1.Number,
|
|
25860
|
-
y: require_Schema$1.Number
|
|
25861
|
-
});
|
|
25862
|
-
/** An aggregated edge between two regions, weighted by how many edges cross. */
|
|
25863
|
-
const CodeGraphRegionLink = require_Schema$1.Struct({
|
|
25864
|
-
source: NonNegativeInt,
|
|
25865
|
-
target: NonNegativeInt,
|
|
25866
|
-
weight: PositiveInt
|
|
25867
|
-
});
|
|
25868
|
-
/**
|
|
25869
|
-
* The default view: the whole repository as ~120 named regions.
|
|
25870
|
-
*
|
|
25871
|
-
* `truncatedRegions` is not decoration. When a graph has more regions than the
|
|
25872
|
-
* map shows, the surface says so — a view that silently drops a third of the
|
|
25873
|
-
* codebase while looking complete is the failure mode this field exists to
|
|
25874
|
-
* prevent.
|
|
25875
|
-
*/
|
|
25876
|
-
const CodeGraphSummary = require_Schema$1.Struct({
|
|
25877
|
-
repoLabel: TrimmedNonEmptyString,
|
|
25878
|
-
builtAtCommit: require_Schema$1.NullOr(require_Schema$1.String),
|
|
25879
|
-
nodeCount: NonNegativeInt,
|
|
25880
|
-
edgeCount: NonNegativeInt,
|
|
25881
|
-
extractedEdgeCount: NonNegativeInt,
|
|
25882
|
-
inferredEdgeCount: NonNegativeInt,
|
|
25883
|
-
regionCount: NonNegativeInt,
|
|
25884
|
-
regions: require_Schema$1.ArraySchema(CodeGraphRegion),
|
|
25885
|
-
links: require_Schema$1.ArraySchema(CodeGraphRegionLink),
|
|
25886
|
-
truncatedRegions: NonNegativeInt
|
|
25887
|
-
});
|
|
25888
|
-
/** A node as it appears in a list, a search result, or a neighborhood. */
|
|
25889
|
-
const CodeGraphNodeSummary = require_Schema$1.Struct({
|
|
25890
|
-
id: TrimmedNonEmptyString,
|
|
25891
|
-
label: TrimmedNonEmptyString,
|
|
25892
|
-
kind: CodeGraphNodeKind,
|
|
25893
|
-
sourceFile: require_Schema$1.NullOr(require_Schema$1.String),
|
|
25894
|
-
sourceLocation: require_Schema$1.NullOr(require_Schema$1.String),
|
|
25895
|
-
regionId: require_Schema$1.NullOr(NonNegativeInt),
|
|
25896
|
-
regionLabel: require_Schema$1.NullOr(require_Schema$1.String),
|
|
25897
|
-
degree: NonNegativeInt
|
|
25898
|
-
});
|
|
25899
|
-
/** One edge, carrying both the exact relation and the class it is drawn as. */
|
|
25900
|
-
const CodeGraphEdgeView = require_Schema$1.Struct({
|
|
25901
|
-
source: TrimmedNonEmptyString,
|
|
25902
|
-
target: TrimmedNonEmptyString,
|
|
25903
|
-
relation: CodeGraphRelation,
|
|
25904
|
-
edgeClass: CodeGraphEdgeClass,
|
|
25905
|
-
confidence: CodeGraphConfidence,
|
|
25906
|
-
confidenceScore: require_Schema$1.Number
|
|
25907
|
-
});
|
|
25908
|
-
/**
|
|
25909
|
-
* One node and what surrounds it — the view a person actually works in.
|
|
25910
|
-
*
|
|
25911
|
-
* `truncated` fires when a hub's fan-out exceeds the cap. A god node with
|
|
25912
|
-
* thousands of edges must degrade to "showing 150 of 2,310", never to a frozen
|
|
25913
|
-
* tab or a quietly partial picture.
|
|
25914
|
-
*/
|
|
25915
|
-
const CodeGraphNeighborhood = require_Schema$1.Struct({
|
|
25916
|
-
root: CodeGraphNodeSummary,
|
|
25917
|
-
nodes: require_Schema$1.ArraySchema(CodeGraphNodeSummary),
|
|
25918
|
-
edges: require_Schema$1.ArraySchema(CodeGraphEdgeView),
|
|
25919
|
-
depth: PositiveInt,
|
|
25920
|
-
truncated: require_Schema$1.Boolean,
|
|
25921
|
-
omittedCount: NonNegativeInt
|
|
25922
|
-
});
|
|
25923
|
-
const CodeGraphSearchResult = require_Schema$1.Struct({
|
|
25924
|
-
nodes: require_Schema$1.ArraySchema(CodeGraphNodeSummary),
|
|
25925
|
-
truncated: require_Schema$1.Boolean
|
|
25926
|
-
});
|
|
25927
|
-
const CodeGraphSummaryInput = require_Schema$1.Struct({ cwd: TrimmedNonEmptyString });
|
|
25928
|
-
const CodeGraphNeighborhoodInput = require_Schema$1.Struct({
|
|
25929
|
-
cwd: TrimmedNonEmptyString,
|
|
25930
|
-
nodeId: TrimmedNonEmptyString,
|
|
25931
|
-
depth: require_Schema$1.optional(PositiveInt)
|
|
25932
|
-
});
|
|
25933
|
-
const CodeGraphSearchInput = require_Schema$1.Struct({
|
|
25934
|
-
cwd: TrimmedNonEmptyString,
|
|
25935
|
-
query: TrimmedNonEmptyString,
|
|
25936
|
-
limit: require_Schema$1.optional(PositiveInt)
|
|
25937
|
-
});
|
|
25938
|
-
/** Where the extractor writes, relative to the project root. */
|
|
25939
|
-
const CODE_GRAPH_ARTIFACT_PATH = "graphify-out/graph.json";
|
|
25940
|
-
/**
|
|
25941
|
-
* No graph in this checkout, or one that cannot be read.
|
|
25942
|
-
*
|
|
25943
|
-
* Distinct from a read failure on purpose: "not indexed yet" is the normal
|
|
25944
|
-
* first-run state and gets an action, while a malformed or unreadable artifact
|
|
25945
|
-
* is a fault and gets an explanation. Collapsing them would tell a user with a
|
|
25946
|
-
* corrupt file to run a build they have already run.
|
|
25947
|
-
*/
|
|
25948
|
-
var CodeGraphUnavailableError = class extends require_Schema$1.TaggedErrorClass()("CodeGraphUnavailableError", {
|
|
25949
|
-
reason: require_Schema$1.Literals([
|
|
25950
|
-
"missing",
|
|
25951
|
-
"unreadable",
|
|
25952
|
-
"malformed",
|
|
25953
|
-
"lfs-pointer"
|
|
25954
|
-
]),
|
|
25955
|
-
message: require_Schema$1.String
|
|
25956
|
-
}) {};
|
|
25957
|
-
/** A node id that is not in this graph — usually a stale link into a rebuilt graph. */
|
|
25958
|
-
var CodeGraphNodeNotFoundError = class extends require_Schema$1.TaggedErrorClass()("CodeGraphNodeNotFoundError", { nodeId: require_Schema$1.String }) {};
|
|
25959
25805
|
//#endregion
|
|
25960
25806
|
//#region ../../packages/contracts/src/relay.ts
|
|
25961
25807
|
const RELAY_PROTOCOL_FAMILY = "forge-relay";
|
|
@@ -26342,9 +26188,6 @@ const WS_METHODS = {
|
|
|
26342
26188
|
projectsWriteFile: "projects.writeFile",
|
|
26343
26189
|
projectCheckoutDeletionPreview: "projectCheckoutDeletion.preview",
|
|
26344
26190
|
projectCheckoutDeletionExecute: "projectCheckoutDeletion.execute",
|
|
26345
|
-
codeGraphSummary: "codeGraph.summary",
|
|
26346
|
-
codeGraphNeighborhood: "codeGraph.neighborhood",
|
|
26347
|
-
codeGraphSearch: "codeGraph.search",
|
|
26348
26191
|
workspaceReadFile: "workspace.readFile",
|
|
26349
26192
|
workspaceBeginWriteFile: "workspace.beginWriteFile",
|
|
26350
26193
|
workspaceWriteFileChunk: "workspace.writeFileChunk",
|
|
@@ -26630,21 +26473,6 @@ const WsProjectCheckoutDeletionExecuteRpc = make$30(WS_METHODS.projectCheckoutDe
|
|
|
26630
26473
|
payload: ProjectCheckoutDeletionExecuteInput,
|
|
26631
26474
|
success: ProjectCheckoutDeletionResult
|
|
26632
26475
|
});
|
|
26633
|
-
const WsCodeGraphSummaryRpc = make$30(WS_METHODS.codeGraphSummary, {
|
|
26634
|
-
payload: CodeGraphSummaryInput,
|
|
26635
|
-
success: CodeGraphSummary,
|
|
26636
|
-
error: CodeGraphUnavailableError
|
|
26637
|
-
});
|
|
26638
|
-
const WsCodeGraphNeighborhoodRpc = make$30(WS_METHODS.codeGraphNeighborhood, {
|
|
26639
|
-
payload: CodeGraphNeighborhoodInput,
|
|
26640
|
-
success: CodeGraphNeighborhood,
|
|
26641
|
-
error: require_Schema$1.Union([CodeGraphUnavailableError, CodeGraphNodeNotFoundError])
|
|
26642
|
-
});
|
|
26643
|
-
const WsCodeGraphSearchRpc = make$30(WS_METHODS.codeGraphSearch, {
|
|
26644
|
-
payload: CodeGraphSearchInput,
|
|
26645
|
-
success: CodeGraphSearchResult,
|
|
26646
|
-
error: CodeGraphUnavailableError
|
|
26647
|
-
});
|
|
26648
26476
|
const WsWorkspaceReadFileRpc = make$30(WS_METHODS.workspaceReadFile, {
|
|
26649
26477
|
payload: BulkTransferReadFileInput,
|
|
26650
26478
|
success: BulkTransferStreamEvent,
|
|
@@ -27094,7 +26922,7 @@ const WsRpcGroup = make$29(WsServerGetConfigRpc, WsServerRefreshProvidersRpc, Ws
|
|
|
27094
26922
|
payload: UsageSummaryInput,
|
|
27095
26923
|
success: UsageSummary,
|
|
27096
26924
|
error: UsageReadError
|
|
27097
|
-
}), WsPullRequestsListRpc, WsPullRequestsListStatsRpc, WsPullRequestsDetailRpc, WsPullRequestsActivityRpc, WsPullRequestsThreadCommentsRpc, WsPullRequestsDiffFileContentsRpc, WsPullRequestsRunActionRpc, WsPullRequestsUpdateRpc, WsPullRequestsCommentRpc, WsPullRequestsUpdateCommentRpc, WsPullRequestsSubmitReviewRpc, WsPullRequestsReplyToThreadRpc, WsPullRequestsSetThreadResolutionRpc, WsPullRequestsSetReactionRpc, WsPullRequestsInvalidateRpc, WsPullRequestsReviewerCandidatesRpc, WsPullRequestsRequestReviewersRpc, WsProjectsSearchContentsRpc, WsProjectsSearchEntriesRpc, WsProjectsWriteFileRpc, WsProjectCheckoutDeletionPreviewRpc, WsProjectCheckoutDeletionExecuteRpc,
|
|
26925
|
+
}), WsPullRequestsListRpc, WsPullRequestsListStatsRpc, WsPullRequestsDetailRpc, WsPullRequestsActivityRpc, WsPullRequestsThreadCommentsRpc, WsPullRequestsDiffFileContentsRpc, WsPullRequestsRunActionRpc, WsPullRequestsUpdateRpc, WsPullRequestsCommentRpc, WsPullRequestsUpdateCommentRpc, WsPullRequestsSubmitReviewRpc, WsPullRequestsReplyToThreadRpc, WsPullRequestsSetThreadResolutionRpc, WsPullRequestsSetReactionRpc, WsPullRequestsInvalidateRpc, WsPullRequestsReviewerCandidatesRpc, WsPullRequestsRequestReviewersRpc, WsProjectsSearchContentsRpc, WsProjectsSearchEntriesRpc, WsProjectsWriteFileRpc, WsProjectCheckoutDeletionPreviewRpc, WsProjectCheckoutDeletionExecuteRpc, WsWorkspaceReadFileRpc, WsWorkspaceBeginWriteFileRpc, WsWorkspaceWriteFileChunkRpc, WsWorkspaceCommitWriteFileRpc, WsWorkspaceCancelWriteFileRpc, WsShellOpenInEditorRpc, WsSubscribeGitStatusRpc, WsGitPullRpc, WsGitRefreshStatusRpc, WsGitRunStackedActionRpc, WsGitResolvePullRequestRpc, WsGitPreparePullRequestThreadRpc, WsGitListBranchesRpc, WsVcsListRefsRpc, WsVcsRefreshStatusRpc, WsSubscribeVcsStatusRpc, WsVcsPullRpc, WsVcsCreateWorktreeRpc, WsVcsRemoveWorktreeRpc, WsVcsCreateRefRpc, WsVcsSwitchRefRpc, WsVcsInitRpc, WsGitCreateWorktreeRpc, WsGitRemoveWorktreeRpc, WsGitCreateBranchRpc, WsGitCheckoutRpc, WsGitInitRpc, WsFilesystemBrowseRpc, WsProjectsReadFileRpc, WsReviewGetDiffPreviewRpc, WsCloudListRuntimesRpc, WsTerminalOpenRpc, WsTerminalAttachRpc, WsTerminalWriteRpc, WsTerminalResizeRpc, WsTerminalSignalRpc, WsTerminalClearRpc, WsTerminalRestartRpc, WsTerminalCloseRpc, WsBrowserOpenSessionRpc, WsBrowserListSessionsRpc, WsBrowserCloseSessionRpc, WsBrowserGetSessionRpc, WsBrowserCommandRpc, WsBrowserClearBrowsingDataRpc, WsBrowserAttachDisplayRpc, WsBrowserAddDisplayIceCandidateRpc, WsComputerInputRpc, WsDevTunnelRegisterRpc, WsDevTunnelUnregisterRpc, WsDevTunnelListRpc, WsThreadDevRuntimeGetRpc, WsThreadDevRuntimeAllocatePortRpc, WsThreadDevRuntimeReleaseRpc, WsWorkspaceEnvironmentPreflightRpc, WsWorkspaceEnsureScratchRpc, WsSubscribeTerminalEventsRpc, WsSubscribeTerminalMetadataRpc, WsProjectsListEntriesRpc, WsServerDiscoverSourceControlRpc, WsServerReportClientActivityRpc, WsSubscribeBrowserEventsRpc, WsSubscribeServerConfigRpc, WsSubscribeServerLifecycleRpc, WsSubscribeAuthAccessRpc, WsSubscribeWorkspaceReadinessRpc, WsOrchestrationDispatchCommandRpc, WsOrchestrationGetTurnDiffRpc, WsOrchestrationGetFullThreadDiffRpc, WsOrchestrationStreamTurnDiffRpc, WsOrchestrationStreamFullThreadDiffRpc, WsOrchestrationReplayEventsRpc, WsOrchestrationGetArchivedShellSnapshotRpc, WsOrchestrationSubscribeShellRpc, WsOrchestrationSubscribeThreadRpc, make$30(WS_METHODS.assetsCreateUrl, {
|
|
27098
26926
|
payload: AssetsRpcSchemas.createUrl.input,
|
|
27099
26927
|
success: AssetsRpcSchemas.createUrl.output,
|
|
27100
26928
|
error: AssetAccessError
|
|
@@ -31791,21 +31619,6 @@ const RELAY_METHOD_POLICY_BASES = [
|
|
|
31791
31619
|
requiredScope: "runtime.read",
|
|
31792
31620
|
deliveryClass: "read"
|
|
31793
31621
|
},
|
|
31794
|
-
{
|
|
31795
|
-
method: WS_METHODS.codeGraphSummary,
|
|
31796
|
-
requiredScope: "workspace.read",
|
|
31797
|
-
deliveryClass: "read"
|
|
31798
|
-
},
|
|
31799
|
-
{
|
|
31800
|
-
method: WS_METHODS.codeGraphNeighborhood,
|
|
31801
|
-
requiredScope: "workspace.read",
|
|
31802
|
-
deliveryClass: "read"
|
|
31803
|
-
},
|
|
31804
|
-
{
|
|
31805
|
-
method: WS_METHODS.codeGraphSearch,
|
|
31806
|
-
requiredScope: "workspace.read",
|
|
31807
|
-
deliveryClass: "read"
|
|
31808
|
-
},
|
|
31809
31622
|
{
|
|
31810
31623
|
method: WS_METHODS.projectsWriteFile,
|
|
31811
31624
|
requiredScope: "workspace.write",
|
|
@@ -51315,21 +51128,21 @@ var require_module_details_from_path = /* @__PURE__ */ require_chunk.__commonJSM
|
|
|
51315
51128
|
var lastBaseDirSegmentIndex = index + offset - 1;
|
|
51316
51129
|
for (var i = 0; i <= lastBaseDirSegmentIndex; i++) if (i === lastBaseDirSegmentIndex) basedir += segments[i];
|
|
51317
51130
|
else basedir += segments[i] + sep$2;
|
|
51318
|
-
var path$
|
|
51131
|
+
var path$17 = "";
|
|
51319
51132
|
var lastSegmentIndex = segments.length - 1;
|
|
51320
|
-
for (var i2 = index + offset; i2 <= lastSegmentIndex; i2++) if (i2 === lastSegmentIndex) path$
|
|
51321
|
-
else path$
|
|
51133
|
+
for (var i2 = index + offset; i2 <= lastSegmentIndex; i2++) if (i2 === lastSegmentIndex) path$17 += segments[i2];
|
|
51134
|
+
else path$17 += segments[i2] + sep$2;
|
|
51322
51135
|
return {
|
|
51323
51136
|
name,
|
|
51324
51137
|
basedir,
|
|
51325
|
-
path: path$
|
|
51138
|
+
path: path$17
|
|
51326
51139
|
};
|
|
51327
51140
|
};
|
|
51328
51141
|
}));
|
|
51329
51142
|
//#endregion
|
|
51330
51143
|
//#region ../../node_modules/.bun/require-in-the-middle@8.0.1/node_modules/require-in-the-middle/index.js
|
|
51331
51144
|
var require_require_in_the_middle = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
|
|
51332
|
-
const path$
|
|
51145
|
+
const path$16 = require("path");
|
|
51333
51146
|
const Module = require("module");
|
|
51334
51147
|
const debug = require_src$5()("require-in-the-middle");
|
|
51335
51148
|
const moduleDetailsFromPath = require_module_details_from_path();
|
|
@@ -51460,7 +51273,7 @@ var require_require_in_the_middle = /* @__PURE__ */ require_chunk.__commonJSMin(
|
|
|
51460
51273
|
}
|
|
51461
51274
|
moduleName = filename;
|
|
51462
51275
|
} else if (hasWhitelist === true && modules.includes(filename)) {
|
|
51463
|
-
const parsedPath = path$
|
|
51276
|
+
const parsedPath = path$16.parse(filename);
|
|
51464
51277
|
moduleName = parsedPath.name;
|
|
51465
51278
|
basedir = parsedPath.dir;
|
|
51466
51279
|
} else {
|
|
@@ -51495,7 +51308,7 @@ var require_require_in_the_middle = /* @__PURE__ */ require_chunk.__commonJSMin(
|
|
|
51495
51308
|
return exports$12;
|
|
51496
51309
|
}
|
|
51497
51310
|
if (res !== filename) if (internals === true) {
|
|
51498
|
-
moduleName = moduleName + path$
|
|
51311
|
+
moduleName = moduleName + path$16.sep + path$16.relative(basedir, filename);
|
|
51499
51312
|
debug("preparing to process require of internal file: %s", moduleName);
|
|
51500
51313
|
} else {
|
|
51501
51314
|
debug("ignoring require of non-main module file: %s", res);
|
|
@@ -51524,8 +51337,8 @@ var require_require_in_the_middle = /* @__PURE__ */ require_chunk.__commonJSMin(
|
|
|
51524
51337
|
} else debug("process.getBuiltinModule unhook unsuccessful");
|
|
51525
51338
|
};
|
|
51526
51339
|
function resolveModuleName(stat) {
|
|
51527
|
-
const normalizedPath = path$
|
|
51528
|
-
return path$
|
|
51340
|
+
const normalizedPath = path$16.sep !== "/" ? stat.path.split(path$16.sep).join("/") : stat.path;
|
|
51341
|
+
return path$16.posix.join(stat.name, normalizedPath).replace(normalize, "");
|
|
51529
51342
|
}
|
|
51530
51343
|
}));
|
|
51531
51344
|
//#endregion
|
|
@@ -51603,7 +51416,7 @@ var require_RequireInTheMiddleSingleton = /* @__PURE__ */ require_chunk.__common
|
|
|
51603
51416
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51604
51417
|
exports.RequireInTheMiddleSingleton = void 0;
|
|
51605
51418
|
const require_in_the_middle_1 = require_require_in_the_middle();
|
|
51606
|
-
const path$
|
|
51419
|
+
const path$15 = require("path");
|
|
51607
51420
|
const ModuleNameTrie_1 = require_ModuleNameTrie();
|
|
51608
51421
|
/**
|
|
51609
51422
|
* Whether Mocha is running in this process
|
|
@@ -51670,7 +51483,7 @@ var require_RequireInTheMiddleSingleton = /* @__PURE__ */ require_chunk.__common
|
|
|
51670
51483
|
* @returns {string} Normalized module name or path
|
|
51671
51484
|
*/
|
|
51672
51485
|
function normalizePathSeparators(moduleNameOrPath) {
|
|
51673
|
-
return path$
|
|
51486
|
+
return path$15.sep !== ModuleNameTrie_1.ModuleNameSeparator ? moduleNameOrPath.split(path$15.sep).join(ModuleNameTrie_1.ModuleNameSeparator) : moduleNameOrPath;
|
|
51674
51487
|
}
|
|
51675
51488
|
}));
|
|
51676
51489
|
//#endregion
|
|
@@ -51721,7 +51534,7 @@ var require_register = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
51721
51534
|
//#endregion
|
|
51722
51535
|
//#region ../../node_modules/.bun/import-in-the-middle@3.0.1/node_modules/import-in-the-middle/index.js
|
|
51723
51536
|
var require_import_in_the_middle = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
|
|
51724
|
-
const path$
|
|
51537
|
+
const path$14 = require("path");
|
|
51725
51538
|
const moduleDetailsFromPath = require_module_details_from_path();
|
|
51726
51539
|
const { fileURLToPath } = require("url");
|
|
51727
51540
|
const { MessageChannel } = require("worker_threads");
|
|
@@ -51864,7 +51677,7 @@ var require_import_in_the_middle = /* @__PURE__ */ require_chunk.__commonJSMin((
|
|
|
51864
51677
|
if (!baseDir) callHookFn(hookFn, namespace, name, baseDir);
|
|
51865
51678
|
else if (baseDir.endsWith(specifiers.get(loadUrl)) || isTurbopackSpecifier(specifiers.get(loadUrl), baseDir)) callHookFn(hookFn, namespace, name, baseDir);
|
|
51866
51679
|
else if (internals) {
|
|
51867
|
-
const internalPath = name + path$
|
|
51680
|
+
const internalPath = name + path$14.sep + path$14.relative(baseDir, filePath);
|
|
51868
51681
|
callHookFn(hookFn, namespace, internalPath, baseDir);
|
|
51869
51682
|
}
|
|
51870
51683
|
} else if (matchArg === specifier) callHookFn(hookFn, namespace, specifier, baseDir);
|
|
@@ -51938,7 +51751,7 @@ var require_utils$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
51938
51751
|
var require_instrumentation = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
51939
51752
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51940
51753
|
exports.InstrumentationBase = void 0;
|
|
51941
|
-
const path$
|
|
51754
|
+
const path$13 = require("path");
|
|
51942
51755
|
const util_1$4 = require("util");
|
|
51943
51756
|
const semver_1 = require_semver();
|
|
51944
51757
|
const shimmer_1 = require_shimmer();
|
|
@@ -52020,7 +51833,7 @@ var require_instrumentation = /* @__PURE__ */ require_chunk.__commonJSMin(((expo
|
|
|
52020
51833
|
}
|
|
52021
51834
|
_extractPackageVersion(baseDir) {
|
|
52022
51835
|
try {
|
|
52023
|
-
const json = (0, fs_1.readFileSync)(path$
|
|
51836
|
+
const json = (0, fs_1.readFileSync)(path$13.join(baseDir, "package.json"), { encoding: "utf8" });
|
|
52024
51837
|
const version = JSON.parse(json).version;
|
|
52025
51838
|
return typeof version === "string" ? version : void 0;
|
|
52026
51839
|
} catch {
|
|
@@ -52057,7 +51870,7 @@ var require_instrumentation = /* @__PURE__ */ require_chunk.__commonJSMin(((expo
|
|
|
52057
51870
|
return exports$7;
|
|
52058
51871
|
}
|
|
52059
51872
|
const files = module$4.files ?? [];
|
|
52060
|
-
const normalizedName = path$
|
|
51873
|
+
const normalizedName = path$13.normalize(name);
|
|
52061
51874
|
return files.filter((f) => f.name === normalizedName && isSupported(f.supportedVersions, version, module$4.includePrerelease)).reduce((patchedExports, file) => {
|
|
52062
51875
|
file.moduleExports = patchedExports;
|
|
52063
51876
|
if (this._enabled) {
|
|
@@ -52098,8 +51911,8 @@ var require_instrumentation = /* @__PURE__ */ require_chunk.__commonJSMin(((expo
|
|
|
52098
51911
|
this._warnOnPreloadedModules();
|
|
52099
51912
|
for (const module$6 of this._modules) {
|
|
52100
51913
|
const hookFn = (exports$8, name, baseDir) => {
|
|
52101
|
-
if (!baseDir && path$
|
|
52102
|
-
const parsedPath = path$
|
|
51914
|
+
if (!baseDir && path$13.isAbsolute(name)) {
|
|
51915
|
+
const parsedPath = path$13.parse(name);
|
|
52103
51916
|
name = parsedPath.name;
|
|
52104
51917
|
baseDir = parsedPath.dir;
|
|
52105
51918
|
}
|
|
@@ -52108,7 +51921,7 @@ var require_instrumentation = /* @__PURE__ */ require_chunk.__commonJSMin(((expo
|
|
|
52108
51921
|
const onRequire = (exports$9, name, baseDir) => {
|
|
52109
51922
|
return this._onRequire(module$6, exports$9, name, baseDir);
|
|
52110
51923
|
};
|
|
52111
|
-
const hook = path$
|
|
51924
|
+
const hook = path$13.isAbsolute(module$6.name) ? new require_in_the_middle_1.Hook([module$6.name], { internals: true }, onRequire) : this._requireInTheMiddleSingleton.register(module$6.name, onRequire);
|
|
52112
51925
|
this._hooks.push(hook);
|
|
52113
51926
|
const esmHook = new import_in_the_middle_1.Hook([module$6.name], { internals: true }, hookFn);
|
|
52114
51927
|
this._hooks.push(esmHook);
|
|
@@ -66418,7 +66231,7 @@ function normalizeNumberish(value) {
|
|
|
66418
66231
|
}
|
|
66419
66232
|
//#endregion
|
|
66420
66233
|
//#region package.json
|
|
66421
|
-
var version$1 = "0.13.
|
|
66234
|
+
var version$1 = "0.13.17";
|
|
66422
66235
|
//#endregion
|
|
66423
66236
|
//#region src/sentry.ts
|
|
66424
66237
|
const SERVER_APP_NAME = "forge-server";
|
|
@@ -67456,7 +67269,7 @@ function toPersistenceDecodeDefect(operation) {
|
|
|
67456
67269
|
const isPersistenceError = (u) => require_Schema$1.is(PersistenceSqlError)(u) || require_Schema$1.is(PersistenceDecodeError)(u);
|
|
67457
67270
|
//#endregion
|
|
67458
67271
|
//#region src/cmmdConnection/CmmdConnectionStore.ts
|
|
67459
|
-
const cache
|
|
67272
|
+
const cache = /* @__PURE__ */ new Map();
|
|
67460
67273
|
const jwtCache = /* @__PURE__ */ new Map();
|
|
67461
67274
|
const jwtExpiryCache = /* @__PURE__ */ new Map();
|
|
67462
67275
|
const refreshTokenCache = /* @__PURE__ */ new Map();
|
|
@@ -67597,7 +67410,7 @@ const hydrateCommandAccessTokenStore = require_Schema$1.gen(function* () {
|
|
|
67597
67410
|
session_grant AS "sessionGrant"
|
|
67598
67411
|
FROM command_access_tokens
|
|
67599
67412
|
`.pipe(require_Schema$1.mapError(toPersistenceSqlError("CommandAccessTokenStore.hydrate:query")))).pipe(require_Schema$1.mapError(toPersistenceDecodeError("CommandAccessTokenStore.hydrate:decodeRows")));
|
|
67600
|
-
cache
|
|
67413
|
+
cache.clear();
|
|
67601
67414
|
jwtCache.clear();
|
|
67602
67415
|
jwtExpiryCache.clear();
|
|
67603
67416
|
refreshTokenCache.clear();
|
|
@@ -67607,7 +67420,7 @@ const hydrateCommandAccessTokenStore = require_Schema$1.gen(function* () {
|
|
|
67607
67420
|
try: () => {
|
|
67608
67421
|
for (const row of decoded) {
|
|
67609
67422
|
const sessionId = row.sessionId;
|
|
67610
|
-
cache
|
|
67423
|
+
cache.set(sessionId, decodeSensitiveValue(ACCESS_TOKEN_SCOPE, row.accessToken));
|
|
67611
67424
|
const jwtToken = decryptNullable(JWT_TOKEN_SCOPE, row.jwtToken);
|
|
67612
67425
|
if (jwtToken) jwtCache.set(sessionId, jwtToken);
|
|
67613
67426
|
if (row.jwtExpiresAt) jwtExpiryCache.set(sessionId, row.jwtExpiresAt);
|
|
@@ -67627,7 +67440,7 @@ const hydrateCommandAccessTokenStore = require_Schema$1.gen(function* () {
|
|
|
67627
67440
|
* Returns `null` when the session has no paired CMMD token.
|
|
67628
67441
|
*/
|
|
67629
67442
|
function readCommandAccessTokenForSession(sessionId) {
|
|
67630
|
-
return cache
|
|
67443
|
+
return cache.get(sessionId) ?? null;
|
|
67631
67444
|
}
|
|
67632
67445
|
const threadSessions = /* @__PURE__ */ new Map();
|
|
67633
67446
|
/**
|
|
@@ -68004,7 +67817,7 @@ const promoteMostRecentOwnerCommandAuthToSession = (sessionId) => require_Schema
|
|
|
68004
67817
|
cmmd_user_identity = excluded.cmmd_user_identity,
|
|
68005
67818
|
updated_at = excluded.updated_at
|
|
68006
67819
|
`.pipe(require_Schema$1.mapError(toPersistenceSqlError("CommandAccessTokenStore.promoteLatestOwnerAuth:upsert")));
|
|
68007
|
-
cache
|
|
67820
|
+
cache.set(sessionId, accessToken);
|
|
68008
67821
|
if (jwtToken) jwtCache.set(sessionId, jwtToken);
|
|
68009
67822
|
else jwtCache.delete(sessionId);
|
|
68010
67823
|
if (row.jwtExpiresAt) jwtExpiryCache.set(sessionId, row.jwtExpiresAt);
|
|
@@ -68049,7 +67862,7 @@ const setCommandAccessTokenForSession = (sessionId, accessToken) => require_Sche
|
|
|
68049
67862
|
access_token = excluded.access_token,
|
|
68050
67863
|
updated_at = excluded.updated_at
|
|
68051
67864
|
`.pipe(require_Schema$1.mapError(toPersistenceSqlError("CommandAccessTokenStore.set:query")));
|
|
68052
|
-
cache
|
|
67865
|
+
cache.set(sessionId, token);
|
|
68053
67866
|
});
|
|
68054
67867
|
/**
|
|
68055
67868
|
* Remove the PAT for a session from both durable persistence and the in-memory cache.
|
|
@@ -68062,7 +67875,7 @@ const clearCommandAccessTokenForSession = (sessionId) => require_Schema$1.gen(fu
|
|
|
68062
67875
|
forgetCommandAccessTokenCachesForSession(sessionId);
|
|
68063
67876
|
});
|
|
68064
67877
|
function forgetCommandAccessTokenCachesForSession(sessionId) {
|
|
68065
|
-
cache
|
|
67878
|
+
cache.delete(sessionId);
|
|
68066
67879
|
jwtCache.delete(sessionId);
|
|
68067
67880
|
jwtExpiryCache.delete(sessionId);
|
|
68068
67881
|
refreshTokenCache.delete(sessionId);
|
|
@@ -76295,7 +76108,7 @@ var require_detect_libc = /* @__PURE__ */ require_chunk.__commonJSMin(((exports,
|
|
|
76295
76108
|
//#region ../../node_modules/.bun/node-gyp-build-optional-packages@5.2.2/node_modules/node-gyp-build-optional-packages/node-gyp-build.js
|
|
76296
76109
|
var require_node_gyp_build = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
|
|
76297
76110
|
var fs$8 = require("fs");
|
|
76298
|
-
var path$
|
|
76111
|
+
var path$11 = require("path");
|
|
76299
76112
|
var url$2 = require("url");
|
|
76300
76113
|
var os$3 = require("os");
|
|
76301
76114
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
|
|
@@ -76315,30 +76128,30 @@ var require_node_gyp_build = /* @__PURE__ */ require_chunk.__commonJSMin(((expor
|
|
|
76315
76128
|
return runtimeRequire(load.resolve(dir));
|
|
76316
76129
|
}
|
|
76317
76130
|
load.resolve = load.path = function(dir) {
|
|
76318
|
-
dir = path$
|
|
76131
|
+
dir = path$11.resolve(dir || ".");
|
|
76319
76132
|
var packageName = "";
|
|
76320
76133
|
var packageNameError;
|
|
76321
76134
|
try {
|
|
76322
|
-
packageName = runtimeRequire(path$
|
|
76135
|
+
packageName = runtimeRequire(path$11.join(dir, "package.json")).name;
|
|
76323
76136
|
var varName = packageName.toUpperCase().replace(/-/g, "_");
|
|
76324
76137
|
if (process.env[varName + "_PREBUILD"]) dir = process.env[varName + "_PREBUILD"];
|
|
76325
76138
|
} catch (err) {
|
|
76326
76139
|
packageNameError = err;
|
|
76327
76140
|
}
|
|
76328
76141
|
if (!prebuildsOnly) {
|
|
76329
|
-
var release = getFirst(path$
|
|
76142
|
+
var release = getFirst(path$11.join(dir, "build/Release"), matchBuild);
|
|
76330
76143
|
if (release) return release;
|
|
76331
|
-
var debug = getFirst(path$
|
|
76144
|
+
var debug = getFirst(path$11.join(dir, "build/Debug"), matchBuild);
|
|
76332
76145
|
if (debug) return debug;
|
|
76333
76146
|
}
|
|
76334
76147
|
var prebuild = resolve(dir);
|
|
76335
76148
|
if (prebuild) return prebuild;
|
|
76336
|
-
var nearby = resolve(path$
|
|
76149
|
+
var nearby = resolve(path$11.dirname(process.execPath));
|
|
76337
76150
|
if (nearby) return nearby;
|
|
76338
76151
|
var platformPackage = (packageName[0] == "@" ? "" : "@" + packageName + "/") + packageName + "-" + platform + "-" + arch;
|
|
76339
76152
|
var packageResolutionError;
|
|
76340
76153
|
try {
|
|
76341
|
-
return resolveFile(path$
|
|
76154
|
+
return resolveFile(path$11.dirname(require("module").createRequire(url$2.pathToFileURL(path$11.join(dir, "package.json"))).resolve(platformPackage)));
|
|
76342
76155
|
} catch (error) {
|
|
76343
76156
|
packageResolutionError = error;
|
|
76344
76157
|
}
|
|
@@ -76358,13 +76171,13 @@ var require_node_gyp_build = /* @__PURE__ */ require_chunk.__commonJSMin(((expor
|
|
|
76358
76171
|
if (packageResolutionError) errMessage += "Error resolving package: " + packageResolutionError.message + "\n";
|
|
76359
76172
|
throw new Error(errMessage);
|
|
76360
76173
|
function resolve(dir) {
|
|
76361
|
-
var tuple = readdirSync(path$
|
|
76174
|
+
var tuple = readdirSync(path$11.join(dir, "prebuilds")).map(parseTuple).filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
76362
76175
|
if (!tuple) return;
|
|
76363
|
-
return resolveFile(path$
|
|
76176
|
+
return resolveFile(path$11.join(dir, "prebuilds", tuple.name));
|
|
76364
76177
|
}
|
|
76365
76178
|
function resolveFile(prebuilds) {
|
|
76366
76179
|
var winner = readdirSync(prebuilds).map(parseTags).filter(matchTags(runtime, abi)).sort(compareTags(runtime))[0];
|
|
76367
|
-
if (winner) return path$
|
|
76180
|
+
if (winner) return path$11.join(prebuilds, winner.file);
|
|
76368
76181
|
}
|
|
76369
76182
|
};
|
|
76370
76183
|
function readdirSync(dir) {
|
|
@@ -76376,7 +76189,7 @@ var require_node_gyp_build = /* @__PURE__ */ require_chunk.__commonJSMin(((expor
|
|
|
76376
76189
|
}
|
|
76377
76190
|
function getFirst(dir, filter) {
|
|
76378
76191
|
var files = readdirSync(dir).filter(filter);
|
|
76379
|
-
return files[0] && path$
|
|
76192
|
+
return files[0] && path$11.join(dir, files[0]);
|
|
76380
76193
|
}
|
|
76381
76194
|
function matchBuild(name) {
|
|
76382
76195
|
return /\.node$/.test(name);
|
|
@@ -77646,500 +77459,6 @@ const makeSocketProtocol = /* @__PURE__ */ require_Schema$1.gen(function* () {
|
|
|
77646
77459
|
};
|
|
77647
77460
|
});
|
|
77648
77461
|
//#endregion
|
|
77649
|
-
//#region src/codeGraph/aggregate.ts
|
|
77650
|
-
/**
|
|
77651
|
-
* Turning a 26 MB graph into slices small enough to draw.
|
|
77652
|
-
*
|
|
77653
|
-
* Pure functions over an already-parsed graph, deliberately free of Effect, the
|
|
77654
|
-
* filesystem and the RPC layer, so the interesting parts — capping, ranking,
|
|
77655
|
-
* hub suppression — are testable without a runtime or a fixture file on disk.
|
|
77656
|
-
*
|
|
77657
|
-
* The whole module exists because of one number: this repo's graph is 34,102
|
|
77658
|
-
* nodes and 86,347 edges. Nothing here ever returns more than a few hundred of
|
|
77659
|
-
* either. A view that tries to show everything shows nothing.
|
|
77660
|
-
*/
|
|
77661
|
-
function pushInto(map, key, link) {
|
|
77662
|
-
const existing = map.get(key);
|
|
77663
|
-
if (existing === void 0) {
|
|
77664
|
-
map.set(key, [link]);
|
|
77665
|
-
return;
|
|
77666
|
-
}
|
|
77667
|
-
existing.push(link);
|
|
77668
|
-
}
|
|
77669
|
-
function isKnownRelation(relation) {
|
|
77670
|
-
return Object.hasOwn(CODE_GRAPH_RELATION_CLASS, relation);
|
|
77671
|
-
}
|
|
77672
|
-
/**
|
|
77673
|
-
* Index a parsed graph once so every later query is a map lookup.
|
|
77674
|
-
*
|
|
77675
|
-
* Edges naming a node the artifact does not define are dropped rather than
|
|
77676
|
-
* synthesised. Graphify does emit these — a call into a module outside the scan
|
|
77677
|
-
* root — and inventing a placeholder node for one would put a file in the map
|
|
77678
|
-
* that is not in the repository.
|
|
77679
|
-
*/
|
|
77680
|
-
function indexGraph(raw, repoLabel) {
|
|
77681
|
-
const nodes = /* @__PURE__ */ new Map();
|
|
77682
|
-
for (const node of raw.nodes) nodes.set(node.id, node);
|
|
77683
|
-
const outbound = /* @__PURE__ */ new Map();
|
|
77684
|
-
const inbound = /* @__PURE__ */ new Map();
|
|
77685
|
-
const degree = /* @__PURE__ */ new Map();
|
|
77686
|
-
const unknownRelations = /* @__PURE__ */ new Set();
|
|
77687
|
-
let extractedEdgeCount = 0;
|
|
77688
|
-
let inferredEdgeCount = 0;
|
|
77689
|
-
let edgeCount = 0;
|
|
77690
|
-
for (const link of raw.links) {
|
|
77691
|
-
if (!nodes.has(link.source) || !nodes.has(link.target)) continue;
|
|
77692
|
-
const relation = link.relation ?? "";
|
|
77693
|
-
if (relation !== "" && !isKnownRelation(relation)) {
|
|
77694
|
-
unknownRelations.add(relation);
|
|
77695
|
-
continue;
|
|
77696
|
-
}
|
|
77697
|
-
edgeCount += 1;
|
|
77698
|
-
if (link.confidence === "INFERRED") inferredEdgeCount += 1;
|
|
77699
|
-
else extractedEdgeCount += 1;
|
|
77700
|
-
pushInto(outbound, link.source, link);
|
|
77701
|
-
pushInto(inbound, link.target, link);
|
|
77702
|
-
degree.set(link.source, (degree.get(link.source) ?? 0) + 1);
|
|
77703
|
-
degree.set(link.target, (degree.get(link.target) ?? 0) + 1);
|
|
77704
|
-
}
|
|
77705
|
-
return {
|
|
77706
|
-
repoLabel,
|
|
77707
|
-
builtAtCommit: raw.built_at_commit ?? null,
|
|
77708
|
-
nodes,
|
|
77709
|
-
outbound,
|
|
77710
|
-
inbound,
|
|
77711
|
-
degree,
|
|
77712
|
-
edgeCount,
|
|
77713
|
-
extractedEdgeCount,
|
|
77714
|
-
inferredEdgeCount,
|
|
77715
|
-
unknownRelations: [...unknownRelations].toSorted()
|
|
77716
|
-
};
|
|
77717
|
-
}
|
|
77718
|
-
/**
|
|
77719
|
-
* Deterministic sunflower placement.
|
|
77720
|
-
*
|
|
77721
|
-
* A phyllotaxis spiral rather than a force simulation, for three reasons: it
|
|
77722
|
-
* needs no dependency, it is O(n), and — the one that actually matters — it is
|
|
77723
|
-
* *stable*. The same graph opens to the same picture every time, so the spatial
|
|
77724
|
-
* memory a person builds up survives closing the panel. A force layout reshuffles
|
|
77725
|
-
* on every mount and quietly costs them that.
|
|
77726
|
-
*
|
|
77727
|
-
* Index 0 lands nearest the centre, so ordering regions by size puts the
|
|
77728
|
-
* architectural core where the eye starts.
|
|
77729
|
-
*/
|
|
77730
|
-
function spiralPosition(index, total) {
|
|
77731
|
-
const goldenAngle = Math.PI * (3 - Math.sqrt(5));
|
|
77732
|
-
const radius = total <= 1 ? 0 : Math.sqrt(index / (total - 1));
|
|
77733
|
-
const angle = index * goldenAngle;
|
|
77734
|
-
return {
|
|
77735
|
-
x: .5 + radius * Math.cos(angle) * .44,
|
|
77736
|
-
y: .5 + radius * Math.sin(angle) * .44
|
|
77737
|
-
};
|
|
77738
|
-
}
|
|
77739
|
-
/** Group nodes into their communities, and remember which community each is in. */
|
|
77740
|
-
function accumulateRegions(graph) {
|
|
77741
|
-
const accumulators = /* @__PURE__ */ new Map();
|
|
77742
|
-
const regionOfNode = /* @__PURE__ */ new Map();
|
|
77743
|
-
for (const node of graph.nodes.values()) {
|
|
77744
|
-
const community = node.community;
|
|
77745
|
-
if (community === void 0) continue;
|
|
77746
|
-
regionOfNode.set(node.id, community);
|
|
77747
|
-
const existing = accumulators.get(community);
|
|
77748
|
-
if (existing === void 0) {
|
|
77749
|
-
accumulators.set(community, {
|
|
77750
|
-
id: community,
|
|
77751
|
-
label: node.community_name ?? `Region ${String(community)}`,
|
|
77752
|
-
nodeCount: 1
|
|
77753
|
-
});
|
|
77754
|
-
continue;
|
|
77755
|
-
}
|
|
77756
|
-
existing.nodeCount += 1;
|
|
77757
|
-
}
|
|
77758
|
-
return {
|
|
77759
|
-
ordered: [...accumulators.values()].toSorted((a, b) => b.nodeCount - a.nodeCount || a.id - b.id),
|
|
77760
|
-
regionOfNode
|
|
77761
|
-
};
|
|
77762
|
-
}
|
|
77763
|
-
/**
|
|
77764
|
-
* Collapse node-level edges into weighted links between drawn regions.
|
|
77765
|
-
*
|
|
77766
|
-
* Undirected: "these two areas talk" is the question at this altitude, and
|
|
77767
|
-
* drawing both arcs doubles the ink for no added meaning.
|
|
77768
|
-
*/
|
|
77769
|
-
function aggregateRegionLinks(graph, regionOfNode, shownIds) {
|
|
77770
|
-
const linkWeights = /* @__PURE__ */ new Map();
|
|
77771
|
-
for (const links of graph.outbound.values()) for (const link of links) {
|
|
77772
|
-
const from = regionOfNode.get(link.source);
|
|
77773
|
-
const to = regionOfNode.get(link.target);
|
|
77774
|
-
if (from === void 0 || to === void 0 || from === to) continue;
|
|
77775
|
-
if (!shownIds.has(from) || !shownIds.has(to)) continue;
|
|
77776
|
-
const key = `${String(Math.min(from, to))}:${String(Math.max(from, to))}`;
|
|
77777
|
-
linkWeights.set(key, (linkWeights.get(key) ?? 0) + 1);
|
|
77778
|
-
}
|
|
77779
|
-
return [...linkWeights.entries()].map(([key, weight]) => {
|
|
77780
|
-
const [source, target] = key.split(":");
|
|
77781
|
-
return {
|
|
77782
|
-
source: Number(source),
|
|
77783
|
-
target: Number(target),
|
|
77784
|
-
weight
|
|
77785
|
-
};
|
|
77786
|
-
});
|
|
77787
|
-
}
|
|
77788
|
-
/**
|
|
77789
|
-
* The default view: the repository as named regions.
|
|
77790
|
-
*
|
|
77791
|
-
* Regions come from graphify's own community detection, and their names come
|
|
77792
|
-
* from the community's hub node — so a region is labelled `AIGateway.ts` or
|
|
77793
|
-
* `IStorage`, something a person recognises, rather than "Community 469".
|
|
77794
|
-
*/
|
|
77795
|
-
function buildSummary(graph) {
|
|
77796
|
-
const { ordered, regionOfNode } = accumulateRegions(graph);
|
|
77797
|
-
const shown = ordered.slice(0, 120);
|
|
77798
|
-
const shownIds = new Set(shown.map((region) => region.id));
|
|
77799
|
-
const regions = shown.map((region, index) => {
|
|
77800
|
-
const position = spiralPosition(index, shown.length);
|
|
77801
|
-
return {
|
|
77802
|
-
id: region.id,
|
|
77803
|
-
label: region.label,
|
|
77804
|
-
nodeCount: region.nodeCount,
|
|
77805
|
-
x: position.x,
|
|
77806
|
-
y: position.y
|
|
77807
|
-
};
|
|
77808
|
-
});
|
|
77809
|
-
return {
|
|
77810
|
-
repoLabel: graph.repoLabel,
|
|
77811
|
-
builtAtCommit: graph.builtAtCommit,
|
|
77812
|
-
nodeCount: graph.nodes.size,
|
|
77813
|
-
edgeCount: graph.edgeCount,
|
|
77814
|
-
extractedEdgeCount: graph.extractedEdgeCount,
|
|
77815
|
-
inferredEdgeCount: graph.inferredEdgeCount,
|
|
77816
|
-
regionCount: ordered.length,
|
|
77817
|
-
regions,
|
|
77818
|
-
links: aggregateRegionLinks(graph, regionOfNode, shownIds),
|
|
77819
|
-
truncatedRegions: Math.max(0, ordered.length - shown.length)
|
|
77820
|
-
};
|
|
77821
|
-
}
|
|
77822
|
-
function summariseNode(graph, node) {
|
|
77823
|
-
return {
|
|
77824
|
-
id: node.id,
|
|
77825
|
-
label: node.label ?? node.id,
|
|
77826
|
-
kind: node._callable === true ? "symbol" : "file",
|
|
77827
|
-
sourceFile: node.source_file ?? null,
|
|
77828
|
-
sourceLocation: node.source_location ?? null,
|
|
77829
|
-
regionId: node.community ?? null,
|
|
77830
|
-
regionLabel: node.community_name ?? null,
|
|
77831
|
-
degree: graph.degree.get(node.id) ?? 0
|
|
77832
|
-
};
|
|
77833
|
-
}
|
|
77834
|
-
function toEdgeView(link) {
|
|
77835
|
-
const relation = link.relation ?? "";
|
|
77836
|
-
if (!isKnownRelation(relation)) return null;
|
|
77837
|
-
const confidence = link.confidence === "INFERRED" ? "INFERRED" : "EXTRACTED";
|
|
77838
|
-
return {
|
|
77839
|
-
source: link.source,
|
|
77840
|
-
target: link.target,
|
|
77841
|
-
relation,
|
|
77842
|
-
edgeClass: CODE_GRAPH_RELATION_CLASS[relation],
|
|
77843
|
-
confidence,
|
|
77844
|
-
confidenceScore: link.confidence_score ?? 1
|
|
77845
|
-
};
|
|
77846
|
-
}
|
|
77847
|
-
/**
|
|
77848
|
-
* Pull one node's neighbours into the result; return how many it had to drop.
|
|
77849
|
-
*
|
|
77850
|
-
* Split out of `buildNeighborhood` because the two read differently: the caller
|
|
77851
|
-
* owns *how far to walk*, this owns *what one step collects*. Together they sat
|
|
77852
|
-
* well past the repo's cognitive-complexity gate.
|
|
77853
|
-
*/
|
|
77854
|
-
/** Links touching a node, most-connected neighbour first. */
|
|
77855
|
-
function rankNeighbourLinks(graph, current) {
|
|
77856
|
-
return [...graph.outbound.get(current) ?? [], ...graph.inbound.get(current) ?? []].toSorted((a, b) => {
|
|
77857
|
-
const aOther = a.source === current ? a.target : a.source;
|
|
77858
|
-
const bOther = b.source === current ? b.target : b.source;
|
|
77859
|
-
return (graph.degree.get(bOther) ?? 0) - (graph.degree.get(aOther) ?? 0);
|
|
77860
|
-
});
|
|
77861
|
-
}
|
|
77862
|
-
/** Take a neighbour into the result. False means the budget is spent. */
|
|
77863
|
-
function admitNeighbour(state, id, node) {
|
|
77864
|
-
if (state.included.has(id)) return true;
|
|
77865
|
-
if (state.included.size >= 150) return false;
|
|
77866
|
-
state.included.set(id, node);
|
|
77867
|
-
state.next.push(id);
|
|
77868
|
-
return true;
|
|
77869
|
-
}
|
|
77870
|
-
/** Record an edge once, dropping any relation this build cannot classify. */
|
|
77871
|
-
function recordEdge(state, link) {
|
|
77872
|
-
const edgeKey = `${link.source}>${link.target}:${link.relation ?? ""}`;
|
|
77873
|
-
if (state.seenEdges.has(edgeKey)) return;
|
|
77874
|
-
const view = toEdgeView(link);
|
|
77875
|
-
if (view === null) return;
|
|
77876
|
-
state.seenEdges.add(edgeKey);
|
|
77877
|
-
state.edges.push(view);
|
|
77878
|
-
}
|
|
77879
|
-
/**
|
|
77880
|
-
* Pull one node's neighbours into the result; return how many it had to drop.
|
|
77881
|
-
*
|
|
77882
|
-
* Split out of `buildNeighborhood` because the two read differently: the caller
|
|
77883
|
-
* owns *how far to walk*, this owns *what one step collects*.
|
|
77884
|
-
*/
|
|
77885
|
-
function expandNode(graph, current, state) {
|
|
77886
|
-
let omitted = 0;
|
|
77887
|
-
for (const link of rankNeighbourLinks(graph, current)) {
|
|
77888
|
-
const other = link.source === current ? link.target : link.source;
|
|
77889
|
-
const otherNode = graph.nodes.get(other);
|
|
77890
|
-
if (otherNode === void 0) continue;
|
|
77891
|
-
if (!admitNeighbour(state, other, otherNode)) {
|
|
77892
|
-
omitted += 1;
|
|
77893
|
-
continue;
|
|
77894
|
-
}
|
|
77895
|
-
recordEdge(state, link);
|
|
77896
|
-
}
|
|
77897
|
-
return omitted;
|
|
77898
|
-
}
|
|
77899
|
-
/**
|
|
77900
|
-
* One node and what surrounds it.
|
|
77901
|
-
*
|
|
77902
|
-
* Two caps, and they do different jobs. `CODE_GRAPH_MAX_NEIGHBORS` bounds the
|
|
77903
|
-
* answer so the canvas stays drawable. `CODE_GRAPH_MAX_FANOUT` bounds the
|
|
77904
|
-
* *traversal*: a hub is included as a neighbor but never expanded through, so
|
|
77905
|
-
* one `logger.ts` in the second ring cannot drag the entire repository in
|
|
77906
|
-
* behind it. Without the second cap the first one is reached instantly and the
|
|
77907
|
-
* result is 150 arbitrary nodes rather than the 150 nearest ones.
|
|
77908
|
-
*/
|
|
77909
|
-
function buildNeighborhood(graph, nodeId, requestedDepth) {
|
|
77910
|
-
const root = graph.nodes.get(nodeId);
|
|
77911
|
-
if (root === void 0) return null;
|
|
77912
|
-
const depth = Math.min(Math.max(1, requestedDepth), 2);
|
|
77913
|
-
const included = new Map([[root.id, root]]);
|
|
77914
|
-
const seenEdges = /* @__PURE__ */ new Set();
|
|
77915
|
-
const edges = [];
|
|
77916
|
-
let omittedCount = 0;
|
|
77917
|
-
let frontier = [root.id];
|
|
77918
|
-
for (let level = 0; level < depth; level += 1) {
|
|
77919
|
-
const next = [];
|
|
77920
|
-
for (const current of frontier) {
|
|
77921
|
-
const fanout = graph.degree.get(current) ?? 0;
|
|
77922
|
-
if (current !== root.id && fanout > 200) continue;
|
|
77923
|
-
omittedCount += expandNode(graph, current, {
|
|
77924
|
-
included,
|
|
77925
|
-
seenEdges,
|
|
77926
|
-
edges,
|
|
77927
|
-
next
|
|
77928
|
-
});
|
|
77929
|
-
}
|
|
77930
|
-
frontier = next;
|
|
77931
|
-
if (frontier.length === 0) break;
|
|
77932
|
-
}
|
|
77933
|
-
const nodes = [...included.values()].filter((node) => node.id !== root.id).map((node) => summariseNode(graph, node)).toSorted((a, b) => b.degree - a.degree || a.label.localeCompare(b.label));
|
|
77934
|
-
return {
|
|
77935
|
-
root: summariseNode(graph, root),
|
|
77936
|
-
nodes,
|
|
77937
|
-
edges: edges.filter((edge) => included.has(edge.source) && included.has(edge.target)),
|
|
77938
|
-
depth,
|
|
77939
|
-
truncated: omittedCount > 0,
|
|
77940
|
-
omittedCount
|
|
77941
|
-
};
|
|
77942
|
-
}
|
|
77943
|
-
/**
|
|
77944
|
-
* Rank one node against a query: lower is better, negative means no match.
|
|
77945
|
-
*
|
|
77946
|
-
* A file-path hit ranks last because "the query appears somewhere in this path"
|
|
77947
|
-
* is much weaker evidence than "this thing is called that".
|
|
77948
|
-
*/
|
|
77949
|
-
function matchScore(node, query) {
|
|
77950
|
-
const label = (node.label ?? node.id).toLowerCase();
|
|
77951
|
-
if (label === query) return 0;
|
|
77952
|
-
if (label.startsWith(query)) return 1;
|
|
77953
|
-
if (label.includes(query)) return 2;
|
|
77954
|
-
return (node.source_file ?? "").toLowerCase().includes(query) ? 3 : -1;
|
|
77955
|
-
}
|
|
77956
|
-
/**
|
|
77957
|
-
* Find a node by name or path.
|
|
77958
|
-
*
|
|
77959
|
-
* Entry to this surface is search, not the canvas — you usually arrive already
|
|
77960
|
-
* knowing what you are looking for, and clicking around 34,000 nodes to find it
|
|
77961
|
-
* is not a workflow. Ranking is exact, then prefix, then substring, with degree
|
|
77962
|
-
* breaking ties so the `logger.ts` everything imports outranks a test fixture
|
|
77963
|
-
* that merely shares the word.
|
|
77964
|
-
*/
|
|
77965
|
-
function searchNodes(graph, rawQuery, limit = 40) {
|
|
77966
|
-
const query = rawQuery.trim().toLowerCase();
|
|
77967
|
-
if (query === "") return {
|
|
77968
|
-
nodes: [],
|
|
77969
|
-
truncated: false
|
|
77970
|
-
};
|
|
77971
|
-
const scored = [];
|
|
77972
|
-
for (const node of graph.nodes.values()) {
|
|
77973
|
-
const score = matchScore(node, query);
|
|
77974
|
-
if (score < 0) continue;
|
|
77975
|
-
scored.push({
|
|
77976
|
-
node,
|
|
77977
|
-
score
|
|
77978
|
-
});
|
|
77979
|
-
}
|
|
77980
|
-
const ranked = scored.toSorted((a, b) => a.score - b.score || (graph.degree.get(b.node.id) ?? 0) - (graph.degree.get(a.node.id) ?? 0) || (a.node.label ?? a.node.id).localeCompare(b.node.label ?? b.node.id));
|
|
77981
|
-
const capped = ranked.slice(0, limit);
|
|
77982
|
-
return {
|
|
77983
|
-
nodes: capped.map((entry) => summariseNode(graph, entry.node)),
|
|
77984
|
-
truncated: ranked.length > capped.length
|
|
77985
|
-
};
|
|
77986
|
-
}
|
|
77987
|
-
//#endregion
|
|
77988
|
-
//#region src/codeGraph/graphArtifact.ts
|
|
77989
|
-
/**
|
|
77990
|
-
* Reading `graphify-out/graph.json` off disk, once.
|
|
77991
|
-
*
|
|
77992
|
-
* The artifact is 26 MB here and 40 MB for CMMD's server tree, and parsing it
|
|
77993
|
-
* costs roughly a second. Every panel open would pay that again without a cache,
|
|
77994
|
-
* so one indexed graph is held per project and reused until the file changes.
|
|
77995
|
-
*
|
|
77996
|
-
* Kept free of Effect on purpose: the failure modes worth distinguishing are all
|
|
77997
|
-
* filesystem-shaped, and a plain promise keeps this unit-testable against real
|
|
77998
|
-
* fixtures without constructing a runtime. `ws.ts` wraps it at the boundary.
|
|
77999
|
-
*/
|
|
78000
|
-
const cache = /* @__PURE__ */ new Map();
|
|
78001
|
-
/** Git LFS writes a pointer file that is valid text and useless as a graph. */
|
|
78002
|
-
const LFS_POINTER_PREFIX = "version https://git-lfs.github.com/spec/v1";
|
|
78003
|
-
function codeGraphArtifactPath(cwd) {
|
|
78004
|
-
return node_path.default.join(cwd, CODE_GRAPH_ARTIFACT_PATH);
|
|
78005
|
-
}
|
|
78006
|
-
function isRawGraph(value) {
|
|
78007
|
-
if (typeof value !== "object" || value === null) return false;
|
|
78008
|
-
const candidate = value;
|
|
78009
|
-
return Array.isArray(candidate.nodes) && Array.isArray(candidate.links);
|
|
78010
|
-
}
|
|
78011
|
-
/**
|
|
78012
|
-
* Load and index the graph for one project checkout.
|
|
78013
|
-
*
|
|
78014
|
-
* The LFS-pointer case is called out separately rather than folded into
|
|
78015
|
-
* "malformed" because it is the single most likely failure on a fresh clone —
|
|
78016
|
-
* the file is present, tracked, and 133 bytes of metadata. Telling someone their
|
|
78017
|
-
* graph is corrupt when they simply have not run `git lfs pull` sends them to
|
|
78018
|
-
* rebuild something that is fine.
|
|
78019
|
-
*/
|
|
78020
|
-
async function loadIndexedGraph(cwd) {
|
|
78021
|
-
const artifactPath = codeGraphArtifactPath(cwd);
|
|
78022
|
-
let stats;
|
|
78023
|
-
try {
|
|
78024
|
-
stats = await (0, node_fs_promises.stat)(artifactPath);
|
|
78025
|
-
} catch {
|
|
78026
|
-
return {
|
|
78027
|
-
ok: false,
|
|
78028
|
-
failure: {
|
|
78029
|
-
kind: "missing",
|
|
78030
|
-
artifactPath
|
|
78031
|
-
}
|
|
78032
|
-
};
|
|
78033
|
-
}
|
|
78034
|
-
if (!stats.isFile()) return {
|
|
78035
|
-
ok: false,
|
|
78036
|
-
failure: {
|
|
78037
|
-
kind: "missing",
|
|
78038
|
-
artifactPath
|
|
78039
|
-
}
|
|
78040
|
-
};
|
|
78041
|
-
const cached = cache.get(artifactPath);
|
|
78042
|
-
if (cached !== void 0 && cached.mtimeMs === stats.mtimeMs && cached.size === stats.size) return {
|
|
78043
|
-
ok: true,
|
|
78044
|
-
graph: cached.graph
|
|
78045
|
-
};
|
|
78046
|
-
let contents;
|
|
78047
|
-
try {
|
|
78048
|
-
contents = await (0, node_fs_promises.readFile)(artifactPath, "utf8");
|
|
78049
|
-
} catch (error) {
|
|
78050
|
-
return {
|
|
78051
|
-
ok: false,
|
|
78052
|
-
failure: {
|
|
78053
|
-
kind: "unreadable",
|
|
78054
|
-
artifactPath,
|
|
78055
|
-
detail: error instanceof Error ? error.message : String(error)
|
|
78056
|
-
}
|
|
78057
|
-
};
|
|
78058
|
-
}
|
|
78059
|
-
if (contents.startsWith(LFS_POINTER_PREFIX)) return {
|
|
78060
|
-
ok: false,
|
|
78061
|
-
failure: {
|
|
78062
|
-
kind: "lfs-pointer",
|
|
78063
|
-
artifactPath
|
|
78064
|
-
}
|
|
78065
|
-
};
|
|
78066
|
-
let parsed;
|
|
78067
|
-
try {
|
|
78068
|
-
parsed = JSON.parse(contents);
|
|
78069
|
-
} catch (error) {
|
|
78070
|
-
return {
|
|
78071
|
-
ok: false,
|
|
78072
|
-
failure: {
|
|
78073
|
-
kind: "malformed",
|
|
78074
|
-
artifactPath,
|
|
78075
|
-
detail: error instanceof Error ? error.message : String(error)
|
|
78076
|
-
}
|
|
78077
|
-
};
|
|
78078
|
-
}
|
|
78079
|
-
if (!isRawGraph(parsed)) return {
|
|
78080
|
-
ok: false,
|
|
78081
|
-
failure: {
|
|
78082
|
-
kind: "malformed",
|
|
78083
|
-
artifactPath,
|
|
78084
|
-
detail: "Expected an object with `nodes` and `links` arrays."
|
|
78085
|
-
}
|
|
78086
|
-
};
|
|
78087
|
-
const graph = indexGraph(parsed, node_path.default.basename(cwd));
|
|
78088
|
-
cache.set(artifactPath, {
|
|
78089
|
-
mtimeMs: stats.mtimeMs,
|
|
78090
|
-
size: stats.size,
|
|
78091
|
-
graph
|
|
78092
|
-
});
|
|
78093
|
-
return {
|
|
78094
|
-
ok: true,
|
|
78095
|
-
graph
|
|
78096
|
-
};
|
|
78097
|
-
}
|
|
78098
|
-
//#endregion
|
|
78099
|
-
//#region src/codeGraph/service.ts
|
|
78100
|
-
/**
|
|
78101
|
-
* The code-graph RPC surface, as Effects.
|
|
78102
|
-
*
|
|
78103
|
-
* A thin seam between `ws.ts` and the pure aggregator: load the artifact, turn
|
|
78104
|
-
* a filesystem failure into the tagged error the client can act on, and slice.
|
|
78105
|
-
*
|
|
78106
|
-
* The failure mapping is the substance here. Each reason produces different
|
|
78107
|
-
* advice — pull LFS, run the extractor, report a corrupt file — so collapsing
|
|
78108
|
-
* them into one "graph unavailable" would send people to fix the wrong thing.
|
|
78109
|
-
*/
|
|
78110
|
-
function toUnavailable(failure) {
|
|
78111
|
-
switch (failure.kind) {
|
|
78112
|
-
case "missing": return new CodeGraphUnavailableError({
|
|
78113
|
-
reason: "missing",
|
|
78114
|
-
message: `No code graph in this checkout. Run \`graphify update .\` to build ${failure.artifactPath}.`
|
|
78115
|
-
});
|
|
78116
|
-
case "lfs-pointer": return new CodeGraphUnavailableError({
|
|
78117
|
-
reason: "lfs-pointer",
|
|
78118
|
-
message: `The graph is a Git LFS pointer, not the graph itself. Run \`git lfs pull\` to fetch it.`
|
|
78119
|
-
});
|
|
78120
|
-
case "malformed": return new CodeGraphUnavailableError({
|
|
78121
|
-
reason: "malformed",
|
|
78122
|
-
message: `The graph file could not be parsed: ${failure.detail}`
|
|
78123
|
-
});
|
|
78124
|
-
case "unreadable": return new CodeGraphUnavailableError({
|
|
78125
|
-
reason: "unreadable",
|
|
78126
|
-
message: `The graph file could not be read: ${failure.detail}`
|
|
78127
|
-
});
|
|
78128
|
-
}
|
|
78129
|
-
}
|
|
78130
|
-
function withGraph(cwd, use) {
|
|
78131
|
-
return require_Schema$1.flatMap(require_Schema$1.promise(() => loadIndexedGraph(cwd)), (result) => result.ok ? require_Schema$1.succeed(use(result.graph)) : require_Schema$1.fail(toUnavailable(result.failure)));
|
|
78132
|
-
}
|
|
78133
|
-
function readCodeGraphSummary(input) {
|
|
78134
|
-
return withGraph(input.cwd, buildSummary);
|
|
78135
|
-
}
|
|
78136
|
-
function readCodeGraphNeighborhood(input) {
|
|
78137
|
-
return require_Schema$1.flatMap(withGraph(input.cwd, (graph) => buildNeighborhood(graph, input.nodeId, input.depth ?? 1)), (neighborhood) => neighborhood === null ? require_Schema$1.fail(new CodeGraphNodeNotFoundError({ nodeId: input.nodeId })) : require_Schema$1.succeed(neighborhood));
|
|
78138
|
-
}
|
|
78139
|
-
function readCodeGraphSearch(input) {
|
|
78140
|
-
return withGraph(input.cwd, (graph) => searchNodes(graph, input.query, input.limit ?? 40));
|
|
78141
|
-
}
|
|
78142
|
-
//#endregion
|
|
78143
77462
|
//#region src/checkpointing/Services/CheckpointDiffQuery.ts
|
|
78144
77463
|
/**
|
|
78145
77464
|
* CheckpointDiffQuery - Service tag for checkpoint diff queries.
|
|
@@ -97076,6 +96395,7 @@ const registerCloudRuntimeForReplicaHydration = require_Schema$1.gen(function* (
|
|
|
97076
96395
|
credentialEpoch,
|
|
97077
96396
|
activeTurnCount: 0,
|
|
97078
96397
|
activeSessionCount: 0,
|
|
96398
|
+
acceptingTurns: false,
|
|
97079
96399
|
...forgeGitCommit !== void 0 ? { forgeGitCommit } : {},
|
|
97080
96400
|
forgeServerVersion: installedForgeServerVersion
|
|
97081
96401
|
}),
|
|
@@ -97112,6 +96432,128 @@ const hydrateCloudRuntimeReplica = require_Schema$1.gen(function* () {
|
|
|
97112
96432
|
return yield* hydrateRuntimeReplica({ expectedRuntimeId: grant.runtimeId }, dependencies);
|
|
97113
96433
|
});
|
|
97114
96434
|
//#endregion
|
|
96435
|
+
//#region src/runtimeDrain/RuntimeDrainState.ts
|
|
96436
|
+
/**
|
|
96437
|
+
* The positive facts this process must observe before it can claim a turn.
|
|
96438
|
+
*
|
|
96439
|
+
* Every entry is required, so adding one here is the whole change: the
|
|
96440
|
+
* derivation below reads this list rather than naming fields, and the record
|
|
96441
|
+
* it indexes cannot be built with a member missing.
|
|
96442
|
+
*/
|
|
96443
|
+
const RUNTIME_EXECUTION_PRECONDITIONS = ["orchestrationEngine", "providerLayer"];
|
|
96444
|
+
/**
|
|
96445
|
+
* The single definition of the accepting-turns fact.
|
|
96446
|
+
*
|
|
96447
|
+
* Exported so test stubs of this service derive it exactly as the live state
|
|
96448
|
+
* does. A stub that recomputed it by hand could disagree with production and
|
|
96449
|
+
* still pass.
|
|
96450
|
+
*/
|
|
96451
|
+
function deriveAcceptingTurns(input) {
|
|
96452
|
+
return RUNTIME_EXECUTION_PRECONDITIONS.every((precondition) => input.preconditions[precondition]) && !input.draining && !input.shutdownRequested;
|
|
96453
|
+
}
|
|
96454
|
+
const initialState = {
|
|
96455
|
+
activeTurns: /* @__PURE__ */ new Set(),
|
|
96456
|
+
activeTurnCount: 0,
|
|
96457
|
+
activeSessionCount: 0,
|
|
96458
|
+
draining: false,
|
|
96459
|
+
drainReason: null,
|
|
96460
|
+
drainTargetImageRef: null,
|
|
96461
|
+
drainTargetImageVersion: null,
|
|
96462
|
+
drainForceRequired: false,
|
|
96463
|
+
preconditions: {
|
|
96464
|
+
orchestrationEngine: false,
|
|
96465
|
+
providerLayer: false
|
|
96466
|
+
},
|
|
96467
|
+
shutdownRequested: false
|
|
96468
|
+
};
|
|
96469
|
+
function snapshotFromState(state) {
|
|
96470
|
+
return {
|
|
96471
|
+
activeTurnCount: state.activeTurnCount,
|
|
96472
|
+
activeSessionCount: state.activeSessionCount,
|
|
96473
|
+
draining: state.draining,
|
|
96474
|
+
drainReason: state.drainReason,
|
|
96475
|
+
drainTargetImageRef: state.drainTargetImageRef,
|
|
96476
|
+
drainTargetImageVersion: state.drainTargetImageVersion,
|
|
96477
|
+
drainForceRequired: state.drainForceRequired,
|
|
96478
|
+
acceptingTurns: deriveAcceptingTurns(state)
|
|
96479
|
+
};
|
|
96480
|
+
}
|
|
96481
|
+
function turnKey(input) {
|
|
96482
|
+
return `${input.threadId}:${input.turnId ?? "unknown"}`;
|
|
96483
|
+
}
|
|
96484
|
+
function normalizeCount(count) {
|
|
96485
|
+
return Number.isFinite(count) ? Math.max(0, Math.floor(count)) : 0;
|
|
96486
|
+
}
|
|
96487
|
+
const makeRuntimeDrainState = require_Schema$1.gen(function* () {
|
|
96488
|
+
const stateRef = yield* require_HttpServer.make$3(initialState);
|
|
96489
|
+
const update = (f) => require_HttpServer.updateAndGet(stateRef, f).pipe(require_Schema$1.map(snapshotFromState));
|
|
96490
|
+
return {
|
|
96491
|
+
beginTurn: (input) => update((state) => {
|
|
96492
|
+
const activeTurns = new Set(state.activeTurns);
|
|
96493
|
+
activeTurns.add(turnKey(input));
|
|
96494
|
+
return {
|
|
96495
|
+
...state,
|
|
96496
|
+
activeTurns,
|
|
96497
|
+
activeTurnCount: activeTurns.size
|
|
96498
|
+
};
|
|
96499
|
+
}),
|
|
96500
|
+
completeTurn: (input) => update((state) => {
|
|
96501
|
+
const activeTurns = new Set(state.activeTurns);
|
|
96502
|
+
activeTurns.delete(turnKey(input));
|
|
96503
|
+
return {
|
|
96504
|
+
...state,
|
|
96505
|
+
activeTurns,
|
|
96506
|
+
activeTurnCount: activeTurns.size
|
|
96507
|
+
};
|
|
96508
|
+
}),
|
|
96509
|
+
clearActiveTurns: update((state) => ({
|
|
96510
|
+
...state,
|
|
96511
|
+
activeTurns: /* @__PURE__ */ new Set(),
|
|
96512
|
+
activeTurnCount: 0
|
|
96513
|
+
})),
|
|
96514
|
+
setActiveSessionCount: (count) => update((state) => ({
|
|
96515
|
+
...state,
|
|
96516
|
+
activeSessionCount: normalizeCount(count)
|
|
96517
|
+
})),
|
|
96518
|
+
reconcileProviderSessions: (sessions) => update((state) => {
|
|
96519
|
+
const activeSessions = sessions.filter((session) => session.status !== "closed");
|
|
96520
|
+
const activeTurns = new Set(activeSessions.flatMap((session) => session.activeTurnId === void 0 ? [] : [turnKey({
|
|
96521
|
+
threadId: session.threadId,
|
|
96522
|
+
turnId: session.activeTurnId
|
|
96523
|
+
})]));
|
|
96524
|
+
return {
|
|
96525
|
+
...state,
|
|
96526
|
+
activeTurns,
|
|
96527
|
+
activeTurnCount: activeTurns.size,
|
|
96528
|
+
activeSessionCount: activeSessions.length
|
|
96529
|
+
};
|
|
96530
|
+
}),
|
|
96531
|
+
applyControlPlaneState: (input) => update((state) => ({
|
|
96532
|
+
...state,
|
|
96533
|
+
draining: input.draining ?? state.draining,
|
|
96534
|
+
drainReason: input.drainReason ?? state.drainReason,
|
|
96535
|
+
drainTargetImageRef: input.drainTargetImageRef ?? state.drainTargetImageRef,
|
|
96536
|
+
drainTargetImageVersion: input.drainTargetImageVersion ?? state.drainTargetImageVersion,
|
|
96537
|
+
drainForceRequired: input.drainForceRequired ?? state.drainForceRequired
|
|
96538
|
+
})),
|
|
96539
|
+
markExecutionPrecondition: (precondition) => update((state) => ({
|
|
96540
|
+
...state,
|
|
96541
|
+
preconditions: {
|
|
96542
|
+
...state.preconditions,
|
|
96543
|
+
[precondition]: true
|
|
96544
|
+
}
|
|
96545
|
+
})),
|
|
96546
|
+
requestShutdown: update((state) => ({
|
|
96547
|
+
...state,
|
|
96548
|
+
shutdownRequested: true
|
|
96549
|
+
})),
|
|
96550
|
+
snapshot: require_HttpServer.get$1(stateRef).pipe(require_Schema$1.map(snapshotFromState)),
|
|
96551
|
+
isDraining: require_HttpServer.get$1(stateRef).pipe(require_Schema$1.map((state) => state.draining))
|
|
96552
|
+
};
|
|
96553
|
+
});
|
|
96554
|
+
var RuntimeDrainState = class extends require_Schema$1.Service()("forge/runtimeDrain/RuntimeDrainState") {};
|
|
96555
|
+
const RuntimeDrainStateLive = require_Schema$1.effect(RuntimeDrainState, makeRuntimeDrainState);
|
|
96556
|
+
//#endregion
|
|
97115
96557
|
//#region src/persistence/Services/LocalAutomations.ts
|
|
97116
96558
|
const LocalAutomationStatus = require_Schema$1.Literals([
|
|
97117
96559
|
"active",
|
|
@@ -100748,6 +100190,30 @@ const makeCommandGate = require_Schema$1.gen(function* () {
|
|
|
100748
100190
|
})
|
|
100749
100191
|
};
|
|
100750
100192
|
});
|
|
100193
|
+
/**
|
|
100194
|
+
* Settle the command gate for a finished startup, and report whether commands
|
|
100195
|
+
* are now accepted.
|
|
100196
|
+
*
|
|
100197
|
+
* The success branch is the moment the orchestration engine can take work, so
|
|
100198
|
+
* it is where the engine half of the accepting-turns fact is marked. A failed
|
|
100199
|
+
* startup accepts nothing and must leave the fact untouched: absent must not
|
|
100200
|
+
* read as healthy.
|
|
100201
|
+
*/
|
|
100202
|
+
const settleCommandReadiness = (input) => require_Schema$1.gen(function* () {
|
|
100203
|
+
if (require_Schema$1.isFailure(input.startupExit)) {
|
|
100204
|
+
const error = new ServerRuntimeStartupError({
|
|
100205
|
+
message: startupFailureMessage(input.startupExit.cause),
|
|
100206
|
+
cause: input.startupExit.cause
|
|
100207
|
+
});
|
|
100208
|
+
yield* require_Schema$1.logError("server runtime startup failed", { cause: describeStartupFailure(input.startupExit.cause) });
|
|
100209
|
+
yield* input.commandGate.failCommandReady(error);
|
|
100210
|
+
return false;
|
|
100211
|
+
}
|
|
100212
|
+
yield* require_Schema$1.logDebug("Accepting commands");
|
|
100213
|
+
yield* input.commandGate.signalCommandReady;
|
|
100214
|
+
yield* input.drainState.markExecutionPrecondition("orchestrationEngine");
|
|
100215
|
+
return true;
|
|
100216
|
+
});
|
|
100751
100217
|
const launchStartupHeartbeat = require_Schema$1.gen(function* () {
|
|
100752
100218
|
const analytics = yield* AnalyticsService;
|
|
100753
100219
|
const { threadCount, projectCount } = yield* (yield* ProjectionSnapshotQuery).getCounts().pipe(require_Schema$1.catch_((cause) => require_Schema$1.logWarning("failed to gather startup projection counts for telemetry", { cause }).pipe(require_Schema$1.as({
|
|
@@ -100929,6 +100395,7 @@ const makeServerRuntimeStartup = require_Schema$1.gen(function* () {
|
|
|
100929
100395
|
const serverSettings = yield* ServerSettingsService;
|
|
100930
100396
|
const serverEnvironment = yield* ServerEnvironment;
|
|
100931
100397
|
const usage = yield* UsageService;
|
|
100398
|
+
const drainState = yield* RuntimeDrainState;
|
|
100932
100399
|
const commandGate = yield* makeCommandGate;
|
|
100933
100400
|
const httpListening = yield* require_Schema$1.make$4();
|
|
100934
100401
|
const reactorScope = yield* require_Schema$1.make$3("sequential");
|
|
@@ -101011,18 +100478,11 @@ const makeServerRuntimeStartup = require_Schema$1.gen(function* () {
|
|
|
101011
100478
|
root: true
|
|
101012
100479
|
}));
|
|
101013
100480
|
yield* require_Schema$1.forkScoped(require_Schema$1.gen(function* () {
|
|
101014
|
-
|
|
101015
|
-
|
|
101016
|
-
|
|
101017
|
-
|
|
101018
|
-
|
|
101019
|
-
});
|
|
101020
|
-
yield* require_Schema$1.logError("server runtime startup failed", { cause: describeStartupFailure(startupExit.cause) });
|
|
101021
|
-
yield* commandGate.failCommandReady(error);
|
|
101022
|
-
return;
|
|
101023
|
-
}
|
|
101024
|
-
yield* require_Schema$1.logDebug("Accepting commands");
|
|
101025
|
-
yield* commandGate.signalCommandReady;
|
|
100481
|
+
if (!(yield* settleCommandReadiness({
|
|
100482
|
+
startupExit: yield* require_Schema$1.exit(startup),
|
|
100483
|
+
commandGate,
|
|
100484
|
+
drainState
|
|
100485
|
+
}))) return;
|
|
101026
100486
|
yield* require_Schema$1.logDebug("startup phase: starting the usage scan warm-up");
|
|
101027
100487
|
yield* require_Schema$1.forkScoped(runUsageScanWarmup({ readSummary: usage.readSummary }));
|
|
101028
100488
|
yield* require_Schema$1.logDebug("startup phase: waiting for http listener");
|
|
@@ -107578,9 +107038,6 @@ const makeWsRpcLayer = (currentSessionId, currentUserId) => WsRpcGroup.toLayer(r
|
|
|
107578
107038
|
}))), { "rpc.aggregate": "workspace" }),
|
|
107579
107039
|
[WS_METHODS.serverDiscoverSourceControl]: () => observeRpcEffect(WS_METHODS.serverDiscoverSourceControl, discoverSourceControl, { "rpc.aggregate": "server" }),
|
|
107580
107040
|
[WS_METHODS.serverReportClientActivity]: () => observeRpcEffect(WS_METHODS.serverReportClientActivity, require_Schema$1.void_, { "rpc.aggregate": "server" }),
|
|
107581
|
-
[WS_METHODS.codeGraphSummary]: (input) => observeRpcEffect(WS_METHODS.codeGraphSummary, readCodeGraphSummary(input), { "rpc.aggregate": "codeGraph" }),
|
|
107582
|
-
[WS_METHODS.codeGraphNeighborhood]: (input) => observeRpcEffect(WS_METHODS.codeGraphNeighborhood, readCodeGraphNeighborhood(input), { "rpc.aggregate": "codeGraph" }),
|
|
107583
|
-
[WS_METHODS.codeGraphSearch]: (input) => observeRpcEffect(WS_METHODS.codeGraphSearch, readCodeGraphSearch(input), { "rpc.aggregate": "codeGraph" }),
|
|
107584
107041
|
[WS_METHODS.projectsWriteFile]: (input) => observeRpcEffect(WS_METHODS.projectsWriteFile, workspaceFileSystem.writeFile(input).pipe(require_Schema$1.mapError((cause) => {
|
|
107585
107042
|
return new ProjectWriteFileError({
|
|
107586
107043
|
message: require_Schema$1.is(WorkspacePathOutsideRootError)(cause) ? "Workspace file path must stay within the project root." : "Failed to write workspace file",
|
|
@@ -153634,7 +153091,9 @@ var CodexAppServerManager = class extends node_events.EventEmitter {
|
|
|
153634
153091
|
scheduleProviderEgressTokenRefresh(context, delayMs) {
|
|
153635
153092
|
if (context.tokenRefreshTimer) clearTimeout(context.tokenRefreshTimer);
|
|
153636
153093
|
const tokenRefreshTimer = setTimeout(() => {
|
|
153637
|
-
this.handleProviderEgressTokenRefresh(context.session.threadId).catch(() =>
|
|
153094
|
+
this.handleProviderEgressTokenRefresh(context.session.threadId).catch((error) => {
|
|
153095
|
+
this.emitErrorEvent(context, "session/tokenRefreshFailed", error instanceof Error ? error.message : String(error));
|
|
153096
|
+
});
|
|
153638
153097
|
}, delayMs);
|
|
153639
153098
|
tokenRefreshTimer.unref?.();
|
|
153640
153099
|
context.tokenRefreshTimer = tokenRefreshTimer;
|
|
@@ -290988,93 +290447,6 @@ async function maybeRefreshRuntimeProvisioningGrant(input) {
|
|
|
290988
290447
|
return "refreshed";
|
|
290989
290448
|
}
|
|
290990
290449
|
//#endregion
|
|
290991
|
-
//#region src/runtimeDrain/RuntimeDrainState.ts
|
|
290992
|
-
const initialState = {
|
|
290993
|
-
activeTurns: /* @__PURE__ */ new Set(),
|
|
290994
|
-
activeTurnCount: 0,
|
|
290995
|
-
activeSessionCount: 0,
|
|
290996
|
-
draining: false,
|
|
290997
|
-
drainReason: null,
|
|
290998
|
-
drainTargetImageRef: null,
|
|
290999
|
-
drainTargetImageVersion: null,
|
|
291000
|
-
drainForceRequired: false
|
|
291001
|
-
};
|
|
291002
|
-
function snapshotFromState(state) {
|
|
291003
|
-
return {
|
|
291004
|
-
activeTurnCount: state.activeTurnCount,
|
|
291005
|
-
activeSessionCount: state.activeSessionCount,
|
|
291006
|
-
draining: state.draining,
|
|
291007
|
-
drainReason: state.drainReason,
|
|
291008
|
-
drainTargetImageRef: state.drainTargetImageRef,
|
|
291009
|
-
drainTargetImageVersion: state.drainTargetImageVersion,
|
|
291010
|
-
drainForceRequired: state.drainForceRequired
|
|
291011
|
-
};
|
|
291012
|
-
}
|
|
291013
|
-
function turnKey(input) {
|
|
291014
|
-
return `${input.threadId}:${input.turnId ?? "unknown"}`;
|
|
291015
|
-
}
|
|
291016
|
-
function normalizeCount(count) {
|
|
291017
|
-
return Number.isFinite(count) ? Math.max(0, Math.floor(count)) : 0;
|
|
291018
|
-
}
|
|
291019
|
-
const makeRuntimeDrainState = require_Schema$1.gen(function* () {
|
|
291020
|
-
const stateRef = yield* require_HttpServer.make$3(initialState);
|
|
291021
|
-
const update = (f) => require_HttpServer.updateAndGet(stateRef, f).pipe(require_Schema$1.map(snapshotFromState));
|
|
291022
|
-
return {
|
|
291023
|
-
beginTurn: (input) => update((state) => {
|
|
291024
|
-
const activeTurns = new Set(state.activeTurns);
|
|
291025
|
-
activeTurns.add(turnKey(input));
|
|
291026
|
-
return {
|
|
291027
|
-
...state,
|
|
291028
|
-
activeTurns,
|
|
291029
|
-
activeTurnCount: activeTurns.size
|
|
291030
|
-
};
|
|
291031
|
-
}),
|
|
291032
|
-
completeTurn: (input) => update((state) => {
|
|
291033
|
-
const activeTurns = new Set(state.activeTurns);
|
|
291034
|
-
activeTurns.delete(turnKey(input));
|
|
291035
|
-
return {
|
|
291036
|
-
...state,
|
|
291037
|
-
activeTurns,
|
|
291038
|
-
activeTurnCount: activeTurns.size
|
|
291039
|
-
};
|
|
291040
|
-
}),
|
|
291041
|
-
clearActiveTurns: update((state) => ({
|
|
291042
|
-
...state,
|
|
291043
|
-
activeTurns: /* @__PURE__ */ new Set(),
|
|
291044
|
-
activeTurnCount: 0
|
|
291045
|
-
})),
|
|
291046
|
-
setActiveSessionCount: (count) => update((state) => ({
|
|
291047
|
-
...state,
|
|
291048
|
-
activeSessionCount: normalizeCount(count)
|
|
291049
|
-
})),
|
|
291050
|
-
reconcileProviderSessions: (sessions) => update((state) => {
|
|
291051
|
-
const activeSessions = sessions.filter((session) => session.status !== "closed");
|
|
291052
|
-
const activeTurns = new Set(activeSessions.flatMap((session) => session.activeTurnId === void 0 ? [] : [turnKey({
|
|
291053
|
-
threadId: session.threadId,
|
|
291054
|
-
turnId: session.activeTurnId
|
|
291055
|
-
})]));
|
|
291056
|
-
return {
|
|
291057
|
-
...state,
|
|
291058
|
-
activeTurns,
|
|
291059
|
-
activeTurnCount: activeTurns.size,
|
|
291060
|
-
activeSessionCount: activeSessions.length
|
|
291061
|
-
};
|
|
291062
|
-
}),
|
|
291063
|
-
applyControlPlaneState: (input) => update((state) => ({
|
|
291064
|
-
...state,
|
|
291065
|
-
draining: input.draining ?? state.draining,
|
|
291066
|
-
drainReason: input.drainReason ?? state.drainReason,
|
|
291067
|
-
drainTargetImageRef: input.drainTargetImageRef ?? state.drainTargetImageRef,
|
|
291068
|
-
drainTargetImageVersion: input.drainTargetImageVersion ?? state.drainTargetImageVersion,
|
|
291069
|
-
drainForceRequired: input.drainForceRequired ?? state.drainForceRequired
|
|
291070
|
-
})),
|
|
291071
|
-
snapshot: require_HttpServer.get$1(stateRef).pipe(require_Schema$1.map(snapshotFromState)),
|
|
291072
|
-
isDraining: require_HttpServer.get$1(stateRef).pipe(require_Schema$1.map((state) => state.draining))
|
|
291073
|
-
};
|
|
291074
|
-
});
|
|
291075
|
-
var RuntimeDrainState = class extends require_Schema$1.Service()("forge/runtimeDrain/RuntimeDrainState") {};
|
|
291076
|
-
const RuntimeDrainStateLive = require_Schema$1.effect(RuntimeDrainState, makeRuntimeDrainState);
|
|
291077
|
-
//#endregion
|
|
291078
290450
|
//#region src/runtimeDrain/RuntimeDrainReporter.ts
|
|
291079
290451
|
const HEARTBEAT_INTERVAL = require_Schema$1.seconds(30);
|
|
291080
290452
|
const HEARTBEAT_TICK_TIMEOUT = require_Schema$1.seconds(60);
|
|
@@ -291132,6 +290504,7 @@ const postRuntimeHeartbeat = (config, snapshot) => require_Schema$1.promise(asyn
|
|
|
291132
290504
|
...config,
|
|
291133
290505
|
activeTurnCount: snapshot.activeTurnCount,
|
|
291134
290506
|
activeSessionCount: snapshot.activeSessionCount,
|
|
290507
|
+
acceptingTurns: snapshot.acceptingTurns,
|
|
291135
290508
|
...forgeGitCommit !== void 0 ? { forgeGitCommit } : {},
|
|
291136
290509
|
forgeServerVersion: installedForgeServerVersion
|
|
291137
290510
|
});
|
|
@@ -291240,6 +290613,7 @@ const makeRuntimeDrainReporter = require_Schema$1.gen(function* () {
|
|
|
291240
290613
|
work: reportOnce,
|
|
291241
290614
|
interval: HEARTBEAT_INTERVAL
|
|
291242
290615
|
}));
|
|
290616
|
+
yield* require_Schema$1.addFinalizer(() => drainState.requestShutdown);
|
|
291243
290617
|
})
|
|
291244
290618
|
};
|
|
291245
290619
|
});
|
|
@@ -291450,6 +290824,7 @@ function decodeCodexRateLimitWindows(raw) {
|
|
|
291450
290824
|
function publicProviderRuntimeError(message) {
|
|
291451
290825
|
return sanitizePublicProviderText(message, { fallback: DEFAULT_PUBLIC_PROVIDER_ERROR });
|
|
291452
290826
|
}
|
|
290827
|
+
const processDomainEvent = (_event) => require_Schema$1.void_;
|
|
291453
290828
|
function isAssistantTextDeltaEvent(event) {
|
|
291454
290829
|
return event.type === "content.delta" && event.payload.streamKind === "assistant_text";
|
|
291455
290830
|
}
|
|
@@ -292245,7 +291620,6 @@ const make$9 = require_Schema$1.fn("make")(function* () {
|
|
|
292245
291620
|
yield* runtimeDrainReporter.reportOnce;
|
|
292246
291621
|
}
|
|
292247
291622
|
});
|
|
292248
|
-
const processDomainEvent = (_event) => require_Schema$1.void_;
|
|
292249
291623
|
const processInput = (input) => input.source === "runtime" ? processRuntimeEvent(input.event) : processDomainEvent(input.event);
|
|
292250
291624
|
const processInputSafely = (input) => processInput(input).pipe(require_Schema$1.catchCause((cause) => {
|
|
292251
291625
|
if (require_Schema$1.hasInterruptsOnly(cause)) return require_Schema$1.failCause(cause);
|
|
@@ -292296,6 +291670,7 @@ const make$9 = require_Schema$1.fn("make")(function* () {
|
|
|
292296
291670
|
return {
|
|
292297
291671
|
start: require_Schema$1.fn("start")(function* () {
|
|
292298
291672
|
yield* reconcileOrphanedRunningSessions();
|
|
291673
|
+
yield* runtimeDrainState.markExecutionPrecondition("providerLayer");
|
|
292299
291674
|
yield* runtimeDrainReporter.start;
|
|
292300
291675
|
yield* require_Schema$1.forkScoped(require_Path.runForEach(providerService.streamEvents, (event) => enqueueInput({
|
|
292301
291676
|
source: "runtime",
|
|
@@ -292535,6 +291910,8 @@ const HANDLED_TURN_START_KEY_MAX = 1e4;
|
|
|
292535
291910
|
const HANDLED_TURN_START_KEY_TTL = require_Schema$1.minutes(30);
|
|
292536
291911
|
const DEFAULT_RUNTIME_MODE = "full-access";
|
|
292537
291912
|
const DEFAULT_THREAD_TITLE = "New thread";
|
|
291913
|
+
const isProviderValidationError = require_Schema$1.is(ProviderValidationError);
|
|
291914
|
+
const isProviderKind = require_Schema$1.is(ProviderKind);
|
|
292538
291915
|
function isPathInsideRoot(candidatePath, rootPath) {
|
|
292539
291916
|
let resolvedCandidate;
|
|
292540
291917
|
let resolvedRoot;
|
|
@@ -292571,6 +291948,38 @@ function resolveExistingWorkspaceCwd(input) {
|
|
|
292571
291948
|
function publicProviderFailureDetail(detail) {
|
|
292572
291949
|
return sanitizePublicProviderText(detail, { fallback: "CMMD is temporarily unavailable. Check the workspace AI connection and retry." }) ?? "CMMD is temporarily unavailable. Check the workspace AI connection and retry.";
|
|
292573
291950
|
}
|
|
291951
|
+
/**
|
|
291952
|
+
* The failure detail a transcript shows, judged on the text and not the envelope.
|
|
291953
|
+
*
|
|
291954
|
+
* Forge writes its own validation copy, so `ProviderValidationError.issue` is
|
|
291955
|
+
* not raw provider output. Every envelope around it hides it, each in its own
|
|
291956
|
+
* way: `Cause.pretty` prints the error tag, and the sanitizer counts
|
|
291957
|
+
* "ProviderValidationError" as a provider leak, so a validation failure
|
|
291958
|
+
* rendered through `Cause.pretty` tripped the guard on its own wrapper. The
|
|
291959
|
+
* `message` getter spells the same tag out in prose. On 2026-09-16 the first of
|
|
291960
|
+
* those replaced "Reconnect the account and try again" with "CMMD is
|
|
291961
|
+
* temporarily unavailable" (#3337).
|
|
291962
|
+
*
|
|
291963
|
+
* The issue still goes through the sanitizer. `ProviderService` builds some
|
|
291964
|
+
* issues from a schema formatter, which echoes the decoded payload, so this is a
|
|
291965
|
+
* narrower input to the same guard rather than a way around it.
|
|
291966
|
+
*/
|
|
291967
|
+
function publicProviderFailureDetailFromError(error) {
|
|
291968
|
+
if (isProviderValidationError(error)) return publicProviderFailureDetail(error.issue);
|
|
291969
|
+
return publicProviderFailureDetail(error instanceof Error ? error.message : String(error));
|
|
291970
|
+
}
|
|
291971
|
+
/**
|
|
291972
|
+
* The same judgement for a failure that arrives as a cause.
|
|
291973
|
+
*
|
|
291974
|
+
* Only the validation branch delegates. A cause carries what a bare error does
|
|
291975
|
+
* not: defects, interrupts, and more than one failure, all of which
|
|
291976
|
+
* `Cause.pretty` renders and `.message` would drop. Squashing every failure into
|
|
291977
|
+
* its message to reach one shared line would lose that.
|
|
291978
|
+
*/
|
|
291979
|
+
function publicProviderFailureDetailFromCause(cause) {
|
|
291980
|
+
const error = require_Schema$1.squash(cause);
|
|
291981
|
+
return isProviderValidationError(error) ? publicProviderFailureDetailFromError(error) : publicProviderFailureDetail(require_Schema$1.pretty(cause));
|
|
291982
|
+
}
|
|
292574
291983
|
function canReplaceThreadTitle(currentTitle, titleSeed) {
|
|
292575
291984
|
const trimmedCurrentTitle = currentTitle.trim();
|
|
292576
291985
|
if (trimmedCurrentTitle === DEFAULT_THREAD_TITLE) return true;
|
|
@@ -292726,7 +292135,7 @@ const make$8 = require_Schema$1.gen(function* () {
|
|
|
292726
292135
|
const thread = readModel.threads.find((entry) => entry.id === threadId);
|
|
292727
292136
|
if (!thread) return yield* require_Schema$1.die(/* @__PURE__ */ new Error(`Thread '${threadId}' was not found in read model.`));
|
|
292728
292137
|
const desiredRuntimeMode = thread.runtimeMode;
|
|
292729
|
-
const currentProvider = thread.session?.status !== "stopped" &&
|
|
292138
|
+
const currentProvider = thread.session?.status !== "stopped" && isProviderKind(thread.session?.providerName) ? thread.session.providerName : void 0;
|
|
292730
292139
|
const rawRequestedModelSelection = options?.modelSelection;
|
|
292731
292140
|
const threadProvider = currentProvider ?? thread.modelSelection.provider;
|
|
292732
292141
|
const isStaleRequestedProvider = rawRequestedModelSelection !== void 0 && rawRequestedModelSelection.provider !== threadProvider;
|
|
@@ -293105,7 +292514,7 @@ const make$8 = require_Schema$1.gen(function* () {
|
|
|
293105
292514
|
threadId: event.payload.threadId,
|
|
293106
292515
|
kind: "provider.turn.start.failed",
|
|
293107
292516
|
summary: "Provider turn start failed",
|
|
293108
|
-
detail:
|
|
292517
|
+
detail: publicProviderFailureDetailFromCause(cause),
|
|
293109
292518
|
turnId: null,
|
|
293110
292519
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
293111
292520
|
})));
|
|
@@ -293121,7 +292530,14 @@ const make$8 = require_Schema$1.gen(function* () {
|
|
|
293121
292530
|
turnId: event.payload.turnId ?? null,
|
|
293122
292531
|
createdAt: event.payload.createdAt
|
|
293123
292532
|
});
|
|
293124
|
-
yield* providerService.interruptTurn({ threadId: event.payload.threadId })
|
|
292533
|
+
yield* providerService.interruptTurn({ threadId: event.payload.threadId }).pipe(require_Schema$1.catchCause((cause) => appendProviderFailureActivity({
|
|
292534
|
+
threadId: event.payload.threadId,
|
|
292535
|
+
kind: "provider.turn.interrupt.failed",
|
|
292536
|
+
summary: "Provider turn interrupt failed",
|
|
292537
|
+
detail: publicProviderFailureDetail(require_Schema$1.pretty(cause)),
|
|
292538
|
+
turnId: event.payload.turnId ?? null,
|
|
292539
|
+
createdAt: event.payload.createdAt
|
|
292540
|
+
})));
|
|
293125
292541
|
});
|
|
293126
292542
|
const processApprovalResponseRequested = require_Schema$1.fn("processApprovalResponseRequested")(function* (event) {
|
|
293127
292543
|
const staged = peekThreadContinuationSession(event.commandId);
|
|
@@ -293158,7 +292574,7 @@ const make$8 = require_Schema$1.gen(function* () {
|
|
|
293158
292574
|
threadId: event.payload.threadId,
|
|
293159
292575
|
kind: "provider.approval.respond.failed",
|
|
293160
292576
|
summary: "Provider approval response failed",
|
|
293161
|
-
detail: isUnknownPendingApprovalRequestError(cause) ? stalePendingRequestDetail("approval", event.payload.requestId) :
|
|
292577
|
+
detail: isUnknownPendingApprovalRequestError(cause) ? stalePendingRequestDetail("approval", event.payload.requestId) : publicProviderFailureDetailFromCause(cause),
|
|
293162
292578
|
turnId: null,
|
|
293163
292579
|
createdAt: event.payload.createdAt,
|
|
293164
292580
|
requestId: event.payload.requestId
|
|
@@ -293201,7 +292617,7 @@ const make$8 = require_Schema$1.gen(function* () {
|
|
|
293201
292617
|
threadId: event.payload.threadId,
|
|
293202
292618
|
kind: "provider.user-input.respond.failed",
|
|
293203
292619
|
summary: "Provider user input response failed",
|
|
293204
|
-
detail: isUnknownPendingUserInputRequestError(cause) ? stalePendingRequestDetail("user-input", event.payload.requestId) :
|
|
292620
|
+
detail: isUnknownPendingUserInputRequestError(cause) ? stalePendingRequestDetail("user-input", event.payload.requestId) : publicProviderFailureDetailFromCause(cause),
|
|
293205
292621
|
turnId: null,
|
|
293206
292622
|
createdAt: event.payload.createdAt,
|
|
293207
292623
|
requestId: event.payload.requestId
|
|
@@ -293214,8 +292630,7 @@ const make$8 = require_Schema$1.gen(function* () {
|
|
|
293214
292630
|
yield* providerService.stopSession({
|
|
293215
292631
|
threadId: thread.id,
|
|
293216
292632
|
...event.payload.preserveResumeState === true ? { preserveResumeState: true } : {}
|
|
293217
|
-
})
|
|
293218
|
-
yield* setThreadSession({
|
|
292633
|
+
}).pipe(require_Schema$1.tap(() => setThreadSession({
|
|
293219
292634
|
threadId: thread.id,
|
|
293220
292635
|
session: {
|
|
293221
292636
|
threadId: thread.id,
|
|
@@ -293227,7 +292642,14 @@ const make$8 = require_Schema$1.gen(function* () {
|
|
|
293227
292642
|
updatedAt: now
|
|
293228
292643
|
},
|
|
293229
292644
|
createdAt: now
|
|
293230
|
-
})
|
|
292645
|
+
})), require_Schema$1.catchCause((cause) => appendProviderFailureActivity({
|
|
292646
|
+
threadId: event.payload.threadId,
|
|
292647
|
+
kind: "provider.session.stop.failed",
|
|
292648
|
+
summary: "Provider session stop failed",
|
|
292649
|
+
detail: publicProviderFailureDetail(require_Schema$1.pretty(cause)),
|
|
292650
|
+
turnId: null,
|
|
292651
|
+
createdAt: now
|
|
292652
|
+
})));
|
|
293231
292653
|
});
|
|
293232
292654
|
const processDomainEvent = require_Schema$1.fn("processDomainEvent")(function* (event) {
|
|
293233
292655
|
yield* require_Schema$1.annotateCurrentSpan({
|
|
@@ -293322,7 +292744,7 @@ const make$8 = require_Schema$1.gen(function* () {
|
|
|
293322
292744
|
threadId: event.payload.threadId,
|
|
293323
292745
|
kind: "provider.turn.start.failed",
|
|
293324
292746
|
summary: "Provider turn start cleanup failed",
|
|
293325
|
-
detail:
|
|
292747
|
+
detail: publicProviderFailureDetailFromError(cause),
|
|
293326
292748
|
turnId: null,
|
|
293327
292749
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
293328
292750
|
})
|
|
@@ -298790,7 +298212,7 @@ function resolveBuildCommitFromEnv(env) {
|
|
|
298790
298212
|
* environment descriptor down instead of reporting an honest "unknown".
|
|
298791
298213
|
*/
|
|
298792
298214
|
function readBakedBuildCommit() {
|
|
298793
|
-
return "
|
|
298215
|
+
return "60c000d9c894e2ef04f90b602ddc8eb49c84980a";
|
|
298794
298216
|
}
|
|
298795
298217
|
async function resolveServerBuildCommit(input) {
|
|
298796
298218
|
if (isFullCommitSha(input.baked)) return input.baked;
|
|
@@ -322280,7 +321702,7 @@ const PlatformServicesLive = require_Schema$1.unwrap(require_Schema$1.gen(functi
|
|
|
322280
321702
|
}));
|
|
322281
321703
|
const RuntimeReplicationLayerLive = RuntimeReplicationLive.pipe(require_Schema$1.provideMerge(RuntimeReplicationClientLive), require_Schema$1.provideMerge(RuntimeReplicationOutboxLive), require_Schema$1.provideMerge(ActiveHourMeterLive.pipe(require_Schema$1.provide$1(RuntimeReplicationOutboxLive))));
|
|
322282
321704
|
const RuntimeDrainLayerLive = RuntimeDrainReporterLive.pipe(require_Schema$1.provideMerge(RuntimeDrainStateLive));
|
|
322283
|
-
const RuntimeAwareProviderReactorsLive = require_Schema$1.mergeAll(ProviderRuntimeIngestionLive, ProviderCommandReactorLive).pipe(require_Schema$1.provide$1(RuntimeDrainLayerLive), require_Schema$1.provide$1(ClaudeUsageTelemetryLive));
|
|
321705
|
+
const RuntimeAwareProviderReactorsLive = require_Schema$1.mergeAll(ProviderRuntimeIngestionLive, ProviderCommandReactorLive).pipe(require_Schema$1.provide$1(RuntimeDrainLayerLive), require_Schema$1.provideMerge(RuntimeDrainStateLive), require_Schema$1.provide$1(ClaudeUsageTelemetryLive));
|
|
322284
321706
|
const PipelineWorkerCoordinatorLayerLive = PipelineWorkerCoordinatorLive.pipe(require_Schema$1.provideMerge(PipelineRunClientLive));
|
|
322285
321707
|
const AgentProtocolReactorLayerLive = AgentProtocolReactorLive.pipe(require_Schema$1.provideMerge(PipelineRunStoreLive));
|
|
322286
321708
|
const PipelineRunCoordinatorLayerLive = PipelineRunCoordinatorLive.pipe(require_Schema$1.provideMerge(PipelineProviderAuthorityInstallerLive), require_Schema$1.provideMerge(PipelineChangeInspectorLive), require_Schema$1.provideMerge(PipelineContextArtifactStoreLive), require_Schema$1.provideMerge(PipelineModelPolicyLive), require_Schema$1.provideMerge(PipelineRunClientLive), require_Schema$1.provideMerge(PipelineRunStoreLive), require_Schema$1.provideMerge(PipelineRunWorkspaceAllocatorLive), require_Schema$1.provideMerge(PipelineStagePolicyLive), require_Schema$1.provideMerge(PipelineWorkerCoordinatorLayerLive));
|