@copilotkit/aimock 1.28.0 → 1.29.0
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/CHANGELOG.md +24 -0
- package/dist/agui-types.d.ts.map +1 -1
- package/dist/journal.cjs +10 -0
- package/dist/journal.cjs.map +1 -1
- package/dist/journal.d.cts +8 -0
- package/dist/journal.d.ts +8 -0
- package/dist/journal.js +10 -0
- package/dist/journal.js.map +1 -1
- package/dist/server.cjs +40 -10
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +40 -10
- package/dist/server.js.map +1 -1
- package/dist/video.cjs +17 -1
- package/dist/video.cjs.map +1 -1
- package/dist/video.d.cts.map +1 -1
- package/dist/video.d.ts.map +1 -1
- package/dist/video.js +17 -1
- package/dist/video.js.map +1 -1
- package/package.json +2 -2
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","names":[],"sources":["../src/server.ts"],"sourcesContent":[],"mappings":";;;;;;;;;UAyEiB,cAAA;UACP,MAAA,CAAK;EADE,OAAA,EAEN,OAFM;EAAc,GAAA,EAAA,MAAA;UACrB,EAGE,eAHG;aACJ,EAGI,aAHJ;;AAGI,
|
|
1
|
+
{"version":3,"file":"server.d.ts","names":[],"sources":["../src/server.ts"],"sourcesContent":[],"mappings":";;;;;;;;;UAyEiB,cAAA;UACP,MAAA,CAAK;EADE,OAAA,EAEN,OAFM;EAAc,GAAA,EAAA,MAAA;UACrB,EAGE,eAHG;aACJ,EAGI,aAHJ;;AAGI,UA85BE,eAAA,CA95BF;EAAa,MAAA,EA+5BlB,aA/5BkB,EAAA;EA85BX,MAAA,EAEP,aAFsB,EAAA;EAAA,UAAA,EAGlB,iBAHkB,EAAA;;AAEtB,iBAOY,YAAA,CAPZ,QAAA,EAQE,OARF,EAAA,EAAA,OAAA,CAAA,EASE,iBATF,EAAA,MAOV,CAPU,EAUC,KAVD,CAAA;MACI,EAAA,MAAA;EAAiB,OAAA,EASW,SATX;AAM/B,CAAA,CAAA,EAAsB,eAAY,CAAA,EAId,eAJc,CAAA,EAK/B,OAL+B,CAKvB,cALuB,CAAA"}
|
package/dist/server.js
CHANGED
|
@@ -137,6 +137,22 @@ function handleNotFound(res, message) {
|
|
|
137
137
|
}
|
|
138
138
|
const CONTROL_PREFIX = "/__aimock";
|
|
139
139
|
/**
|
|
140
|
+
* Perform a full fixtures reset: clear the fixtures array, journal, video/fal
|
|
141
|
+
* generation state, and the interaction/event-id counters, then zero the
|
|
142
|
+
* `aimock_fixtures_loaded` gauge. Shared by `/reset/fixtures` and the
|
|
143
|
+
* deprecated `/reset` alias.
|
|
144
|
+
*/
|
|
145
|
+
function performFixturesReset(fixtures, journal, videoStates, defaults) {
|
|
146
|
+
fixtures.length = 0;
|
|
147
|
+
journal.clear();
|
|
148
|
+
videoStates.clear();
|
|
149
|
+
falJobs.clear();
|
|
150
|
+
falQueueStates.clear();
|
|
151
|
+
resetInteractionCounter();
|
|
152
|
+
resetEventIdCounter();
|
|
153
|
+
if (defaults.registry) defaults.registry.setGauge("aimock_fixtures_loaded", {}, fixtures.length);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
140
156
|
* Handle requests under `/__aimock/`. Returns `true` if the request was
|
|
141
157
|
* handled, `false` if the path doesn't match the control prefix.
|
|
142
158
|
*/
|
|
@@ -203,19 +219,33 @@ async function handleControlAPI(req, res, pathname, fixtures, journal, videoStat
|
|
|
203
219
|
res.end(JSON.stringify({ cleared: true }));
|
|
204
220
|
return true;
|
|
205
221
|
}
|
|
206
|
-
if (subPath === "/reset" && req.method === "POST") {
|
|
207
|
-
fixtures
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
if (defaults.registry) defaults.registry.setGauge("aimock_fixtures_loaded", {}, fixtures.length);
|
|
222
|
+
if (subPath === "/reset/fixtures" && req.method === "POST") {
|
|
223
|
+
performFixturesReset(fixtures, journal, videoStates, defaults);
|
|
224
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
225
|
+
res.end(JSON.stringify({ reset: true }));
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
if (subPath === "/reset/journal" && req.method === "POST") {
|
|
229
|
+
journal.clearEntries();
|
|
215
230
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
216
231
|
res.end(JSON.stringify({ reset: true }));
|
|
217
232
|
return true;
|
|
218
233
|
}
|
|
234
|
+
if (subPath === "/reset" && req.method === "POST") {
|
|
235
|
+
performFixturesReset(fixtures, journal, videoStates, defaults);
|
|
236
|
+
const deprecation = "POST /__aimock/reset is deprecated; use POST /__aimock/reset/fixtures (full reset) or POST /__aimock/reset/journal (journal only)";
|
|
237
|
+
defaults.logger.warn("POST /__aimock/reset is deprecated; use /__aimock/reset/fixtures or /__aimock/reset/journal");
|
|
238
|
+
res.writeHead(200, {
|
|
239
|
+
"Content-Type": "application/json",
|
|
240
|
+
Deprecation: "true"
|
|
241
|
+
});
|
|
242
|
+
res.end(JSON.stringify({
|
|
243
|
+
reset: true,
|
|
244
|
+
deprecated: true,
|
|
245
|
+
deprecation
|
|
246
|
+
}));
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
219
249
|
if (subPath === "/error" && req.method === "POST") {
|
|
220
250
|
let raw;
|
|
221
251
|
try {
|
|
@@ -878,7 +908,7 @@ async function createServer(fixtures, options, mounts, serviceFixtures) {
|
|
|
878
908
|
return;
|
|
879
909
|
}
|
|
880
910
|
if (req.method === "DELETE") {
|
|
881
|
-
journal.
|
|
911
|
+
journal.clearEntries();
|
|
882
912
|
res.writeHead(204);
|
|
883
913
|
res.end();
|
|
884
914
|
return;
|