@atlasharness/atlascode 0.1.52 → 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 +57 -6
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -85608,7 +85608,7 @@ function findDeferredToolUseState(conversation) {
|
|
|
85608
85608
|
return { toolUseId, toolName, deferReason };
|
|
85609
85609
|
}
|
|
85610
85610
|
async function reEvaluateDeferredToolCalls(params) {
|
|
85611
|
-
const { conversation, toolUseId, tools, toolHooks, checkPermission } = params;
|
|
85611
|
+
const { conversation, toolUseId, tools, toolHooks, checkPermission, signal, toolContext } = params;
|
|
85612
85612
|
let tu;
|
|
85613
85613
|
let assistantMsg;
|
|
85614
85614
|
for (let i = conversation.length - 1;i >= 0; i--) {
|
|
@@ -85646,7 +85646,9 @@ async function reEvaluateDeferredToolCalls(params) {
|
|
|
85646
85646
|
const outcome = await executeToolUse(tu, assistantMsg, {
|
|
85647
85647
|
tools,
|
|
85648
85648
|
hooks: toolHooks,
|
|
85649
|
-
checkPermission
|
|
85649
|
+
checkPermission,
|
|
85650
|
+
signal,
|
|
85651
|
+
toolContext
|
|
85650
85652
|
});
|
|
85651
85653
|
if (outcome.deferred) {
|
|
85652
85654
|
const payload = {
|
|
@@ -85672,6 +85674,51 @@ async function reEvaluateDeferredToolCalls(params) {
|
|
|
85672
85674
|
};
|
|
85673
85675
|
return { suspended: false, messages: [...conversation, resultMsg] };
|
|
85674
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
|
+
}
|
|
85675
85722
|
function resolveHeadlessTpc(tpc) {
|
|
85676
85723
|
if (tpc)
|
|
85677
85724
|
return tpc;
|
|
@@ -85828,7 +85875,8 @@ async function runHeadless(inputPrompt, options) {
|
|
|
85828
85875
|
const loopDeps = {
|
|
85829
85876
|
...bundle.deps,
|
|
85830
85877
|
signal: abortController.signal,
|
|
85831
|
-
checkPermission
|
|
85878
|
+
checkPermission,
|
|
85879
|
+
toolContext: makeCtx()
|
|
85832
85880
|
};
|
|
85833
85881
|
const autoCompact = {
|
|
85834
85882
|
contextWindow: (roleModel ? getProviderContextWindow(roleModel) : undefined) ?? 200000,
|
|
@@ -85965,7 +86013,9 @@ async function runHeadless(inputPrompt, options) {
|
|
|
85965
86013
|
toolUseId: deferredState.toolUseId,
|
|
85966
86014
|
tools,
|
|
85967
86015
|
toolHooks: loopDeps.hooks?.toolHooks,
|
|
85968
|
-
checkPermission
|
|
86016
|
+
checkPermission,
|
|
86017
|
+
signal: loopDeps.signal,
|
|
86018
|
+
toolContext: loopDeps.toolContext
|
|
85969
86019
|
});
|
|
85970
86020
|
conversation = re.messages;
|
|
85971
86021
|
if (loopDeps.transcript) {
|
|
@@ -86116,11 +86166,12 @@ async function loadResumedMessages(options) {
|
|
|
86116
86166
|
return [];
|
|
86117
86167
|
}
|
|
86118
86168
|
const chain = buildConversationChain(loaded.messages, leafMessage);
|
|
86169
|
+
const conversation = recoverDeferredToolUseMarkers(loaded.messages, chain);
|
|
86119
86170
|
await processResumedConversation({
|
|
86120
|
-
messages:
|
|
86171
|
+
messages: conversation,
|
|
86121
86172
|
sessionId: resumedId
|
|
86122
86173
|
}, { forkSession: false, sessionIdOverride: resumedId });
|
|
86123
|
-
return
|
|
86174
|
+
return conversation;
|
|
86124
86175
|
}
|
|
86125
86176
|
var init_print = __esm(() => {
|
|
86126
86177
|
init_engine();
|
package/package.json
CHANGED