@ycodium-ai/agent-dsh 0.2.3024 → 0.2.3028

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 +91 -39
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -32708,6 +32708,62 @@ function acpModelChoicesFromConfigOptions(configOptions) {
32708
32708
  return flattenChoices(modelOption["options"], asString(modelOption["currentValue"])?.trim());
32709
32709
  }
32710
32710
 
32711
+ // ../../packages/ycodium-acp-executor/src/apply-effort.ts
32712
+ var applyRequestedEffort = async (input2) => {
32713
+ const requested = input2.requestedEffort?.trim();
32714
+ if (!requested) return;
32715
+ const effort = findAcpEffortConfig(input2.configOptions);
32716
+ if (effort === void 0) return;
32717
+ const matched = effort.choices.find((choice) => choice.value === requested);
32718
+ if (matched === void 0) {
32719
+ input2.log?.info("requested effort is not in the agent catalog; keeping its own", {
32720
+ requestedEffort: requested,
32721
+ advertised: effort.choices.map((choice) => choice.value)
32722
+ });
32723
+ return;
32724
+ }
32725
+ if (matched.isDefault === true) return;
32726
+ if (!input2.isLive(input2.expectedGeneration)) return;
32727
+ try {
32728
+ await input2.connection.request("session/set_config_option", {
32729
+ sessionId: input2.acpSessionId,
32730
+ configId: effort.configId,
32731
+ value: requested
32732
+ });
32733
+ } catch (error62) {
32734
+ input2.log?.info("setting the effort level failed; the session keeps its own", {
32735
+ requestedEffort: requested,
32736
+ configId: effort.configId,
32737
+ error: error62 instanceof Error ? error62.message : String(error62)
32738
+ });
32739
+ }
32740
+ };
32741
+
32742
+ // ../../packages/ycodium-acp-executor/src/failureCategory.ts
32743
+ var ACP_FAILURE_CATEGORIES = [
32744
+ "quota",
32745
+ "rate-limit",
32746
+ "context-limit",
32747
+ "auth",
32748
+ "model-unavailable",
32749
+ "transport",
32750
+ "unknown"
32751
+ ];
32752
+ var isAcpFailureCategory = (value) => ACP_FAILURE_CATEGORIES.some((category) => category === value);
32753
+ var readAcpFailureCategory = (error62) => {
32754
+ if (typeof error62 !== "object" || error62 === null) return void 0;
32755
+ const value = error62.failureCategory;
32756
+ return isAcpFailureCategory(value) ? value : void 0;
32757
+ };
32758
+ var withFailureCategory = (error62, category) => category === void 0 ? error62 : Object.assign(error62, { failureCategory: category });
32759
+ var failureCategoryField = (category) => category === void 0 ? {} : { failureCategory: category };
32760
+ var acpTransportIfEstablished = (sessionEstablished, disposed) => sessionEstablished && !disposed ? "transport" : void 0;
32761
+ var acpPromptFailureCategory = (error62, input2) => {
32762
+ const signaled = readAcpFailureCategory(error62);
32763
+ if (signaled !== void 0) return signaled;
32764
+ return error62 instanceof AcpConnectionClosedError ? acpTransportIfEstablished(input2.sessionEstablished, input2.disposed) : void 0;
32765
+ };
32766
+
32711
32767
  // ../../packages/ycodium-acp-executor/src/runtime-mode.ts
32712
32768
  function isRecord5(value) {
32713
32769
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -32757,7 +32813,7 @@ var ACP_CONFIG_CATEGORY_HANDLING = {
32757
32813
  },
32758
32814
  thought_level: {
32759
32815
  consumed: true,
32760
- via: "config-options.ts:findAcpEffortConfig \u2192 executor.ts:applyRequestedEffort"
32816
+ via: "config-options.ts:findAcpEffortConfig \u2192 apply-effort.ts:applyRequestedEffort"
32761
32817
  },
32762
32818
  model_option: {
32763
32819
  consumed: true,
@@ -33245,11 +33301,16 @@ function createAcpExecutor(options) {
33245
33301
  payload: { answers }
33246
33302
  });
33247
33303
  };
