@cmmd-center/forge 0.9.16 → 0.9.18
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 +889 -436
- package/dist/bin.mjs +892 -451
- package/dist/client/assets/{CanvasPanel-Dc8j2ouo.js → CanvasPanel-DO2u5-Xk.js} +2 -2
- package/dist/client/assets/{CompositeItem-Cn5DdObI.js → CompositeItem-BNUtGUNS.js} +2 -2
- package/dist/client/assets/{DiffPanel-CRdkVPEz.js → DiffPanel-CiOqFcOU.js} +2 -2
- package/dist/client/assets/{DiffPanel.logic-BIPcNz_o.js → DiffPanel.logic-CcUKnHmG.js} +2 -2
- package/dist/client/assets/{DiffPanelShell-tIdXu7mn.js → DiffPanelShell-B8YmcyIS.js} +33 -33
- package/dist/client/assets/{DiffWorkerPoolProvider-tFSGuVfC.js → DiffWorkerPoolProvider-XttvFu9p.js} +2 -2
- package/dist/client/assets/{PullRequestCodePanel-inwJYfZC.js → PullRequestCodePanel-BwnGKUmC.js} +2 -2
- package/dist/client/assets/{Virtualizer-DeKxnAeU.js → Virtualizer-DD1kZz4_.js} +2 -2
- package/dist/client/assets/{canvasStateStore-Dlm4tanv.js → canvasStateStore-BVOZ0hkY.js} +2 -2
- package/dist/client/assets/{cmmdAuthRedirect-C1FjO86g.js → cmmdAuthRedirect-COJsfxk2.js} +2 -2
- package/dist/client/assets/{index-BvXPD-Rk.js → index-B6v3s1Ki.js} +57 -57
- package/dist/client/assets/{index-4a61qSZ4.css → index-BUnBt2Vq.css} +1 -1
- package/dist/client/assets/{src-DljvAdHI.js → src-DEn2qb9-.js} +3 -3
- package/dist/client/assets/{toggle-It2CvaLA.js → toggle-vjiHllrh.js} +2 -2
- package/dist/client/assets/{useTriggerFocusGuards-DfUh9uvu.js → useTriggerFocusGuards-DMJ0Xu3Z.js} +2 -2
- package/dist/client/index.html +11 -11
- package/package.json +1 -1
package/dist/bin.mjs
CHANGED
|
@@ -19105,6 +19105,23 @@ const ProjectAvailability = Literals([
|
|
|
19105
19105
|
"missing",
|
|
19106
19106
|
"unknown"
|
|
19107
19107
|
]);
|
|
19108
|
+
/**
|
|
19109
|
+
* The CMMD record that places one Forge Project onto one Environment.
|
|
19110
|
+
*
|
|
19111
|
+
* The organization and the CMMD project together are the durable identity of a
|
|
19112
|
+
* Checkout on that Environment, and the key every lookup uses; a directory path
|
|
19113
|
+
* only breaks ties. A Forge Cloud Environment is per (organization, user), so
|
|
19114
|
+
* every Checkout on it reports the same workspace root and, once connected,
|
|
19115
|
+
* an empty `cwd` — nothing about a directory can tell them apart.
|
|
19116
|
+
*
|
|
19117
|
+
* Optional everywhere it appears: a project created before this field existed,
|
|
19118
|
+
* or one added by hand rather than from a Registration, carries none and is
|
|
19119
|
+
* still matched by the directory rules.
|
|
19120
|
+
*/
|
|
19121
|
+
const CmmdRegistration = Struct({
|
|
19122
|
+
cmmdOrganizationId: PositiveInt,
|
|
19123
|
+
cmmdProjectId: PositiveInt
|
|
19124
|
+
});
|
|
19108
19125
|
const OrchestrationProject = Struct({
|
|
19109
19126
|
id: ProjectId,
|
|
19110
19127
|
title: TrimmedNonEmptyString,
|
|
@@ -19113,6 +19130,7 @@ const OrchestrationProject = Struct({
|
|
|
19113
19130
|
availability: optional$4(ProjectAvailability),
|
|
19114
19131
|
defaultModelSelection: NullOr(ModelSelection),
|
|
19115
19132
|
defaultThreadEnvMode: optional$4(NullOr(ThreadEnvMode)),
|
|
19133
|
+
cmmdRegistration: optional$4(NullOr(CmmdRegistration)),
|
|
19116
19134
|
scripts: ArraySchema(ProjectScript),
|
|
19117
19135
|
createdAt: IsoDateTime,
|
|
19118
19136
|
updatedAt: IsoDateTime,
|
|
@@ -19384,6 +19402,7 @@ const OrchestrationProjectShell = Struct({
|
|
|
19384
19402
|
availability: optional$4(ProjectAvailability),
|
|
19385
19403
|
defaultModelSelection: NullOr(ModelSelection),
|
|
19386
19404
|
defaultThreadEnvMode: optional$4(NullOr(ThreadEnvMode)),
|
|
19405
|
+
cmmdRegistration: optional$4(NullOr(CmmdRegistration)),
|
|
19387
19406
|
scripts: ArraySchema(ProjectScript),
|
|
19388
19407
|
createdAt: IsoDateTime,
|
|
19389
19408
|
updatedAt: IsoDateTime
|
|
@@ -19463,6 +19482,7 @@ const ProjectCreateCommand = Struct({
|
|
|
19463
19482
|
workspaceRoot: TrimmedNonEmptyString,
|
|
19464
19483
|
defaultModelSelection: optional$4(NullOr(ModelSelection)),
|
|
19465
19484
|
defaultThreadEnvMode: optional$4(NullOr(ThreadEnvMode)),
|
|
19485
|
+
cmmdRegistration: optional$4(NullOr(CmmdRegistration)),
|
|
19466
19486
|
createdAt: IsoDateTime
|
|
19467
19487
|
});
|
|
19468
19488
|
const ProjectMetaUpdateCommand = Struct({
|
|
@@ -19473,6 +19493,7 @@ const ProjectMetaUpdateCommand = Struct({
|
|
|
19473
19493
|
workspaceRoot: optional$4(TrimmedNonEmptyString),
|
|
19474
19494
|
defaultModelSelection: optional$4(NullOr(ModelSelection)),
|
|
19475
19495
|
defaultThreadEnvMode: optional$4(NullOr(ThreadEnvMode)),
|
|
19496
|
+
cmmdRegistration: optional$4(NullOr(CmmdRegistration)),
|
|
19476
19497
|
scripts: optional$4(ArraySchema(ProjectScript))
|
|
19477
19498
|
});
|
|
19478
19499
|
const ProjectDeleteCommand = Struct({
|
|
@@ -19863,6 +19884,7 @@ const ProjectCreatedPayload$1 = Struct({
|
|
|
19863
19884
|
repositoryIdentity: optional$4(NullOr(RepositoryIdentity)),
|
|
19864
19885
|
defaultModelSelection: NullOr(ModelSelection),
|
|
19865
19886
|
defaultThreadEnvMode: optional$4(NullOr(ThreadEnvMode)),
|
|
19887
|
+
cmmdRegistration: optional$4(NullOr(CmmdRegistration)),
|
|
19866
19888
|
scripts: ArraySchema(ProjectScript),
|
|
19867
19889
|
createdAt: IsoDateTime,
|
|
19868
19890
|
updatedAt: IsoDateTime
|
|
@@ -19874,6 +19896,7 @@ const ProjectMetaUpdatedPayload$1 = Struct({
|
|
|
19874
19896
|
repositoryIdentity: optional$4(NullOr(RepositoryIdentity)),
|
|
19875
19897
|
defaultModelSelection: optional$4(NullOr(ModelSelection)),
|
|
19876
19898
|
defaultThreadEnvMode: optional$4(NullOr(ThreadEnvMode)),
|
|
19899
|
+
cmmdRegistration: optional$4(NullOr(CmmdRegistration)),
|
|
19877
19900
|
scripts: optional$4(ArraySchema(ProjectScript)),
|
|
19878
19901
|
updatedAt: IsoDateTime
|
|
19879
19902
|
});
|
|
@@ -20783,23 +20806,33 @@ const ThreadMetadataUpdatedPayload = Struct({
|
|
|
20783
20806
|
name: optional$4(TrimmedNonEmptyStringSchema$2),
|
|
20784
20807
|
metadata: optional$4(UnknownRecordSchema)
|
|
20785
20808
|
});
|
|
20786
|
-
const ThreadTokenUsageUpdatedPayload = Struct({
|
|
20787
|
-
|
|
20788
|
-
|
|
20789
|
-
|
|
20790
|
-
|
|
20791
|
-
|
|
20792
|
-
|
|
20793
|
-
|
|
20794
|
-
|
|
20795
|
-
|
|
20796
|
-
|
|
20797
|
-
|
|
20798
|
-
|
|
20799
|
-
|
|
20800
|
-
|
|
20801
|
-
|
|
20802
|
-
|
|
20809
|
+
const ThreadTokenUsageUpdatedPayload = Struct({
|
|
20810
|
+
usage: Struct({
|
|
20811
|
+
usedTokens: NonNegativeInt,
|
|
20812
|
+
totalProcessedTokens: optional$4(NonNegativeInt),
|
|
20813
|
+
maxTokens: optional$4(PositiveInt),
|
|
20814
|
+
inputTokens: optional$4(NonNegativeInt),
|
|
20815
|
+
cachedInputTokens: optional$4(NonNegativeInt),
|
|
20816
|
+
outputTokens: optional$4(NonNegativeInt),
|
|
20817
|
+
reasoningOutputTokens: optional$4(NonNegativeInt),
|
|
20818
|
+
lastUsedTokens: optional$4(NonNegativeInt),
|
|
20819
|
+
lastInputTokens: optional$4(NonNegativeInt),
|
|
20820
|
+
lastCachedInputTokens: optional$4(NonNegativeInt),
|
|
20821
|
+
lastOutputTokens: optional$4(NonNegativeInt),
|
|
20822
|
+
lastReasoningOutputTokens: optional$4(NonNegativeInt),
|
|
20823
|
+
toolUses: optional$4(NonNegativeInt),
|
|
20824
|
+
durationMs: optional$4(NonNegativeInt),
|
|
20825
|
+
compactsAutomatically: optional$4(Boolean$1)
|
|
20826
|
+
}),
|
|
20827
|
+
turnUsage: optional$4(Struct({
|
|
20828
|
+
scope: Literals(["turn-total", "call-delta"]),
|
|
20829
|
+
uncachedInputTokens: NonNegativeInt,
|
|
20830
|
+
cachedInputTokens: NonNegativeInt,
|
|
20831
|
+
cacheCreationTokens: NonNegativeInt,
|
|
20832
|
+
outputTokens: NonNegativeInt,
|
|
20833
|
+
reasoningTokens: NonNegativeInt
|
|
20834
|
+
}))
|
|
20835
|
+
});
|
|
20803
20836
|
const ThreadRealtimeStartedPayload = Struct({ realtimeSessionId: optional$4(TrimmedNonEmptyStringSchema$2) });
|
|
20804
20837
|
const ThreadRealtimeItemAddedPayload = Struct({ item: Unknown });
|
|
20805
20838
|
const ThreadRealtimeAudioDeltaPayload = Struct({ audio: Unknown });
|
|
@@ -22164,6 +22197,40 @@ const ServerProviderAuth = Struct({
|
|
|
22164
22197
|
accountEmail: optional$4(TrimmedNonEmptyString),
|
|
22165
22198
|
provenance: optional$4(ProviderAuthProvenance)
|
|
22166
22199
|
});
|
|
22200
|
+
/**
|
|
22201
|
+
* Whether this Environment will let a person select the provider.
|
|
22202
|
+
*
|
|
22203
|
+
* Published for every provider the build knows about. A provider is never
|
|
22204
|
+
* dropped from the list: absence is not a state, and four different reasons
|
|
22205
|
+
* once collapsed into one "Coming soon." string because the Shell had to infer
|
|
22206
|
+
* meaning from what was missing. See
|
|
22207
|
+
* `docs/adr/withheld-providers-carry-their-reason.md`.
|
|
22208
|
+
*/
|
|
22209
|
+
const ProviderAvailability = Literals(["available", "unavailable"]);
|
|
22210
|
+
/**
|
|
22211
|
+
* Why a Withheld Provider is withheld. The four members are the glossary's,
|
|
22212
|
+
* in `CONTEXT.md` section "Provider availability": Unbuilt, Not Offered, Not
|
|
22213
|
+
* Usable, Not on this Environment. Only Unbuilt may read "Coming soon."
|
|
22214
|
+
*
|
|
22215
|
+
* An Environment can only ever report Unbuilt, Not Usable, or Not on this
|
|
22216
|
+
* Environment. Not Offered is a CMMD fact about the organization's Provider
|
|
22217
|
+
* Offer, which the Shell adds when it joins.
|
|
22218
|
+
*/
|
|
22219
|
+
const ProviderUnavailableReason = Literals([
|
|
22220
|
+
"unbuilt",
|
|
22221
|
+
"not-offered",
|
|
22222
|
+
"not-usable",
|
|
22223
|
+
"not-on-this-environment"
|
|
22224
|
+
]);
|
|
22225
|
+
/**
|
|
22226
|
+
* The Not Usable sub-case. It picks a second line of copy, not a fifth state,
|
|
22227
|
+
* which is why it is a separate field rather than three more reasons.
|
|
22228
|
+
*/
|
|
22229
|
+
const ProviderUnavailableDetail = Literals([
|
|
22230
|
+
"no-connection",
|
|
22231
|
+
"delivery-pending",
|
|
22232
|
+
"reconnect-required"
|
|
22233
|
+
]);
|
|
22167
22234
|
const ServerProviderModel = Struct({
|
|
22168
22235
|
slug: TrimmedNonEmptyString,
|
|
22169
22236
|
name: TrimmedNonEmptyString,
|
|
@@ -22195,6 +22262,9 @@ const ServerProvider = Struct({
|
|
|
22195
22262
|
checkedAt: IsoDateTime,
|
|
22196
22263
|
message: optional$4(TrimmedNonEmptyString),
|
|
22197
22264
|
models: ArraySchema(ServerProviderModel),
|
|
22265
|
+
availability: optional$4(ProviderAvailability),
|
|
22266
|
+
unavailableReason: optional$4(ProviderUnavailableReason),
|
|
22267
|
+
unavailableDetail: optional$4(ProviderUnavailableDetail),
|
|
22198
22268
|
slashCommands: ArraySchema(ServerProviderSlashCommand).pipe(withDecodingDefault(succeed([]))),
|
|
22199
22269
|
skills: ArraySchema(ServerProviderSkill).pipe(withDecodingDefault(succeed([])))
|
|
22200
22270
|
});
|
|
@@ -64870,7 +64940,7 @@ function normalizeNumberish(value) {
|
|
|
64870
64940
|
}
|
|
64871
64941
|
//#endregion
|
|
64872
64942
|
//#region package.json
|
|
64873
|
-
var version$1 = "0.9.
|
|
64943
|
+
var version$1 = "0.9.18";
|
|
64874
64944
|
//#endregion
|
|
64875
64945
|
//#region src/sentry.ts
|
|
64876
64946
|
const SERVER_APP_NAME = "forge-server";
|
|
@@ -67999,7 +68069,8 @@ function fixPath(options = {}) {
|
|
|
67999
68069
|
if (shellPath) break;
|
|
68000
68070
|
}
|
|
68001
68071
|
const launchctlPath = platform === "darwin" && !shellPath ? (options.readLaunchctlPath ?? readPathFromLaunchctl)() : void 0;
|
|
68002
|
-
const
|
|
68072
|
+
const hydratedPath = shellPath ?? launchctlPath;
|
|
68073
|
+
const mergedPath = options.preferProcessPath ? mergePathEntries(env.PATH, hydratedPath, platform) : mergePathEntries(hydratedPath, env.PATH, platform);
|
|
68003
68074
|
if (mergedPath) env.PATH = mergedPath;
|
|
68004
68075
|
} catch (error) {
|
|
68005
68076
|
logWarning("Failed to hydrate PATH from the user environment.", error);
|
|
@@ -91842,305 +91913,6 @@ var AnalyticsService = class AnalyticsService extends Service$1()("forge/telemet
|
|
|
91842
91913
|
});
|
|
91843
91914
|
};
|
|
91844
91915
|
//#endregion
|
|
91845
|
-
//#region src/cmmdSync/CmmdSyncClient.ts
|
|
91846
|
-
const SYNC_TIMEOUT_MS = 1e4;
|
|
91847
|
-
var CmmdSyncError = class extends TaggedError("CmmdSyncError") {};
|
|
91848
|
-
var CmmdSyncClient = class extends Service$1()("forge/cmmdSync/CmmdSyncClient") {};
|
|
91849
|
-
const CmmdSyncClientLive = effect(CmmdSyncClient, gen(function* () {
|
|
91850
|
-
const serverSettings = yield* ServerSettingsService;
|
|
91851
|
-
const syncTurn = (payload) => gen(function* () {
|
|
91852
|
-
const { baseUrl, apiKey } = (yield* serverSettings.getSettings.pipe(orDie)).providers.cmmd;
|
|
91853
|
-
const url = `${baseUrl.replace(/\/$/, "")}/api/forge/turns`;
|
|
91854
|
-
const headers = { "Content-Type": "application/json" };
|
|
91855
|
-
if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`;
|
|
91856
|
-
const response = yield* tryPromise({
|
|
91857
|
-
try: () => fetch(url, {
|
|
91858
|
-
method: "POST",
|
|
91859
|
-
headers,
|
|
91860
|
-
body: JSON.stringify(payload),
|
|
91861
|
-
signal: AbortSignal.timeout(SYNC_TIMEOUT_MS)
|
|
91862
|
-
}),
|
|
91863
|
-
catch: (cause) => new CmmdSyncError({
|
|
91864
|
-
statusCode: 0,
|
|
91865
|
-
body: String(cause)
|
|
91866
|
-
})
|
|
91867
|
-
});
|
|
91868
|
-
const body = yield* tryPromise({
|
|
91869
|
-
try: () => response.text(),
|
|
91870
|
-
catch: (cause) => new CmmdSyncError({
|
|
91871
|
-
statusCode: response.status,
|
|
91872
|
-
body: String(cause)
|
|
91873
|
-
})
|
|
91874
|
-
});
|
|
91875
|
-
if (!response.ok) return yield* new CmmdSyncError({
|
|
91876
|
-
statusCode: response.status,
|
|
91877
|
-
body
|
|
91878
|
-
});
|
|
91879
|
-
return yield* try_({
|
|
91880
|
-
try: () => JSON.parse(body),
|
|
91881
|
-
catch: (cause) => new CmmdSyncError({
|
|
91882
|
-
statusCode: 200,
|
|
91883
|
-
body: String(cause)
|
|
91884
|
-
})
|
|
91885
|
-
});
|
|
91886
|
-
});
|
|
91887
|
-
return { syncTurn };
|
|
91888
|
-
}));
|
|
91889
|
-
//#endregion
|
|
91890
|
-
//#region src/persistence/Services/ProjectionProjects.ts
|
|
91891
|
-
/**
|
|
91892
|
-
* ProjectionProjectRepository - Projection repository interface for projects.
|
|
91893
|
-
*
|
|
91894
|
-
* Owns persistence operations for project rows in the orchestration projection
|
|
91895
|
-
* read model.
|
|
91896
|
-
*
|
|
91897
|
-
* @module ProjectionProjectRepository
|
|
91898
|
-
*/
|
|
91899
|
-
const ProjectionProject = Struct({
|
|
91900
|
-
projectId: ProjectId,
|
|
91901
|
-
title: String$1,
|
|
91902
|
-
workspaceRoot: String$1,
|
|
91903
|
-
defaultModelSelection: NullOr(ModelSelection),
|
|
91904
|
-
defaultThreadEnvMode: NullOr(ThreadEnvMode),
|
|
91905
|
-
scripts: ArraySchema(ProjectScript),
|
|
91906
|
-
createdAt: IsoDateTime,
|
|
91907
|
-
updatedAt: IsoDateTime,
|
|
91908
|
-
deletedAt: NullOr(IsoDateTime)
|
|
91909
|
-
});
|
|
91910
|
-
const GetProjectionProjectInput = Struct({ projectId: ProjectId });
|
|
91911
|
-
const DeleteProjectionProjectInput = Struct({ projectId: ProjectId });
|
|
91912
|
-
/**
|
|
91913
|
-
* ProjectionProjectRepository - Service tag for project projection persistence.
|
|
91914
|
-
*/
|
|
91915
|
-
var ProjectionProjectRepository = class extends Service$1()("forge/persistence/Services/ProjectionProjects/ProjectionProjectRepository") {};
|
|
91916
|
-
//#endregion
|
|
91917
|
-
//#region src/persistence/Services/ProjectionThreadMessages.ts
|
|
91918
|
-
/**
|
|
91919
|
-
* ProjectionThreadMessageRepository - Projection repository interface for messages.
|
|
91920
|
-
*
|
|
91921
|
-
* Owns persistence operations for projected thread messages rendered in the
|
|
91922
|
-
* orchestration read model.
|
|
91923
|
-
*
|
|
91924
|
-
* @module ProjectionThreadMessageRepository
|
|
91925
|
-
*/
|
|
91926
|
-
const ProjectionThreadMessage = Struct({
|
|
91927
|
-
messageId: MessageId,
|
|
91928
|
-
threadId: ThreadId,
|
|
91929
|
-
turnId: NullOr(TurnId),
|
|
91930
|
-
role: OrchestrationMessageRole,
|
|
91931
|
-
text: String$1,
|
|
91932
|
-
attachments: optional$4(ArraySchema(ChatAttachment)),
|
|
91933
|
-
isStreaming: Boolean$1,
|
|
91934
|
-
createdAt: IsoDateTime,
|
|
91935
|
-
updatedAt: IsoDateTime
|
|
91936
|
-
});
|
|
91937
|
-
const ListProjectionThreadMessagesInput = Struct({ threadId: ThreadId });
|
|
91938
|
-
const GetProjectionThreadMessageInput = Struct({ messageId: MessageId });
|
|
91939
|
-
const DeleteProjectionThreadMessagesInput = Struct({ threadId: ThreadId });
|
|
91940
|
-
/**
|
|
91941
|
-
* ProjectionThreadMessageRepository - Service tag for message projection persistence.
|
|
91942
|
-
*/
|
|
91943
|
-
var ProjectionThreadMessageRepository = class extends Service$1()("forge/persistence/Services/ProjectionThreadMessages/ProjectionThreadMessageRepository") {};
|
|
91944
|
-
//#endregion
|
|
91945
|
-
//#region src/persistence/Services/ProjectionThreads.ts
|
|
91946
|
-
/**
|
|
91947
|
-
* ProjectionThreadRepository - Projection repository interface for threads.
|
|
91948
|
-
*
|
|
91949
|
-
* Owns persistence operations for projected thread records in the
|
|
91950
|
-
* orchestration read model.
|
|
91951
|
-
*
|
|
91952
|
-
* @module ProjectionThreadRepository
|
|
91953
|
-
*/
|
|
91954
|
-
const ProjectionThread = Struct({
|
|
91955
|
-
threadId: ThreadId,
|
|
91956
|
-
projectId: ProjectId,
|
|
91957
|
-
title: String$1,
|
|
91958
|
-
modelSelection: ModelSelection,
|
|
91959
|
-
runtimeMode: RuntimeMode$1,
|
|
91960
|
-
interactionMode: ProviderInteractionMode,
|
|
91961
|
-
branch: NullOr(String$1),
|
|
91962
|
-
worktreePath: NullOr(String$1),
|
|
91963
|
-
latestTurnId: NullOr(TurnId),
|
|
91964
|
-
createdAt: IsoDateTime,
|
|
91965
|
-
updatedAt: IsoDateTime,
|
|
91966
|
-
archivedAt: NullOr(IsoDateTime),
|
|
91967
|
-
settledAt: NullOr(IsoDateTime),
|
|
91968
|
-
settledOverride: NullOr(Literals(["settled", "active"])),
|
|
91969
|
-
latestUserMessageAt: NullOr(IsoDateTime),
|
|
91970
|
-
pendingApprovalCount: NonNegativeInt,
|
|
91971
|
-
pendingUserInputCount: NonNegativeInt,
|
|
91972
|
-
hasActionableProposedPlan: NonNegativeInt,
|
|
91973
|
-
deletedAt: NullOr(IsoDateTime),
|
|
91974
|
-
kind: ThreadKind.pipe(withDecodingDefault(succeed("master"))),
|
|
91975
|
-
parentThreadId: NullOr(ThreadId).pipe(withDecodingDefault(succeed(null))),
|
|
91976
|
-
anchorKind: CmmdAnchorKind.pipe(withDecodingDefault(succeed("scratch"))),
|
|
91977
|
-
anchorCmmdId: NullOr(String$1).pipe(withDecodingDefault(succeed(null))),
|
|
91978
|
-
linkedPullRequest: optionalKey(NullOr(LinkedPullRequest)),
|
|
91979
|
-
status: ThreadStatus.pipe(withDecodingDefault(succeed("idle"))),
|
|
91980
|
-
workerRole: NullOr(WorkerRole).pipe(withDecodingDefault(succeed(null))),
|
|
91981
|
-
goal: NullOr(String$1).pipe(withDecodingDefault(succeed(null))),
|
|
91982
|
-
titleRegeneration: NullOr(ThreadTitleRegeneration).pipe(withDecodingDefault(succeed(null))),
|
|
91983
|
-
pendingAutoCreatePrompt: optional$4(NullOr(AutoCreateTaskPrompt)).pipe(withDecodingDefault(succeed(null))),
|
|
91984
|
-
rateLimitStatus: optional$4(ArraySchema(ThreadProviderRateLimitStatus)).pipe(withDecodingDefault(succeed([])))
|
|
91985
|
-
});
|
|
91986
|
-
const GetProjectionThreadInput = Struct({ threadId: ThreadId });
|
|
91987
|
-
const DeleteProjectionThreadInput = Struct({ threadId: ThreadId });
|
|
91988
|
-
const ListProjectionThreadsByProjectInput = Struct({ projectId: ProjectId });
|
|
91989
|
-
/**
|
|
91990
|
-
* ProjectionThreadRepository - Service tag for thread projection persistence.
|
|
91991
|
-
*/
|
|
91992
|
-
var ProjectionThreadRepository = class extends Service$1()("forge/persistence/Services/ProjectionThreads/ProjectionThreadRepository") {};
|
|
91993
|
-
//#endregion
|
|
91994
|
-
//#region src/cmmdSync/TurnSerializer.ts
|
|
91995
|
-
var TurnSerializer = class extends Service$1()("forge/cmmdSync/TurnSerializer") {};
|
|
91996
|
-
const TurnSerializerLive = effect(TurnSerializer, gen(function* () {
|
|
91997
|
-
const threadRepo = yield* ProjectionThreadRepository;
|
|
91998
|
-
const projectRepo = yield* ProjectionProjectRepository;
|
|
91999
|
-
const messageRepo = yield* ProjectionThreadMessageRepository;
|
|
92000
|
-
const buildPayload = (threadId, turnId, completedAt) => gen(function* () {
|
|
92001
|
-
const maybeThread = yield* threadRepo.getById({ threadId }).pipe(orDie);
|
|
92002
|
-
if (isNone(maybeThread)) return yield* die$1(/* @__PURE__ */ new Error(`Thread ${threadId} not found for CMMD sync`));
|
|
92003
|
-
const thread = maybeThread.value;
|
|
92004
|
-
const maybeProject = yield* projectRepo.getById({ projectId: thread.projectId }).pipe(orDie);
|
|
92005
|
-
if (isNone(maybeProject)) return yield* die$1(/* @__PURE__ */ new Error(`Project ${thread.projectId} not found for CMMD sync`));
|
|
92006
|
-
const project = maybeProject.value;
|
|
92007
|
-
const turnMsgs = (yield* messageRepo.listByThreadId({ threadId }).pipe(orDie)).filter((m) => m.turnId === turnId);
|
|
92008
|
-
const userMsg = turnMsgs.find((m) => m.role === "user")?.text ?? "";
|
|
92009
|
-
const assistantMsg = turnMsgs.find((m) => m.role === "assistant")?.text ?? "";
|
|
92010
|
-
const startedAt = turnMsgs.find((m) => m.role === "user")?.createdAt ?? completedAt;
|
|
92011
|
-
return {
|
|
92012
|
-
forgeSessionId: threadId,
|
|
92013
|
-
forgeTurnId: turnId,
|
|
92014
|
-
workspaceId: null,
|
|
92015
|
-
userId: null,
|
|
92016
|
-
projectPath: project.workspaceRoot,
|
|
92017
|
-
projectTitle: project.title,
|
|
92018
|
-
threadTitle: thread.title,
|
|
92019
|
-
model: thread.modelSelection.model,
|
|
92020
|
-
branch: thread.branch,
|
|
92021
|
-
userMessage: userMsg,
|
|
92022
|
-
assistantMessage: assistantMsg,
|
|
92023
|
-
toolCalls: [],
|
|
92024
|
-
status: "complete",
|
|
92025
|
-
startedAt,
|
|
92026
|
-
completedAt,
|
|
92027
|
-
forgeVersion: version$1
|
|
92028
|
-
};
|
|
92029
|
-
});
|
|
92030
|
-
return { buildPayload };
|
|
92031
|
-
}));
|
|
92032
|
-
//#endregion
|
|
92033
|
-
//#region src/cmmdSync/TurnCompletionWatcher.ts
|
|
92034
|
-
var TurnCompletionWatcher = class extends Service$1()("forge/cmmdSync/TurnCompletionWatcher") {};
|
|
92035
|
-
const isTurnDiffCompleted = (e) => e.type === "thread.turn-diff-completed";
|
|
92036
|
-
const TurnCompletionWatcherLive = effect(TurnCompletionWatcher, gen(function* () {
|
|
92037
|
-
const engine = yield* OrchestrationEngineService;
|
|
92038
|
-
const serializer = yield* TurnSerializer;
|
|
92039
|
-
const syncClient = yield* CmmdSyncClient;
|
|
92040
|
-
const serverSettings = yield* ServerSettingsService;
|
|
92041
|
-
const sql = yield* SqlClient;
|
|
92042
|
-
const enqueueForRetry = (threadId, turnId, payloadJson) => sql`
|
|
92043
|
-
INSERT INTO cmmd_session_sync_queue
|
|
92044
|
-
(thread_id, turn_id, payload_json, status, attempt_count, created_at)
|
|
92045
|
-
VALUES
|
|
92046
|
-
(${threadId}, ${turnId}, ${payloadJson}, 'pending', 0, ${(/* @__PURE__ */ new Date()).toISOString()})
|
|
92047
|
-
ON CONFLICT (turn_id) DO NOTHING
|
|
92048
|
-
`.pipe(orDie);
|
|
92049
|
-
const processEvent = (event) => gen(function* () {
|
|
92050
|
-
const settings = yield* serverSettings.getSettings.pipe(orDie);
|
|
92051
|
-
if (!settings.providers.cmmd.enabled || !settings.providers.cmmd.apiKey) return;
|
|
92052
|
-
const { threadId, turnId, completedAt } = event.payload;
|
|
92053
|
-
const turnPayload = yield* serializer.buildPayload(threadId, turnId, completedAt);
|
|
92054
|
-
yield* syncClient.syncTurn(turnPayload).pipe(catch_((err) => gen(function* () {
|
|
92055
|
-
yield* logWarning$1("CMMD sync: push failed, queuing for retry", {
|
|
92056
|
-
threadId,
|
|
92057
|
-
turnId,
|
|
92058
|
-
statusCode: err.statusCode
|
|
92059
|
-
});
|
|
92060
|
-
if (err.statusCode === 0 || err.statusCode >= 500) yield* enqueueForRetry(threadId, turnId, JSON.stringify(turnPayload));
|
|
92061
|
-
})));
|
|
92062
|
-
}).pipe(catchCause((cause) => logError("CMMD sync: unhandled error in turn watcher", {
|
|
92063
|
-
cause,
|
|
92064
|
-
threadId: event.payload.threadId,
|
|
92065
|
-
turnId: event.payload.turnId
|
|
92066
|
-
})));
|
|
92067
|
-
const start = () => engine.streamDomainEvents.pipe(filter$2(isTurnDiffCompleted), mapEffect$1(processEvent, { concurrency: 1 }), runDrain, forkScoped, asVoid);
|
|
92068
|
-
return { start };
|
|
92069
|
-
}));
|
|
92070
|
-
//#endregion
|
|
92071
|
-
//#region src/cmmdSync/SyncWorker.ts
|
|
92072
|
-
const MAX_ATTEMPTS = 5;
|
|
92073
|
-
const DRAIN_BATCH = 10;
|
|
92074
|
-
var CmmdSyncWorker = class extends Service$1()("forge/cmmdSync/CmmdSyncWorker") {};
|
|
92075
|
-
/**
|
|
92076
|
-
* Recovers rows that were set to 'in_flight' before a server crash.
|
|
92077
|
-
*
|
|
92078
|
-
* Exported so regression tests can call it directly through the test's SqlClient
|
|
92079
|
-
* (same ambient context) while verifying the exact production SQL path.
|
|
92080
|
-
* `start()` delegates to this constant.
|
|
92081
|
-
*/
|
|
92082
|
-
const resetOrphanedInFlightRows = gen(function* () {
|
|
92083
|
-
yield* (yield* SqlClient)`
|
|
92084
|
-
UPDATE cmmd_session_sync_queue SET status = 'pending'
|
|
92085
|
-
WHERE status = 'in_flight'
|
|
92086
|
-
`.pipe(orDie);
|
|
92087
|
-
});
|
|
92088
|
-
const CmmdSyncWorkerLive = effect(CmmdSyncWorker, gen(function* () {
|
|
92089
|
-
const syncClient = yield* CmmdSyncClient;
|
|
92090
|
-
const serverSettings = yield* ServerSettingsService;
|
|
92091
|
-
const sql = yield* SqlClient;
|
|
92092
|
-
const processRow = (row) => gen(function* () {
|
|
92093
|
-
yield* sql`
|
|
92094
|
-
UPDATE cmmd_session_sync_queue
|
|
92095
|
-
SET status = 'in_flight', attempt_count = attempt_count + 1, last_attempted_at = ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
92096
|
-
WHERE turn_id = ${row.turn_id}
|
|
92097
|
-
`.pipe(orDie);
|
|
92098
|
-
const payload = JSON.parse(row.payload_json);
|
|
92099
|
-
yield* syncClient.syncTurn(payload).pipe(flatMap(() => sql`DELETE FROM cmmd_session_sync_queue WHERE turn_id = ${row.turn_id}`.pipe(orDie)), catch_((err) => gen(function* () {
|
|
92100
|
-
const isClientError = err.statusCode >= 400 && err.statusCode < 500;
|
|
92101
|
-
const exhausted = row.attempt_count + 1 >= MAX_ATTEMPTS;
|
|
92102
|
-
const nextStatus = isClientError || exhausted ? "failed" : "pending";
|
|
92103
|
-
yield* sql`
|
|
92104
|
-
UPDATE cmmd_session_sync_queue
|
|
92105
|
-
SET status = ${nextStatus}
|
|
92106
|
-
WHERE turn_id = ${row.turn_id}
|
|
92107
|
-
`.pipe(orDie);
|
|
92108
|
-
if (nextStatus === "failed") yield* logWarning$1("CMMD sync: turn permanently failed", {
|
|
92109
|
-
turnId: row.turn_id,
|
|
92110
|
-
threadId: row.thread_id,
|
|
92111
|
-
statusCode: err.statusCode,
|
|
92112
|
-
attempts: row.attempt_count + 1
|
|
92113
|
-
});
|
|
92114
|
-
})), catchCause((cause) => gen(function* () {
|
|
92115
|
-
const nextStatus = row.attempt_count + 1 >= MAX_ATTEMPTS ? "failed" : "pending";
|
|
92116
|
-
yield* sql`
|
|
92117
|
-
UPDATE cmmd_session_sync_queue
|
|
92118
|
-
SET status = ${nextStatus}
|
|
92119
|
-
WHERE turn_id = ${row.turn_id}
|
|
92120
|
-
`.pipe(orDie);
|
|
92121
|
-
yield* logError("CMMD sync: unhandled defect in processRow", {
|
|
92122
|
-
turnId: row.turn_id,
|
|
92123
|
-
threadId: row.thread_id,
|
|
92124
|
-
cause,
|
|
92125
|
-
nextStatus
|
|
92126
|
-
});
|
|
92127
|
-
})));
|
|
92128
|
-
});
|
|
92129
|
-
const drainQueue = gen(function* () {
|
|
92130
|
-
const settings = yield* serverSettings.getSettings.pipe(orDie);
|
|
92131
|
-
if (!settings.providers.cmmd.enabled || !settings.providers.cmmd.apiKey) return;
|
|
92132
|
-
yield* forEach(yield* sql`
|
|
92133
|
-
SELECT turn_id, thread_id, payload_json, attempt_count
|
|
92134
|
-
FROM cmmd_session_sync_queue
|
|
92135
|
-
WHERE status = 'pending'
|
|
92136
|
-
ORDER BY created_at ASC
|
|
92137
|
-
LIMIT ${DRAIN_BATCH}
|
|
92138
|
-
`.pipe(orDie), processRow, { concurrency: 1 });
|
|
92139
|
-
});
|
|
92140
|
-
const start = () => resetOrphanedInFlightRows.pipe(provideService(SqlClient, sql), andThen(drainQueue.pipe(catchCause((cause) => logError("CMMD sync worker: unexpected error during drain", { cause })), repeat(spaced("30 seconds")), forkScoped, asVoid)));
|
|
92141
|
-
return { start };
|
|
92142
|
-
}));
|
|
92143
|
-
//#endregion
|
|
92144
91916
|
//#region src/runtimeReplication/Services/RuntimeReplication.ts
|
|
92145
91917
|
var RuntimeReplication = class extends Service$1()("forge/runtimeReplication/Services/RuntimeReplication") {};
|
|
92146
91918
|
//#endregion
|
|
@@ -92604,8 +92376,33 @@ const replicaEventKinds = new Set([
|
|
|
92604
92376
|
"activity_summary",
|
|
92605
92377
|
"turn_status",
|
|
92606
92378
|
"error_summary",
|
|
92607
|
-
"tool_call"
|
|
92379
|
+
"tool_call",
|
|
92380
|
+
"turn_usage"
|
|
92608
92381
|
]);
|
|
92382
|
+
const turnUsageTokenKeys = [
|
|
92383
|
+
"uncachedInputTokens",
|
|
92384
|
+
"cachedInputTokens",
|
|
92385
|
+
"cacheCreationTokens",
|
|
92386
|
+
"outputTokens",
|
|
92387
|
+
"reasoningTokens"
|
|
92388
|
+
];
|
|
92389
|
+
function isNonNegativeInt(value) {
|
|
92390
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
92391
|
+
}
|
|
92392
|
+
/** `usage` is null for an Unreported turn, otherwise exactly the five buckets. */
|
|
92393
|
+
function isValidTurnUsageTokens(value) {
|
|
92394
|
+
if (value === null) return true;
|
|
92395
|
+
if (!isRecord$16(value)) return false;
|
|
92396
|
+
return turnUsageTokenKeys.every((key) => isNonNegativeInt(value[key])) && Object.keys(value).every((key) => turnUsageTokenKeys.includes(key));
|
|
92397
|
+
}
|
|
92398
|
+
/** A turn_usage row: no text, no status, and its record in `payload`. */
|
|
92399
|
+
function hasValidTurnUsagePayload(value) {
|
|
92400
|
+
const payload = value.payload;
|
|
92401
|
+
return value.text === null && value.status === null && typeof value.turnId === "string" && value.turnId.length > 0 && isRecord$16(payload) && isNonBlankString(payload.provider) && isNonBlankString(payload.model) && "usage" in payload && isValidTurnUsageTokens(payload.usage);
|
|
92402
|
+
}
|
|
92403
|
+
function hasValidEventTurn(value) {
|
|
92404
|
+
return !("turnId" in value) || value.turnId === null || isNonBlankString(value.turnId);
|
|
92405
|
+
}
|
|
92609
92406
|
const replicaTurnStatuses$1 = new Set([
|
|
92610
92407
|
"pending",
|
|
92611
92408
|
"running",
|
|
@@ -92625,9 +92422,10 @@ function hasEventPayloadKey(value) {
|
|
|
92625
92422
|
return value.kind !== "tool_call" || "payload" in value;
|
|
92626
92423
|
}
|
|
92627
92424
|
function hasValidEventFields(value) {
|
|
92628
|
-
return hasValidEventSequence(value.sequence) && isNonBlankString(value.eventId) && replicaEventKinds.has(value.kind) && nullableString(value.text) && hasValidEventStatus(value) && hasEventPayloadKey(value) && isIsoDateTime(value.occurredAt);
|
|
92425
|
+
return hasValidEventSequence(value.sequence) && isNonBlankString(value.eventId) && replicaEventKinds.has(value.kind) && hasValidEventTurn(value) && nullableString(value.text) && hasValidEventStatus(value) && hasEventPayloadKey(value) && isIsoDateTime(value.occurredAt);
|
|
92629
92426
|
}
|
|
92630
92427
|
function hasValidEventPayload(value) {
|
|
92428
|
+
if (value.kind === "turn_usage") return hasValidTurnUsagePayload(value);
|
|
92631
92429
|
if (value.kind === "turn_status") return value.text === null && value.status !== null;
|
|
92632
92430
|
if (value.kind === "tool_call") return isNonBlankString(value.text) && value.status !== null;
|
|
92633
92431
|
return isNonBlankString(value.text) && value.status === null;
|
|
@@ -92734,28 +92532,41 @@ const REPLICA_MESSAGE_ID_PREFIX = "replica-source-v1:";
|
|
|
92734
92532
|
function isReservedReplicaSourceMessageId(value) {
|
|
92735
92533
|
return value.startsWith(REPLICA_MESSAGE_ID_PREFIX);
|
|
92736
92534
|
}
|
|
92535
|
+
/**
|
|
92536
|
+
* A hydrated message keeps its CMMD turn inside its id rather than in the
|
|
92537
|
+
* projection's `turnId`: `retainThreadMessagesAfterRevert` drops messages whose
|
|
92538
|
+
* turn is not among the local checkpoints, and a hydrated thread has none, so
|
|
92539
|
+
* a later local revert would erase recovered history. The id is the one slot
|
|
92540
|
+
* the serializer can read back without touching revert semantics.
|
|
92541
|
+
*/
|
|
92737
92542
|
function encodeReplicaSourceMessageId(input) {
|
|
92738
|
-
|
|
92543
|
+
const base = `${REPLICA_MESSAGE_ID_PREFIX}${input.sequence}:${Buffer.from(input.scope).toString("base64url")}:${Buffer.from(input.eventId).toString("base64url")}`;
|
|
92544
|
+
return input.turnId ? `${base}:${Buffer.from(input.turnId).toString("base64url")}` : base;
|
|
92545
|
+
}
|
|
92546
|
+
/** Decodes one base64url segment, or null when it does not round-trip exactly. */
|
|
92547
|
+
function decodeExactSegment(encoded) {
|
|
92548
|
+
const decoded = Buffer.from(encoded, "base64url").toString("utf8");
|
|
92549
|
+
return decoded.length > 0 && Buffer.from(decoded).toString("base64url") === encoded ? decoded : null;
|
|
92739
92550
|
}
|
|
92740
92551
|
function decodeReplicaSourceMessageId(value) {
|
|
92741
92552
|
if (!value.startsWith(REPLICA_MESSAGE_ID_PREFIX)) return null;
|
|
92742
|
-
const
|
|
92743
|
-
|
|
92744
|
-
|
|
92745
|
-
const sequence = Number(value.slice(18, sequenceSeparator));
|
|
92553
|
+
const [sequenceText, encodedScope, encodedEventId, encodedTurnId, ...rest] = value.slice(18).split(":");
|
|
92554
|
+
if (rest.length > 0 || encodedScope === void 0 || encodedEventId === void 0) return null;
|
|
92555
|
+
const sequence = Number(sequenceText);
|
|
92746
92556
|
if (!Number.isSafeInteger(sequence) || sequence <= 0) return null;
|
|
92747
|
-
|
|
92748
|
-
|
|
92749
|
-
|
|
92750
|
-
|
|
92751
|
-
|
|
92752
|
-
|
|
92753
|
-
|
|
92754
|
-
|
|
92755
|
-
|
|
92756
|
-
|
|
92757
|
-
|
|
92758
|
-
|
|
92557
|
+
const scope = decodeExactSegment(encodedScope);
|
|
92558
|
+
const eventId = decodeExactSegment(encodedEventId);
|
|
92559
|
+
if (scope === null || eventId === null) return null;
|
|
92560
|
+
if (encodedTurnId === void 0) return {
|
|
92561
|
+
sequence,
|
|
92562
|
+
eventId
|
|
92563
|
+
};
|
|
92564
|
+
const turnId = decodeExactSegment(encodedTurnId);
|
|
92565
|
+
return turnId === null ? null : {
|
|
92566
|
+
sequence,
|
|
92567
|
+
eventId,
|
|
92568
|
+
turnId
|
|
92569
|
+
};
|
|
92759
92570
|
}
|
|
92760
92571
|
var RuntimeThreadHistoryConflict = class extends Error {
|
|
92761
92572
|
constructor(message) {
|
|
@@ -92773,22 +92584,50 @@ function runtimeThreadFinalGenerationId(runtimeId, streamKey, events) {
|
|
|
92773
92584
|
const projectionHash = Crypto.createHash("sha256").update(JSON.stringify(events)).digest("base64url");
|
|
92774
92585
|
return `${runtimeThreadGenerationId(runtimeId, streamKey)}:final:${projectionHash}`;
|
|
92775
92586
|
}
|
|
92587
|
+
function canonicalKindFields(event) {
|
|
92588
|
+
switch (event.kind) {
|
|
92589
|
+
case "user_message":
|
|
92590
|
+
case "assistant_message": return { text: event.text };
|
|
92591
|
+
case "activity_summary":
|
|
92592
|
+
case "error_summary": return { summary: event.summary };
|
|
92593
|
+
case "turn_status": return { status: event.status };
|
|
92594
|
+
case "tool_call": return {
|
|
92595
|
+
summary: event.summary,
|
|
92596
|
+
status: event.status,
|
|
92597
|
+
...event.payload !== void 0 ? { payload: event.payload } : {}
|
|
92598
|
+
};
|
|
92599
|
+
case "turn_usage": return canonicalTurnUsageFields(event);
|
|
92600
|
+
}
|
|
92601
|
+
}
|
|
92602
|
+
/**
|
|
92603
|
+
* CMMD's forge-runtime-thread-replication-protocol.ts builds this object in
|
|
92604
|
+
* the same order and rejects a batch whose hash differs. `turnId` comes after
|
|
92605
|
+
* every kind-specific field so an event sent without one hashes byte for byte
|
|
92606
|
+
* as it did before recorded turns existed.
|
|
92607
|
+
*/
|
|
92776
92608
|
function canonicalEventPayload(event) {
|
|
92777
92609
|
return JSON.stringify({
|
|
92778
92610
|
sequence: event.sequence,
|
|
92779
92611
|
eventId: event.eventId,
|
|
92780
92612
|
occurredAt: event.occurredAt,
|
|
92781
92613
|
kind: event.kind,
|
|
92782
|
-
...event
|
|
92783
|
-
...event.
|
|
92784
|
-
...event.kind === "turn_status" ? { status: event.status } : {},
|
|
92785
|
-
...event.kind === "tool_call" ? {
|
|
92786
|
-
summary: event.summary,
|
|
92787
|
-
status: event.status,
|
|
92788
|
-
...event.payload !== void 0 ? { payload: event.payload } : {}
|
|
92789
|
-
} : {}
|
|
92614
|
+
...canonicalKindFields(event),
|
|
92615
|
+
...event.turnId !== void 0 ? { turnId: event.turnId } : {}
|
|
92790
92616
|
});
|
|
92791
92617
|
}
|
|
92618
|
+
function canonicalTurnUsageFields(event) {
|
|
92619
|
+
return {
|
|
92620
|
+
provider: event.provider,
|
|
92621
|
+
model: event.model,
|
|
92622
|
+
usage: event.usage === null ? null : {
|
|
92623
|
+
uncachedInputTokens: event.usage.uncachedInputTokens,
|
|
92624
|
+
cachedInputTokens: event.usage.cachedInputTokens,
|
|
92625
|
+
cacheCreationTokens: event.usage.cacheCreationTokens,
|
|
92626
|
+
outputTokens: event.usage.outputTokens,
|
|
92627
|
+
reasoningTokens: event.usage.reasoningTokens
|
|
92628
|
+
}
|
|
92629
|
+
};
|
|
92630
|
+
}
|
|
92792
92631
|
function hashRuntimeThreadEvent(event) {
|
|
92793
92632
|
return sha256$3(canonicalEventPayload(event));
|
|
92794
92633
|
}
|
|
@@ -92909,7 +92748,8 @@ function replicaMessage(runtimeId, generationId, event) {
|
|
|
92909
92748
|
id: MessageId.make(encodeReplicaSourceMessageId({
|
|
92910
92749
|
sequence: event.sequence,
|
|
92911
92750
|
scope: stableReplicaDigest(runtimeId, generationId),
|
|
92912
|
-
eventId: event.eventId
|
|
92751
|
+
eventId: event.eventId,
|
|
92752
|
+
turnId: event.turnId ?? null
|
|
92913
92753
|
})),
|
|
92914
92754
|
role: event.kind === "user_message" ? "user" : "assistant",
|
|
92915
92755
|
text: event.text ?? "",
|
|
@@ -92919,11 +92759,33 @@ function replicaMessage(runtimeId, generationId, event) {
|
|
|
92919
92759
|
updatedAt: event.occurredAt
|
|
92920
92760
|
};
|
|
92921
92761
|
}
|
|
92922
|
-
function
|
|
92923
|
-
const
|
|
92762
|
+
function replicaTurnUsage(event) {
|
|
92763
|
+
const payload = event.payload;
|
|
92764
|
+
return {
|
|
92765
|
+
eventId: event.eventId,
|
|
92766
|
+
occurredAt: event.occurredAt,
|
|
92767
|
+
kind: "turn_usage",
|
|
92768
|
+
turnId: event.turnId,
|
|
92769
|
+
provider: payload.provider,
|
|
92770
|
+
model: payload.model,
|
|
92771
|
+
usage: payload.usage === null ? null : {
|
|
92772
|
+
uncachedInputTokens: payload.usage.uncachedInputTokens,
|
|
92773
|
+
cachedInputTokens: payload.usage.cachedInputTokens,
|
|
92774
|
+
cacheCreationTokens: payload.usage.cacheCreationTokens,
|
|
92775
|
+
outputTokens: payload.usage.outputTokens,
|
|
92776
|
+
reasoningTokens: payload.usage.reasoningTokens
|
|
92777
|
+
}
|
|
92778
|
+
};
|
|
92779
|
+
}
|
|
92780
|
+
function replicaEventBase(event) {
|
|
92781
|
+
const turn = typeof event.turnId === "string" ? { turnId: event.turnId } : {};
|
|
92782
|
+
return {
|
|
92924
92783
|
eventId: event.eventId,
|
|
92925
|
-
occurredAt: event.occurredAt
|
|
92784
|
+
occurredAt: event.occurredAt,
|
|
92785
|
+
...turn
|
|
92926
92786
|
};
|
|
92787
|
+
}
|
|
92788
|
+
function replicaTextEvent(event, base) {
|
|
92927
92789
|
switch (event.kind) {
|
|
92928
92790
|
case "user_message":
|
|
92929
92791
|
case "assistant_message": return {
|
|
@@ -92937,31 +92799,50 @@ function replicaSourceEvent(event) {
|
|
|
92937
92799
|
kind: event.kind,
|
|
92938
92800
|
summary: event.text
|
|
92939
92801
|
};
|
|
92940
|
-
|
|
92941
|
-
...base,
|
|
92942
|
-
kind: event.kind,
|
|
92943
|
-
status: event.status
|
|
92944
|
-
};
|
|
92945
|
-
case "tool_call": return {
|
|
92946
|
-
...base,
|
|
92947
|
-
kind: event.kind,
|
|
92948
|
-
summary: event.text,
|
|
92949
|
-
status: event.status,
|
|
92950
|
-
payload: event.payload ?? void 0
|
|
92951
|
-
};
|
|
92802
|
+
default: return null;
|
|
92952
92803
|
}
|
|
92953
92804
|
}
|
|
92805
|
+
function replicaSourceEvent(event) {
|
|
92806
|
+
const base = replicaEventBase(event);
|
|
92807
|
+
const textEvent = replicaTextEvent(event, base);
|
|
92808
|
+
if (textEvent !== null) return textEvent;
|
|
92809
|
+
if (event.kind === "turn_usage") return replicaTurnUsage(event);
|
|
92810
|
+
if (event.kind === "turn_status") return {
|
|
92811
|
+
...base,
|
|
92812
|
+
kind: event.kind,
|
|
92813
|
+
status: replicaTurnStatus(event)
|
|
92814
|
+
};
|
|
92815
|
+
return {
|
|
92816
|
+
...base,
|
|
92817
|
+
kind: "tool_call",
|
|
92818
|
+
summary: event.text,
|
|
92819
|
+
status: event.status,
|
|
92820
|
+
payload: event.payload ?? void 0
|
|
92821
|
+
};
|
|
92822
|
+
}
|
|
92823
|
+
function replicaTurnStatus(event) {
|
|
92824
|
+
return event.status;
|
|
92825
|
+
}
|
|
92826
|
+
function replicaActivitySummary(event) {
|
|
92827
|
+
if (event.kind === "turn_status") return event.status ?? "unknown";
|
|
92828
|
+
if (event.kind === "turn_usage") return "Turn usage recorded";
|
|
92829
|
+
return event.text ?? "";
|
|
92830
|
+
}
|
|
92831
|
+
function replicaActivityTone(event) {
|
|
92832
|
+
const failed = event.kind === "turn_status" && event.status === "failed";
|
|
92833
|
+
return event.kind === "error_summary" || failed ? "error" : "info";
|
|
92834
|
+
}
|
|
92954
92835
|
function replicaActivity(runtimeId, generationId, event) {
|
|
92955
|
-
const summary = event.kind === "turn_status" ? event.status ?? "unknown" : event.text ?? "";
|
|
92956
92836
|
return {
|
|
92957
92837
|
id: EventId.make("replica:" + stableReplicaDigest(runtimeId, generationId, event.eventId, "activity")),
|
|
92958
|
-
tone: event
|
|
92838
|
+
tone: replicaActivityTone(event),
|
|
92959
92839
|
kind: "replica." + event.kind,
|
|
92960
|
-
summary,
|
|
92840
|
+
summary: replicaActivitySummary(event),
|
|
92961
92841
|
payload: {
|
|
92962
92842
|
sourceEventId: event.eventId,
|
|
92963
92843
|
sourceGenerationId: generationId,
|
|
92964
92844
|
sourceRuntimeId: runtimeId,
|
|
92845
|
+
sourceTurnId: typeof event.turnId === "string" ? event.turnId : null,
|
|
92965
92846
|
status: event.status,
|
|
92966
92847
|
text: event.text,
|
|
92967
92848
|
payload: event.payload
|
|
@@ -93686,8 +93567,6 @@ const ServerRuntimeStartupLive = effect(ServerRuntimeStartup, gen(function* () {
|
|
|
93686
93567
|
const serverConfig = yield* ServerConfig;
|
|
93687
93568
|
const keybindings = yield* Keybindings;
|
|
93688
93569
|
const orchestrationReactor = yield* OrchestrationReactor;
|
|
93689
|
-
const turnCompletionWatcher = yield* TurnCompletionWatcher;
|
|
93690
|
-
const cmmdSyncWorker = yield* CmmdSyncWorker;
|
|
93691
93570
|
const runtimeReplication = yield* RuntimeReplication;
|
|
93692
93571
|
const localAutomationRunReconciler = yield* LocalAutomationRunReconciler;
|
|
93693
93572
|
const agentProtocol = yield* AgentProtocolReactor;
|
|
@@ -93724,8 +93603,6 @@ const ServerRuntimeStartupLive = effect(ServerRuntimeStartup, gen(function* () {
|
|
|
93724
93603
|
yield* runStartupPhase("reactors.start", orchestrationReactor.start().pipe(provide$2(reactorScope)));
|
|
93725
93604
|
yield* logDebug("startup phase: reconciling local automation runs");
|
|
93726
93605
|
yield* runStartupPhase("local-automations.reconcile", localAutomationRunReconciler.start().pipe(provide$2(reactorScope)));
|
|
93727
|
-
yield* logDebug("startup phase: starting CMMD session sync");
|
|
93728
|
-
yield* runStartupPhase("cmmd-sync.start", all([turnCompletionWatcher.start().pipe(provide$2(reactorScope)), cmmdSyncWorker.start().pipe(provide$2(reactorScope))]).pipe(asVoid));
|
|
93729
93606
|
yield* logDebug("startup phase: starting CMMD runtime replication");
|
|
93730
93607
|
yield* runStartupPhase("runtime-replication.start", runtimeReplication.start().pipe(provide$2(reactorScope)));
|
|
93731
93608
|
yield* logDebug("startup phase: starting CMMD pipeline reactors");
|
|
@@ -94058,36 +93935,92 @@ function finiteNumber$1(value) {
|
|
|
94058
93935
|
* Entries without both an input and an output rate are dropped: a half-priced
|
|
94059
93936
|
* model would silently under-report cost, which is worse than reporting the
|
|
94060
93937
|
* model as unpriced.
|
|
93938
|
+
*
|
|
93939
|
+
* Entries keep their full normalized key. Collapsing `claude-opus-5` and
|
|
93940
|
+
* `deepinfra/anthropic/claude-opus-5` onto one key let the last one listed win,
|
|
93941
|
+
* and the DeepInfra entry carries no cache-read rate, so cached Claude tokens
|
|
93942
|
+
* were priced at the full input rate. A bare name is aliased only when no
|
|
93943
|
+
* canonical entry claims it and every qualified entry agrees on the rate.
|
|
94061
93944
|
*/
|
|
94062
93945
|
function parseRateTable(document) {
|
|
94063
93946
|
const table = /* @__PURE__ */ new Map();
|
|
94064
93947
|
if (typeof document !== "object" || document === null) return table;
|
|
94065
93948
|
for (const [name, raw] of Object.entries(document)) {
|
|
94066
|
-
|
|
94067
|
-
const
|
|
94068
|
-
|
|
94069
|
-
|
|
94070
|
-
if (input === null || output === null) continue;
|
|
94071
|
-
table.set(normalizeModelName(name), {
|
|
94072
|
-
inputCostPerToken: input,
|
|
94073
|
-
outputCostPerToken: output,
|
|
94074
|
-
cacheReadCostPerToken: finiteNumber$1(entry.cache_read_input_token_cost) ?? input,
|
|
94075
|
-
cacheCreationCostPerToken: finiteNumber$1(entry.cache_creation_input_token_cost) ?? input
|
|
94076
|
-
});
|
|
93949
|
+
const rate = readRate(raw);
|
|
93950
|
+
const key = normalizeRateKey(name);
|
|
93951
|
+
if (rate === null || key.length === 0) continue;
|
|
93952
|
+
table.set(key, rate);
|
|
94077
93953
|
}
|
|
93954
|
+
addBareNameAliases(table);
|
|
94078
93955
|
return table;
|
|
94079
93956
|
}
|
|
93957
|
+
/** One LiteLLM entry's rates, or `null` when it is not priced in full. */
|
|
93958
|
+
function readRate(raw) {
|
|
93959
|
+
if (typeof raw !== "object" || raw === null) return null;
|
|
93960
|
+
const entry = raw;
|
|
93961
|
+
const input = finiteNumber$1(entry.input_cost_per_token);
|
|
93962
|
+
const output = finiteNumber$1(entry.output_cost_per_token);
|
|
93963
|
+
if (input === null || output === null) return null;
|
|
93964
|
+
return {
|
|
93965
|
+
inputCostPerToken: input,
|
|
93966
|
+
outputCostPerToken: output,
|
|
93967
|
+
cacheReadCostPerToken: finiteNumber$1(entry.cache_read_input_token_cost) ?? input,
|
|
93968
|
+
cacheCreationCostPerToken: finiteNumber$1(entry.cache_creation_input_token_cost) ?? input
|
|
93969
|
+
};
|
|
93970
|
+
}
|
|
94080
93971
|
/**
|
|
94081
|
-
*
|
|
93972
|
+
* Lets a bare name resolve when the table only carries qualified spellings of
|
|
93973
|
+
* it, which is how a transcript's `gpt-5.6-terra` reaches `azure/gpt-5.6-terra`.
|
|
94082
93974
|
*
|
|
94083
|
-
*
|
|
94084
|
-
*
|
|
94085
|
-
|
|
93975
|
+
* A canonical entry always wins, and a bare name claimed at two different rates
|
|
93976
|
+
* gets no alias at all: document order is not a tiebreaker.
|
|
93977
|
+
*/
|
|
93978
|
+
function addBareNameAliases(table) {
|
|
93979
|
+
for (const [alias, rate] of bareNameAliasCandidates(table)) if (rate !== null) table.set(alias, rate);
|
|
93980
|
+
}
|
|
93981
|
+
/** The bare name `key` could stand in for, or `null` when it cannot. */
|
|
93982
|
+
function aliasableBareName(table, key) {
|
|
93983
|
+
const alias = bareModelName(key);
|
|
93984
|
+
if (alias.length === 0 || alias === key) return null;
|
|
93985
|
+
return table.has(alias) ? null : alias;
|
|
93986
|
+
}
|
|
93987
|
+
/** Bare names to alias, mapped to `null` where the qualified rates disagree. */
|
|
93988
|
+
function bareNameAliasCandidates(table) {
|
|
93989
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
93990
|
+
for (const [key, rate] of table) {
|
|
93991
|
+
const alias = aliasableBareName(table, key);
|
|
93992
|
+
if (alias === null) continue;
|
|
93993
|
+
const held = candidates.get(alias);
|
|
93994
|
+
if (held === void 0) candidates.set(alias, rate);
|
|
93995
|
+
else if (held !== null && !sameRate(held, rate)) candidates.set(alias, null);
|
|
93996
|
+
}
|
|
93997
|
+
return candidates;
|
|
93998
|
+
}
|
|
93999
|
+
function sameRate(a, b) {
|
|
94000
|
+
return a.inputCostPerToken === b.inputCostPerToken && a.outputCostPerToken === b.outputCostPerToken && a.cacheReadCostPerToken === b.cacheReadCostPerToken && a.cacheCreationCostPerToken === b.cacheCreationCostPerToken;
|
|
94001
|
+
}
|
|
94002
|
+
/**
|
|
94003
|
+
* The key an entry is stored under, and the key a reported model is looked up
|
|
94004
|
+
* by. Trimmed and lowercased only: transcripts are inconsistent about casing,
|
|
94005
|
+
* but a `provider/` prefix names a different row and must survive.
|
|
94006
|
+
*/
|
|
94007
|
+
function normalizeRateKey(model) {
|
|
94008
|
+
return model.trim().toLowerCase();
|
|
94009
|
+
}
|
|
94010
|
+
/** The key with any `provider/` prefix removed. */
|
|
94011
|
+
function bareModelName(key) {
|
|
94012
|
+
const slash = key.lastIndexOf("/");
|
|
94013
|
+
return slash === -1 ? key : key.slice(slash + 1);
|
|
94014
|
+
}
|
|
94015
|
+
/**
|
|
94016
|
+
* Drops a bracketed variant suffix such as `claude-opus-5[1m]`, which Claude
|
|
94017
|
+
* Code writes for the 1M context tier. The rate table only knows the base name,
|
|
94018
|
+
* and we price at the base tier anyway, so a turn on the wide-context tier
|
|
94019
|
+
* would otherwise come back unpriced.
|
|
94086
94020
|
*/
|
|
94087
|
-
function
|
|
94088
|
-
const
|
|
94089
|
-
|
|
94090
|
-
return slash === -1 ? trimmed : trimmed.slice(slash + 1);
|
|
94021
|
+
function stripVariantSuffix(key) {
|
|
94022
|
+
const bracket = key.indexOf("[");
|
|
94023
|
+
return bracket === -1 ? key : key.slice(0, bracket);
|
|
94091
94024
|
}
|
|
94092
94025
|
/**
|
|
94093
94026
|
* Models we never price, regardless of the table.
|
|
@@ -94105,9 +94038,10 @@ const UNPRICEABLE_MODELS = new Set([
|
|
|
94105
94038
|
"fable"
|
|
94106
94039
|
]);
|
|
94107
94040
|
function lookupRate(table, model) {
|
|
94108
|
-
const
|
|
94109
|
-
|
|
94110
|
-
|
|
94041
|
+
const key = stripVariantSuffix(normalizeRateKey(model));
|
|
94042
|
+
const bareName = bareModelName(key);
|
|
94043
|
+
if (bareName.length === 0 || UNPRICEABLE_MODELS.has(bareName)) return null;
|
|
94044
|
+
return table.get(key) ?? null;
|
|
94111
94045
|
}
|
|
94112
94046
|
/**
|
|
94113
94047
|
* Prices a bucket's tokens.
|
|
@@ -94394,7 +94328,15 @@ async function readTranscriptRecords(filePath, provider) {
|
|
|
94394
94328
|
}
|
|
94395
94329
|
//#endregion
|
|
94396
94330
|
//#region src/usage/usageScanCache.ts
|
|
94397
|
-
|
|
94331
|
+
/**
|
|
94332
|
+
* Bumped whenever cached records could differ from what a fresh parse produces.
|
|
94333
|
+
*
|
|
94334
|
+
* Version 1 was written before `parseCodexLine` suppressed the parent history a
|
|
94335
|
+
* forked rollout copies in, so those caches hold every copied record twice. A
|
|
94336
|
+
* transcript never changes after it is written, so a stale entry is a warm hit
|
|
94337
|
+
* forever: only the version discarding the file evicts them.
|
|
94338
|
+
*/
|
|
94339
|
+
const USAGE_SCAN_CACHE_VERSION = 2;
|
|
94398
94340
|
/** Appends `value` to `table` unless it is already there, returning its index. */
|
|
94399
94341
|
function intern(table, index, value) {
|
|
94400
94342
|
const existing = index.get(value);
|
|
@@ -94446,7 +94388,7 @@ function isStringTable(value) {
|
|
|
94446
94388
|
*
|
|
94447
94389
|
* The intern tables must be all strings: a numeric entry would pass the
|
|
94448
94390
|
* per-record undefined guard, land in a record's model, and crash the aggregate
|
|
94449
|
-
*
|
|
94391
|
+
* when that model is priced. A corrupt table rejects the whole cache.
|
|
94450
94392
|
*/
|
|
94451
94393
|
function decodeEnvelope$1(document) {
|
|
94452
94394
|
if (typeof document !== "object" || document === null) return null;
|
|
@@ -94611,7 +94553,7 @@ const RATES_CACHE_FILE = "usage-model-rates.json";
|
|
|
94611
94553
|
const SCAN_CACHE_FILE = "usage-scan-cache.json";
|
|
94612
94554
|
var UsageService = class extends Service$1()("forge/usage/UsageService") {};
|
|
94613
94555
|
succeed$2(UsageService, UsageService.of({ readSummary: (input) => succeed({
|
|
94614
|
-
contractVersion:
|
|
94556
|
+
contractVersion: 2,
|
|
94615
94557
|
readAt: "1970-01-01T00:00:00.000Z",
|
|
94616
94558
|
timeZone: input.timeZone,
|
|
94617
94559
|
sinceDay: input.sinceDay,
|
|
@@ -94891,7 +94833,7 @@ const UsageServiceLive = effect(UsageService, gen(function* () {
|
|
|
94891
94833
|
const readAt = yield* now;
|
|
94892
94834
|
const finishedAtMs = yield* currentTimeMillis;
|
|
94893
94835
|
return {
|
|
94894
|
-
contractVersion:
|
|
94836
|
+
contractVersion: 2,
|
|
94895
94837
|
readAt: formatIso(readAt),
|
|
94896
94838
|
timeZone: input.timeZone,
|
|
94897
94839
|
sinceDay: input.sinceDay,
|
|
@@ -108278,7 +108220,7 @@ const postgresSchemaStatements = [
|
|
|
108278
108220
|
"CREATE TABLE IF NOT EXISTS orchestration_command_receipts (\n command_id TEXT PRIMARY KEY,\n aggregate_kind TEXT NOT NULL,\n aggregate_id TEXT NOT NULL,\n accepted_at TEXT NOT NULL,\n result_sequence INTEGER NOT NULL,\n status TEXT NOT NULL,\n error TEXT\n )",
|
|
108279
108221
|
"CREATE TABLE IF NOT EXISTS checkpoint_diff_blobs (\n thread_id TEXT NOT NULL,\n from_turn_count INTEGER NOT NULL,\n to_turn_count INTEGER NOT NULL,\n diff TEXT NOT NULL,\n created_at TEXT NOT NULL,\n UNIQUE (thread_id, from_turn_count, to_turn_count)\n )",
|
|
108280
108222
|
"CREATE TABLE IF NOT EXISTS provider_session_runtime (\n thread_id TEXT PRIMARY KEY,\n provider_name TEXT NOT NULL,\n adapter_key TEXT NOT NULL,\n runtime_mode TEXT NOT NULL DEFAULT 'full-access',\n status TEXT NOT NULL,\n last_seen_at TEXT NOT NULL,\n resume_cursor_json TEXT,\n runtime_payload_json TEXT\n )",
|
|
108281
|
-
"CREATE TABLE IF NOT EXISTS projection_projects (\n project_id TEXT PRIMARY KEY,\n title TEXT NOT NULL,\n workspace_root TEXT NOT NULL,\n scripts_json TEXT NOT NULL,\n created_at TEXT NOT NULL,\n updated_at TEXT NOT NULL,\n deleted_at TEXT\n , default_model_selection_json TEXT, default_thread_env_mode TEXT)",
|
|
108223
|
+
"CREATE TABLE IF NOT EXISTS projection_projects (\n project_id TEXT PRIMARY KEY,\n title TEXT NOT NULL,\n workspace_root TEXT NOT NULL,\n scripts_json TEXT NOT NULL,\n created_at TEXT NOT NULL,\n updated_at TEXT NOT NULL,\n deleted_at TEXT\n , default_model_selection_json TEXT, default_thread_env_mode TEXT, cmmd_registration_json TEXT)",
|
|
108282
108224
|
"CREATE TABLE IF NOT EXISTS projection_threads (\n thread_id TEXT PRIMARY KEY,\n project_id TEXT NOT NULL,\n title TEXT NOT NULL,\n branch TEXT,\n worktree_path TEXT,\n latest_turn_id TEXT,\n created_at TEXT NOT NULL,\n updated_at TEXT NOT NULL,\n deleted_at TEXT\n , runtime_mode TEXT NOT NULL DEFAULT 'full-access', interaction_mode TEXT NOT NULL DEFAULT 'default', model_selection_json TEXT, archived_at TEXT, latest_user_message_at TEXT, pending_approval_count INTEGER NOT NULL DEFAULT 0, pending_user_input_count INTEGER NOT NULL DEFAULT 0, has_actionable_proposed_plan INTEGER NOT NULL DEFAULT 0, kind TEXT NOT NULL DEFAULT 'master', parent_thread_id TEXT, status TEXT NOT NULL DEFAULT 'idle', anchor_kind TEXT NOT NULL DEFAULT 'scratch', anchor_cmmd_id TEXT, worker_role TEXT DEFAULT NULL, goal TEXT, pending_auto_create_prompt_json TEXT, title_regeneration_json TEXT, rate_limit_status_json TEXT, linked_pull_request_json TEXT, settled_at TEXT, settled_override TEXT)",
|
|
108283
108225
|
"CREATE TABLE IF NOT EXISTS projection_thread_messages (\n message_id TEXT PRIMARY KEY,\n thread_id TEXT NOT NULL,\n turn_id TEXT,\n role TEXT NOT NULL,\n text TEXT NOT NULL,\n is_streaming INTEGER NOT NULL,\n created_at TEXT NOT NULL,\n updated_at TEXT NOT NULL\n , attachments_json TEXT)",
|
|
108284
108226
|
"CREATE TABLE IF NOT EXISTS projection_thread_activities (\n activity_id TEXT PRIMARY KEY,\n thread_id TEXT NOT NULL,\n turn_id TEXT,\n tone TEXT NOT NULL,\n kind TEXT NOT NULL,\n summary TEXT NOT NULL,\n payload_json TEXT NOT NULL,\n created_at TEXT NOT NULL\n , sequence INTEGER)",
|
|
@@ -108549,7 +108491,8 @@ const postgresUpgradeMigrations = new Map([
|
|
|
108549
108491
|
thread_id TEXT NOT NULL PRIMARY KEY,
|
|
108550
108492
|
detail TEXT NOT NULL,
|
|
108551
108493
|
quarantined_at TEXT NOT NULL
|
|
108552
|
-
)`]]
|
|
108494
|
+
)`]],
|
|
108495
|
+
[74, [`ALTER TABLE projection_projects ADD COLUMN IF NOT EXISTS cmmd_registration_json TEXT`]]
|
|
108553
108496
|
]);
|
|
108554
108497
|
function requirePostgresUpgradeStatements(version) {
|
|
108555
108498
|
const statements = postgresUpgradeMigrations.get(version);
|
|
@@ -108575,15 +108518,15 @@ const runPostgresMigrations = fn$1("runPostgresMigrations")(function* () {
|
|
|
108575
108518
|
ORDER BY version DESC
|
|
108576
108519
|
LIMIT 1
|
|
108577
108520
|
`)[0]?.version ?? 0;
|
|
108578
|
-
if (currentVersion >
|
|
108521
|
+
if (currentVersion > 74) return yield* die$1(/* @__PURE__ */ new Error(`Forge Postgres schema ${currentVersion} is newer than server schema 74.`));
|
|
108579
108522
|
if (currentVersion === 0) {
|
|
108580
108523
|
for (const statement of postgresSchemaStatements) yield* sql.unsafe(statement);
|
|
108581
108524
|
yield* sql`
|
|
108582
108525
|
INSERT INTO forge_schema_migrations (version)
|
|
108583
|
-
VALUES (${
|
|
108526
|
+
VALUES (${74})
|
|
108584
108527
|
ON CONFLICT (version) DO NOTHING
|
|
108585
108528
|
`;
|
|
108586
|
-
} else for (let version = currentVersion + 1; version <=
|
|
108529
|
+
} else for (let version = currentVersion + 1; version <= 74; version += 1) {
|
|
108587
108530
|
const statements = yield* sync$1(() => requirePostgresUpgradeStatements(version));
|
|
108588
108531
|
for (const statement of statements) yield* sql.unsafe(statement);
|
|
108589
108532
|
yield* sql`
|
|
@@ -111241,6 +111184,31 @@ var _073_ReplicaThreadQuarantine_default = gen(function* () {
|
|
|
111241
111184
|
`;
|
|
111242
111185
|
});
|
|
111243
111186
|
//#endregion
|
|
111187
|
+
//#region src/persistence/Migrations/074_ProjectCmmdRegistration.ts
|
|
111188
|
+
/**
|
|
111189
|
+
* Let a Checkout say which Registration it was created from.
|
|
111190
|
+
*
|
|
111191
|
+
* A Forge Cloud Environment is per (organization, user), so one Environment
|
|
111192
|
+
* holds every Checkout its owner registered. They all report the sprite's own
|
|
111193
|
+
* root as their workspace root, and once connected they report an empty `cwd`,
|
|
111194
|
+
* so nothing about a path can tell them apart. The Registration is the durable
|
|
111195
|
+
* identity, and until now it lived only on the CMMD catalog row: the Checkout
|
|
111196
|
+
* itself could not answer which project it was.
|
|
111197
|
+
*
|
|
111198
|
+
* NULL is a Checkout that was not created from a Registration, and that is
|
|
111199
|
+
* every row written before this column existed. Those keep resolving through
|
|
111200
|
+
* the directory rules, so nothing is backfilled and no existing row is touched.
|
|
111201
|
+
*/
|
|
111202
|
+
var _074_ProjectCmmdRegistration_default = gen(function* () {
|
|
111203
|
+
const sql = yield* SqlClient;
|
|
111204
|
+
if (!(yield* sql`
|
|
111205
|
+
PRAGMA table_info(projection_projects)
|
|
111206
|
+
`).some((column) => column.name === "cmmd_registration_json")) yield* sql`
|
|
111207
|
+
ALTER TABLE projection_projects
|
|
111208
|
+
ADD COLUMN cmmd_registration_json TEXT
|
|
111209
|
+
`;
|
|
111210
|
+
});
|
|
111211
|
+
//#endregion
|
|
111244
111212
|
//#region src/persistence/Migrations.ts
|
|
111245
111213
|
/**
|
|
111246
111214
|
* MigrationsLive - Migration runner with inline loader
|
|
@@ -111626,6 +111594,11 @@ const migrationEntries = [
|
|
|
111626
111594
|
73,
|
|
111627
111595
|
"ReplicaThreadQuarantine",
|
|
111628
111596
|
_073_ReplicaThreadQuarantine_default
|
|
111597
|
+
],
|
|
111598
|
+
[
|
|
111599
|
+
74,
|
|
111600
|
+
"ProjectCmmdRegistration",
|
|
111601
|
+
_074_ProjectCmmdRegistration_default
|
|
111629
111602
|
]
|
|
111630
111603
|
];
|
|
111631
111604
|
const makeMigrationLoader = (throughId) => fromRecord(Object.fromEntries(migrationEntries.filter(([id]) => throughId === void 0 || id <= throughId).map(([id, name, migration]) => [`${id}_${name}`, migration])));
|
|
@@ -204269,13 +204242,45 @@ function mapCodexThreadNameUpdatedEvent(event, canonicalThreadId, payload) {
|
|
|
204269
204242
|
}
|
|
204270
204243
|
}];
|
|
204271
204244
|
}
|
|
204245
|
+
/**
|
|
204246
|
+
* One provider call's spend, from Codex's `last_token_usage`. Codex reports
|
|
204247
|
+
* `input_tokens` inclusive of the cached and cache-write portions, so the
|
|
204248
|
+
* uncached bucket is the remainder; reasoning is reported inside output and
|
|
204249
|
+
* is surfaced separately without being added again. Mirrors
|
|
204250
|
+
* `parseCodexLine` in usage/usageTranscripts.ts so a Recorded turn and a
|
|
204251
|
+
* scanned transcript agree on the same numbers.
|
|
204252
|
+
*/
|
|
204253
|
+
function codexTurnUsageDelta(value) {
|
|
204254
|
+
const usage = asObject$2(value);
|
|
204255
|
+
const lastUsage = asObject$2(usage?.last_token_usage ?? usage?.last);
|
|
204256
|
+
if (!lastUsage) return void 0;
|
|
204257
|
+
const int = (key, alt) => Math.max(0, Math.trunc(asNumber(lastUsage[key]) ?? asNumber(lastUsage[alt]) ?? 0));
|
|
204258
|
+
const inputTokens = int("input_tokens", "inputTokens");
|
|
204259
|
+
const cachedInputTokens = int("cached_input_tokens", "cachedInputTokens");
|
|
204260
|
+
const cacheCreationTokens = int("cache_write_input_tokens", "cacheWriteInputTokens");
|
|
204261
|
+
const outputTokens = int("output_tokens", "outputTokens");
|
|
204262
|
+
if (inputTokens + cachedInputTokens + cacheCreationTokens + outputTokens === 0) return void 0;
|
|
204263
|
+
return {
|
|
204264
|
+
scope: "call-delta",
|
|
204265
|
+
uncachedInputTokens: Math.max(0, inputTokens - cachedInputTokens - cacheCreationTokens),
|
|
204266
|
+
cachedInputTokens,
|
|
204267
|
+
cacheCreationTokens,
|
|
204268
|
+
outputTokens,
|
|
204269
|
+
reasoningTokens: Math.min(outputTokens, int("reasoning_output_tokens", "reasoningOutputTokens"))
|
|
204270
|
+
};
|
|
204271
|
+
}
|
|
204272
204272
|
function mapCodexThreadTokenUsageEvent(event, canonicalThreadId, payload) {
|
|
204273
|
-
const
|
|
204273
|
+
const tokenUsage = asObject$2(payload?.tokenUsage);
|
|
204274
|
+
const normalizedUsage = normalizeCodexTokenUsage(tokenUsage ?? event.payload);
|
|
204274
204275
|
if (!normalizedUsage) return [];
|
|
204276
|
+
const turnUsage = codexTurnUsageDelta(tokenUsage ?? event.payload);
|
|
204275
204277
|
return [{
|
|
204276
204278
|
type: "thread.token-usage.updated",
|
|
204277
204279
|
...runtimeEventBase(event, canonicalThreadId),
|
|
204278
|
-
payload: {
|
|
204280
|
+
payload: {
|
|
204281
|
+
usage: normalizedUsage,
|
|
204282
|
+
...turnUsage ? { turnUsage } : {}
|
|
204283
|
+
}
|
|
204279
204284
|
}];
|
|
204280
204285
|
}
|
|
204281
204286
|
const codexThreadMethodMappers = {
|
|
@@ -206899,6 +206904,29 @@ function finiteNumberField(usage, key) {
|
|
|
206899
206904
|
function finiteNumberFieldOrZero(usage, key) {
|
|
206900
206905
|
return finiteNumberField(usage, key) ?? 0;
|
|
206901
206906
|
}
|
|
206907
|
+
/**
|
|
206908
|
+
* The whole turn's spend from the SDK result message, cache split intact.
|
|
206909
|
+
* Claude reports `input_tokens` exclusive of the cached and cache-creation
|
|
206910
|
+
* portions, so the buckets are already disjoint. Claude does not report
|
|
206911
|
+
* reasoning separately.
|
|
206912
|
+
*/
|
|
206913
|
+
function claudeTurnUsageTotal(value) {
|
|
206914
|
+
const usage = asClaudeUsageRecord(value);
|
|
206915
|
+
if (!usage) return void 0;
|
|
206916
|
+
const uncachedInputTokens = finiteNumberFieldOrZero(usage, "input_tokens");
|
|
206917
|
+
const cachedInputTokens = finiteNumberFieldOrZero(usage, "cache_read_input_tokens");
|
|
206918
|
+
const cacheCreationTokens = finiteNumberFieldOrZero(usage, "cache_creation_input_tokens");
|
|
206919
|
+
const outputTokens = finiteNumberFieldOrZero(usage, "output_tokens");
|
|
206920
|
+
if (uncachedInputTokens + cachedInputTokens + cacheCreationTokens + outputTokens <= 0) return;
|
|
206921
|
+
return {
|
|
206922
|
+
scope: "turn-total",
|
|
206923
|
+
uncachedInputTokens: Math.trunc(uncachedInputTokens),
|
|
206924
|
+
cachedInputTokens: Math.trunc(cachedInputTokens),
|
|
206925
|
+
cacheCreationTokens: Math.trunc(cacheCreationTokens),
|
|
206926
|
+
outputTokens: Math.trunc(outputTokens),
|
|
206927
|
+
reasoningTokens: 0
|
|
206928
|
+
};
|
|
206929
|
+
}
|
|
206902
206930
|
function normalizedClaudeInputTokens(usage) {
|
|
206903
206931
|
return finiteNumberFieldOrZero(usage, "input_tokens") + finiteNumberFieldOrZero(usage, "cache_creation_input_tokens") + finiteNumberFieldOrZero(usage, "cache_read_input_tokens");
|
|
206904
206932
|
}
|
|
@@ -207541,8 +207569,9 @@ const makeClaudeAdapter = fn$1("makeClaudeAdapter")(function* (options) {
|
|
|
207541
207569
|
}
|
|
207542
207570
|
});
|
|
207543
207571
|
});
|
|
207544
|
-
const emitTurnUsageUpdated = fn$1("emitTurnUsageUpdated")(function* (context, turnState, usageSnapshot) {
|
|
207572
|
+
const emitTurnUsageUpdated = fn$1("emitTurnUsageUpdated")(function* (context, turnState, usageSnapshot, result) {
|
|
207545
207573
|
if (!usageSnapshot) return;
|
|
207574
|
+
const turnUsage = claudeTurnUsageTotal(result?.usage);
|
|
207546
207575
|
const usageStamp = yield* makeEventStamp();
|
|
207547
207576
|
yield* offerRuntimeEvent({
|
|
207548
207577
|
type: "thread.token-usage.updated",
|
|
@@ -207551,7 +207580,10 @@ const makeClaudeAdapter = fn$1("makeClaudeAdapter")(function* (options) {
|
|
|
207551
207580
|
createdAt: usageStamp.createdAt,
|
|
207552
207581
|
threadId: context.session.threadId,
|
|
207553
207582
|
...turnState ? { turnId: turnState.turnId } : {},
|
|
207554
|
-
payload: {
|
|
207583
|
+
payload: {
|
|
207584
|
+
usage: usageSnapshot,
|
|
207585
|
+
...turnUsage ? { turnUsage } : {}
|
|
207586
|
+
},
|
|
207555
207587
|
providerRefs: turnState ? nativeProviderRefs(context) : {}
|
|
207556
207588
|
});
|
|
207557
207589
|
});
|
|
@@ -207569,7 +207601,7 @@ const makeClaudeAdapter = fn$1("makeClaudeAdapter")(function* (options) {
|
|
|
207569
207601
|
});
|
|
207570
207602
|
});
|
|
207571
207603
|
const emitTurnCompletionWithoutActiveTurn = fn$1("emitTurnCompletionWithoutActiveTurn")(function* (context, status, errorMessage, result, usageSnapshot) {
|
|
207572
|
-
yield* emitTurnUsageUpdated(context, void 0, usageSnapshot);
|
|
207604
|
+
yield* emitTurnUsageUpdated(context, void 0, usageSnapshot, result);
|
|
207573
207605
|
yield* emitTurnCompleted(context, void 0, status, errorMessage, result);
|
|
207574
207606
|
});
|
|
207575
207607
|
const completeInFlightTools = fn$1("completeInFlightTools")(function* (context, turnState, status, result) {
|
|
@@ -207633,7 +207665,7 @@ const makeClaudeAdapter = fn$1("makeClaudeAdapter")(function* (options) {
|
|
|
207633
207665
|
yield* completeInFlightTools(context, turnState, status, result);
|
|
207634
207666
|
yield* completePendingAssistantTextBlocks(context, turnState, status, result);
|
|
207635
207667
|
recordCompletedTurn(context, turnState);
|
|
207636
|
-
yield* emitTurnUsageUpdated(context, turnState, usageSnapshot);
|
|
207668
|
+
yield* emitTurnUsageUpdated(context, turnState, usageSnapshot, result);
|
|
207637
207669
|
yield* emitTurnCompleted(context, turnState, status, errorMessage, result);
|
|
207638
207670
|
yield* finalizeTurnSession(context, status, errorMessage);
|
|
207639
207671
|
});
|
|
@@ -277366,6 +277398,83 @@ var PlanTaskCreationReactor = class extends Service$1()("forge/orchestration/Ser
|
|
|
277366
277398
|
*/
|
|
277367
277399
|
var SpriteTaskHoldReactor = class extends Service$1()("forge/orchestration/Services/SpriteTaskHoldReactor") {};
|
|
277368
277400
|
//#endregion
|
|
277401
|
+
//#region src/persistence/Services/ProjectionProjects.ts
|
|
277402
|
+
/**
|
|
277403
|
+
* ProjectionProjectRepository - Projection repository interface for projects.
|
|
277404
|
+
*
|
|
277405
|
+
* Owns persistence operations for project rows in the orchestration projection
|
|
277406
|
+
* read model.
|
|
277407
|
+
*
|
|
277408
|
+
* @module ProjectionProjectRepository
|
|
277409
|
+
*/
|
|
277410
|
+
const ProjectionProject = Struct({
|
|
277411
|
+
projectId: ProjectId,
|
|
277412
|
+
title: String$1,
|
|
277413
|
+
workspaceRoot: String$1,
|
|
277414
|
+
defaultModelSelection: NullOr(ModelSelection),
|
|
277415
|
+
defaultThreadEnvMode: NullOr(ThreadEnvMode),
|
|
277416
|
+
cmmdRegistration: NullOr(CmmdRegistration),
|
|
277417
|
+
scripts: ArraySchema(ProjectScript),
|
|
277418
|
+
createdAt: IsoDateTime,
|
|
277419
|
+
updatedAt: IsoDateTime,
|
|
277420
|
+
deletedAt: NullOr(IsoDateTime)
|
|
277421
|
+
});
|
|
277422
|
+
const GetProjectionProjectInput = Struct({ projectId: ProjectId });
|
|
277423
|
+
const DeleteProjectionProjectInput = Struct({ projectId: ProjectId });
|
|
277424
|
+
/**
|
|
277425
|
+
* ProjectionProjectRepository - Service tag for project projection persistence.
|
|
277426
|
+
*/
|
|
277427
|
+
var ProjectionProjectRepository = class extends Service$1()("forge/persistence/Services/ProjectionProjects/ProjectionProjectRepository") {};
|
|
277428
|
+
//#endregion
|
|
277429
|
+
//#region src/persistence/Services/ProjectionThreads.ts
|
|
277430
|
+
/**
|
|
277431
|
+
* ProjectionThreadRepository - Projection repository interface for threads.
|
|
277432
|
+
*
|
|
277433
|
+
* Owns persistence operations for projected thread records in the
|
|
277434
|
+
* orchestration read model.
|
|
277435
|
+
*
|
|
277436
|
+
* @module ProjectionThreadRepository
|
|
277437
|
+
*/
|
|
277438
|
+
const ProjectionThread = Struct({
|
|
277439
|
+
threadId: ThreadId,
|
|
277440
|
+
projectId: ProjectId,
|
|
277441
|
+
title: String$1,
|
|
277442
|
+
modelSelection: ModelSelection,
|
|
277443
|
+
runtimeMode: RuntimeMode$1,
|
|
277444
|
+
interactionMode: ProviderInteractionMode,
|
|
277445
|
+
branch: NullOr(String$1),
|
|
277446
|
+
worktreePath: NullOr(String$1),
|
|
277447
|
+
latestTurnId: NullOr(TurnId),
|
|
277448
|
+
createdAt: IsoDateTime,
|
|
277449
|
+
updatedAt: IsoDateTime,
|
|
277450
|
+
archivedAt: NullOr(IsoDateTime),
|
|
277451
|
+
settledAt: NullOr(IsoDateTime),
|
|
277452
|
+
settledOverride: NullOr(Literals(["settled", "active"])),
|
|
277453
|
+
latestUserMessageAt: NullOr(IsoDateTime),
|
|
277454
|
+
pendingApprovalCount: NonNegativeInt,
|
|
277455
|
+
pendingUserInputCount: NonNegativeInt,
|
|
277456
|
+
hasActionableProposedPlan: NonNegativeInt,
|
|
277457
|
+
deletedAt: NullOr(IsoDateTime),
|
|
277458
|
+
kind: ThreadKind.pipe(withDecodingDefault(succeed("master"))),
|
|
277459
|
+
parentThreadId: NullOr(ThreadId).pipe(withDecodingDefault(succeed(null))),
|
|
277460
|
+
anchorKind: CmmdAnchorKind.pipe(withDecodingDefault(succeed("scratch"))),
|
|
277461
|
+
anchorCmmdId: NullOr(String$1).pipe(withDecodingDefault(succeed(null))),
|
|
277462
|
+
linkedPullRequest: optionalKey(NullOr(LinkedPullRequest)),
|
|
277463
|
+
status: ThreadStatus.pipe(withDecodingDefault(succeed("idle"))),
|
|
277464
|
+
workerRole: NullOr(WorkerRole).pipe(withDecodingDefault(succeed(null))),
|
|
277465
|
+
goal: NullOr(String$1).pipe(withDecodingDefault(succeed(null))),
|
|
277466
|
+
titleRegeneration: NullOr(ThreadTitleRegeneration).pipe(withDecodingDefault(succeed(null))),
|
|
277467
|
+
pendingAutoCreatePrompt: optional$4(NullOr(AutoCreateTaskPrompt)).pipe(withDecodingDefault(succeed(null))),
|
|
277468
|
+
rateLimitStatus: optional$4(ArraySchema(ThreadProviderRateLimitStatus)).pipe(withDecodingDefault(succeed([])))
|
|
277469
|
+
});
|
|
277470
|
+
const GetProjectionThreadInput = Struct({ threadId: ThreadId });
|
|
277471
|
+
const DeleteProjectionThreadInput = Struct({ threadId: ThreadId });
|
|
277472
|
+
const ListProjectionThreadsByProjectInput = Struct({ projectId: ProjectId });
|
|
277473
|
+
/**
|
|
277474
|
+
* ProjectionThreadRepository - Service tag for thread projection persistence.
|
|
277475
|
+
*/
|
|
277476
|
+
var ProjectionThreadRepository = class extends Service$1()("forge/persistence/Services/ProjectionThreads/ProjectionThreadRepository") {};
|
|
277477
|
+
//#endregion
|
|
277369
277478
|
//#region src/orchestration/Layers/OrchestrationReactor.ts
|
|
277370
277479
|
const RETENTION_SWEEP_INTERVAL_MS = 300 * 1e3;
|
|
277371
277480
|
const OrchestrationReactorLive = effect(OrchestrationReactor, gen(function* () {
|
|
@@ -279915,7 +280024,10 @@ function threadEventToActivities(event) {
|
|
|
279915
280024
|
tone: "info",
|
|
279916
280025
|
kind: "context-window.updated",
|
|
279917
280026
|
summary: "Context window updated",
|
|
279918
|
-
payload
|
|
280027
|
+
payload: {
|
|
280028
|
+
...payload,
|
|
280029
|
+
...event.payload.turnUsage ? { turnUsage: event.payload.turnUsage } : {}
|
|
280030
|
+
}
|
|
279919
280031
|
}] : [];
|
|
279920
280032
|
}
|
|
279921
280033
|
default: return;
|
|
@@ -284577,14 +284689,87 @@ const writeProviderStatusCache = (input) => {
|
|
|
284577
284689
|
})));
|
|
284578
284690
|
};
|
|
284579
284691
|
//#endregion
|
|
284580
|
-
//#region
|
|
284692
|
+
//#region ../../packages/shared/src/providerExecution.ts
|
|
284581
284693
|
/**
|
|
284582
|
-
*
|
|
284583
|
-
*
|
|
284584
|
-
*
|
|
284585
|
-
*
|
|
284694
|
+
* Canonical provider-readiness gate for starting work.
|
|
284695
|
+
*
|
|
284696
|
+
* Cloud user VMs can execute through Forge's scoped provider proxy without a
|
|
284697
|
+
* provider-local login. In that case the provider reports unauthenticated but
|
|
284698
|
+
* its credential provenance is explicitly `proxied`.
|
|
284586
284699
|
*/
|
|
284587
|
-
|
|
284700
|
+
function isServerProviderExecutable(provider) {
|
|
284701
|
+
const hasExecutionAuthority = provider.auth.status !== "unauthenticated" || provider.auth.provenance?.credentialScope === "proxied";
|
|
284702
|
+
return provider.enabled && provider.installed && provider.status === "ready" && hasExecutionAuthority && provider.models.length > 0;
|
|
284703
|
+
}
|
|
284704
|
+
//#endregion
|
|
284705
|
+
//#region src/provider/providerAvailability.ts
|
|
284706
|
+
/**
|
|
284707
|
+
* Derive what this Environment knows about a provider's availability.
|
|
284708
|
+
*
|
|
284709
|
+
* WHY THIS EXISTS
|
|
284710
|
+
*
|
|
284711
|
+
* Four different states (Unbuilt, Not Offered, Not Usable, Not on this
|
|
284712
|
+
* Environment) used to render as one "Coming soon." string, because consumers
|
|
284713
|
+
* were handed a filtered list and had to infer meaning from what was missing.
|
|
284714
|
+
* Every provider is now published with an explicit availability and, when
|
|
284715
|
+
* withheld, its reason. See `docs/adr/withheld-providers-carry-their-reason.md`
|
|
284716
|
+
* and the glossary in `CONTEXT.md` section "Provider availability".
|
|
284717
|
+
*
|
|
284718
|
+
* WHAT AN ENVIRONMENT MAY SAY
|
|
284719
|
+
*
|
|
284720
|
+
* Three of the four reasons only. Not Offered is a fact about the CMMD
|
|
284721
|
+
* organization's Provider Offer, and delivery-pending is a fact about a
|
|
284722
|
+
* credential in flight; neither is visible from inside an Environment, so the
|
|
284723
|
+
* Shell adds them when it joins. Nothing here may invent them.
|
|
284724
|
+
*
|
|
284725
|
+
* This reads the snapshot a provider Layer already produced. It runs no probe
|
|
284726
|
+
* and changes no probe: `isServerProviderExecutable` stays the single gate on
|
|
284727
|
+
* whether a turn can be dispatched, and this restates its answer in the
|
|
284728
|
+
* vocabulary a person sees.
|
|
284729
|
+
*/
|
|
284730
|
+
/**
|
|
284731
|
+
* Providers Forge ships in the UI but cannot execute, published as Unbuilt.
|
|
284732
|
+
*
|
|
284733
|
+
* Empty in this build: codex, claudeAgent, ollama, cmmd, apex, cursor and
|
|
284734
|
+
* opencode all have a real detection Layer and a registered adapter. The list
|
|
284735
|
+
* stays as the one place a provider that ships ahead of its server-side
|
|
284736
|
+
* implementation is named, so "Coming soon." is a deliberate entry rather than
|
|
284737
|
+
* a fallback something fell into.
|
|
284738
|
+
*/
|
|
284739
|
+
const UNBUILT_PROVIDERS = [];
|
|
284740
|
+
function deriveProviderAvailability(provider, unbuiltProviders = UNBUILT_PROVIDERS) {
|
|
284741
|
+
if (unbuiltProviders.includes(provider.provider)) return {
|
|
284742
|
+
availability: "unavailable",
|
|
284743
|
+
unavailableReason: "unbuilt"
|
|
284744
|
+
};
|
|
284745
|
+
if (isServerProviderExecutable(provider)) return { availability: "available" };
|
|
284746
|
+
const hasProxiedCredential = provider.auth.provenance?.credentialScope === "proxied";
|
|
284747
|
+
if (provider.installed && provider.auth.status === "unauthenticated" && !hasProxiedCredential) return {
|
|
284748
|
+
availability: "unavailable",
|
|
284749
|
+
unavailableReason: "not-usable",
|
|
284750
|
+
unavailableDetail: "no-connection"
|
|
284751
|
+
};
|
|
284752
|
+
return {
|
|
284753
|
+
availability: "unavailable",
|
|
284754
|
+
unavailableReason: "not-on-this-environment"
|
|
284755
|
+
};
|
|
284756
|
+
}
|
|
284757
|
+
/**
|
|
284758
|
+
* Stamp a snapshot with its derived availability.
|
|
284759
|
+
*
|
|
284760
|
+
* The previous fields are dropped before the new ones are applied. Merging
|
|
284761
|
+
* would leave a provider that just connected reporting `available` while still
|
|
284762
|
+
* carrying the reason it was withheld for.
|
|
284763
|
+
*/
|
|
284764
|
+
function withProviderAvailability(provider, unbuiltProviders = UNBUILT_PROVIDERS) {
|
|
284765
|
+
const { availability: _availability, unavailableReason: _unavailableReason, unavailableDetail: _unavailableDetail, ...rest } = provider;
|
|
284766
|
+
return {
|
|
284767
|
+
...rest,
|
|
284768
|
+
...deriveProviderAvailability(provider, unbuiltProviders)
|
|
284769
|
+
};
|
|
284770
|
+
}
|
|
284771
|
+
//#endregion
|
|
284772
|
+
//#region src/provider/Layers/ProviderRegistry.ts
|
|
284588
284773
|
const loadProviders = (codexProvider, claudeProvider, ollamaProvider, cmmdProvider, apexProvider, cursorProvider, opencodeProvider) => all([
|
|
284589
284774
|
codexProvider.getSnapshot,
|
|
284590
284775
|
claudeProvider.getSnapshot,
|
|
@@ -284621,9 +284806,9 @@ const ProviderRegistryLive = effect(ProviderRegistry, gen(function* () {
|
|
|
284621
284806
|
cachedProvider,
|
|
284622
284807
|
fallbackProvider
|
|
284623
284808
|
});
|
|
284624
|
-
return
|
|
284809
|
+
return UNBUILT_PROVIDERS.includes(provider) ? fallbackProvider : void 0;
|
|
284625
284810
|
}));
|
|
284626
|
-
}, { concurrency: "unbounded" }).pipe(map$3((providers) => orderProviderSnapshots(providers.filter((provider) => provider !== void 0)))));
|
|
284811
|
+
}, { concurrency: "unbounded" }).pipe(map$3((providers) => orderProviderSnapshots(providers.filter((provider) => provider !== void 0).map((provider) => withProviderAvailability(provider))))));
|
|
284627
284812
|
const persistProvider = (provider) => writeProviderStatusCache({
|
|
284628
284813
|
filePath: cachePathByProvider.get(provider.provider),
|
|
284629
284814
|
provider
|
|
@@ -284631,7 +284816,8 @@ const ProviderRegistryLive = effect(ProviderRegistry, gen(function* () {
|
|
|
284631
284816
|
provider: provider.provider,
|
|
284632
284817
|
error
|
|
284633
284818
|
})), ignore);
|
|
284634
|
-
const upsertProviders = fn$1("upsertProviders")(function* (
|
|
284819
|
+
const upsertProviders = fn$1("upsertProviders")(function* (incomingProviders, options) {
|
|
284820
|
+
const nextProviders = incomingProviders.map((provider) => withProviderAvailability(provider));
|
|
284635
284821
|
const [previousProviders, providers] = yield* modify$3(providersRef, (previousProviders) => {
|
|
284636
284822
|
const mergedProviders = new Map(previousProviders.map((provider) => [provider.provider, provider]));
|
|
284637
284823
|
for (const provider of nextProviders) mergedProviders.set(provider.provider, provider);
|
|
@@ -286174,6 +286360,7 @@ const ProjectCheckoutDeletionLive = effect(ProjectCheckoutDeletion, gen(function
|
|
|
286174
286360
|
//#region src/persistence/Layers/ProjectionProjects.ts
|
|
286175
286361
|
const ProjectionProjectDbRow = ProjectionProject.mapFields(assign({
|
|
286176
286362
|
defaultModelSelection: NullOr(fromJsonString(ModelSelection)),
|
|
286363
|
+
cmmdRegistration: NullOr(fromJsonString(CmmdRegistration)),
|
|
286177
286364
|
scripts: fromJsonString(ArraySchema(ProjectScript))
|
|
286178
286365
|
}));
|
|
286179
286366
|
const ProjectionProjectRepositoryLive = effect(ProjectionProjectRepository, gen(function* () {
|
|
@@ -286187,6 +286374,7 @@ const ProjectionProjectRepositoryLive = effect(ProjectionProjectRepository, gen(
|
|
|
286187
286374
|
workspace_root,
|
|
286188
286375
|
default_model_selection_json,
|
|
286189
286376
|
default_thread_env_mode,
|
|
286377
|
+
cmmd_registration_json,
|
|
286190
286378
|
scripts_json,
|
|
286191
286379
|
created_at,
|
|
286192
286380
|
updated_at,
|
|
@@ -286198,6 +286386,7 @@ const ProjectionProjectRepositoryLive = effect(ProjectionProjectRepository, gen(
|
|
|
286198
286386
|
${row.workspaceRoot},
|
|
286199
286387
|
${row.defaultModelSelection !== null ? JSON.stringify(row.defaultModelSelection) : null},
|
|
286200
286388
|
${row.defaultThreadEnvMode},
|
|
286389
|
+
${row.cmmdRegistration !== null ? JSON.stringify(row.cmmdRegistration) : null},
|
|
286201
286390
|
${JSON.stringify(row.scripts)},
|
|
286202
286391
|
${row.createdAt},
|
|
286203
286392
|
${row.updatedAt},
|
|
@@ -286209,6 +286398,7 @@ const ProjectionProjectRepositoryLive = effect(ProjectionProjectRepository, gen(
|
|
|
286209
286398
|
workspace_root = excluded.workspace_root,
|
|
286210
286399
|
default_model_selection_json = excluded.default_model_selection_json,
|
|
286211
286400
|
default_thread_env_mode = excluded.default_thread_env_mode,
|
|
286401
|
+
cmmd_registration_json = excluded.cmmd_registration_json,
|
|
286212
286402
|
scripts_json = excluded.scripts_json,
|
|
286213
286403
|
created_at = excluded.created_at,
|
|
286214
286404
|
updated_at = excluded.updated_at,
|
|
@@ -286225,6 +286415,7 @@ const ProjectionProjectRepositoryLive = effect(ProjectionProjectRepository, gen(
|
|
|
286225
286415
|
workspace_root AS "workspaceRoot",
|
|
286226
286416
|
default_model_selection_json AS "defaultModelSelection",
|
|
286227
286417
|
default_thread_env_mode AS "defaultThreadEnvMode",
|
|
286418
|
+
cmmd_registration_json AS "cmmdRegistration",
|
|
286228
286419
|
scripts_json AS "scripts",
|
|
286229
286420
|
created_at AS "createdAt",
|
|
286230
286421
|
updated_at AS "updatedAt",
|
|
@@ -286243,6 +286434,7 @@ const ProjectionProjectRepositoryLive = effect(ProjectionProjectRepository, gen(
|
|
|
286243
286434
|
workspace_root AS "workspaceRoot",
|
|
286244
286435
|
default_model_selection_json AS "defaultModelSelection",
|
|
286245
286436
|
default_thread_env_mode AS "defaultThreadEnvMode",
|
|
286437
|
+
cmmd_registration_json AS "cmmdRegistration",
|
|
286246
286438
|
scripts_json AS "scripts",
|
|
286247
286439
|
created_at AS "createdAt",
|
|
286248
286440
|
updated_at AS "updatedAt",
|
|
@@ -287392,7 +287584,7 @@ function resolveBuildCommitFromEnv(env) {
|
|
|
287392
287584
|
* environment descriptor down instead of reporting an honest "unknown".
|
|
287393
287585
|
*/
|
|
287394
287586
|
function readBakedBuildCommit() {
|
|
287395
|
-
return "
|
|
287587
|
+
return "0ef3571b544de985c96601544e36094a62787683";
|
|
287396
287588
|
}
|
|
287397
287589
|
async function resolveServerBuildCommit(input) {
|
|
287398
287590
|
if (isFullCommitSha(input.baked)) return input.baked;
|
|
@@ -287564,7 +287756,7 @@ const ServerEnvironmentLive = effect(ServerEnvironment, fn$1("makeServerEnvironm
|
|
|
287564
287756
|
os,
|
|
287565
287757
|
arch: platformArch()
|
|
287566
287758
|
},
|
|
287567
|
-
serverVersion:
|
|
287759
|
+
serverVersion: version$1,
|
|
287568
287760
|
...buildCommit !== void 0 ? { buildCommit } : {},
|
|
287569
287761
|
capabilities: {
|
|
287570
287762
|
...executionEnvironmentCapabilities(serverConfig),
|
|
@@ -290543,6 +290735,7 @@ const decideOrchestrationCommand = fn$1("decideOrchestrationCommand")(function*
|
|
|
290543
290735
|
workspaceRoot: command.workspaceRoot,
|
|
290544
290736
|
defaultModelSelection: command.defaultModelSelection ?? null,
|
|
290545
290737
|
...command.defaultThreadEnvMode !== void 0 ? { defaultThreadEnvMode: command.defaultThreadEnvMode } : {},
|
|
290738
|
+
...command.cmmdRegistration !== void 0 ? { cmmdRegistration: command.cmmdRegistration } : {},
|
|
290546
290739
|
scripts: [],
|
|
290547
290740
|
createdAt: command.createdAt,
|
|
290548
290741
|
updatedAt: command.createdAt
|
|
@@ -290569,6 +290762,7 @@ const decideOrchestrationCommand = fn$1("decideOrchestrationCommand")(function*
|
|
|
290569
290762
|
...command.workspaceRoot !== void 0 ? { workspaceRoot: command.workspaceRoot } : {},
|
|
290570
290763
|
...command.defaultModelSelection !== void 0 ? { defaultModelSelection: command.defaultModelSelection } : {},
|
|
290571
290764
|
...command.defaultThreadEnvMode !== void 0 ? { defaultThreadEnvMode: command.defaultThreadEnvMode } : {},
|
|
290765
|
+
...command.cmmdRegistration !== void 0 ? { cmmdRegistration: command.cmmdRegistration } : {},
|
|
290572
290766
|
...command.scripts !== void 0 ? { scripts: command.scripts } : {},
|
|
290573
290767
|
updatedAt: occurredAt
|
|
290574
290768
|
}
|
|
@@ -291430,6 +291624,7 @@ function projectProjectDomainEvent(nextBase, event) {
|
|
|
291430
291624
|
workspaceRoot: payload.workspaceRoot,
|
|
291431
291625
|
defaultModelSelection: payload.defaultModelSelection,
|
|
291432
291626
|
defaultThreadEnvMode: payload.defaultThreadEnvMode ?? null,
|
|
291627
|
+
cmmdRegistration: payload.cmmdRegistration ?? null,
|
|
291433
291628
|
scripts: payload.scripts,
|
|
291434
291629
|
createdAt: payload.createdAt,
|
|
291435
291630
|
updatedAt: payload.updatedAt,
|
|
@@ -291448,6 +291643,7 @@ function projectProjectDomainEvent(nextBase, event) {
|
|
|
291448
291643
|
...payload.workspaceRoot !== void 0 ? { workspaceRoot: payload.workspaceRoot } : {},
|
|
291449
291644
|
...payload.defaultModelSelection !== void 0 ? { defaultModelSelection: payload.defaultModelSelection } : {},
|
|
291450
291645
|
...payload.defaultThreadEnvMode !== void 0 ? { defaultThreadEnvMode: payload.defaultThreadEnvMode } : {},
|
|
291646
|
+
...payload.cmmdRegistration !== void 0 ? { cmmdRegistration: payload.cmmdRegistration } : {},
|
|
291451
291647
|
...payload.scripts !== void 0 ? { scripts: payload.scripts } : {},
|
|
291452
291648
|
updatedAt: payload.updatedAt
|
|
291453
291649
|
} : project)
|
|
@@ -292051,6 +292247,34 @@ const DeleteProjectionThreadActivitiesInput = Struct({ threadId: ThreadId });
|
|
|
292051
292247
|
*/
|
|
292052
292248
|
var ProjectionThreadActivityRepository = class extends Service$1()("forge/persistence/Services/ProjectionThreadActivities/ProjectionThreadActivityRepository") {};
|
|
292053
292249
|
//#endregion
|
|
292250
|
+
//#region src/persistence/Services/ProjectionThreadMessages.ts
|
|
292251
|
+
/**
|
|
292252
|
+
* ProjectionThreadMessageRepository - Projection repository interface for messages.
|
|
292253
|
+
*
|
|
292254
|
+
* Owns persistence operations for projected thread messages rendered in the
|
|
292255
|
+
* orchestration read model.
|
|
292256
|
+
*
|
|
292257
|
+
* @module ProjectionThreadMessageRepository
|
|
292258
|
+
*/
|
|
292259
|
+
const ProjectionThreadMessage = Struct({
|
|
292260
|
+
messageId: MessageId,
|
|
292261
|
+
threadId: ThreadId,
|
|
292262
|
+
turnId: NullOr(TurnId),
|
|
292263
|
+
role: OrchestrationMessageRole,
|
|
292264
|
+
text: String$1,
|
|
292265
|
+
attachments: optional$4(ArraySchema(ChatAttachment)),
|
|
292266
|
+
isStreaming: Boolean$1,
|
|
292267
|
+
createdAt: IsoDateTime,
|
|
292268
|
+
updatedAt: IsoDateTime
|
|
292269
|
+
});
|
|
292270
|
+
const ListProjectionThreadMessagesInput = Struct({ threadId: ThreadId });
|
|
292271
|
+
const GetProjectionThreadMessageInput = Struct({ messageId: MessageId });
|
|
292272
|
+
const DeleteProjectionThreadMessagesInput = Struct({ threadId: ThreadId });
|
|
292273
|
+
/**
|
|
292274
|
+
* ProjectionThreadMessageRepository - Service tag for message projection persistence.
|
|
292275
|
+
*/
|
|
292276
|
+
var ProjectionThreadMessageRepository = class extends Service$1()("forge/persistence/Services/ProjectionThreadMessages/ProjectionThreadMessageRepository") {};
|
|
292277
|
+
//#endregion
|
|
292054
292278
|
//#region src/persistence/Services/ProjectionThreadProposedPlans.ts
|
|
292055
292279
|
const ProjectionThreadProposedPlan = Struct({
|
|
292056
292280
|
planId: OrchestrationProposedPlanId,
|
|
@@ -292987,6 +293211,7 @@ const OrchestrationProjectionPipelineLive = effect(OrchestrationProjectionPipeli
|
|
|
292987
293211
|
workspaceRoot: event.payload.workspaceRoot,
|
|
292988
293212
|
defaultModelSelection: event.payload.defaultModelSelection,
|
|
292989
293213
|
defaultThreadEnvMode: event.payload.defaultThreadEnvMode ?? null,
|
|
293214
|
+
cmmdRegistration: event.payload.cmmdRegistration ?? null,
|
|
292990
293215
|
scripts: event.payload.scripts,
|
|
292991
293216
|
createdAt: event.payload.createdAt,
|
|
292992
293217
|
updatedAt: event.payload.updatedAt,
|
|
@@ -293002,6 +293227,7 @@ const OrchestrationProjectionPipelineLive = effect(OrchestrationProjectionPipeli
|
|
|
293002
293227
|
...event.payload.workspaceRoot !== void 0 ? { workspaceRoot: event.payload.workspaceRoot } : {},
|
|
293003
293228
|
...event.payload.defaultModelSelection !== void 0 ? { defaultModelSelection: event.payload.defaultModelSelection } : {},
|
|
293004
293229
|
...event.payload.defaultThreadEnvMode !== void 0 ? { defaultThreadEnvMode: event.payload.defaultThreadEnvMode } : {},
|
|
293230
|
+
...event.payload.cmmdRegistration !== void 0 ? { cmmdRegistration: event.payload.cmmdRegistration } : {},
|
|
293005
293231
|
...event.payload.scripts !== void 0 ? { scripts: event.payload.scripts } : {},
|
|
293006
293232
|
updatedAt: event.payload.updatedAt
|
|
293007
293233
|
});
|
|
@@ -293893,6 +294119,7 @@ const decodeShellSnapshot = decodeUnknownEffect(OrchestrationShellSnapshot);
|
|
|
293893
294119
|
const decodeThread = decodeUnknownEffect(OrchestrationThread);
|
|
293894
294120
|
const ProjectionProjectDbRowSchema = ProjectionProject.mapFields(assign({
|
|
293895
294121
|
defaultModelSelection: NullOr(fromJsonString(ModelSelection)),
|
|
294122
|
+
cmmdRegistration: NullOr(fromJsonString(CmmdRegistration)),
|
|
293896
294123
|
scripts: fromJsonString(ArraySchema(ProjectScript))
|
|
293897
294124
|
}));
|
|
293898
294125
|
const ProjectionThreadMessageDbRowSchema = ProjectionThreadMessage.mapFields(assign({
|
|
@@ -294031,6 +294258,7 @@ function mapProjectShellRow(row, repositoryIdentity, availability) {
|
|
|
294031
294258
|
repositoryIdentity,
|
|
294032
294259
|
availability,
|
|
294033
294260
|
defaultModelSelection: row.defaultModelSelection,
|
|
294261
|
+
cmmdRegistration: row.cmmdRegistration,
|
|
294034
294262
|
scripts: row.scripts,
|
|
294035
294263
|
createdAt: row.createdAt,
|
|
294036
294264
|
updatedAt: row.updatedAt
|
|
@@ -294068,6 +294296,7 @@ const OrchestrationInfrastructureLayerLive = mergeAll(effect(ProjectionSnapshotQ
|
|
|
294068
294296
|
workspace_root AS "workspaceRoot",
|
|
294069
294297
|
default_model_selection_json AS "defaultModelSelection",
|
|
294070
294298
|
default_thread_env_mode AS "defaultThreadEnvMode",
|
|
294299
|
+
cmmd_registration_json AS "cmmdRegistration",
|
|
294071
294300
|
scripts_json AS "scripts",
|
|
294072
294301
|
created_at AS "createdAt",
|
|
294073
294302
|
updated_at AS "updatedAt",
|
|
@@ -294363,6 +294592,7 @@ const OrchestrationInfrastructureLayerLive = mergeAll(effect(ProjectionSnapshotQ
|
|
|
294363
294592
|
workspace_root AS "workspaceRoot",
|
|
294364
294593
|
default_model_selection_json AS "defaultModelSelection",
|
|
294365
294594
|
default_thread_env_mode AS "defaultThreadEnvMode",
|
|
294595
|
+
cmmd_registration_json AS "cmmdRegistration",
|
|
294366
294596
|
scripts_json AS "scripts",
|
|
294367
294597
|
created_at AS "createdAt",
|
|
294368
294598
|
updated_at AS "updatedAt",
|
|
@@ -294384,6 +294614,7 @@ const OrchestrationInfrastructureLayerLive = mergeAll(effect(ProjectionSnapshotQ
|
|
|
294384
294614
|
workspace_root AS "workspaceRoot",
|
|
294385
294615
|
default_model_selection_json AS "defaultModelSelection",
|
|
294386
294616
|
default_thread_env_mode AS "defaultThreadEnvMode",
|
|
294617
|
+
cmmd_registration_json AS "cmmdRegistration",
|
|
294387
294618
|
scripts_json AS "scripts",
|
|
294388
294619
|
created_at AS "createdAt",
|
|
294389
294620
|
updated_at AS "updatedAt",
|
|
@@ -294404,6 +294635,7 @@ const OrchestrationInfrastructureLayerLive = mergeAll(effect(ProjectionSnapshotQ
|
|
|
294404
294635
|
workspace_root AS "workspaceRoot",
|
|
294405
294636
|
default_model_selection_json AS "defaultModelSelection",
|
|
294406
294637
|
default_thread_env_mode AS "defaultThreadEnvMode",
|
|
294638
|
+
cmmd_registration_json AS "cmmdRegistration",
|
|
294407
294639
|
scripts_json AS "scripts",
|
|
294408
294640
|
created_at AS "createdAt",
|
|
294409
294641
|
updated_at AS "updatedAt",
|
|
@@ -294721,6 +294953,7 @@ const OrchestrationInfrastructureLayerLive = mergeAll(effect(ProjectionSnapshotQ
|
|
|
294721
294953
|
repositoryIdentity: repositoryIdentities.get(row.projectId) ?? null,
|
|
294722
294954
|
availability: projectAvailabilities.get(row.projectId) ?? "unknown",
|
|
294723
294955
|
defaultModelSelection: row.defaultModelSelection,
|
|
294956
|
+
cmmdRegistration: row.cmmdRegistration,
|
|
294724
294957
|
scripts: row.scripts,
|
|
294725
294958
|
createdAt: row.createdAt,
|
|
294726
294959
|
updatedAt: row.updatedAt,
|
|
@@ -298219,6 +298452,23 @@ const cmmdRenameDeviceRouteLayer = registerProxyRoute({
|
|
|
298219
298452
|
orgIdSource: "none",
|
|
298220
298453
|
responseShape: "unwrapData"
|
|
298221
298454
|
});
|
|
298455
|
+
/**
|
|
298456
|
+
* Name the caller's cloud Environment (FOR-36371).
|
|
298457
|
+
*
|
|
298458
|
+
* Owner JWT lane, like every other `/api/cmmd/forge-runtimes/*` control call.
|
|
298459
|
+
* CMMD scopes the rename to the caller's own Environment and answers 409
|
|
298460
|
+
* `environment_name_taken` when this Seat already has one by that name; both
|
|
298461
|
+
* the status and the code reach the browser unchanged, which is what lets the
|
|
298462
|
+
* rename field say something specific instead of "something went wrong".
|
|
298463
|
+
*/
|
|
298464
|
+
const cmmdRenameForgeRuntimeRouteLayer = registerProxyRoute({
|
|
298465
|
+
forgePath: "/api/cmmd/forge-runtimes/:runtimeId/rename",
|
|
298466
|
+
method: "POST",
|
|
298467
|
+
cmmdPath: "/api/forge/context/runtimes/:runtimeId/rename",
|
|
298468
|
+
orgIdSource: "none",
|
|
298469
|
+
responseShape: "unwrapData",
|
|
298470
|
+
successStatus: 200
|
|
298471
|
+
});
|
|
298222
298472
|
const cmmdRevokeDeviceRouteLayer = registerProxyRoute({
|
|
298223
298473
|
forgePath: "/api/cmmd/devices/:deviceId/revoke",
|
|
298224
298474
|
method: "POST",
|
|
@@ -300054,21 +300304,24 @@ function processRuntimeReplicationOutboxItem(item, dependencies) {
|
|
|
300054
300304
|
//#endregion
|
|
300055
300305
|
//#region src/runtimeReplication/Services/ActiveHourMeter.ts
|
|
300056
300306
|
var ActiveHourMeter = class extends Service$1()("forge/runtimeReplication/Services/ActiveHourMeter") {};
|
|
300057
|
-
|
|
300058
|
-
|
|
300307
|
+
/** `slug` and `name` are `.min(1).max(512)` on the receiving schema. */
|
|
300308
|
+
const FIELD_MAX_LENGTH = 512;
|
|
300309
|
+
/** `version` is `.max(128)` on the receiving schema, with no length floor. */
|
|
300310
|
+
const VERSION_MAX_LENGTH = 128;
|
|
300311
|
+
/** `binaryPath` is `.max(2048)` on the receiving schema, with no length floor. */
|
|
300312
|
+
const BINARY_PATH_MAX_LENGTH = 2048;
|
|
300059
300313
|
/**
|
|
300060
|
-
*
|
|
300314
|
+
* Trim to the receiving schema's maximum, or null.
|
|
300061
300315
|
*
|
|
300062
|
-
*
|
|
300063
|
-
*
|
|
300064
|
-
*
|
|
300316
|
+
* Neither field has a length floor, so an empty string would be legal — but it
|
|
300317
|
+
* is not an answer. A version nobody resolved and a binary nobody found are
|
|
300318
|
+
* both null, which is what the control plane stores and what a reader can tell
|
|
300319
|
+
* apart from a real value.
|
|
300065
300320
|
*/
|
|
300066
|
-
function
|
|
300067
|
-
const
|
|
300068
|
-
return
|
|
300321
|
+
function cappedText(value, max) {
|
|
300322
|
+
const normalized = value?.trim().slice(0, max);
|
|
300323
|
+
return normalized ? normalized : null;
|
|
300069
300324
|
}
|
|
300070
|
-
/** `slug` and `name` are `.min(1).max(512)` on the receiving schema. */
|
|
300071
|
-
const FIELD_MAX_LENGTH = 512;
|
|
300072
300325
|
function serializeModel(model) {
|
|
300073
300326
|
const slug = model.slug.trim().slice(0, FIELD_MAX_LENGTH);
|
|
300074
300327
|
const name = model.name.trim().slice(0, FIELD_MAX_LENGTH);
|
|
@@ -300082,20 +300335,48 @@ function serializeModel(model) {
|
|
|
300082
300335
|
name
|
|
300083
300336
|
};
|
|
300084
300337
|
}
|
|
300338
|
+
/**
|
|
300339
|
+
* The availability to publish for one provider.
|
|
300340
|
+
*
|
|
300341
|
+
* The registry stamps every snapshot before it leaves, so this normally copies.
|
|
300342
|
+
* Deriving over a stamped snapshot would lose the one fact only the registry
|
|
300343
|
+
* holds — which providers this build cannot run at all — and republish every
|
|
300344
|
+
* Unbuilt provider as Not on this Environment. The fallback covers a snapshot
|
|
300345
|
+
* that reached the outbox from some other path.
|
|
300346
|
+
*
|
|
300347
|
+
* Built by spread so a key with no value is ABSENT rather than `undefined`: the
|
|
300348
|
+
* receiving object is `.strict()`, `undefined` is not a legal enum member, and
|
|
300349
|
+
* the outbox retries the resulting 400 forever.
|
|
300350
|
+
*/
|
|
300351
|
+
function publishedAvailability(provider) {
|
|
300352
|
+
if (provider.availability === void 0) return deriveProviderAvailability(provider);
|
|
300353
|
+
const reason = provider.unavailableReason;
|
|
300354
|
+
const detail = provider.unavailableDetail;
|
|
300355
|
+
return {
|
|
300356
|
+
availability: provider.availability,
|
|
300357
|
+
...reason === void 0 ? {} : { unavailableReason: reason },
|
|
300358
|
+
...detail === void 0 ? {} : { unavailableDetail: detail }
|
|
300359
|
+
};
|
|
300360
|
+
}
|
|
300361
|
+
function serializeProvider(provider) {
|
|
300362
|
+
const models = [];
|
|
300363
|
+
for (const model of provider.models) {
|
|
300364
|
+
if (models.length >= 256) break;
|
|
300365
|
+
const serialized = serializeModel(model);
|
|
300366
|
+
if (serialized) models.push(serialized);
|
|
300367
|
+
}
|
|
300368
|
+
return {
|
|
300369
|
+
provider: provider.provider,
|
|
300370
|
+
models,
|
|
300371
|
+
...publishedAvailability(provider),
|
|
300372
|
+
version: cappedText(provider.version, VERSION_MAX_LENGTH),
|
|
300373
|
+
binaryPath: cappedText(provider.auth.provenance?.binaryPath, BINARY_PATH_MAX_LENGTH)
|
|
300374
|
+
};
|
|
300375
|
+
}
|
|
300085
300376
|
function serializeProviderCatalog(providers) {
|
|
300086
300377
|
const catalog = [];
|
|
300087
300378
|
for (const provider of providers) {
|
|
300088
|
-
|
|
300089
|
-
const models = [];
|
|
300090
|
-
for (const model of provider.models) {
|
|
300091
|
-
if (models.length >= 256) break;
|
|
300092
|
-
const serialized = serializeModel(model);
|
|
300093
|
-
if (serialized) models.push(serialized);
|
|
300094
|
-
}
|
|
300095
|
-
catalog.push({
|
|
300096
|
-
provider: provider.provider,
|
|
300097
|
-
models
|
|
300098
|
-
});
|
|
300379
|
+
catalog.push(serializeProvider(provider));
|
|
300099
300380
|
if (catalog.length >= 16) break;
|
|
300100
300381
|
}
|
|
300101
300382
|
return catalog;
|
|
@@ -300113,16 +300394,26 @@ const replicaTurnStatuses = new Set([
|
|
|
300113
300394
|
function isRecord$6(value) {
|
|
300114
300395
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
300115
300396
|
}
|
|
300397
|
+
function replicaSourceSequence(value) {
|
|
300398
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : null;
|
|
300399
|
+
}
|
|
300400
|
+
function replicaSourceEventId(value) {
|
|
300401
|
+
return typeof value === "string" && value.length > 0 ? value : null;
|
|
300402
|
+
}
|
|
300403
|
+
function replicaSourceTurn(sourceTurnId) {
|
|
300404
|
+
return typeof sourceTurnId === "string" && sourceTurnId.length > 0 ? { turnId: sourceTurnId } : {};
|
|
300405
|
+
}
|
|
300116
300406
|
function replicaActivitySource(activity) {
|
|
300117
300407
|
if (!activity.kind.startsWith("replica.") || !isRecord$6(activity.payload)) return null;
|
|
300118
|
-
const sourceSequence = activity.sequence;
|
|
300119
|
-
const eventId = activity.payload.sourceEventId;
|
|
300120
|
-
if (sourceSequence ===
|
|
300121
|
-
return
|
|
300408
|
+
const sourceSequence = replicaSourceSequence(activity.sequence);
|
|
300409
|
+
const eventId = replicaSourceEventId(activity.payload.sourceEventId);
|
|
300410
|
+
if (sourceSequence === null || eventId === null) return null;
|
|
300411
|
+
return {
|
|
300122
300412
|
sourceSequence,
|
|
300123
300413
|
eventId,
|
|
300124
|
-
occurredAt: activity.createdAt
|
|
300125
|
-
|
|
300414
|
+
occurredAt: activity.createdAt,
|
|
300415
|
+
turn: replicaSourceTurn(activity.payload.sourceTurnId)
|
|
300416
|
+
};
|
|
300126
300417
|
}
|
|
300127
300418
|
function replicaSummaryEvent(activity, source) {
|
|
300128
300419
|
if (activity.kind !== "replica.activity_summary" && activity.kind !== "replica.error_summary") return null;
|
|
@@ -300132,6 +300423,7 @@ function replicaSummaryEvent(activity, source) {
|
|
|
300132
300423
|
event: {
|
|
300133
300424
|
eventId: source.eventId,
|
|
300134
300425
|
occurredAt: source.occurredAt,
|
|
300426
|
+
...source.turn,
|
|
300135
300427
|
kind: activity.kind.slice(8),
|
|
300136
300428
|
summary: typeof sourceText === "string" ? sourceText : activity.summary
|
|
300137
300429
|
}
|
|
@@ -300145,6 +300437,7 @@ function replicaTurnEvent(activity, source) {
|
|
|
300145
300437
|
event: {
|
|
300146
300438
|
eventId: source.eventId,
|
|
300147
300439
|
occurredAt: source.occurredAt,
|
|
300440
|
+
...source.turn,
|
|
300148
300441
|
kind: "turn_status",
|
|
300149
300442
|
status
|
|
300150
300443
|
}
|
|
@@ -300160,6 +300453,7 @@ function replicaToolCallEvent(activity, source) {
|
|
|
300160
300453
|
event: {
|
|
300161
300454
|
eventId: source.eventId,
|
|
300162
300455
|
occurredAt: source.occurredAt,
|
|
300456
|
+
...source.turn,
|
|
300163
300457
|
kind: "tool_call",
|
|
300164
300458
|
summary: sourceText,
|
|
300165
300459
|
status,
|
|
@@ -300167,9 +300461,36 @@ function replicaToolCallEvent(activity, source) {
|
|
|
300167
300461
|
}
|
|
300168
300462
|
};
|
|
300169
300463
|
}
|
|
300464
|
+
function replicaTurnUsageEvent(activity, source) {
|
|
300465
|
+
if (activity.kind !== "replica.turn_usage" || !isRecord$6(activity.payload)) return null;
|
|
300466
|
+
const usage = activity.payload.payload;
|
|
300467
|
+
if (!("turnId" in source.turn) || !isRecord$6(usage)) return null;
|
|
300468
|
+
const provider = usage.provider;
|
|
300469
|
+
const model = usage.model;
|
|
300470
|
+
if (typeof provider !== "string" || typeof model !== "string" || !("usage" in usage)) return null;
|
|
300471
|
+
const tokens = usage.usage;
|
|
300472
|
+
return {
|
|
300473
|
+
sourceSequence: source.sourceSequence,
|
|
300474
|
+
event: {
|
|
300475
|
+
eventId: source.eventId,
|
|
300476
|
+
occurredAt: source.occurredAt,
|
|
300477
|
+
kind: "turn_usage",
|
|
300478
|
+
turnId: source.turn.turnId,
|
|
300479
|
+
provider,
|
|
300480
|
+
model,
|
|
300481
|
+
usage: tokens === null ? null : {
|
|
300482
|
+
uncachedInputTokens: tokens.uncachedInputTokens,
|
|
300483
|
+
cachedInputTokens: tokens.cachedInputTokens,
|
|
300484
|
+
cacheCreationTokens: tokens.cacheCreationTokens,
|
|
300485
|
+
outputTokens: tokens.outputTokens,
|
|
300486
|
+
reasoningTokens: tokens.reasoningTokens
|
|
300487
|
+
}
|
|
300488
|
+
}
|
|
300489
|
+
};
|
|
300490
|
+
}
|
|
300170
300491
|
function serializeReplicaActivity(activity) {
|
|
300171
300492
|
const source = replicaActivitySource(activity);
|
|
300172
|
-
return source === null ? null : replicaSummaryEvent(activity, source) ?? replicaTurnEvent(activity, source) ?? replicaToolCallEvent(activity, source);
|
|
300493
|
+
return source === null ? null : replicaSummaryEvent(activity, source) ?? replicaTurnEvent(activity, source) ?? replicaToolCallEvent(activity, source) ?? replicaTurnUsageEvent(activity, source);
|
|
300173
300494
|
}
|
|
300174
300495
|
function serializeReplicaMessage(message) {
|
|
300175
300496
|
const source = decodeReplicaSourceMessageId(message.id);
|
|
@@ -300179,6 +300500,7 @@ function serializeReplicaMessage(message) {
|
|
|
300179
300500
|
event: {
|
|
300180
300501
|
eventId: source.eventId,
|
|
300181
300502
|
occurredAt: message.createdAt,
|
|
300503
|
+
...source.turnId === void 0 ? {} : { turnId: source.turnId },
|
|
300182
300504
|
kind: message.role === "user" ? "user_message" : "assistant_message",
|
|
300183
300505
|
text: message.text
|
|
300184
300506
|
}
|
|
@@ -300255,12 +300577,17 @@ function canonicalRuntimeEventTimestamp(value) {
|
|
|
300255
300577
|
if (Number.isNaN(timestamp.getTime())) throw new Error(`Invalid runtime event timestamp: ${value}`);
|
|
300256
300578
|
return timestamp.toISOString();
|
|
300257
300579
|
}
|
|
300580
|
+
/** Spread onto an event: present only when the projection knows the turn. */
|
|
300581
|
+
function eventTurn(turnId) {
|
|
300582
|
+
return turnId ? { turnId } : {};
|
|
300583
|
+
}
|
|
300258
300584
|
function orderedLocalMessageEvent(message, content) {
|
|
300259
300585
|
return {
|
|
300260
300586
|
sourceSequence: null,
|
|
300261
300587
|
event: {
|
|
300262
300588
|
eventId: `message:${message.id}`,
|
|
300263
300589
|
occurredAt: canonicalRuntimeEventTimestamp(message.createdAt),
|
|
300590
|
+
...eventTurn(message.turnId),
|
|
300264
300591
|
kind: message.role === "user" ? "user_message" : "assistant_message",
|
|
300265
300592
|
text: content
|
|
300266
300593
|
}
|
|
@@ -300291,6 +300618,7 @@ function serializeNativeToolActivity(activity) {
|
|
|
300291
300618
|
event: {
|
|
300292
300619
|
eventId: `activity:${activity.id}`,
|
|
300293
300620
|
occurredAt: canonicalRuntimeEventTimestamp(activity.createdAt),
|
|
300621
|
+
...eventTurn(activity.turnId),
|
|
300294
300622
|
kind: "tool_call",
|
|
300295
300623
|
summary,
|
|
300296
300624
|
status: activityStatus(activity),
|
|
@@ -300333,11 +300661,123 @@ function serializeProviderFailureActivity(activity) {
|
|
|
300333
300661
|
event: {
|
|
300334
300662
|
eventId: `activity:${activity.id}`,
|
|
300335
300663
|
occurredAt: canonicalRuntimeEventTimestamp(activity.createdAt),
|
|
300664
|
+
...eventTurn(activity.turnId),
|
|
300336
300665
|
kind: "error_summary",
|
|
300337
300666
|
summary: text(detail === null ? summary : `${summary}: ${detail}`, 4e3) ?? summary
|
|
300338
300667
|
}
|
|
300339
300668
|
};
|
|
300340
300669
|
}
|
|
300670
|
+
const turnUsageKeys = [
|
|
300671
|
+
"uncachedInputTokens",
|
|
300672
|
+
"cachedInputTokens",
|
|
300673
|
+
"cacheCreationTokens",
|
|
300674
|
+
"outputTokens",
|
|
300675
|
+
"reasoningTokens"
|
|
300676
|
+
];
|
|
300677
|
+
function isTurnUsageRecord(value) {
|
|
300678
|
+
if (!value || typeof value !== "object") return false;
|
|
300679
|
+
const record = value;
|
|
300680
|
+
return (record.scope === "turn-total" || record.scope === "call-delta") && turnUsageKeys.every((key) => Number.isSafeInteger(record[key]) && record[key] >= 0);
|
|
300681
|
+
}
|
|
300682
|
+
function providerTurnUsage(activity) {
|
|
300683
|
+
if (activity.kind !== "context-window.updated") return null;
|
|
300684
|
+
const payload = activity.payload;
|
|
300685
|
+
const usage = payload && typeof payload === "object" ? payload.turnUsage : void 0;
|
|
300686
|
+
return isTurnUsageRecord(usage) ? usage : null;
|
|
300687
|
+
}
|
|
300688
|
+
function tokensOf(usage) {
|
|
300689
|
+
return {
|
|
300690
|
+
uncachedInputTokens: usage.uncachedInputTokens,
|
|
300691
|
+
cachedInputTokens: usage.cachedInputTokens,
|
|
300692
|
+
cacheCreationTokens: usage.cacheCreationTokens,
|
|
300693
|
+
outputTokens: usage.outputTokens,
|
|
300694
|
+
reasoningTokens: usage.reasoningTokens
|
|
300695
|
+
};
|
|
300696
|
+
}
|
|
300697
|
+
/**
|
|
300698
|
+
* What one turn spent, from the usage the adapter reported while it ran.
|
|
300699
|
+
*
|
|
300700
|
+
* A `turn-total` (Claude, from the result message) is the whole turn, so the
|
|
300701
|
+
* last one wins. Otherwise the turn is the sum of its `call-delta` rows
|
|
300702
|
+
* (Codex, one per token update) after dropping consecutive duplicates, the
|
|
300703
|
+
* same rule usage/usageTranscripts.ts applies to a Codex rollout so a Recorded
|
|
300704
|
+
* turn and a scanned transcript agree. No usage at all is an Unreported turn.
|
|
300705
|
+
*/
|
|
300706
|
+
function turnUsageTokens(activities) {
|
|
300707
|
+
const reported = activities.map(providerTurnUsage).filter((usage) => usage !== null);
|
|
300708
|
+
const total = reported.findLast((usage) => usage.scope === "turn-total");
|
|
300709
|
+
if (total) return tokensOf(total);
|
|
300710
|
+
let summed = null;
|
|
300711
|
+
let previous = null;
|
|
300712
|
+
for (const delta of reported) {
|
|
300713
|
+
const signature = JSON.stringify(tokensOf(delta));
|
|
300714
|
+
if (signature === previous) continue;
|
|
300715
|
+
previous = signature;
|
|
300716
|
+
const tokens = tokensOf(delta);
|
|
300717
|
+
summed = summed ? {
|
|
300718
|
+
uncachedInputTokens: summed.uncachedInputTokens + tokens.uncachedInputTokens,
|
|
300719
|
+
cachedInputTokens: summed.cachedInputTokens + tokens.cachedInputTokens,
|
|
300720
|
+
cacheCreationTokens: summed.cacheCreationTokens + tokens.cacheCreationTokens,
|
|
300721
|
+
outputTokens: summed.outputTokens + tokens.outputTokens,
|
|
300722
|
+
reasoningTokens: summed.reasoningTokens + tokens.reasoningTokens
|
|
300723
|
+
} : tokens;
|
|
300724
|
+
}
|
|
300725
|
+
return summed;
|
|
300726
|
+
}
|
|
300727
|
+
/**
|
|
300728
|
+
* One Recorded turn per settled local turn: the turns named on this thread's
|
|
300729
|
+
* own messages and activities, minus the one still running (it would churn a
|
|
300730
|
+
* new generation on every token update). Hydrated replica rows carry no local
|
|
300731
|
+
* turn, so a recovered thread does not re-record turns CMMD already holds.
|
|
300732
|
+
*
|
|
300733
|
+
* Model and provider are the thread's current selection. The adapters do not
|
|
300734
|
+
* yet report which model answered a given turn, so a mid-thread model switch
|
|
300735
|
+
* is attributed to the selection in force when the thread is serialized.
|
|
300736
|
+
* Recorded on FOR-36388.
|
|
300737
|
+
*/
|
|
300738
|
+
/** Turns named on this thread's own rows; hydrated replica rows carry no local turn. */
|
|
300739
|
+
function localTurnIds(thread) {
|
|
300740
|
+
const fromMessages = thread.messages.filter((message) => !message.streaming).map((message) => message.turnId);
|
|
300741
|
+
const fromActivities = thread.activities.filter((activity) => !activity.kind.startsWith("replica.")).map((activity) => activity.turnId);
|
|
300742
|
+
const turnIds = /* @__PURE__ */ new Set();
|
|
300743
|
+
for (const turnId of [...fromMessages, ...fromActivities]) if (turnId) turnIds.add(turnId);
|
|
300744
|
+
return turnIds;
|
|
300745
|
+
}
|
|
300746
|
+
function settledTurnIds(thread) {
|
|
300747
|
+
const turnIds = localTurnIds(thread);
|
|
300748
|
+
if (thread.latestTurn?.state === "running") turnIds.delete(thread.latestTurn.turnId);
|
|
300749
|
+
return turnIds;
|
|
300750
|
+
}
|
|
300751
|
+
function turnActivities(thread, turnId) {
|
|
300752
|
+
return thread.activities.filter((activity) => activity.turnId === turnId).toSorted((left, right) => left.createdAt.localeCompare(right.createdAt) || left.id.localeCompare(right.id));
|
|
300753
|
+
}
|
|
300754
|
+
/** The last thing that happened in the turn: what the Recorded turn is stamped with. */
|
|
300755
|
+
function turnLatestAt(thread, turnId, activities) {
|
|
300756
|
+
return [...activities.map((activity) => activity.createdAt), ...thread.messages.filter((message) => message.turnId === turnId).map((message) => message.createdAt)].toSorted().at(-1);
|
|
300757
|
+
}
|
|
300758
|
+
function recordedTurnEvent(thread, turnId) {
|
|
300759
|
+
const activities = turnActivities(thread, turnId);
|
|
300760
|
+
const latestAt = turnLatestAt(thread, turnId, activities);
|
|
300761
|
+
if (latestAt === void 0) return null;
|
|
300762
|
+
return {
|
|
300763
|
+
sourceSequence: null,
|
|
300764
|
+
event: {
|
|
300765
|
+
eventId: `usage:${turnId}`,
|
|
300766
|
+
occurredAt: canonicalRuntimeEventTimestamp(latestAt),
|
|
300767
|
+
kind: "turn_usage",
|
|
300768
|
+
turnId,
|
|
300769
|
+
provider: thread.modelSelection?.provider ?? "unknown",
|
|
300770
|
+
model: thread.modelSelection?.model ?? "unknown",
|
|
300771
|
+
usage: turnUsageTokens(activities)
|
|
300772
|
+
}
|
|
300773
|
+
};
|
|
300774
|
+
}
|
|
300775
|
+
function serializeRecordedTurns(thread) {
|
|
300776
|
+
return [...settledTurnIds(thread)].flatMap((turnId) => {
|
|
300777
|
+
const event = recordedTurnEvent(thread, turnId);
|
|
300778
|
+
return event === null ? [] : [event];
|
|
300779
|
+
});
|
|
300780
|
+
}
|
|
300341
300781
|
function serializeRuntimeThreadEvents(thread) {
|
|
300342
300782
|
const messages = thread.messages.flatMap(serializeThreadMessage);
|
|
300343
300783
|
const failureActivities = thread.activities.flatMap((activity) => {
|
|
@@ -300352,11 +300792,13 @@ function serializeRuntimeThreadEvents(thread) {
|
|
|
300352
300792
|
const event = serializeNativeToolActivity(activity);
|
|
300353
300793
|
return event === null ? [] : [event];
|
|
300354
300794
|
});
|
|
300795
|
+
const recordedTurns = serializeRecordedTurns(thread);
|
|
300355
300796
|
return [
|
|
300356
300797
|
...messages,
|
|
300357
300798
|
...replicaActivities,
|
|
300358
300799
|
...toolActivities,
|
|
300359
|
-
...failureActivities
|
|
300800
|
+
...failureActivities,
|
|
300801
|
+
...recordedTurns
|
|
300360
300802
|
].toSorted((left, right) => {
|
|
300361
300803
|
if (left.sourceSequence !== null && right.sourceSequence !== null) return left.sourceSequence - right.sourceSequence;
|
|
300362
300804
|
if (left.sourceSequence !== null) return -1;
|
|
@@ -309551,7 +309993,6 @@ const PlatformServicesLive = unwrap(gen(function* () {
|
|
|
309551
309993
|
return layer;
|
|
309552
309994
|
}
|
|
309553
309995
|
}));
|
|
309554
|
-
const CmmdSyncLayerLive = empty$4.pipe(provideMerge(TurnCompletionWatcherLive), provideMerge(CmmdSyncWorkerLive), provideMerge(TurnSerializerLive), provideMerge(CmmdSyncClientLive));
|
|
309555
309996
|
const RuntimeReplicationLayerLive = RuntimeReplicationLive.pipe(provideMerge(RuntimeReplicationClientLive), provideMerge(RuntimeReplicationOutboxLive), provideMerge(ActiveHourMeterLive.pipe(provide$1(RuntimeReplicationOutboxLive))));
|
|
309556
309997
|
const RuntimeDrainLayerLive = RuntimeDrainReporterLive.pipe(provideMerge(RuntimeDrainStateLive));
|
|
309557
309998
|
const RuntimeAwareProviderReactorsLive = mergeAll(ProviderRuntimeIngestionLive, ProviderCommandReactorLive).pipe(provide$1(RuntimeDrainLayerLive));
|
|
@@ -309559,7 +310000,7 @@ const PipelineWorkerCoordinatorLayerLive = PipelineWorkerCoordinatorLive.pipe(pr
|
|
|
309559
310000
|
const AgentProtocolReactorLayerLive = AgentProtocolReactorLive.pipe(provideMerge(PipelineRunStoreLive));
|
|
309560
310001
|
const PipelineRunCoordinatorLayerLive = PipelineRunCoordinatorLive.pipe(provideMerge(PipelineProviderAuthorityInstallerLive), provideMerge(PipelineChangeInspectorLive), provideMerge(PipelineContextArtifactStoreLive), provideMerge(PipelineModelPolicyLive), provideMerge(PipelineRunClientLive), provideMerge(PipelineRunStoreLive), provideMerge(PipelineRunWorkspaceAllocatorLive), provideMerge(PipelineStagePolicyLive), provideMerge(PipelineWorkerCoordinatorLayerLive));
|
|
309561
310002
|
const PipelineRuntimeLayerLive = PipelineCoordinatorReactorLive.pipe(provideMerge(PipelineRunCoordinatorLayerLive), provideMerge(AgentProtocolReactorLayerLive));
|
|
309562
|
-
const ReactorLayerLive = empty$4.pipe(provideMerge(OrchestrationReactorLive), provideMerge(ApprovedWorkerPlanReactorLive), provideMerge(RuntimeAwareProviderReactorsLive), provideMerge(CheckpointReactorLive), provideMerge(SpriteTaskHoldReactorLive), provideMerge(PlanTaskCreationReactorLive), provideMerge(RuntimeReceiptBusLive), provideMerge(
|
|
310003
|
+
const ReactorLayerLive = empty$4.pipe(provideMerge(OrchestrationReactorLive), provideMerge(ApprovedWorkerPlanReactorLive), provideMerge(RuntimeAwareProviderReactorsLive), provideMerge(CheckpointReactorLive), provideMerge(SpriteTaskHoldReactorLive), provideMerge(PlanTaskCreationReactorLive), provideMerge(RuntimeReceiptBusLive), provideMerge(RuntimeReplicationLayerLive), provideMerge(PipelineRuntimeLayerLive), provideMerge(LocalAutomationRunReconcilerLive));
|
|
309563
310004
|
const CheckpointingLayerLive = empty$4.pipe(provideMerge(CheckpointDiffQueryLive), provideMerge(CheckpointStoreLive));
|
|
309564
310005
|
const ProviderLayerLive = unwrap(gen(function* () {
|
|
309565
310006
|
const config = yield* ServerConfig;
|
|
@@ -309613,10 +310054,10 @@ const MiscRuntimeLayerLive = mergeAll(AnalyticsServiceLayerLive, OpenLive, Serve
|
|
|
309613
310054
|
const RuntimeDependenciesWithoutPullRequestsLive = ReactorLayerLive.pipe(provideMerge(CheckpointingLayerLive), provideMerge(GitLayerLive), provideMerge(OrchestrationLayerLive), provideMerge(ProviderLayerLive), provideMerge(TerminalLayerLive), provideMerge(AgentBrowserManagerLive), provideMerge(mergeAll(ThreadDevRuntimeLive, DevTunnelLive.pipe(provide$1(ThreadDevRuntimeLive)))), provideMerge(PersistenceLayerLive), provideMerge(KeybindingsLive), provideMerge(ProviderRegistryLive), provideMerge(mergeAll(ServerSettingsLive, UsageServiceLive.pipe(provide$1(ServerSettingsLive)))), provideMerge(WorkspaceLayerLive), provideMerge(WorkspaceReadinessStateLive), provideMerge(ProjectFaviconResolverLive), provideMerge(RepositoryIdentityResolverLive), provideMerge(ServerEnvironmentLive), provideMerge(AuthLayerLive), provideMerge(ServerSecretStoreLayerLive), provideMerge(mergeAll(CloudRedisCoordinationLive, CloudStateSyncLive.pipe(provide$1(PersistenceLayerLive)))), provideMerge(MiscRuntimeLayerLive));
|
|
309614
310055
|
const RuntimeDependenciesLive = pullRequestServiceFactoryLayer.pipe(provideMerge(RuntimeDependenciesWithoutPullRequestsLive), provideMerge(cmmdProjectIdentityResolverLive.pipe(provide$1(RuntimeDependenciesWithoutPullRequestsLive))), provideMerge(pullRequestProviderRuntimeLive));
|
|
309615
310056
|
const RuntimeServicesLive = ServerRuntimeStartupLive.pipe(provideMerge(RuntimeDependenciesLive));
|
|
309616
|
-
const makeRoutesLayer = mergeAll(authBearerBootstrapRouteLayer, authBootstrapRouteLayer, authCommandBearerBootstrapRouteLayer, authCommandBootstrapRouteLayer, authOAuthTokenExchangeRouteLayer, authWebSocketTicketRouteLayer, authCmmdOAuthDeviceRouteLayer, authCmmdOAuthTokenRouteLayer, authCmmdPasswordTokenRouteLayer, authClientsRevokeOthersRouteLayer, authClientsRevokeRouteLayer, authClientsRouteLayer, authLogoutRouteLayer, authPairingLinksRevokeRouteLayer, authPairingLinksRouteLayer, authPairingCredentialRouteLayer, authSessionRouteLayer, authWebSocketTokenRouteLayer, authWebLoginRouteLayer, authWebCallbackRouteLayer, desktopLocalWebBridgePublishRouteLayer, desktopLocalWebBridgeBootstrapRouteLayer, desktopRelayControlPlaneRouteLayer, apiDocsHtmlRouteLayer, apiDocsOpenApiRouteLayer, pulseSignalStateListRouteLayer, pulseSignalStateUpsertRouteLayer, cmmdProfileRouteLayer, cmmdCreateBrainDocRouteLayer, cmmdUpdateTaskRouteLayer, cmmdUpsertTaskPullRequestRouteLayer, ...cmmdPullRequestRouteLayers, cmmdAddTaskCommentRouteLayer, cmmdWorkIntakeRouteLayer, cmmdWsTokenRouteLayer, cmmdSearchTasksRouteLayer, cmmdGetTaskCommentsRouteLayer, cmmdGetProjectCommentsRouteLayer, cmmdAddProjectCommentRouteLayer, cmmdUpdateProjectRouteLayer, cmmdGetOrgMembersRouteLayer, cmmdSimHostsRouteLayer, cmmdSimLeaseReadRouteLayer, cmmdSimLeaseClaimRouteLayer, cmmdSimLeaseReleaseRouteLayer, cmmdSimLeaseRenewRouteLayer, cmmdUploadTaskAttachmentRouteLayer, cmmdGetTaskAttachmentsRouteLayer, cmmdUpdateTaskCommentRouteLayer, cmmdDeleteTaskCommentRouteLayer, cmmdGetProjectRepositoryRouteLayer, cmmdListProjectRepositoriesRouteLayer, cmmdArchiveTaskRouteLayer, cmmdUnarchiveTaskRouteLayer, cmmdListTasksRouteLayer, cmmdCreateTaskRouteLayer, cmmdListCampaignsRouteLayer, cmmdGetCampaignRouteLayer, cmmdCreateCampaignRouteLayer, cmmdUpdateCampaignRouteLayer, cmmdDeleteCampaignRouteLayer, cmmdListSavedViewsRouteLayer, cmmdCreateSavedViewRouteLayer, cmmdImportSavedViewRouteLayer, cmmdUpdateSavedViewRouteLayer, cmmdDeleteSavedViewRouteLayer, cmmdListProjectsRouteLayer, cmmdGetProjectRouteLayer, cmmdCreateProjectRouteLayer, cmmdDeleteProjectRouteLayer, cmmdMoveProjectRouteLayer, cmmdGetProjectMembersRouteLayer, cmmdListWorkspaceMembersRouteLayer, cmmdAddProjectMemberRouteLayer, cmmdGetProjectMilestonesRouteLayer, cmmdCreateProjectMilestoneRouteLayer, cmmdUpdateProjectMilestoneRouteLayer, cmmdDeleteProjectMilestoneRouteLayer, cmmdGetProjectUpdatesRouteLayer, cmmdCreateProjectUpdateRouteLayer, cmmdUpdateProjectUpdateRouteLayer, cmmdDeleteProjectUpdateRouteLayer, cmmdImproveProjectContentRouteLayer, cmmdCreateProjectTaskDraftRouteLayer, cmmdGetProjectTaskDraftRouteLayer, cmmdUpdateProjectTaskDraftRouteLayer, cmmdPreviewProjectTaskDraftRouteLayer, cmmdCommitProjectTaskDraftRouteLayer, cmmdDiscardProjectTaskDraftRouteLayer, cmmdGetProjectLeadPlanRouteLayer, cmmdActivateProjectLeadAuthorityRouteLayer, cmmdGetProjectLeadReadinessRouteLayer, cmmdGetProjectLeadCapabilitiesRouteLayer, cmmdGetProjectLeadSummaryRouteLayer, cmmdGetProjectLeadDetailRouteLayer, cmmdGetProjectLeadBriefingRouteLayer, cmmdListProjectLeadEventsRouteLayer, cmmdExplainProjectLeadRouteLayer, cmmdPauseProjectLeadRouteLayer, cmmdResumeProjectLeadRouteLayer, cmmdReserveProjectLeadTaskRouteLayer, cmmdReleaseProjectLeadReservationRouteLayer, cmmdReconcileProjectLeadRouteLayer, cmmdResolveProjectLeadAttentionRouteLayer, cmmdClaimProjectLeadControllerRouteLayer, cmmdRenewProjectLeadControllerClaimRouteLayer, cmmdYieldProjectLeadControllerClaimRouteLayer, cmmdAcknowledgeProjectLeadControllerEventRouteLayer, cmmdRecordProjectLeadControllerDecisionRouteLayer, cmmdListForgeAutomationPresetsRouteLayer, cmmdListUserForgeAutomationRulesRouteLayer, cmmdCreateUserForgeAutomationRuleRouteLayer, cmmdUpdateUserForgeAutomationRuleRouteLayer, cmmdListUserForgeAutomationRunsRouteLayer, cmmdStartUserForgeAutomationRunRouteLayer, cmmdListForgeAutomationRulesRouteLayer, cmmdCreateForgeAutomationRuleRouteLayer, cmmdUpdateForgeAutomationRuleRouteLayer, cmmdListForgeAutomationRunsRouteLayer, cmmdStartForgeAutomationRunRouteLayer, cmmdGetForgeAutomationRunRouteLayer, cmmdRetryForgeAutomationRunRouteLayer, cmmdCancelForgeAutomationRunRouteLayer, cmmdApproveForgeAutomationEscalationRouteLayer, cmmdRejectForgeAutomationEscalationRouteLayer, cmmdListProjectAgentMembersRouteLayer, cmmdCreateProjectAgentMemberRouteLayer, cmmdGetProjectAgentMemberRouteLayer, cmmdRenameProjectAgentMemberRouteLayer, cmmdRetireProjectAgentMemberRouteLayer, cmmdUpdateProjectAgentMemberAvatarRouteLayer, cmmdListProjectAgentMemberInstancesRouteLayer, cmmdPreviewProjectAgentMemberConsolidationRouteLayer, cmmdApplyProjectAgentMemberConsolidationRouteLayer, cmmdPutProjectTaskAssignmentRouteLayer, cmmdListProjectBoardRouteLayer, cmmdGetProjectTaskWorkflowRouteLayer, cmmdUpdateProjectTaskWorkflowRouteLayer, cmmdCreateProjectBoardTaskRouteLayer, cmmdUpdateProjectBoardTaskRouteLayer, cmmdUpdateProjectBoardTaskStatusRouteLayer, cmmdListTaskExecutionOptionsRouteLayer, cmmdCreateTaskWorkSessionRouteLayer, cmmdListProjectWorkSessionsRouteLayer, cmmdGetWorkSessionRouteLayer, cmmdUpdateWorkSessionRouteLayer, cmmdAttachWorkSessionThreadRouteLayer, cmmdListTaskConversationsRouteLayer, cmmdLinkTaskConversationRouteLayer, cmmdGetTaskHistoryRouteLayer, cmmdGetTaskConversationRouteLayer, cmmdSpawnForgeThreadFromBoardTaskRouteLayer, cmmdListCenterBoardRouteLayer, cmmdCreateCenterBoardTaskRouteLayer, cmmdCreateFeedbackRouteLayer, cmmdUpdateCenterBoardTaskRouteLayer, cmmdMoveCenterBoardTaskRouteLayer, cmmdMoveProjectBoardTaskRouteLayer, cmmdArchiveProjectBoardTaskRouteLayer, cmmdUnarchiveProjectBoardTaskRouteLayer, cmmdArchiveCenterBoardTaskRouteLayer, cmmdUnarchiveCenterBoardTaskRouteLayer, cmmdBootstrapRouteLayer, cmmdGetAccountPreferencesRouteLayer, cmmdUpdateAccountPreferencesRouteLayer, cmmdGetOrgProviderPolicyRouteLayer, cmmdListChatsRouteLayer, cmmdGetChatRouteLayer, cmmdListDevicesRouteLayer, runtimeReplicationStatusRouteLayer, cmmdRegisterDeviceRouteLayer, cmmdHeartbeatRuntimeRouteLayer, cmmdGrantRuntimeAccessRouteLayer, cmmdRevokeRuntimeAccessRouteLayer, cmmdCreateRelayControlRouteLayer, cmmdCreateRelayActionGrantRouteLayer, cmmdReplaceRuntimeInventoryRouteLayer, cmmdListRuntimeInventoryRouteLayer, cmmdGetRuntimeDiagnosticsRouteLayer, cmmdProvisionAuthRuntimeRouteLayer, cmmdGetAuthRuntimeRouteLayer, cmmdDestroyAuthRuntimeRouteLayer, cmmdConnectAuthRuntimeRouteLayer, cmmdGetProviderAccountsRouteLayer, cmmdDeleteProviderAccountRouteLayer, cmmdSetProviderAccountDefaultRouteLayer, cmmdGetProviderUsageRouteLayer, cmmdRefreshProviderUsageRouteLayer, cmmdGetUserCodexCredentialRouteLayer, cmmdDeleteUserCodexCredentialRouteLayer, cmmdGetUserClaudeCredentialRouteLayer, cmmdDeleteUserClaudeCredentialRouteLayer, cmmdGetClaudeRuntimeReadinessRouteLayer, cmmdAppendRuntimeThreadEventsRouteLayer, cmmdGetRuntimeThreadReplicaRouteLayer, cmmdRenameDeviceRouteLayer, cmmdRevokeDeviceRouteLayer, cmmdInstallConnectorRouteLayer, cmmdListConnectorsRouteLayer, cmmdForgeCloudProjectsListRouteLayer, cmmdForgeCloudProjectsEventsRouteLayer, cmmdForgeCloudProjectRegisterRouteLayer, cmmdForgeCloudProjectUnregisterRouteLayer, cmmdForgeCloudProjectLifecyclePreflightRouteLayer, cmmdForgeCloudProjectRemovalRouteLayer, cmmdForgeCloudProjectRemovalPreviewRouteLayer, cmmdForgeCloudProjectRemovalReceiptRouteLayer, cmmdForgeRuntimesEnsureRouteLayer, cmmdForgeRuntimesConnectRouteLayer, ownerRuntimeCodexReadinessRouteLayer, cmmdForgeRuntimesStatusRouteLayer, cmmdForgeRuntimesStartRouteLayer, cmmdForgeRuntimesStopRouteLayer, cmmdForgeRuntimesRecycleRouteLayer, cmmdForgeRuntimesUpdateCommitRouteLayer, cmmdForgeRuntimesDestroyRouteLayer, cmmdGetTaskRouteLayer, commandUpdateTaskRouteLayer, mobileProviderCatalogRouteLayer, cmmdUsageSummaryRouteLayer, cmmdBillingRouteLayer, cmmdBillingSeriesRouteLayer, attachmentsRouteLayer, orchestrationDispatchRouteLayer, orchestrationCmmdWorkRunEventRouteLayer, orchestrationAutomationStartThreadRouteLayer, orchestrationAutomationRebindRouteLayer, orchestrationAutomationTerminalReconcileRouteLayer, mobileGitRunStackedActionRouteLayer, pullRequestDiffRouteLayer, orchestrationSnapshotRouteLayer, localAutomationListRouteLayer, localAutomationCreateRouteLayer, localAutomationUpdateRouteLayer, localAutomationDeleteRouteLayer, localAutomationRunRouteLayer, otlpTracesProxyRouteLayer, devTunnelProxyRouteLayer, devTunnelLocalPortProxyRouteLayer, projectFaviconRouteLayer, serverEnvironmentRouteLayer, browserWebRtcReadinessRouteLayer, staticAndDevRouteLayer, githubStatusRouteLayer, githubAuthorizeUrlRouteLayer, githubDisconnectRouteLayer, githubReposRouteLayer, githubCloneRouteLayer, githubCloneJobStartRouteLayer, githubCloneJobStatusRouteLayer, githubRefreshCredentialsRouteLayer, githubToolConfirmationApproveRouteLayer, projectLinkGetRouteLayer, projectLinkListRouteLayer, projectLinkSetRouteLayer, projectLinkDeleteRouteLayer, cmmdWorkspacesRouteLayer, cmmdCampaignsRouteLayer, cmmdProjectLinksRouteLayer, cmmdEnsureGitHubProjectContextRouteLayer, cmmdProjectRepositoryEnsureRouteLayer, cmmdProjectsGetRouteLayer, cmmdProjectsCreateRouteLayer, workspaceReadinessRouteLayer, runtimeLivenessRouteLayer, claudeNativeGenerationProofRouteLayer, claudeUsageRouteLayer, codexRuntimeProviderReadinessRouteLayer, runtimeDiagnosticsRouteLayer, cloudFoldersRouteLayer, cloudProjectCreateRouteLayer, gitUrlCloneRouteLayer, websocketRpcRouteLayer).pipe(provide$1(browserApiCorsLayer));
|
|
310057
|
+
const makeRoutesLayer = mergeAll(authBearerBootstrapRouteLayer, authBootstrapRouteLayer, authCommandBearerBootstrapRouteLayer, authCommandBootstrapRouteLayer, authOAuthTokenExchangeRouteLayer, authWebSocketTicketRouteLayer, authCmmdOAuthDeviceRouteLayer, authCmmdOAuthTokenRouteLayer, authCmmdPasswordTokenRouteLayer, authClientsRevokeOthersRouteLayer, authClientsRevokeRouteLayer, authClientsRouteLayer, authLogoutRouteLayer, authPairingLinksRevokeRouteLayer, authPairingLinksRouteLayer, authPairingCredentialRouteLayer, authSessionRouteLayer, authWebSocketTokenRouteLayer, authWebLoginRouteLayer, authWebCallbackRouteLayer, desktopLocalWebBridgePublishRouteLayer, desktopLocalWebBridgeBootstrapRouteLayer, desktopRelayControlPlaneRouteLayer, apiDocsHtmlRouteLayer, apiDocsOpenApiRouteLayer, pulseSignalStateListRouteLayer, pulseSignalStateUpsertRouteLayer, cmmdProfileRouteLayer, cmmdCreateBrainDocRouteLayer, cmmdUpdateTaskRouteLayer, cmmdUpsertTaskPullRequestRouteLayer, ...cmmdPullRequestRouteLayers, cmmdAddTaskCommentRouteLayer, cmmdWorkIntakeRouteLayer, cmmdWsTokenRouteLayer, cmmdSearchTasksRouteLayer, cmmdGetTaskCommentsRouteLayer, cmmdGetProjectCommentsRouteLayer, cmmdAddProjectCommentRouteLayer, cmmdUpdateProjectRouteLayer, cmmdGetOrgMembersRouteLayer, cmmdSimHostsRouteLayer, cmmdSimLeaseReadRouteLayer, cmmdSimLeaseClaimRouteLayer, cmmdSimLeaseReleaseRouteLayer, cmmdSimLeaseRenewRouteLayer, cmmdUploadTaskAttachmentRouteLayer, cmmdGetTaskAttachmentsRouteLayer, cmmdUpdateTaskCommentRouteLayer, cmmdDeleteTaskCommentRouteLayer, cmmdGetProjectRepositoryRouteLayer, cmmdListProjectRepositoriesRouteLayer, cmmdArchiveTaskRouteLayer, cmmdUnarchiveTaskRouteLayer, cmmdListTasksRouteLayer, cmmdCreateTaskRouteLayer, cmmdListCampaignsRouteLayer, cmmdGetCampaignRouteLayer, cmmdCreateCampaignRouteLayer, cmmdUpdateCampaignRouteLayer, cmmdDeleteCampaignRouteLayer, cmmdListSavedViewsRouteLayer, cmmdCreateSavedViewRouteLayer, cmmdImportSavedViewRouteLayer, cmmdUpdateSavedViewRouteLayer, cmmdDeleteSavedViewRouteLayer, cmmdListProjectsRouteLayer, cmmdGetProjectRouteLayer, cmmdCreateProjectRouteLayer, cmmdDeleteProjectRouteLayer, cmmdMoveProjectRouteLayer, cmmdGetProjectMembersRouteLayer, cmmdListWorkspaceMembersRouteLayer, cmmdAddProjectMemberRouteLayer, cmmdGetProjectMilestonesRouteLayer, cmmdCreateProjectMilestoneRouteLayer, cmmdUpdateProjectMilestoneRouteLayer, cmmdDeleteProjectMilestoneRouteLayer, cmmdGetProjectUpdatesRouteLayer, cmmdCreateProjectUpdateRouteLayer, cmmdUpdateProjectUpdateRouteLayer, cmmdDeleteProjectUpdateRouteLayer, cmmdImproveProjectContentRouteLayer, cmmdCreateProjectTaskDraftRouteLayer, cmmdGetProjectTaskDraftRouteLayer, cmmdUpdateProjectTaskDraftRouteLayer, cmmdPreviewProjectTaskDraftRouteLayer, cmmdCommitProjectTaskDraftRouteLayer, cmmdDiscardProjectTaskDraftRouteLayer, cmmdGetProjectLeadPlanRouteLayer, cmmdActivateProjectLeadAuthorityRouteLayer, cmmdGetProjectLeadReadinessRouteLayer, cmmdGetProjectLeadCapabilitiesRouteLayer, cmmdGetProjectLeadSummaryRouteLayer, cmmdGetProjectLeadDetailRouteLayer, cmmdGetProjectLeadBriefingRouteLayer, cmmdListProjectLeadEventsRouteLayer, cmmdExplainProjectLeadRouteLayer, cmmdPauseProjectLeadRouteLayer, cmmdResumeProjectLeadRouteLayer, cmmdReserveProjectLeadTaskRouteLayer, cmmdReleaseProjectLeadReservationRouteLayer, cmmdReconcileProjectLeadRouteLayer, cmmdResolveProjectLeadAttentionRouteLayer, cmmdClaimProjectLeadControllerRouteLayer, cmmdRenewProjectLeadControllerClaimRouteLayer, cmmdYieldProjectLeadControllerClaimRouteLayer, cmmdAcknowledgeProjectLeadControllerEventRouteLayer, cmmdRecordProjectLeadControllerDecisionRouteLayer, cmmdListForgeAutomationPresetsRouteLayer, cmmdListUserForgeAutomationRulesRouteLayer, cmmdCreateUserForgeAutomationRuleRouteLayer, cmmdUpdateUserForgeAutomationRuleRouteLayer, cmmdListUserForgeAutomationRunsRouteLayer, cmmdStartUserForgeAutomationRunRouteLayer, cmmdListForgeAutomationRulesRouteLayer, cmmdCreateForgeAutomationRuleRouteLayer, cmmdUpdateForgeAutomationRuleRouteLayer, cmmdListForgeAutomationRunsRouteLayer, cmmdStartForgeAutomationRunRouteLayer, cmmdGetForgeAutomationRunRouteLayer, cmmdRetryForgeAutomationRunRouteLayer, cmmdCancelForgeAutomationRunRouteLayer, cmmdApproveForgeAutomationEscalationRouteLayer, cmmdRejectForgeAutomationEscalationRouteLayer, cmmdListProjectAgentMembersRouteLayer, cmmdCreateProjectAgentMemberRouteLayer, cmmdGetProjectAgentMemberRouteLayer, cmmdRenameProjectAgentMemberRouteLayer, cmmdRetireProjectAgentMemberRouteLayer, cmmdUpdateProjectAgentMemberAvatarRouteLayer, cmmdListProjectAgentMemberInstancesRouteLayer, cmmdPreviewProjectAgentMemberConsolidationRouteLayer, cmmdApplyProjectAgentMemberConsolidationRouteLayer, cmmdPutProjectTaskAssignmentRouteLayer, cmmdListProjectBoardRouteLayer, cmmdGetProjectTaskWorkflowRouteLayer, cmmdUpdateProjectTaskWorkflowRouteLayer, cmmdCreateProjectBoardTaskRouteLayer, cmmdUpdateProjectBoardTaskRouteLayer, cmmdUpdateProjectBoardTaskStatusRouteLayer, cmmdListTaskExecutionOptionsRouteLayer, cmmdCreateTaskWorkSessionRouteLayer, cmmdListProjectWorkSessionsRouteLayer, cmmdGetWorkSessionRouteLayer, cmmdUpdateWorkSessionRouteLayer, cmmdAttachWorkSessionThreadRouteLayer, cmmdListTaskConversationsRouteLayer, cmmdLinkTaskConversationRouteLayer, cmmdGetTaskHistoryRouteLayer, cmmdGetTaskConversationRouteLayer, cmmdSpawnForgeThreadFromBoardTaskRouteLayer, cmmdListCenterBoardRouteLayer, cmmdCreateCenterBoardTaskRouteLayer, cmmdCreateFeedbackRouteLayer, cmmdUpdateCenterBoardTaskRouteLayer, cmmdMoveCenterBoardTaskRouteLayer, cmmdMoveProjectBoardTaskRouteLayer, cmmdArchiveProjectBoardTaskRouteLayer, cmmdUnarchiveProjectBoardTaskRouteLayer, cmmdArchiveCenterBoardTaskRouteLayer, cmmdUnarchiveCenterBoardTaskRouteLayer, cmmdBootstrapRouteLayer, cmmdGetAccountPreferencesRouteLayer, cmmdUpdateAccountPreferencesRouteLayer, cmmdGetOrgProviderPolicyRouteLayer, cmmdListChatsRouteLayer, cmmdGetChatRouteLayer, cmmdListDevicesRouteLayer, runtimeReplicationStatusRouteLayer, cmmdRegisterDeviceRouteLayer, cmmdHeartbeatRuntimeRouteLayer, cmmdGrantRuntimeAccessRouteLayer, cmmdRevokeRuntimeAccessRouteLayer, cmmdCreateRelayControlRouteLayer, cmmdCreateRelayActionGrantRouteLayer, cmmdReplaceRuntimeInventoryRouteLayer, cmmdListRuntimeInventoryRouteLayer, cmmdGetRuntimeDiagnosticsRouteLayer, cmmdProvisionAuthRuntimeRouteLayer, cmmdGetAuthRuntimeRouteLayer, cmmdDestroyAuthRuntimeRouteLayer, cmmdConnectAuthRuntimeRouteLayer, cmmdGetProviderAccountsRouteLayer, cmmdDeleteProviderAccountRouteLayer, cmmdSetProviderAccountDefaultRouteLayer, cmmdGetProviderUsageRouteLayer, cmmdRefreshProviderUsageRouteLayer, cmmdGetUserCodexCredentialRouteLayer, cmmdDeleteUserCodexCredentialRouteLayer, cmmdGetUserClaudeCredentialRouteLayer, cmmdDeleteUserClaudeCredentialRouteLayer, cmmdGetClaudeRuntimeReadinessRouteLayer, cmmdAppendRuntimeThreadEventsRouteLayer, cmmdGetRuntimeThreadReplicaRouteLayer, cmmdRenameDeviceRouteLayer, cmmdRevokeDeviceRouteLayer, cmmdInstallConnectorRouteLayer, cmmdListConnectorsRouteLayer, cmmdForgeCloudProjectsListRouteLayer, cmmdForgeCloudProjectsEventsRouteLayer, cmmdForgeCloudProjectRegisterRouteLayer, cmmdForgeCloudProjectUnregisterRouteLayer, cmmdForgeCloudProjectLifecyclePreflightRouteLayer, cmmdForgeCloudProjectRemovalRouteLayer, cmmdForgeCloudProjectRemovalPreviewRouteLayer, cmmdForgeCloudProjectRemovalReceiptRouteLayer, cmmdForgeRuntimesEnsureRouteLayer, cmmdForgeRuntimesConnectRouteLayer, ownerRuntimeCodexReadinessRouteLayer, cmmdForgeRuntimesStatusRouteLayer, cmmdForgeRuntimesStartRouteLayer, cmmdForgeRuntimesStopRouteLayer, cmmdForgeRuntimesRecycleRouteLayer, cmmdForgeRuntimesUpdateCommitRouteLayer, cmmdForgeRuntimesDestroyRouteLayer, cmmdRenameForgeRuntimeRouteLayer, cmmdGetTaskRouteLayer, commandUpdateTaskRouteLayer, mobileProviderCatalogRouteLayer, cmmdUsageSummaryRouteLayer, cmmdBillingRouteLayer, cmmdBillingSeriesRouteLayer, attachmentsRouteLayer, orchestrationDispatchRouteLayer, orchestrationCmmdWorkRunEventRouteLayer, orchestrationAutomationStartThreadRouteLayer, orchestrationAutomationRebindRouteLayer, orchestrationAutomationTerminalReconcileRouteLayer, mobileGitRunStackedActionRouteLayer, pullRequestDiffRouteLayer, orchestrationSnapshotRouteLayer, localAutomationListRouteLayer, localAutomationCreateRouteLayer, localAutomationUpdateRouteLayer, localAutomationDeleteRouteLayer, localAutomationRunRouteLayer, otlpTracesProxyRouteLayer, devTunnelProxyRouteLayer, devTunnelLocalPortProxyRouteLayer, projectFaviconRouteLayer, serverEnvironmentRouteLayer, browserWebRtcReadinessRouteLayer, staticAndDevRouteLayer, githubStatusRouteLayer, githubAuthorizeUrlRouteLayer, githubDisconnectRouteLayer, githubReposRouteLayer, githubCloneRouteLayer, githubCloneJobStartRouteLayer, githubCloneJobStatusRouteLayer, githubRefreshCredentialsRouteLayer, githubToolConfirmationApproveRouteLayer, projectLinkGetRouteLayer, projectLinkListRouteLayer, projectLinkSetRouteLayer, projectLinkDeleteRouteLayer, cmmdWorkspacesRouteLayer, cmmdCampaignsRouteLayer, cmmdProjectLinksRouteLayer, cmmdEnsureGitHubProjectContextRouteLayer, cmmdProjectRepositoryEnsureRouteLayer, cmmdProjectsGetRouteLayer, cmmdProjectsCreateRouteLayer, workspaceReadinessRouteLayer, runtimeLivenessRouteLayer, claudeNativeGenerationProofRouteLayer, claudeUsageRouteLayer, codexRuntimeProviderReadinessRouteLayer, runtimeDiagnosticsRouteLayer, cloudFoldersRouteLayer, cloudProjectCreateRouteLayer, gitUrlCloneRouteLayer, websocketRpcRouteLayer).pipe(provide$1(browserApiCorsLayer));
|
|
309617
310058
|
const runServer = launch$1(unwrap(gen(function* () {
|
|
309618
310059
|
const config = yield* ServerConfig;
|
|
309619
|
-
fixPath();
|
|
310060
|
+
fixPath({ preferProcessPath: config.forgeCmmdRuntimeMode === true });
|
|
309620
310061
|
const httpListeningLayer = effectDiscard(gen(function* () {
|
|
309621
310062
|
yield* HttpServer;
|
|
309622
310063
|
yield* (yield* ServerRuntimeStartup).markHttpListening;
|