@lingjingai/scriptctl 0.63.2 → 0.63.3
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 +1 -1
- package/changes/0.63.3.md +5 -0
- package/dist/bin.js +114 -13
- package/dist/bin.js.map +3 -3
- package/dist/llm/router.d.ts +3 -2
- package/dist/llm/router.js +90 -13
- package/dist/llm/router.js.map +1 -1
- package/package.json +1 -1
- package/skills/scriptctl/SKILL.md +4 -0
- package/skills/scriptctl/references/ingest-workflow.md +4 -3
- package/dist/cli/register-batch.d.ts +0 -3
- package/dist/cli/register-batch.js +0 -28
- package/dist/cli/register-batch.js.map +0 -1
- package/dist/cli/register-edits.d.ts +0 -4
- package/dist/cli/register-edits.js +0 -234
- package/dist/cli/register-edits.js.map +0 -1
- package/dist/cli/register-query.d.ts +0 -4
- package/dist/cli/register-query.js +0 -95
- package/dist/cli/register-query.js.map +0 -1
- package/dist/infra/llm/doubao-video-model.d.ts +0 -56
- package/dist/infra/llm/doubao-video-model.js +0 -231
- package/dist/infra/llm/doubao-video-model.js.map +0 -1
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { commandActions } from "../usecases/script/actions.js";
|
|
2
|
-
import { commandActors } from "../usecases/script/actors.js";
|
|
3
|
-
import { commandAssets } from "../usecases/script/assets.js";
|
|
4
|
-
import { commandAuditAssets } from "../usecases/script/audit-assets.js";
|
|
5
|
-
import { commandEpisodes } from "../usecases/script/episodes.js";
|
|
6
|
-
import { commandIds } from "../usecases/script/ids.js";
|
|
7
|
-
import { commandIssues } from "../usecases/script/issues.js";
|
|
8
|
-
import { commandLocations } from "../usecases/script/locations.js";
|
|
9
|
-
import { commandProps } from "../usecases/script/props.js";
|
|
10
|
-
import { commandRefs } from "../usecases/script/refs.js";
|
|
11
|
-
import { commandScenes } from "../usecases/script/scenes.js";
|
|
12
|
-
import { commandScriptValidate } from "../usecases/script/script-validate.js";
|
|
13
|
-
import { commandStates } from "../usecases/script/states.js";
|
|
14
|
-
import { commandSummary } from "../usecases/script/summary.js";
|
|
15
|
-
import { describeArguments, dispatch, withScriptOpts } from "./registry.js";
|
|
16
|
-
export function registerQueryCommands(program, state, llm) {
|
|
17
|
-
withScriptOpts(program.command("summary"), "read")
|
|
18
|
-
.description("Show a compact script summary")
|
|
19
|
-
.action(dispatch(commandSummary, state));
|
|
20
|
-
withScriptOpts(program.command("episodes"), "read")
|
|
21
|
-
.description("List episodes")
|
|
22
|
-
.option("--id <id>", "Filter by episode ID")
|
|
23
|
-
.option("-i, --in <addr>", "Limit results to an address")
|
|
24
|
-
.option("--min-chars <n>", "Minimum episode character count")
|
|
25
|
-
.option("--max-chars <n>", "Maximum episode character count")
|
|
26
|
-
.action(dispatch(commandEpisodes, state));
|
|
27
|
-
withScriptOpts(program.command("scenes"), "read")
|
|
28
|
-
.description("List scenes")
|
|
29
|
-
.option("-i, --in <addr>", "Limit results to an address")
|
|
30
|
-
.option("--has-actor <id>", "Require an actor reference")
|
|
31
|
-
.option("--has-location <id>", "Require a location reference")
|
|
32
|
-
.option("--has-prop <id>", "Require a prop reference")
|
|
33
|
-
.action(dispatch(commandScenes, state));
|
|
34
|
-
withScriptOpts(program.command("actions"), "read")
|
|
35
|
-
.description("List actions")
|
|
36
|
-
.option("-i, --in <addr>", "Limit results to an address or range")
|
|
37
|
-
.option("-g, --grep <text>", "Match action text")
|
|
38
|
-
.option("-t, --type <type>", "Filter by action type")
|
|
39
|
-
.option("-a, --actor <id>", "Filter by actor ID")
|
|
40
|
-
.option("--has <kind>", "Require a populated action facet")
|
|
41
|
-
.option("--time <time-or-range>", "Match an episode-local timestamp or closed range")
|
|
42
|
-
.option("--context <n>", "Include surrounding actions")
|
|
43
|
-
.option("--span", "Collapse selected Actions to one episode-local timestamp span")
|
|
44
|
-
.addHelpText("after", "\nExamples:\n scriptctl actions --in ep_001/scn_001 --grep \"door\"\n scriptctl actions --in @ep:1 --time 00:30..00:45\n scriptctl actions --in 'acStart..acEnd' --span\n")
|
|
45
|
-
.action(dispatch(commandActions, state));
|
|
46
|
-
for (const [name, description, handler] of [
|
|
47
|
-
["actors", "List actors", commandActors],
|
|
48
|
-
["locations", "List locations", commandLocations],
|
|
49
|
-
["props", "List props", commandProps],
|
|
50
|
-
]) {
|
|
51
|
-
withScriptOpts(program.command(name), "read")
|
|
52
|
-
.description(description)
|
|
53
|
-
.option("--id <id>", `Filter ${name} by ID`)
|
|
54
|
-
.option("--name <text>", `Filter ${name} by name`)
|
|
55
|
-
.option("-i, --in <addr>", "Limit results to an address")
|
|
56
|
-
.option("--counts", "Include reference counts")
|
|
57
|
-
.action(dispatch(handler, state));
|
|
58
|
-
}
|
|
59
|
-
withScriptOpts(program.command("assets"), "read")
|
|
60
|
-
.description("List actors, locations, and props")
|
|
61
|
-
.option("-k, --kind <kind>", "Filter by asset kind")
|
|
62
|
-
.option("--id <id>", "Filter by asset ID")
|
|
63
|
-
.option("--name <text>", "Filter by asset name")
|
|
64
|
-
.option("-i, --in <addr>", "Limit results to an address")
|
|
65
|
-
.option("--counts", "Include reference counts")
|
|
66
|
-
.action(dispatch(commandAssets, state));
|
|
67
|
-
const states = withScriptOpts(program.command("states <asset-addr>"), "read")
|
|
68
|
-
.description("List states for an asset")
|
|
69
|
-
.action(dispatch(commandStates, state));
|
|
70
|
-
describeArguments(states, ["Actor, location, or prop address"]);
|
|
71
|
-
withScriptOpts(program.command("issues"), "read")
|
|
72
|
-
.description("List validation issues")
|
|
73
|
-
.option("--severity <severity>", "Filter by severity")
|
|
74
|
-
.option("--code <code>", "Filter by issue code")
|
|
75
|
-
.action(dispatch(commandIssues, state));
|
|
76
|
-
const refs = withScriptOpts(program.command("refs <addr>"), "read")
|
|
77
|
-
.description("List references to an address")
|
|
78
|
-
.option("--level <level>", "Reference detail level")
|
|
79
|
-
.action(dispatch(commandRefs, state));
|
|
80
|
-
describeArguments(refs, ["Address to inspect"]);
|
|
81
|
-
withScriptOpts(program.command("validate"), "read")
|
|
82
|
-
.description("Validate the script")
|
|
83
|
-
.action(dispatch(commandScriptValidate, state));
|
|
84
|
-
withScriptOpts(program.command("audit-assets"), "read")
|
|
85
|
-
.description("Audit asset consistency with an LLM")
|
|
86
|
-
.option("--llm-config <path>", "LLM configuration file")
|
|
87
|
-
.option("-o, --output <path>", "Audit JSON output file")
|
|
88
|
-
.action(dispatch((options) => commandAuditAssets(options, llm), state));
|
|
89
|
-
withScriptOpts(program.command("ids"), "read")
|
|
90
|
-
.description("Generate unreserved candidate IDs")
|
|
91
|
-
.requiredOption("-k, --kind <kind>", "ID kind")
|
|
92
|
-
.requiredOption("--count <n>", "Number of IDs")
|
|
93
|
-
.action(dispatch(commandIds, state));
|
|
94
|
-
}
|
|
95
|
-
//# sourceMappingURL=register-query.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register-query.js","sourceRoot":"","sources":["../../src/cli/register-query.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM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AAqB,EAAE,KAAK,CAAC,CAAC,CAAC;IAElD,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;SACpD,WAAW,CAAC,qCAAqC,CAAC;SAClD,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC;SACvD,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC;SACvD,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IAE1E,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;SAC3C,WAAW,CAAC,mCAAmC,CAAC;SAChD,cAAc,CAAC,mBAAmB,EAAE,SAAS,CAAC;SAC9C,cAAc,CAAC,aAAa,EAAE,eAAe,CAAC;SAC9C,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { type JsonSchema, type VideoGenerationResponse } from "../../llm/types.js";
|
|
2
|
-
export interface ArkResponse {
|
|
3
|
-
status?: string;
|
|
4
|
-
incomplete_details?: {
|
|
5
|
-
reason?: string;
|
|
6
|
-
};
|
|
7
|
-
output?: Array<{
|
|
8
|
-
type?: string;
|
|
9
|
-
content?: Array<{
|
|
10
|
-
type?: string;
|
|
11
|
-
text?: string;
|
|
12
|
-
}>;
|
|
13
|
-
}>;
|
|
14
|
-
usage?: {
|
|
15
|
-
input_tokens?: number;
|
|
16
|
-
output_tokens?: number;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export interface ArkFile {
|
|
20
|
-
id?: string;
|
|
21
|
-
status?: string;
|
|
22
|
-
}
|
|
23
|
-
export interface ArkClient {
|
|
24
|
-
uploadFile(params: {
|
|
25
|
-
filePath: string;
|
|
26
|
-
mimeType: string;
|
|
27
|
-
fps: number;
|
|
28
|
-
}): Promise<ArkFile>;
|
|
29
|
-
getFile(params: {
|
|
30
|
-
id: string;
|
|
31
|
-
}): Promise<ArkFile>;
|
|
32
|
-
createResponse(params: Record<string, unknown>, signal?: AbortSignal): Promise<ArkResponse>;
|
|
33
|
-
deleteFile(params: {
|
|
34
|
-
id: string;
|
|
35
|
-
}): Promise<void>;
|
|
36
|
-
}
|
|
37
|
-
export interface DoubaoRunRequest {
|
|
38
|
-
localPath: string;
|
|
39
|
-
localMime: string;
|
|
40
|
-
system?: string;
|
|
41
|
-
user: string;
|
|
42
|
-
fps: number;
|
|
43
|
-
maxOutputTokens: number;
|
|
44
|
-
responseJsonSchema?: JsonSchema;
|
|
45
|
-
signal?: AbortSignal;
|
|
46
|
-
}
|
|
47
|
-
export declare class DoubaoVideoModel {
|
|
48
|
-
private readonly model;
|
|
49
|
-
private readonly timeoutMs;
|
|
50
|
-
private readonly maxAttempts;
|
|
51
|
-
private readonly client;
|
|
52
|
-
constructor(model: string, timeoutMs: number, maxAttempts: number, apiKey: string, baseUrl: string, client?: ArkClient);
|
|
53
|
-
run(request: DoubaoRunRequest): Promise<VideoGenerationResponse>;
|
|
54
|
-
private pollActive;
|
|
55
|
-
private generateOnce;
|
|
56
|
-
}
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
// Doubao / Volcengine Ark video-understanding adapter — the LAST-resort fallback
|
|
2
|
-
// after the Gemini model chain is exhausted (§10.5). Ark is a different protocol:
|
|
3
|
-
// the Files API sets sampling fps at UPLOAD time (preprocess_configs[video][fps]),
|
|
4
|
-
// then the Responses API references the file by id. So this adapter can't fit the
|
|
5
|
-
// upload/generate split of VideoUnderstandingPort cleanly — it exposes one
|
|
6
|
-
// self-contained run(): upload the local transcode → poll ACTIVE → respond →
|
|
7
|
-
// best-effort delete. Transport only; it never builds business prompts. HTTP is
|
|
8
|
-
// reached through a narrow structural client so tests inject a fake.
|
|
9
|
-
import * as fs from "node:fs";
|
|
10
|
-
import * as path from "node:path";
|
|
11
|
-
import { File } from "node:buffer";
|
|
12
|
-
import { Agent, fetch, FormData } from "undici";
|
|
13
|
-
import { LlmTransportError, } from "../../llm/types.js";
|
|
14
|
-
import { httpError, httpStatusOf, networkError } from "./failure-mapping.js";
|
|
15
|
-
import { addTokenUsage, withTransientRetry } from "./retry.js";
|
|
16
|
-
const POLL_INTERVAL_MS = 2000;
|
|
17
|
-
function delay(ms) {
|
|
18
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
19
|
-
}
|
|
20
|
-
// Map an SDK/HTTP error to a transport error with the shared retry policy: retry
|
|
21
|
-
// only transient network/timeout/408/429/5xx.
|
|
22
|
-
function toArkError(error, signal, what, model) {
|
|
23
|
-
if (error instanceof LlmTransportError)
|
|
24
|
-
return error;
|
|
25
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
26
|
-
const status = httpStatusOf(error);
|
|
27
|
-
const context = { provider: "doubao", model, operation: what };
|
|
28
|
-
if (status !== null) {
|
|
29
|
-
return httpError(status, `Doubao ${what} failed.`, message.slice(0, 500), context);
|
|
30
|
-
}
|
|
31
|
-
return networkError(error, signal, `Doubao ${what} failed.`, message.slice(0, 500), context);
|
|
32
|
-
}
|
|
33
|
-
function arkUsage(u) {
|
|
34
|
-
if (!u)
|
|
35
|
-
return {};
|
|
36
|
-
const num = (v) => (typeof v === "number" ? v : undefined);
|
|
37
|
-
return { inputTokens: num(u.input_tokens), outputTokens: num(u.output_tokens) };
|
|
38
|
-
}
|
|
39
|
-
// Concatenate every output_text across message items (reasoning items carry no
|
|
40
|
-
// output_text, so they are naturally skipped).
|
|
41
|
-
function extractText(res) {
|
|
42
|
-
const parts = [];
|
|
43
|
-
for (const item of res.output ?? []) {
|
|
44
|
-
if (item.type !== "message")
|
|
45
|
-
continue;
|
|
46
|
-
for (const c of item.content ?? []) {
|
|
47
|
-
if (c.type === "output_text" && typeof c.text === "string")
|
|
48
|
-
parts.push(c.text);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return parts.join("").trim();
|
|
52
|
-
}
|
|
53
|
-
export class DoubaoVideoModel {
|
|
54
|
-
model;
|
|
55
|
-
timeoutMs;
|
|
56
|
-
maxAttempts;
|
|
57
|
-
client;
|
|
58
|
-
constructor(model, timeoutMs, maxAttempts, apiKey, baseUrl, client) {
|
|
59
|
-
this.model = model;
|
|
60
|
-
this.timeoutMs = timeoutMs;
|
|
61
|
-
this.maxAttempts = maxAttempts;
|
|
62
|
-
this.client = client ?? createArkClient(apiKey, baseUrl, timeoutMs);
|
|
63
|
-
}
|
|
64
|
-
// upload local transcode → poll ACTIVE → respond → best-effort delete.
|
|
65
|
-
async run(request) {
|
|
66
|
-
const { value: file } = await withTransientRetry(this.maxAttempts, async () => {
|
|
67
|
-
try {
|
|
68
|
-
return await this.client.uploadFile({ filePath: request.localPath, mimeType: request.localMime, fps: request.fps });
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
throw toArkError(error, request.signal, "upload", this.model);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
if (!file.id)
|
|
75
|
-
throw new LlmTransportError("invalid_response", "Doubao upload returned no file id.");
|
|
76
|
-
const active = await this.pollActive(file.id, request.signal);
|
|
77
|
-
try {
|
|
78
|
-
return await this.generateOnce(active, request);
|
|
79
|
-
}
|
|
80
|
-
finally {
|
|
81
|
-
await this.client.deleteFile({ id: active }).catch(() => { }); // cleanup is best-effort
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
async pollActive(id, signal) {
|
|
85
|
-
const deadline = Date.now() + this.timeoutMs;
|
|
86
|
-
let status = "processing";
|
|
87
|
-
while (status === "processing" || status === "") {
|
|
88
|
-
if (signal?.aborted) {
|
|
89
|
-
throw new LlmTransportError("cancelled", "Doubao upload aborted.", {
|
|
90
|
-
context: { provider: "doubao", model: this.model, operation: "file_poll" },
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
if (Date.now() >= deadline) {
|
|
94
|
-
throw new LlmTransportError("timeout", "Doubao file processing timed out.", {
|
|
95
|
-
retryable: true,
|
|
96
|
-
classification: { failure_type: "timeout", failure_code: "media_processing_timeout" },
|
|
97
|
-
context: { provider: "doubao", model: this.model, operation: "file_poll" },
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
await delay(POLL_INTERVAL_MS);
|
|
101
|
-
let file;
|
|
102
|
-
try {
|
|
103
|
-
file = await this.client.getFile({ id });
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
throw toArkError(error, signal, "file_poll", this.model);
|
|
107
|
-
}
|
|
108
|
-
status = (file.status ?? "").toLowerCase();
|
|
109
|
-
}
|
|
110
|
-
if (status === "failed" || status === "error") {
|
|
111
|
-
throw new LlmTransportError("invalid_response", "Doubao file processing failed.", {
|
|
112
|
-
classification: { failure_type: "media", failure_code: "media_processing_failed" },
|
|
113
|
-
context: { provider: "doubao", model: this.model, operation: "file_poll" },
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
return id;
|
|
117
|
-
}
|
|
118
|
-
async generateOnce(fileId, request) {
|
|
119
|
-
const params = {
|
|
120
|
-
model: this.model,
|
|
121
|
-
max_output_tokens: request.maxOutputTokens,
|
|
122
|
-
input: [{ role: "user", content: [
|
|
123
|
-
{ type: "input_video", file_id: fileId },
|
|
124
|
-
{ type: "input_text", text: request.user },
|
|
125
|
-
] }],
|
|
126
|
-
};
|
|
127
|
-
if (request.system?.trim())
|
|
128
|
-
params["instructions"] = request.system;
|
|
129
|
-
if (request.responseJsonSchema) {
|
|
130
|
-
params["text"] = { format: { type: "json_schema", name: "video_serial", schema: request.responseJsonSchema } };
|
|
131
|
-
}
|
|
132
|
-
const { value, attempts, failedUsage } = await withTransientRetry(this.maxAttempts, async () => {
|
|
133
|
-
let res;
|
|
134
|
-
try {
|
|
135
|
-
res = await this.client.createResponse(params, request.signal);
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
throw toArkError(error, request.signal, "generate", this.model);
|
|
139
|
-
}
|
|
140
|
-
const status = (res.status ?? "").toLowerCase();
|
|
141
|
-
const usage = arkUsage(res.usage);
|
|
142
|
-
if (status === "incomplete") {
|
|
143
|
-
const reason = res.incomplete_details?.reason ?? "unknown";
|
|
144
|
-
if (reason === "max_output_tokens")
|
|
145
|
-
throw new LlmTransportError("truncated", "Doubao output was truncated.", { usage });
|
|
146
|
-
throw new LlmTransportError("content_filtered", `Doubao response incomplete (reason=${reason}).`, { usage });
|
|
147
|
-
}
|
|
148
|
-
const text = extractText(res);
|
|
149
|
-
if (!text)
|
|
150
|
-
throw new LlmTransportError("empty_response", "Doubao returned an empty response.", { retryable: true, usage });
|
|
151
|
-
if (request.responseJsonSchema) {
|
|
152
|
-
try {
|
|
153
|
-
JSON.parse(text);
|
|
154
|
-
}
|
|
155
|
-
catch {
|
|
156
|
-
throw new LlmTransportError("invalid_response", "Doubao returned malformed JSON for a structured video response.", {
|
|
157
|
-
retryable: true,
|
|
158
|
-
usage,
|
|
159
|
-
context: { provider: "doubao", model: this.model, operation: "generate" },
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return { text, usage, raw: res };
|
|
164
|
-
});
|
|
165
|
-
return { text: value.text, finishReason: "STOP", attempts, usage: addTokenUsage(failedUsage, value.usage), raw: value.raw };
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
// Real HTTP client over the Ark REST API using global fetch (Node 18+). No SDK
|
|
169
|
-
// dependency — the surface is tiny (4 calls) and multipart upload is trivial.
|
|
170
|
-
class HttpError extends Error {
|
|
171
|
-
status;
|
|
172
|
-
constructor(status, message) {
|
|
173
|
-
super(message);
|
|
174
|
-
this.status = status;
|
|
175
|
-
this.name = "HttpError";
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
function createArkClient(apiKey, baseUrl, timeoutMs) {
|
|
179
|
-
const root = baseUrl.replace(/\/$/, "");
|
|
180
|
-
const auth = { Authorization: `Bearer ${apiKey}` };
|
|
181
|
-
// Node's global fetch uses Undici's 5-minute response-header timeout even
|
|
182
|
-
// when the AbortSignal allows a longer model request. Ark video responses
|
|
183
|
-
// can legitimately take longer, so keep the transport deadline aligned with
|
|
184
|
-
// the provider timeout instead of failing every retry at exactly 5 minutes.
|
|
185
|
-
const dispatcher = new Agent({ headersTimeout: timeoutMs, bodyTimeout: timeoutMs });
|
|
186
|
-
function signalFor(extra) {
|
|
187
|
-
const timeout = AbortSignal.timeout(timeoutMs);
|
|
188
|
-
return extra ? AbortSignal.any([extra, timeout]) : timeout;
|
|
189
|
-
}
|
|
190
|
-
async function readError(res) {
|
|
191
|
-
const body = await res.text().catch(() => "");
|
|
192
|
-
throw new HttpError(res.status, body.slice(0, 500));
|
|
193
|
-
}
|
|
194
|
-
return {
|
|
195
|
-
async uploadFile({ filePath, mimeType, fps }) {
|
|
196
|
-
const form = new FormData();
|
|
197
|
-
const bytes = fs.readFileSync(filePath);
|
|
198
|
-
form.append("file", new File([bytes], path.basename(filePath), { type: mimeType }));
|
|
199
|
-
form.append("purpose", "user_data");
|
|
200
|
-
form.append("preprocess_configs[video][fps]", String(fps));
|
|
201
|
-
const res = await fetch(`${root}/files`, { method: "POST", headers: auth, body: form, signal: signalFor(), dispatcher });
|
|
202
|
-
if (!res.ok)
|
|
203
|
-
await readError(res);
|
|
204
|
-
return (await res.json());
|
|
205
|
-
},
|
|
206
|
-
async getFile({ id }) {
|
|
207
|
-
const res = await fetch(`${root}/files/${id}`, { headers: auth, signal: signalFor(), dispatcher });
|
|
208
|
-
if (!res.ok)
|
|
209
|
-
await readError(res);
|
|
210
|
-
return (await res.json());
|
|
211
|
-
},
|
|
212
|
-
async createResponse(params, signal) {
|
|
213
|
-
const res = await fetch(`${root}/responses`, {
|
|
214
|
-
method: "POST",
|
|
215
|
-
headers: { ...auth, "Content-Type": "application/json" },
|
|
216
|
-
body: JSON.stringify(params),
|
|
217
|
-
signal: signalFor(signal),
|
|
218
|
-
dispatcher,
|
|
219
|
-
});
|
|
220
|
-
if (!res.ok)
|
|
221
|
-
await readError(res);
|
|
222
|
-
return (await res.json());
|
|
223
|
-
},
|
|
224
|
-
async deleteFile({ id }) {
|
|
225
|
-
const res = await fetch(`${root}/files/${id}`, { method: "DELETE", headers: auth, signal: signalFor(), dispatcher });
|
|
226
|
-
if (!res.ok)
|
|
227
|
-
await readError(res);
|
|
228
|
-
},
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
//# sourceMappingURL=doubao-video-model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"doubao-video-model.js","sourceRoot":"","sources":["../../../src/infra/llm/doubao-video-model.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,kFAAkF;AAClF,mFAAmF;AACnF,kFAAkF;AAClF,2EAA2E;AAC3E,6EAA6E;AAC7E,gFAAgF;AAChF,qEAAqE;AAErE,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,EACL,iBAAiB,GAIlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAwB/D,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,iFAAiF;AACjF,8CAA8C;AAC9C,SAAS,UAAU,CAAC,KAAc,EAAE,MAA+B,EAAE,IAAY,EAAE,KAAa;IAC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