@ycodium-ai/agent-claude 0.2.3935 → 0.2.3982

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 +18 -55
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1,6 +1,11 @@
1
1
  // src/index.ts
2
2
  import * as NodePath20 from "node:path";
3
3
  import { definePlugin } from "@ycodium-ai/plugin-api";
4
+
5
+ // ../../packages/plugin-api/src/version.ts
6
+ var PLUGIN_API_VERSION = 76;
7
+
8
+ // src/index.ts
4
9
  import {
5
10
  EXECUTOR_EFFECTIVE_PAYLOAD_SCHEMA,
6
11
  executorEnvironmentValue,
@@ -23922,8 +23927,8 @@ var makeEventEmitter = (deps) => {
23922
23927
  threadId: context.session.threadId
23923
23928
  });
23924
23929
  const offerRuntimeEvent = (context, event) => {
23925
- deps.push({
23926
- ...context?.origin,
23930
+ context.events.emit({
23931
+ ...context.origin,
23927
23932
  ...event
23928
23933
  });
23929
23934
  };
@@ -24627,9 +24632,7 @@ var makeSdkStream = (deps) => {
24627
24632
  } else if (context.turnState) {
24628
24633
  await completeTurn(context, "interrupted", "Claude runtime stream ended.");
24629
24634
  }
24630
- await stopSessionInternal(context, {
24631
- emitExitEvent: true
24632
- });
24635
+ await stopSessionInternal(context);
24633
24636
  };
24634
24637
  return { runSdkStream };
24635
24638
  };
@@ -25907,7 +25910,7 @@ var makeSessionLifecycle = (deps) => {
25907
25910
  clearTimeout(timer);
25908
25911
  }
25909
25912
  };
