@poncho-ai/cli 0.20.2 → 0.20.3
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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +6 -0
- package/dist/{chunk-VRLHV23J.js → chunk-F4SLLHSH.js} +52 -40
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{run-interactive-ink-2YFB7AEJ.js → run-interactive-ink-JJDTHPM5.js} +1 -1
- package/package.json +3 -3
- package/src/index.ts +51 -39
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @poncho-ai/cli@0.20.
|
|
2
|
+
> @poncho-ai/cli@0.20.3 build /home/runner/work/poncho-ai/poncho-ai/packages/cli
|
|
3
3
|
> tsup src/index.ts src/cli.ts --format esm --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/cli.ts, src/index.ts
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
[34mCLI[39m Target: es2022
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[32mESM[39m [1mdist/cli.js [22m[32m94.00 B[39m
|
|
11
|
+
[32mESM[39m [1mdist/run-interactive-ink-JJDTHPM5.js [22m[32m55.30 KB[39m
|
|
11
12
|
[32mESM[39m [1mdist/index.js [22m[32m857.00 B[39m
|
|
12
|
-
[32mESM[39m [1mdist/
|
|
13
|
-
[32mESM[39m
|
|
14
|
-
[32mESM[39m ⚡️ Build success in 62ms
|
|
13
|
+
[32mESM[39m [1mdist/chunk-F4SLLHSH.js [22m[32m384.50 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 50ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 3455ms
|
|
17
17
|
[32mDTS[39m [1mdist/cli.d.ts [22m[32m20.00 B[39m
|
|
18
18
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.59 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @poncho-ai/cli
|
|
2
2
|
|
|
3
|
+
## 0.20.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9b38474`](https://github.com/cesr/poncho-ai/commit/9b38474a25bfb54cec108d1d3eae664aaed37ccf) Thanks [@cesr](https://github.com/cesr)! - Make approval resume robust: wrap in try/catch to always clear runStatus, and await the work when waitUntil is unavailable so the resume completes before the response is sent.
|
|
8
|
+
|
|
3
9
|
## 0.20.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -8608,48 +8608,60 @@ data: ${JSON.stringify(data)}
|
|
|
8608
8608
|
await conversationStore.update(foundConversation);
|
|
8609
8609
|
const checkpointRef = allApprovals[0];
|
|
8610
8610
|
const resumeWork = (async () => {
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8611
|
+
try {
|
|
8612
|
+
const toolContext = {
|
|
8613
|
+
runId: checkpointRef.runId,
|
|
8614
|
+
agentId: identity.id,
|
|
8615
|
+
step: 0,
|
|
8616
|
+
workingDir,
|
|
8617
|
+
parameters: {}
|
|
8618
|
+
};
|
|
8619
|
+
const approvalToolCallIds = new Set(allApprovals.map((a) => a.toolCallId));
|
|
8620
|
+
const callsToExecute = [];
|
|
8621
|
+
const deniedResults = [];
|
|
8622
|
+
for (const a of allApprovals) {
|
|
8623
|
+
if (a.decision === "approved" && a.toolCallId) {
|
|
8624
|
+
callsToExecute.push({ id: a.toolCallId, name: a.tool, input: a.input });
|
|
8625
|
+
} else if (a.decision === "denied" && a.toolCallId) {
|
|
8626
|
+
deniedResults.push({ callId: a.toolCallId, toolName: a.tool, error: "Tool execution denied by user" });
|
|
8627
|
+
}
|
|
8628
|
+
}
|
|
8629
|
+
const pendingToolCalls = checkpointRef.pendingToolCalls ?? [];
|
|
8630
|
+
for (const tc of pendingToolCalls) {
|
|
8631
|
+
if (!approvalToolCallIds.has(tc.id)) {
|
|
8632
|
+
callsToExecute.push(tc);
|
|
8633
|
+
}
|
|
8634
|
+
}
|
|
8635
|
+
let toolResults = [...deniedResults];
|
|
8636
|
+
if (callsToExecute.length > 0) {
|
|
8637
|
+
const execResults = await harness.executeTools(callsToExecute, toolContext);
|
|
8638
|
+
toolResults.push(...execResults.map((r) => ({
|
|
8639
|
+
callId: r.callId,
|
|
8640
|
+
toolName: r.tool,
|
|
8641
|
+
result: r.output,
|
|
8642
|
+
error: r.error
|
|
8643
|
+
})));
|
|
8644
|
+
}
|
|
8645
|
+
await resumeRunFromCheckpoint(
|
|
8646
|
+
conversationId,
|
|
8647
|
+
foundConversation,
|
|
8648
|
+
checkpointRef,
|
|
8649
|
+
toolResults
|
|
8650
|
+
);
|
|
8651
|
+
} catch (err) {
|
|
8652
|
+
console.error("[approval-resume] failed:", err instanceof Error ? err.message : err);
|
|
8653
|
+
const conv = await conversationStore.get(conversationId);
|
|
8654
|
+
if (conv) {
|
|
8655
|
+
conv.runStatus = "idle";
|
|
8656
|
+
conv.updatedAt = Date.now();
|
|
8657
|
+
await conversationStore.update(conv);
|
|
8658
|
+
}
|
|
8659
|
+
}
|
|
8650
8660
|
})();
|
|
8651
8661
|
if (waitUntilHook) {
|
|
8652
8662
|
waitUntilHook(resumeWork);
|
|
8663
|
+
} else {
|
|
8664
|
+
await resumeWork;
|
|
8653
8665
|
}
|
|
8654
8666
|
writeJson(response, 200, { ok: true, approvalId, approved, batchComplete: true });
|
|
8655
8667
|
return;
|
|
@@ -9679,7 +9691,7 @@ var runInteractive = async (workingDir, params) => {
|
|
|
9679
9691
|
await harness.initialize();
|
|
9680
9692
|
const identity = await ensureAgentIdentity2(workingDir);
|
|
9681
9693
|
try {
|
|
9682
|
-
const { runInteractiveInk } = await import("./run-interactive-ink-
|
|
9694
|
+
const { runInteractiveInk } = await import("./run-interactive-ink-JJDTHPM5.js");
|
|
9683
9695
|
await runInteractiveInk({
|
|
9684
9696
|
harness,
|
|
9685
9697
|
params,
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poncho-ai/cli",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.3",
|
|
4
4
|
"description": "CLI for building and deploying AI agents",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"react": "^19.2.4",
|
|
28
28
|
"react-devtools-core": "^6.1.5",
|
|
29
29
|
"yaml": "^2.8.1",
|
|
30
|
-
"@poncho-ai/
|
|
30
|
+
"@poncho-ai/sdk": "1.4.0",
|
|
31
31
|
"@poncho-ai/messaging": "0.2.7",
|
|
32
|
-
"@poncho-ai/
|
|
32
|
+
"@poncho-ai/harness": "0.20.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/busboy": "^1.5.4",
|
package/src/index.ts
CHANGED
|
@@ -2909,55 +2909,67 @@ export const createRequestHandler = async (options?: {
|
|
|
2909
2909
|
const checkpointRef = allApprovals[0]!;
|
|
2910
2910
|
|
|
2911
2911
|
const resumeWork = (async () => {
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2912
|
+
try {
|
|
2913
|
+
const toolContext = {
|
|
2914
|
+
runId: checkpointRef.runId,
|
|
2915
|
+
agentId: identity.id,
|
|
2916
|
+
step: 0,
|
|
2917
|
+
workingDir,
|
|
2918
|
+
parameters: {},
|
|
2919
|
+
};
|
|
2919
2920
|
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2921
|
+
// Collect tool calls to execute: approved approval-gated tools + auto-approved deferred tools
|
|
2922
|
+
const approvalToolCallIds = new Set(allApprovals.map(a => a.toolCallId));
|
|
2923
|
+
const callsToExecute: Array<{ id: string; name: string; input: Record<string, unknown> }> = [];
|
|
2924
|
+
const deniedResults: Array<{ callId: string; toolName: string; error: string }> = [];
|
|
2924
2925
|
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2926
|
+
for (const a of allApprovals) {
|
|
2927
|
+
if (a.decision === "approved" && a.toolCallId) {
|
|
2928
|
+
callsToExecute.push({ id: a.toolCallId, name: a.tool, input: a.input });
|
|
2929
|
+
} else if (a.decision === "denied" && a.toolCallId) {
|
|
2930
|
+
deniedResults.push({ callId: a.toolCallId, toolName: a.tool, error: "Tool execution denied by user" });
|
|
2931
|
+
}
|
|
2930
2932
|
}
|
|
2931
|
-
}
|
|
2932
2933
|
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2934
|
+
// Auto-approved tools that were deferred alongside the approval-needing ones
|
|
2935
|
+
const pendingToolCalls = checkpointRef.pendingToolCalls ?? [];
|
|
2936
|
+
for (const tc of pendingToolCalls) {
|
|
2937
|
+
if (!approvalToolCallIds.has(tc.id)) {
|
|
2938
|
+
callsToExecute.push(tc);
|
|
2939
|
+
}
|
|
2938
2940
|
}
|
|
2939
|
-
}
|
|
2940
2941
|
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2942
|
+
let toolResults: Array<{ callId: string; toolName: string; result?: unknown; error?: string }> = [...deniedResults];
|
|
2943
|
+
if (callsToExecute.length > 0) {
|
|
2944
|
+
const execResults = await harness.executeTools(callsToExecute, toolContext);
|
|
2945
|
+
toolResults.push(...execResults.map(r => ({
|
|
2946
|
+
callId: r.callId,
|
|
2947
|
+
toolName: r.tool,
|
|
2948
|
+
result: r.output,
|
|
2949
|
+
error: r.error,
|
|
2950
|
+
})));
|
|
2951
|
+
}
|
|
2951
2952
|
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2953
|
+
await resumeRunFromCheckpoint(
|
|
2954
|
+
conversationId,
|
|
2955
|
+
foundConversation!,
|
|
2956
|
+
checkpointRef,
|
|
2957
|
+
toolResults,
|
|
2958
|
+
);
|
|
2959
|
+
} catch (err) {
|
|
2960
|
+
console.error("[approval-resume] failed:", err instanceof Error ? err.message : err);
|
|
2961
|
+
const conv = await conversationStore.get(conversationId);
|
|
2962
|
+
if (conv) {
|
|
2963
|
+
conv.runStatus = "idle";
|
|
2964
|
+
conv.updatedAt = Date.now();
|
|
2965
|
+
await conversationStore.update(conv);
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2958
2968
|
})();
|
|
2959
2969
|
if (waitUntilHook) {
|
|
2960
2970
|
waitUntilHook(resumeWork);
|
|
2971
|
+
} else {
|
|
2972
|
+
await resumeWork;
|
|
2961
2973
|
}
|
|
2962
2974
|
|
|
2963
2975
|
writeJson(response, 200, { ok: true, approvalId, approved, batchComplete: true });
|