topchester-ai 0.56.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +1 -1
- package/dist/bin.mjs.map +1 -1
- package/dist/{cli-AJknxj59.mjs → cli-Fw-z_PsS.mjs} +186 -32
- package/dist/cli-Fw-z_PsS.mjs.map +1 -0
- package/dist/cli.mjs +1 -1
- package/package.json +13 -13
- package/dist/cli-AJknxj59.mjs.map +0 -1
package/dist/bin.mjs
CHANGED
package/dist/bin.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.mjs","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { runTopchesterCli } from \"./cli.js\";\n\nawait runTopchesterCli();\n"],"mappings":";;;AAGA,MAAM,
|
|
1
|
+
{"version":3,"file":"bin.mjs","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { runTopchesterCli } from \"./cli.js\";\n\nawait runTopchesterCli();\n"],"mappings":";;;AAGA,MAAM,iBAAiB"}
|
|
@@ -5335,7 +5335,7 @@ function createCodexProviderFetch(options = {}) {
|
|
|
5335
5335
|
const providerId = options.providerId ?? "codex";
|
|
5336
5336
|
const upstreamFetch = options.fetch ?? fetch;
|
|
5337
5337
|
return (async (input, init) => {
|
|
5338
|
-
const request = await rewriteCodexRequest(input, init);
|
|
5338
|
+
const request = await rewriteCodexRequest(input, init, options.reasoningEffort);
|
|
5339
5339
|
const auth = await resolveCodexAuth({
|
|
5340
5340
|
...options,
|
|
5341
5341
|
providerId,
|
|
@@ -5364,7 +5364,7 @@ function rewriteCodexRequestUrl(input) {
|
|
|
5364
5364
|
}
|
|
5365
5365
|
return input;
|
|
5366
5366
|
}
|
|
5367
|
-
async function rewriteCodexRequest(input, init) {
|
|
5367
|
+
async function rewriteCodexRequest(input, init, reasoningEffort) {
|
|
5368
5368
|
const rewrittenUrl = rewriteCodexRequestUrl(input);
|
|
5369
5369
|
const body = await readJsonBody(init?.body);
|
|
5370
5370
|
if (!isChatCompletionsBody(body)) return {
|
|
@@ -5372,7 +5372,7 @@ async function rewriteCodexRequest(input, init) {
|
|
|
5372
5372
|
...init ? { init } : {}
|
|
5373
5373
|
};
|
|
5374
5374
|
const stream = body.stream === true;
|
|
5375
|
-
const codexBody = chatCompletionsBodyToCodexResponsesBody(body);
|
|
5375
|
+
const codexBody = chatCompletionsBodyToCodexResponsesBody(body, reasoningEffort);
|
|
5376
5376
|
const headers = new Headers(init?.headers);
|
|
5377
5377
|
headers.set("Content-Type", "application/json");
|
|
5378
5378
|
return {
|
|
@@ -5385,7 +5385,7 @@ async function rewriteCodexRequest(input, init) {
|
|
|
5385
5385
|
responseMode: stream ? "chat-sse" : "chat-json"
|
|
5386
5386
|
};
|
|
5387
5387
|
}
|
|
5388
|
-
function chatCompletionsBodyToCodexResponsesBody(body) {
|
|
5388
|
+
function chatCompletionsBodyToCodexResponsesBody(body, reasoningEffort) {
|
|
5389
5389
|
const instructions = body.messages.filter((message) => message.role === "system" || message.role === "developer").map((message) => messageContentToText(message.content)).filter((text) => text.trim().length > 0).join("\n\n");
|
|
5390
5390
|
const input = body.messages.filter((message) => message.role !== "system" && message.role !== "developer").map(chatMessageToResponseInputItem).filter((item) => item !== void 0);
|
|
5391
5391
|
return {
|
|
@@ -5396,7 +5396,11 @@ function chatCompletionsBodyToCodexResponsesBody(body) {
|
|
|
5396
5396
|
stream: true,
|
|
5397
5397
|
...typeof body.temperature === "number" ? { temperature: body.temperature } : {},
|
|
5398
5398
|
...typeof body.top_p === "number" ? { top_p: body.top_p } : {},
|
|
5399
|
-
...typeof body.max_tokens === "number" ? { max_output_tokens: body.max_tokens } : {}
|
|
5399
|
+
...typeof body.max_tokens === "number" ? { max_output_tokens: body.max_tokens } : {},
|
|
5400
|
+
...reasoningEffort === void 0 ? {} : { reasoning: {
|
|
5401
|
+
effort: reasoningEffort,
|
|
5402
|
+
summary: "auto"
|
|
5403
|
+
} }
|
|
5400
5404
|
};
|
|
5401
5405
|
}
|
|
5402
5406
|
function chatMessageToResponseInputItem(message) {
|
|
@@ -5633,7 +5637,8 @@ var ModelGateway = class ModelGateway {
|
|
|
5633
5637
|
if (!providerConfig) throw new Error(`No provider configured for model provider "${providerId}".`);
|
|
5634
5638
|
const providerFetch = isCodexProvider(providerId, providerConfig) ? createCodexProviderFetch({
|
|
5635
5639
|
...this.#config.codexAuth,
|
|
5636
|
-
providerId
|
|
5640
|
+
providerId,
|
|
5641
|
+
reasoningEffort: providerConfig.reasoningEffort
|
|
5637
5642
|
}) : void 0;
|
|
5638
5643
|
return {
|
|
5639
5644
|
model: createOpenAICompatible({
|
|
@@ -5672,6 +5677,7 @@ var ModelGateway = class ModelGateway {
|
|
|
5672
5677
|
providerId: resolved.providerId,
|
|
5673
5678
|
modelId: resolved.modelId,
|
|
5674
5679
|
purpose: resolved.purpose,
|
|
5680
|
+
...resolved.providerConfig.reasoningEffort ? { reasoningEffort: resolved.providerConfig.reasoningEffort } : {},
|
|
5675
5681
|
...usage ? { usage } : {}
|
|
5676
5682
|
};
|
|
5677
5683
|
}
|
|
@@ -5758,6 +5764,7 @@ var ModelGateway = class ModelGateway {
|
|
|
5758
5764
|
providerId: resolved.providerId,
|
|
5759
5765
|
modelId: resolved.modelId,
|
|
5760
5766
|
purpose: resolved.purpose,
|
|
5767
|
+
...resolved.providerConfig.reasoningEffort ? { reasoningEffort: resolved.providerConfig.reasoningEffort } : {},
|
|
5761
5768
|
...usage ? { usage } : {},
|
|
5762
5769
|
toolCalls,
|
|
5763
5770
|
toolProtocol: "native-openai-compatible",
|
|
@@ -5793,6 +5800,7 @@ var ModelGateway = class ModelGateway {
|
|
|
5793
5800
|
providerId: resolved.providerId,
|
|
5794
5801
|
modelId: resolved.modelId,
|
|
5795
5802
|
purpose: resolved.purpose,
|
|
5803
|
+
...resolved.providerConfig.reasoningEffort ? { reasoningEffort: resolved.providerConfig.reasoningEffort } : {},
|
|
5796
5804
|
...usage ? { usage } : {},
|
|
5797
5805
|
toolCalls: parsed ? [{
|
|
5798
5806
|
id: `${parsed.source}-0`,
|
|
@@ -5976,8 +5984,14 @@ function buildProviderOptions(providerId, config, request) {
|
|
|
5976
5984
|
const options = {};
|
|
5977
5985
|
if (config.service_tier !== void 0) options.service_tier = config.service_tier;
|
|
5978
5986
|
if (shouldUsePromptCaching(config) && request?.sessionId) options.prompt_cache_key = request.sessionId;
|
|
5987
|
+
if (config.reasoningEffort !== void 0) Object.assign(options, buildReasoningProviderOptions(providerId, config));
|
|
5979
5988
|
return { [providerId]: options };
|
|
5980
5989
|
}
|
|
5990
|
+
function buildReasoningProviderOptions(providerId, config) {
|
|
5991
|
+
if (config.reasoningEffort === void 0) return {};
|
|
5992
|
+
if (isOpenRouterProvider$1(providerId, config)) return { reasoning: { effort: config.reasoningEffort } };
|
|
5993
|
+
return { reasoningEffort: config.reasoningEffort };
|
|
5994
|
+
}
|
|
5981
5995
|
function buildNativeProviderOptions(providerId, config, request) {
|
|
5982
5996
|
const options = {
|
|
5983
5997
|
...buildProviderOptions(providerId, config, request)[providerId],
|
|
@@ -6130,6 +6144,15 @@ const toolProtocolSchema = z.enum([
|
|
|
6130
6144
|
"text-json",
|
|
6131
6145
|
"text-xml"
|
|
6132
6146
|
]);
|
|
6147
|
+
const reasoningEfforts = [
|
|
6148
|
+
"none",
|
|
6149
|
+
"minimal",
|
|
6150
|
+
"low",
|
|
6151
|
+
"medium",
|
|
6152
|
+
"high",
|
|
6153
|
+
"xhigh"
|
|
6154
|
+
];
|
|
6155
|
+
const reasoningEffortSchema = z.enum(reasoningEfforts);
|
|
6133
6156
|
const openRouterAttributionHeaders = {
|
|
6134
6157
|
"HTTP-Referer": "https://topchester.com",
|
|
6135
6158
|
"X-Title": "Topchester"
|
|
@@ -6149,7 +6172,8 @@ const providerSchema = z.object({
|
|
|
6149
6172
|
"auto",
|
|
6150
6173
|
"force",
|
|
6151
6174
|
"off"
|
|
6152
|
-
]).optional()
|
|
6175
|
+
]).optional(),
|
|
6176
|
+
reasoningEffort: reasoningEffortSchema.optional()
|
|
6153
6177
|
});
|
|
6154
6178
|
const modelAssignmentSchema = z.object({
|
|
6155
6179
|
name: z.string(),
|
|
@@ -6158,7 +6182,7 @@ const modelAssignmentSchema = z.object({
|
|
|
6158
6182
|
});
|
|
6159
6183
|
const modelChoiceAssignmentSchema = modelAssignmentSchema.extend({ provider: z.string().min(1) });
|
|
6160
6184
|
const modelRefSchema = z.union([z.string(), modelAssignmentSchema]);
|
|
6161
|
-
const providersSchema = z.object({ default: z.string().optional() }).catchall(providerSchema
|
|
6185
|
+
const providersSchema = z.object({ default: z.string().optional() }).catchall(providerSchema);
|
|
6162
6186
|
const rawModelsSchema = z.object({
|
|
6163
6187
|
"default": modelRefSchema.optional(),
|
|
6164
6188
|
"fast": modelRefSchema.optional(),
|
|
@@ -6467,6 +6491,32 @@ async function setGlobalDefaultModel(modelRef) {
|
|
|
6467
6491
|
defaultModel: normalizedModelRef
|
|
6468
6492
|
};
|
|
6469
6493
|
}
|
|
6494
|
+
async function setGlobalReasoningEffort(providerId, effort) {
|
|
6495
|
+
const normalizedProviderId = providerId.trim();
|
|
6496
|
+
if (!normalizedProviderId) throw new Error("No provider configured for the active model.");
|
|
6497
|
+
const configPath = getGlobalTopchesterConfigPath();
|
|
6498
|
+
const config = readConfigObject(configPath);
|
|
6499
|
+
const provider = ensurePlainObjectProperty(config, "providers")[normalizedProviderId];
|
|
6500
|
+
if (!isPlainObject(provider)) throw new Error(`No provider configured for model provider "${normalizedProviderId}".`);
|
|
6501
|
+
if (effort === void 0) delete provider.reasoningEffort;
|
|
6502
|
+
else provider.reasoningEffort = effort;
|
|
6503
|
+
await writeGlobalConfig(configPath, config);
|
|
6504
|
+
return {
|
|
6505
|
+
path: configPath,
|
|
6506
|
+
providerId: normalizedProviderId,
|
|
6507
|
+
...effort === void 0 ? {} : { reasoningEffort: effort }
|
|
6508
|
+
};
|
|
6509
|
+
}
|
|
6510
|
+
function getActiveModelProviderId(config) {
|
|
6511
|
+
const purpose = config.models?.defaultPurpose ?? "agent.primary";
|
|
6512
|
+
const provider = (config.models?.assignments?.[purpose] ?? config.models?.assignments?.fallback)?.provider ?? config.providers?.default;
|
|
6513
|
+
return typeof provider === "string" ? provider : void 0;
|
|
6514
|
+
}
|
|
6515
|
+
function getConfiguredReasoningEffort(config, providerId = getActiveModelProviderId(config)) {
|
|
6516
|
+
if (!providerId) return;
|
|
6517
|
+
const provider = config.providers?.[providerId];
|
|
6518
|
+
return typeof provider === "object" && provider !== null && "reasoningEffort" in provider ? provider.reasoningEffort : void 0;
|
|
6519
|
+
}
|
|
6470
6520
|
function formatModelRef(model) {
|
|
6471
6521
|
return model.provider ? `${model.provider}/${model.name}` : model.name;
|
|
6472
6522
|
}
|
|
@@ -9818,6 +9868,22 @@ const slashCommandSuggestions = [
|
|
|
9818
9868
|
value: "/connect",
|
|
9819
9869
|
description: "connect a model provider"
|
|
9820
9870
|
},
|
|
9871
|
+
{
|
|
9872
|
+
value: "/effort",
|
|
9873
|
+
description: "show or set reasoning effort"
|
|
9874
|
+
},
|
|
9875
|
+
{
|
|
9876
|
+
value: "/effort high",
|
|
9877
|
+
description: "set reasoning effort to high"
|
|
9878
|
+
},
|
|
9879
|
+
{
|
|
9880
|
+
value: "/reasoning",
|
|
9881
|
+
description: "show or set reasoning effort"
|
|
9882
|
+
},
|
|
9883
|
+
{
|
|
9884
|
+
value: "/reasoning high",
|
|
9885
|
+
description: "set reasoning effort to high"
|
|
9886
|
+
},
|
|
9821
9887
|
{
|
|
9822
9888
|
value: "/kb status",
|
|
9823
9889
|
description: "show non-clean knowledge files"
|
|
@@ -9904,6 +9970,16 @@ const slashCommands = [
|
|
|
9904
9970
|
description: "connect a model provider",
|
|
9905
9971
|
execute: executeInteractiveOnlyCommand("/connect")
|
|
9906
9972
|
},
|
|
9973
|
+
{
|
|
9974
|
+
name: "effort",
|
|
9975
|
+
description: "show or set reasoning effort",
|
|
9976
|
+
execute: executeInteractiveOnlyCommand("/effort")
|
|
9977
|
+
},
|
|
9978
|
+
{
|
|
9979
|
+
name: "reasoning",
|
|
9980
|
+
description: "show or set reasoning effort",
|
|
9981
|
+
execute: executeInteractiveOnlyCommand("/reasoning")
|
|
9982
|
+
},
|
|
9907
9983
|
{
|
|
9908
9984
|
name: "provider",
|
|
9909
9985
|
description: "connect a model provider",
|
|
@@ -10309,7 +10385,8 @@ function getStartupThreadMessages(context) {
|
|
|
10309
10385
|
for (const [providerId, provider] of namedProviders) {
|
|
10310
10386
|
if (typeof provider === "string") continue;
|
|
10311
10387
|
const auth = provider.apiKeyEnv ? `env:${provider.apiKeyEnv}` : provider.apiKey ? "inline" : "none";
|
|
10312
|
-
|
|
10388
|
+
const effort = provider.reasoningEffort ? ` effort=${provider.reasoningEffort}` : "";
|
|
10389
|
+
lines.push(` ${providerId}: ${provider.type} ${provider.baseURL} auth=${auth}${effort}`);
|
|
10313
10390
|
}
|
|
10314
10391
|
}
|
|
10315
10392
|
const setupHint = getModelSetupHint(context);
|
|
@@ -10360,9 +10437,10 @@ function formatSplitStatusLine(left, right, width) {
|
|
|
10360
10437
|
return `${leftText}${" ".repeat(gap)}${right}`;
|
|
10361
10438
|
}
|
|
10362
10439
|
function formatModelStatusSegment(modelLabel) {
|
|
10363
|
-
const providerMatch = /^(?<model>.*?)(?<provider> \[[^\]]+\])
|
|
10440
|
+
const providerMatch = /^(?<model>.*?)(?<provider> \[[^\]]+\])(?<effort> · effort .+)?$/u.exec(modelLabel);
|
|
10364
10441
|
if (!providerMatch?.groups) return ui.model(modelLabel);
|
|
10365
|
-
|
|
10442
|
+
const effort = providerMatch.groups.effort ? ui.label(providerMatch.groups.effort) : "";
|
|
10443
|
+
return `${ui.model(providerMatch.groups.model)}${ui.label(providerMatch.groups.provider)}${effort}`;
|
|
10366
10444
|
}
|
|
10367
10445
|
function formatKnowledgeFooterStatus(status) {
|
|
10368
10446
|
if (!status.kbExists) return `${ui.warn("⚠")} kb: ${ui.warn("missing")}`;
|
|
@@ -10391,7 +10469,9 @@ function getModelLabel(context) {
|
|
|
10391
10469
|
const model = context.config.models?.assignments?.[purpose] ?? context.config.models?.assignments?.fallback;
|
|
10392
10470
|
if (!model) return "not set";
|
|
10393
10471
|
const provider = model.provider ?? context.config.providers?.default;
|
|
10394
|
-
|
|
10472
|
+
const effort = getConfiguredReasoningEffort(context.config, typeof provider === "string" ? provider : void 0);
|
|
10473
|
+
const effortLabel = effort ? ` · effort ${effort}` : "";
|
|
10474
|
+
return typeof provider === "string" ? `${model.name} [${provider}]${effortLabel}` : `${model.name}${effortLabel}`;
|
|
10395
10475
|
}
|
|
10396
10476
|
//#endregion
|
|
10397
10477
|
//#region src/tui/text.ts
|
|
@@ -12926,9 +13006,13 @@ var TopchesterAgentRuntime = class TopchesterAgentRuntime {
|
|
|
12926
13006
|
profile,
|
|
12927
13007
|
permissions
|
|
12928
13008
|
}, projectInstructions);
|
|
13009
|
+
const modelRequestMetadata = this.resolveModelMetadata("agent.primary");
|
|
12929
13010
|
this.context.logger.debug({
|
|
12930
13011
|
event: "model_prompt",
|
|
12931
13012
|
purpose: "agent.primary",
|
|
13013
|
+
providerId: modelRequestMetadata?.providerId,
|
|
13014
|
+
modelId: modelRequestMetadata?.modelId,
|
|
13015
|
+
reasoningEffort: modelRequestMetadata?.providerConfig.reasoningEffort,
|
|
12932
13016
|
afterTool,
|
|
12933
13017
|
toolProtocol: toolProtocolOverride,
|
|
12934
13018
|
promptLength: nextPrompt.length,
|
|
@@ -12959,6 +13043,8 @@ var TopchesterAgentRuntime = class TopchesterAgentRuntime {
|
|
|
12959
13043
|
event: "model_response",
|
|
12960
13044
|
purpose: "agent.primary",
|
|
12961
13045
|
modelId: result.modelId,
|
|
13046
|
+
providerId: result.providerId,
|
|
13047
|
+
reasoningEffort: result.reasoningEffort,
|
|
12962
13048
|
durationMs,
|
|
12963
13049
|
totalDurationMs,
|
|
12964
13050
|
textLength: result.text.length,
|
|
@@ -12982,6 +13068,8 @@ var TopchesterAgentRuntime = class TopchesterAgentRuntime {
|
|
|
12982
13068
|
event: "model_response_text",
|
|
12983
13069
|
purpose: "agent.primary",
|
|
12984
13070
|
modelId: result.modelId,
|
|
13071
|
+
providerId: result.providerId,
|
|
13072
|
+
reasoningEffort: result.reasoningEffort,
|
|
12985
13073
|
afterTool,
|
|
12986
13074
|
toolProtocol: result.toolProtocol,
|
|
12987
13075
|
text: result.text
|
|
@@ -13342,30 +13430,34 @@ var TopchesterAgentRuntime = class TopchesterAgentRuntime {
|
|
|
13342
13430
|
};
|
|
13343
13431
|
}
|
|
13344
13432
|
createHookModelPayload(purpose) {
|
|
13433
|
+
const resolved = this.resolveModelMetadata(purpose);
|
|
13434
|
+
if (!resolved) return {};
|
|
13435
|
+
const modelRef = `${resolved.providerId}/${resolved.modelId}`;
|
|
13436
|
+
return {
|
|
13437
|
+
model_purpose: resolved.purpose,
|
|
13438
|
+
model_provider: resolved.providerId,
|
|
13439
|
+
model_id: resolved.modelId,
|
|
13440
|
+
model_ref: modelRef,
|
|
13441
|
+
model: {
|
|
13442
|
+
purpose: resolved.purpose,
|
|
13443
|
+
providerId: resolved.providerId,
|
|
13444
|
+
modelId: resolved.modelId,
|
|
13445
|
+
ref: modelRef
|
|
13446
|
+
}
|
|
13447
|
+
};
|
|
13448
|
+
}
|
|
13449
|
+
resolveModelMetadata(purpose) {
|
|
13345
13450
|
const resolveModel = this.context.modelGateway.resolveModel;
|
|
13346
|
-
if (typeof resolveModel !== "function") return
|
|
13451
|
+
if (typeof resolveModel !== "function") return;
|
|
13347
13452
|
try {
|
|
13348
|
-
|
|
13349
|
-
const modelRef = `${resolved.providerId}/${resolved.modelId}`;
|
|
13350
|
-
return {
|
|
13351
|
-
model_purpose: resolved.purpose,
|
|
13352
|
-
model_provider: resolved.providerId,
|
|
13353
|
-
model_id: resolved.modelId,
|
|
13354
|
-
model_ref: modelRef,
|
|
13355
|
-
model: {
|
|
13356
|
-
purpose: resolved.purpose,
|
|
13357
|
-
providerId: resolved.providerId,
|
|
13358
|
-
modelId: resolved.modelId,
|
|
13359
|
-
ref: modelRef
|
|
13360
|
-
}
|
|
13361
|
-
};
|
|
13453
|
+
return resolveModel.call(this.context.modelGateway, purpose);
|
|
13362
13454
|
} catch (error) {
|
|
13363
13455
|
this.context.logger.debug({
|
|
13364
|
-
event: "
|
|
13456
|
+
event: "model_resolution_skipped",
|
|
13365
13457
|
purpose,
|
|
13366
13458
|
error: error instanceof Error ? error.message : String(error)
|
|
13367
|
-
}, "
|
|
13368
|
-
return
|
|
13459
|
+
}, "model metadata unavailable");
|
|
13460
|
+
return;
|
|
13369
13461
|
}
|
|
13370
13462
|
}
|
|
13371
13463
|
createToolHookPayload(event, call, toolCallId, session, extra = {}) {
|
|
@@ -13975,6 +14067,10 @@ function isModelCommand(command) {
|
|
|
13975
14067
|
const name = getSlashCommandName(command);
|
|
13976
14068
|
return name === "model" || name === "models";
|
|
13977
14069
|
}
|
|
14070
|
+
function isReasoningEffortCommand(command) {
|
|
14071
|
+
const name = getSlashCommandName(command);
|
|
14072
|
+
return name === "effort" || name === "reasoning";
|
|
14073
|
+
}
|
|
13978
14074
|
function getSlashCommandName(command) {
|
|
13979
14075
|
return command.trim().slice(1).split(/\s+/u).filter(Boolean)[0]?.toLowerCase();
|
|
13980
14076
|
}
|
|
@@ -14461,6 +14557,10 @@ var TopchesterTuiShell = class {
|
|
|
14461
14557
|
await this.submitModelCommand(app, tui, command);
|
|
14462
14558
|
return;
|
|
14463
14559
|
}
|
|
14560
|
+
if (isReasoningEffortCommand(command)) {
|
|
14561
|
+
await this.submitReasoningEffortCommand(app, tui, command);
|
|
14562
|
+
return;
|
|
14563
|
+
}
|
|
14464
14564
|
const busy = new BusyIndicator(app, tui, {
|
|
14465
14565
|
status: "running command",
|
|
14466
14566
|
promptHint: "working...",
|
|
@@ -14550,7 +14650,7 @@ var TopchesterTuiShell = class {
|
|
|
14550
14650
|
async resolveSkillActivationCommand(command) {
|
|
14551
14651
|
const parts = command.trim().slice(1).split(/\s+/u).filter(Boolean);
|
|
14552
14652
|
const name = parts[0]?.toLowerCase();
|
|
14553
|
-
if (!name || name === "skills" || name === "kb" || isNewSessionCommand(command) || isConnectCommand(command) || isModelCommand(command)) return;
|
|
14653
|
+
if (!name || name === "skills" || name === "kb" || isNewSessionCommand(command) || isConnectCommand(command) || isModelCommand(command) || isReasoningEffortCommand(command)) return;
|
|
14554
14654
|
if (name === "skill") {
|
|
14555
14655
|
const skillName = parts[1];
|
|
14556
14656
|
if (!skillName) return;
|
|
@@ -14669,6 +14769,51 @@ var TopchesterTuiShell = class {
|
|
|
14669
14769
|
}
|
|
14670
14770
|
this.showModelPicker(app, tui, query);
|
|
14671
14771
|
}
|
|
14772
|
+
async submitReasoningEffortCommand(app, tui, command) {
|
|
14773
|
+
await this.clearTaskPlanForNewTurn(app);
|
|
14774
|
+
await this.persistPayloadWithWarning(app, slashCommandToSessionPayload(command));
|
|
14775
|
+
const args = getSlashCommandArgs(command);
|
|
14776
|
+
const value = args[0]?.toLowerCase();
|
|
14777
|
+
if (args.length === 0) {
|
|
14778
|
+
const current = getConfiguredReasoningEffort(this.context.config);
|
|
14779
|
+
app.addMessage(systemMessage(formatCurrentReasoningEffortMessage(current)));
|
|
14780
|
+
tui.requestRender();
|
|
14781
|
+
return;
|
|
14782
|
+
}
|
|
14783
|
+
if (args.length > 1) {
|
|
14784
|
+
app.addMessage(systemMessage(formatReasoningEffortUsageMessage()));
|
|
14785
|
+
tui.requestRender();
|
|
14786
|
+
return;
|
|
14787
|
+
}
|
|
14788
|
+
if (value === "clear" || value === "default") {
|
|
14789
|
+
await this.updateReasoningEffort(app, void 0);
|
|
14790
|
+
tui.requestRender();
|
|
14791
|
+
return;
|
|
14792
|
+
}
|
|
14793
|
+
if (!isReasoningEffort(value)) {
|
|
14794
|
+
app.addMessage(systemMessage(formatReasoningEffortUsageMessage()));
|
|
14795
|
+
tui.requestRender();
|
|
14796
|
+
return;
|
|
14797
|
+
}
|
|
14798
|
+
await this.updateReasoningEffort(app, value);
|
|
14799
|
+
tui.requestRender();
|
|
14800
|
+
}
|
|
14801
|
+
async updateReasoningEffort(app, effort) {
|
|
14802
|
+
try {
|
|
14803
|
+
const providerId = getActiveModelProviderId(this.context.config);
|
|
14804
|
+
if (!providerId) {
|
|
14805
|
+
app.addMessage(systemMessage("No provider configured for the active model. Run /connect codex or configure a provider first."));
|
|
14806
|
+
return;
|
|
14807
|
+
}
|
|
14808
|
+
const result = await setGlobalReasoningEffort(providerId, effort);
|
|
14809
|
+
this.reloadModelConfig(app);
|
|
14810
|
+
app.addMessage(systemMessage(effort === void 0 ? `Reasoning effort cleared; provider defaults will apply.\nconfig: ${formatHomeRelativePath(result.path)}` : `Reasoning effort set to ${effort}.\nconfig: ${formatHomeRelativePath(result.path)}`));
|
|
14811
|
+
app.setStatus("ready");
|
|
14812
|
+
} catch (error) {
|
|
14813
|
+
app.addMessage(systemMessage(`Reasoning effort change failed: ${formatPlainError(error)}`));
|
|
14814
|
+
app.setStatus("reasoning effort change failed");
|
|
14815
|
+
}
|
|
14816
|
+
}
|
|
14672
14817
|
showProviderPicker(app, tui) {
|
|
14673
14818
|
app.setModalActionHandler((action) => {
|
|
14674
14819
|
if (action.value === "openrouter") this.startBackgroundTask(app, tui, "Connect", () => this.connectOpenRouter(app, tui));
|
|
@@ -15049,6 +15194,15 @@ function parseSteerCommandPrompt(command) {
|
|
|
15049
15194
|
const match = /^\/steer(?:\s+([\s\S]*))?$/u.exec(trimmed);
|
|
15050
15195
|
return match ? match[1] ?? "" : void 0;
|
|
15051
15196
|
}
|
|
15197
|
+
function isReasoningEffort(value) {
|
|
15198
|
+
return reasoningEfforts.includes(value);
|
|
15199
|
+
}
|
|
15200
|
+
function formatCurrentReasoningEffortMessage(effort) {
|
|
15201
|
+
return `Current reasoning effort: ${effort ?? "provider default"}. Values: ${reasoningEfforts.join(", ")}.`;
|
|
15202
|
+
}
|
|
15203
|
+
function formatReasoningEffortUsageMessage() {
|
|
15204
|
+
return `Usage: /effort <${reasoningEfforts.join("|")}> or /effort clear.`;
|
|
15205
|
+
}
|
|
15052
15206
|
//#endregion
|
|
15053
15207
|
//#region src/version.ts
|
|
15054
15208
|
const FALLBACK_VERSION = "0.0.0";
|
|
@@ -16029,4 +16183,4 @@ function formatDryRunSyncStatus(status) {
|
|
|
16029
16183
|
//#endregion
|
|
16030
16184
|
export { runTopchesterCli as t };
|
|
16031
16185
|
|
|
16032
|
-
//# sourceMappingURL=cli-
|
|
16186
|
+
//# sourceMappingURL=cli-Fw-z_PsS.mjs.map
|