claudish 3.3.10 → 3.3.11
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/index.js +141 -87
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -56301,31 +56301,51 @@ var init_remote_provider_types = __esm(() => {
|
|
|
56301
56301
|
"gemini-3.0-flash": { inputCostPer1M: 0.1, outputCostPer1M: 0.4 },
|
|
56302
56302
|
"gemini-2.0-flash": { inputCostPer1M: 0.1, outputCostPer1M: 0.4 },
|
|
56303
56303
|
"gemini-2.0-flash-thinking": { inputCostPer1M: 0.1, outputCostPer1M: 0.4 },
|
|
56304
|
-
default: { inputCostPer1M: 0.5, outputCostPer1M: 2 }
|
|
56304
|
+
default: { inputCostPer1M: 0.5, outputCostPer1M: 2, isEstimate: true }
|
|
56305
56305
|
};
|
|
56306
56306
|
OPENAI_PRICING = {
|
|
56307
|
-
"gpt-5": { inputCostPer1M:
|
|
56308
|
-
"gpt-5.2": { inputCostPer1M:
|
|
56309
|
-
"gpt-5-
|
|
56310
|
-
"gpt-5.
|
|
56307
|
+
"gpt-5.2": { inputCostPer1M: 1.75, outputCostPer1M: 14 },
|
|
56308
|
+
"gpt-5.2-codex": { inputCostPer1M: 1.75, outputCostPer1M: 14 },
|
|
56309
|
+
"gpt-5.2-chat-latest": { inputCostPer1M: 1.75, outputCostPer1M: 14 },
|
|
56310
|
+
"gpt-5.2-pro": { inputCostPer1M: 21, outputCostPer1M: 168 },
|
|
56311
|
+
"gpt-5.1": { inputCostPer1M: 1.25, outputCostPer1M: 10 },
|
|
56312
|
+
"gpt-5.1-codex": { inputCostPer1M: 1.25, outputCostPer1M: 10 },
|
|
56313
|
+
"gpt-5.1-codex-max": { inputCostPer1M: 1.25, outputCostPer1M: 10 },
|
|
56314
|
+
"gpt-5.1-codex-mini": { inputCostPer1M: 0.25, outputCostPer1M: 2 },
|
|
56315
|
+
"gpt-5.1-chat-latest": { inputCostPer1M: 1.25, outputCostPer1M: 10 },
|
|
56316
|
+
"gpt-5": { inputCostPer1M: 1.25, outputCostPer1M: 10 },
|
|
56317
|
+
"gpt-5-codex": { inputCostPer1M: 1.25, outputCostPer1M: 10 },
|
|
56318
|
+
"gpt-5-chat-latest": { inputCostPer1M: 1.25, outputCostPer1M: 10 },
|
|
56319
|
+
"gpt-5-mini": { inputCostPer1M: 0.25, outputCostPer1M: 2 },
|
|
56320
|
+
"gpt-5-nano": { inputCostPer1M: 0.05, outputCostPer1M: 0.4 },
|
|
56321
|
+
"gpt-5-pro": { inputCostPer1M: 15, outputCostPer1M: 120 },
|
|
56322
|
+
"gpt-4.1": { inputCostPer1M: 2, outputCostPer1M: 8 },
|
|
56323
|
+
"gpt-4.1-mini": { inputCostPer1M: 0.4, outputCostPer1M: 1.6 },
|
|
56324
|
+
"gpt-4.1-nano": { inputCostPer1M: 0.1, outputCostPer1M: 0.4 },
|
|
56311
56325
|
"gpt-4o": { inputCostPer1M: 2.5, outputCostPer1M: 10 },
|
|
56326
|
+
"gpt-4o-2024-05-13": { inputCostPer1M: 5, outputCostPer1M: 15 },
|
|
56312
56327
|
"gpt-4o-mini": { inputCostPer1M: 0.15, outputCostPer1M: 0.6 },
|
|
56313
56328
|
"gpt-4o-audio": { inputCostPer1M: 2.5, outputCostPer1M: 10 },
|
|
56314
56329
|
o1: { inputCostPer1M: 15, outputCostPer1M: 60 },
|
|
56315
|
-
"o1-mini": { inputCostPer1M:
|
|
56316
|
-
"o1-
|
|
56317
|
-
o3: { inputCostPer1M:
|
|
56318
|
-
"o3-mini": { inputCostPer1M:
|
|
56330
|
+
"o1-mini": { inputCostPer1M: 1.1, outputCostPer1M: 4.4 },
|
|
56331
|
+
"o1-pro": { inputCostPer1M: 150, outputCostPer1M: 600 },
|
|
56332
|
+
o3: { inputCostPer1M: 2, outputCostPer1M: 8 },
|
|
56333
|
+
"o3-mini": { inputCostPer1M: 1.1, outputCostPer1M: 4.4 },
|
|
56334
|
+
"o3-pro": { inputCostPer1M: 20, outputCostPer1M: 80 },
|
|
56335
|
+
"o3-deep-research": { inputCostPer1M: 10, outputCostPer1M: 40 },
|
|
56336
|
+
"o4-mini": { inputCostPer1M: 1.1, outputCostPer1M: 4.4 },
|
|
56337
|
+
"o4-mini-deep-research": { inputCostPer1M: 2, outputCostPer1M: 8 },
|
|
56319
56338
|
"gpt-4-turbo": { inputCostPer1M: 10, outputCostPer1M: 30 },
|
|
56320
56339
|
"gpt-4-turbo-preview": { inputCostPer1M: 10, outputCostPer1M: 30 },
|
|
56321
56340
|
"gpt-4": { inputCostPer1M: 30, outputCostPer1M: 60 },
|
|
56322
56341
|
"gpt-3.5-turbo": { inputCostPer1M: 0.5, outputCostPer1M: 1.5 },
|
|
56323
|
-
|
|
56342
|
+
"codex-mini-latest": { inputCostPer1M: 1.5, outputCostPer1M: 6 },
|
|
56343
|
+
default: { inputCostPer1M: 2, outputCostPer1M: 8, isEstimate: true }
|
|
56324
56344
|
};
|
|
56325
56345
|
MINIMAX_PRICING = {
|
|
56326
56346
|
"minimax-m2.1": { inputCostPer1M: 0.12, outputCostPer1M: 0.48 },
|
|
56327
56347
|
"minimax-m2": { inputCostPer1M: 0.12, outputCostPer1M: 0.48 },
|
|
56328
|
-
default: { inputCostPer1M: 0.12, outputCostPer1M: 0.48 }
|
|
56348
|
+
default: { inputCostPer1M: 0.12, outputCostPer1M: 0.48, isEstimate: true }
|
|
56329
56349
|
};
|
|
56330
56350
|
KIMI_PRICING = {
|
|
56331
56351
|
"kimi-k2-thinking-turbo": { inputCostPer1M: 0.32, outputCostPer1M: 0.48 },
|
|
@@ -56333,13 +56353,13 @@ var init_remote_provider_types = __esm(() => {
|
|
|
56333
56353
|
"kimi-k2-turbo-preview": { inputCostPer1M: 0.2, outputCostPer1M: 0.4 },
|
|
56334
56354
|
"kimi-k2-0905-preview": { inputCostPer1M: 0.2, outputCostPer1M: 0.4 },
|
|
56335
56355
|
"kimi-k2": { inputCostPer1M: 0.2, outputCostPer1M: 0.4 },
|
|
56336
|
-
default: { inputCostPer1M: 0.32, outputCostPer1M: 0.48 }
|
|
56356
|
+
default: { inputCostPer1M: 0.32, outputCostPer1M: 0.48, isEstimate: true }
|
|
56337
56357
|
};
|
|
56338
56358
|
GLM_PRICING = {
|
|
56339
56359
|
"glm-4.7": { inputCostPer1M: 0.16, outputCostPer1M: 0.8 },
|
|
56340
56360
|
"glm-4": { inputCostPer1M: 0.16, outputCostPer1M: 0.8 },
|
|
56341
56361
|
"glm-4-plus": { inputCostPer1M: 0.5, outputCostPer1M: 2 },
|
|
56342
|
-
default: { inputCostPer1M: 0.16, outputCostPer1M: 0.8 }
|
|
56362
|
+
default: { inputCostPer1M: 0.16, outputCostPer1M: 0.8, isEstimate: true }
|
|
56343
56363
|
};
|
|
56344
56364
|
});
|
|
56345
56365
|
|
|
@@ -56980,7 +57000,7 @@ class OpenAIHandler {
|
|
|
56980
57000
|
}
|
|
56981
57001
|
return `${this.provider.baseUrl}${this.provider.apiPath}`;
|
|
56982
57002
|
}
|
|
56983
|
-
writeTokenFile(input, output) {
|
|
57003
|
+
writeTokenFile(input, output, isEstimate) {
|
|
56984
57004
|
try {
|
|
56985
57005
|
const total = input + output;
|
|
56986
57006
|
const leftPct = this.contextWindow > 0 ? Math.max(0, Math.min(100, Math.round((this.contextWindow - total) / this.contextWindow * 100))) : 100;
|
|
@@ -56993,6 +57013,9 @@ class OpenAIHandler {
|
|
|
56993
57013
|
context_left_percent: leftPct,
|
|
56994
57014
|
updated_at: Date.now()
|
|
56995
57015
|
};
|
|
57016
|
+
if (isEstimate) {
|
|
57017
|
+
data.cost_is_estimate = true;
|
|
57018
|
+
}
|
|
56996
57019
|
const claudishDir = join9(homedir5(), ".claudish");
|
|
56997
57020
|
mkdirSync6(claudishDir, { recursive: true });
|
|
56998
57021
|
writeFileSync8(join9(claudishDir, `tokens-${this.port}.json`), JSON.stringify(data), "utf-8");
|
|
@@ -57001,13 +57024,23 @@ class OpenAIHandler {
|
|
|
57001
57024
|
}
|
|
57002
57025
|
}
|
|
57003
57026
|
updateTokenTracking(inputTokens, outputTokens) {
|
|
57004
|
-
|
|
57005
|
-
this.sessionInputTokens
|
|
57027
|
+
let incrementalInputTokens;
|
|
57028
|
+
if (inputTokens >= this.sessionInputTokens) {
|
|
57029
|
+
incrementalInputTokens = inputTokens - this.sessionInputTokens;
|
|
57030
|
+
this.sessionInputTokens = inputTokens;
|
|
57031
|
+
} else if (inputTokens < this.sessionInputTokens * 0.5) {
|
|
57032
|
+
incrementalInputTokens = inputTokens;
|
|
57033
|
+
log(`[OpenAIHandler] Token tracking: detected concurrent conversation (${inputTokens} < ${this.sessionInputTokens}), charging full input`);
|
|
57034
|
+
} else {
|
|
57035
|
+
incrementalInputTokens = inputTokens;
|
|
57036
|
+
this.sessionInputTokens = inputTokens;
|
|
57037
|
+
log(`[OpenAIHandler] Token tracking: ambiguous token decrease (${inputTokens} vs ${this.sessionInputTokens}), charging full input`);
|
|
57038
|
+
}
|
|
57006
57039
|
this.sessionOutputTokens += outputTokens;
|
|
57007
57040
|
const pricing = this.getPricing();
|
|
57008
57041
|
const cost = incrementalInputTokens / 1e6 * pricing.inputCostPer1M + outputTokens / 1e6 * pricing.outputCostPer1M;
|
|
57009
57042
|
this.sessionTotalCost += cost;
|
|
57010
|
-
this.writeTokenFile(inputTokens, this.sessionOutputTokens);
|
|
57043
|
+
this.writeTokenFile(Math.max(inputTokens, this.sessionInputTokens), this.sessionOutputTokens, pricing.isEstimate);
|
|
57011
57044
|
}
|
|
57012
57045
|
convertMessages(claudeRequest) {
|
|
57013
57046
|
return convertMessagesToOpenAI(claudeRequest, `openai/${this.modelName}`, filterIdentity);
|
|
@@ -57158,7 +57191,7 @@ class OpenAIHandler {
|
|
|
57158
57191
|
payload.instructions = claudeRequest.system;
|
|
57159
57192
|
}
|
|
57160
57193
|
if (claudeRequest.max_tokens) {
|
|
57161
|
-
payload.max_output_tokens = claudeRequest.max_tokens;
|
|
57194
|
+
payload.max_output_tokens = Math.max(16, claudeRequest.max_tokens);
|
|
57162
57195
|
}
|
|
57163
57196
|
if (tools.length > 0) {
|
|
57164
57197
|
payload.tools = tools.map((tool) => {
|
|
@@ -57188,11 +57221,22 @@ class OpenAIHandler {
|
|
|
57188
57221
|
let outputTokens = 0;
|
|
57189
57222
|
let hasTextContent = false;
|
|
57190
57223
|
let hasToolUse = false;
|
|
57224
|
+
let lastActivity = Date.now();
|
|
57225
|
+
let pingInterval = null;
|
|
57226
|
+
let isClosed = false;
|
|
57191
57227
|
const functionCalls = new Map;
|
|
57192
57228
|
const stream = new ReadableStream({
|
|
57193
57229
|
start: async (controller) => {
|
|
57230
|
+
const send = (event, data) => {
|
|
57231
|
+
if (!isClosed) {
|
|
57232
|
+
controller.enqueue(encoder.encode(`event: ${event}
|
|
57233
|
+
data: ${JSON.stringify(data)}
|
|
57234
|
+
|
|
57235
|
+
`));
|
|
57236
|
+
}
|
|
57237
|
+
};
|
|
57194
57238
|
log(`[OpenAIHandler] Sending message_start with placeholder tokens`);
|
|
57195
|
-
|
|
57239
|
+
send("message_start", {
|
|
57196
57240
|
type: "message_start",
|
|
57197
57241
|
message: {
|
|
57198
57242
|
id: `msg_${Date.now()}`,
|
|
@@ -57204,20 +57248,19 @@ class OpenAIHandler {
|
|
|
57204
57248
|
stop_sequence: null,
|
|
57205
57249
|
usage: { input_tokens: 100, output_tokens: 1 }
|
|
57206
57250
|
}
|
|
57207
|
-
};
|
|
57208
|
-
|
|
57209
|
-
|
|
57210
|
-
|
|
57211
|
-
|
|
57212
|
-
|
|
57213
|
-
|
|
57214
|
-
|
|
57215
|
-
`));
|
|
57251
|
+
});
|
|
57252
|
+
send("ping", { type: "ping" });
|
|
57253
|
+
pingInterval = setInterval(() => {
|
|
57254
|
+
if (!isClosed && Date.now() - lastActivity > 1000) {
|
|
57255
|
+
send("ping", { type: "ping" });
|
|
57256
|
+
}
|
|
57257
|
+
}, 1000);
|
|
57216
57258
|
try {
|
|
57217
57259
|
while (true) {
|
|
57218
57260
|
const { done, value } = await reader.read();
|
|
57219
57261
|
if (done)
|
|
57220
57262
|
break;
|
|
57263
|
+
lastActivity = Date.now();
|
|
57221
57264
|
buffer += decoder.decode(value, { stream: true });
|
|
57222
57265
|
const lines = buffer.split(`
|
|
57223
57266
|
`);
|
|
@@ -57241,86 +57284,99 @@ data: {"type":"ping"}
|
|
|
57241
57284
|
}
|
|
57242
57285
|
if (event.type === "response.output_text.delta") {
|
|
57243
57286
|
if (!hasTextContent) {
|
|
57244
|
-
|
|
57287
|
+
send("content_block_start", {
|
|
57245
57288
|
type: "content_block_start",
|
|
57246
57289
|
index: blockIndex,
|
|
57247
57290
|
content_block: { type: "text", text: "" }
|
|
57248
|
-
};
|
|
57249
|
-
controller.enqueue(encoder.encode(`event: content_block_start
|
|
57250
|
-
data: ${JSON.stringify(blockStart)}
|
|
57251
|
-
|
|
57252
|
-
`));
|
|
57291
|
+
});
|
|
57253
57292
|
hasTextContent = true;
|
|
57254
57293
|
}
|
|
57255
|
-
|
|
57294
|
+
send("content_block_delta", {
|
|
57256
57295
|
type: "content_block_delta",
|
|
57257
57296
|
index: blockIndex,
|
|
57258
57297
|
delta: { type: "text_delta", text: event.delta || "" }
|
|
57259
|
-
};
|
|
57260
|
-
controller.enqueue(encoder.encode(`event: content_block_delta
|
|
57261
|
-
data: ${JSON.stringify(delta)}
|
|
57262
|
-
|
|
57263
|
-
`));
|
|
57298
|
+
});
|
|
57264
57299
|
} else if (event.type === "response.output_item.added") {
|
|
57300
|
+
if (getLogLevel() === "debug" && event.item?.type) {
|
|
57301
|
+
log(`[OpenAIHandler] Output item added: type=${event.item.type}, id=${event.item.id || event.item.call_id || "unknown"}`);
|
|
57302
|
+
}
|
|
57265
57303
|
if (event.item?.type === "function_call") {
|
|
57266
|
-
const
|
|
57304
|
+
const itemId = event.item.id;
|
|
57305
|
+
const openaiCallId = event.item.call_id || itemId;
|
|
57306
|
+
const callId = openaiCallId.startsWith("toolu_") ? openaiCallId : `toolu_${openaiCallId.replace(/^fc_/, "")}`;
|
|
57307
|
+
const fnName = event.item.name || "";
|
|
57267
57308
|
const fnIndex = blockIndex + functionCalls.size + (hasTextContent ? 1 : 0);
|
|
57268
|
-
|
|
57269
|
-
|
|
57309
|
+
log(`[OpenAIHandler] Function call: itemId=${itemId}, openaiCallId=${openaiCallId}, claudeId=${callId}, name=${fnName}, index=${fnIndex}`);
|
|
57310
|
+
const fnCallData = {
|
|
57311
|
+
name: fnName,
|
|
57270
57312
|
arguments: "",
|
|
57271
|
-
index: fnIndex
|
|
57272
|
-
|
|
57313
|
+
index: fnIndex,
|
|
57314
|
+
claudeId: callId
|
|
57315
|
+
};
|
|
57316
|
+
functionCalls.set(openaiCallId, fnCallData);
|
|
57317
|
+
if (itemId && itemId !== openaiCallId) {
|
|
57318
|
+
functionCalls.set(itemId, fnCallData);
|
|
57319
|
+
}
|
|
57273
57320
|
if (hasTextContent && !hasToolUse) {
|
|
57274
|
-
|
|
57275
|
-
controller.enqueue(encoder.encode(`event: content_block_stop
|
|
57276
|
-
data: ${JSON.stringify(blockStop)}
|
|
57277
|
-
|
|
57278
|
-
`));
|
|
57321
|
+
send("content_block_stop", { type: "content_block_stop", index: blockIndex });
|
|
57279
57322
|
blockIndex++;
|
|
57280
57323
|
}
|
|
57281
|
-
|
|
57324
|
+
send("content_block_start", {
|
|
57282
57325
|
type: "content_block_start",
|
|
57283
57326
|
index: fnIndex,
|
|
57284
57327
|
content_block: {
|
|
57285
57328
|
type: "tool_use",
|
|
57286
57329
|
id: callId,
|
|
57287
|
-
name:
|
|
57330
|
+
name: fnName,
|
|
57288
57331
|
input: {}
|
|
57289
57332
|
}
|
|
57290
|
-
};
|
|
57291
|
-
controller.enqueue(encoder.encode(`event: content_block_start
|
|
57292
|
-
data: ${JSON.stringify(toolStart)}
|
|
57293
|
-
|
|
57294
|
-
`));
|
|
57333
|
+
});
|
|
57295
57334
|
hasToolUse = true;
|
|
57335
|
+
} else if (event.item?.type === "reasoning") {
|
|
57336
|
+
log(`[OpenAIHandler] Reasoning block started`);
|
|
57296
57337
|
}
|
|
57338
|
+
} else if (event.type === "response.reasoning_summary_text.delta") {
|
|
57339
|
+
if (!hasTextContent) {
|
|
57340
|
+
send("content_block_start", {
|
|
57341
|
+
type: "content_block_start",
|
|
57342
|
+
index: blockIndex,
|
|
57343
|
+
content_block: { type: "text", text: "" }
|
|
57344
|
+
});
|
|
57345
|
+
hasTextContent = true;
|
|
57346
|
+
}
|
|
57347
|
+
send("content_block_delta", {
|
|
57348
|
+
type: "content_block_delta",
|
|
57349
|
+
index: blockIndex,
|
|
57350
|
+
delta: { type: "text_delta", text: event.delta || "" }
|
|
57351
|
+
});
|
|
57297
57352
|
} else if (event.type === "response.function_call_arguments.delta") {
|
|
57298
57353
|
const callId = event.call_id || event.item_id;
|
|
57354
|
+
if (getLogLevel() === "debug" && !functionCalls.has(callId)) {
|
|
57355
|
+
log(`[OpenAIHandler] Argument delta lookup failed: callId=${callId}, stored keys=[${Array.from(functionCalls.keys()).join(", ")}]`);
|
|
57356
|
+
}
|
|
57299
57357
|
const fnCall = functionCalls.get(callId);
|
|
57300
57358
|
if (fnCall) {
|
|
57301
57359
|
fnCall.arguments += event.delta || "";
|
|
57302
|
-
|
|
57360
|
+
send("content_block_delta", {
|
|
57303
57361
|
type: "content_block_delta",
|
|
57304
57362
|
index: fnCall.index,
|
|
57305
57363
|
delta: { type: "input_json_delta", partial_json: event.delta || "" }
|
|
57306
|
-
};
|
|
57307
|
-
controller.enqueue(encoder.encode(`event: content_block_delta
|
|
57308
|
-
data: ${JSON.stringify(delta)}
|
|
57309
|
-
|
|
57310
|
-
`));
|
|
57364
|
+
});
|
|
57311
57365
|
}
|
|
57312
57366
|
} else if (event.type === "response.output_item.done") {
|
|
57313
57367
|
if (event.item?.type === "function_call") {
|
|
57314
57368
|
const callId = event.item.call_id || event.item.id;
|
|
57315
|
-
const fnCall = functionCalls.get(callId);
|
|
57369
|
+
const fnCall = functionCalls.get(callId) || functionCalls.get(event.item.id);
|
|
57316
57370
|
if (fnCall) {
|
|
57317
|
-
|
|
57318
|
-
controller.enqueue(encoder.encode(`event: content_block_stop
|
|
57319
|
-
data: ${JSON.stringify(blockStop)}
|
|
57320
|
-
|
|
57321
|
-
`));
|
|
57371
|
+
send("content_block_stop", { type: "content_block_stop", index: fnCall.index });
|
|
57322
57372
|
}
|
|
57323
57373
|
}
|
|
57374
|
+
} else if (event.type === "response.incomplete") {
|
|
57375
|
+
log(`[OpenAIHandler] Response incomplete: ${event.reason || "unknown reason"}`);
|
|
57376
|
+
if (event.response?.usage) {
|
|
57377
|
+
inputTokens = event.response.usage.input_tokens || inputTokens;
|
|
57378
|
+
outputTokens = event.response.usage.output_tokens || outputTokens;
|
|
57379
|
+
}
|
|
57324
57380
|
} else if (event.type === "response.completed" || event.type === "response.done") {
|
|
57325
57381
|
if (event.response?.usage) {
|
|
57326
57382
|
inputTokens = event.response.usage.input_tokens || 0;
|
|
@@ -57337,31 +57393,29 @@ data: ${JSON.stringify(blockStop)}
|
|
|
57337
57393
|
}
|
|
57338
57394
|
}
|
|
57339
57395
|
}
|
|
57340
|
-
if (
|
|
57341
|
-
|
|
57342
|
-
|
|
57343
|
-
|
|
57344
|
-
|
|
57345
|
-
|
|
57396
|
+
if (pingInterval) {
|
|
57397
|
+
clearInterval(pingInterval);
|
|
57398
|
+
pingInterval = null;
|
|
57399
|
+
}
|
|
57400
|
+
if (hasTextContent) {
|
|
57401
|
+
send("content_block_stop", { type: "content_block_stop", index: blockIndex });
|
|
57346
57402
|
}
|
|
57347
57403
|
const stopReason = hasToolUse ? "tool_use" : "end_turn";
|
|
57348
|
-
|
|
57404
|
+
send("message_delta", {
|
|
57349
57405
|
type: "message_delta",
|
|
57350
57406
|
delta: { stop_reason: stopReason, stop_sequence: null },
|
|
57351
57407
|
usage: { input_tokens: inputTokens, output_tokens: outputTokens }
|
|
57352
|
-
};
|
|
57353
|
-
|
|
57354
|
-
|
|
57355
|
-
|
|
57356
|
-
`));
|
|
57357
|
-
const messageStop = { type: "message_stop" };
|
|
57358
|
-
controller.enqueue(encoder.encode(`event: message_stop
|
|
57359
|
-
data: ${JSON.stringify(messageStop)}
|
|
57360
|
-
|
|
57361
|
-
`));
|
|
57408
|
+
});
|
|
57409
|
+
send("message_stop", { type: "message_stop" });
|
|
57410
|
+
isClosed = true;
|
|
57362
57411
|
this.updateTokenTracking(inputTokens, outputTokens);
|
|
57363
57412
|
controller.close();
|
|
57364
57413
|
} catch (error46) {
|
|
57414
|
+
if (pingInterval) {
|
|
57415
|
+
clearInterval(pingInterval);
|
|
57416
|
+
pingInterval = null;
|
|
57417
|
+
}
|
|
57418
|
+
isClosed = true;
|
|
57365
57419
|
log(`[OpenAIHandler] Responses streaming error: ${error46}`);
|
|
57366
57420
|
controller.error(error46);
|
|
57367
57421
|
}
|
|
@@ -58207,7 +58261,7 @@ function createTempSettingsFile(modelDisplay, port) {
|
|
|
58207
58261
|
const DIM2 = "\\033[2m";
|
|
58208
58262
|
const RESET2 = "\\033[0m";
|
|
58209
58263
|
const BOLD2 = "\\033[1m";
|
|
58210
|
-
statusCommand = `JSON=$(cat) && DIR=$(basename "$(pwd)") && [ \${#DIR} -gt 15 ] && DIR="\${DIR:0:12}..." || true && CTX=100 && COST="0" && if [ -f "${tokenFilePath}" ]; then TOKENS=$(cat "${tokenFilePath}" 2>/dev/null) && REAL_CTX=$(echo "$TOKENS" | grep -o '"context_left_percent":[0-9]*' | grep -o '[0-9]*') && if [ ! -z "$REAL_CTX" ]; then CTX="$REAL_CTX"; fi
|
|
58264
|
+
statusCommand = `JSON=$(cat) && DIR=$(basename "$(pwd)") && [ \${#DIR} -gt 15 ] && DIR="\${DIR:0:12}..." || true && CTX=100 && COST="0" && if [ -f "${tokenFilePath}" ]; then TOKENS=$(cat "${tokenFilePath}" 2>/dev/null) && REAL_CTX=$(echo "$TOKENS" | grep -o '"context_left_percent":[0-9]*' | grep -o '[0-9]*') && if [ ! -z "$REAL_CTX" ]; then CTX="$REAL_CTX"; fi && REAL_COST=$(echo "$TOKENS" | grep -o '"total_cost":[0-9.]*' | cut -d: -f2) && if [ ! -z "$REAL_COST" ]; then COST="$REAL_COST"; fi; fi && if [ "$CLAUDISH_IS_LOCAL" = "true" ]; then COST_DISPLAY="LOCAL"; else COST_DISPLAY=$(printf "\\$%.3f" "$COST"); fi && printf "${CYAN2}${BOLD2}%s${RESET2} ${DIM2}•${RESET2} ${YELLOW2}%s${RESET2} ${DIM2}•${RESET2} ${GREEN2}%s${RESET2} ${DIM2}•${RESET2} ${MAGENTA}%s%%${RESET2}\\n" "$DIR" "$CLAUDISH_ACTIVE_MODEL_NAME" "$COST_DISPLAY" "$CTX"`;
|
|
58211
58265
|
}
|
|
58212
58266
|
const settings = {
|
|
58213
58267
|
statusLine: {
|