@ycodium-ai/agent-dsh 0.2.3766 → 0.2.3799

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.
@@ -0,0 +1,28 @@
1
+ icon.svg in this directory uses the path geometry of the DeepSeek Mono
2
+ variant in @lobehub/icons 5.18.0, part of Lobe Icons
3
+ (https://github.com/lobehub/lobe-icons). DeepSeek is a trademark of its
4
+ owner.
5
+
6
+ The Lobe Icons license follows.
7
+
8
+ MIT License
9
+
10
+ Copyright (c) 2023 LobeHub
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
package/dist/index.js CHANGED
@@ -33471,6 +33471,7 @@ function createExecutorPrompt({
33471
33471
  promptResults,
33472
33472
  settleToolSubagents
33473
33473
  }) {
33474
+ const ownOutcomes = /* @__PURE__ */ new Map();
33474
33475
  const settleTurn = (input2) => {
33475
33476
  if (!isLive(input2.expectedGeneration) || input2.record.finished) {
33476
33477
  return false;
@@ -33487,14 +33488,22 @@ function createExecutorPrompt({
33487
33488
  }
33488
33489
  closeActiveAssistantSegment(input2.turnId);
33489
33490
  shared.promptsInFlight = Math.max(0, shared.promptsInFlight - 1);
33490
- if (shared.promptsInFlight !== 0 || shared.activeTurnId !== input2.turnId) return false;
33491
+ if (shared.promptsInFlight !== 0 || shared.activeTurnId !== input2.turnId) {
33492
+ if (input2.foldedIn !== true) ownOutcomes.set(input2.turnId, input2);
33493
+ return false;
33494
+ }
33495
+ const outcome = (input2.foldedIn === true ? ownOutcomes.get(input2.turnId) : void 0) ?? input2;
33496
+ ownOutcomes.delete(input2.turnId);
33491
33497
  shared.activeTurnId = void 0;
33492
33498
  if (shared.status !== "disposed") {
33493
33499
  shared.status = "ready";
33494
33500
  }
33495
33501
  const interrupted = promptResults.hasInterrupted(input2.turnId);
33496
33502
  settleToolSubagents(
33497
- toolSubagentSettlementOfTurn(interrupted ? "cancelled" : input2.state, input2.failureCategory),
33503
+ toolSubagentSettlementOfTurn(
33504
+ interrupted ? "cancelled" : outcome.state,
33505
+ outcome.failureCategory
33506
+ ),
33498
33507
  input2.turnId
33499
33508
  );
33500
33509
  emit({
@@ -33504,10 +33513,10 @@ function createExecutorPrompt({
33504
33513
  threadId: options.threadId,
33505
33514
  turnId: input2.turnId,
33506
33515
  payload: {
33507
- state: interrupted ? "cancelled" : input2.state,
33508
- stopReason: interrupted ? "cancelled" : input2.stopReason,
33509
- ...input2.errorMessage === void 0 ? {} : { errorMessage: input2.errorMessage },
33510
- ...input2.state === "failed" ? failureCategoryField(input2.failureCategory) : {}
33516
+ state: interrupted ? "cancelled" : outcome.state,
33517
+ stopReason: interrupted ? "cancelled" : outcome.stopReason,
33518
+ ...outcome.errorMessage === void 0 ? {} : { errorMessage: outcome.errorMessage },
33519
+ ...outcome.state === "failed" ? failureCategoryField(outcome.failureCategory) : {}
33511
33520
  }
33512
33521
  });
33513
33522
  interruptedTurnIds.delete(input2.turnId);
@@ -33532,7 +33541,7 @@ function createExecutorPrompt({
33532
33541
  return await promptRpc;
33533
33542
  } else {
33534
33543
  const { promise: early, resolve: settleEarly } = Promise.withResolvers();
33535
- shared.pendingSettlement = {
33544
+ shared.pendingSettlements.set(promptKey, {
33536
33545
  promptKey,
33537
33546
  sessionId,
33538
33547
  settle: settleEarly,
@@ -33541,7 +33550,7 @@ function createExecutorPrompt({
33541
33550
  onError: () => promptResults.reject(record2.promptId),
33542
33551
  hasResult: () => record2.response !== void 0
33543
33552
  }
33544
- };
33553
+ });
33545
33554
  try {
33546
33555
  const outcome = await Promise.race([
33547
33556
  promptRpc.then((value) => {
@@ -33554,7 +33563,7 @@ function createExecutorPrompt({
33554
33563
  if (outcome.error !== void 0) throw outcome.error;
33555
33564
  return outcome.response;
33556
33565
  } finally {
33557
- shared.pendingSettlement = void 0;
33566
+ shared.pendingSettlements.delete(promptKey);
33558
33567
  void promptRpc.catch(() => void 0);
33559
33568
  }
33560
33569
  }
@@ -33704,7 +33713,9 @@ function createExecutorPrompt({
33704
33713
  settle2({
33705
33714
  turnId,
33706
33715
  stopReason,
33707
- state: response2.stopReason === "cancelled" ? "cancelled" : "completed"
33716
+ state: response2.stopReason === "cancelled" ? "cancelled" : "completed",
33717
+ // 立刻写出的插话没被打断却应答 cancelled:agent 把它并进了这一轮(grok 的 removedFromQueue)。
33718
+ foldedIn: response2.stopReason === "cancelled" && input2.expectedActiveTurnId !== void 0 && hooks.queuesPromptsWhileRunning === true
33708
33719
  });
33709
33720
  return {
33710
33721
  threadId: options.threadId,
@@ -33713,7 +33724,8 @@ function createExecutorPrompt({
33713
33724
  ...response2.usage !== void 0 && response2.usage !== null ? { usage: response2.usage } : {}
33714
33725
  };
33715
33726
  };
33716
- await promptMutex.acquire();
33727
+ const writesWhileRunning = input2.expectedActiveTurnId !== void 0 && hooks.queuesPromptsWhileRunning === true;
33728
+ if (!writesWhileRunning) await promptMutex.acquire();
33717
33729
  let response;
33718
33730
  try {
33719
33731
  failIfDisposed();
@@ -33795,7 +33807,7 @@ function createExecutorPrompt({
33795
33807
  await options.beforeApplyResult();
33796
33808
  }
33797
33809
  } finally {
33798
- promptMutex.release();
33810
+ if (!writesWhileRunning) promptMutex.release();
33799
33811
  notifyPromptSettled();
33800
33812
  }
33801
33813
  if (!isLive(started.generation)) {
@@ -34838,28 +34850,29 @@ function createExecutorSettlement({
34838
34850
  if (settledPromptKeys.length > SETTLED_PROMPT_KEY_LIMIT) settledPromptKeys.shift();
34839
34851
  };
34840
34852
  const abortPendingSettlement = (reason, failureCategory) => {
34841
- const waiting = shared.pendingSettlement;
34842
- if (waiting === void 0) return;
34843
- if (waiting.hasResult?.()) return;
34844
- shared.pendingSettlement = void 0;
34845
- waiting.settle({
34846
- error: withFailureCategory(
34847
- new AcpExecutorRequestError("session/prompt", reason),
34848
- failureCategory
34849
- )
34850
- });
34853
+ for (const [key, waiting] of shared.pendingSettlements) {
34854
+ if (waiting.hasResult?.()) continue;
34855
+ shared.pendingSettlements.delete(key);
34856
+ waiting.settle({
34857
+ error: withFailureCategory(
34858
+ new AcpExecutorRequestError("session/prompt", reason),
34859
+ failureCategory
34860
+ )
34861
+ });
34862
+ }
34851
34863
  };
34852
34864
  const settleFromNotification = (method, params) => {
34853
34865
  const hook = hooks.promptSettlement;
34854
- if (hook === void 0 || shared.pendingSettlement === void 0) return false;
34866
+ if (hook === void 0 || shared.pendingSettlements.size === 0) return false;
34855
34867
  const signal = hook.fromNotification(method, params);
34856
34868
  if (signal === void 0) return false;
34857
- const waiting = shared.pendingSettlement;
34858
- if (signal.sessionId !== waiting.sessionId) return false;
34859
- if (signal.promptKey !== void 0 && signal.promptKey !== waiting.promptKey) {
34860
- return settledPromptKeys.includes(signal.promptKey);
34869
+ const waiting = signal.promptKey === void 0 ? [...shared.pendingSettlements.values()].find(
34870
+ (candidate) => candidate.sessionId === signal.sessionId
34871
+ ) : shared.pendingSettlements.get(signal.promptKey);
34872
+ if (waiting === void 0 || waiting.sessionId !== signal.sessionId) {
34873
+ return signal.promptKey !== void 0 && settledPromptKeys.includes(signal.promptKey);
34861
34874
  }
34862
- shared.pendingSettlement = void 0;
34875
+ shared.pendingSettlements.delete(waiting.promptKey);
34863
34876
  rememberSettledPromptKey(waiting.promptKey);
34864
34877
  if (signal.outcome === "error") {
34865
34878
  waiting.onError?.();
@@ -35453,7 +35466,7 @@ function createAcpExecutor(options) {
35453
35466
  startInFlight: void 0,
35454
35467
  activeTurnId: void 0,
35455
35468
  promptsInFlight: 0,
35456
- pendingSettlement: void 0,
35469
+ pendingSettlements: /* @__PURE__ */ new Map(),
35457
35470
  manualCompaction: void 0,
35458
35471
  assistantSegment: { nextSegmentIndex: 0 },
35459
35472
  modeState: void 0,
@@ -37153,7 +37166,7 @@ var executors = [
37153
37166
  ];
37154
37167
  var index_default = definePlugin({
37155
37168
  id: "agent-dsh",
37156
- apiVersion: 56,
37169
+ apiVersion: 60,
37157
37170
  executors,
37158
37171
  activate(ctx) {
37159
37172
  ctx.command({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-dsh",
3
- "version": "0.2.3766",
3
+ "version": "0.2.3799",
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.3766",
25
+ "@ycodium-ai/plugin-api": "0.2.3799",
26
26
  "ycodium-executor-testing": "0.0.0",
27
- "ycodium-acp-executor": "0.2.3766"
27
+ "ycodium-acp-executor": "0.2.3799"
28
28
  },
29
29
  "ycodium": {
30
30
  "plugin": "./dist/index.js",