@copilotkit/aimock 1.30.0 → 1.32.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +22 -0
- package/README.md +2 -2
- package/dist/agui-types.d.ts.map +1 -1
- package/dist/cli.cjs +18 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +18 -1
- package/dist/cli.js.map +1 -1
- package/dist/fal-audio.cjs +12 -6
- package/dist/fal-audio.cjs.map +1 -1
- package/dist/fal-audio.d.cts.map +1 -1
- package/dist/fal-audio.d.ts.map +1 -1
- package/dist/fal-audio.js +14 -8
- package/dist/fal-audio.js.map +1 -1
- package/dist/fal.cjs +100 -54
- package/dist/fal.cjs.map +1 -1
- package/dist/fal.d.cts +13 -0
- package/dist/fal.d.cts.map +1 -1
- package/dist/fal.d.ts +13 -0
- package/dist/fal.d.ts.map +1 -1
- package/dist/fal.js +101 -55
- package/dist/fal.js.map +1 -1
- package/dist/index.cjs +10 -2
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -3
- package/dist/llmock.cjs +8 -3
- package/dist/llmock.cjs.map +1 -1
- package/dist/llmock.d.cts +5 -5
- package/dist/llmock.d.cts.map +1 -1
- package/dist/llmock.d.ts +5 -5
- package/dist/llmock.d.ts.map +1 -1
- package/dist/llmock.js +8 -3
- package/dist/llmock.js.map +1 -1
- package/dist/metrics.cjs +9 -0
- package/dist/metrics.cjs.map +1 -1
- package/dist/metrics.d.cts.map +1 -1
- package/dist/metrics.d.ts.map +1 -1
- package/dist/metrics.js +7 -1
- package/dist/metrics.js.map +1 -1
- package/dist/openrouter-video.cjs +1609 -0
- package/dist/openrouter-video.cjs.map +1 -0
- package/dist/openrouter-video.d.cts +154 -0
- package/dist/openrouter-video.d.cts.map +1 -0
- package/dist/openrouter-video.d.ts +154 -0
- package/dist/openrouter-video.d.ts.map +1 -0
- package/dist/openrouter-video.js +1601 -0
- package/dist/openrouter-video.js.map +1 -0
- package/dist/recorder.cjs +48 -7
- package/dist/recorder.cjs.map +1 -1
- package/dist/recorder.d.cts.map +1 -1
- package/dist/recorder.d.ts.map +1 -1
- package/dist/recorder.js +46 -8
- package/dist/recorder.js.map +1 -1
- package/dist/server.cjs +158 -10
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +2 -0
- package/dist/server.d.cts.map +1 -1
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +159 -11
- package/dist/server.js.map +1 -1
- package/dist/types.d.cts +100 -9
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.ts +100 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/vector-types.d.cts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Journal } from "./journal.js";
|
|
2
|
+
import { Fixture, HandlerDefaults, VideoResponse } from "./types.js";
|
|
3
|
+
import * as http$1 from "node:http";
|
|
4
|
+
|
|
5
|
+
//#region src/openrouter-video.d.ts
|
|
6
|
+
declare const OPENROUTER_VIDEO_MAX_ENTRIES = 10000;
|
|
7
|
+
type OpenRouterVideoStatus = "pending" | "in_progress" | "completed" | "failed";
|
|
8
|
+
interface OpenRouterVideoReplayJob {
|
|
9
|
+
kind: "replay";
|
|
10
|
+
jobId: string;
|
|
11
|
+
status: OpenRouterVideoStatus;
|
|
12
|
+
/** Number of status polls the caller has made against this job. */
|
|
13
|
+
pollCount: number;
|
|
14
|
+
/** Poll-count threshold for `pending → in_progress` transition. */
|
|
15
|
+
pollsBeforeInProgress: number;
|
|
16
|
+
/** Poll-count threshold for the transition to the terminal status. */
|
|
17
|
+
pollsBeforeCompleted: number;
|
|
18
|
+
/** The matched fixture's video object (terminal status, bytes, cost, error). */
|
|
19
|
+
video: VideoResponse["video"];
|
|
20
|
+
/**
|
|
21
|
+
* Latch for the empty-`error` authoring warn on failed polls — a polling
|
|
22
|
+
* loop must surface the fixture defect once per job, not once per poll.
|
|
23
|
+
*/
|
|
24
|
+
emptyErrorWarned?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Latch for the per-download fixture-defect warns on the content endpoint
|
|
27
|
+
* (b64 corruption / empty b64 / ignored url). The job's `video` is
|
|
28
|
+
* immutable after submit, so the warn set is identical on every download —
|
|
29
|
+
* surface it once per job, not once per re-download.
|
|
30
|
+
*/
|
|
31
|
+
contentWarnsLatched?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A job whose lifecycle is proxied live upstream (record mode, no fixture
|
|
35
|
+
* matched at submit). Every client poll is forwarded 1:1 to
|
|
36
|
+
* `upstreamPollingUrl`; when the upstream reports a terminal status the
|
|
37
|
+
* entry is captured as a fixture and MUTATED into a terminal
|
|
38
|
+
* OpenRouterVideoReplayJob — so the content endpoint serves it like any
|
|
39
|
+
* replay job. Under `record.proxyOnly` nothing is ever captured or mutated:
|
|
40
|
+
* the job stays `kind: "record"` (terminal statuses included) and the
|
|
41
|
+
* content endpoint live-proxies the stored upstream `unsigned_urls`.
|
|
42
|
+
*/
|
|
43
|
+
interface OpenRouterVideoRecordJob {
|
|
44
|
+
kind: "record";
|
|
45
|
+
/** The mock-issued jobId the client polls with. */
|
|
46
|
+
jobId: string;
|
|
47
|
+
/**
|
|
48
|
+
* Last upstream status relayed to the client. Terminal values occur under
|
|
49
|
+
* proxyOnly (the job stays a live proxy forever) and during the capturing
|
|
50
|
+
* window — `completed` is set synchronously with `capturing` so the content
|
|
51
|
+
* endpoint can live-proxy downloads while the eager capture is in flight.
|
|
52
|
+
* Outside those two cases the capturing path mutates the entry into a
|
|
53
|
+
* replay job at the terminal poll.
|
|
54
|
+
*/
|
|
55
|
+
status: OpenRouterVideoStatus;
|
|
56
|
+
/** Upstream's own job id (recorded as the fixture's video.id). */
|
|
57
|
+
upstreamJobId: string;
|
|
58
|
+
/** Origin-validated absolute upstream URL proxied on every client poll. */
|
|
59
|
+
upstreamPollingUrl: string;
|
|
60
|
+
/**
|
|
61
|
+
* Match snapshot built at submit time (post requestTransform). Its `model`
|
|
62
|
+
* is the submitted model as recorded by the standard model-normalization
|
|
63
|
+
* rules — date suffixes stripped unless `recordFullModelVersion`; model-less
|
|
64
|
+
* submits record the assumed default model.
|
|
65
|
+
*/
|
|
66
|
+
match: Fixture["match"];
|
|
67
|
+
/**
|
|
68
|
+
* Upstream content URLs from a completed poll, stored under proxyOnly and
|
|
69
|
+
* during the capturing window so the content endpoint can live-proxy the
|
|
70
|
+
* bytes (never cached). Stored UNFILTERED — positions must line up with the
|
|
71
|
+
* indexes the rewritten relay handed the client — so entries may be
|
|
72
|
+
* non-strings; the content proxy skips unusable entries at use time.
|
|
73
|
+
*/
|
|
74
|
+
upstreamUnsignedUrls?: unknown[];
|
|
75
|
+
/**
|
|
76
|
+
* Set synchronously before the first await of the eager-capture sequence so
|
|
77
|
+
* a concurrent completed poll relays the upstream body instead of starting
|
|
78
|
+
* a second capture/persist.
|
|
79
|
+
*/
|
|
80
|
+
capturing?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Latches for the per-poll upstream-defect warns in rewriteRecordPollBody
|
|
83
|
+
* (mirrors emptyErrorWarned): a polling loop must surface each defect once
|
|
84
|
+
* per job, not once per poll.
|
|
85
|
+
*/
|
|
86
|
+
nonArrayUrlsWarned?: boolean;
|
|
87
|
+
badCostWarned?: boolean;
|
|
88
|
+
}
|
|
89
|
+
type OpenRouterVideoJob = OpenRouterVideoReplayJob | OpenRouterVideoRecordJob;
|
|
90
|
+
/**
|
|
91
|
+
* Per-testId job state for the OpenRouter video handler. Mirrors
|
|
92
|
+
* FalQueueStateMap (fal.ts): lazy TTL eviction on `get`, FIFO eviction of the
|
|
93
|
+
* oldest entries on `set` when over capacity, no background sweep timer.
|
|
94
|
+
* Deliberate divergences from FalQueueStateMap:
|
|
95
|
+
* - lifetime: this map is per-server-instance (cleared on server
|
|
96
|
+
* close/reset) while FalQueueStateMap is module-global;
|
|
97
|
+
* - `set()` refreshes: delete-before-set moves a re-inserted key to the
|
|
98
|
+
* back of the FIFO order AND resets its createdAt, so a refreshed entry
|
|
99
|
+
* gets a fresh TTL — FalQueueStateMap's plain overwrite keeps the
|
|
100
|
+
* original insertion slot and is never used as a TTL refresh.
|
|
101
|
+
* Keys are `${testId}:${jobId}`.
|
|
102
|
+
*/
|
|
103
|
+
declare class OpenRouterVideoJobMap {
|
|
104
|
+
private readonly entries;
|
|
105
|
+
private worldGeneration;
|
|
106
|
+
/**
|
|
107
|
+
* Monotonic world-generation counter, incremented by `clear()` (a fixtures
|
|
108
|
+
* reset). Identity checks (`jobs.get(key) === job`) can only guard
|
|
109
|
+
* continuations whose job was ALREADY inserted — a continuation that has
|
|
110
|
+
* not inserted yet (the submit proxy's upstream fetch) captures this value
|
|
111
|
+
* before its await and compares after, so it can detect that the world it
|
|
112
|
+
* belongs to was reset mid-flight and skip seeding the new world.
|
|
113
|
+
*/
|
|
114
|
+
get generation(): number;
|
|
115
|
+
get(key: string): OpenRouterVideoJob | undefined;
|
|
116
|
+
set(key: string, job: OpenRouterVideoJob): void;
|
|
117
|
+
delete(key: string): boolean;
|
|
118
|
+
clear(): void;
|
|
119
|
+
get size(): number;
|
|
120
|
+
}
|
|
121
|
+
declare function handleOpenRouterVideoStatus(req: http$1.IncomingMessage, res: http$1.ServerResponse, jobId: string, fixtures: Fixture[], journal: Journal, defaults: HandlerDefaults, setCorsHeaders: (res: http$1.ServerResponse) => void, jobs: OpenRouterVideoJobMap): Promise<void>;
|
|
122
|
+
declare function handleOpenRouterVideoContent(req: http$1.IncomingMessage, res: http$1.ServerResponse, jobId: string, journal: Journal, defaults: HandlerDefaults, setCorsHeaders: (res: http$1.ServerResponse) => void, jobs: OpenRouterVideoJobMap): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Synthesizes the OpenRouter video model listing from loaded fixtures —
|
|
125
|
+
* video-endpoint fixtures with a string `match.model` (mirrors the Ollama
|
|
126
|
+
* `/api/tags` synthesis in server.ts). Falls back to a default model set when
|
|
127
|
+
* no video fixtures are loaded. Note video models do not appear in the plain
|
|
128
|
+
* `/api/v1/models` listing on the real API, hence the dedicated route.
|
|
129
|
+
*
|
|
130
|
+
* With `record.providers.openrouter` configured the listing is proxied
|
|
131
|
+
* upstream instead and relayed verbatim on success (journaled
|
|
132
|
+
* source:"proxy", never recorded as a fixture); an upstream failure warns
|
|
133
|
+
* and falls back to the synthesis below. Strict mode disables the proxy —
|
|
134
|
+
* a strict request is always served the synthesized listing (strict means
|
|
135
|
+
* "nothing reaches an upstream").
|
|
136
|
+
*/
|
|
137
|
+
declare function handleOpenRouterVideoModels(req: http$1.IncomingMessage, res: http$1.ServerResponse, fixtures: Fixture[], journal: Journal, defaults: HandlerDefaults, setCorsHeaders: (res: http$1.ServerResponse) => void): Promise<void>;
|
|
138
|
+
declare function handleOpenRouterVideoCreate(req: http$1.IncomingMessage, res: http$1.ServerResponse, raw: string, fixtures: Fixture[], journal: Journal, defaults: HandlerDefaults, setCorsHeaders: (res: http$1.ServerResponse) => void, jobs: OpenRouterVideoJobMap): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Default cap on the DECODED byte size embedded as `b64` in a recorded
|
|
141
|
+
* fixture (32 MB). Override per-server via
|
|
142
|
+
* `record.openRouterVideo.maxContentBytes` (0 = unlimited; negative or
|
|
143
|
+
* non-integer values are treated as the default, with a createServer warn).
|
|
144
|
+
* The cap protects disk AND memory: a capture whose upstream response
|
|
145
|
+
* DECLARES an over-cap Content-Length is skipped without downloading, while
|
|
146
|
+
* a response with no declared length is read as a stream with the byte count
|
|
147
|
+
* enforced during the read — on exceed the download aborts with nothing
|
|
148
|
+
* oversized retained in memory. In both cases the fixture is persisted
|
|
149
|
+
* without `b64` and the same-session job serves the placeholder MP4.
|
|
150
|
+
*/
|
|
151
|
+
declare const OPENROUTER_VIDEO_DEFAULT_MAX_CONTENT_BYTES: number;
|
|
152
|
+
//#endregion
|
|
153
|
+
export { OPENROUTER_VIDEO_DEFAULT_MAX_CONTENT_BYTES, OPENROUTER_VIDEO_MAX_ENTRIES, OpenRouterVideoJobMap, handleOpenRouterVideoContent, handleOpenRouterVideoCreate, handleOpenRouterVideoModels, handleOpenRouterVideoStatus };
|
|
154
|
+
//# sourceMappingURL=openrouter-video.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openrouter-video.d.ts","names":[],"sources":["../src/openrouter-video.ts"],"sourcesContent":[],"mappings":";;;;;cA2Da,4BAAA;KAGR,qBAAA;AAHL,UAKU,wBAAA,CAL+B;EAGpC,IAAA,EAAA,QAAA;EAEK,KAAA,EAAA,MAAA;EAAwB,MAAA,EAGxB,qBAHwB;;WAWzB,EAAA,MAAA;EAAa;EAyBZ,qBAAA,EAAA,MAAwB;EAAA;sBAYxB,EAAA,MAAA;;EAWM,KAAA,EAhDP,aAgDO,CAAA,OAAA,CAAA;EAwBJ;;;;EAAwE,gBAAA,CAAA,EAAA,OAAA;EAoBvE;;;;;AAoYb;EAAiD,mBAAA,CAAA,EAAA,OAAA;;;;;;;;;;AAiKjD;;UAxmBU,wBAAA,CAymBE;MACL,EAAA,QAAK;;OAGA,EAAA,MAAA;;;;;AAsmBZ;;;;QAGY,EA1sCF,qBA0sCE;;eAEA,EAAA,MAAA;;oBAET,EAAA,MAAA;EAAO;AAmIV;;;;;OAKW,EA30CF,OA20CE,CAAA,OAAA,CAAA;;;;;;AA+lBX;;;;;;;;;;;;;;;;;KAl5DY,kBAAA,GAAqB,2BAA2B;;;;;;;;;;;;;;cAoB/C,qBAAA;;;;;;;;;;;;oBAgBO;wBAUI;;;;;iBA0WF,2BAAA,MACf,MAAA,CAAK,sBACL,MAAA,CAAK,yCAEA,oBACD,mBACC,uCACY,MAAA,CAAK,+BACrB,wBACL;iBAwJmB,4BAAA,MACf,MAAA,CAAK,sBACL,MAAA,CAAK,wCAED,mBACC,uCACY,MAAA,CAAK,+BACrB,wBACL;;;;;;;;;;;;;;;iBAmmBmB,2BAAA,MACf,MAAA,CAAK,sBACL,MAAA,CAAK,0BACA,oBACD,mBACC,uCACY,MAAA,CAAK,0BAC1B;iBAmImB,2BAAA,MACf,MAAA,CAAK,sBACL,MAAA,CAAK,uCAEA,oBACD,mBACC,uCACY,MAAA,CAAK,+BACrB,wBACL;;;;;;;;;;;;;cA2lBU"}
|