25910
- const stopSessionInternal = async (context, stopOptions) => {
25913
+ const stopSessionInternal = async (context) => {
25911
25914
  if (context.stopWork) {
25912
25915
  await context.stopWork;
25913
25916
  return;
@@ -25982,7 +25985,7 @@ var makeSessionLifecycle = (deps) => {
25982
25985
  status: "closed",
25983
25986
  updatedAt
25984
25987
  };
25985
- if (stopOptions?.emitExitEvent !== false && sessions.get(context.session.threadId) === context) {
25988
+ if (sessions.get(context.session.threadId) === context) {
25986
25989
  const stamp = await makeEventStamp();
25987
25990
  offerRuntimeEvent(context, {
25988
25991
  type: "session.exited",
@@ -26017,7 +26020,7 @@ var makeSessionLifecycle = (deps) => {
26017
26020
  };
26018
26021
  const withProcessGeneration = (session, context) => ({
26019
26022
  ...session,
26020
- ...context.origin.originBindingGeneration === void 0 ? {} : { bindingGeneration: context.origin.originBindingGeneration }
26023
+ ...context.bindingGeneration === void 0 ? {} : { bindingGeneration: context.bindingGeneration }
26021
26024
  });
26022
26025
  const reconfigureSession = async (context, input, desired) => {
26023
26026
  const resumeTarget = readClaudeResumeState(input.resumeCursor)?.resume;
@@ -26248,7 +26251,7 @@ var makeStartSession = (deps) => {
26248
26251
  existingSessionStatus: existingContext.session.status,
26249
26252
  reason: "startSession called with existing active session"
26250
26253
  });
26251
- await stopSessionInternal(existingContext, { emitExitEvent: false });
26254
+ await stopSessionInternal(existingContext);
26252
26255
  }
26253
26256
  const startedAt = nowIso();
26254
26257
  const resumeState = input.discardResumeCursor === true ? void 0 : readClaudeResumeState(input.resumeCursor);
@@ -26409,10 +26412,9 @@ var makeStartSession = (deps) => {
26409
26412
  };
26410
26413
  const context = {
26411
26414
  session,
26412
- origin: {
26413
- ...input.bindingGeneration === void 0 ? {} : { originBindingGeneration: input.bindingGeneration },
26414
- ...input.resumeCursor === void 0 ? {} : { originResumeCursor: input.resumeCursor }
26415
- },
26415
+ events: input.events,
26416
+ bindingGeneration: input.bindingGeneration,
26417
+ origin: input.resumeCursor === void 0 ? {} : { originResumeCursor: input.resumeCursor },
26416
26418
  promptQueue,
26417
26419
  query: queryRuntime,
26418
26420
  cliProcess,
@@ -27945,40 +27947,6 @@ function claudeSignInCommand(credentialsPath, platform4) {
27945
27947
  return withClaudeCredentialsDir({ command, credentialsDirPath, platform: platform4 });
27946
27948
  }
27947
27949
 
27948
- // src/events.ts
27949
- var EventBus = class {
27950
- #queued = [];
27951
- #waiters = [];
27952
- #closed = false;
27953
- push(event) {
27954
- const waiter = this.#waiters.shift();
27955
- if (waiter) {
27956
- waiter({ done: false, value: event });
27957
- return;
27958
- }
27959
- this.#queued.push(event);
27960
- }
27961
- close() {
27962
- if (this.#closed) return;
27963
- this.#closed = true;
27964
- while (this.#waiters.length > 0) {
27965
- this.#waiters.shift()?.({ done: true, value: void 0 });
27966
- }
27967
- }
27968
- [Symbol.asyncIterator]() {
27969
- return {
27970
- next: () => {
27971
- const queued = this.#queued.shift();
27972
- if (queued !== void 0) return Promise.resolve({ done: false, value: queued });
27973
- if (this.#closed) return Promise.resolve({ done: true, value: void 0 });
27974
- return new Promise((resolve6) => {
27975
- this.#waiters.push(resolve6);
27976
- });
27977
- }
27978
- };
27979
- }
27980
- };
27981
-
27982
27950
  // src/textGeneration.ts
27983
27951
  import * as NodeFSP7 from "node:fs/promises";
27984
27952
  import * as NodeOS8 from "node:os";
@@ -29295,11 +29263,9 @@ function createClaudeAdapter(recipe, host, options) {
29295
29263
  });
29296
29264
  const currentModelCatalog = modelCatalog.current;
29297
29265
  const declaredModels = [CLAUDE_CARD.defaultModel];
29298
- const runtimeEventQueue = new EventBus();
29299
29266
  const emitter = makeEventEmitter({
29300
29267
  now,
29301
- randomId: options?.randomId ?? (() => crypto.randomUUID()),
29302
- push: (event) => runtimeEventQueue.push(event)
29268
+ randomId: options?.randomId ?? (() => crypto.randomUUID())
29303
29269
  });
29304
29270
  const { nowIso } = emitter;
29305
29271
  const {
@@ -29427,7 +29393,7 @@ function createClaudeAdapter(recipe, host, options) {
29427
29393
  const stopSession = async (threadId) => {
29428
29394
  const context = sessions.get(threadId);
29429
29395
  if (!context) return;
29430
- await stopSessionInternal(context, { emitExitEvent: true });
29396
+ await stopSessionInternal(context);
29431
29397
  };
29432
29398
  return {
29433
29399
  /** 型号目录:探测用它读并拿当前这份;会话内部自己走同一份。 */
@@ -29451,12 +29417,10 @@ function createClaudeAdapter(recipe, host, options) {
29451
29417
  setNativeMode,
29452
29418
  stopSession,
29453
29419
  openCommandProcesses: async (threadId) => openCommandsOf(sessions.get(threadId)),
29454
- events: runtimeEventQueue,
29455
29420
  dispose: async () => {
29456
29421
  const results = await Promise.allSettled(
29457
29422
  [...sessions.values()].map((ctx) => stopSessionInternal(ctx))
29458
29423
  );
29459
- runtimeEventQueue.close();
29460
29424
  const failures = results.flatMap(
29461
29425
  (result) => result.status === "rejected" ? [result.reason] : []
29462
29426
  );
@@ -29529,7 +29493,6 @@ function createClaudeInstance(config, host, attachments, overrides, usageCache)
29529
29493
  stopSession: adapter.stopSession,
29530
29494
  openCommandProcesses: adapter.openCommandProcesses,
29531
29495
  readThread: adapter.readThread,
29532
- events: adapter.events,
29533
29496
  dispose: adapter.dispose,
29534
29497
  // 项目里的命令与技能:探测没有工作区,只能报用户配置目录那份;这里按目录扫。
29535
29498
  workspaceInventory: ({ cwd }) => {
@@ -29610,7 +29573,7 @@ var executors = [
29610
29573
  ];
29611
29574
  var index_default = definePlugin({
29612
29575
  id: "agent-claude",
29613
- apiVersion: 69,
29576
+ apiVersion: PLUGIN_API_VERSION,
29614
29577
  executors,
29615
29578
  activate(ctx) {
29616
29579
  ctx.command({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-claude",
3
- "version": "0.2.3935",
3
+ "version": "0.2.3982",
4
4
  "description": "Claude executor: Claude Code CLI via @anthropic-ai/claude-agent-sdk.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -24,10 +24,10 @@
24
24
  "@types/node": "24.12.4",
25
25
  "esbuild": "0.28.1",
26
26
  "vite-plus": "0.2.2",
27
- "@ycodium-ai/plugin-api": "0.2.3935",
28
- "ycodium-jsonl-stream": "0.0.0",
27
+ "@ycodium-ai/plugin-api": "0.2.3982",
28
+ "ycodium-composer-tokens": "0.0.0",
29
29
  "ycodium-executor-testing": "0.0.0",
30
- "ycodium-composer-tokens": "0.0.0"
30
+ "ycodium-jsonl-stream": "0.0.0"
31
31
  },
32
32
  "ycodium": {
33
33
  "plugin": "./dist/index.js",