@copilotkit/aimock 1.16.3 → 1.17.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 +30 -0
- package/README.md +10 -10
- package/dist/a2a-mock.d.cts +2 -2
- package/dist/a2a-mock.d.cts.map +1 -1
- package/dist/a2a-mock.d.ts +2 -2
- package/dist/a2a-mock.d.ts.map +1 -1
- package/dist/a2a-mock.js +2 -2
- package/dist/a2a-mock.js.map +1 -1
- package/dist/agui-handler.cjs +120 -5
- package/dist/agui-handler.cjs.map +1 -1
- package/dist/agui-handler.d.cts +41 -5
- package/dist/agui-handler.d.cts.map +1 -1
- package/dist/agui-handler.d.ts +41 -5
- package/dist/agui-handler.d.ts.map +1 -1
- package/dist/agui-handler.js +114 -6
- package/dist/agui-handler.js.map +1 -1
- package/dist/agui-mock.cjs +18 -7
- package/dist/agui-mock.cjs.map +1 -1
- package/dist/agui-mock.d.cts +2 -2
- package/dist/agui-mock.d.cts.map +1 -1
- package/dist/agui-mock.d.ts +2 -2
- package/dist/agui-mock.d.ts.map +1 -1
- package/dist/agui-mock.js +20 -9
- package/dist/agui-mock.js.map +1 -1
- package/dist/agui-recorder.cjs +43 -22
- package/dist/agui-recorder.cjs.map +1 -1
- package/dist/agui-recorder.d.cts +4 -3
- package/dist/agui-recorder.d.cts.map +1 -1
- package/dist/agui-recorder.d.ts +4 -3
- package/dist/agui-recorder.d.ts.map +1 -1
- package/dist/agui-recorder.js +45 -24
- package/dist/agui-recorder.js.map +1 -1
- package/dist/agui-stub.cjs +28 -0
- package/dist/agui-stub.d.cts +5 -0
- package/dist/agui-stub.d.ts +5 -0
- package/dist/agui-stub.js +5 -0
- package/dist/agui-types.d.cts +33 -6
- package/dist/agui-types.d.cts.map +1 -1
- package/dist/agui-types.d.ts +33 -6
- package/dist/agui-types.d.ts.map +1 -1
- package/dist/aimock-cli.cjs +1 -1
- package/dist/aimock-cli.js +1 -1
- package/dist/aws-event-stream.d.cts +2 -2
- package/dist/aws-event-stream.d.cts.map +1 -1
- package/dist/aws-event-stream.d.ts +2 -2
- package/dist/aws-event-stream.d.ts.map +1 -1
- package/dist/bedrock-converse.d.cts +3 -3
- package/dist/bedrock-converse.d.cts.map +1 -1
- package/dist/bedrock-converse.d.ts +3 -3
- package/dist/bedrock-converse.d.ts.map +1 -1
- package/dist/bedrock.d.cts +3 -3
- package/dist/bedrock.d.cts.map +1 -1
- package/dist/bedrock.d.ts +3 -3
- package/dist/bedrock.d.ts.map +1 -1
- package/dist/chaos.d.cts +3 -3
- package/dist/chaos.d.cts.map +1 -1
- package/dist/chaos.d.ts +3 -3
- package/dist/chaos.d.ts.map +1 -1
- package/dist/cli.cjs +6 -5
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +6 -5
- package/dist/cli.js.map +1 -1
- package/dist/cohere.d.cts +2 -2
- package/dist/cohere.d.cts.map +1 -1
- package/dist/cohere.d.ts +2 -2
- package/dist/cohere.d.ts.map +1 -1
- package/dist/config-loader.cjs +3 -3
- package/dist/config-loader.d.cts +1 -1
- package/dist/config-loader.d.cts.map +1 -1
- package/dist/config-loader.d.ts +1 -1
- package/dist/config-loader.js +2 -2
- package/dist/convert-vidaimock.cjs +1 -1
- package/dist/convert-vidaimock.js +1 -1
- package/dist/convert.cjs +1 -1
- package/dist/convert.js +1 -1
- package/dist/elevenlabs-audio.cjs +209 -0
- package/dist/elevenlabs-audio.cjs.map +1 -0
- package/dist/elevenlabs-audio.d.cts +11 -0
- package/dist/elevenlabs-audio.d.cts.map +1 -0
- package/dist/elevenlabs-audio.d.ts +11 -0
- package/dist/elevenlabs-audio.d.ts.map +1 -0
- package/dist/elevenlabs-audio.js +209 -0
- package/dist/elevenlabs-audio.js.map +1 -0
- package/dist/embeddings.d.cts +2 -2
- package/dist/embeddings.d.cts.map +1 -1
- package/dist/embeddings.d.ts +2 -2
- package/dist/embeddings.d.ts.map +1 -1
- package/dist/fal-audio.cjs +477 -0
- package/dist/fal-audio.cjs.map +1 -0
- package/dist/fal-audio.d.cts +10 -0
- package/dist/fal-audio.d.cts.map +1 -0
- package/dist/fal-audio.d.ts +10 -0
- package/dist/fal-audio.d.ts.map +1 -0
- package/dist/fal-audio.js +474 -0
- package/dist/fal-audio.js.map +1 -0
- package/dist/fixture-loader.cjs +14 -1
- package/dist/fixture-loader.cjs.map +1 -1
- package/dist/fixture-loader.js +14 -1
- package/dist/fixture-loader.js.map +1 -1
- package/dist/fixtures-remote.cjs +1 -1
- package/dist/fixtures-remote.js +1 -1
- package/dist/gemini-interactions.cjs +617 -0
- package/dist/gemini-interactions.cjs.map +1 -0
- package/dist/gemini-interactions.d.cts +46 -0
- package/dist/gemini-interactions.d.cts.map +1 -0
- package/dist/gemini-interactions.d.ts +46 -0
- package/dist/gemini-interactions.d.ts.map +1 -0
- package/dist/gemini-interactions.js +616 -0
- package/dist/gemini-interactions.js.map +1 -0
- package/dist/gemini.cjs +76 -0
- package/dist/gemini.cjs.map +1 -1
- package/dist/gemini.d.cts +2 -2
- package/dist/gemini.d.cts.map +1 -1
- package/dist/gemini.d.ts +2 -2
- package/dist/gemini.d.ts.map +1 -1
- package/dist/gemini.js +77 -1
- package/dist/gemini.js.map +1 -1
- package/dist/helpers.cjs +24 -1
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +13 -3
- package/dist/helpers.d.cts.map +1 -1
- package/dist/helpers.d.ts +13 -3
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +23 -2
- package/dist/helpers.js.map +1 -1
- package/dist/images.d.cts +2 -2
- package/dist/images.d.cts.map +1 -1
- package/dist/images.d.ts +2 -2
- package/dist/images.d.ts.map +1 -1
- package/dist/index.cjs +21 -4
- package/dist/index.d.cts +10 -7
- package/dist/index.d.ts +10 -7
- package/dist/index.js +10 -7
- package/dist/jest.cjs +1 -1
- package/dist/jest.js +1 -1
- package/dist/jsonrpc.d.cts +3 -3
- package/dist/jsonrpc.d.cts.map +1 -1
- package/dist/jsonrpc.d.ts +3 -3
- package/dist/jsonrpc.d.ts.map +1 -1
- package/dist/llmock.cjs +38 -2
- package/dist/llmock.cjs.map +1 -1
- package/dist/llmock.d.cts +4 -0
- package/dist/llmock.d.cts.map +1 -1
- package/dist/llmock.d.ts +4 -0
- package/dist/llmock.d.ts.map +1 -1
- package/dist/llmock.js +38 -2
- package/dist/llmock.js.map +1 -1
- package/dist/logger.cjs +5 -4
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.d.cts +1 -1
- package/dist/logger.d.cts.map +1 -1
- package/dist/logger.d.ts +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +5 -4
- package/dist/logger.js.map +1 -1
- package/dist/mcp-mock.d.cts +2 -2
- package/dist/mcp-mock.d.cts.map +1 -1
- package/dist/mcp-mock.d.ts +2 -2
- package/dist/mcp-mock.d.ts.map +1 -1
- package/dist/mcp-mock.js +2 -2
- package/dist/mcp-mock.js.map +1 -1
- package/dist/messages.d.cts +2 -2
- package/dist/messages.d.cts.map +1 -1
- package/dist/messages.d.ts +2 -2
- package/dist/messages.d.ts.map +1 -1
- package/dist/moderation.d.cts +3 -3
- package/dist/moderation.d.cts.map +1 -1
- package/dist/moderation.d.ts +3 -3
- package/dist/moderation.d.ts.map +1 -1
- package/dist/ndjson-writer.d.cts +2 -2
- package/dist/ndjson-writer.d.cts.map +1 -1
- package/dist/ndjson-writer.d.ts +2 -2
- package/dist/ndjson-writer.d.ts.map +1 -1
- package/dist/ollama.d.cts +3 -3
- package/dist/ollama.d.cts.map +1 -1
- package/dist/ollama.d.ts +3 -3
- package/dist/ollama.d.ts.map +1 -1
- package/dist/recorder.cjs +64 -21
- package/dist/recorder.cjs.map +1 -1
- package/dist/recorder.d.cts +2 -2
- package/dist/recorder.d.cts.map +1 -1
- package/dist/recorder.d.ts +2 -2
- package/dist/recorder.d.ts.map +1 -1
- package/dist/recorder.js +66 -23
- package/dist/recorder.js.map +1 -1
- package/dist/rerank.d.cts +3 -3
- package/dist/rerank.d.cts.map +1 -1
- package/dist/rerank.d.ts +3 -3
- package/dist/rerank.d.ts.map +1 -1
- package/dist/responses.d.cts +2 -2
- package/dist/responses.d.cts.map +1 -1
- package/dist/responses.d.ts +2 -2
- package/dist/responses.d.ts.map +1 -1
- package/dist/router.cjs +3 -3
- package/dist/router.cjs.map +1 -1
- package/dist/router.js +3 -3
- package/dist/router.js.map +1 -1
- package/dist/search.d.cts +3 -3
- package/dist/search.d.cts.map +1 -1
- package/dist/search.d.ts +3 -3
- package/dist/search.d.ts.map +1 -1
- package/dist/server.cjs +170 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +2 -2
- package/dist/server.d.cts.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +173 -4
- package/dist/server.js.map +1 -1
- package/dist/speech.cjs +18 -9
- package/dist/speech.cjs.map +1 -1
- package/dist/speech.d.cts +2 -2
- package/dist/speech.d.cts.map +1 -1
- package/dist/speech.d.ts +2 -2
- package/dist/speech.d.ts.map +1 -1
- package/dist/speech.js +18 -9
- package/dist/speech.js.map +1 -1
- package/dist/sse-writer.d.cts +3 -3
- package/dist/sse-writer.d.cts.map +1 -1
- package/dist/sse-writer.d.ts +3 -3
- package/dist/sse-writer.d.ts.map +1 -1
- package/dist/stream-collapse.cjs +80 -9
- package/dist/stream-collapse.cjs.map +1 -1
- package/dist/stream-collapse.d.cts +11 -1
- package/dist/stream-collapse.d.cts.map +1 -1
- package/dist/stream-collapse.d.ts +11 -1
- package/dist/stream-collapse.d.ts.map +1 -1
- package/dist/stream-collapse.js +80 -10
- package/dist/stream-collapse.js.map +1 -1
- package/dist/suite.cjs +1 -1
- package/dist/suite.d.cts +2 -2
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +1 -1
- package/dist/transcription.d.cts +2 -2
- package/dist/transcription.d.cts.map +1 -1
- package/dist/transcription.d.ts +2 -2
- package/dist/transcription.d.ts.map +1 -1
- package/dist/types.d.cts +10 -7
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.ts +10 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/vector-mock.d.cts +2 -2
- package/dist/vector-mock.d.cts.map +1 -1
- package/dist/vector-mock.d.ts +2 -2
- package/dist/vector-mock.d.ts.map +1 -1
- package/dist/vector-mock.js +2 -2
- package/dist/vector-mock.js.map +1 -1
- package/dist/vector-types.d.ts.map +1 -1
- package/dist/video.d.cts +3 -3
- package/dist/video.d.cts.map +1 -1
- package/dist/video.d.ts +3 -3
- package/dist/video.d.ts.map +1 -1
- package/dist/vitest.cjs +1 -1
- package/dist/vitest.js +1 -1
- package/dist/ws-framing.d.cts +2 -2
- package/dist/ws-framing.d.cts.map +1 -1
- package/dist/ws-framing.d.ts +2 -2
- package/dist/ws-framing.d.ts.map +1 -1
- package/dist/ws-gemini-live.cjs +145 -2
- package/dist/ws-gemini-live.cjs.map +1 -1
- package/dist/ws-gemini-live.d.cts.map +1 -1
- package/dist/ws-gemini-live.d.ts.map +1 -1
- package/dist/ws-gemini-live.js +146 -3
- package/dist/ws-gemini-live.js.map +1 -1
- package/package.json +16 -2
- package/skills/write-fixtures/SKILL.md +10 -10
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_helpers = require('./helpers.cjs');
|
|
3
|
+
const require_router = require('./router.cjs');
|
|
4
|
+
const require_recorder = require('./recorder.cjs');
|
|
5
|
+
let node_crypto = require("node:crypto");
|
|
6
|
+
node_crypto = require_runtime.__toESM(node_crypto);
|
|
7
|
+
|
|
8
|
+
//#region src/fal-audio.ts
|
|
9
|
+
const FAL_JOB_MAX_ENTRIES = 1e4;
|
|
10
|
+
const FAL_JOB_TTL_MS = 36e5;
|
|
11
|
+
/**
|
|
12
|
+
* A Map wrapper for fal.ai queue jobs that enforces a maximum size and per-entry TTL.
|
|
13
|
+
* Entries older than FAL_JOB_TTL_MS are lazily evicted on `get`.
|
|
14
|
+
* When the map exceeds FAL_JOB_MAX_ENTRIES on `set`, the oldest entries
|
|
15
|
+
* are removed to stay within bounds.
|
|
16
|
+
*/
|
|
17
|
+
var FalJobMap = class {
|
|
18
|
+
entries = /* @__PURE__ */ new Map();
|
|
19
|
+
get(key) {
|
|
20
|
+
const entry = this.entries.get(key);
|
|
21
|
+
if (!entry) return void 0;
|
|
22
|
+
if (Date.now() - entry.createdAt > FAL_JOB_TTL_MS) {
|
|
23
|
+
this.entries.delete(key);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
return entry.job;
|
|
27
|
+
}
|
|
28
|
+
set(key, job) {
|
|
29
|
+
this.entries.set(key, {
|
|
30
|
+
job,
|
|
31
|
+
createdAt: Date.now()
|
|
32
|
+
});
|
|
33
|
+
if (this.entries.size > FAL_JOB_MAX_ENTRIES) {
|
|
34
|
+
const excess = this.entries.size - FAL_JOB_MAX_ENTRIES;
|
|
35
|
+
const iter = this.entries.keys();
|
|
36
|
+
for (let i = 0; i < excess; i++) {
|
|
37
|
+
const next = iter.next();
|
|
38
|
+
if (!next.done) this.entries.delete(next.value);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
delete(key) {
|
|
43
|
+
return this.entries.delete(key);
|
|
44
|
+
}
|
|
45
|
+
clear() {
|
|
46
|
+
this.entries.clear();
|
|
47
|
+
}
|
|
48
|
+
get size() {
|
|
49
|
+
return this.entries.size;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const falJobs = new FalJobMap();
|
|
53
|
+
function audioToFalFile(response) {
|
|
54
|
+
let contentType;
|
|
55
|
+
let data;
|
|
56
|
+
if (typeof response.audio === "string") {
|
|
57
|
+
data = response.audio;
|
|
58
|
+
contentType = require_helpers.FORMAT_TO_CONTENT_TYPE[response.format ?? "mp3"] ?? "audio/mpeg";
|
|
59
|
+
} else {
|
|
60
|
+
data = response.audio.b64Json;
|
|
61
|
+
contentType = response.audio.contentType ?? "audio/mpeg";
|
|
62
|
+
}
|
|
63
|
+
const ext = response.format ?? (contentType !== "audio/mpeg" ? Object.entries(require_helpers.FORMAT_TO_CONTENT_TYPE).find(([, v]) => v === contentType)?.[0] ?? "mp3" : "mp3");
|
|
64
|
+
const fileSize = Math.ceil(data.length * 3 / 4) - (data.endsWith("==") ? 2 : data.endsWith("=") ? 1 : 0);
|
|
65
|
+
return { audio: {
|
|
66
|
+
url: `https://mock.fal.media/files/generated_audio.${ext}`,
|
|
67
|
+
content_type: contentType,
|
|
68
|
+
file_name: `generated_audio.${ext}`,
|
|
69
|
+
file_size: fileSize
|
|
70
|
+
} };
|
|
71
|
+
}
|
|
72
|
+
const QUEUE_SUBMIT_RE = /^\/fal\/queue\/submit\/(.+)$/;
|
|
73
|
+
const QUEUE_STATUS_RE = /^\/fal\/queue\/requests\/([^/]+)\/status$/;
|
|
74
|
+
const QUEUE_RESULT_RE = /^\/fal\/queue\/requests\/([^/]+)$/;
|
|
75
|
+
const QUEUE_CANCEL_RE = /^\/fal\/queue\/requests\/([^/]+)\/cancel$/;
|
|
76
|
+
const SYNC_RUN_RE = /^\/fal\/run\/(.+)$/;
|
|
77
|
+
async function handleFalQueue(req, res, body, pathname, fixtures, defaults, journal) {
|
|
78
|
+
const testId = require_helpers.getTestId(req);
|
|
79
|
+
const matchCounts = journal.getFixtureMatchCountsForTest(testId);
|
|
80
|
+
const submitMatch = QUEUE_SUBMIT_RE.exec(pathname);
|
|
81
|
+
if (submitMatch && req.method === "POST") {
|
|
82
|
+
const modelId = submitMatch[1];
|
|
83
|
+
return handleQueueSubmit(req, res, body, pathname, modelId, testId, fixtures, defaults, matchCounts, journal);
|
|
84
|
+
}
|
|
85
|
+
const statusMatch = QUEUE_STATUS_RE.exec(pathname);
|
|
86
|
+
if (statusMatch) {
|
|
87
|
+
const requestId = statusMatch[1];
|
|
88
|
+
return handleQueueStatus(req, res, pathname, requestId, testId, journal);
|
|
89
|
+
}
|
|
90
|
+
const cancelMatch = QUEUE_CANCEL_RE.exec(pathname);
|
|
91
|
+
if (cancelMatch) {
|
|
92
|
+
const requestId = cancelMatch[1];
|
|
93
|
+
return handleQueueCancel(req, res, pathname, requestId, testId, journal);
|
|
94
|
+
}
|
|
95
|
+
const resultMatch = QUEUE_RESULT_RE.exec(pathname);
|
|
96
|
+
if (resultMatch) {
|
|
97
|
+
const requestId = resultMatch[1];
|
|
98
|
+
return handleQueueResult(req, res, pathname, requestId, testId, journal);
|
|
99
|
+
}
|
|
100
|
+
const runMatch = SYNC_RUN_RE.exec(pathname);
|
|
101
|
+
if (runMatch && req.method === "POST") {
|
|
102
|
+
const modelId = runMatch[1];
|
|
103
|
+
return handleSyncRun(req, res, body, pathname, modelId, fixtures, defaults, matchCounts, journal);
|
|
104
|
+
}
|
|
105
|
+
const errorBody = { error: {
|
|
106
|
+
message: "Unknown fal.ai endpoint",
|
|
107
|
+
type: "not_found"
|
|
108
|
+
} };
|
|
109
|
+
journal.add({
|
|
110
|
+
method: req.method ?? "GET",
|
|
111
|
+
path: pathname,
|
|
112
|
+
headers: {},
|
|
113
|
+
body: null,
|
|
114
|
+
response: {
|
|
115
|
+
status: 404,
|
|
116
|
+
fixture: null
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
res.writeHead(404, { "Content-Type": "application/json" });
|
|
120
|
+
res.end(JSON.stringify(errorBody));
|
|
121
|
+
}
|
|
122
|
+
async function handleQueueSubmit(req, res, body, pathname, modelId, testId, fixtures, defaults, matchCounts, journal) {
|
|
123
|
+
let parsed = {};
|
|
124
|
+
if (body.trim()) try {
|
|
125
|
+
parsed = JSON.parse(body);
|
|
126
|
+
} catch {
|
|
127
|
+
journal.add({
|
|
128
|
+
method: req.method ?? "POST",
|
|
129
|
+
path: pathname,
|
|
130
|
+
headers: {},
|
|
131
|
+
body: null,
|
|
132
|
+
response: {
|
|
133
|
+
status: 400,
|
|
134
|
+
fixture: null
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
res.writeHead(400, { "Content-Type": "application/json" });
|
|
138
|
+
res.end(JSON.stringify({ error: {
|
|
139
|
+
message: "Malformed JSON",
|
|
140
|
+
type: "invalid_request_error"
|
|
141
|
+
} }));
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const syntheticReq = {
|
|
145
|
+
model: modelId,
|
|
146
|
+
messages: [{
|
|
147
|
+
role: "user",
|
|
148
|
+
content: (typeof parsed.prompt === "string" ? parsed.prompt : null) ?? (typeof parsed.text === "string" ? parsed.text : null) ?? ""
|
|
149
|
+
}],
|
|
150
|
+
_endpointType: "fal-audio"
|
|
151
|
+
};
|
|
152
|
+
const fixture = require_router.matchFixture(fixtures, syntheticReq, matchCounts, defaults.requestTransform);
|
|
153
|
+
if (!fixture) {
|
|
154
|
+
if (defaults.record) {
|
|
155
|
+
if (await require_recorder.proxyAndRecord(req, res, syntheticReq, "fal", pathname, fixtures, defaults, body)) {
|
|
156
|
+
journal.add({
|
|
157
|
+
method: req.method ?? "POST",
|
|
158
|
+
path: pathname,
|
|
159
|
+
headers: {},
|
|
160
|
+
body: syntheticReq,
|
|
161
|
+
response: {
|
|
162
|
+
status: res.statusCode ?? 200,
|
|
163
|
+
fixture: null
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const strictStatus = defaults.strict ? 503 : 404;
|
|
170
|
+
const strictMessage = defaults.strict ? "Strict mode: no fixture matched" : "No fixture matched";
|
|
171
|
+
journal.add({
|
|
172
|
+
method: req.method ?? "POST",
|
|
173
|
+
path: pathname,
|
|
174
|
+
headers: {},
|
|
175
|
+
body: syntheticReq,
|
|
176
|
+
response: {
|
|
177
|
+
status: strictStatus,
|
|
178
|
+
fixture: null
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
res.writeHead(strictStatus, { "Content-Type": "application/json" });
|
|
182
|
+
res.end(JSON.stringify({ error: {
|
|
183
|
+
message: strictMessage,
|
|
184
|
+
type: "invalid_request_error",
|
|
185
|
+
code: "no_fixture_match"
|
|
186
|
+
} }));
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
journal.incrementFixtureMatchCount(fixture, fixtures, testId);
|
|
190
|
+
const response = fixture.response;
|
|
191
|
+
if (require_helpers.isErrorResponse(response)) {
|
|
192
|
+
const status = response.status ?? 500;
|
|
193
|
+
journal.add({
|
|
194
|
+
method: req.method ?? "POST",
|
|
195
|
+
path: pathname,
|
|
196
|
+
headers: {},
|
|
197
|
+
body: syntheticReq,
|
|
198
|
+
response: {
|
|
199
|
+
status,
|
|
200
|
+
fixture
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
res.writeHead(status, { "Content-Type": "application/json" });
|
|
204
|
+
res.end(JSON.stringify(response));
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (!require_helpers.isAudioResponse(response)) {
|
|
208
|
+
journal.add({
|
|
209
|
+
method: req.method ?? "POST",
|
|
210
|
+
path: pathname,
|
|
211
|
+
headers: {},
|
|
212
|
+
body: syntheticReq,
|
|
213
|
+
response: {
|
|
214
|
+
status: 500,
|
|
215
|
+
fixture
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
219
|
+
res.end(JSON.stringify({ error: {
|
|
220
|
+
message: "Fixture response is not an audio type",
|
|
221
|
+
type: "server_error"
|
|
222
|
+
} }));
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const requestId = node_crypto.default.randomUUID();
|
|
226
|
+
const job = {
|
|
227
|
+
requestId,
|
|
228
|
+
modelId,
|
|
229
|
+
status: "COMPLETED",
|
|
230
|
+
result: audioToFalFile(response),
|
|
231
|
+
createdAt: Date.now()
|
|
232
|
+
};
|
|
233
|
+
const stateKey = `${testId}:${requestId}`;
|
|
234
|
+
falJobs.set(stateKey, job);
|
|
235
|
+
journal.add({
|
|
236
|
+
method: req.method ?? "POST",
|
|
237
|
+
path: pathname,
|
|
238
|
+
headers: {},
|
|
239
|
+
body: syntheticReq,
|
|
240
|
+
response: {
|
|
241
|
+
status: 200,
|
|
242
|
+
fixture
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
246
|
+
res.end(JSON.stringify({
|
|
247
|
+
request_id: requestId,
|
|
248
|
+
response_url: `https://queue.fal.run/${modelId}/requests/${requestId}/response`,
|
|
249
|
+
status_url: `https://queue.fal.run/${modelId}/requests/${requestId}/status`,
|
|
250
|
+
cancel_url: `https://queue.fal.run/${modelId}/requests/${requestId}/cancel`,
|
|
251
|
+
queue_position: 0
|
|
252
|
+
}));
|
|
253
|
+
}
|
|
254
|
+
function handleQueueStatus(req, res, pathname, requestId, testId, journal) {
|
|
255
|
+
const stateKey = `${testId}:${requestId}`;
|
|
256
|
+
const job = falJobs.get(stateKey);
|
|
257
|
+
if (!job) {
|
|
258
|
+
journal.add({
|
|
259
|
+
method: req.method ?? "GET",
|
|
260
|
+
path: pathname,
|
|
261
|
+
headers: {},
|
|
262
|
+
body: null,
|
|
263
|
+
response: {
|
|
264
|
+
status: 404,
|
|
265
|
+
fixture: null
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
res.writeHead(404, { "Content-Type": "application/json" });
|
|
269
|
+
res.end(JSON.stringify({ error: {
|
|
270
|
+
message: `Request ${requestId} not found`,
|
|
271
|
+
type: "not_found"
|
|
272
|
+
} }));
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
journal.add({
|
|
276
|
+
method: req.method ?? "GET",
|
|
277
|
+
path: pathname,
|
|
278
|
+
headers: {},
|
|
279
|
+
body: null,
|
|
280
|
+
response: {
|
|
281
|
+
status: 200,
|
|
282
|
+
fixture: null
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
286
|
+
res.end(JSON.stringify({
|
|
287
|
+
status: job.status,
|
|
288
|
+
request_id: job.requestId,
|
|
289
|
+
response_url: `https://queue.fal.run/${job.modelId}/requests/${requestId}/response`
|
|
290
|
+
}));
|
|
291
|
+
}
|
|
292
|
+
function handleQueueResult(req, res, pathname, requestId, testId, journal) {
|
|
293
|
+
const stateKey = `${testId}:${requestId}`;
|
|
294
|
+
const job = falJobs.get(stateKey);
|
|
295
|
+
if (!job) {
|
|
296
|
+
journal.add({
|
|
297
|
+
method: req.method ?? "GET",
|
|
298
|
+
path: pathname,
|
|
299
|
+
headers: {},
|
|
300
|
+
body: null,
|
|
301
|
+
response: {
|
|
302
|
+
status: 404,
|
|
303
|
+
fixture: null
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
res.writeHead(404, { "Content-Type": "application/json" });
|
|
307
|
+
res.end(JSON.stringify({ error: {
|
|
308
|
+
message: `Request ${requestId} not found`,
|
|
309
|
+
type: "not_found"
|
|
310
|
+
} }));
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
journal.add({
|
|
314
|
+
method: req.method ?? "GET",
|
|
315
|
+
path: pathname,
|
|
316
|
+
headers: {},
|
|
317
|
+
body: null,
|
|
318
|
+
response: {
|
|
319
|
+
status: 200,
|
|
320
|
+
fixture: null
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
324
|
+
res.end(JSON.stringify(job.result));
|
|
325
|
+
}
|
|
326
|
+
function handleQueueCancel(req, res, pathname, requestId, testId, journal) {
|
|
327
|
+
const stateKey = `${testId}:${requestId}`;
|
|
328
|
+
if (!falJobs.get(stateKey)) {
|
|
329
|
+
journal.add({
|
|
330
|
+
method: req.method ?? "DELETE",
|
|
331
|
+
path: pathname,
|
|
332
|
+
headers: {},
|
|
333
|
+
body: null,
|
|
334
|
+
response: {
|
|
335
|
+
status: 404,
|
|
336
|
+
fixture: null
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
res.writeHead(404, { "Content-Type": "application/json" });
|
|
340
|
+
res.end(JSON.stringify({ status: "NOT_FOUND" }));
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
journal.add({
|
|
344
|
+
method: req.method ?? "DELETE",
|
|
345
|
+
path: pathname,
|
|
346
|
+
headers: {},
|
|
347
|
+
body: null,
|
|
348
|
+
response: {
|
|
349
|
+
status: 400,
|
|
350
|
+
fixture: null
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
res.writeHead(400, { "Content-Type": "application/json" });
|
|
354
|
+
res.end(JSON.stringify({ status: "ALREADY_COMPLETED" }));
|
|
355
|
+
}
|
|
356
|
+
async function handleSyncRun(req, res, body, pathname, modelId, fixtures, defaults, matchCounts, journal) {
|
|
357
|
+
let parsed = {};
|
|
358
|
+
if (body.trim()) try {
|
|
359
|
+
parsed = JSON.parse(body);
|
|
360
|
+
} catch {
|
|
361
|
+
journal.add({
|
|
362
|
+
method: req.method ?? "POST",
|
|
363
|
+
path: pathname,
|
|
364
|
+
headers: {},
|
|
365
|
+
body: null,
|
|
366
|
+
response: {
|
|
367
|
+
status: 400,
|
|
368
|
+
fixture: null
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
res.writeHead(400, { "Content-Type": "application/json" });
|
|
372
|
+
res.end(JSON.stringify({ error: {
|
|
373
|
+
message: "Malformed JSON",
|
|
374
|
+
type: "invalid_request_error"
|
|
375
|
+
} }));
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
const syntheticReq = {
|
|
379
|
+
model: modelId,
|
|
380
|
+
messages: [{
|
|
381
|
+
role: "user",
|
|
382
|
+
content: (typeof parsed.prompt === "string" ? parsed.prompt : null) ?? (typeof parsed.text === "string" ? parsed.text : null) ?? ""
|
|
383
|
+
}],
|
|
384
|
+
_endpointType: "fal-audio"
|
|
385
|
+
};
|
|
386
|
+
const fixture = require_router.matchFixture(fixtures, syntheticReq, matchCounts, defaults.requestTransform);
|
|
387
|
+
if (!fixture) {
|
|
388
|
+
if (defaults.record) {
|
|
389
|
+
if (await require_recorder.proxyAndRecord(req, res, syntheticReq, "fal", pathname, fixtures, defaults, body)) {
|
|
390
|
+
journal.add({
|
|
391
|
+
method: req.method ?? "POST",
|
|
392
|
+
path: pathname,
|
|
393
|
+
headers: {},
|
|
394
|
+
body: syntheticReq,
|
|
395
|
+
response: {
|
|
396
|
+
status: res.statusCode ?? 200,
|
|
397
|
+
fixture: null
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
const strictStatus = defaults.strict ? 503 : 404;
|
|
404
|
+
const strictMessage = defaults.strict ? "Strict mode: no fixture matched" : "No fixture matched";
|
|
405
|
+
journal.add({
|
|
406
|
+
method: req.method ?? "POST",
|
|
407
|
+
path: pathname,
|
|
408
|
+
headers: {},
|
|
409
|
+
body: syntheticReq,
|
|
410
|
+
response: {
|
|
411
|
+
status: strictStatus,
|
|
412
|
+
fixture: null
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
res.writeHead(strictStatus, { "Content-Type": "application/json" });
|
|
416
|
+
res.end(JSON.stringify({ error: {
|
|
417
|
+
message: strictMessage,
|
|
418
|
+
type: "invalid_request_error",
|
|
419
|
+
code: "no_fixture_match"
|
|
420
|
+
} }));
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
journal.incrementFixtureMatchCount(fixture, fixtures, require_helpers.getTestId(req));
|
|
424
|
+
const response = fixture.response;
|
|
425
|
+
if (require_helpers.isErrorResponse(response)) {
|
|
426
|
+
const status = response.status ?? 500;
|
|
427
|
+
journal.add({
|
|
428
|
+
method: req.method ?? "POST",
|
|
429
|
+
path: pathname,
|
|
430
|
+
headers: {},
|
|
431
|
+
body: syntheticReq,
|
|
432
|
+
response: {
|
|
433
|
+
status,
|
|
434
|
+
fixture
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
res.writeHead(status, { "Content-Type": "application/json" });
|
|
438
|
+
res.end(JSON.stringify(response));
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
if (!require_helpers.isAudioResponse(response)) {
|
|
442
|
+
journal.add({
|
|
443
|
+
method: req.method ?? "POST",
|
|
444
|
+
path: pathname,
|
|
445
|
+
headers: {},
|
|
446
|
+
body: syntheticReq,
|
|
447
|
+
response: {
|
|
448
|
+
status: 500,
|
|
449
|
+
fixture
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
453
|
+
res.end(JSON.stringify({ error: {
|
|
454
|
+
message: "Fixture response is not an audio type",
|
|
455
|
+
type: "server_error"
|
|
456
|
+
} }));
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
const result = audioToFalFile(response);
|
|
460
|
+
journal.add({
|
|
461
|
+
method: req.method ?? "POST",
|
|
462
|
+
path: pathname,
|
|
463
|
+
headers: {},
|
|
464
|
+
body: syntheticReq,
|
|
465
|
+
response: {
|
|
466
|
+
status: 200,
|
|
467
|
+
fixture
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
471
|
+
res.end(JSON.stringify(result));
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
//#endregion
|
|
475
|
+
exports.falJobs = falJobs;
|
|
476
|
+
exports.handleFalQueue = handleFalQueue;
|
|
477
|
+
//# sourceMappingURL=fal-audio.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fal-audio.cjs","names":["FORMAT_TO_CONTENT_TYPE","getTestId","matchFixture","proxyAndRecord","isErrorResponse","isAudioResponse","crypto"],"sources":["../src/fal-audio.ts"],"sourcesContent":["import type http from \"node:http\";\nimport crypto from \"node:crypto\";\nimport type { AudioResponse, ChatCompletionRequest, Fixture, HandlerDefaults } from \"./types.js\";\nimport { isAudioResponse, isErrorResponse, FORMAT_TO_CONTENT_TYPE, getTestId } from \"./helpers.js\";\nimport { matchFixture } from \"./router.js\";\nimport { proxyAndRecord } from \"./recorder.js\";\nimport type { Journal } from \"./journal.js\";\n\n// ─── FalJobMap with TTL and size bound ───────────────────────────────────\n\nconst FAL_JOB_MAX_ENTRIES = 10_000;\nconst FAL_JOB_TTL_MS = 3_600_000; // 1 hour\n\ninterface FalJob {\n requestId: string;\n modelId: string;\n status: \"IN_QUEUE\" | \"IN_PROGRESS\" | \"COMPLETED\";\n result: Record<string, unknown> | null;\n createdAt: number;\n}\n\ninterface FalJobEntry {\n job: FalJob;\n createdAt: number;\n}\n\n/**\n * A Map wrapper for fal.ai queue jobs that enforces a maximum size and per-entry TTL.\n * Entries older than FAL_JOB_TTL_MS are lazily evicted on `get`.\n * When the map exceeds FAL_JOB_MAX_ENTRIES on `set`, the oldest entries\n * are removed to stay within bounds.\n */\nexport class FalJobMap {\n private readonly entries = new Map<string, FalJobEntry>();\n\n get(key: string): FalJob | undefined {\n const entry = this.entries.get(key);\n if (!entry) return undefined;\n if (Date.now() - entry.createdAt > FAL_JOB_TTL_MS) {\n this.entries.delete(key);\n return undefined;\n }\n return entry.job;\n }\n\n set(key: string, job: FalJob): void {\n this.entries.set(key, { job, createdAt: Date.now() });\n // Evict oldest entries if over capacity\n if (this.entries.size > FAL_JOB_MAX_ENTRIES) {\n const excess = this.entries.size - FAL_JOB_MAX_ENTRIES;\n const iter = this.entries.keys();\n for (let i = 0; i < excess; i++) {\n const next = iter.next();\n if (!next.done) this.entries.delete(next.value);\n }\n }\n }\n\n delete(key: string): boolean {\n return this.entries.delete(key);\n }\n\n clear(): void {\n this.entries.clear();\n }\n\n get size(): number {\n return this.entries.size;\n }\n}\n\n// Module-level singleton — exported so server.ts can clear it during reset\nexport const falJobs = new FalJobMap();\n\n// ─── Audio response translation ──────────────────────────────────────────\n\nfunction audioToFalFile(response: AudioResponse): Record<string, unknown> {\n let contentType: string;\n let data: string;\n\n if (typeof response.audio === \"string\") {\n data = response.audio;\n contentType = FORMAT_TO_CONTENT_TYPE[response.format ?? \"mp3\"] ?? \"audio/mpeg\";\n } else {\n data = response.audio.b64Json;\n contentType = response.audio.contentType ?? \"audio/mpeg\";\n }\n\n const ext =\n response.format ??\n (contentType !== \"audio/mpeg\"\n ? (Object.entries(FORMAT_TO_CONTENT_TYPE).find(([, v]) => v === contentType)?.[0] ?? \"mp3\")\n : \"mp3\");\n\n const fileSize =\n Math.ceil((data.length * 3) / 4) - (data.endsWith(\"==\") ? 2 : data.endsWith(\"=\") ? 1 : 0);\n\n return {\n audio: {\n url: `https://mock.fal.media/files/generated_audio.${ext}`,\n content_type: contentType,\n file_name: `generated_audio.${ext}`,\n file_size: fileSize,\n },\n };\n}\n\n// ─── Route patterns ──────────────────────────────────────────────────────\n\nconst QUEUE_SUBMIT_RE = /^\\/fal\\/queue\\/submit\\/(.+)$/;\nconst QUEUE_STATUS_RE = /^\\/fal\\/queue\\/requests\\/([^/]+)\\/status$/;\nconst QUEUE_RESULT_RE = /^\\/fal\\/queue\\/requests\\/([^/]+)$/;\nconst QUEUE_CANCEL_RE = /^\\/fal\\/queue\\/requests\\/([^/]+)\\/cancel$/;\nconst SYNC_RUN_RE = /^\\/fal\\/run\\/(.+)$/;\n\n// ─── Handler ─────────────────────────────────────────────────────────────\n\nexport async function handleFalQueue(\n req: http.IncomingMessage,\n res: http.ServerResponse,\n body: string,\n pathname: string,\n fixtures: Fixture[],\n defaults: HandlerDefaults,\n journal: Journal,\n): Promise<void> {\n const testId = getTestId(req);\n const matchCounts = journal.getFixtureMatchCountsForTest(testId);\n\n // ── Queue Submit ───────────────────────────────────────────────────\n const submitMatch = QUEUE_SUBMIT_RE.exec(pathname);\n if (submitMatch && req.method === \"POST\") {\n const modelId = submitMatch[1];\n return handleQueueSubmit(\n req,\n res,\n body,\n pathname,\n modelId,\n testId,\n fixtures,\n defaults,\n matchCounts,\n journal,\n );\n }\n\n // ── Queue Status ───────────────────────────────────────────────────\n const statusMatch = QUEUE_STATUS_RE.exec(pathname);\n if (statusMatch) {\n const requestId = statusMatch[1];\n return handleQueueStatus(req, res, pathname, requestId, testId, journal);\n }\n\n // ── Queue Cancel ───────────────────────────────────────────────────\n const cancelMatch = QUEUE_CANCEL_RE.exec(pathname);\n if (cancelMatch) {\n const requestId = cancelMatch[1];\n return handleQueueCancel(req, res, pathname, requestId, testId, journal);\n }\n\n // ── Queue Result ───────────────────────────────────────────────────\n const resultMatch = QUEUE_RESULT_RE.exec(pathname);\n if (resultMatch) {\n const requestId = resultMatch[1];\n return handleQueueResult(req, res, pathname, requestId, testId, journal);\n }\n\n // ── Synchronous Run ────────────────────────────────────────────────\n const runMatch = SYNC_RUN_RE.exec(pathname);\n if (runMatch && req.method === \"POST\") {\n const modelId = runMatch[1];\n return handleSyncRun(\n req,\n res,\n body,\n pathname,\n modelId,\n fixtures,\n defaults,\n matchCounts,\n journal,\n );\n }\n\n // Unknown fal path\n const errorBody = { error: { message: \"Unknown fal.ai endpoint\", type: \"not_found\" } };\n journal.add({\n method: req.method ?? \"GET\",\n path: pathname,\n headers: {},\n body: null,\n response: { status: 404, fixture: null },\n });\n res.writeHead(404, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify(errorBody));\n}\n\n// ─── Sub-handlers ────────────────────────────────────────────────────────\n\nasync function handleQueueSubmit(\n req: http.IncomingMessage,\n res: http.ServerResponse,\n body: string,\n pathname: string,\n modelId: string,\n testId: string,\n fixtures: Fixture[],\n defaults: HandlerDefaults,\n matchCounts: Map<Fixture, number>,\n journal: Journal,\n): Promise<void> {\n let parsed: Record<string, unknown> = {};\n if (body.trim()) {\n try {\n parsed = JSON.parse(body) as Record<string, unknown>;\n } catch {\n journal.add({\n method: req.method ?? \"POST\",\n path: pathname,\n headers: {},\n body: null,\n response: { status: 400, fixture: null },\n });\n res.writeHead(400, { \"Content-Type\": \"application/json\" });\n res.end(\n JSON.stringify({\n error: { message: \"Malformed JSON\", type: \"invalid_request_error\" },\n }),\n );\n return;\n }\n }\n\n const prompt =\n (typeof parsed.prompt === \"string\" ? parsed.prompt : null) ??\n (typeof parsed.text === \"string\" ? parsed.text : null) ??\n \"\";\n\n const syntheticReq: ChatCompletionRequest = {\n model: modelId,\n messages: [{ role: \"user\", content: prompt }],\n _endpointType: \"fal-audio\",\n };\n\n const fixture = matchFixture(fixtures, syntheticReq, matchCounts, defaults.requestTransform);\n\n if (!fixture) {\n if (defaults.record) {\n const proxied = await proxyAndRecord(\n req,\n res,\n syntheticReq,\n \"fal\",\n pathname,\n fixtures,\n defaults,\n body,\n );\n if (proxied) {\n journal.add({\n method: req.method ?? \"POST\",\n path: pathname,\n headers: {},\n body: syntheticReq,\n response: { status: res.statusCode ?? 200, fixture: null },\n });\n return;\n }\n }\n\n const strictStatus = defaults.strict ? 503 : 404;\n const strictMessage = defaults.strict\n ? \"Strict mode: no fixture matched\"\n : \"No fixture matched\";\n journal.add({\n method: req.method ?? \"POST\",\n path: pathname,\n headers: {},\n body: syntheticReq,\n response: { status: strictStatus, fixture: null },\n });\n res.writeHead(strictStatus, { \"Content-Type\": \"application/json\" });\n res.end(\n JSON.stringify({\n error: {\n message: strictMessage,\n type: \"invalid_request_error\",\n code: \"no_fixture_match\",\n },\n }),\n );\n return;\n }\n\n journal.incrementFixtureMatchCount(fixture, fixtures, testId);\n const response = fixture.response;\n\n if (isErrorResponse(response)) {\n const status = response.status ?? 500;\n journal.add({\n method: req.method ?? \"POST\",\n path: pathname,\n headers: {},\n body: syntheticReq,\n response: { status, fixture },\n });\n res.writeHead(status, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify(response));\n return;\n }\n\n if (!isAudioResponse(response)) {\n journal.add({\n method: req.method ?? \"POST\",\n path: pathname,\n headers: {},\n body: syntheticReq,\n response: { status: 500, fixture },\n });\n res.writeHead(500, { \"Content-Type\": \"application/json\" });\n res.end(\n JSON.stringify({\n error: { message: \"Fixture response is not an audio type\", type: \"server_error\" },\n }),\n );\n return;\n }\n\n const requestId = crypto.randomUUID();\n const result = audioToFalFile(response);\n\n const job: FalJob = {\n requestId,\n modelId,\n status: \"COMPLETED\",\n result,\n createdAt: Date.now(),\n };\n\n const stateKey = `${testId}:${requestId}`;\n falJobs.set(stateKey, job);\n\n journal.add({\n method: req.method ?? \"POST\",\n path: pathname,\n headers: {},\n body: syntheticReq,\n response: { status: 200, fixture },\n });\n res.writeHead(200, { \"Content-Type\": \"application/json\" });\n res.end(\n JSON.stringify({\n request_id: requestId,\n response_url: `https://queue.fal.run/${modelId}/requests/${requestId}/response`,\n status_url: `https://queue.fal.run/${modelId}/requests/${requestId}/status`,\n cancel_url: `https://queue.fal.run/${modelId}/requests/${requestId}/cancel`,\n queue_position: 0,\n }),\n );\n}\n\nfunction handleQueueStatus(\n req: http.IncomingMessage,\n res: http.ServerResponse,\n pathname: string,\n requestId: string,\n testId: string,\n journal: Journal,\n): void {\n const stateKey = `${testId}:${requestId}`;\n const job = falJobs.get(stateKey);\n\n if (!job) {\n journal.add({\n method: req.method ?? \"GET\",\n path: pathname,\n headers: {},\n body: null,\n response: { status: 404, fixture: null },\n });\n res.writeHead(404, { \"Content-Type\": \"application/json\" });\n res.end(\n JSON.stringify({\n error: { message: `Request ${requestId} not found`, type: \"not_found\" },\n }),\n );\n return;\n }\n\n journal.add({\n method: req.method ?? \"GET\",\n path: pathname,\n headers: {},\n body: null,\n response: { status: 200, fixture: null },\n });\n res.writeHead(200, { \"Content-Type\": \"application/json\" });\n res.end(\n JSON.stringify({\n status: job.status,\n request_id: job.requestId,\n response_url: `https://queue.fal.run/${job.modelId}/requests/${requestId}/response`,\n }),\n );\n}\n\nfunction handleQueueResult(\n req: http.IncomingMessage,\n res: http.ServerResponse,\n pathname: string,\n requestId: string,\n testId: string,\n journal: Journal,\n): void {\n const stateKey = `${testId}:${requestId}`;\n const job = falJobs.get(stateKey);\n\n if (!job) {\n journal.add({\n method: req.method ?? \"GET\",\n path: pathname,\n headers: {},\n body: null,\n response: { status: 404, fixture: null },\n });\n res.writeHead(404, { \"Content-Type\": \"application/json\" });\n res.end(\n JSON.stringify({\n error: { message: `Request ${requestId} not found`, type: \"not_found\" },\n }),\n );\n return;\n }\n\n journal.add({\n method: req.method ?? \"GET\",\n path: pathname,\n headers: {},\n body: null,\n response: { status: 200, fixture: null },\n });\n res.writeHead(200, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify(job.result));\n}\n\nfunction handleQueueCancel(\n req: http.IncomingMessage,\n res: http.ServerResponse,\n pathname: string,\n requestId: string,\n testId: string,\n journal: Journal,\n): void {\n const stateKey = `${testId}:${requestId}`;\n const job = falJobs.get(stateKey);\n\n if (!job) {\n journal.add({\n method: req.method ?? \"DELETE\",\n path: pathname,\n headers: {},\n body: null,\n response: { status: 404, fixture: null },\n });\n res.writeHead(404, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify({ status: \"NOT_FOUND\" }));\n return;\n }\n\n // Since we complete immediately, cancellation always returns ALREADY_COMPLETED\n journal.add({\n method: req.method ?? \"DELETE\",\n path: pathname,\n headers: {},\n body: null,\n response: { status: 400, fixture: null },\n });\n res.writeHead(400, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify({ status: \"ALREADY_COMPLETED\" }));\n}\n\nasync function handleSyncRun(\n req: http.IncomingMessage,\n res: http.ServerResponse,\n body: string,\n pathname: string,\n modelId: string,\n fixtures: Fixture[],\n defaults: HandlerDefaults,\n matchCounts: Map<Fixture, number>,\n journal: Journal,\n): Promise<void> {\n let parsed: Record<string, unknown> = {};\n if (body.trim()) {\n try {\n parsed = JSON.parse(body) as Record<string, unknown>;\n } catch {\n journal.add({\n method: req.method ?? \"POST\",\n path: pathname,\n headers: {},\n body: null,\n response: { status: 400, fixture: null },\n });\n res.writeHead(400, { \"Content-Type\": \"application/json\" });\n res.end(\n JSON.stringify({\n error: { message: \"Malformed JSON\", type: \"invalid_request_error\" },\n }),\n );\n return;\n }\n }\n\n const prompt =\n (typeof parsed.prompt === \"string\" ? parsed.prompt : null) ??\n (typeof parsed.text === \"string\" ? parsed.text : null) ??\n \"\";\n\n const syntheticReq: ChatCompletionRequest = {\n model: modelId,\n messages: [{ role: \"user\", content: prompt }],\n _endpointType: \"fal-audio\",\n };\n\n const fixture = matchFixture(fixtures, syntheticReq, matchCounts, defaults.requestTransform);\n\n if (!fixture) {\n if (defaults.record) {\n const proxied = await proxyAndRecord(\n req,\n res,\n syntheticReq,\n \"fal\",\n pathname,\n fixtures,\n defaults,\n body,\n );\n if (proxied) {\n journal.add({\n method: req.method ?? \"POST\",\n path: pathname,\n headers: {},\n body: syntheticReq,\n response: { status: res.statusCode ?? 200, fixture: null },\n });\n return;\n }\n }\n\n const strictStatus = defaults.strict ? 503 : 404;\n const strictMessage = defaults.strict\n ? \"Strict mode: no fixture matched\"\n : \"No fixture matched\";\n journal.add({\n method: req.method ?? \"POST\",\n path: pathname,\n headers: {},\n body: syntheticReq,\n response: { status: strictStatus, fixture: null },\n });\n res.writeHead(strictStatus, { \"Content-Type\": \"application/json\" });\n res.end(\n JSON.stringify({\n error: {\n message: strictMessage,\n type: \"invalid_request_error\",\n code: \"no_fixture_match\",\n },\n }),\n );\n return;\n }\n\n journal.incrementFixtureMatchCount(fixture, fixtures, getTestId(req));\n const response = fixture.response;\n\n if (isErrorResponse(response)) {\n const status = response.status ?? 500;\n journal.add({\n method: req.method ?? \"POST\",\n path: pathname,\n headers: {},\n body: syntheticReq,\n response: { status, fixture },\n });\n res.writeHead(status, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify(response));\n return;\n }\n\n if (!isAudioResponse(response)) {\n journal.add({\n method: req.method ?? \"POST\",\n path: pathname,\n headers: {},\n body: syntheticReq,\n response: { status: 500, fixture },\n });\n res.writeHead(500, { \"Content-Type\": \"application/json\" });\n res.end(\n JSON.stringify({\n error: { message: \"Fixture response is not an audio type\", type: \"server_error\" },\n }),\n );\n return;\n }\n\n const result = audioToFalFile(response);\n\n journal.add({\n method: req.method ?? \"POST\",\n path: pathname,\n headers: {},\n body: syntheticReq,\n response: { status: 200, fixture },\n });\n res.writeHead(200, { \"Content-Type\": \"application/json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nE,MAAI,IACF,KAAK,UAAU,EACb,OAAO;GACL,SAAS;GACT,MAAM;GACN,MAAM;GACP,EACF,CAAC,CACH;AACD;;AAGF,SAAQ,2BAA2B,SAAS,UAAUF,0BAAU,IAAI,CAAC;CACrE,MAAM,WAAW,QAAQ;AAEzB,KAAIG,gCAAgB,SAAS,EAAE;EAC7B,MAAM,SAAS,SAAS,UAAU;AAClC,UAAQ,IAAI;GACV,QAAQ,IAAI,UAAU;GACtB,MAAM;GACN,SAAS,EAAE;GACX,MAAM;GACN,UAAU;IAAE;IAAQ;IAAS;GAC9B,CAAC;AACF,MAAI,UAAU,QAAQ,EAAE,gBAAgB,oBAAoB,CAAC;AAC7D,MAAI,IAAI,KAAK,UAAU,SAAS,CAAC;AACjC;;AAGF,KAAI,CAACC,gCAAgB,SAAS,EAAE;AAC9B,UAAQ,IAAI;GACV,QAAQ,IAAI,UAAU;GACtB,MAAM;GACN,SAAS,EAAE;GACX,MAAM;GACN,UAAU;IAAE,QAAQ;IAAK;IAAS;GACnC,CAAC;AACF,MAAI,UAAU,KAAK,EAAE,gBAAgB,oBAAoB,CAAC;AAC1D,MAAI,IACF,KAAK,UAAU,EACb,OAAO;GAAE,SAAS;GAAyC,MAAM;GAAgB,EAClF,CAAC,CACH;AACD;;CAGF,MAAM,SAAS,eAAe,SAAS;AAEvC,SAAQ,IAAI;EACV,QAAQ,IAAI,UAAU;EACtB,MAAM;EACN,SAAS,EAAE;EACX,MAAM;EACN,UAAU;GAAE,QAAQ;GAAK;GAAS;EACnC,CAAC;AACF,KAAI,UAAU,KAAK,EAAE,gBAAgB,oBAAoB,CAAC;AAC1D,KAAI,IAAI,KAAK,UAAU,OAAO,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Journal } from "./journal.cjs";
|
|
2
|
+
import { Fixture, HandlerDefaults } from "./types.cjs";
|
|
3
|
+
import http from "node:http";
|
|
4
|
+
|
|
5
|
+
//#region src/fal-audio.d.ts
|
|
6
|
+
|
|
7
|
+
declare function handleFalQueue(req: http.IncomingMessage, res: http.ServerResponse, body: string, pathname: string, fixtures: Fixture[], defaults: HandlerDefaults, journal: Journal): Promise<void>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { handleFalQueue };
|
|
10
|
+
//# sourceMappingURL=fal-audio.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fal-audio.d.cts","names":[],"sources":["../src/fal-audio.ts"],"sourcesContent":[],"mappings":";;;;;;iBAqHsB,cAAA,MACf,IAAA,CAAK,sBACL,IAAA,CAAK,0DAGA,qBACA,0BACD,UACR"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Journal } from "./journal.js";
|
|
2
|
+
import { Fixture, HandlerDefaults } from "./types.js";
|
|
3
|
+
import http from "node:http";
|
|
4
|
+
|
|
5
|
+
//#region src/fal-audio.d.ts
|
|
6
|
+
|
|
7
|
+
declare function handleFalQueue(req: http.IncomingMessage, res: http.ServerResponse, body: string, pathname: string, fixtures: Fixture[], defaults: HandlerDefaults, journal: Journal): Promise<void>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { handleFalQueue };
|
|
10
|
+
//# sourceMappingURL=fal-audio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fal-audio.d.ts","names":[],"sources":["../src/fal-audio.ts"],"sourcesContent":[],"mappings":";;;;;;iBAqHsB,cAAA,MACf,IAAA,CAAK,sBACL,IAAA,CAAK,0DAGA,qBACA,0BACD,UACR"}
|