@ycodium-ai/agent-grok 0.2.3094 → 0.2.3102

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 +23 -2
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -27121,6 +27121,24 @@ var dispatchAcpPrompt = (executor, input2) => {
27121
27121
  ]);
27122
27122
  };
27123
27123
 
27124
+ // ../../packages/ycodium-acp-executor/src/start-abort.ts
27125
+ function throwIfStartAborted(signal) {
27126
+ if (signal?.aborted) throw new Error("aborted");
27127
+ }
27128
+ async function raceStartAbort(promise2, signal) {
27129
+ void promise2.catch(() => void 0);
27130
+ throwIfStartAborted(signal);
27131
+ if (signal === void 0) return promise2;
27132
+ const aborted2 = Promise.withResolvers();
27133
+ const onAbort = () => aborted2.reject(new Error("aborted"));
27134
+ signal.addEventListener("abort", onAbort, { once: true });
27135
+ try {
27136
+ return await Promise.race([promise2, aborted2.promise]);
27137
+ } finally {
27138
+ signal.removeEventListener("abort", onAbort);
27139
+ }
27140
+ }
27141
+
27124
27142
  // ../../packages/ycodium-acp-executor/src/mcp-servers.ts
27125
27143
  function toAcpMcpServers(entries) {
27126
27144
  return (entries ?? []).map(
@@ -28612,7 +28630,7 @@ var createGrokInstance = (config2, host) => {
28612
28630
  // 绝对路径读到哪儿都一样(实测表见 grokSupport.ts),附件目录无需放行。
28613
28631
  startSession: async (input2, signal) => {
28614
28632
  if (disposed) throw new Error("instance disposed");
28615
- if (signal?.aborted) throw new Error("aborted");
28633
+ throwIfStartAborted(signal);
28616
28634
  if (recipe.binaryPath.length === 0) {
28617
28635
  throw new Error("Grok program path is not configured");
28618
28636
  }
@@ -28622,6 +28640,7 @@ var createGrokInstance = (config2, host) => {
28622
28640
  if (existing !== void 0) {
28623
28641
  await stopBooked(existing);
28624
28642
  threads.delete(input2.threadId);
28643
+ throwIfStartAborted(signal);
28625
28644
  }
28626
28645
  const configuredHome = recipe.homePath;
28627
28646
  const env = buildSpawnEnv(
@@ -28731,9 +28750,11 @@ var createGrokInstance = (config2, host) => {
28731
28750
  }
28732
28751
  })();
28733
28752
  try {
28734
- const started = await executor.start();
28753
+ throwIfStartAborted(signal);
28754
+ const started = await raceStartAbort(executor.start(), signal);
28735
28755
  initializeResult = started.initializeResult;
28736
28756
  await yieldTick();
28757
+ throwIfStartAborted(signal);
28737
28758
  const createdAt = nowIso();
28738
28759
  const resumeCursor = {
28739
28760
  schemaVersion: RESUME_SCHEMA_VERSION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-grok",
3
- "version": "0.2.3094",
3
+ "version": "0.2.3102",
4
4
  "description": "Grok executor: grok CLI over Agent Client Protocol stdio.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -21,8 +21,8 @@
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.3094",
25
- "ycodium-acp-executor": "0.2.3094",
24
+ "@ycodium-ai/plugin-api": "0.2.3102",
25
+ "ycodium-acp-executor": "0.2.3102",
26
26
  "ycodium-executor-testing": "0.0.0"
27
27
  },
28
28
  "ycodium": {