@poncho-ai/cli 0.20.2 → 0.21.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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +12 -0
- package/dist/{chunk-VRLHV23J.js → chunk-54WK2ATG.js} +59 -42
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{run-interactive-ink-2YFB7AEJ.js → run-interactive-ink-H55INI7H.js} +1 -1
- package/package.json +2 -2
- package/src/index.ts +58 -39
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @poncho-ai/cli@0.
|
|
2
|
+
> @poncho-ai/cli@0.21.0 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
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[32mESM[39m [1mdist/cli.js [22m[32m94.00 B[39m
|
|
11
11
|
[32mESM[39m [1mdist/index.js [22m[32m857.00 B[39m
|
|
12
|
-
[32mESM[39m [1mdist/run-interactive-ink-
|
|
13
|
-
[32mESM[39m [1mdist/chunk-
|
|
14
|
-
[32mESM[39m ⚡️ Build success in
|
|
12
|
+
[32mESM[39m [1mdist/run-interactive-ink-H55INI7H.js [22m[32m55.30 KB[39m
|
|
13
|
+
[32mESM[39m [1mdist/chunk-54WK2ATG.js [22m[32m384.68 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 57ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 3701ms
|
|
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.21.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c5d94c5`](https://github.com/cesr/poncho-ai/commit/c5d94c5854081ac23e91f7104047354ad1a415ef) Thanks [@cesr](https://github.com/cesr)! - Automatically add `@vercel/functions` to project dependencies when running `poncho build vercel`. This ensures `waitUntil` is available for keeping serverless functions alive during webhook processing and approval resume.
|
|
8
|
+
|
|
9
|
+
## 0.20.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`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.
|
|
14
|
+
|
|
3
15
|
## 0.20.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -6862,7 +6862,7 @@ var UPLOAD_PROVIDER_DEPS = {
|
|
|
6862
6862
|
{ name: "@aws-sdk/s3-request-presigner", fallback: "^3.700.0" }
|
|
6863
6863
|
]
|
|
6864
6864
|
};
|
|
6865
|
-
var ensureRuntimeCliDependency = async (projectDir, cliVersion, config) => {
|
|
6865
|
+
var ensureRuntimeCliDependency = async (projectDir, cliVersion, config, target) => {
|
|
6866
6866
|
const packageJsonPath = resolve3(projectDir, "package.json");
|
|
6867
6867
|
const content = await readFile3(packageJsonPath, "utf8");
|
|
6868
6868
|
const parsed = JSON.parse(content);
|
|
@@ -6886,6 +6886,10 @@ var ensureRuntimeCliDependency = async (projectDir, cliVersion, config) => {
|
|
|
6886
6886
|
}
|
|
6887
6887
|
}
|
|
6888
6888
|
}
|
|
6889
|
+
if (target === "vercel" && !dependencies["@vercel/functions"]) {
|
|
6890
|
+
dependencies["@vercel/functions"] = "^1.0.0";
|
|
6891
|
+
addedDeps.push("@vercel/functions");
|
|
6892
|
+
}
|
|
6889
6893
|
parsed.dependencies = dependencies;
|
|
6890
6894
|
await writeFile3(packageJsonPath, `${JSON.stringify(parsed, null, 2)}
|
|
6891
6895
|
`, "utf8");
|
|
@@ -7094,7 +7098,8 @@ CMD ["node","server.js"]
|
|
|
7094
7098
|
const { paths: packagePaths, addedDeps } = await ensureRuntimeCliDependency(
|
|
7095
7099
|
projectDir,
|
|
7096
7100
|
cliVersion,
|
|
7097
|
-
config
|
|
7101
|
+
config,
|
|
7102
|
+
target
|
|
7098
7103
|
);
|
|
7099
7104
|
const depNote = addedDeps.length > 0 ? ` (added ${addedDeps.join(", ")})` : "";
|
|
7100
7105
|
for (const p of packagePaths) {
|
|
@@ -8608,48 +8613,60 @@ data: ${JSON.stringify(data)}
|
|
|
8608
8613
|
await conversationStore.update(foundConversation);
|
|
8609
8614
|
const checkpointRef = allApprovals[0];
|
|
8610
8615
|
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
|
-
|
|
8616
|
+
try {
|
|
8617
|
+
const toolContext = {
|
|
8618
|
+
runId: checkpointRef.runId,
|
|
8619
|
+
agentId: identity.id,
|
|
8620
|
+
step: 0,
|
|
8621
|
+
workingDir,
|
|
8622
|
+
parameters: {}
|
|
8623
|
+
};
|
|
8624
|
+
const approvalToolCallIds = new Set(allApprovals.map((a) => a.toolCallId));
|
|
8625
|
+
const callsToExecute = [];
|
|
8626
|
+
const deniedResults = [];
|
|
8627
|
+
for (const a of allApprovals) {
|
|
8628
|
+
if (a.decision === "approved" && a.toolCallId) {
|
|
8629
|
+
callsToExecute.push({ id: a.toolCallId, name: a.tool, input: a.input });
|
|
8630
|
+
} else if (a.decision === "denied" && a.toolCallId) {
|
|
8631
|
+
deniedResults.push({ callId: a.toolCallId, toolName: a.tool, error: "Tool execution denied by user" });
|
|
8632
|
+
}
|
|
8633
|
+
}
|
|
8634
|
+
const pendingToolCalls = checkpointRef.pendingToolCalls ?? [];
|
|
8635
|
+
for (const tc of pendingToolCalls) {
|
|
8636
|
+
if (!approvalToolCallIds.has(tc.id)) {
|
|
8637
|
+
callsToExecute.push(tc);
|
|
8638
|
+
}
|
|
8639
|
+
}
|
|
8640
|
+
let toolResults = [...deniedResults];
|
|
8641
|
+
if (callsToExecute.length > 0) {
|
|
8642
|
+
const execResults = await harness.executeTools(callsToExecute, toolContext);
|
|
8643
|
+
toolResults.push(...execResults.map((r) => ({
|
|
8644
|
+
callId: r.callId,
|
|
8645
|
+
toolName: r.tool,
|
|
8646
|
+
result: r.output,
|
|
8647
|
+
error: r.error
|
|
8648
|
+
})));
|
|
8649
|
+
}
|
|
8650
|
+
await resumeRunFromCheckpoint(
|
|
8651
|
+
conversationId,
|
|
8652
|
+
foundConversation,
|
|
8653
|
+
checkpointRef,
|
|
8654
|
+
toolResults
|
|
8655
|
+
);
|
|
8656
|
+
} catch (err) {
|
|
8657
|
+
console.error("[approval-resume] failed:", err instanceof Error ? err.message : err);
|
|
8658
|
+
const conv = await conversationStore.get(conversationId);
|
|
8659
|
+
if (conv) {
|
|
8660
|
+
conv.runStatus = "idle";
|
|
8661
|
+
conv.updatedAt = Date.now();
|
|
8662
|
+
await conversationStore.update(conv);
|
|
8663
|
+
}
|
|
8664
|
+
}
|
|
8650
8665
|
})();
|
|
8651
8666
|
if (waitUntilHook) {
|
|
8652
8667
|
waitUntilHook(resumeWork);
|
|
8668
|
+
} else {
|
|
8669
|
+
await resumeWork;
|
|
8653
8670
|
}
|
|
8654
8671
|
writeJson(response, 200, { ok: true, approvalId, approved, batchComplete: true });
|
|
8655
8672
|
return;
|
|
@@ -9679,7 +9696,7 @@ var runInteractive = async (workingDir, params) => {
|
|
|
9679
9696
|
await harness.initialize();
|
|
9680
9697
|
const identity = await ensureAgentIdentity2(workingDir);
|
|
9681
9698
|
try {
|
|
9682
|
-
const { runInteractiveInk } = await import("./run-interactive-ink-
|
|
9699
|
+
const { runInteractiveInk } = await import("./run-interactive-ink-H55INI7H.js");
|
|
9683
9700
|
await runInteractiveInk({
|
|
9684
9701
|
harness,
|
|
9685
9702
|
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.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "CLI for building and deploying AI agents",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"react": "^19.2.4",
|
|
28
28
|
"react-devtools-core": "^6.1.5",
|
|
29
29
|
"yaml": "^2.8.1",
|
|
30
|
-
"@poncho-ai/harness": "0.20.0",
|
|
31
30
|
"@poncho-ai/messaging": "0.2.7",
|
|
31
|
+
"@poncho-ai/harness": "0.20.0",
|
|
32
32
|
"@poncho-ai/sdk": "1.4.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
package/src/index.ts
CHANGED
|
@@ -889,6 +889,7 @@ const ensureRuntimeCliDependency = async (
|
|
|
889
889
|
projectDir: string,
|
|
890
890
|
cliVersion: string,
|
|
891
891
|
config?: PonchoConfig,
|
|
892
|
+
target?: string,
|
|
892
893
|
): Promise<{ paths: string[]; addedDeps: string[] }> => {
|
|
893
894
|
const packageJsonPath = resolve(projectDir, "package.json");
|
|
894
895
|
const content = await readFile(packageJsonPath, "utf8");
|
|
@@ -922,6 +923,11 @@ const ensureRuntimeCliDependency = async (
|
|
|
922
923
|
}
|
|
923
924
|
}
|
|
924
925
|
|
|
926
|
+
if (target === "vercel" && !dependencies["@vercel/functions"]) {
|
|
927
|
+
dependencies["@vercel/functions"] = "^1.0.0";
|
|
928
|
+
addedDeps.push("@vercel/functions");
|
|
929
|
+
}
|
|
930
|
+
|
|
925
931
|
parsed.dependencies = dependencies;
|
|
926
932
|
await writeFile(packageJsonPath, `${JSON.stringify(parsed, null, 2)}\n`, "utf8");
|
|
927
933
|
return { paths: [relative(projectDir, packageJsonPath)], addedDeps };
|
|
@@ -1137,6 +1143,7 @@ CMD ["node","server.js"]
|
|
|
1137
1143
|
projectDir,
|
|
1138
1144
|
cliVersion,
|
|
1139
1145
|
config,
|
|
1146
|
+
target,
|
|
1140
1147
|
);
|
|
1141
1148
|
const depNote = addedDeps.length > 0 ? ` (added ${addedDeps.join(", ")})` : "";
|
|
1142
1149
|
for (const p of packagePaths) {
|
|
@@ -2909,55 +2916,67 @@ export const createRequestHandler = async (options?: {
|
|
|
2909
2916
|
const checkpointRef = allApprovals[0]!;
|
|
2910
2917
|
|
|
2911
2918
|
const resumeWork = (async () => {
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
+
try {
|
|
2920
|
+
const toolContext = {
|
|
2921
|
+
runId: checkpointRef.runId,
|
|
2922
|
+
agentId: identity.id,
|
|
2923
|
+
step: 0,
|
|
2924
|
+
workingDir,
|
|
2925
|
+
parameters: {},
|
|
2926
|
+
};
|
|
2919
2927
|
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2928
|
+
// Collect tool calls to execute: approved approval-gated tools + auto-approved deferred tools
|
|
2929
|
+
const approvalToolCallIds = new Set(allApprovals.map(a => a.toolCallId));
|
|
2930
|
+
const callsToExecute: Array<{ id: string; name: string; input: Record<string, unknown> }> = [];
|
|
2931
|
+
const deniedResults: Array<{ callId: string; toolName: string; error: string }> = [];
|
|
2924
2932
|
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2933
|
+
for (const a of allApprovals) {
|
|
2934
|
+
if (a.decision === "approved" && a.toolCallId) {
|
|
2935
|
+
callsToExecute.push({ id: a.toolCallId, name: a.tool, input: a.input });
|
|
2936
|
+
} else if (a.decision === "denied" && a.toolCallId) {
|
|
2937
|
+
deniedResults.push({ callId: a.toolCallId, toolName: a.tool, error: "Tool execution denied by user" });
|
|
2938
|
+
}
|
|
2930
2939
|
}
|
|
2931
|
-
}
|
|
2932
2940
|
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2941
|
+
// Auto-approved tools that were deferred alongside the approval-needing ones
|
|
2942
|
+
const pendingToolCalls = checkpointRef.pendingToolCalls ?? [];
|
|
2943
|
+
for (const tc of pendingToolCalls) {
|
|
2944
|
+
if (!approvalToolCallIds.has(tc.id)) {
|
|
2945
|
+
callsToExecute.push(tc);
|
|
2946
|
+
}
|
|
2938
2947
|
}
|
|
2939
|
-
}
|
|
2940
2948
|
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2949
|
+
let toolResults: Array<{ callId: string; toolName: string; result?: unknown; error?: string }> = [...deniedResults];
|
|
2950
|
+
if (callsToExecute.length > 0) {
|
|
2951
|
+
const execResults = await harness.executeTools(callsToExecute, toolContext);
|
|
2952
|
+
toolResults.push(...execResults.map(r => ({
|
|
2953
|
+
callId: r.callId,
|
|
2954
|
+
toolName: r.tool,
|
|
2955
|
+
result: r.output,
|
|
2956
|
+
error: r.error,
|
|
2957
|
+
})));
|
|
2958
|
+
}
|
|
2951
2959
|
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2960
|
+
await resumeRunFromCheckpoint(
|
|
2961
|
+
conversationId,
|
|
2962
|
+
foundConversation!,
|
|
2963
|
+
checkpointRef,
|
|
2964
|
+
toolResults,
|
|
2965
|
+
);
|
|
2966
|
+
} catch (err) {
|
|
2967
|
+
console.error("[approval-resume] failed:", err instanceof Error ? err.message : err);
|
|
2968
|
+
const conv = await conversationStore.get(conversationId);
|
|
2969
|
+
if (conv) {
|
|
2970
|
+
conv.runStatus = "idle";
|
|
2971
|
+
conv.updatedAt = Date.now();
|
|
2972
|
+
await conversationStore.update(conv);
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2958
2975
|
})();
|
|
2959
2976
|
if (waitUntilHook) {
|
|
2960
2977
|
waitUntilHook(resumeWork);
|
|
2978
|
+
} else {
|
|
2979
|
+
await resumeWork;
|
|
2961
2980
|
}
|
|
2962
2981
|
|
|
2963
2982
|
writeJson(response, 200, { ok: true, approvalId, approved, batchComplete: true });
|