@ycodium-ai/agent-fake 0.2.3250 → 0.2.3254
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.
- package/dist/index.js +11 -6
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -68,6 +68,7 @@ var FAKE_CARD = {
|
|
|
68
68
|
holdMs: { type: "integer", minimum: 0 },
|
|
69
69
|
// stream 脚本循环切片的源文本;性能探针用它换上可控的长回复,不进设置表单。
|
|
70
70
|
streamText: { type: "string" },
|
|
71
|
+
streamVaryPerTurn: { type: "boolean" },
|
|
71
72
|
// mcp-send 的逐轮剧本文件路径;不进设置表单。
|
|
72
73
|
playbookPath: { type: "string" },
|
|
73
74
|
// 额度与用量怎么答(见 fakeUsage.ts);不进设置表单,开发与验收时手改实例配置。
|
|
@@ -1296,9 +1297,11 @@ var FAKE_STREAM_TEXT = [
|
|
|
1296
1297
|
"not the whole list, so each delta stays cheap even on a long conversation. "
|
|
1297
1298
|
].join("");
|
|
1298
1299
|
var STREAM_CHUNK_CHARS = 12;
|
|
1299
|
-
var
|
|
1300
|
+
var streamTextForRound = (text, vary, round) => vary ? text.replaceAll("{{streamRound}}", String(round)) : text;
|
|
1301
|
+
var parseStreamOptions = (input, round) => {
|
|
1300
1302
|
const config = input?.config ?? {};
|
|
1301
|
-
const
|
|
1303
|
+
const sourceText = typeof config.streamText === "string" && config.streamText !== "" ? config.streamText : null;
|
|
1304
|
+
const customText = sourceText !== null && round !== void 0 ? streamTextForRound(sourceText, config.streamVaryPerTurn === true, round) : sourceText;
|
|
1302
1305
|
const chunks = typeof config.streamChunks === "number" && config.streamChunks >= 1 ? Math.floor(config.streamChunks) : customText === null ? 200 : Math.ceil(customText.length / STREAM_CHUNK_CHARS);
|
|
1303
1306
|
const intervalMs = typeof config.streamIntervalMs === "number" && config.streamIntervalMs >= 0 ? config.streamIntervalMs : 30;
|
|
1304
1307
|
return { chunks, intervalMs, text: customText ?? FAKE_STREAM_TEXT };
|
|
@@ -1539,6 +1542,7 @@ var createFakeInstance = (config, host) => {
|
|
|
1539
1542
|
const steeredInputs = /* @__PURE__ */ new Map();
|
|
1540
1543
|
const pendingDecisions = /* @__PURE__ */ new Map();
|
|
1541
1544
|
let seq = 0;
|
|
1545
|
+
let streamRound = 0;
|
|
1542
1546
|
const inflight = /* @__PURE__ */ new Map();
|
|
1543
1547
|
let disposed = false;
|
|
1544
1548
|
const nextId = (prefix) => `${prefix}-fake-${++seq}-${NodeCrypto.randomUUID()}`;
|
|
@@ -1694,13 +1698,14 @@ var createFakeInstance = (config, host) => {
|
|
|
1694
1698
|
return;
|
|
1695
1699
|
}
|
|
1696
1700
|
if (script === "stream") {
|
|
1701
|
+
const roundOptions = parseStreamOptions(config, ++streamRound);
|
|
1697
1702
|
let text = "";
|
|
1698
|
-
for (let index = 0; index <
|
|
1703
|
+
for (let index = 0; index < roundOptions.chunks; index++) {
|
|
1699
1704
|
if (aborted()) break;
|
|
1700
|
-
const delta = fakeStreamChunk(
|
|
1705
|
+
const delta = fakeStreamChunk(roundOptions.text, index);
|
|
1701
1706
|
text += delta;
|
|
1702
1707
|
emit("content.delta", threadId, { streamKind: "assistant_text", delta }, { turnId });
|
|
1703
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
1708
|
+
await new Promise((resolve) => setTimeout(resolve, roundOptions.intervalMs));
|
|
1704
1709
|
}
|
|
1705
1710
|
finishTurn(booked, turnId, aborted() ? "interrupted" : "completed", [
|
|
1706
1711
|
{ kind: "assistant", text }
|
|
@@ -1896,7 +1901,7 @@ var executors = [
|
|
|
1896
1901
|
];
|
|
1897
1902
|
var index_default = definePlugin({
|
|
1898
1903
|
id: "agent-fake",
|
|
1899
|
-
apiVersion:
|
|
1904
|
+
apiVersion: 30,
|
|
1900
1905
|
executors,
|
|
1901
1906
|
activate(ctx) {
|
|
1902
1907
|
ctx.log.info("fake executor ready");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-fake",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3254",
|
|
4
4
|
"description": "Minimal fake executor for plugin authors and host orchestration tests.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"esbuild": "0.28.1",
|
|
23
23
|
"vite-plus": "0.2.2",
|
|
24
24
|
"ycodium-executor-testing": "0.0.0",
|
|
25
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
25
|
+
"@ycodium-ai/plugin-api": "0.2.3254"
|
|
26
26
|
},
|
|
27
27
|
"ycodium": {
|
|
28
28
|
"plugin": "./dist/index.js",
|