@ycodium-ai/agent-acp 0.2.4486 → 0.2.5004

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.
Files changed (2) hide show
  1. package/dist/index.js +58 -7
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ var __export = (target, all) => {
8
8
  import { definePlugin } from "@ycodium-ai/plugin-api";
9
9
 
10
10
  // ../../packages/plugin-api/src/version.ts
11
- var PLUGIN_API_VERSION = 119;
11
+ var PLUGIN_API_VERSION = 142;
12
12
 
13
13
  // src/acpInstance.ts
14
14
  import * as NodeOS3 from "node:os";
@@ -1037,7 +1037,15 @@ function parsePermissionRequest(params, known) {
1037
1037
  { fallbackStatus: "pending" }
1038
1038
  );
1039
1039
  const kind = toolCall?.kind ?? "unknown";
1040
- const detail = toolCall?.command ?? toolCall?.title ?? toolCall?.detail;
1040
+ const content = toolCall?.data["content"];
1041
+ const firstText = Array.isArray(content) ? content.flatMap((entry) => {
1042
+ if (!isRecord2(entry) || entry["type"] !== "content" || !isRecord2(entry["content"]))
1043
+ return [];
1044
+ const block = entry["content"];
1045
+ return block["type"] === "text" && typeof block["text"] === "string" && block["text"].trim() ? [block["text"]] : [];
1046
+ })[0] : void 0;
1047
+ const originalTitle = (request.title ?? known?.rawTitle)?.trim() || void 0;
1048
+ const detail = toolCall?.command ?? firstText ?? originalTitle;
1041
1049
  return {
1042
1050
  kind,
1043
1051
  ...detail ? { detail } : {},
@@ -1278,6 +1286,7 @@ function makeAcpRequestOpenedEvent(input2) {
1278
1286
  ...input2.detail ? { detail: input2.detail } : {},
1279
1287
  ...toolName ? { toolName } : {},
1280
1288
  args: input2.args,
1289
+ ...input2.statement !== void 0 ? { statement: input2.statement } : {},
1281
1290
  ...input2.options ? { options: input2.options } : {},
1282
1291
  ...input2.fileChanges ? { fileChanges: input2.fileChanges } : {},
1283
1292
  declineReasonRelay: "queued"
@@ -26551,6 +26560,38 @@ function createPromptResults({
26551
26560
  return { add, receive, reject, stop, complete, hasInterrupted, forget, wait, finishUnreceived };
26552
26561
  }
26553
26562
 
26563
+ // ../../packages/ycodium-acp-executor/src/permission-statement.ts
26564
+ function defaultPermissionStatement(request) {
26565
+ const rawInput = request.toolCall?.data["rawInput"];
26566
+ const input2 = isRecord2(rawInput) ? rawInput : {};
26567
+ const coveredArgs = [];
26568
+ const text = (name) => {
26569
+ const value = input2[name];
26570
+ if (typeof value !== "string" || value.trim().length === 0) return void 0;
26571
+ coveredArgs.push(name);
26572
+ return value;
26573
+ };
26574
+ const description = text("description");
26575
+ const justification = text("justification") ?? text("reason");
26576
+ const command = request.kind === "execute" ? text("command") ?? text("cmd") ?? request.toolCall?.command : void 0;
26577
+ let outsideSandbox = false;
26578
+ for (const name of ["sandbox_permissions", "sandboxPermissions", "dangerouslyDisableSandbox"]) {
26579
+ const value = input2[name];
26580
+ const outside = name === "dangerouslyDisableSandbox" ? value === true || value === "true" : typeof value === "string" && /full[-_]access|danger|escalat/i.test(value);
26581
+ if (!outside) continue;
26582
+ outsideSandbox = true;
26583
+ coveredArgs.push(name);
26584
+ }
26585
+ if ("timeoutMs" in input2) coveredArgs.push("timeoutMs");
26586
+ return {
26587
+ ...description !== void 0 ? { description } : {},
26588
+ ...justification !== void 0 ? { justification } : {},
26589
+ ...command !== void 0 ? { command } : {},
26590
+ ...outsideSandbox ? { outsideSandbox: true } : {},
26591
+ ...coveredArgs.length > 0 ? { coveredArgs } : {}
26592
+ };
26593
+ }
26594
+
26554
26595
  // ../../packages/ycodium-acp-executor/src/executor/requests.ts
26555
26596
  function createExecutorRequests({
26556
26597
  emit,
@@ -26684,6 +26725,13 @@ function createExecutorRequests({
26684
26725
  return { outcome: { outcome: "selected", optionId } };
26685
26726
  }
26686
26727
  }
26728
+ const permissionContext = {
26729
+ request: params,
26730
+ permissionRequest,
26731
+ previousToolCall: tracked?.state
26732
+ };
26733
+ const statement = hooks.permissionStatement?.(permissionContext) ?? defaultPermissionStatement(permissionRequest);
26734
+ const fileChanges = hooks.permissionFileChanges?.(permissionContext) ?? fileChangesFromAcpPermission(permissionRequest);
26687
26735
  const requestId = randomId();
26688
26736
  const outcome = await new Promise((resolve2) => {
26689
26737
  const pending = {
@@ -26703,10 +26751,11 @@ function createExecutorRequests({
26703
26751
  turnId: shared.activeTurnId,
26704
26752
  requestId,
26705
26753
  permissionRequest,
26706
- detail: permissionRequest.detail,
26754
+ detail: statement.command ?? permissionRequest.detail,
26707
26755
  args: permissionRequest.toolCall?.data["rawInput"] ?? params.toolCall.rawInput,
26756
+ statement,
26708
26757
  options: acpApprovalOptions(params),
26709
- fileChanges: fileChangesFromAcpPermission(permissionRequest),
26758
+ fileChanges,
26710
26759
  source: "acp.jsonrpc",
26711
26760
  method: "session/request_permission",
26712
26761
  rawPayload: params
@@ -28730,6 +28779,7 @@ var ACP_CARD = {
28730
28779
  type: "string",
28731
28780
  "x-ycodium-form": {
28732
28781
  titleKey: "form.homePath.title",
28782
+ machineLocal: true,
28733
28783
  descriptionKey: "form.homePath.description",
28734
28784
  placeholderKey: "form.homePath.placeholder"
28735
28785
  }
@@ -29049,8 +29099,8 @@ function acpRuntimeModeAutoApproves(runtimeMode, toolKind) {
29049
29099
  return false;
29050
29100
  }
29051
29101
  }
29052
- function acpSessionModeToApply(requestedNativeModeId, startedModeId) {
29053
- return requestedNativeModeId !== void 0 && requestedNativeModeId !== startedModeId ? requestedNativeModeId : void 0;
29102
+ function acpSessionModeToApply(requestedNativeModeId, startedModeId, isResuming) {
29103
+ return requestedNativeModeId !== void 0 && (isResuming || requestedNativeModeId !== startedModeId) ? requestedNativeModeId : void 0;
29054
29104
  }
29055
29105
 
29056
29106
  // src/acpInstance.ts
@@ -29248,7 +29298,8 @@ var createAcpInstance = (config2, host) => {
29248
29298
  const started = await raceStartAbort(executor.start(), signal);
29249
29299
  const modeToApply = acpSessionModeToApply(
29250
29300
  input2.nativeModeId,
29251
- acpCurrentModeId(started.sessionSetupResult)
29301
+ acpCurrentModeId(started.sessionSetupResult),
29302
+ resume !== void 0
29252
29303
  );
29253
29304
  if (modeToApply !== void 0) {
29254
29305
  await raceStartAbort(executor.setNativeMode(modeToApply), signal);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-acp",
3
- "version": "0.2.4486",
3
+ "version": "0.2.5004",
4
4
  "description": "Generic ACP executor: user-supplied CLI over Agent Client Protocol stdio.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -21,9 +21,9 @@
21
21
  "@types/node": "24.12.4",
22
22
  "esbuild": "0.28.1",
23
23
  "vite-plus": "0.2.2",
24
- "@ycodium-ai/plugin-api": "0.2.4486",
25
- "ycodium-acp-executor": "0.2.0",
26
- "ycodium-executor-testing": "0.0.0"
24
+ "@ycodium-ai/plugin-api": "0.2.5004",
25
+ "ycodium-executor-testing": "0.0.0",
26
+ "ycodium-acp-executor": "0.2.5004"
27
27
  },
28
28
  "ycodium": {
29
29
  "plugin": "./dist/index.js",