t3 0.0.4 → 0.0.6
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/client/assets/{DiffPanel-DxvQMXZW.js → DiffPanel-CzalIv5q.js} +1 -1
- package/dist/client/assets/{angular-html-PO6YH8f-.js → angular-html-Q9OBcLFT.js} +1 -1
- package/dist/client/assets/{angular-ts-DaJ2RvnO.js → angular-ts-G-pBmCN8.js} +1 -1
- package/dist/client/assets/{apl-zEuTt-He.js → apl-3Q0t3NrW.js} +1 -1
- package/dist/client/assets/{astro-DwysnkhD.js → astro-t4EQKiJS.js} +1 -1
- package/dist/client/assets/{blade-GgAGAlM8.js → blade-DFB03N9P.js} +1 -1
- package/dist/client/assets/{c-DzeHBMp7.js → c-CJdmBuHo.js} +1 -1
- package/dist/client/assets/{cobol-iVCIJtWR.js → cobol-DrxRUGxg.js} +1 -1
- package/dist/client/assets/{coffee-BxMkYhOP.js → coffee-9oBXXYx-.js} +1 -1
- package/dist/client/assets/{cpp-BEfmDGKr.js → cpp-Bvis2W13.js} +1 -1
- package/dist/client/assets/{crystal-CGJ9U7K8.js → crystal-DY1aiNTR.js} +1 -1
- package/dist/client/assets/{css-D-J6muk9.js → css-02pdHNTz.js} +1 -1
- package/dist/client/assets/{edge-B5l1ep6K.js → edge-DtLhn633.js} +1 -1
- package/dist/client/assets/{elixir-DT7C4nRI.js → elixir-Db0ZOwHP.js} +1 -1
- package/dist/client/assets/{elm-DacHZu0P.js → elm-Cyc3mBqv.js} +1 -1
- package/dist/client/assets/{erb-B4qeW_5R.js → erb-BqGWZuL-.js} +1 -1
- package/dist/client/assets/{git-rebase-Dk3SbS0p.js → git-rebase-D422_Yl8.js} +1 -1
- package/dist/client/assets/{glimmer-js-DEVFfhxl.js → glimmer-js-DoJ-tCrR.js} +1 -1
- package/dist/client/assets/{glimmer-ts-CsEJRls5.js → glimmer-ts-BZsPNmjB.js} +1 -1
- package/dist/client/assets/{glsl-Im5_mbH8.js → glsl-B5R1dOOR.js} +1 -1
- package/dist/client/assets/{graphql-DrNOYYdo.js → graphql-Ddxln-5C.js} +1 -1
- package/dist/client/assets/{hack-D53MnsWT.js → hack-DxrK_CCL.js} +1 -1
- package/dist/client/assets/{haml-B4euY0vY.js → haml-BMOU1n--.js} +1 -1
- package/dist/client/assets/{handlebars-CtMln1GB.js → handlebars-CeE0e_mR.js} +1 -1
- package/dist/client/assets/{html-B7CTON1n.js → html-BVHBnR-i.js} +1 -1
- package/dist/client/assets/{html-derivative-DwHkcKJ3.js → html-derivative-mUvHoP7c.js} +1 -1
- package/dist/client/assets/{http-BmGf_D9h.js → http-BuVyp3yL.js} +1 -1
- package/dist/client/assets/{hurl-nnTeLb9y.js → hurl-DFOtlUGQ.js} +1 -1
- package/dist/client/assets/{index-nhQz5h-9.js → index-RfSFywij.js} +84 -84
- package/dist/client/assets/index-ftgDvYhP.css +1 -0
- package/dist/client/assets/{java-d7p4YLBX.js → java-DWjc310D.js} +1 -1
- package/dist/client/assets/{javascript-BcWERNKv.js → javascript-BwSIWJhk.js} +1 -1
- package/dist/client/assets/{jinja-CB7zbi6K.js → jinja-9HCjw8DX.js} +1 -1
- package/dist/client/assets/{jison-BBAjjhmY.js → jison-CQjqp5mh.js} +1 -1
- package/dist/client/assets/{json-CNf-D-Ai.js → json-Bxndor4j.js} +1 -1
- package/dist/client/assets/{jsx-DdT20ddY.js → jsx-n4rYpDuw.js} +1 -1
- package/dist/client/assets/{julia-Bp0laiQT.js → julia-DcNaM7Yd.js} +1 -1
- package/dist/client/assets/{just-C2n1JzZf.js → just-C1m9RUIb.js} +1 -1
- package/dist/client/assets/{latex-BX6qSGK7.js → latex-D3mwWg5j.js} +1 -1
- package/dist/client/assets/{liquid-DgouKodz.js → liquid-eCdlsRlY.js} +1 -1
- package/dist/client/assets/{lua-B-JF8LJ7.js → lua-DwqR8oFs.js} +1 -1
- package/dist/client/assets/{marko-DdaUBozC.js → marko-Dop12MMU.js} +1 -1
- package/dist/client/assets/{mdc-Tak-aC9z.js → mdc-yT8Tp3z8.js} +1 -1
- package/dist/client/assets/{nginx-C26ntnSE.js → nginx-C0O70Wbm.js} +1 -1
- package/dist/client/assets/{nim-KDX5BPuj.js → nim-BRPmBKYY.js} +1 -1
- package/dist/client/assets/{perl-BwpIuvHY.js → perl-UnVBaajl.js} +1 -1
- package/dist/client/assets/{php-CmeyInUZ.js → php-BOYwCxJb.js} +1 -1
- package/dist/client/assets/{pug-t16F4unN.js → pug-ByvSIP5s.js} +1 -1
- package/dist/client/assets/{qml-DKXIwoU2.js → qml-B5beGnUN.js} +1 -1
- package/dist/client/assets/{r-Bm5SLw35.js → r-C61wpruV.js} +1 -1
- package/dist/client/assets/{razor-Cg7E03DE.js → razor-DyN--uT9.js} +1 -1
- package/dist/client/assets/{regexp-B4BXgdkL.js → regexp-6VAUbr0Q.js} +1 -1
- package/dist/client/assets/{rst-CErMU3C_.js → rst-B2fnv699.js} +1 -1
- package/dist/client/assets/{ruby-C-LB4XJd.js → ruby-DCyI54Nr.js} +1 -1
- package/dist/client/assets/{sas-KXri-Pyv.js → sas-D96h3-dB.js} +1 -1
- package/dist/client/assets/{scss-5RriKTs7.js → scss-BlMMkMkv.js} +1 -1
- package/dist/client/assets/{shellscript-d2-2QqxY.js → shellscript-CiMR4TR3.js} +1 -1
- package/dist/client/assets/{shellsession-BBXyPthj.js → shellsession-DSjYDFop.js} +1 -1
- package/dist/client/assets/{soy-B5WN_6xP.js → soy-BFGCQBgy.js} +1 -1
- package/dist/client/assets/{sql-ByWEVmCC.js → sql-BwEhv1j0.js} +1 -1
- package/dist/client/assets/{stata-ZtX2PbNh.js → stata-x_4M6-Oe.js} +1 -1
- package/dist/client/assets/{surrealql-DIyL-cuf.js → surrealql-DaOaS7Zh.js} +1 -1
- package/dist/client/assets/{svelte-Dv8xlo7a.js → svelte-zAhq3p8s.js} +1 -1
- package/dist/client/assets/{templ-DEm7cZue.js → templ-DM2A7Bp4.js} +1 -1
- package/dist/client/assets/{tex-GXsn56xP.js → tex-DthZzwAp.js} +1 -1
- package/dist/client/assets/{ts-tags-ByCXY4T3.js → ts-tags-DTot_4bW.js} +1 -1
- package/dist/client/assets/{tsx-By_LD9k9.js → tsx-ChbyGfgR.js} +1 -1
- package/dist/client/assets/{twig-Du6sgCzz.js → twig-BF4HNPSM.js} +1 -1
- package/dist/client/assets/{typescript-DodIuvim.js → typescript-BpcaieTL.js} +1 -1
- package/dist/client/assets/{vue-D-NASAgP.js → vue-Br8YjcCE.js} +1 -1
- package/dist/client/assets/{vue-html-xVY24NdN.js → vue-html-JT5J41KV.js} +1 -1
- package/dist/client/assets/{vue-vine-D6iwmyYT.js → vue-vine-BpyzIF4o.js} +1 -1
- package/dist/client/assets/{xml-Bnub5Bnx.js → xml-BG2RtxuS.js} +1 -1
- package/dist/client/assets/{xsl-gWFBcUcI.js → xsl-tkNQVlOE.js} +1 -1
- package/dist/client/assets/{yaml-Bh8YueBH.js → yaml-B6r-KKwn.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/index.cjs +157 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +157 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/client/assets/index-D2CnaX3V.css +0 -1
package/dist/index.mjs
CHANGED
|
@@ -443,6 +443,11 @@ const ProviderSandboxMode = Schema.Literals([
|
|
|
443
443
|
"danger-full-access"
|
|
444
444
|
]);
|
|
445
445
|
const ProviderServiceTier = Schema.Literals(["fast", "flex"]);
|
|
446
|
+
const CodexProviderStartOptions$1 = Schema.Struct({
|
|
447
|
+
binaryPath: Schema.optional(TrimmedNonEmptyString),
|
|
448
|
+
homePath: Schema.optional(TrimmedNonEmptyString)
|
|
449
|
+
});
|
|
450
|
+
const ProviderStartOptions$1 = Schema.Struct({ codex: Schema.optional(CodexProviderStartOptions$1) });
|
|
446
451
|
const RuntimeMode = Schema.Literals(["approval-required", "full-access"]);
|
|
447
452
|
const DEFAULT_RUNTIME_MODE$2 = "full-access";
|
|
448
453
|
const ProviderInteractionMode = Schema.Literals(["default", "plan"]);
|
|
@@ -701,6 +706,7 @@ const ThreadTurnStartCommand = Schema.Struct({
|
|
|
701
706
|
model: Schema.optional(TrimmedNonEmptyString),
|
|
702
707
|
serviceTier: Schema.optional(Schema.NullOr(ProviderServiceTier)),
|
|
703
708
|
modelOptions: Schema.optional(ProviderModelOptions),
|
|
709
|
+
providerOptions: Schema.optional(ProviderStartOptions$1),
|
|
704
710
|
assistantDeliveryMode: Schema.optional(AssistantDeliveryMode),
|
|
705
711
|
runtimeMode: RuntimeMode.pipe(Schema.withDecodingDefault(() => DEFAULT_RUNTIME_MODE$2)),
|
|
706
712
|
interactionMode: ProviderInteractionMode.pipe(Schema.withDecodingDefault(() => DEFAULT_PROVIDER_INTERACTION_MODE)),
|
|
@@ -720,6 +726,7 @@ const ClientThreadTurnStartCommand = Schema.Struct({
|
|
|
720
726
|
model: Schema.optional(TrimmedNonEmptyString),
|
|
721
727
|
serviceTier: Schema.optional(Schema.NullOr(ProviderServiceTier)),
|
|
722
728
|
modelOptions: Schema.optional(ProviderModelOptions),
|
|
729
|
+
providerOptions: Schema.optional(ProviderStartOptions$1),
|
|
723
730
|
assistantDeliveryMode: Schema.optional(AssistantDeliveryMode),
|
|
724
731
|
runtimeMode: RuntimeMode,
|
|
725
732
|
interactionMode: ProviderInteractionMode,
|
|
@@ -962,6 +969,7 @@ const ThreadTurnStartRequestedPayload = Schema.Struct({
|
|
|
962
969
|
model: Schema.optional(TrimmedNonEmptyString),
|
|
963
970
|
serviceTier: Schema.optional(Schema.NullOr(ProviderServiceTier)),
|
|
964
971
|
modelOptions: Schema.optional(ProviderModelOptions),
|
|
972
|
+
providerOptions: Schema.optional(ProviderStartOptions$1),
|
|
965
973
|
assistantDeliveryMode: Schema.optional(AssistantDeliveryMode),
|
|
966
974
|
runtimeMode: RuntimeMode.pipe(Schema.withDecodingDefault(() => DEFAULT_RUNTIME_MODE$2)),
|
|
967
975
|
interactionMode: ProviderInteractionMode.pipe(Schema.withDecodingDefault(() => DEFAULT_PROVIDER_INTERACTION_MODE)),
|
|
@@ -4396,6 +4404,7 @@ const decideOrchestrationCommand = Effect.fn("decideOrchestrationCommand")(funct
|
|
|
4396
4404
|
...command.model !== void 0 ? { model: command.model } : {},
|
|
4397
4405
|
...command.serviceTier !== void 0 ? { serviceTier: command.serviceTier } : {},
|
|
4398
4406
|
...command.modelOptions !== void 0 ? { modelOptions: command.modelOptions } : {},
|
|
4407
|
+
...command.providerOptions !== void 0 ? { providerOptions: command.providerOptions } : {},
|
|
4399
4408
|
assistantDeliveryMode: command.assistantDeliveryMode ?? DEFAULT_ASSISTANT_DELIVERY_MODE$1,
|
|
4400
4409
|
runtimeMode: readModel.threads.find((entry) => entry.id === command.threadId)?.runtimeMode ?? command.runtimeMode,
|
|
4401
4410
|
interactionMode: readModel.threads.find((entry) => entry.id === command.threadId)?.interactionMode ?? command.interactionMode,
|
|
@@ -5817,6 +5826,7 @@ const make$1 = Effect.gen(function* () {
|
|
|
5817
5826
|
lookup: () => Effect.succeed(true)
|
|
5818
5827
|
});
|
|
5819
5828
|
const hasHandledTurnStartRecently = (key) => Cache.getOption(handledTurnStartKeys, key).pipe(Effect.flatMap((cached) => Cache.set(handledTurnStartKeys, key, true).pipe(Effect.as(Option.isSome(cached)))));
|
|
5829
|
+
const threadProviderOptions = /* @__PURE__ */ new Map();
|
|
5820
5830
|
const appendProviderFailureActivity = (input) => orchestrationEngine.dispatch({
|
|
5821
5831
|
type: "thread.activity.append",
|
|
5822
5832
|
commandId: serverCommandId("provider-failure-activity"),
|
|
@@ -5865,6 +5875,7 @@ const make$1 = Effect.gen(function* () {
|
|
|
5865
5875
|
...desiredModel ? { model: desiredModel } : {},
|
|
5866
5876
|
...options?.serviceTier !== void 0 ? { serviceTier: options.serviceTier } : {},
|
|
5867
5877
|
...options?.modelOptions !== void 0 ? { modelOptions: options.modelOptions } : {},
|
|
5878
|
+
...options?.providerOptions !== void 0 ? { providerOptions: options.providerOptions } : {},
|
|
5868
5879
|
...input?.resumeCursor !== void 0 ? { resumeCursor: input.resumeCursor } : {},
|
|
5869
5880
|
runtimeMode: desiredRuntimeMode
|
|
5870
5881
|
});
|
|
@@ -5924,11 +5935,13 @@ const make$1 = Effect.gen(function* () {
|
|
|
5924
5935
|
});
|
|
5925
5936
|
const sendTurnForThread = Effect.fnUntraced(function* (input) {
|
|
5926
5937
|
if (!(yield* resolveThread(input.threadId))) return;
|
|
5938
|
+
if (input.providerOptions !== void 0) threadProviderOptions.set(input.threadId, input.providerOptions);
|
|
5927
5939
|
yield* ensureSessionForThread(input.threadId, input.createdAt, {
|
|
5928
5940
|
...input.provider !== void 0 ? { provider: input.provider } : {},
|
|
5929
5941
|
...input.model !== void 0 ? { model: input.model } : {},
|
|
5930
5942
|
...input.serviceTier !== void 0 ? { serviceTier: input.serviceTier } : {},
|
|
5931
|
-
...input.modelOptions !== void 0 ? { modelOptions: input.modelOptions } : {}
|
|
5943
|
+
...input.modelOptions !== void 0 ? { modelOptions: input.modelOptions } : {},
|
|
5944
|
+
...input.providerOptions !== void 0 ? { providerOptions: input.providerOptions } : {}
|
|
5932
5945
|
});
|
|
5933
5946
|
const normalizedInput = toNonEmptyProviderInput(input.messageText);
|
|
5934
5947
|
const normalizedAttachments = input.attachments ?? [];
|
|
@@ -6017,6 +6030,7 @@ const make$1 = Effect.gen(function* () {
|
|
|
6017
6030
|
...event.payload.model !== void 0 ? { model: event.payload.model } : {},
|
|
6018
6031
|
...event.payload.serviceTier !== void 0 ? { serviceTier: event.payload.serviceTier } : {},
|
|
6019
6032
|
...event.payload.modelOptions !== void 0 ? { modelOptions: event.payload.modelOptions } : {},
|
|
6033
|
+
...event.payload.providerOptions !== void 0 ? { providerOptions: event.payload.providerOptions } : {},
|
|
6020
6034
|
interactionMode: event.payload.interactionMode,
|
|
6021
6035
|
createdAt: event.payload.createdAt
|
|
6022
6036
|
});
|
|
@@ -6118,7 +6132,8 @@ const make$1 = Effect.gen(function* () {
|
|
|
6118
6132
|
case "thread.runtime-mode-set": {
|
|
6119
6133
|
const thread = yield* resolveThread(event.payload.threadId);
|
|
6120
6134
|
if (!thread?.session || thread.session.status === "stopped") return;
|
|
6121
|
-
|
|
6135
|
+
const cachedProviderOptions = threadProviderOptions.get(event.payload.threadId);
|
|
6136
|
+
yield* ensureSessionForThread(event.payload.threadId, event.occurredAt, { ...cachedProviderOptions !== void 0 ? { providerOptions: cachedProviderOptions } : {} });
|
|
6122
6137
|
return;
|
|
6123
6138
|
}
|
|
6124
6139
|
case "thread.turn-start-requested":
|
|
@@ -9044,6 +9059,8 @@ const make = Effect.gen(function* () {
|
|
|
9044
9059
|
if (assistantCompletion) {
|
|
9045
9060
|
const assistantMessageId = assistantCompletion.messageId;
|
|
9046
9061
|
const turnId = toTurnId$1(event.turnId);
|
|
9062
|
+
const existingAssistantMessage = thread.messages.find((entry) => entry.id === assistantMessageId);
|
|
9063
|
+
const shouldApplyFallbackCompletionText = !existingAssistantMessage || existingAssistantMessage.text.length === 0;
|
|
9047
9064
|
if (turnId) yield* rememberAssistantMessageId(thread.id, turnId, assistantMessageId);
|
|
9048
9065
|
yield* finalizeAssistantMessage({
|
|
9049
9066
|
event,
|
|
@@ -9053,7 +9070,7 @@ const make = Effect.gen(function* () {
|
|
|
9053
9070
|
createdAt: now,
|
|
9054
9071
|
commandTag: "assistant-complete",
|
|
9055
9072
|
finalDeltaCommandTag: "assistant-delta-finalize",
|
|
9056
|
-
...assistantCompletion.fallbackText !== void 0 ? { fallbackText: assistantCompletion.fallbackText } : {}
|
|
9073
|
+
...assistantCompletion.fallbackText !== void 0 && shouldApplyFallbackCompletionText ? { fallbackText: assistantCompletion.fallbackText } : {}
|
|
9057
9074
|
});
|
|
9058
9075
|
if (turnId) yield* forgetAssistantMessageId(thread.id, turnId, assistantMessageId);
|
|
9059
9076
|
}
|
|
@@ -9203,8 +9220,82 @@ function normalizeModelSlug(model, provider = "codex") {
|
|
|
9203
9220
|
return typeof aliased === "string" ? aliased : trimmed;
|
|
9204
9221
|
}
|
|
9205
9222
|
|
|
9223
|
+
//#endregion
|
|
9224
|
+
//#region src/provider/codexCliVersion.ts
|
|
9225
|
+
const CODEX_VERSION_PATTERN = /\bv?(\d+\.\d+(?:\.\d+)?(?:-[0-9A-Za-z.-]+)?)\b/;
|
|
9226
|
+
const MINIMUM_CODEX_CLI_VERSION = "0.37.0";
|
|
9227
|
+
function normalizeCodexVersion(version) {
|
|
9228
|
+
const [main, prerelease] = version.trim().split("-", 2);
|
|
9229
|
+
const segments = (main ?? "").split(".").map((segment) => segment.trim()).filter((segment) => segment.length > 0);
|
|
9230
|
+
if (segments.length === 2) segments.push("0");
|
|
9231
|
+
return prerelease ? `${segments.join(".")}-${prerelease}` : segments.join(".");
|
|
9232
|
+
}
|
|
9233
|
+
function parseSemver(version) {
|
|
9234
|
+
const [main = "", prerelease] = normalizeCodexVersion(version).split("-", 2);
|
|
9235
|
+
const segments = main.split(".");
|
|
9236
|
+
if (segments.length !== 3) return null;
|
|
9237
|
+
const [majorSegment, minorSegment, patchSegment] = segments;
|
|
9238
|
+
if (majorSegment === void 0 || minorSegment === void 0 || patchSegment === void 0) return null;
|
|
9239
|
+
const major = Number.parseInt(majorSegment, 10);
|
|
9240
|
+
const minor = Number.parseInt(minorSegment, 10);
|
|
9241
|
+
const patch = Number.parseInt(patchSegment, 10);
|
|
9242
|
+
if (![
|
|
9243
|
+
major,
|
|
9244
|
+
minor,
|
|
9245
|
+
patch
|
|
9246
|
+
].every(Number.isInteger)) return null;
|
|
9247
|
+
return {
|
|
9248
|
+
major,
|
|
9249
|
+
minor,
|
|
9250
|
+
patch,
|
|
9251
|
+
prerelease: prerelease?.split(".").map((segment) => segment.trim()).filter((segment) => segment.length > 0) ?? []
|
|
9252
|
+
};
|
|
9253
|
+
}
|
|
9254
|
+
function comparePrereleaseIdentifier(left, right) {
|
|
9255
|
+
const leftNumeric = /^\d+$/.test(left);
|
|
9256
|
+
const rightNumeric = /^\d+$/.test(right);
|
|
9257
|
+
if (leftNumeric && rightNumeric) return Number.parseInt(left, 10) - Number.parseInt(right, 10);
|
|
9258
|
+
if (leftNumeric) return -1;
|
|
9259
|
+
if (rightNumeric) return 1;
|
|
9260
|
+
return left.localeCompare(right);
|
|
9261
|
+
}
|
|
9262
|
+
function compareCodexCliVersions(left, right) {
|
|
9263
|
+
const parsedLeft = parseSemver(left);
|
|
9264
|
+
const parsedRight = parseSemver(right);
|
|
9265
|
+
if (!parsedLeft || !parsedRight) return left.localeCompare(right);
|
|
9266
|
+
if (parsedLeft.major !== parsedRight.major) return parsedLeft.major - parsedRight.major;
|
|
9267
|
+
if (parsedLeft.minor !== parsedRight.minor) return parsedLeft.minor - parsedRight.minor;
|
|
9268
|
+
if (parsedLeft.patch !== parsedRight.patch) return parsedLeft.patch - parsedRight.patch;
|
|
9269
|
+
if (parsedLeft.prerelease.length === 0 && parsedRight.prerelease.length === 0) return 0;
|
|
9270
|
+
if (parsedLeft.prerelease.length === 0) return 1;
|
|
9271
|
+
if (parsedRight.prerelease.length === 0) return -1;
|
|
9272
|
+
const length = Math.max(parsedLeft.prerelease.length, parsedRight.prerelease.length);
|
|
9273
|
+
for (let index = 0; index < length; index += 1) {
|
|
9274
|
+
const leftIdentifier = parsedLeft.prerelease[index];
|
|
9275
|
+
const rightIdentifier = parsedRight.prerelease[index];
|
|
9276
|
+
if (leftIdentifier === void 0) return -1;
|
|
9277
|
+
if (rightIdentifier === void 0) return 1;
|
|
9278
|
+
const comparison = comparePrereleaseIdentifier(leftIdentifier, rightIdentifier);
|
|
9279
|
+
if (comparison !== 0) return comparison;
|
|
9280
|
+
}
|
|
9281
|
+
return 0;
|
|
9282
|
+
}
|
|
9283
|
+
function parseCodexCliVersion(output) {
|
|
9284
|
+
const match = CODEX_VERSION_PATTERN.exec(output);
|
|
9285
|
+
if (!match?.[1]) return null;
|
|
9286
|
+
if (!parseSemver(match[1])) return null;
|
|
9287
|
+
return normalizeCodexVersion(match[1]);
|
|
9288
|
+
}
|
|
9289
|
+
function isCodexCliVersionSupported(version) {
|
|
9290
|
+
return compareCodexCliVersions(version, MINIMUM_CODEX_CLI_VERSION) >= 0;
|
|
9291
|
+
}
|
|
9292
|
+
function formatCodexCliUpgradeMessage(version) {
|
|
9293
|
+
return `Codex CLI ${version ? `v${version}` : "the installed version"} is too old for T3 Code. Upgrade to v${MINIMUM_CODEX_CLI_VERSION} or newer and restart T3 Code.`;
|
|
9294
|
+
}
|
|
9295
|
+
|
|
9206
9296
|
//#endregion
|
|
9207
9297
|
//#region src/codexAppServerManager.ts
|
|
9298
|
+
const CODEX_VERSION_CHECK_TIMEOUT_MS = 4e3;
|
|
9208
9299
|
const ANSI_ESCAPE_CHAR = String.fromCharCode(27);
|
|
9209
9300
|
const ANSI_ESCAPE_REGEX = new RegExp(`${ANSI_ESCAPE_CHAR}\\[[0-9;]*m`, "g");
|
|
9210
9301
|
const CODEX_STDERR_LOG_REGEX = /^\d{4}-\d{2}-\d{2}T\S+\s+(TRACE|DEBUG|INFO|WARN|ERROR)\s+\S+:\s+(.*)$/;
|
|
@@ -9499,6 +9590,11 @@ var CodexAppServerManager = class extends EventEmitter {
|
|
|
9499
9590
|
const codexOptions = readCodexProviderOptions(input);
|
|
9500
9591
|
const codexBinaryPath = codexOptions.binaryPath ?? "codex";
|
|
9501
9592
|
const codexHomePath = codexOptions.homePath;
|
|
9593
|
+
this.assertSupportedCodexCliVersion({
|
|
9594
|
+
binaryPath: codexBinaryPath,
|
|
9595
|
+
cwd: resolvedCwd,
|
|
9596
|
+
...codexHomePath ? { homePath: codexHomePath } : {}
|
|
9597
|
+
});
|
|
9502
9598
|
const child = spawn(codexBinaryPath, ["app-server"], {
|
|
9503
9599
|
cwd: resolvedCwd,
|
|
9504
9600
|
env: {
|
|
@@ -10050,6 +10146,9 @@ var CodexAppServerManager = class extends EventEmitter {
|
|
|
10050
10146
|
emitEvent(event) {
|
|
10051
10147
|
this.emit("event", event);
|
|
10052
10148
|
}
|
|
10149
|
+
assertSupportedCodexCliVersion(input) {
|
|
10150
|
+
assertSupportedCodexCliVersion(input);
|
|
10151
|
+
}
|
|
10053
10152
|
updateSession(context, updates) {
|
|
10054
10153
|
context.session = {
|
|
10055
10154
|
...context.session,
|
|
@@ -10139,6 +10238,37 @@ function readCodexProviderOptions(input) {
|
|
|
10139
10238
|
...options.homePath ? { homePath: options.homePath } : {}
|
|
10140
10239
|
};
|
|
10141
10240
|
}
|
|
10241
|
+
function assertSupportedCodexCliVersion(input) {
|
|
10242
|
+
const result = spawnSync(input.binaryPath, ["--version"], {
|
|
10243
|
+
cwd: input.cwd,
|
|
10244
|
+
env: {
|
|
10245
|
+
...process.env,
|
|
10246
|
+
...input.homePath ? { CODEX_HOME: input.homePath } : {}
|
|
10247
|
+
},
|
|
10248
|
+
encoding: "utf8",
|
|
10249
|
+
shell: process.platform === "win32",
|
|
10250
|
+
stdio: [
|
|
10251
|
+
"ignore",
|
|
10252
|
+
"pipe",
|
|
10253
|
+
"pipe"
|
|
10254
|
+
],
|
|
10255
|
+
timeout: CODEX_VERSION_CHECK_TIMEOUT_MS,
|
|
10256
|
+
maxBuffer: 1024 * 1024
|
|
10257
|
+
});
|
|
10258
|
+
if (result.error) {
|
|
10259
|
+
const lower = result.error.message.toLowerCase();
|
|
10260
|
+
if (lower.includes("enoent") || lower.includes("command not found") || lower.includes("not found")) throw new Error(`Codex CLI (${input.binaryPath}) is not installed or not executable.`);
|
|
10261
|
+
throw new Error(`Failed to execute Codex CLI version check: ${result.error.message || String(result.error)}`);
|
|
10262
|
+
}
|
|
10263
|
+
const stdout = result.stdout ?? "";
|
|
10264
|
+
const stderr = result.stderr ?? "";
|
|
10265
|
+
if (result.status !== 0) {
|
|
10266
|
+
const detail = stderr.trim() || stdout.trim() || `Command exited with code ${result.status}.`;
|
|
10267
|
+
throw new Error(`Codex CLI version check failed. ${detail}`);
|
|
10268
|
+
}
|
|
10269
|
+
const parsedVersion = parseCodexCliVersion(`${stdout}\n${stderr}`);
|
|
10270
|
+
if (parsedVersion && !isCodexCliVersionSupported(parsedVersion)) throw new Error(formatCodexCliUpgradeMessage(parsedVersion));
|
|
10271
|
+
}
|
|
10142
10272
|
function readResumeCursorThreadId(resumeCursor) {
|
|
10143
10273
|
if (!resumeCursor || typeof resumeCursor !== "object" || Array.isArray(resumeCursor)) return;
|
|
10144
10274
|
const rawThreadId = resumeCursor.threadId;
|
|
@@ -11395,14 +11525,21 @@ function toRuntimeStatus(session) {
|
|
|
11395
11525
|
default: return "running";
|
|
11396
11526
|
}
|
|
11397
11527
|
}
|
|
11398
|
-
function toRuntimePayloadFromSession(session) {
|
|
11528
|
+
function toRuntimePayloadFromSession(session, extra) {
|
|
11399
11529
|
return {
|
|
11400
11530
|
cwd: session.cwd ?? null,
|
|
11401
11531
|
model: session.model ?? null,
|
|
11402
11532
|
activeTurnId: session.activeTurnId ?? null,
|
|
11403
|
-
lastError: session.lastError ?? null
|
|
11533
|
+
lastError: session.lastError ?? null,
|
|
11534
|
+
...extra?.providerOptions !== void 0 ? { providerOptions: extra.providerOptions } : {}
|
|
11404
11535
|
};
|
|
11405
11536
|
}
|
|
11537
|
+
function readPersistedProviderOptions(runtimePayload) {
|
|
11538
|
+
if (!runtimePayload || typeof runtimePayload !== "object" || Array.isArray(runtimePayload)) return;
|
|
11539
|
+
const raw = "providerOptions" in runtimePayload ? runtimePayload.providerOptions : void 0;
|
|
11540
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
11541
|
+
return raw;
|
|
11542
|
+
}
|
|
11406
11543
|
function readPersistedCwd(runtimePayload) {
|
|
11407
11544
|
if (!runtimePayload || typeof runtimePayload !== "object" || Array.isArray(runtimePayload)) return;
|
|
11408
11545
|
const rawCwd = "cwd" in runtimePayload ? runtimePayload.cwd : void 0;
|
|
@@ -11418,13 +11555,13 @@ const makeProviderService = (options) => Effect.gen(function* () {
|
|
|
11418
11555
|
const runtimeEventQueue = yield* Queue.unbounded();
|
|
11419
11556
|
const runtimeEventPubSub = yield* PubSub.unbounded();
|
|
11420
11557
|
const publishRuntimeEvent = (event) => Effect.succeed(event).pipe(Effect.tap((canonicalEvent) => canonicalEventLogger ? canonicalEventLogger.write(canonicalEvent, null) : Effect.void), Effect.flatMap((canonicalEvent) => PubSub.publish(runtimeEventPubSub, canonicalEvent)), Effect.asVoid);
|
|
11421
|
-
const upsertSessionBinding = (session, threadId) => directory.upsert({
|
|
11558
|
+
const upsertSessionBinding = (session, threadId, extra) => directory.upsert({
|
|
11422
11559
|
threadId,
|
|
11423
11560
|
provider: session.provider,
|
|
11424
11561
|
runtimeMode: session.runtimeMode,
|
|
11425
11562
|
status: toRuntimeStatus(session),
|
|
11426
11563
|
...session.resumeCursor !== void 0 ? { resumeCursor: session.resumeCursor } : {},
|
|
11427
|
-
runtimePayload: toRuntimePayloadFromSession(session)
|
|
11564
|
+
runtimePayload: toRuntimePayloadFromSession(session, extra)
|
|
11428
11565
|
});
|
|
11429
11566
|
const providers = yield* registry.listProviders();
|
|
11430
11567
|
const adapters = yield* Effect.forEach(providers, (provider) => registry.getByProvider(provider));
|
|
@@ -11452,10 +11589,12 @@ const makeProviderService = (options) => Effect.gen(function* () {
|
|
|
11452
11589
|
}
|
|
11453
11590
|
if (!hasResumeCursor) return yield* toValidationError(input.operation, `Cannot recover thread '${input.binding.threadId}' because no provider resume state is persisted.`);
|
|
11454
11591
|
const persistedCwd = readPersistedCwd(input.binding.runtimePayload);
|
|
11592
|
+
const persistedProviderOptions = readPersistedProviderOptions(input.binding.runtimePayload);
|
|
11455
11593
|
const resumed = yield* adapter.startSession({
|
|
11456
11594
|
threadId: input.binding.threadId,
|
|
11457
11595
|
provider: input.binding.provider,
|
|
11458
11596
|
...persistedCwd ? { cwd: persistedCwd } : {},
|
|
11597
|
+
...persistedProviderOptions ? { providerOptions: persistedProviderOptions } : {},
|
|
11459
11598
|
...hasResumeCursor ? { resumeCursor: input.binding.resumeCursor } : {},
|
|
11460
11599
|
runtimeMode: input.binding.runtimeMode ?? "full-access"
|
|
11461
11600
|
});
|
|
@@ -11509,7 +11648,7 @@ const makeProviderService = (options) => Effect.gen(function* () {
|
|
|
11509
11648
|
const adapter = yield* registry.getByProvider(input.provider);
|
|
11510
11649
|
const session = yield* adapter.startSession(input);
|
|
11511
11650
|
if (session.provider !== adapter.provider) return yield* toValidationError("ProviderService.startSession", `Adapter/provider mismatch: requested '${adapter.provider}', received '${session.provider}'.`);
|
|
11512
|
-
yield* upsertSessionBinding(session, threadId);
|
|
11651
|
+
yield* upsertSessionBinding(session, threadId, { ...input.providerOptions !== void 0 ? { providerOptions: input.providerOptions } : {} });
|
|
11513
11652
|
yield* analytics.record("provider.session.started", {
|
|
11514
11653
|
provider: session.provider,
|
|
11515
11654
|
runtimeMode: input.runtimeMode,
|
|
@@ -15380,6 +15519,15 @@ const checkCodexProviderStatus = Effect.gen(function* () {
|
|
|
15380
15519
|
message: detail ? `Codex CLI is installed but failed to run. ${detail}` : "Codex CLI is installed but failed to run."
|
|
15381
15520
|
};
|
|
15382
15521
|
}
|
|
15522
|
+
const parsedVersion = parseCodexCliVersion(`${version.stdout}\n${version.stderr}`);
|
|
15523
|
+
if (parsedVersion && !isCodexCliVersionSupported(parsedVersion)) return {
|
|
15524
|
+
provider: CODEX_PROVIDER,
|
|
15525
|
+
status: "error",
|
|
15526
|
+
available: false,
|
|
15527
|
+
authStatus: "unknown",
|
|
15528
|
+
checkedAt,
|
|
15529
|
+
message: formatCodexCliUpgradeMessage(parsedVersion)
|
|
15530
|
+
};
|
|
15383
15531
|
const authProbe = yield* runCodexCommand(["login", "status"]).pipe(Effect.timeoutOption(DEFAULT_TIMEOUT_MS), Effect.result);
|
|
15384
15532
|
if (Result.isFailure(authProbe)) {
|
|
15385
15533
|
const error = authProbe.failure;
|
|
@@ -16465,7 +16613,7 @@ const getTelemetryIdentifier = Effect.gen(function* () {
|
|
|
16465
16613
|
|
|
16466
16614
|
//#endregion
|
|
16467
16615
|
//#region package.json
|
|
16468
|
-
var version = "0.0.
|
|
16616
|
+
var version = "0.0.5";
|
|
16469
16617
|
|
|
16470
16618
|
//#endregion
|
|
16471
16619
|
//#region src/telemetry/Layers/AnalyticsService.ts
|