@ycodium-ai/agent-fake 0.2.2634 → 0.2.2664
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/README.md +2 -1
- package/dist/index.js +44 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
A minimal executor plugin. It starts no CLI and replays a fixed event script:
|
|
4
4
|
|
|
5
5
|
- `startSession` emits `session.started`
|
|
6
|
-
- `sendTurn` emits one `content.delta
|
|
6
|
+
- `sendTurn` emits `turn.started`, one `content.delta`, then `turn.completed` (the host binds the turn by `turn.started`)
|
|
7
|
+
- `config.script` picks the script: `plain` (default), `approval-tool` (two approvals before the reply), or `async-question` (on a thread's first turn, the reply plus one non-blocking `user-input.requested` with `responseMode: "message"`)
|
|
7
8
|
- `interruptTurn` (or an aborted `AbortSignal`) ends the in-flight turn as `interrupted`
|
|
8
9
|
- `readThread` returns the bookkeeping the instance recorded
|
|
9
10
|
- `probe` reports two models, `fake` (default) and `fake-large`
|
package/dist/index.js
CHANGED
|
@@ -40,7 +40,7 @@ var FAKE_CARD = {
|
|
|
40
40
|
additionalProperties: false,
|
|
41
41
|
"x-ycodium-form-order": ["replyText"],
|
|
42
42
|
properties: {
|
|
43
|
-
script: { type: "string", enum: ["plain", "approval-tool"] },
|
|
43
|
+
script: { type: "string", enum: ["plain", "approval-tool", "async-question"] },
|
|
44
44
|
replyText: {
|
|
45
45
|
type: "string",
|
|
46
46
|
"x-ycodium-form": {
|
|
@@ -94,10 +94,31 @@ var EventBus = class {
|
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
|
+
var FAKE_ASYNC_QUESTIONS = [
|
|
98
|
+
{
|
|
99
|
+
id: "q0",
|
|
100
|
+
header: "Which database should I use?",
|
|
101
|
+
question: "Which database should I use?",
|
|
102
|
+
options: [
|
|
103
|
+
{ label: "Postgres", description: "" },
|
|
104
|
+
{ label: "SQLite", description: "" }
|
|
105
|
+
],
|
|
106
|
+
allowFreeform: true,
|
|
107
|
+
multiSelect: false
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: "q1",
|
|
111
|
+
header: "Anything else I should know?",
|
|
112
|
+
question: "Anything else I should know?",
|
|
113
|
+
options: [],
|
|
114
|
+
allowFreeform: true,
|
|
115
|
+
multiSelect: false
|
|
116
|
+
}
|
|
117
|
+
];
|
|
97
118
|
function parseScript(input) {
|
|
98
119
|
const envelope = input;
|
|
99
120
|
const script = envelope?.config?.script;
|
|
100
|
-
return script === "approval-tool"
|
|
121
|
+
return script === "approval-tool" || script === "async-question" ? script : "plain";
|
|
101
122
|
}
|
|
102
123
|
var parseReplyText = (input) => {
|
|
103
124
|
const envelope = input;
|
|
@@ -316,12 +337,33 @@ var createFakeInstance = (config, host) => {
|
|
|
316
337
|
activeTurnId: turnId,
|
|
317
338
|
updatedAt: now()
|
|
318
339
|
};
|
|
340
|
+
emit("turn.started", input.threadId, {}, { turnId });
|
|
319
341
|
try {
|
|
320
342
|
await yieldTick();
|
|
321
343
|
if (aborted) {
|
|
322
344
|
finishTurn(booked, turnId, "interrupted", []);
|
|
323
345
|
return { threadId: input.threadId, turnId };
|
|
324
346
|
}
|
|
347
|
+
if (script === "async-question" && booked.asked !== true) {
|
|
348
|
+
booked.asked = true;
|
|
349
|
+
emit(
|
|
350
|
+
"content.delta",
|
|
351
|
+
input.threadId,
|
|
352
|
+
{ streamKind: "assistant_text", delta: replyText },
|
|
353
|
+
{ turnId }
|
|
354
|
+
);
|
|
355
|
+
emit(
|
|
356
|
+
"user-input.requested",
|
|
357
|
+
input.threadId,
|
|
358
|
+
{ questions: FAKE_ASYNC_QUESTIONS, responseMode: "message" },
|
|
359
|
+
{ turnId, requestId: nextId("question") }
|
|
360
|
+
);
|
|
361
|
+
await yieldTick();
|
|
362
|
+
finishTurn(booked, turnId, aborted ? "interrupted" : "completed", [
|
|
363
|
+
{ kind: "assistant", text: replyText }
|
|
364
|
+
]);
|
|
365
|
+
return { threadId: input.threadId, turnId };
|
|
366
|
+
}
|
|
325
367
|
if (script === "approval-tool") {
|
|
326
368
|
const finalText = await runApprovalToolScript(input.threadId, turnId, signal);
|
|
327
369
|
finishTurn(booked, turnId, aborted ? "interrupted" : "completed", [
|
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.2664",
|
|
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.
|
|
24
|
+
"@ycodium-ai/plugin-api": "0.2.2664"
|
|
25
25
|
},
|
|
26
26
|
"ycodium": {
|
|
27
27
|
"plugin": "./dist/index.js",
|