@ycodium-ai/agent-fake 0.2.3024 → 0.2.3034
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 +30 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -315,6 +315,23 @@ async function holdTurn(ctx) {
|
|
|
315
315
|
return text;
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
+
// src/failScript.ts
|
|
319
|
+
var FAIL_SENTENCES = {
|
|
320
|
+
quota: "Fake provider: this account has used up its usage limit.",
|
|
321
|
+
"rate-limit": "Fake provider: too many requests, slow down.",
|
|
322
|
+
"context-limit": "Fake provider: the prompt is longer than the model's context window.",
|
|
323
|
+
auth: "Fake provider: the saved API key was rejected.",
|
|
324
|
+
"model-unavailable": "Fake provider: the selected model is overloaded right now.",
|
|
325
|
+
transport: "Fake provider: the connection to the provider was lost.",
|
|
326
|
+
unknown: "Fake provider: something went wrong."
|
|
327
|
+
};
|
|
328
|
+
var isFailCategory = (value) => Object.hasOwn(FAIL_SENTENCES, value);
|
|
329
|
+
var parseFailInput = (input) => {
|
|
330
|
+
const match = /^fail:([a-z-]+)$/.exec(input?.trim() ?? "");
|
|
331
|
+
const category = match?.[1];
|
|
332
|
+
return category !== void 0 && isFailCategory(category) ? { category, message: FAIL_SENTENCES[category] } : void 0;
|
|
333
|
+
};
|
|
334
|
+
|
|
318
335
|
// src/fakeUsage.ts
|
|
319
336
|
var FAKE_USAGE_SCRIPTS = [
|
|
320
337
|
"available",
|
|
@@ -742,7 +759,7 @@ var createFakeInstance = (config, host) => {
|
|
|
742
759
|
if (!booked) throw new Error(`unknown thread ${threadId}`);
|
|
743
760
|
return booked;
|
|
744
761
|
};
|
|
745
|
-
const finishTurn = (booked, turnId, state, items, errorMessage) => {
|
|
762
|
+
const finishTurn = (booked, turnId, state, items, errorMessage, failureCategory) => {
|
|
746
763
|
booked.turns.push({ id: turnId, items });
|
|
747
764
|
const { activeTurnId: _cleared, ...idle } = booked.session;
|
|
748
765
|
booked.session = {
|
|
@@ -753,7 +770,11 @@ var createFakeInstance = (config, host) => {
|
|
|
753
770
|
emit(
|
|
754
771
|
"turn.completed",
|
|
755
772
|
booked.session.threadId,
|
|
756
|
-
|
|
773
|
+
{
|
|
774
|
+
state,
|
|
775
|
+
...errorMessage === void 0 ? {} : { errorMessage },
|
|
776
|
+
...failureCategory === void 0 ? {} : { failureCategory }
|
|
777
|
+
},
|
|
757
778
|
{ turnId }
|
|
758
779
|
);
|
|
759
780
|
if (inflight.get(booked.session.threadId)?.turnId === turnId) {
|
|
@@ -889,6 +910,13 @@ var createFakeInstance = (config, host) => {
|
|
|
889
910
|
finishTurn(booked, turnId, "interrupted", []);
|
|
890
911
|
return;
|
|
891
912
|
}
|
|
913
|
+
const failure = parseFailInput(input);
|
|
914
|
+
if (failure !== void 0) {
|
|
915
|
+
const { category, message } = failure;
|
|
916
|
+
emit("runtime.error", threadId, { message, failureCategory: category }, { turnId });
|
|
917
|
+
finishTurn(booked, turnId, "failed", [], message, category);
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
892
920
|
if (script === "async-question" && booked.asked !== true) {
|
|
893
921
|
booked.asked = true;
|
|
894
922
|
emit(
|
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.3034",
|
|
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.3034",
|
|
25
25
|
"ycodium-executor-testing": "0.0.0"
|
|
26
26
|
},
|
|
27
27
|
"ycodium": {
|