@wrongstack/acp 1.1.0 → 1.1.2
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/client.js +13 -6
- package/dist/index.js +13 -6
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -966,6 +966,10 @@ async function handleAcpFsRequest(msg, fileServer, permissionPolicy, sender, cal
|
|
|
966
966
|
return;
|
|
967
967
|
}
|
|
968
968
|
if (msg.method === "fs/write_text_file") {
|
|
969
|
+
if (typeof params.content !== "string") {
|
|
970
|
+
await sender.sendErrorResponse(id, -32602, "content must be a string");
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
969
973
|
const authorization = await authorizeAcpCallback(
|
|
970
974
|
permissionPolicy,
|
|
971
975
|
{
|
|
@@ -999,7 +1003,7 @@ async function handleAcpFsRequest(msg, fileServer, permissionPolicy, sender, cal
|
|
|
999
1003
|
await fileServer.writeTextFile({
|
|
1000
1004
|
sessionId: params.sessionId ?? "",
|
|
1001
1005
|
path: params.path,
|
|
1002
|
-
content: params.content
|
|
1006
|
+
content: params.content
|
|
1003
1007
|
});
|
|
1004
1008
|
await sender.sendResult(id, {});
|
|
1005
1009
|
}
|
|
@@ -1016,17 +1020,22 @@ async function handleAcpTerminalRequest(msg, terminalServer, permissionPolicy, s
|
|
|
1016
1020
|
try {
|
|
1017
1021
|
switch (msg.method) {
|
|
1018
1022
|
case "terminal/create": {
|
|
1023
|
+
const env = Array.isArray(params.env) ? params.env.filter(
|
|
1024
|
+
(entry) => !!entry && typeof entry.name === "string" && typeof entry.value === "string"
|
|
1025
|
+
) : [];
|
|
1026
|
+
const envSuffix = env.length > 0 ? ` (env: ${env.map((e) => `${e.name}=${e.value}`).join(" ")})` : "";
|
|
1019
1027
|
const authorization = await authorizeAcpCallback(
|
|
1020
1028
|
permissionPolicy,
|
|
1021
1029
|
{
|
|
1022
1030
|
toolCallId: `acp-terminal-create-${id}`,
|
|
1023
|
-
title: `Run command: ${String(params.command ?? "")} ${(Array.isArray(params.args) ? params.args : []).join(" ")}`.trim(),
|
|
1031
|
+
title: `Run command: ${String(params.command ?? "")} ${(Array.isArray(params.args) ? params.args : []).join(" ")}`.trim() + envSuffix,
|
|
1024
1032
|
kind: "execute",
|
|
1025
1033
|
rawInput: {
|
|
1026
1034
|
command: params.command,
|
|
1027
1035
|
args: params.args,
|
|
1028
1036
|
cwd: params.cwd,
|
|
1029
|
-
sessionId: params.sessionId
|
|
1037
|
+
sessionId: params.sessionId,
|
|
1038
|
+
...env.length > 0 ? { env } : {}
|
|
1030
1039
|
}
|
|
1031
1040
|
},
|
|
1032
1041
|
callbackOptions2
|
|
@@ -1045,9 +1054,7 @@ async function handleAcpTerminalRequest(msg, terminalServer, permissionPolicy, s
|
|
|
1045
1054
|
command: String(params.command ?? ""),
|
|
1046
1055
|
args: Array.isArray(params.args) ? params.args : []
|
|
1047
1056
|
};
|
|
1048
|
-
if (
|
|
1049
|
-
createOpts.env = params.env;
|
|
1050
|
-
}
|
|
1057
|
+
if (env.length > 0) createOpts.env = env;
|
|
1051
1058
|
if (typeof params.cwd === "string") {
|
|
1052
1059
|
createOpts.cwd = params.cwd;
|
|
1053
1060
|
}
|
package/dist/index.js
CHANGED
|
@@ -2517,6 +2517,10 @@ async function handleAcpFsRequest(msg, fileServer, permissionPolicy, sender, cal
|
|
|
2517
2517
|
return;
|
|
2518
2518
|
}
|
|
2519
2519
|
if (msg.method === "fs/write_text_file") {
|
|
2520
|
+
if (typeof params.content !== "string") {
|
|
2521
|
+
await sender.sendErrorResponse(id, -32602, "content must be a string");
|
|
2522
|
+
return;
|
|
2523
|
+
}
|
|
2520
2524
|
const authorization = await authorizeAcpCallback(
|
|
2521
2525
|
permissionPolicy,
|
|
2522
2526
|
{
|
|
@@ -2550,7 +2554,7 @@ async function handleAcpFsRequest(msg, fileServer, permissionPolicy, sender, cal
|
|
|
2550
2554
|
await fileServer.writeTextFile({
|
|
2551
2555
|
sessionId: params.sessionId ?? "",
|
|
2552
2556
|
path: params.path,
|
|
2553
|
-
content: params.content
|
|
2557
|
+
content: params.content
|
|
2554
2558
|
});
|
|
2555
2559
|
await sender.sendResult(id, {});
|
|
2556
2560
|
}
|
|
@@ -2567,17 +2571,22 @@ async function handleAcpTerminalRequest(msg, terminalServer, permissionPolicy, s
|
|
|
2567
2571
|
try {
|
|
2568
2572
|
switch (msg.method) {
|
|
2569
2573
|
case "terminal/create": {
|
|
2574
|
+
const env = Array.isArray(params.env) ? params.env.filter(
|
|
2575
|
+
(entry) => !!entry && typeof entry.name === "string" && typeof entry.value === "string"
|
|
2576
|
+
) : [];
|
|
2577
|
+
const envSuffix = env.length > 0 ? ` (env: ${env.map((e) => `${e.name}=${e.value}`).join(" ")})` : "";
|
|
2570
2578
|
const authorization = await authorizeAcpCallback(
|
|
2571
2579
|
permissionPolicy,
|
|
2572
2580
|
{
|
|
2573
2581
|
toolCallId: `acp-terminal-create-${id}`,
|
|
2574
|
-
title: `Run command: ${String(params.command ?? "")} ${(Array.isArray(params.args) ? params.args : []).join(" ")}`.trim(),
|
|
2582
|
+
title: `Run command: ${String(params.command ?? "")} ${(Array.isArray(params.args) ? params.args : []).join(" ")}`.trim() + envSuffix,
|
|
2575
2583
|
kind: "execute",
|
|
2576
2584
|
rawInput: {
|
|
2577
2585
|
command: params.command,
|
|
2578
2586
|
args: params.args,
|
|
2579
2587
|
cwd: params.cwd,
|
|
2580
|
-
sessionId: params.sessionId
|
|
2588
|
+
sessionId: params.sessionId,
|
|
2589
|
+
...env.length > 0 ? { env } : {}
|
|
2581
2590
|
}
|
|
2582
2591
|
},
|
|
2583
2592
|
callbackOptions2
|
|
@@ -2596,9 +2605,7 @@ async function handleAcpTerminalRequest(msg, terminalServer, permissionPolicy, s
|
|
|
2596
2605
|
command: String(params.command ?? ""),
|
|
2597
2606
|
args: Array.isArray(params.args) ? params.args : []
|
|
2598
2607
|
};
|
|
2599
|
-
if (
|
|
2600
|
-
createOpts.env = params.env;
|
|
2601
|
-
}
|
|
2608
|
+
if (env.length > 0) createOpts.env = env;
|
|
2602
2609
|
if (typeof params.cwd === "string") {
|
|
2603
2610
|
createOpts.cwd = params.cwd;
|
|
2604
2611
|
}
|