@ycodium-ai/agent-dsh 0.2.3510 → 0.2.3576

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 +40 -24
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -8270,22 +8270,25 @@ function parseAvailableCommandsUpdate(params) {
8270
8270
  }
8271
8271
  return commands;
8272
8272
  }
8273
- function parsePermissionRequest(params) {
8273
+ function parsePermissionRequest(params, known) {
8274
+ const request = params.toolCall;
8275
+ const earlier = known?.state.data;
8274
8276
  const toolCall = makeToolCallState(
8275
8277
  {
8276
- toolCallId: params.toolCall.toolCallId,
8277
- title: params.toolCall.title,
8278
- kind: params.toolCall.kind,
8279
- status: params.toolCall.status,
8280
- rawInput: params.toolCall.rawInput,
8281
- rawOutput: params.toolCall.rawOutput,
8282
- content: params.toolCall.content,
8283
- locations: params.toolCall.locations
8278
+ toolCallId: request.toolCallId,
8279
+ name: earlier?.["name"],
8280
+ title: request.title ?? known?.rawTitle,
8281
+ kind: request.kind ?? earlier?.["kind"],
8282
+ status: request.status ?? known?.state.status,
8283
+ rawInput: request.rawInput !== void 0 ? request.rawInput : earlier?.["rawInput"],
8284
+ rawOutput: request.rawOutput !== void 0 ? request.rawOutput : earlier?.["rawOutput"],
8285
+ content: request.content !== void 0 ? request.content : earlier?.["content"],
8286
+ locations: request.locations !== void 0 ? request.locations : earlier?.["locations"]
8284
8287
  },
8285
8288
  { fallbackStatus: "pending" }
8286
8289
  );
8287
- const kind = normalizeToolKind(params.toolCall.kind) ?? "unknown";
8288
- const detail = toolCall?.command ?? toolCall?.title ?? toolCall?.detail ?? (typeof params.sessionId === "string" ? `Session ${params.sessionId}` : void 0);
8290
+ const kind = toolCall?.kind ?? "unknown";
8291
+ const detail = toolCall?.command ?? toolCall?.title ?? toolCall?.detail;
8289
8292
  return {
8290
8293
  kind,
8291
8294
  ...detail ? { detail } : {},
@@ -8523,7 +8526,7 @@ function makeAcpRequestOpenedEvent(input2) {
8523
8526
  requestId: input2.requestId,
8524
8527
  payload: {
8525
8528
  requestType,
8526
- detail: input2.detail,
8529
+ ...input2.detail ? { detail: input2.detail } : {},
8527
8530
  ...toolName ? { toolName } : {},
8528
8531
  args: input2.args,
8529
8532
  ...input2.options ? { options: input2.options } : {},
@@ -33284,7 +33287,8 @@ function createExecutorRequests({
33284
33287
  failIfDisposed,
33285
33288
  randomId,
33286
33289
  hooks,
33287
- shared
33290
+ shared,
33291
+ toolCalls
33288
33292
  }) {
33289
33293
  const emitResolved = (pending, decision, reason) => {
33290
33294
  emit(
@@ -33392,7 +33396,14 @@ function createExecutorRequests({
33392
33396
  }
33393
33397
  const userInputOutcome = await handlePermissionAsUserInput(params);
33394
33398
  if (userInputOutcome !== void 0) return userInputOutcome;
33395
- const permissionRequest = parsePermissionRequest(params);
33399
+ const tracked = toolCalls.get(params.toolCall.toolCallId);
33400
+ const parsed = parsePermissionRequest(params, tracked);
33401
+ const overriddenKind = hooks.permissionRequestKind?.({
33402
+ title: params.toolCall.title ?? tracked?.rawTitle,
33403
+ kind: parsed.kind,
33404
+ rawInput: parsed.toolCall?.data["rawInput"]
33405
+ });
33406
+ const permissionRequest = overriddenKind === void 0 ? parsed : { ...parsed, kind: overriddenKind };
33396
33407
  if (options.autoApprove?.(permissionRequest) === true) {
33397
33408
  const optionId = selectAutoApprovedAcpPermissionOption(params);
33398
33409
  if (optionId !== void 0) {
@@ -33418,7 +33429,7 @@ function createExecutorRequests({
33418
33429
  turnId: shared.activeTurnId,
33419
33430
  requestId,
33420
33431
  permissionRequest,
33421
- detail: permissionRequest.detail ?? "Approve this tool call?",
33432
+ detail: permissionRequest.detail,
33422
33433
  args: permissionRequest.toolCall?.data["rawInput"] ?? params.toolCall.rawInput,
33423
33434
  options: acpApprovalOptions(params),
33424
33435
  fileChanges: fileChangesFromAcpPermission(permissionRequest),
@@ -34707,7 +34718,8 @@ function createAcpExecutor(options) {
34707
34718
  failIfDisposed,
34708
34719
  randomId,
34709
34720
  hooks,
34710
- shared
34721
+ shared,
34722
+ toolCalls
34711
34723
  });
34712
34724
  const { rememberSettledPromptKey, abortPendingSettlement, settleFromNotification } = createExecutorSettlement({ hooks, shared });
34713
34725
  const promptResults = createPromptResults({ options, shared });
@@ -35801,6 +35813,14 @@ var WINDOWS_POWERSHELL_FLAGS = ["-NoLogo", "-NoProfile", "-NonInteractive", "-Co
35801
35813
  var NODE_EXECUTABLES = /* @__PURE__ */ new Set(["node", "node.exe"]);
35802
35814
  var SHELL_TOOL_TITLES = /* @__PURE__ */ new Set(["bash", "pwsh"]);
35803
35815
  var isDshShellToolTitle = (title) => SHELL_TOOL_TITLES.has(title);
35816
+ var readShellCommand = (title, rawInput) => {
35817
+ if (title === void 0 || !isDshShellToolTitle(title)) return void 0;
35818
+ if (typeof rawInput !== "object" || rawInput === null) return void 0;
35819
+ const input2 = rawInput;
35820
+ const command = input2["command"];
35821
+ return typeof command === "string" && command.trim() !== "" ? { command, input: input2 } : void 0;
35822
+ };
35823
+ var dshPermissionRequestKind = (tool) => readShellCommand(tool.title, tool.rawInput) === void 0 ? void 0 : "execute";
35804
35824
  var slashed = (path) => path.replaceAll("\\", "/").replace(/\/{2,}/g, "/");
35805
35825
  var basename = (path) => {
35806
35826
  const normalized = slashed(path);
@@ -35868,13 +35888,8 @@ function dshSessionProcessMatcher(program, args) {
35868
35888
  };
35869
35889
  }
35870
35890
  var commandOf = (call) => {
35871
- if (call.title === void 0 || !isDshShellToolTitle(call.title)) return void 0;
35872
- const rawInput = call.rawInput;
35873
- if (typeof rawInput !== "object" || rawInput === null) return void 0;
35874
- const input2 = rawInput;
35875
- if (input2["run_in_background"] === true) return void 0;
35876
- const command = input2["command"];
35877
- return typeof command === "string" && command.trim() !== "" ? command : void 0;
35891
+ const shell = readShellCommand(call.title, call.rawInput);
35892
+ return shell?.input["run_in_background"] === true ? void 0 : shell?.command;
35878
35893
  };
35879
35894
  function dshOpenCommands(session) {
35880
35895
  const commands = session.openToolCalls.flatMap((call) => {
@@ -36064,6 +36079,7 @@ var createDshInstance = (config2, host) => {
36064
36079
  // 该 agent 不实现 session/load,只实现 session/resume——续接重新激活
36065
36080
  // 持久会话而不重放记录,发 load 会卡在永远不结算的重放门上。
36066
36081
  resumeMethod: "session/resume",
36082
+ hooks: { permissionRequestKind: dshPermissionRequestKind },
36067
36083
  ...requestedModelId === void 0 ? {} : { requestedModelId },
36068
36084
  ...requestedEffort === void 0 ? {} : { requestedEffort },
36069
36085
  ...input2.bindingGeneration === void 0 ? {} : { originBindingGeneration: input2.bindingGeneration },
@@ -36221,7 +36237,7 @@ var executors = [
36221
36237
  ];
36222
36238
  var index_default = definePlugin({
36223
36239
  id: "agent-dsh",
36224
- apiVersion: 43,
36240
+ apiVersion: 47,
36225
36241
  executors,
36226
36242
  activate(ctx) {
36227
36243
  ctx.log.info("dsh executor ready");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-dsh",
3
- "version": "0.2.3510",
3
+ "version": "0.2.3576",
4
4
  "description": "DeepSeek Harness executor: dsh CLI over Agent Client Protocol stdio.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -22,9 +22,9 @@
22
22
  "esbuild": "0.28.1",
23
23
  "vite-plus": "0.2.2",
24
24
  "yaml": "^2.9.0",
25
- "ycodium-executor-testing": "0.0.0",
26
- "ycodium-acp-executor": "0.2.3510",
27
- "@ycodium-ai/plugin-api": "0.2.3510"
25
+ "@ycodium-ai/plugin-api": "0.2.3576",
26
+ "ycodium-acp-executor": "0.2.3576",
27
+ "ycodium-executor-testing": "0.0.0"
28
28
  },
29
29
  "ycodium": {
30
30
  "plugin": "./dist/index.js",