@atlasharness/atlascode 0.1.53 → 0.1.54
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/cli.js +48 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -85674,6 +85674,51 @@ async function reEvaluateDeferredToolCalls(params) {
|
|
|
85674
85674
|
};
|
|
85675
85675
|
return { suspended: false, messages: [...conversation, resultMsg] };
|
|
85676
85676
|
}
|
|
85677
|
+
function recoverDeferredToolUseMarkers(messages, chain) {
|
|
85678
|
+
const chainUuids = new Set;
|
|
85679
|
+
for (const m of chain)
|
|
85680
|
+
chainUuids.add(m.uuid);
|
|
85681
|
+
const resolvedToolUseIds = new Set;
|
|
85682
|
+
for (const m of messages.values()) {
|
|
85683
|
+
const content = m.message?.content;
|
|
85684
|
+
if (Array.isArray(content)) {
|
|
85685
|
+
for (const b of content) {
|
|
85686
|
+
const rec = b;
|
|
85687
|
+
if (rec?.type === "tool_result" && typeof rec.tool_use_id === "string") {
|
|
85688
|
+
resolvedToolUseIds.add(rec.tool_use_id);
|
|
85689
|
+
}
|
|
85690
|
+
}
|
|
85691
|
+
}
|
|
85692
|
+
}
|
|
85693
|
+
const byParent = new Map;
|
|
85694
|
+
for (const m of messages.values()) {
|
|
85695
|
+
if (m.type !== "system" || m.subtype !== "deferred_tool_use")
|
|
85696
|
+
continue;
|
|
85697
|
+
if (chainUuids.has(m.uuid))
|
|
85698
|
+
continue;
|
|
85699
|
+
const pu = m.parentUuid;
|
|
85700
|
+
if (!pu || !chainUuids.has(pu))
|
|
85701
|
+
continue;
|
|
85702
|
+
if (typeof m.tool_use_id === "string" && resolvedToolUseIds.has(m.tool_use_id))
|
|
85703
|
+
continue;
|
|
85704
|
+
const arr = byParent.get(pu);
|
|
85705
|
+
if (arr)
|
|
85706
|
+
arr.push(m);
|
|
85707
|
+
else
|
|
85708
|
+
byParent.set(pu, [m]);
|
|
85709
|
+
}
|
|
85710
|
+
if (byParent.size === 0)
|
|
85711
|
+
return chain;
|
|
85712
|
+
const out = [];
|
|
85713
|
+
for (const m of chain) {
|
|
85714
|
+
out.push(m);
|
|
85715
|
+
const kids = byParent.get(m.uuid);
|
|
85716
|
+
if (kids)
|
|
85717
|
+
for (const k of kids)
|
|
85718
|
+
out.push(k);
|
|
85719
|
+
}
|
|
85720
|
+
return out;
|
|
85721
|
+
}
|
|
85677
85722
|
function resolveHeadlessTpc(tpc) {
|
|
85678
85723
|
if (tpc)
|
|
85679
85724
|
return tpc;
|
|
@@ -86121,11 +86166,12 @@ async function loadResumedMessages(options) {
|
|
|
86121
86166
|
return [];
|
|
86122
86167
|
}
|
|
86123
86168
|
const chain = buildConversationChain(loaded.messages, leafMessage);
|
|
86169
|
+
const conversation = recoverDeferredToolUseMarkers(loaded.messages, chain);
|
|
86124
86170
|
await processResumedConversation({
|
|
86125
|
-
messages:
|
|
86171
|
+
messages: conversation,
|
|
86126
86172
|
sessionId: resumedId
|
|
86127
86173
|
}, { forkSession: false, sessionIdOverride: resumedId });
|
|
86128
|
-
return
|
|
86174
|
+
return conversation;
|
|
86129
86175
|
}
|
|
86130
86176
|
var init_print = __esm(() => {
|
|
86131
86177
|
init_engine();
|
package/package.json
CHANGED