@jeffreycao/copilot-api 1.14.5 → 1.14.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/main.js +1 -1
- package/dist/{server-CmynIOAW.js → server-uQjD_RpA.js} +49 -15
- package/dist/server-uQjD_RpA.js.map +1 -0
- package/dist/{start-Beq7gtGI.js → start-DNPIXvm4.js} +2 -2
- package/dist/{start-Beq7gtGI.js.map → start-DNPIXvm4.js.map} +1 -1
- package/package.json +2 -2
- package/dist/server-CmynIOAW.js.map +0 -1
package/dist/main.js
CHANGED
|
@@ -25,7 +25,7 @@ bindElectronFetch();
|
|
|
25
25
|
const { auth } = await import("./auth-DvJ8r_tN.js");
|
|
26
26
|
const { debug } = await import("./debug-Bb5hamXX.js");
|
|
27
27
|
const { mcp } = await import("./mcp-BseuqgHR.js");
|
|
28
|
-
const { start } = await import("./start-
|
|
28
|
+
const { start } = await import("./start-DNPIXvm4.js");
|
|
29
29
|
await runMain(defineCommand({
|
|
30
30
|
meta: {
|
|
31
31
|
name: "copilot-api",
|
|
@@ -3568,6 +3568,7 @@ const MESSAGE_TYPE = "message";
|
|
|
3568
3568
|
const COMPACTION_SIGNATURE_PREFIX = "cm1#";
|
|
3569
3569
|
const COMPACTION_SIGNATURE_SEPARATOR = "@";
|
|
3570
3570
|
const THINKING_TEXT = "Thinking...";
|
|
3571
|
+
const REASONING_SUMMARY_SEPARATOR = "\n\n";
|
|
3571
3572
|
const resolveReasoningEffort = (payload) => payload.output_config?.effort ?? getReasoningEffortForModel(payload.model);
|
|
3572
3573
|
const buildPromptCacheKey = (basePromptCacheKey, subagentAgentId) => {
|
|
3573
3574
|
if (!basePromptCacheKey) return null;
|
|
@@ -3609,7 +3610,7 @@ const translateAnthropicMessagesToResponsesPayload = (payload, subagentAgentId)
|
|
|
3609
3610
|
parallel_tool_calls: true,
|
|
3610
3611
|
reasoning: {
|
|
3611
3612
|
effort: resolveReasoningEffort(payload),
|
|
3612
|
-
summary: "
|
|
3613
|
+
summary: "auto",
|
|
3613
3614
|
context: isSupportAllTurns(payload) ? "all_turns" : "auto"
|
|
3614
3615
|
},
|
|
3615
3616
|
include: ["reasoning.encrypted_content"]
|
|
@@ -3755,17 +3756,24 @@ const createFileContent = (block) => ({
|
|
|
3755
3756
|
});
|
|
3756
3757
|
const createReasoningContent = (block) => {
|
|
3757
3758
|
const { encryptedContent, id } = parseReasoningSignature(block.signature);
|
|
3758
|
-
const thinking = block.thinking === "Thinking..." ? "" : block.thinking;
|
|
3759
3759
|
return {
|
|
3760
3760
|
id,
|
|
3761
3761
|
type: "reasoning",
|
|
3762
|
-
summary: thinking ?
|
|
3763
|
-
type: "summary_text",
|
|
3764
|
-
text: thinking
|
|
3765
|
-
}] : [],
|
|
3762
|
+
summary: createReasoningSummary(block.thinking === "Thinking..." ? "" : block.thinking),
|
|
3766
3763
|
encrypted_content: encryptedContent
|
|
3767
3764
|
};
|
|
3768
3765
|
};
|
|
3766
|
+
const createReasoningSummary = (thinking) => {
|
|
3767
|
+
if (thinking.length === 0) return [];
|
|
3768
|
+
if (!thinking.includes("\n\n")) return [{
|
|
3769
|
+
type: "summary_text",
|
|
3770
|
+
text: thinking
|
|
3771
|
+
}];
|
|
3772
|
+
return thinking.split(REASONING_SUMMARY_SEPARATOR).map((text) => ({
|
|
3773
|
+
type: "summary_text",
|
|
3774
|
+
text
|
|
3775
|
+
}));
|
|
3776
|
+
};
|
|
3769
3777
|
const createCompactionContent = (block) => {
|
|
3770
3778
|
const compaction = decodeCompactionCarrierSignature(block.signature);
|
|
3771
3779
|
if (!compaction) return;
|
|
@@ -4042,7 +4050,7 @@ const extractReasoningText = (item) => {
|
|
|
4042
4050
|
};
|
|
4043
4051
|
if (!item.summary || item.summary.length === 0) return THINKING_TEXT;
|
|
4044
4052
|
collectFromBlocks(item.summary);
|
|
4045
|
-
return segments.join(
|
|
4053
|
+
return segments.join(REASONING_SUMMARY_SEPARATOR).trim();
|
|
4046
4054
|
};
|
|
4047
4055
|
const createToolUseContentBlock = (call) => {
|
|
4048
4056
|
const toolId = call.call_id;
|
|
@@ -4193,6 +4201,7 @@ const createResponsesStreamState = (options) => ({
|
|
|
4193
4201
|
blockIndexByKey: /* @__PURE__ */ new Map(),
|
|
4194
4202
|
openBlocks: /* @__PURE__ */ new Set(),
|
|
4195
4203
|
blockHasDelta: /* @__PURE__ */ new Set(),
|
|
4204
|
+
reasoningSummaryHasDelta: /* @__PURE__ */ new Set(),
|
|
4196
4205
|
functionCallStateByOutputIndex: /* @__PURE__ */ new Map(),
|
|
4197
4206
|
toolSearchName: options?.toolSearchName ?? "mcp__tool_search__search",
|
|
4198
4207
|
hasToolCall: false
|
|
@@ -4202,6 +4211,7 @@ const translateResponsesStreamEvent = (rawEvent, state) => {
|
|
|
4202
4211
|
case "response.created": return handleResponseCreated(rawEvent, state);
|
|
4203
4212
|
case "response.output_item.added": return handleOutputItemAdded$1(rawEvent, state);
|
|
4204
4213
|
case "response.reasoning_summary_text.delta": return handleReasoningSummaryTextDelta(rawEvent, state);
|
|
4214
|
+
case "response.reasoning_summary_part.added": return handleReasoningSummaryPartAdded(rawEvent, state);
|
|
4205
4215
|
case "response.output_text.delta": return handleOutputTextDelta(rawEvent, state);
|
|
4206
4216
|
case "response.reasoning_summary_text.done": return handleReasoningSummaryTextDone(rawEvent, state);
|
|
4207
4217
|
case "response.output_text.done": return handleOutputTextDone(rawEvent, state);
|
|
@@ -4298,7 +4308,7 @@ const handleOutputItemDone$1 = (rawEvent, state) => {
|
|
|
4298
4308
|
const blockIndex = openThinkingBlockIfNeeded(state, outputIndex, events);
|
|
4299
4309
|
const signature = (item.encrypted_content ?? "") + "@" + item.id;
|
|
4300
4310
|
if (signature) {
|
|
4301
|
-
if (!item.summary || item.summary.length === 0) events.push({
|
|
4311
|
+
if ((!item.summary || item.summary.length === 0) && !state.blockHasDelta.has(blockIndex)) events.push({
|
|
4302
4312
|
type: "content_block_delta",
|
|
4303
4313
|
index: blockIndex,
|
|
4304
4314
|
delta: {
|
|
@@ -4389,8 +4399,10 @@ const handleOutputTextDelta = (rawEvent, state) => {
|
|
|
4389
4399
|
};
|
|
4390
4400
|
const handleReasoningSummaryTextDelta = (rawEvent, state) => {
|
|
4391
4401
|
const outputIndex = rawEvent.output_index;
|
|
4402
|
+
const summaryIndex = rawEvent.summary_index;
|
|
4392
4403
|
const deltaText = rawEvent.delta;
|
|
4393
4404
|
const events = new Array();
|
|
4405
|
+
if (!deltaText) return events;
|
|
4394
4406
|
const blockIndex = openThinkingBlockIfNeeded(state, outputIndex, events);
|
|
4395
4407
|
events.push({
|
|
4396
4408
|
type: "content_block_delta",
|
|
@@ -4401,21 +4413,42 @@ const handleReasoningSummaryTextDelta = (rawEvent, state) => {
|
|
|
4401
4413
|
}
|
|
4402
4414
|
});
|
|
4403
4415
|
state.blockHasDelta.add(blockIndex);
|
|
4416
|
+
state.reasoningSummaryHasDelta.add(getBlockKey(outputIndex, summaryIndex));
|
|
4404
4417
|
return events;
|
|
4405
4418
|
};
|
|
4406
|
-
const
|
|
4407
|
-
const outputIndex = rawEvent.output_index;
|
|
4408
|
-
const text = rawEvent.text;
|
|
4419
|
+
const handleReasoningSummaryPartAdded = (rawEvent, state) => {
|
|
4409
4420
|
const events = new Array();
|
|
4410
|
-
const blockIndex = openThinkingBlockIfNeeded(state,
|
|
4411
|
-
if (
|
|
4421
|
+
const blockIndex = openThinkingBlockIfNeeded(state, rawEvent.output_index, events);
|
|
4422
|
+
if (rawEvent.summary_index === 0) return events;
|
|
4423
|
+
events.push({
|
|
4412
4424
|
type: "content_block_delta",
|
|
4413
4425
|
index: blockIndex,
|
|
4414
4426
|
delta: {
|
|
4415
4427
|
type: "thinking_delta",
|
|
4416
|
-
thinking:
|
|
4428
|
+
thinking: REASONING_SUMMARY_SEPARATOR
|
|
4417
4429
|
}
|
|
4418
4430
|
});
|
|
4431
|
+
state.blockHasDelta.add(blockIndex);
|
|
4432
|
+
return events;
|
|
4433
|
+
};
|
|
4434
|
+
const handleReasoningSummaryTextDone = (rawEvent, state) => {
|
|
4435
|
+
const outputIndex = rawEvent.output_index;
|
|
4436
|
+
const summaryIndex = rawEvent.summary_index;
|
|
4437
|
+
const text = rawEvent.text;
|
|
4438
|
+
const events = new Array();
|
|
4439
|
+
const blockIndex = openThinkingBlockIfNeeded(state, outputIndex, events);
|
|
4440
|
+
const summaryKey = getBlockKey(outputIndex, summaryIndex);
|
|
4441
|
+
if (text && !state.reasoningSummaryHasDelta.has(summaryKey)) {
|
|
4442
|
+
events.push({
|
|
4443
|
+
type: "content_block_delta",
|
|
4444
|
+
index: blockIndex,
|
|
4445
|
+
delta: {
|
|
4446
|
+
type: "thinking_delta",
|
|
4447
|
+
thinking: text
|
|
4448
|
+
}
|
|
4449
|
+
});
|
|
4450
|
+
state.blockHasDelta.add(blockIndex);
|
|
4451
|
+
}
|
|
4419
4452
|
return events;
|
|
4420
4453
|
};
|
|
4421
4454
|
const handleOutputTextDone = (rawEvent, state) => {
|
|
@@ -4562,6 +4595,7 @@ const closeOpenBlocks = (state, events) => {
|
|
|
4562
4595
|
const closeAllOpenBlocks = (state, events) => {
|
|
4563
4596
|
closeOpenBlocks(state, events);
|
|
4564
4597
|
state.functionCallStateByOutputIndex.clear();
|
|
4598
|
+
state.reasoningSummaryHasDelta.clear();
|
|
4565
4599
|
};
|
|
4566
4600
|
const buildErrorEvent = (message) => ({
|
|
4567
4601
|
type: "error",
|
|
@@ -6886,4 +6920,4 @@ server.route("/:provider/v1/models", providerModelRoutes);
|
|
|
6886
6920
|
//#endregion
|
|
6887
6921
|
export { server };
|
|
6888
6922
|
|
|
6889
|
-
//# sourceMappingURL=server-
|
|
6923
|
+
//# sourceMappingURL=server-uQjD_RpA.js.map
|