@poncho-ai/cli 0.20.1 → 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 +12 -0
- package/dist/{chunk-J4OZUXG5.js → chunk-F4SLLHSH.js} +71 -41
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{run-interactive-ink-S3D42QQY.js → run-interactive-ink-JJDTHPM5.js} +1 -1
- package/package.json +3 -3
- package/src/index.ts +51 -39
- package/src/web-ui-client.ts +19 -1
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-
|
|
12
|
-
[32mESM[39m [1mdist/chunk-J4OZUXG5.js [22m[32m383.23 KB[39m
|
|
11
|
+
[32mESM[39m [1mdist/run-interactive-ink-JJDTHPM5.js [22m[32m55.30 KB[39m
|
|
13
12
|
[32mESM[39m [1mdist/index.js [22m[32m857.00 B[39m
|
|
14
|
-
[32mESM[39m
|
|
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,17 @@
|
|
|
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
|
+
|
|
9
|
+
## 0.20.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`dcb1b51`](https://github.com/cesr/poncho-ai/commit/dcb1b51ed3be9147c982ed75e3784de38e77bc2f) Thanks [@cesr](https://github.com/cesr)! - Fix polling fallback wiping approval buttons: hydrate pending approvals on each poll cycle so the approve/deny UI stays visible.
|
|
14
|
+
|
|
3
15
|
## 0.20.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -2567,7 +2567,25 @@ var getWebUiClientScript = (markedSource2) => `
|
|
|
2567
2567
|
var payload = await api("/api/conversations/" + encodeURIComponent(conversationId));
|
|
2568
2568
|
if (state.activeConversationId !== conversationId) return;
|
|
2569
2569
|
if (payload.conversation) {
|
|
2570
|
-
|
|
2570
|
+
var allPending = [].concat(
|
|
2571
|
+
payload.conversation.pendingApprovals || [],
|
|
2572
|
+
);
|
|
2573
|
+
if (Array.isArray(payload.subagentPendingApprovals)) {
|
|
2574
|
+
payload.subagentPendingApprovals.forEach(function(sa) {
|
|
2575
|
+
var subIdShort = sa.subagentId && sa.subagentId.length > 12 ? sa.subagentId.slice(0, 12) + "..." : (sa.subagentId || "");
|
|
2576
|
+
allPending.push({
|
|
2577
|
+
approvalId: sa.approvalId,
|
|
2578
|
+
tool: sa.tool,
|
|
2579
|
+
input: sa.input,
|
|
2580
|
+
_subagentId: sa.subagentId,
|
|
2581
|
+
_subagentLabel: "subagent " + subIdShort,
|
|
2582
|
+
});
|
|
2583
|
+
});
|
|
2584
|
+
}
|
|
2585
|
+
state.activeMessages = hydratePendingApprovals(
|
|
2586
|
+
payload.conversation.messages || [],
|
|
2587
|
+
allPending,
|
|
2588
|
+
);
|
|
2571
2589
|
renderMessages(state.activeMessages, payload.hasActiveRun);
|
|
2572
2590
|
}
|
|
2573
2591
|
if (payload.hasActiveRun) {
|
|
@@ -8590,48 +8608,60 @@ data: ${JSON.stringify(data)}
|
|
|
8590
8608
|
await conversationStore.update(foundConversation);
|
|
8591
8609
|
const checkpointRef = allApprovals[0];
|
|
8592
8610
|
const resumeWork = (async () => {
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
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
|
+
}
|
|
8632
8660
|
})();
|
|
8633
8661
|
if (waitUntilHook) {
|
|
8634
8662
|
waitUntilHook(resumeWork);
|
|
8663
|
+
} else {
|
|
8664
|
+
await resumeWork;
|
|
8635
8665
|
}
|
|
8636
8666
|
writeJson(response, 200, { ok: true, approvalId, approved, batchComplete: true });
|
|
8637
8667
|
return;
|
|
@@ -9661,7 +9691,7 @@ var runInteractive = async (workingDir, params) => {
|
|
|
9661
9691
|
await harness.initialize();
|
|
9662
9692
|
const identity = await ensureAgentIdentity2(workingDir);
|
|
9663
9693
|
try {
|
|
9664
|
-
const { runInteractiveInk } = await import("./run-interactive-ink-
|
|
9694
|
+
const { runInteractiveInk } = await import("./run-interactive-ink-JJDTHPM5.js");
|
|
9665
9695
|
await runInteractiveInk({
|
|
9666
9696
|
harness,
|
|
9667
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 });
|
package/src/web-ui-client.ts
CHANGED
|
@@ -1036,7 +1036,25 @@ export const getWebUiClientScript = (markedSource: string): string => `
|
|
|
1036
1036
|
var payload = await api("/api/conversations/" + encodeURIComponent(conversationId));
|
|
1037
1037
|
if (state.activeConversationId !== conversationId) return;
|
|
1038
1038
|
if (payload.conversation) {
|
|
1039
|
-
|
|
1039
|
+
var allPending = [].concat(
|
|
1040
|
+
payload.conversation.pendingApprovals || [],
|
|
1041
|
+
);
|
|
1042
|
+
if (Array.isArray(payload.subagentPendingApprovals)) {
|
|
1043
|
+
payload.subagentPendingApprovals.forEach(function(sa) {
|
|
1044
|
+
var subIdShort = sa.subagentId && sa.subagentId.length > 12 ? sa.subagentId.slice(0, 12) + "..." : (sa.subagentId || "");
|
|
1045
|
+
allPending.push({
|
|
1046
|
+
approvalId: sa.approvalId,
|
|
1047
|
+
tool: sa.tool,
|
|
1048
|
+
input: sa.input,
|
|
1049
|
+
_subagentId: sa.subagentId,
|
|
1050
|
+
_subagentLabel: "subagent " + subIdShort,
|
|
1051
|
+
});
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
state.activeMessages = hydratePendingApprovals(
|
|
1055
|
+
payload.conversation.messages || [],
|
|
1056
|
+
allPending,
|
|
1057
|
+
);
|
|
1040
1058
|
renderMessages(state.activeMessages, payload.hasActiveRun);
|
|
1041
1059
|
}
|
|
1042
1060
|
if (payload.hasActiveRun) {
|