33248
- const abortPendingSettlement = (reason) => {
33304
+ const abortPendingSettlement = (reason, failureCategory) => {
33249
33305
  const waiting = pendingSettlement;
33250
33306
  if (waiting === void 0) return;
33251
33307
  pendingSettlement = void 0;
33252
- waiting.settle({ error: new AcpExecutorRequestError("session/prompt", reason) });
33308
+ waiting.settle({
33309
+ error: withFailureCategory(
33310
+ new AcpExecutorRequestError("session/prompt", reason),
33311
+ failureCategory
33312
+ )
33313
+ });
33253
33314
  };
33254
33315
  const settleAllUserInputs = () => {
33255
33316
  for (const pending of pendingUserInputs.values()) {
@@ -33273,9 +33334,12 @@ function createAcpExecutor(options) {
33273
33334
  rememberSettledPromptKey(waiting.promptKey);
33274
33335
  if (signal.outcome === "error") {
33275
33336
  waiting.settle({
33276
- error: new AcpExecutorRequestError(
33277
- "session/prompt",
33278
- signal.detail ?? "prompt failed without an error detail"
33337
+ error: withFailureCategory(
33338
+ new AcpExecutorRequestError(
33339
+ "session/prompt",
33340
+ signal.detail ?? "prompt failed without an error detail"
33341
+ ),
33342
+ signal.failureCategory
33279
33343
  )
33280
33344
  });
33281
33345
  } else {
@@ -33430,7 +33494,10 @@ function createAcpExecutor(options) {
33430
33494
  }
33431
33495
  settleAllApprovals("cancel");
33432
33496
  settleAllUserInputs();
33433
- abortPendingSettlement("connection closed");
33497
+ abortPendingSettlement(
33498
+ "connection closed",
33499
+ acpTransportIfEstablished(startResult !== void 0, disposed)
33500
+ );
33434
33501
  promptWaiters.splice(0).forEach((wake) => wake());
33435
33502
  },
33436
33503
  () => {
@@ -33485,35 +33552,6 @@ function createAcpExecutor(options) {
33485
33552
  }
33486
33553
  return { ...input2.state, currentModelId: value, configOptions };
33487
33554
  };
33488
- const applyRequestedEffort = async (input2) => {
33489
- const requested = input2.requestedEffort?.trim();
33490
- if (!requested) return;
33491
- const effort = findAcpEffortConfig(input2.configOptions);
33492
- if (effort === void 0) return;
33493
- const matched = effort.choices.find((choice) => choice.value === requested);
33494
- if (matched === void 0) {
33495
- options.log?.info("requested effort is not in the agent catalog; keeping its own", {
33496
- requestedEffort: requested,
33497
- advertised: effort.choices.map((choice) => choice.value)
33498
- });
33499
- return;
33500
- }
33501
- if (matched.isDefault === true) return;
33502
- if (!isLive(input2.expectedGeneration)) return;
33503
- try {
33504
- await connection.request("session/set_config_option", {
33505
- sessionId: input2.acpSessionId,
33506
- configId: effort.configId,
33507
- value: requested
33508
- });
33509
- } catch (error62) {
33510
- options.log?.info("setting the effort level failed; the session keeps its own", {
33511
- requestedEffort: requested,
33512
- configId: effort.configId,
33513
- error: error62 instanceof Error ? error62.message : String(error62)
33514
- });
33515
- }
33516
- };
33517
33555
  const startOnce = async (expectedGeneration) => {
33518
33556
  const initializePayload = acpInitializePayload(options.clientInfo, options.clientCapabilities);
33519
33557
  const initialized = await connection.request(
@@ -33588,6 +33626,9 @@ function createAcpExecutor(options) {
33588
33626
  expectedGeneration
33589
33627
  });
33590
33628
  await applyRequestedEffort({
33629
+ connection,
33630
+ log: options.log,
33631
+ isLive,
33591
33632
  configOptions: nextModelSelectionState.configOptions,
33592
33633
  acpSessionId: nextSessionId,
33593
33634
  requestedEffort: options.requestedEffort,
@@ -33710,7 +33751,8 @@ function createAcpExecutor(options) {
33710
33751
  payload: {
33711
33752
  state: input2.state,
33712
33753
  stopReason: input2.stopReason,
33713
- ...input2.errorMessage === void 0 ? {} : { errorMessage: input2.errorMessage }
33754
+ ...input2.errorMessage === void 0 ? {} : { errorMessage: input2.errorMessage },
33755
+ ...input2.state === "failed" ? failureCategoryField(input2.failureCategory) : {}
33714
33756
  }
33715
33757
  });
33716
33758
  interruptedTurnIds.delete(input2.turnId);
@@ -33807,15 +33849,25 @@ function createAcpExecutor(options) {
33807
33849
  if (disposed) {
33808
33850
  throw new AcpExecutorDisposedError();
33809
33851
  }
33852
+ const failureCategory = acpPromptFailureCategory(error62, {
33853
+ sessionEstablished: startResult !== void 0,
33854
+ disposed
33855
+ });
33810
33856
  if (written && input2.onDispatched !== void 0 && !interruptedTurnIds.has(turnId)) {
33811
33857
  const errorMessage = error62 instanceof Error && error62.message.trim() || "ACP prompt failed";
33812
- if (settle2({ turnId, stopReason: "error", state: "failed", errorMessage }))
33858
+ if (settle2({
33859
+ turnId,
33860
+ stopReason: "error",
33861
+ state: "failed",
33862
+ errorMessage,
33863
+ ...failureCategory === void 0 ? {} : { failureCategory }
33864
+ }))
33813
33865
  options.log?.warn?.("turn failed after dispatch", {
33814
33866
  threadId: options.threadId,
33815
33867
  failure: errorMessage
33816
33868
  });
33817
33869
  }
33818
- throw error62;
33870
+ throw error62 instanceof Error ? withFailureCategory(error62, failureCategory) : error62;
33819
33871
  }
33820
33872
  await connection.awaitInboundIdle();
33821
33873
  if (options.beforeApplyResult) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-dsh",
3
- "version": "0.2.3024",
3
+ "version": "0.2.3028",
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-ai/plugin-api": "0.2.3024",
26
- "ycodium-executor-testing": "0.0.0",
27
- "ycodium-acp-executor": "0.2.0"
25
+ "@ycodium-ai/plugin-api": "0.2.3028",
26
+ "ycodium-acp-executor": "0.2.3028",
27
+ "ycodium-executor-testing": "0.0.0"
28
28
  },
29
29
  "ycodium": {
30
30
  "plugin": "./dist/index.js",