maoda-commander-tt 0.0.73 → 0.0.75
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 +35 -3
- package/dist/{chunk-P5FMG34Z.js → chunk-C2AFDDQW.js} +27 -33
- package/dist/chunk-C2AFDDQW.js.map +1 -0
- package/dist/{chunk-HJSXXJQA.js → chunk-HC46BQKK.js} +1172 -570
- package/dist/chunk-HC46BQKK.js.map +1 -0
- package/dist/{chunk-2VUM57PV.js → chunk-SOAX67WJ.js} +68 -6
- package/dist/chunk-SOAX67WJ.js.map +1 -0
- package/dist/codex-worker-main.js +1 -1
- package/dist/image-worker-main.js +33 -5
- package/dist/image-worker-main.js.map +1 -1
- package/dist/index.d.ts +76 -1
- package/dist/index.js +13 -3
- package/dist/main.js +3 -3
- package/dist/traex-worker-main.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2VUM57PV.js.map +0 -1
- package/dist/chunk-HJSXXJQA.js.map +0 -1
- package/dist/chunk-P5FMG34Z.js.map +0 -1
package/README.md
CHANGED
|
@@ -106,6 +106,35 @@ tt tool get-config example.key
|
|
|
106
106
|
保留其他配置。无效文件或检测到写入冲突时失败并保留原内容。成功返回 key、configured、
|
|
107
107
|
revision,不回显 value。
|
|
108
108
|
|
|
109
|
+
## 云端 KV
|
|
110
|
+
|
|
111
|
+
`tt kv` 读写 imaoda.com 上的键值数据。每条记录由 `scope + key` 定位,scope 必填,
|
|
112
|
+
通过 `tt kv scopes` 查询当前可用列表;key 区分大小写,原样保留。当前接口无需登录,
|
|
113
|
+
仅用于非敏感数据。各命令同步等待服务端响应,单次请求超时 10 秒,不自动重试。
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
tt kv scopes
|
|
117
|
+
tt kv get test preferences
|
|
118
|
+
tt kv set test greeting '"hello"'
|
|
119
|
+
tt kv set test preferences '{"theme":"dark","enabled":true}'
|
|
120
|
+
tt kv set -- test delta -2.5
|
|
121
|
+
tt kv set test preferences --file ./preferences.json
|
|
122
|
+
printf '%s' '{"enabled":true}' | tt kv set test preferences --file -
|
|
123
|
+
tt kv delete test preferences
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
`set` 的位置参数 value 和 `--file` 必须且只能提供一种,内容一律是 JSON;文件使用
|
|
127
|
+
UTF-8,`--file -` 从管道或重定向 stdin 读取至 EOF。支持字符串、有限数字、布尔、
|
|
128
|
+
数组和对象,不猜测文本类型。顶层 `null` 被拒绝,对象和数组内部可包含 `null`。
|
|
129
|
+
缺少输入或解析失败时不发送请求。以 `-` 开头的位置参数(如负数)放在 `--` 后,
|
|
130
|
+
选项放在 `--` 前。写入完整替换原值,不合并对象,也不做并发版本检查。
|
|
131
|
+
|
|
132
|
+
`scopes` 返回 `data.scopes` 字符串数组。`get` 返回 scope、key、exists,存在时包含
|
|
133
|
+
保持原始 JSON 类型的 value;键不存在时 `exists=false`、无 value,code 和退出码均为 0。
|
|
134
|
+
`set` / `delete` 成功只返回 scope、key,表示服务端已确认操作;删除直接执行,不询问
|
|
135
|
+
确认,键原本不存在也成功。写入或删除结果无法确认时,错误带 `outcome=unconfirmed`,
|
|
136
|
+
并提供 `nextCommand` 读取核对当前状态,不能据此断言之前的请求未执行。
|
|
137
|
+
|
|
109
138
|
## 抖音视频解析
|
|
110
139
|
|
|
111
140
|
`tt pippit douyin-video '<抖音链接或完整分享文案>'` 返回解析后的视频地址。
|
|
@@ -472,6 +501,9 @@ loopback HTTP 除外),客户端不跟随重定向,以免将 token 发送
|
|
|
472
501
|
图片、音频与视频统一采用异步提交:默认返回 `taskId`,`status` 单次查询,
|
|
473
502
|
`wait` 等待已有任务,`--output` 隐含 `--wait`。生成是否成功以 `data.state` 为准,
|
|
474
503
|
不能只看查询命令的 `code=0`;超时返回 `data.timedOut=true`,不会取消生成。
|
|
504
|
+
`--timeout-seconds` 限制等待状态的时间(包括查询请求),不包含提交与产物保存。
|
|
505
|
+
超时保留最后一次查询到的状态;首次查询尚未返回时为 `unknown`,可以用同一
|
|
506
|
+
`taskId` 继续查询,不代表生成失败或已停止。
|
|
475
507
|
|
|
476
508
|
提交返回 `taskId`、当前 `state`、`outputs` 和适用时的 `nextCommand`。
|
|
477
509
|
后续查询或等待直接复用返回的完整 `taskId`。
|
|
@@ -502,13 +534,13 @@ tt ai image list
|
|
|
502
534
|
提示词按顺序以“图1、图2”引用。
|
|
503
535
|
|
|
504
536
|
支持模型参数的生成方式默认使用 `gpt_image_2_5_sunburst`;其他生成方式忽略
|
|
505
|
-
`--model-id`、`--effort` 和 `--resolution
|
|
506
|
-
|
|
537
|
+
`--model-id`、`--effort` 和 `--resolution`。image2.5 支持 `--resolution 1k|2k|4k`,
|
|
538
|
+
其他模型保持 `2k|4k`;默认仍为 `2k`,参数值区分大小写。已知模型的 effort 范围如下:
|
|
507
539
|
|
|
508
540
|
| `--model-id` | `--effort` 可选值 | 默认 effort |
|
|
509
541
|
| --- | --- | --- |
|
|
510
542
|
| `gpt_image_2`(image2) | `medium`、`high` | `high` |
|
|
511
|
-
| `gpt_image_2_5_sunburst`(image2.5 Sunburst,默认模型) | `high`、`xhigh`、`max` | `xhigh` |
|
|
543
|
+
| `gpt_image_2_5_sunburst`(image2.5 Sunburst,默认模型) | `low`、`medium`、`high`、`xhigh`、`max` | `xhigh` |
|
|
512
544
|
| `seedream5.0pro`(Seedream 5.0 Pro) | 不支持;显式传入时报错 | 无 |
|
|
513
545
|
|
|
514
546
|
其他图片模型 ID 允许透传,其 effort 不校验,省略时沿用 `medium`。
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
classifyHttpFailure,
|
|
3
|
+
classifySystemFailure,
|
|
4
|
+
readFailureFacts
|
|
5
|
+
} from "./chunk-SOAX67WJ.js";
|
|
6
|
+
|
|
1
7
|
// src/modules/image-generation/image-task-store.ts
|
|
2
8
|
import * as fs from "node:fs/promises";
|
|
3
9
|
import { homedir } from "node:os";
|
|
@@ -88,9 +94,12 @@ function resolveMediaRecovery(facts, context) {
|
|
|
88
94
|
return { recoverable: true, retry: "after_delay", instruction: "\u8BF7\u6C42\u53D7\u5230\u9650\u6D41\uFF1B\u7A0D\u540E\u91CD\u8BD5" };
|
|
89
95
|
case "network":
|
|
90
96
|
case "server":
|
|
97
|
+
case "timeout":
|
|
91
98
|
return context.operation === "submit" && facts.requestOutcome !== "not_sent" && facts.requestOutcome !== "rejected" ? {} : { recoverable: true, retry: "after_delay", instruction: context.operation === "query" ? "\u7A0D\u540E\u91CD\u8BD5\u540C\u4E00\u4EFB\u52A1\u7684\u72B6\u6001\u67E5\u8BE2" : "\u7A0D\u540E\u91CD\u8BD5\u5F53\u524D\u64CD\u4F5C" };
|
|
92
99
|
case "aborted":
|
|
93
100
|
return { instruction: "\u64CD\u4F5C\u5DF2\u53D6\u6D88\uFF1B\u786E\u8BA4\u662F\u5426\u9700\u8981\u7EE7\u7EED\u540E\u518D\u8C03\u7528" };
|
|
101
|
+
case "io":
|
|
102
|
+
return { instruction: "\u672C\u5730\u6587\u4EF6\u64CD\u4F5C\u5931\u8D25\uFF1B\u6839\u636E\u7CFB\u7EDF\u9519\u8BEF\u7801\u68C0\u67E5\u76EE\u6807\u8DEF\u5F84\u3001\u6743\u9650\u6216\u53EF\u7528\u7A7A\u95F4" };
|
|
94
103
|
case "rejected":
|
|
95
104
|
return { instruction: "\u4F9B\u5E94\u5546\u660E\u786E\u62D2\u7EDD\u4E86\u8BF7\u6C42\uFF1B\u6839\u636E\u8FD4\u56DE\u539F\u56E0\u5904\u7406\u540E\u518D\u51B3\u5B9A\u662F\u5426\u91CD\u8BD5" };
|
|
96
105
|
case "response":
|
|
@@ -100,35 +109,16 @@ function resolveMediaRecovery(facts, context) {
|
|
|
100
109
|
}
|
|
101
110
|
}
|
|
102
111
|
function classifyMediaHttpFailure(status) {
|
|
103
|
-
|
|
104
|
-
return {
|
|
105
|
-
failureKind,
|
|
106
|
-
httpStatus: status,
|
|
107
|
-
requestOutcome: status >= 400 && status < 500 && status !== 408 ? "rejected" : "unknown"
|
|
108
|
-
};
|
|
112
|
+
return classifyHttpFailure(status);
|
|
109
113
|
}
|
|
110
|
-
var FAILURE_KINDS = [
|
|
111
|
-
"input",
|
|
112
|
-
"settings",
|
|
113
|
-
"auth",
|
|
114
|
-
"permission",
|
|
115
|
-
"not_found",
|
|
116
|
-
"rate_limit",
|
|
117
|
-
"network",
|
|
118
|
-
"server",
|
|
119
|
-
"response",
|
|
120
|
-
"rejected",
|
|
121
|
-
"aborted",
|
|
122
|
-
"unknown"
|
|
123
|
-
];
|
|
124
114
|
function readMediaFailureFacts(errorInfo) {
|
|
125
|
-
if (
|
|
126
|
-
const
|
|
115
|
+
if (!isRecord(errorInfo)) return {};
|
|
116
|
+
const cause = isRecord(errorInfo.cause) ? errorInfo.cause : {};
|
|
117
|
+
const facts = { ...readFailureFacts(cause), ...readFailureFacts(errorInfo) };
|
|
118
|
+
const providerCode = errorInfo.providerCode ?? cause.providerCode;
|
|
127
119
|
return {
|
|
128
|
-
...
|
|
129
|
-
...
|
|
130
|
-
...typeof info.httpStatus === "number" ? { httpStatus: info.httpStatus } : {},
|
|
131
|
-
...typeof info.providerCode === "number" || typeof info.providerCode === "string" ? { providerCode: info.providerCode } : {}
|
|
120
|
+
...facts,
|
|
121
|
+
...typeof providerCode === "number" || typeof providerCode === "string" ? { providerCode } : {}
|
|
132
122
|
};
|
|
133
123
|
}
|
|
134
124
|
var RECOVERY_FIELDS = ["recoverable", "retry", "instruction", "retryAfterSeconds"];
|
|
@@ -141,9 +131,11 @@ var RETRY_DIRECTIVES = [
|
|
|
141
131
|
"never"
|
|
142
132
|
];
|
|
143
133
|
function readMediaRecovery(errorInfo) {
|
|
144
|
-
if (
|
|
145
|
-
const
|
|
146
|
-
|
|
134
|
+
if (!isRecord(errorInfo)) return void 0;
|
|
135
|
+
const hasDirectRecovery = RECOVERY_FIELDS.some((field) => Object.hasOwn(errorInfo, field));
|
|
136
|
+
const hasNestedRecovery = !hasDirectRecovery && isRecord(errorInfo.recovery);
|
|
137
|
+
const info = hasDirectRecovery ? errorInfo : isRecord(errorInfo.recovery) ? errorInfo.recovery : errorInfo;
|
|
138
|
+
if (!hasNestedRecovery && !RECOVERY_FIELDS.some((field) => Object.hasOwn(info, field))) return void 0;
|
|
147
139
|
return {
|
|
148
140
|
...typeof info.recoverable === "boolean" ? { recoverable: info.recoverable } : {},
|
|
149
141
|
...RETRY_DIRECTIVES.includes(info.retry) ? { retry: info.retry } : {},
|
|
@@ -151,6 +143,9 @@ function readMediaRecovery(errorInfo) {
|
|
|
151
143
|
...typeof info.retryAfterSeconds === "number" ? { retryAfterSeconds: info.retryAfterSeconds } : {}
|
|
152
144
|
};
|
|
153
145
|
}
|
|
146
|
+
function isRecord(value) {
|
|
147
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
148
|
+
}
|
|
154
149
|
function canResumeMediaTask(recovery) {
|
|
155
150
|
return recovery.recoverable === true && (recovery.retry === "resume" || recovery.retry === "after_delay");
|
|
156
151
|
}
|
|
@@ -245,9 +240,8 @@ async function copyImageArtifact(source, destination) {
|
|
|
245
240
|
await fs2.rename(temporary, output);
|
|
246
241
|
return ok(output);
|
|
247
242
|
} catch (error) {
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
return err(1, `\u590D\u5236\u56FE\u7247\u4EA7\u7269\u5931\u8D25: ${error instanceof Error ? error.message : String(error)}`, {
|
|
243
|
+
const facts = classifySystemFailure(error, { source: "filesystem" });
|
|
244
|
+
return err(1, `\u590D\u5236\u56FE\u7247\u4EA7\u7269\u5931\u8D25${facts.systemCode ? ` (${facts.systemCode})` : ""}`, {
|
|
251
245
|
...facts,
|
|
252
246
|
...resolveMediaRecovery(facts, { operation: "download" })
|
|
253
247
|
});
|
|
@@ -324,4 +318,4 @@ export {
|
|
|
324
318
|
isImageWorkerAlive,
|
|
325
319
|
startImageWorkerHealth
|
|
326
320
|
};
|
|
327
|
-
//# sourceMappingURL=chunk-
|
|
321
|
+
//# sourceMappingURL=chunk-C2AFDDQW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/modules/image-generation/image-task-store.ts","../src/modules/image-generation/image-artifact.ts","../src/modules/media-generation/media-error-recovery.ts","../src/modules/image-generation/image-worker-health.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport * as path from \"node:path\";\nimport { randomUUID } from \"node:crypto\";\nimport { Disposable } from \"rockbed/dispose\";\nimport type { IImageTaskRecord } from \"./image-task-types\";\n\nexport const DEFAULT_IMAGE_TASK_DIRECTORY = path.join(homedir(), \".tt\", \"ai\", \"image-tasks\");\nconst TASK_ID_PATTERN = /^local-image:([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})$/;\n\nexport class ImageTaskStore extends Disposable {\n public readonly directory: string;\n\n public constructor(directory: string = DEFAULT_IMAGE_TASK_DIRECTORY) {\n super();\n this.directory = path.resolve(directory);\n }\n\n public taskDirectory(taskId: string): string {\n const match = TASK_ID_PATTERN.exec(taskId);\n if (!match) throw new Error(\"图片 task-id 格式必须是 local-image:<uuid>\");\n return path.join(this.directory, match[1]);\n }\n\n public artifactPath(taskId: string): string { return path.join(this.taskDirectory(taskId), \"image.png\"); }\n public stagingPath(taskId: string): string { return path.join(this.taskDirectory(taskId), \"generated.png\"); }\n\n public async create(record: IImageTaskRecord): Promise<void> {\n await fs.mkdir(this.directory, { recursive: true, mode: 0o700 });\n await fs.mkdir(this.taskDirectory(record.taskId), { mode: 0o700 });\n await this.write(record);\n }\n\n public async write(record: IImageTaskRecord): Promise<void> {\n const directory = this.taskDirectory(record.taskId);\n const temporary = path.join(directory, `.task-${randomUUID()}.tmp`);\n try {\n const handle = await fs.open(temporary, \"wx\", 0o600);\n try { await handle.writeFile(JSON.stringify(record)); await handle.sync(); }\n finally { await handle.close(); }\n await fs.rename(temporary, path.join(directory, \"task.json\"));\n } finally { await fs.rm(temporary, { force: true }).catch(() => undefined); }\n }\n\n public async read(taskId: string): Promise<IImageTaskRecord> {\n const record: IImageTaskRecord = JSON.parse(await fs.readFile(path.join(this.taskDirectory(taskId), \"task.json\"), \"utf8\"));\n if (record.schemaVersion !== 1 || record.taskId !== taskId || typeof record.workerId !== \"string\"\n || typeof record.prompt !== \"string\" || ![\"submitted\", \"working\", \"completed\", \"failed\", \"unknown\"].includes(record.state)) {\n throw new Error(\"图片任务记录格式无效\");\n }\n return record;\n }\n\n public async taskIds(): Promise<readonly string[]> {\n try {\n return (await fs.readdir(this.directory, { withFileTypes: true }))\n .filter((entry) => entry.isDirectory() && TASK_ID_PATTERN.test(`local-image:${entry.name}`))\n .map((entry) => `local-image:${entry.name}`);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return [];\n throw error;\n }\n }\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { randomUUID } from \"node:crypto\";\nimport { inflateSync } from \"node:zlib\";\nimport { err, ok, type Result } from \"rockbed/error\";\nimport { classifySystemFailure } from \"../../bedrock/failure-facts\";\nimport { resolveMediaRecovery } from \"../media-generation/media-error-recovery\";\n\nconst PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);\nconst MAX_IMAGE_BYTES = 128 * 1024 * 1024;\nconst MAX_DECODED_BYTES = 256 * 1024 * 1024;\nconst CRC_TABLE = Array.from({ length: 256 }, (_, index) => {\n let value = index;\n for (let bit = 0; bit < 8; bit++) value = (value >>> 1) ^ ((value & 1) ? 0xedb88320 : 0);\n return value >>> 0;\n});\n\n/** Validate the entire PNG container and scanline payload before publishing it. */\nexport async function validateImageArtifact(filePath: string): Promise<Result<void>> {\n try {\n const stat = await fs.stat(filePath);\n if (!stat.isFile() || stat.size === 0 || stat.size > MAX_IMAGE_BYTES) throw new Error(\"图片文件为空、过大或不是普通文件\");\n const bytes = await fs.readFile(filePath);\n if (!bytes.subarray(0, 8).equals(PNG_SIGNATURE)) throw new Error(\"图片不是有效 PNG 文件\");\n let offset = 8;\n let width = 0;\n let height = 0;\n let bitDepth = 0;\n let colorType = -1;\n let interlace = -1;\n let ended = false;\n let palette = false;\n let pixelsEnded = false;\n const compressed: Buffer[] = [];\n while (offset < bytes.length) {\n if (offset + 12 > bytes.length) throw new Error(\"PNG 数据截断\");\n const length = bytes.readUInt32BE(offset);\n if (length > bytes.length - offset - 12) throw new Error(\"PNG 数据截断\");\n const type = bytes.toString(\"ascii\", offset + 4, offset + 8);\n const chunk = bytes.subarray(offset + 8, offset + 8 + length);\n if (crc32(bytes.subarray(offset + 4, offset + 8 + length)) !== bytes.readUInt32BE(offset + 8 + length)) throw new Error(\"PNG 校验和错误\");\n if (offset === 8 && type !== \"IHDR\") throw new Error(\"PNG 缺少头部\");\n if (type === \"IHDR\") {\n if (offset !== 8 || length !== 13) throw new Error(\"PNG 头部无效\");\n width = chunk.readUInt32BE(0); height = chunk.readUInt32BE(4);\n bitDepth = chunk[8]; colorType = chunk[9]; interlace = chunk[12];\n const depths: Record<number, readonly number[]> = { 0: [1, 2, 4, 8, 16], 2: [8, 16], 3: [1, 2, 4, 8], 4: [8, 16], 6: [8, 16] };\n if (!width || !height || width > 100_000 || height > 100_000 || !depths[colorType]?.includes(bitDepth)\n || chunk[10] !== 0 || chunk[11] !== 0 || interlace > 1) throw new Error(\"PNG 图像参数无效\");\n } else if (type === \"PLTE\") {\n if (palette || compressed.length > 0 || length === 0 || length % 3 !== 0 || length > 768 || colorType === 0 || colorType === 4) throw new Error(\"PNG 调色板无效\");\n palette = true;\n } else if (type === \"IDAT\") {\n if (pixelsEnded || (colorType === 3 && !palette)) throw new Error(\"PNG 像素块顺序无效\");\n compressed.push(chunk);\n }\n else if (type === \"IEND\") {\n if (length !== 0 || offset + 12 !== bytes.length) throw new Error(\"PNG 结束标记无效\");\n ended = true;\n } else if ((bytes[offset + 4] & 32) === 0) throw new Error(\"PNG 包含未知关键数据块\");\n if (compressed.length > 0 && type !== \"IDAT\") pixelsEnded = true;\n offset += length + 12;\n }\n if (!ended || compressed.length === 0) throw new Error(\"PNG 不完整\");\n const channels = ({ 0: 1, 2: 3, 3: 1, 4: 2, 6: 4 } as Record<number, number>)[colorType];\n const passes = interlace === 0 ? [[0, 0, 1, 1]] : [[0, 0, 8, 8], [4, 0, 8, 8], [0, 4, 4, 8], [2, 0, 4, 4], [0, 2, 2, 4], [1, 0, 2, 2], [0, 1, 1, 2]];\n const rows = passes.map(([x, y, dx, dy]) => {\n const columns = Math.max(0, Math.ceil((width - x) / dx));\n return { count: columns ? Math.max(0, Math.ceil((height - y) / dy)) : 0, size: 1 + Math.ceil(columns * channels * bitDepth / 8) };\n });\n const expected = rows.reduce((total, row) => total + row.count * row.size, 0);\n if (expected > MAX_DECODED_BYTES) throw new Error(\"PNG 解码数据过大\");\n const decoded = inflateSync(Buffer.concat(compressed), { maxOutputLength: MAX_DECODED_BYTES });\n if (decoded.length !== expected) throw new Error(\"PNG 像素数据长度无效\");\n let position = 0;\n for (const row of rows) {\n for (let index = 0; index < row.count; index++) {\n if (decoded[position] > 4) throw new Error(\"PNG 扫描行无效\");\n position += row.size;\n }\n }\n return ok();\n } catch (error) { return err(1, error instanceof Error ? error.message : String(error)); }\n}\n\nexport async function copyImageArtifact(source: string, destination: string): Promise<Result<string>> {\n const output = path.resolve(destination);\n if (path.resolve(source) === output) return ok(output);\n const temporary = path.join(path.dirname(output), `.${path.basename(output)}.${randomUUID()}.tmp`);\n try {\n await fs.mkdir(path.dirname(output), { recursive: true });\n await fs.copyFile(source, temporary);\n const valid = await validateImageArtifact(temporary);\n if (!valid.ok) return valid;\n await fs.rename(temporary, output);\n return ok(output);\n } catch (error) {\n const facts = classifySystemFailure(error, { source: \"filesystem\" });\n return err(1, `复制图片产物失败${facts.systemCode ? ` (${facts.systemCode})` : \"\"}`, {\n ...facts, ...resolveMediaRecovery(facts, { operation: \"download\" }),\n });\n }\n finally { await fs.rm(temporary, { force: true }).catch(() => undefined); }\n}\n\nfunction crc32(bytes: Buffer): number {\n let crc = 0xffffffff;\n for (const byte of bytes) crc = (crc >>> 8) ^ CRC_TABLE[(crc ^ byte) & 255];\n return (crc ^ 0xffffffff) >>> 0;\n}\n","import { classifyHttpFailure, readFailureFacts, type IFailureFacts, type TFailureKind } from \"../../bedrock/failure-facts\";\n\n/** Transport facts are shared with bedrock; provider codes belong to the media boundary. */\nexport type TMediaFailureKind = TFailureKind;\n\nexport interface IMediaFailureFacts extends IFailureFacts {\n readonly providerCode?: string | number;\n}\n\nexport interface IMediaRecovery {\n readonly recoverable?: boolean;\n readonly retry?: \"immediate\" | \"after_delay\" | \"after_input_change\" | \"after_settings_change\" | \"resume\" | \"never\";\n readonly instruction?: string;\n readonly retryAfterSeconds?: number;\n}\n\nexport interface IMediaRecoveryContext {\n readonly operation: \"submit\" | \"query\" | \"upload\" | \"download\" | \"setup\";\n readonly taskId?: string;\n}\n\n/** Missing advice means unknown; it does not mean an operation is safe to repeat. */\nexport function resolveMediaRecovery(facts: IMediaFailureFacts, context: IMediaRecoveryContext): IMediaRecovery {\n if (context.operation === \"submit\" && facts.requestOutcome === \"unknown\") {\n return context.taskId\n ? { recoverable: true, retry: \"resume\", instruction: \"提交结果不确定;先查询同一 taskId,确认任务状态后再决定是否重新提交\" }\n : { instruction: \"提交结果不确定且没有可查询的 taskId;先核对供应商任务记录,确认是否受理,避免重复生成\" };\n }\n switch (facts.failureKind) {\n case \"input\":\n return { recoverable: true, retry: \"after_input_change\", instruction: \"修正错误指出的输入或参考文件后重试\" };\n case \"settings\":\n return { recoverable: true, retry: \"after_settings_change\", instruction: \"修复错误指出的配置后重试\" };\n case \"auth\":\n return { recoverable: true, retry: \"after_settings_change\", instruction: \"更新登录态后重试\" };\n case \"permission\":\n return { instruction: \"操作被拒绝访问;先确认目标资源的访问权限\" };\n case \"not_found\":\n return { instruction: \"目标资源不存在;先核对资源标识或文件路径\" };\n case \"rate_limit\":\n return { recoverable: true, retry: \"after_delay\", instruction: \"请求受到限流;稍后重试\" };\n case \"network\":\n case \"server\":\n case \"timeout\":\n // A generic submit error without a known outcome is insufficient evidence\n // to recommend another potentially billable generation request.\n return context.operation === \"submit\" && facts.requestOutcome !== \"not_sent\" && facts.requestOutcome !== \"rejected\"\n ? {}\n : { recoverable: true, retry: \"after_delay\", instruction: context.operation === \"query\" ? \"稍后重试同一任务的状态查询\" : \"稍后重试当前操作\" };\n case \"aborted\":\n return { instruction: \"操作已取消;确认是否需要继续后再调用\" };\n case \"io\":\n return { instruction: \"本地文件操作失败;根据系统错误码检查目标路径、权限或可用空间\" };\n case \"rejected\":\n return { instruction: \"供应商明确拒绝了请求;根据返回原因处理后再决定是否重试\" };\n case \"response\":\n case \"unknown\":\n default:\n return {};\n }\n}\n\nexport function classifyMediaHttpFailure(status: number): IMediaFailureFacts {\n return classifyHttpFailure(status);\n}\n\nexport function readMediaFailureFacts(errorInfo: unknown): IMediaFailureFacts {\n if (!isRecord(errorInfo)) return {};\n // Video wraps facts in cause; other media retain them directly. Only allowlisted\n // facts cross this boundary, never arbitrary transport errors or response bodies.\n const cause = isRecord(errorInfo.cause) ? errorInfo.cause : {};\n const facts = { ...readFailureFacts(cause), ...readFailureFacts(errorInfo) };\n const providerCode = errorInfo.providerCode ?? cause.providerCode;\n return {\n ...facts,\n ...(typeof providerCode === \"number\" || typeof providerCode === \"string\" ? { providerCode } : {}),\n };\n}\n\nconst RECOVERY_FIELDS = [\"recoverable\", \"retry\", \"instruction\", \"retryAfterSeconds\"] as const;\nconst RETRY_DIRECTIVES: readonly NonNullable<IMediaRecovery[\"retry\"]>[] = [\n \"immediate\", \"after_delay\", \"after_input_change\", \"after_settings_change\", \"resume\", \"never\",\n];\n\n/** A partial explicit decision is authoritative as a group; missing fields remain unspecified. */\nexport function readMediaRecovery(errorInfo: unknown): IMediaRecovery | undefined {\n if (!isRecord(errorInfo)) return undefined;\n const hasDirectRecovery = RECOVERY_FIELDS.some((field) => Object.hasOwn(errorInfo, field));\n const hasNestedRecovery = !hasDirectRecovery && isRecord(errorInfo.recovery);\n const info = hasDirectRecovery\n ? errorInfo\n : isRecord(errorInfo.recovery) ? errorInfo.recovery : errorInfo;\n if (!hasNestedRecovery && !RECOVERY_FIELDS.some((field) => Object.hasOwn(info, field))) return undefined;\n return {\n ...(typeof info.recoverable === \"boolean\" ? { recoverable: info.recoverable } : {}),\n ...(RETRY_DIRECTIVES.includes(info.retry as NonNullable<IMediaRecovery[\"retry\"]>)\n ? { retry: info.retry as NonNullable<IMediaRecovery[\"retry\"]> } : {}),\n ...(typeof info.instruction === \"string\" ? { instruction: info.instruction } : {}),\n ...(typeof info.retryAfterSeconds === \"number\" ? { retryAfterSeconds: info.retryAfterSeconds } : {}),\n };\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** Continuing an existing task must be explicitly supported by recovery advice. */\nexport function canResumeMediaTask(recovery: IMediaRecovery): boolean {\n return recovery.recoverable === true && (recovery.retry === \"resume\" || recovery.retry === \"after_delay\");\n}\n","import { createConnection, createServer, type Server } from \"node:net\";\nimport type { IImageTaskRecord } from \"./image-task-types\";\n\n/** A live endpoint authenticated by this attempt's nonce avoids PID reuse ambiguity. */\nexport async function isImageWorkerAlive(record: IImageTaskRecord): Promise<boolean> {\n if (!record.healthPort) return false;\n return new Promise((resolve) => {\n const socket = createConnection({ host: \"127.0.0.1\", port: record.healthPort! });\n let received = \"\";\n const finish = (alive: boolean): void => { socket.destroy(); resolve(alive); };\n socket.setTimeout(750, () => finish(false));\n socket.on(\"error\", () => finish(false));\n socket.on(\"connect\", () => socket.write(`${record.workerId}\\n`));\n socket.on(\"data\", (chunk: Buffer) => {\n received += chunk.toString();\n if (received.includes(\"\\n\")) finish(received.trim() === `${record.taskId}:${record.workerId}`);\n else if (received.length > 256) finish(false);\n });\n socket.on(\"end\", () => finish(false));\n });\n}\n\nexport function startImageWorkerHealth(record: IImageTaskRecord): Promise<{ server: Server; port: number }> {\n return new Promise((resolve, reject) => {\n const server = createServer((socket) => {\n let received = \"\";\n socket.setTimeout(1000, () => socket.destroy());\n socket.on(\"error\", () => socket.destroy());\n socket.on(\"data\", (chunk: Buffer) => {\n received += chunk.toString();\n if (received.includes(\"\\n\")) {\n if (received.trim() === record.workerId) socket.end(`${record.taskId}:${record.workerId}\\n`);\n else socket.destroy();\n } else if (received.length > 128) socket.destroy();\n });\n });\n server.once(\"error\", reject);\n server.listen(0, \"127.0.0.1\", () => {\n const address = server.address();\n if (!address || typeof address === \"string\") { server.close(); reject(new Error(\"worker 状态监听失败\")); return; }\n resolve({ server, port: address.port });\n });\n });\n}\n"],"mappings":";;;;;;;AAAA,YAAY,QAAQ;AACpB,SAAS,eAAe;AACxB,YAAY,UAAU;AACtB,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAGpB,IAAM,+BAAoC,UAAK,QAAQ,GAAG,OAAO,MAAM,aAAa;AAC3F,IAAM,kBAAkB;AAEjB,IAAM,iBAAN,cAA6B,WAAW;AAAA,EAC7B;AAAA,EAET,YAAY,YAAoB,8BAA8B;AACnE,UAAM;AACN,SAAK,YAAiB,aAAQ,SAAS;AAAA,EACzC;AAAA,EAEO,cAAc,QAAwB;AAC3C,UAAM,QAAQ,gBAAgB,KAAK,MAAM;AACzC,QAAI,CAAC,MAAO,OAAM,IAAI,MAAM,wEAAqC;AACjE,WAAY,UAAK,KAAK,WAAW,MAAM,CAAC,CAAC;AAAA,EAC3C;AAAA,EAEO,aAAa,QAAwB;AAAE,WAAY,UAAK,KAAK,cAAc,MAAM,GAAG,WAAW;AAAA,EAAG;AAAA,EAClG,YAAY,QAAwB;AAAE,WAAY,UAAK,KAAK,cAAc,MAAM,GAAG,eAAe;AAAA,EAAG;AAAA,EAE5G,MAAa,OAAO,QAAyC;AAC3D,UAAS,SAAM,KAAK,WAAW,EAAE,WAAW,MAAM,MAAM,IAAM,CAAC;AAC/D,UAAS,SAAM,KAAK,cAAc,OAAO,MAAM,GAAG,EAAE,MAAM,I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