@aiderdesk/aiderdesk 0.67.0 → 0.68.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/out/renderer/assets/{arc-BnPy4nhx.js → arc-Cju-fnUJ.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-3BPJPVTR-_SwpsbSs.js → architectureDiagram-3BPJPVTR-hVK8LPcC.js} +3 -3
- package/out/renderer/assets/{blockDiagram-GPEHLZMM-D8Bc_xCY.js → blockDiagram-GPEHLZMM-B04Ulwbh.js} +4 -4
- package/out/renderer/assets/{c4Diagram-AAUBKEIU-Ddic5IpI.js → c4Diagram-AAUBKEIU-DSP8EUB6.js} +2 -2
- package/out/renderer/assets/{channel-I2sEi2rW.js → channel-CM1Bn7Zy.js} +1 -1
- package/out/renderer/assets/{chunk-2J33WTMH-Cqrw7IHw.js → chunk-2J33WTMH-Bd_3pGvb.js} +1 -1
- package/out/renderer/assets/{chunk-4BX2VUAB-DKY4go9E.js → chunk-4BX2VUAB-Csrpxz3N.js} +1 -1
- package/out/renderer/assets/{chunk-55IACEB6-COO6Gc0F.js → chunk-55IACEB6-BB7RTMZZ.js} +1 -1
- package/out/renderer/assets/{chunk-727SXJPM-Bu8zhvGn.js → chunk-727SXJPM-D6Y9H3aA.js} +5 -5
- package/out/renderer/assets/{chunk-AQP2D5EJ-JHXEk1U1.js → chunk-AQP2D5EJ-D5f9Zgag.js} +3 -3
- package/out/renderer/assets/{chunk-FMBD7UC4-BqbYNISq.js → chunk-FMBD7UC4-Bstyl64g.js} +1 -1
- package/out/renderer/assets/{chunk-ND2GUHAM-D29ZgnDp.js → chunk-ND2GUHAM-CVaUW2HV.js} +1 -1
- package/out/renderer/assets/{chunk-QZHKN3VN-B-pbtAbR.js → chunk-QZHKN3VN-AMfy7Nbn.js} +1 -1
- package/out/renderer/assets/{classDiagram-4FO5ZUOK-B7_tIdbP.js → classDiagram-4FO5ZUOK-CPmL8t3E.js} +6 -6
- package/out/renderer/assets/{classDiagram-v2-Q7XG4LA2-B7_tIdbP.js → classDiagram-v2-Q7XG4LA2-CPmL8t3E.js} +6 -6
- package/out/renderer/assets/{cose-bilkent-S5V4N54A-CGNgxRV6.js → cose-bilkent-S5V4N54A-px_eCLil.js} +1 -1
- package/out/renderer/assets/{dagre-BM42HDAG-DB-tI7Ml.js → dagre-BM42HDAG-c63xhfuM.js} +3 -3
- package/out/renderer/assets/{diagram-2AECGRRQ-Cdwrgy7R.js → diagram-2AECGRRQ-DISIyKng.js} +3 -3
- package/out/renderer/assets/{diagram-5GNKFQAL-BnvZ78_N.js → diagram-5GNKFQAL-BSkGLBgD.js} +4 -4
- package/out/renderer/assets/{diagram-KO2AKTUF-VUrfwRCk.js → diagram-KO2AKTUF-xiSl-Lui.js} +3 -3
- package/out/renderer/assets/{diagram-LMA3HP47-_Vo8GrFC.js → diagram-LMA3HP47-lJ69G8gJ.js} +3 -3
- package/out/renderer/assets/{diagram-OG6HWLK6-CoLz9kio.js → diagram-OG6HWLK6-AoDpX3QT.js} +4 -4
- package/out/renderer/assets/{erDiagram-TEJ5UH35-B3Bg3gW1.js → erDiagram-TEJ5UH35-O7UNRkDw.js} +4 -4
- package/out/renderer/assets/{flowDiagram-I6XJVG4X-BgyAk0Xe.js → flowDiagram-I6XJVG4X-Dd9XTtIY.js} +6 -6
- package/out/renderer/assets/{ganttDiagram-6RSMTGT7-NnVRwQPs.js → ganttDiagram-6RSMTGT7-Bc7FUk0Y.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-PVQCEYII-C4vrRnDw.js → gitGraphDiagram-PVQCEYII-DwEksAhs.js} +4 -4
- package/out/renderer/assets/{graph-BZvTCUpv.js → graph-BPvbzKl1.js} +1 -1
- package/out/renderer/assets/{index-P63PgYUG.js → index-BmQl7j8n.js} +1607 -1288
- package/out/renderer/assets/{index-zdiQSGqQ.css → index-z-BItG-u.css} +8 -0
- package/out/renderer/assets/{infoDiagram-5YYISTIA-zTriWVJJ.js → infoDiagram-5YYISTIA-DvophXOV.js} +2 -2
- package/out/renderer/assets/{ishikawaDiagram-YF4QCWOH-DHO6Yeea.js → ishikawaDiagram-YF4QCWOH-CDT4EDOF.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-JHISSGLW-CZsRcg2X.js → journeyDiagram-JHISSGLW-B5FCPOti.js} +4 -4
- package/out/renderer/assets/jsx-dev-runtime-DuBp-Rhq.js +49 -0
- package/out/renderer/assets/{kanban-definition-UN3LZRKU-DSpAeh8p.js → kanban-definition-UN3LZRKU-CM_TQl4S.js} +2 -2
- package/out/renderer/assets/{layout-B5A8fT-Z.js → layout-DdBKGefG.js} +2 -2
- package/out/renderer/assets/{mindmap-definition-RKZ34NQL-Bns9Ab8p.js → mindmap-definition-RKZ34NQL-BeGrpK-H.js} +3 -3
- package/out/renderer/assets/{pieDiagram-4H26LBE5-BX36DY7W.js → pieDiagram-4H26LBE5-CnMhRK3I.js} +4 -4
- package/out/renderer/assets/{quadrantDiagram-W4KKPZXB-DuD2qSni.js → quadrantDiagram-W4KKPZXB-O_Q_JI2s.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-4Y6WPE33-Th2uknlw.js → requirementDiagram-4Y6WPE33-vf9wLf04.js} +3 -3
- package/out/renderer/assets/{sankeyDiagram-5OEKKPKP-DP3WODC7.js → sankeyDiagram-5OEKKPKP-CE4n-uB4.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-3UESZ5HK-BvpGEq-v.js → sequenceDiagram-3UESZ5HK-DebEZhql.js} +3 -3
- package/out/renderer/assets/{stateDiagram-AJRCARHV-Btrfma35.js → stateDiagram-AJRCARHV-DCsVosBt.js} +6 -6
- package/out/renderer/assets/{stateDiagram-v2-BHNVJYJU-v-8JiozM.js → stateDiagram-v2-BHNVJYJU-8oguEvt8.js} +4 -4
- package/out/renderer/assets/{timeline-definition-PNZ67QCA-prZy7cGx.js → timeline-definition-PNZ67QCA-CSfXVnNf.js} +2 -2
- package/out/renderer/assets/{vennDiagram-CIIHVFJN-XCVp5OjS.js → vennDiagram-CIIHVFJN-DxOEVeC4.js} +1 -1
- package/out/renderer/assets/{wardley-L42UT6IY-FZSNLjCs.js → wardley-L42UT6IY-Cz6T4MDn.js} +1 -1
- package/out/renderer/assets/{wardleyDiagram-YWT4CUSO-Cla_7ryL.js → wardleyDiagram-YWT4CUSO-B4sA3LOJ.js} +3 -3
- package/out/renderer/assets/{xychartDiagram-2RQKCTM6-CKvwGbhk.js → xychartDiagram-2RQKCTM6-DbJjruqS.js} +1 -1
- package/out/renderer/index.html +2 -2
- package/out/resources/skills/extension-creator/SKILL.md +24 -0
- package/out/resources/skills/extension-creator/references/examples-gallery.md +11 -0
- package/out/resources/skills/extension-creator/references/extension-interface.md +4 -0
- package/out/resources/skills/extension-creator/references/external-libraries.md +159 -0
- package/out/resources/skills/extension-creator/references/ui-components.md +24 -0
- package/out/runner.js +228 -33
- package/package.json +2 -2
package/out/runner.js
CHANGED
|
@@ -2446,6 +2446,19 @@ const getDefaultProjectSettings = (store, providerModels, baseDir, defaultAgentP
|
|
|
2446
2446
|
contextSidebarSectionsHidden: []
|
|
2447
2447
|
};
|
|
2448
2448
|
};
|
|
2449
|
+
const DEFAULT_FETCH_TIMEOUT_MS = 12e4;
|
|
2450
|
+
const fetchWithTimeout = async (url, timeoutMs = DEFAULT_FETCH_TIMEOUT_MS) => {
|
|
2451
|
+
const controller = new AbortController();
|
|
2452
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
2453
|
+
try {
|
|
2454
|
+
const response = await fetch(url, { signal: controller.signal });
|
|
2455
|
+
clearTimeout(timeoutId);
|
|
2456
|
+
return response;
|
|
2457
|
+
} catch (error) {
|
|
2458
|
+
clearTimeout(timeoutId);
|
|
2459
|
+
throw error;
|
|
2460
|
+
}
|
|
2461
|
+
};
|
|
2449
2462
|
const filenamify = filenamifyImport.default;
|
|
2450
2463
|
const getFilePathSuggestions = async (currentPath, directoriesOnly = false) => {
|
|
2451
2464
|
try {
|
|
@@ -6702,7 +6715,7 @@ ${fileList}`
|
|
|
6702
6715
|
task.addToolMessage(options.toolCallId, serverName, messageToolName, effectiveInput, void 0, void 0, promptContext);
|
|
6703
6716
|
const toolCalledExtensionResult = await this.extensionManager.dispatchEvent(
|
|
6704
6717
|
"onToolCalled",
|
|
6705
|
-
{ toolName, agentProfile: profile, input: effectiveInput, abortSignal: options.abortSignal || abortSignal },
|
|
6718
|
+
{ toolCallId: options.toolCallId, toolName, agentProfile: profile, input: effectiveInput, abortSignal: options.abortSignal || abortSignal },
|
|
6706
6719
|
task.project,
|
|
6707
6720
|
task
|
|
6708
6721
|
);
|
|
@@ -6719,7 +6732,7 @@ ${fileList}`
|
|
|
6719
6732
|
}
|
|
6720
6733
|
const toolFinishedExtensionResult = await this.extensionManager.dispatchEvent(
|
|
6721
6734
|
"onToolFinished",
|
|
6722
|
-
{ toolName, agentProfile: profile, input: effectiveInput, output: result },
|
|
6735
|
+
{ toolCallId: options.toolCallId, toolName, agentProfile: profile, input: effectiveInput, output: result },
|
|
6723
6736
|
task.project,
|
|
6724
6737
|
task
|
|
6725
6738
|
);
|
|
@@ -10830,6 +10843,18 @@ class ExtensionsApi extends BaseApi {
|
|
|
10830
10843
|
res.status(200).json(result);
|
|
10831
10844
|
})
|
|
10832
10845
|
);
|
|
10846
|
+
router.post(
|
|
10847
|
+
"/extensions/load-library",
|
|
10848
|
+
this.handleRequest(async (req, res) => {
|
|
10849
|
+
const { librarySpec } = req.body;
|
|
10850
|
+
if (!librarySpec) {
|
|
10851
|
+
res.status(400).json({ message: "librarySpec is required" });
|
|
10852
|
+
return;
|
|
10853
|
+
}
|
|
10854
|
+
const source = await this.eventsHandler.loadExtensionLibrary(librarySpec);
|
|
10855
|
+
res.status(200).type("application/javascript").send(source);
|
|
10856
|
+
})
|
|
10857
|
+
);
|
|
10833
10858
|
router.get(
|
|
10834
10859
|
"/extensions/config-component",
|
|
10835
10860
|
this.handleRequest(async (req, res) => {
|
|
@@ -12604,6 +12629,7 @@ ${JSON.stringify(part.output.value)}`
|
|
|
12604
12629
|
toolMessage.response = JSON.stringify(part.output.value);
|
|
12605
12630
|
toolMessage.usageReport = message.usageReport || toolMessage.usageReport;
|
|
12606
12631
|
toolMessage.promptContext = promptContext;
|
|
12632
|
+
toolMessage.finished = true;
|
|
12607
12633
|
}
|
|
12608
12634
|
if (serverName === AIDER_TOOL_GROUP_NAME && toolName === AIDER_TOOL_RUN_PROMPT && part.output?.value && typeof part.output.value === "object" && "responses" in part.output.value) {
|
|
12609
12635
|
const responses = part.output.value.responses;
|
|
@@ -12704,6 +12730,7 @@ ${JSON.stringify(part.output.value)}`
|
|
|
12704
12730
|
const toolMessage2 = messagesData.find((message2) => message2.type === "tool" && message2.id === subPart.toolCallId);
|
|
12705
12731
|
if (toolMessage2) {
|
|
12706
12732
|
toolMessage2.response = JSON.stringify(subPart.output.value);
|
|
12733
|
+
toolMessage2.finished = true;
|
|
12707
12734
|
}
|
|
12708
12735
|
}
|
|
12709
12736
|
}
|
|
@@ -12783,6 +12810,7 @@ ${JSON.stringify(part.output.value)}`
|
|
|
12783
12810
|
if (toolMessage) {
|
|
12784
12811
|
toolMessage.response = JSON.stringify(toolResultData.output);
|
|
12785
12812
|
toolMessage.usageReport = message.usageReport || toolMessage.usageReport;
|
|
12813
|
+
toolMessage.finished = true;
|
|
12786
12814
|
const promptContext = extractPromptContextFromToolResult(toolResultData.output);
|
|
12787
12815
|
if (promptContext) {
|
|
12788
12816
|
toolMessage.promptContext = promptContext;
|
|
@@ -15405,6 +15433,12 @@ Git output: ${err.stderr || err.stdout || err.message}`
|
|
|
15405
15433
|
await this.pruneDeleted(projectDir);
|
|
15406
15434
|
}
|
|
15407
15435
|
}
|
|
15436
|
+
var CompactionLevel = /* @__PURE__ */ ((CompactionLevel2) => {
|
|
15437
|
+
CompactionLevel2[CompactionLevel2["One"] = 1] = "One";
|
|
15438
|
+
CompactionLevel2[CompactionLevel2["Two"] = 2] = "Two";
|
|
15439
|
+
CompactionLevel2[CompactionLevel2["Three"] = 3] = "Three";
|
|
15440
|
+
return CompactionLevel2;
|
|
15441
|
+
})(CompactionLevel || {});
|
|
15408
15442
|
const extractFilePath = (args) => {
|
|
15409
15443
|
if (typeof args === "object" && args !== null && "filePath" in args) {
|
|
15410
15444
|
return args.filePath;
|
|
@@ -15545,8 +15579,9 @@ const mergeConsecutiveAssistantMessages = (messages) => {
|
|
|
15545
15579
|
return true;
|
|
15546
15580
|
});
|
|
15547
15581
|
};
|
|
15548
|
-
const truncateNonPowerToolResults = async (messages, protectedMessageCount = 10) => {
|
|
15582
|
+
const truncateNonPowerToolResults = async (messages, protectedMessageCount = 10, compactionLevel = 1) => {
|
|
15549
15583
|
const protectedStart = getProtectedStartIndex(messages, protectedMessageCount);
|
|
15584
|
+
const redactionMessage = "Result redacted due to compaction, run again if needed.";
|
|
15550
15585
|
for (let i = 0; i < protectedStart; i++) {
|
|
15551
15586
|
const msg = messages[i];
|
|
15552
15587
|
if (msg.role !== "tool") {
|
|
@@ -15561,6 +15596,20 @@ const truncateNonPowerToolResults = async (messages, protectedMessageCount = 10)
|
|
|
15561
15596
|
if (isPowerTool(serverName)) {
|
|
15562
15597
|
continue;
|
|
15563
15598
|
}
|
|
15599
|
+
if (compactionLevel >= 3) {
|
|
15600
|
+
if (part.output.type === "text" || part.output.type === "error-text") {
|
|
15601
|
+
part.output = {
|
|
15602
|
+
type: part.output.type,
|
|
15603
|
+
value: redactionMessage
|
|
15604
|
+
};
|
|
15605
|
+
} else {
|
|
15606
|
+
part.output = {
|
|
15607
|
+
type: "text",
|
|
15608
|
+
value: redactionMessage
|
|
15609
|
+
};
|
|
15610
|
+
}
|
|
15611
|
+
continue;
|
|
15612
|
+
}
|
|
15564
15613
|
if (part.output.type !== "text" && part.output.type !== "error-text") {
|
|
15565
15614
|
continue;
|
|
15566
15615
|
}
|
|
@@ -15568,11 +15617,14 @@ const truncateNonPowerToolResults = async (messages, protectedMessageCount = 10)
|
|
|
15568
15617
|
if (!outputText) {
|
|
15569
15618
|
continue;
|
|
15570
15619
|
}
|
|
15620
|
+
const maxLines = compactionLevel >= 2 ? 10 : 20;
|
|
15621
|
+
const maxSizeKB = compactionLevel >= 2 ? 1 : 2;
|
|
15622
|
+
const maxTokens = compactionLevel >= 2 ? 1e3 : 2e3;
|
|
15571
15623
|
const truncated = await truncateToolResult(
|
|
15572
15624
|
outputText,
|
|
15573
|
-
|
|
15574
|
-
|
|
15575
|
-
|
|
15625
|
+
maxLines,
|
|
15626
|
+
maxSizeKB,
|
|
15627
|
+
maxTokens,
|
|
15576
15628
|
false,
|
|
15577
15629
|
"Output truncated due to compaction, re-execute the tool if full output is needed."
|
|
15578
15630
|
);
|
|
@@ -15586,17 +15638,17 @@ const truncateNonPowerToolResults = async (messages, protectedMessageCount = 10)
|
|
|
15586
15638
|
}
|
|
15587
15639
|
return messages;
|
|
15588
15640
|
};
|
|
15589
|
-
const smartCompactMessages = async (messages, protectedMessageCount = 10) => {
|
|
15641
|
+
const smartCompactMessages = async (messages, protectedMessageCount = 10, compactionLevel = 1) => {
|
|
15590
15642
|
let result = cloneMessages(messages);
|
|
15591
15643
|
result = removeErroredTools(result, protectedMessageCount);
|
|
15592
15644
|
result = collapseFileEdits(result, protectedMessageCount);
|
|
15593
15645
|
result = removeStaleFileReads(result, protectedMessageCount);
|
|
15594
|
-
result = compactFileReads(result, protectedMessageCount);
|
|
15595
|
-
result = removeObsoleteSearches(result, protectedMessageCount);
|
|
15596
|
-
result = compactSemanticSearches(result, protectedMessageCount);
|
|
15597
|
-
result = deduplicateBash(result, protectedMessageCount);
|
|
15646
|
+
result = compactFileReads(result, protectedMessageCount, compactionLevel);
|
|
15647
|
+
result = removeObsoleteSearches(result, protectedMessageCount, compactionLevel);
|
|
15648
|
+
result = compactSemanticSearches(result, protectedMessageCount, compactionLevel);
|
|
15649
|
+
result = deduplicateBash(result, protectedMessageCount, compactionLevel);
|
|
15598
15650
|
result = redactFetchOutputs(result, protectedMessageCount);
|
|
15599
|
-
result = await truncateNonPowerToolResults(result, protectedMessageCount);
|
|
15651
|
+
result = await truncateNonPowerToolResults(result, protectedMessageCount, compactionLevel);
|
|
15600
15652
|
result = mergeConsecutiveAssistantMessages(result);
|
|
15601
15653
|
return result;
|
|
15602
15654
|
};
|
|
@@ -15800,8 +15852,9 @@ const removeStaleFileReads = (messages, protectedMessageCount = 10) => {
|
|
|
15800
15852
|
}
|
|
15801
15853
|
return messages;
|
|
15802
15854
|
};
|
|
15803
|
-
const compactFileReads = (messages, protectedMessageCount = 10) => {
|
|
15855
|
+
const compactFileReads = (messages, protectedMessageCount = 10, compactionLevel = 1) => {
|
|
15804
15856
|
const protectedStart = getProtectedStartIndex(messages, protectedMessageCount);
|
|
15857
|
+
const maxLines = compactionLevel === 3 ? 0 : compactionLevel === 2 ? 20 : 50;
|
|
15805
15858
|
for (let i = 0; i < protectedStart; i++) {
|
|
15806
15859
|
if (i >= messages.length) {
|
|
15807
15860
|
break;
|
|
@@ -15822,18 +15875,25 @@ const compactFileReads = (messages, protectedMessageCount = 10) => {
|
|
|
15822
15875
|
if (part.output.type !== "text") {
|
|
15823
15876
|
continue;
|
|
15824
15877
|
}
|
|
15878
|
+
if (compactionLevel === 3) {
|
|
15879
|
+
part.output = {
|
|
15880
|
+
type: "text",
|
|
15881
|
+
value: "<result redacted due to compaction, read the file again if content is needed>"
|
|
15882
|
+
};
|
|
15883
|
+
continue;
|
|
15884
|
+
}
|
|
15825
15885
|
const lines = part.output.value.split("\n");
|
|
15826
|
-
if (lines.length >
|
|
15886
|
+
if (lines.length > maxLines) {
|
|
15827
15887
|
part.output = {
|
|
15828
15888
|
type: "text",
|
|
15829
|
-
value: lines.slice(0,
|
|
15889
|
+
value: lines.slice(0, maxLines).join("\n") + "\n<truncated due to compaction, read the file again if full content is needed>"
|
|
15830
15890
|
};
|
|
15831
15891
|
}
|
|
15832
15892
|
}
|
|
15833
15893
|
}
|
|
15834
15894
|
return messages;
|
|
15835
15895
|
};
|
|
15836
|
-
const removeObsoleteSearches = (messages, protectedMessageCount = 10) => {
|
|
15896
|
+
const removeObsoleteSearches = (messages, protectedMessageCount = 10, compactionLevel = 1) => {
|
|
15837
15897
|
const protectedStart = getProtectedStartIndex(messages, protectedMessageCount);
|
|
15838
15898
|
const fileModificationPositions = [];
|
|
15839
15899
|
for (let i = 0; i < messages.length; i++) {
|
|
@@ -15864,7 +15924,7 @@ const removeObsoleteSearches = (messages, protectedMessageCount = 10) => {
|
|
|
15864
15924
|
}
|
|
15865
15925
|
}
|
|
15866
15926
|
const hasFileModifications = fileModificationPositions.length > 0;
|
|
15867
|
-
if (!hasFileModifications) {
|
|
15927
|
+
if (!hasFileModifications && compactionLevel < 3) {
|
|
15868
15928
|
return messages;
|
|
15869
15929
|
}
|
|
15870
15930
|
for (let i = protectedStart - 1; i >= 0; i--) {
|
|
@@ -15886,8 +15946,8 @@ const removeObsoleteSearches = (messages, protectedMessageCount = 10) => {
|
|
|
15886
15946
|
if (toolName !== POWER_TOOL_GLOB && toolName !== POWER_TOOL_GREP) {
|
|
15887
15947
|
continue;
|
|
15888
15948
|
}
|
|
15889
|
-
const
|
|
15890
|
-
if (
|
|
15949
|
+
const shouldRemove = compactionLevel >= 3 || fileModificationPositions.some((pos) => pos > i);
|
|
15950
|
+
if (shouldRemove) {
|
|
15891
15951
|
removeToolCallFromAssistant(messages, part.toolCallId);
|
|
15892
15952
|
removeToolResult(messages, part.toolCallId);
|
|
15893
15953
|
}
|
|
@@ -15895,7 +15955,7 @@ const removeObsoleteSearches = (messages, protectedMessageCount = 10) => {
|
|
|
15895
15955
|
}
|
|
15896
15956
|
return messages;
|
|
15897
15957
|
};
|
|
15898
|
-
const compactSemanticSearches = (messages, protectedMessageCount = 10) => {
|
|
15958
|
+
const compactSemanticSearches = (messages, protectedMessageCount = 10, compactionLevel = 1) => {
|
|
15899
15959
|
const protectedStart = getProtectedStartIndex(messages, protectedMessageCount);
|
|
15900
15960
|
const searchIndices = [];
|
|
15901
15961
|
for (let i = 0; i < protectedStart; i++) {
|
|
@@ -15918,7 +15978,14 @@ const compactSemanticSearches = (messages, protectedMessageCount = 10) => {
|
|
|
15918
15978
|
searchIndices.push({ messageIndex: i, partIndex: j, toolCallId: part.toolCallId });
|
|
15919
15979
|
}
|
|
15920
15980
|
}
|
|
15921
|
-
if (searchIndices.length <= 1) {
|
|
15981
|
+
if (searchIndices.length <= 1 && compactionLevel < 3) {
|
|
15982
|
+
return messages;
|
|
15983
|
+
}
|
|
15984
|
+
if (compactionLevel >= 3) {
|
|
15985
|
+
for (const search2 of searchIndices) {
|
|
15986
|
+
removeToolCallFromAssistant(messages, search2.toolCallId);
|
|
15987
|
+
removeToolResult(messages, search2.toolCallId);
|
|
15988
|
+
}
|
|
15922
15989
|
return messages;
|
|
15923
15990
|
}
|
|
15924
15991
|
const toRemove = searchIndices.slice(0, -1);
|
|
@@ -15927,6 +15994,7 @@ const compactSemanticSearches = (messages, protectedMessageCount = 10) => {
|
|
|
15927
15994
|
removeToolCallFromAssistant(messages, search2.toolCallId);
|
|
15928
15995
|
removeToolResult(messages, search2.toolCallId);
|
|
15929
15996
|
}
|
|
15997
|
+
const maxLines = compactionLevel === 2 ? 20 : 50;
|
|
15930
15998
|
const keptToolIdx = messages.findIndex((m) => m.role === "tool" && m.content.some((p) => p.type === "tool-result" && p.toolCallId === toKeep.toolCallId));
|
|
15931
15999
|
if (keptToolIdx !== -1) {
|
|
15932
16000
|
const keptMsg = messages[keptToolIdx];
|
|
@@ -15934,17 +16002,17 @@ const compactSemanticSearches = (messages, protectedMessageCount = 10) => {
|
|
|
15934
16002
|
const keptPart = keptMsg.content[keptPartIdx];
|
|
15935
16003
|
if (keptPart && keptPart.output.type === "text") {
|
|
15936
16004
|
const lines = keptPart.output.value.split("\n");
|
|
15937
|
-
if (lines.length >
|
|
16005
|
+
if (lines.length > maxLines) {
|
|
15938
16006
|
keptPart.output = {
|
|
15939
16007
|
type: "text",
|
|
15940
|
-
value: lines.slice(0,
|
|
16008
|
+
value: lines.slice(0, maxLines).join("\n") + "\n<truncated due to compaction, run again if full output is needed>"
|
|
15941
16009
|
};
|
|
15942
16010
|
}
|
|
15943
16011
|
}
|
|
15944
16012
|
}
|
|
15945
16013
|
return messages;
|
|
15946
16014
|
};
|
|
15947
|
-
const deduplicateBash = (messages, protectedMessageCount = 10) => {
|
|
16015
|
+
const deduplicateBash = (messages, protectedMessageCount = 10, compactionLevel = 1) => {
|
|
15948
16016
|
const protectedStart = getProtectedStartIndex(messages, protectedMessageCount);
|
|
15949
16017
|
const bashCommands = /* @__PURE__ */ new Map();
|
|
15950
16018
|
for (let i = 0; i < protectedStart; i++) {
|
|
@@ -16004,6 +16072,13 @@ const deduplicateBash = (messages, protectedMessageCount = 10) => {
|
|
|
16004
16072
|
if (!isPowerTool(serverName) || toolName !== POWER_TOOL_BASH) {
|
|
16005
16073
|
continue;
|
|
16006
16074
|
}
|
|
16075
|
+
if (compactionLevel >= 3) {
|
|
16076
|
+
part.output = {
|
|
16077
|
+
type: "text",
|
|
16078
|
+
value: "<result redacted due to compaction, run again if needed>"
|
|
16079
|
+
};
|
|
16080
|
+
continue;
|
|
16081
|
+
}
|
|
16007
16082
|
if (part.output.type !== "text") {
|
|
16008
16083
|
continue;
|
|
16009
16084
|
}
|
|
@@ -16014,11 +16089,12 @@ const deduplicateBash = (messages, protectedMessageCount = 10) => {
|
|
|
16014
16089
|
const stderr = typeof parsed.stderr === "string" ? parsed.stderr : "";
|
|
16015
16090
|
const redactionMessage = "<output redacted due to compaction, run again if output is needed>";
|
|
16016
16091
|
let modified = false;
|
|
16017
|
-
|
|
16092
|
+
const redactionThreshold = compactionLevel >= 2 ? 0 : 30;
|
|
16093
|
+
if (stdout.length > redactionThreshold) {
|
|
16018
16094
|
parsed.stdout = redactionMessage;
|
|
16019
16095
|
modified = true;
|
|
16020
16096
|
}
|
|
16021
|
-
if (stderr.length >
|
|
16097
|
+
if (stderr.length > redactionThreshold) {
|
|
16022
16098
|
parsed.stderr = redactionMessage;
|
|
16023
16099
|
modified = true;
|
|
16024
16100
|
}
|
|
@@ -16148,6 +16224,8 @@ class Task {
|
|
|
16148
16224
|
tokensInfo;
|
|
16149
16225
|
queuedPrompts = [];
|
|
16150
16226
|
isCompacting = false;
|
|
16227
|
+
lastSmartCompactionMessageCount = 0;
|
|
16228
|
+
smartCompactionLevel = CompactionLevel.One;
|
|
16151
16229
|
taskDataPath;
|
|
16152
16230
|
contextManager;
|
|
16153
16231
|
agent;
|
|
@@ -17839,6 +17917,7 @@ ${contentText}</agent-response>`;
|
|
|
17839
17917
|
lastAgentProviderMetadata: null
|
|
17840
17918
|
});
|
|
17841
17919
|
}
|
|
17920
|
+
this.smartCompactionLevel = CompactionLevel.One;
|
|
17842
17921
|
this.contextManager.clearMessages(true, createSnapshot);
|
|
17843
17922
|
await this.runCommand("clear", addToHistory);
|
|
17844
17923
|
this.eventManager.sendClearTask(this.project.baseDir, this.taskId, true, false);
|
|
@@ -18126,7 +18205,9 @@ ${contentText}</agent-response>`;
|
|
|
18126
18205
|
const removedMessages = this.contextManager.removeMessagesUpToUserMessage(messageId);
|
|
18127
18206
|
const originalUserMessage = removedMessages[0];
|
|
18128
18207
|
if (!originalUserMessage || originalUserMessage.role !== MessageRole.User) {
|
|
18129
|
-
logger.warn("Could not find the specified user message to redo.", {
|
|
18208
|
+
logger.warn("Could not find the specified user message to redo.", {
|
|
18209
|
+
messageId
|
|
18210
|
+
});
|
|
18130
18211
|
return;
|
|
18131
18212
|
}
|
|
18132
18213
|
const originalText = extractTextContent(originalUserMessage.content);
|
|
@@ -18243,7 +18324,14 @@ ${contentText}</agent-response>`;
|
|
|
18243
18324
|
return [];
|
|
18244
18325
|
}
|
|
18245
18326
|
await this.contextManager.backupContext();
|
|
18246
|
-
const
|
|
18327
|
+
const messagesSinceLastCompaction = contextMessages.length - this.lastSmartCompactionMessageCount;
|
|
18328
|
+
if (messagesSinceLastCompaction <= 3) {
|
|
18329
|
+
this.smartCompactionLevel = Math.min(this.smartCompactionLevel + 1, CompactionLevel.Three);
|
|
18330
|
+
} else if (messagesSinceLastCompaction > 5) {
|
|
18331
|
+
this.smartCompactionLevel = CompactionLevel.One;
|
|
18332
|
+
}
|
|
18333
|
+
const compactedMessages = await smartCompactMessages(contextMessages, 10, this.smartCompactionLevel);
|
|
18334
|
+
this.lastSmartCompactionMessageCount = compactedMessages.length;
|
|
18247
18335
|
this.contextManager.setContextMessages(compactedMessages);
|
|
18248
18336
|
await this.contextManager.loadMessages(compactedMessages, false);
|
|
18249
18337
|
await this.updateContextInfo();
|
|
@@ -19166,7 +19254,13 @@ ${diff}
|
|
|
19166
19254
|
if (success) {
|
|
19167
19255
|
const newHead = await this.worktreeManager.getHeadCommit(this.task.worktree.path);
|
|
19168
19256
|
if (newHead) {
|
|
19169
|
-
await this.saveTask({
|
|
19257
|
+
await this.saveTask({
|
|
19258
|
+
worktree: {
|
|
19259
|
+
...this.task.worktree,
|
|
19260
|
+
baseCommit: newHead,
|
|
19261
|
+
baseBranch: effectiveFromBranch
|
|
19262
|
+
}
|
|
19263
|
+
});
|
|
19170
19264
|
}
|
|
19171
19265
|
this.addLogMessage("info", "Worktree rebased successfully", true);
|
|
19172
19266
|
return;
|
|
@@ -22883,7 +22977,7 @@ const loadNeuralwattModels = async (profile, settings) => {
|
|
|
22883
22977
|
return { models: [], success: false, error: errorMsg };
|
|
22884
22978
|
}
|
|
22885
22979
|
const data = await response.json();
|
|
22886
|
-
logger.
|
|
22980
|
+
logger.debug(`Received response from Neuralwatt models API for profile ${profile.id}`, { data });
|
|
22887
22981
|
const models = data.data?.map((model) => {
|
|
22888
22982
|
const metadata = model.metadata;
|
|
22889
22983
|
const pricing = metadata?.pricing;
|
|
@@ -26620,7 +26714,7 @@ class ExtensionContextImpl {
|
|
|
26620
26714
|
return truncateToolResult(content, maxLines, maxSizeKB, maxTokens, saveToFile, truncationSuffix);
|
|
26621
26715
|
}
|
|
26622
26716
|
}
|
|
26623
|
-
const CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
26717
|
+
const CACHE_TTL_MS$1 = 24 * 60 * 60 * 1e3;
|
|
26624
26718
|
class ExtensionFetcher {
|
|
26625
26719
|
cache = /* @__PURE__ */ new Map();
|
|
26626
26720
|
getAvailableExtensionsPromise = null;
|
|
@@ -26651,7 +26745,7 @@ class ExtensionFetcher {
|
|
|
26651
26745
|
async fetchExtensionsFromRepo(repoUrl, forceRefresh) {
|
|
26652
26746
|
const cached = this.cache.get(repoUrl);
|
|
26653
26747
|
const now = Date.now();
|
|
26654
|
-
if (!forceRefresh && cached && now - cached.timestamp < CACHE_TTL_MS) {
|
|
26748
|
+
if (!forceRefresh && cached && now - cached.timestamp < CACHE_TTL_MS$1) {
|
|
26655
26749
|
logger.debug(`[ExtensionFetcher] Using cached extensions for ${repoUrl}`);
|
|
26656
26750
|
return cached.extensions;
|
|
26657
26751
|
}
|
|
@@ -26963,6 +27057,67 @@ class ExtensionFetcher {
|
|
|
26963
27057
|
return this.convertToGitHubRawUrl(webUrl);
|
|
26964
27058
|
}
|
|
26965
27059
|
}
|
|
27060
|
+
const ESM_SH_BASE_URL = "https://esm.sh";
|
|
27061
|
+
const CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
27062
|
+
const sanitizeLibraryName = (name) => {
|
|
27063
|
+
return name.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
27064
|
+
};
|
|
27065
|
+
class ExtensionLibraryLoader {
|
|
27066
|
+
cacheDir;
|
|
27067
|
+
constructor() {
|
|
27068
|
+
this.cacheDir = path.join(AIDER_DESK_CACHE_DIR, "extension-libraries");
|
|
27069
|
+
}
|
|
27070
|
+
getCachePath(librarySpec) {
|
|
27071
|
+
const sanitized = sanitizeLibraryName(librarySpec);
|
|
27072
|
+
return path.join(this.cacheDir, `${sanitized}.js`);
|
|
27073
|
+
}
|
|
27074
|
+
getMetaPath(librarySpec) {
|
|
27075
|
+
const sanitized = sanitizeLibraryName(librarySpec);
|
|
27076
|
+
return path.join(this.cacheDir, `${sanitized}.meta.json`);
|
|
27077
|
+
}
|
|
27078
|
+
async loadLibrary(librarySpec) {
|
|
27079
|
+
const cachePath = this.getCachePath(librarySpec);
|
|
27080
|
+
const metaPath = this.getMetaPath(librarySpec);
|
|
27081
|
+
try {
|
|
27082
|
+
await fs.access(cachePath);
|
|
27083
|
+
await fs.access(metaPath);
|
|
27084
|
+
try {
|
|
27085
|
+
const meta = JSON.parse(await fs.readFile(metaPath, "utf-8"));
|
|
27086
|
+
const age = Date.now() - new Date(meta.fetchedAt).getTime();
|
|
27087
|
+
if (age < CACHE_TTL_MS) {
|
|
27088
|
+
logger.debug(`[ExtensionLibraryLoader] Cache hit for ${librarySpec}`);
|
|
27089
|
+
return await fs.readFile(cachePath, "utf-8");
|
|
27090
|
+
}
|
|
27091
|
+
logger.info(`[ExtensionLibraryLoader] Cache stale for ${librarySpec} (age: ${Math.round(age / 1e3 / 60)}min), re-fetching`);
|
|
27092
|
+
} catch {
|
|
27093
|
+
logger.warn(`[ExtensionLibraryLoader] Failed to read meta for ${librarySpec}, re-fetching`);
|
|
27094
|
+
}
|
|
27095
|
+
} catch {
|
|
27096
|
+
}
|
|
27097
|
+
logger.info(`[ExtensionLibraryLoader] Fetching ${librarySpec} from esm.sh`);
|
|
27098
|
+
const url = `${ESM_SH_BASE_URL}/${librarySpec}?external=react,react-dom,react/jsx-runtime,react/jsx-dev-runtime&bundle-deps&bundle`;
|
|
27099
|
+
let response = await fetchWithTimeout(url);
|
|
27100
|
+
if (!response.ok) {
|
|
27101
|
+
throw new Error(`Failed to fetch library ${librarySpec} from esm.sh: ${response.status} ${response.statusText}`);
|
|
27102
|
+
}
|
|
27103
|
+
let source = await response.text();
|
|
27104
|
+
const redirectMatch = source.match(/export\s+\*\s+from\s+["']([^"']+)["']/);
|
|
27105
|
+
if (redirectMatch) {
|
|
27106
|
+
const bundleUrl = `${ESM_SH_BASE_URL}${redirectMatch[1]}`;
|
|
27107
|
+
logger.debug(`[ExtensionLibraryLoader] Following redirect to ${bundleUrl}`);
|
|
27108
|
+
response = await fetchWithTimeout(bundleUrl);
|
|
27109
|
+
if (!response.ok) {
|
|
27110
|
+
throw new Error(`Failed to fetch bundle for ${librarySpec} from esm.sh: ${response.status} ${response.statusText}`);
|
|
27111
|
+
}
|
|
27112
|
+
source = await response.text();
|
|
27113
|
+
}
|
|
27114
|
+
await fs.mkdir(this.cacheDir, { recursive: true });
|
|
27115
|
+
await fs.writeFile(cachePath, source, "utf-8");
|
|
27116
|
+
await fs.writeFile(metaPath, JSON.stringify({ librarySpec, fetchedAt: (/* @__PURE__ */ new Date()).toISOString() }), "utf-8");
|
|
27117
|
+
logger.info(`[ExtensionLibraryLoader] Cached ${librarySpec}`);
|
|
27118
|
+
return source;
|
|
27119
|
+
}
|
|
27120
|
+
}
|
|
26966
27121
|
class ExtensionManager {
|
|
26967
27122
|
constructor(store, modelManager, eventManager, telemetryManager, memoryManager, registry = new ExtensionRegistry()) {
|
|
26968
27123
|
this.store = store;
|
|
@@ -26973,6 +27128,7 @@ class ExtensionManager {
|
|
|
26973
27128
|
this.registry = registry;
|
|
26974
27129
|
this.loader = new ExtensionLoader();
|
|
26975
27130
|
this.fetcher = new ExtensionFetcher();
|
|
27131
|
+
this.libraryLoader = new ExtensionLibraryLoader();
|
|
26976
27132
|
}
|
|
26977
27133
|
loader;
|
|
26978
27134
|
fetcher;
|
|
@@ -26980,6 +27136,7 @@ class ExtensionManager {
|
|
|
26980
27136
|
projectWatchers = /* @__PURE__ */ new Map();
|
|
26981
27137
|
initialized = false;
|
|
26982
27138
|
listeners = [];
|
|
27139
|
+
libraryLoader;
|
|
26983
27140
|
debouncedNotifyListeners = debounce(() => {
|
|
26984
27141
|
const extensions = this.registry.getExtensions();
|
|
26985
27142
|
for (const listener of this.listeners) {
|
|
@@ -27834,6 +27991,39 @@ class ExtensionManager {
|
|
|
27834
27991
|
}
|
|
27835
27992
|
return collectedComponents;
|
|
27836
27993
|
}
|
|
27994
|
+
getUIComponentsLibraries(project) {
|
|
27995
|
+
const librariesByExtension = /* @__PURE__ */ new Map();
|
|
27996
|
+
const allExtensions = this.registry.getExtensions(project?.baseDir);
|
|
27997
|
+
const extensions = this.filterEnabledExtensions(allExtensions);
|
|
27998
|
+
for (const loaded of extensions) {
|
|
27999
|
+
const { instance, initialized, metadata } = loaded;
|
|
28000
|
+
if (!initialized || !instance.getUIComponentsLibraries) {
|
|
28001
|
+
continue;
|
|
28002
|
+
}
|
|
28003
|
+
try {
|
|
28004
|
+
const libraries = instance.getUIComponentsLibraries();
|
|
28005
|
+
if (typeof libraries !== "object" || libraries === null || Array.isArray(libraries)) {
|
|
28006
|
+
logger.error(`[Extensions] Extension '${metadata.name}' getUIComponentsLibraries() did not return a Record<string, string>`);
|
|
28007
|
+
continue;
|
|
28008
|
+
}
|
|
28009
|
+
const validLibs = {};
|
|
28010
|
+
for (const [key, spec] of Object.entries(libraries)) {
|
|
28011
|
+
if (typeof key === "string" && typeof spec === "string") {
|
|
28012
|
+
validLibs[key] = spec;
|
|
28013
|
+
}
|
|
28014
|
+
}
|
|
28015
|
+
if (Object.keys(validLibs).length > 0) {
|
|
28016
|
+
librariesByExtension.set(loaded.id, validLibs);
|
|
28017
|
+
}
|
|
28018
|
+
} catch (error) {
|
|
28019
|
+
logger.error(`[Extensions] Failed to get UI component libraries from extension '${metadata.name}':`, error);
|
|
28020
|
+
}
|
|
28021
|
+
}
|
|
28022
|
+
return librariesByExtension;
|
|
28023
|
+
}
|
|
28024
|
+
async loadExtensionLibrary(librarySpec) {
|
|
28025
|
+
return await this.libraryLoader.loadLibrary(librarySpec);
|
|
28026
|
+
}
|
|
27837
28027
|
/**
|
|
27838
28028
|
* Check if an extension provides a settings config component.
|
|
27839
28029
|
* Uses the dedicated getConfigComponent() method on the Extension interface.
|
|
@@ -29258,15 +29448,20 @@ ${error instanceof Error ? error.message : String(error)}`);
|
|
|
29258
29448
|
const task = taskId && project ? project.getTask(taskId) ?? void 0 : void 0;
|
|
29259
29449
|
const components = this.extensionManager.getUIComponents(project, task);
|
|
29260
29450
|
const filtered = placement ? components.filter((c) => c.component.placement === placement) : components;
|
|
29451
|
+
const librariesByExtension = this.extensionManager.getUIComponentsLibraries(project);
|
|
29261
29452
|
return filtered.map((c) => ({
|
|
29262
29453
|
extensionId: c.extensionId,
|
|
29263
29454
|
componentId: c.component.id,
|
|
29264
29455
|
placement: c.component.placement,
|
|
29265
29456
|
jsx: c.component.jsx,
|
|
29266
29457
|
loadData: c.component.loadData,
|
|
29267
|
-
noDataCache: c.component.noDataCache
|
|
29458
|
+
noDataCache: c.component.noDataCache,
|
|
29459
|
+
libraries: librariesByExtension.get(c.extensionId)
|
|
29268
29460
|
}));
|
|
29269
29461
|
}
|
|
29462
|
+
async loadExtensionLibrary(librarySpec) {
|
|
29463
|
+
return await this.extensionManager.loadExtensionLibrary(librarySpec);
|
|
29464
|
+
}
|
|
29270
29465
|
async getUIExtensionData(extensionId, componentId, projectDir, taskId) {
|
|
29271
29466
|
logger.debug("Getting UI extension data:", {
|
|
29272
29467
|
extensionId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiderdesk/aiderdesk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.68.0",
|
|
4
4
|
"description": "AiderDesk - AI-Powered Development Platform",
|
|
5
5
|
"bin": {
|
|
6
6
|
"aiderdesk": "./bin/aiderdesk.js"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@ai-sdk/mistral": "2.0.30",
|
|
46
46
|
"@ai-sdk/openai": "^2.0.103",
|
|
47
47
|
"@ai-sdk/openai-compatible": "1.0.36",
|
|
48
|
-
"@aiderdesk/extensions": "0.
|
|
48
|
+
"@aiderdesk/extensions": "0.18.0",
|
|
49
49
|
"@augmentcode/auggie-sdk": "0.1.15",
|
|
50
50
|
"@aws-sdk/client-bedrock": "^3.887.0",
|
|
51
51
|
"@aws-sdk/credential-providers": "^3.782.0",
|