@ycodium-ai/agent-fake 0.2.3168 → 0.2.3180

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 +19 -9
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -57,6 +57,8 @@ var FAKE_CARD = {
57
57
  },
58
58
  streamChunks: { type: "integer", minimum: 1 },
59
59
  streamIntervalMs: { type: "integer", minimum: 0 },
60
+ // 仅探针与测试故意违约:stop 收完后台轮但不发 session.exited,事件流仍打开;默认关闭,不进设置表单。
61
+ stopWithoutExit: { type: "boolean" },
60
62
  // lane 的 hold 最多等插话多久;不进设置表单。
61
63
  holdMs: { type: "integer", minimum: 0 },
62
64
  // stream 脚本循环切片的源文本;性能探针用它换上可控的长回复,不进设置表单。
@@ -124,6 +126,10 @@ var EventBus = class {
124
126
  };
125
127
 
126
128
  // src/fakeSessionLifecycle.ts
129
+ var parseStopWithoutExit = (input) => {
130
+ const envelope = input;
131
+ return envelope?.config?.stopWithoutExit === true;
132
+ };
127
133
  function runFakeTurn(run, settle, fail) {
128
134
  const work = run();
129
135
  return (fail === void 0 ? work : work.catch(fail)).finally(settle);
@@ -1282,6 +1288,7 @@ var createFakeInstance = (config, host) => {
1282
1288
  const playbook = script === "mcp-send" ? createPlaybookRunner(config) : void 0;
1283
1289
  const replyText = parseReplyText(config);
1284
1290
  const failStartSession = parseFailStartSession(config);
1291
+ const stopWithoutExit = parseStopWithoutExit(config);
1285
1292
  const streamOptions = parseStreamOptions(config);
1286
1293
  const previewHoldMs = parsePreviewHoldMs(config);
1287
1294
  const laneOptions = laneTurnOptions(config, streamOptions);
@@ -1313,15 +1320,18 @@ var createFakeInstance = (config, host) => {
1313
1320
  abort: (threadId) => inflight.get(threadId)?.abort(),
1314
1321
  stopPlaybook: (threadId) => playbook?.stopSession(threadId),
1315
1322
  // 代次与续接游标取被关闭的那份 session,不在发送时重查当前会话。
1316
- exited: (session) => emit(
1317
- "session.exited",
1318
- session.threadId,
1319
- { reason: "stopped" },
1320
- {
1321
- ...session.bindingGeneration === void 0 ? {} : { originBindingGeneration: session.bindingGeneration },
1322
- ...session.resumeCursor === void 0 ? {} : { originResumeCursor: session.resumeCursor }
1323
- }
1324
- ),
1323
+ exited: (session) => {
1324
+ if (stopWithoutExit) return;
1325
+ emit(
1326
+ "session.exited",
1327
+ session.threadId,
1328
+ { reason: "stopped" },
1329
+ {
1330
+ ...session.bindingGeneration === void 0 ? {} : { originBindingGeneration: session.bindingGeneration },
1331
+ ...session.resumeCursor === void 0 ? {} : { originResumeCursor: session.resumeCursor }
1332
+ }
1333
+ );
1334
+ },
1325
1335
  forget: (threadId) => steeredInputs.delete(threadId),
1326
1336
  disposePlaybook: () => playbook?.dispose(),
1327
1337
  closeEvents: () => events.close()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-fake",
3
- "version": "0.2.3168",
3
+ "version": "0.2.3180",
4
4
  "description": "Minimal fake executor for plugin authors and host orchestration tests.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -21,7 +21,7 @@
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.3168",
24
+ "@ycodium-ai/plugin-api": "0.2.3180",
25
25
  "ycodium-executor-testing": "0.0.0"
26
26
  },
27
27
  "ycodium": {