maoda-commander-tt 0.0.74 → 0.0.76
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 +28 -9
- package/dist/{chunk-RCHYA6IO.js → chunk-LRYUVB4W.js} +108 -114
- package/dist/chunk-LRYUVB4W.js.map +1 -0
- package/dist/index.d.ts +1 -6
- package/dist/index.js +1 -3
- package/dist/main.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-RCHYA6IO.js.map +0 -1
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ tt-cli/
|
|
|
56
56
|
│ │ └── command-meta.ts # ICommandMeta: name/description/aliases/hidden/output
|
|
57
57
|
│ ├── commands/ # CLI 表现层,每个命令组一个目录
|
|
58
58
|
│ │ ├── index.ts # 顶层注册表 createRootCommands()
|
|
59
|
-
│ │ ├── ai/ deploy/ git/ hello/ pippit/
|
|
59
|
+
│ │ ├── ai/ deploy/ git/ hello/ pippit/ tool/
|
|
60
60
|
│ ├── modules/ # 领域逻辑:不依赖 commander,返回 Result<T>
|
|
61
61
|
│ │ ├── ark/ git/ pippit/ static-deploy/ video-generation/ xyq/ xyq-tasks/
|
|
62
62
|
│ ├── bedrock/ # 与业务无关的基础设施
|
|
@@ -92,6 +92,22 @@ pnpm test
|
|
|
92
92
|
pnpm build && pnpm test:dist
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
## 拉取仓库及子模块
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
tt g l
|
|
99
|
+
tt g l --help
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
从当前 Git 仓库的任意子目录运行均可:先在仓库根目录执行 `git pull
|
|
103
|
+
--no-recurse-submodules`,成功后执行 `git submodule update --init --recursive
|
|
104
|
+
--checkout`。pull 沿用 Git 的上游分支及合并/rebase 配置;未初始化及嵌套子模块
|
|
105
|
+
一并同步到仓库记录的 commit,无子模块时也能正常完成,不追随子模块远端分支最新版本。
|
|
106
|
+
|
|
107
|
+
子模块通常切为 detached HEAD;不强制覆盖本地修改,本命令不额外执行 stash。任一步失败立即
|
|
108
|
+
停止并返回退出码 1,保留 Git 原始输出;若子模块同步失败,主仓库及已经完成的子模块
|
|
109
|
+
更新会保留,修复报错后可再次运行。此命令透传 Git 输出,不返回 JSON envelope。
|
|
110
|
+
|
|
95
111
|
## 读写配置
|
|
96
112
|
|
|
97
113
|
```bash
|
|
@@ -334,8 +350,9 @@ writer 写入。它的 `value` 是包含以下五个字段的 JSON 字符串,
|
|
|
334
350
|
Nginx 将 `/assets/<编码后的key>` 302 到固定 COS 桶的 `/tt/<编码后的key>`,配置见
|
|
335
351
|
[资源入口路由](ops/nginx/tt-assets-location.conf)。302 保留原始 URL 编码,避免中文、
|
|
336
352
|
空格及保留字符被二次解释。入口省略 `tt/`,但跳转的 Location 和浏览器网络记录仍能
|
|
337
|
-
看到 COS
|
|
338
|
-
|
|
353
|
+
看到 COS 对象路径。白名单 GET/HEAD 302 的 Nginx 响应缓存 30 天,其余跳转与
|
|
354
|
+
错误、OPTIONS 响应为 `no-store`;最终 COS 对象的缓存头按上述 key 后缀规则设置。
|
|
355
|
+
统一规则见 [静态缓存配置](ops/nginx/static-cache.conf) 与
|
|
339
356
|
[普通静态文件路由](ops/nginx/static-files-location.conf)。更新内容或资源入口映射时,
|
|
340
357
|
要考虑已经缓存的响应,使用新 key 发布新内容。
|
|
341
358
|
|
|
@@ -425,9 +442,11 @@ loopback HTTP 除外),客户端不跟随重定向,以免将 token 发送
|
|
|
425
442
|
这个根目录下的项目;需要更换时同时更新服务器和跨应用设置。
|
|
426
443
|
|
|
427
444
|
服务器需要预先配置 API 和 nginx 路由,参见 [部署运维说明](ops/static-deploy/README.md)。
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
445
|
+
当前服务器在静态入口上保留既有跨域响应头、OPTIONS 预检及 HSTS。白名单静态资源的
|
|
446
|
+
GET/HEAD 响应使用 `Cache-Control: max-age=2592000`(30 天);HTML、JSON、播放列表、
|
|
447
|
+
无扩展名和未知后缀使用 `no-cache`,允许浏览器缓存,但再次使用前向服务器确认内容
|
|
448
|
+
是否更新。目录清单和部署 API 使用 `no-store`。覆盖白名单静态资源不会刷新客户端
|
|
449
|
+
已有的 30 天缓存,新内容应使用版本文件名。
|
|
431
450
|
|
|
432
451
|
### 目录页与 AI 返回值
|
|
433
452
|
|
|
@@ -534,13 +553,13 @@ tt ai image list
|
|
|
534
553
|
提示词按顺序以“图1、图2”引用。
|
|
535
554
|
|
|
536
555
|
支持模型参数的生成方式默认使用 `gpt_image_2_5_sunburst`;其他生成方式忽略
|
|
537
|
-
`--model-id`、`--effort` 和 `--resolution
|
|
538
|
-
|
|
556
|
+
`--model-id`、`--effort` 和 `--resolution`。image2.5 支持 `--resolution 1k|2k|4k`,
|
|
557
|
+
其他模型保持 `2k|4k`;默认仍为 `2k`,参数值区分大小写。已知模型的 effort 范围如下:
|
|
539
558
|
|
|
540
559
|
| `--model-id` | `--effort` 可选值 | 默认 effort |
|
|
541
560
|
| --- | --- | --- |
|
|
542
561
|
| `gpt_image_2`(image2) | `medium`、`high` | `high` |
|
|
543
|
-
| `gpt_image_2_5_sunburst`(image2.5 Sunburst,默认模型) | `high`、`xhigh`、`max` | `xhigh` |
|
|
562
|
+
| `gpt_image_2_5_sunburst`(image2.5 Sunburst,默认模型) | `low`、`medium`、`high`、`xhigh`、`max` | `xhigh` |
|
|
544
563
|
| `seedream5.0pro`(Seedream 5.0 Pro) | 不支持;显式传入时报错 | 无 |
|
|
545
564
|
|
|
546
565
|
其他图片模型 ID 允许透传,其 effort 不校验,省略时沿用 `medium`。
|
|
@@ -1016,16 +1016,17 @@ var DEFAULT_VIDEO_ASPECT_RATIO = "16:9";
|
|
|
1016
1016
|
var DEFAULT_VIDEO_RESOLUTION = "720p";
|
|
1017
1017
|
var DEFAULT_VIDEO_OUTPUT_COUNT = 1;
|
|
1018
1018
|
var MIN_VIDEO_OUTPUT_COUNT = 1;
|
|
1019
|
+
var IMAGE_RESOLUTIONS = ["1k", "2k", "4k"];
|
|
1020
|
+
var DEFAULT_IMAGE_RESOLUTION = "2k";
|
|
1021
|
+
var UNKNOWN_IMAGE_RESOLUTIONS = ["2k", "4k"];
|
|
1019
1022
|
var IMAGE_MODELS = [
|
|
1020
|
-
{ id: "gpt_image_2", name: "image2", efforts: ["medium", "high"], defaultEffort: "high" },
|
|
1021
|
-
{ id: "gpt_image_2_5_sunburst", name: "image2.5 Sunburst", efforts: ["high", "xhigh", "max"], defaultEffort: "xhigh" },
|
|
1022
|
-
{ id: "seedream5.0pro", name: "Seedream 5.0 Pro", efforts: [], defaultEffort: void 0 }
|
|
1023
|
+
{ id: "gpt_image_2", name: "image2", efforts: ["medium", "high"], defaultEffort: "high", resolutions: ["2k", "4k"] },
|
|
1024
|
+
{ id: "gpt_image_2_5_sunburst", name: "image2.5 Sunburst", efforts: ["low", "medium", "high", "xhigh", "max"], defaultEffort: "xhigh", resolutions: IMAGE_RESOLUTIONS },
|
|
1025
|
+
{ id: "seedream5.0pro", name: "Seedream 5.0 Pro", efforts: [], defaultEffort: void 0, resolutions: ["2k", "4k"] }
|
|
1023
1026
|
];
|
|
1024
1027
|
var IMAGE_MODEL_IDS = Object.freeze(IMAGE_MODELS.map((model) => model.id));
|
|
1025
1028
|
var DEFAULT_IMAGE_MODEL_ID = "gpt_image_2_5_sunburst";
|
|
1026
1029
|
var DEFAULT_UNKNOWN_IMAGE_EFFORT = "medium";
|
|
1027
|
-
var IMAGE_RESOLUTIONS = ["2k", "4k"];
|
|
1028
|
-
var DEFAULT_IMAGE_RESOLUTION = "2k";
|
|
1029
1030
|
var IMAGE_ASPECT_RATIOS = ["21:9", "16:9", "3:2", "4:3", "1:1", "3:4", "2:3", "9:16", "auto"];
|
|
1030
1031
|
var DEFAULT_IMAGE_WAIT_SECONDS = 360;
|
|
1031
1032
|
var MAX_IMAGE_WAIT_SECONDS = 600;
|
|
@@ -2357,6 +2358,10 @@ function resolveImageGenerationParameters(input) {
|
|
|
2357
2358
|
return invalidImageParameters(`--resolution \u5FC5\u987B\u662F ${IMAGE_RESOLUTIONS.join("\u3001")} \u4E4B\u4E00\uFF08\u533A\u5206\u5927\u5C0F\u5199\uFF09`);
|
|
2358
2359
|
}
|
|
2359
2360
|
const config = IMAGE_MODELS.find((item) => item.id === modelId);
|
|
2361
|
+
const resolutions = config?.resolutions ?? UNKNOWN_IMAGE_RESOLUTIONS;
|
|
2362
|
+
if (!resolutions.includes(resolution)) {
|
|
2363
|
+
return invalidImageParameters(`\u56FE\u7247\u6A21\u578B ${modelId} \u7684 --resolution \u5FC5\u987B\u662F ${resolutions.join("\u3001")} \u4E4B\u4E00\uFF08\u533A\u5206\u5927\u5C0F\u5199\uFF09`);
|
|
2364
|
+
}
|
|
2360
2365
|
if (config?.efforts.length === 0) {
|
|
2361
2366
|
if (input.effort !== void 0) return invalidImageParameters(`\u56FE\u7247\u6A21\u578B ${modelId} \u4E0D\u652F\u6301 --effort`);
|
|
2362
2367
|
return ok14({ modelId, resolution });
|
|
@@ -5462,6 +5467,7 @@ var JimengImageTaskService = class extends Disposable13 {
|
|
|
5462
5467
|
prompt: request.prompt.trim(),
|
|
5463
5468
|
materials,
|
|
5464
5469
|
workspaceId,
|
|
5470
|
+
// The public resolver already validated resolution against this supported model.
|
|
5465
5471
|
resolution,
|
|
5466
5472
|
aspectRatio: request.aspectRatio
|
|
5467
5473
|
});
|
|
@@ -6028,7 +6034,7 @@ var AiImageCommand = class extends BaseCommandGroup {
|
|
|
6028
6034
|
);
|
|
6029
6035
|
cmd.addOption(new Option6("--model-id <model-id>", `\u5DF2\u77E5\u56FE\u7247\u6A21\u578B\uFF1A${IMAGE_MODELS.map((model) => `${model.id}\uFF08${model.name}\uFF09`).join("\u3001")}\uFF1B\u9ED8\u8BA4 ${DEFAULT_IMAGE_MODEL_ID}`));
|
|
6030
6036
|
cmd.addOption(new Option6("--effort <effort>", `\u63A8\u7406\u5F3A\u5EA6\uFF1A${IMAGE_MODELS.map((model) => model.efforts.length ? `${model.id} \u652F\u6301 ${model.efforts.join("/")}\uFF0C\u9ED8\u8BA4 ${model.defaultEffort}` : `${model.id} \u4E0D\u652F\u6301\u6B64\u53C2\u6570`).join("\uFF1B")}`));
|
|
6031
|
-
cmd.addOption(new Option6("--resolution <resolution>", `\u56FE\u7247\u5206\u8FA8\u7387\
|
|
6037
|
+
cmd.addOption(new Option6("--resolution <resolution>", `\u56FE\u7247\u5206\u8FA8\u7387\uFF08\u533A\u5206\u5927\u5C0F\u5199\uFF09\uFF1A${IMAGE_MODELS.map((model) => `${model.id} ${model.resolutions.join("/")}`).join("\uFF1B")}\uFF1B\u672A\u77E5\u6A21\u578B ${UNKNOWN_IMAGE_RESOLUTIONS.join("/")}`).default(DEFAULT_IMAGE_RESOLUTION));
|
|
6032
6038
|
cmd.addOption(new Option6("--wait", "\u63D0\u4EA4\u540E\u7EE7\u7EED\u7B49\u5F85\u56FE\u7247\u751F\u6210\u5B8C\u6210").default(false));
|
|
6033
6039
|
cmd.addOption(new Option6("--quiet", "\u5173\u95ED\u63D0\u4EA4\u9636\u6BB5\u7684 stderr \u8FDB\u5EA6\u4E0E\u5FC3\u8DF3").default(false));
|
|
6034
6040
|
cmd.addOption(new Option6("--timeout-seconds <seconds>", `\u6700\u591A\u7B49\u5F85\u79D2\u6570\uFF0C1-${MAX_IMAGE_WAIT_SECONDS} \u7684\u6574\u6570`).argParser(Number).default(DEFAULT_IMAGE_WAIT_SECONDS));
|
|
@@ -8786,6 +8792,39 @@ function buildMergeRequestUrl(repoUrl, sourceBranch) {
|
|
|
8786
8792
|
return `${repoUrl}/merge_requests/new?merge_request=&source_branch=${encodeURIComponent(sourceBranch)}`;
|
|
8787
8793
|
}
|
|
8788
8794
|
|
|
8795
|
+
// src/modules/git/git-pull.ts
|
|
8796
|
+
import { err as err32 } from "rockbed/error";
|
|
8797
|
+
async function gitPullWithSubmodules() {
|
|
8798
|
+
const rootResult = await captureGit(["rev-parse", "--show-toplevel"]);
|
|
8799
|
+
if (!rootResult.ok) {
|
|
8800
|
+
return rootResult;
|
|
8801
|
+
}
|
|
8802
|
+
const atRoot = ["-C", rootResult.value];
|
|
8803
|
+
const pullResult = await runGit([
|
|
8804
|
+
...atRoot,
|
|
8805
|
+
"pull",
|
|
8806
|
+
"--no-recurse-submodules"
|
|
8807
|
+
]);
|
|
8808
|
+
if (!pullResult.ok) {
|
|
8809
|
+
return err32(pullResult.code, `\u62C9\u53D6\u5931\u8D25\uFF0C\u672A\u6267\u884C\u5B50\u6A21\u5757\u540C\u6B65\u3002${pullResult.msg}`);
|
|
8810
|
+
}
|
|
8811
|
+
const updateResult = await runGit([
|
|
8812
|
+
...atRoot,
|
|
8813
|
+
"submodule",
|
|
8814
|
+
"update",
|
|
8815
|
+
"--init",
|
|
8816
|
+
"--recursive",
|
|
8817
|
+
"--checkout"
|
|
8818
|
+
]);
|
|
8819
|
+
if (!updateResult.ok) {
|
|
8820
|
+
return err32(
|
|
8821
|
+
updateResult.code,
|
|
8822
|
+
`\u4E3B\u4ED3\u5E93\u5DF2\u62C9\u53D6\uFF0C\u5B50\u6A21\u5757\u540C\u6B65\u672A\u5B8C\u6210\uFF0C\u90E8\u5206\u5B50\u6A21\u5757\u53EF\u80FD\u5DF2\u66F4\u65B0\u3002${updateResult.msg}`
|
|
8823
|
+
);
|
|
8824
|
+
}
|
|
8825
|
+
return updateResult;
|
|
8826
|
+
}
|
|
8827
|
+
|
|
8789
8828
|
// src/commands/git/git-base-command.ts
|
|
8790
8829
|
var GitBaseCommand = class extends BaseCommand {
|
|
8791
8830
|
_defaultOutputMode() {
|
|
@@ -8913,6 +8952,33 @@ var GitPpCommand = class extends GitBaseCommand {
|
|
|
8913
8952
|
}
|
|
8914
8953
|
};
|
|
8915
8954
|
|
|
8955
|
+
// src/commands/git/git-pull-command.ts
|
|
8956
|
+
var GitPullCommand = class extends BaseCommand {
|
|
8957
|
+
constructor(_pull = gitPullWithSubmodules) {
|
|
8958
|
+
super();
|
|
8959
|
+
this._pull = _pull;
|
|
8960
|
+
}
|
|
8961
|
+
_meta() {
|
|
8962
|
+
return {
|
|
8963
|
+
name: "l",
|
|
8964
|
+
description: "\u62C9\u53D6\u5F53\u524D\u4ED3\u5E93\uFF0C\u518D\u6309\u4ED3\u5E93\u6307\u9488\u9012\u5F52\u540C\u6B65\u5B50\u6A21\u5757",
|
|
8965
|
+
output: "passthrough"
|
|
8966
|
+
};
|
|
8967
|
+
}
|
|
8968
|
+
_agentContract() {
|
|
8969
|
+
return [
|
|
8970
|
+
"\u5728\u5F53\u524D Git \u4ED3\u5E93\u6839\u76EE\u5F55\u6267\u884C pull\uFF0C\u6CBF\u7528 Git \u7684\u4E0A\u6E38\u5206\u652F\u53CA\u5408\u5E76/rebase \u914D\u7F6E\u3002",
|
|
8971
|
+
"pull \u6210\u529F\u540E\u521D\u59CB\u5316\u5E76\u9012\u5F52 checkout \u5B50\u6A21\u5757\u5230\u4ED3\u5E93\u8BB0\u5F55\u7684 commit\uFF0C\u4E0D\u8FFD\u968F\u8FDC\u7AEF\u5206\u652F\u6700\u65B0\u7248\u672C\uFF1B\u65E0\u5B50\u6A21\u5757\u4E5F\u53EF\u4F7F\u7528\u3002",
|
|
8972
|
+
"\u5B50\u6A21\u5757\u901A\u5E38\u5207\u4E3A detached HEAD\uFF1B\u4E0D\u5F3A\u5236\u8986\u76D6\u4FEE\u6539\uFF0C\u672C\u547D\u4EE4\u4E0D\u989D\u5916\u6267\u884C stash\u3002",
|
|
8973
|
+
"\u4EFB\u4E00\u6B65\u5931\u8D25\u5373\u505C\u6B62\uFF0C\u5DF2\u5B8C\u6210\u7684\u66F4\u65B0\u4FDD\u7559\uFF1B\u4FEE\u590D Git \u62A5\u9519\u540E\u53EF\u518D\u6B21\u8FD0\u884C\u3002",
|
|
8974
|
+
"stdout \u4E3A Git \u539F\u59CB\u8F93\u51FA\uFF0C\u4E0D\u4F7F\u7528 JSON envelope\uFF1B\u5931\u8D25\u9000\u51FA\u7801\u4E3A 1\u3002"
|
|
8975
|
+
];
|
|
8976
|
+
}
|
|
8977
|
+
async _execute() {
|
|
8978
|
+
return this._pull();
|
|
8979
|
+
}
|
|
8980
|
+
};
|
|
8981
|
+
|
|
8916
8982
|
// src/commands/git/git-command.ts
|
|
8917
8983
|
var GitCommand = class extends BaseCommandGroup {
|
|
8918
8984
|
_meta() {
|
|
@@ -8924,6 +8990,7 @@ var GitCommand = class extends BaseCommandGroup {
|
|
|
8924
8990
|
};
|
|
8925
8991
|
}
|
|
8926
8992
|
_registerSubcommands() {
|
|
8993
|
+
this._addSubcommand(new GitPullCommand());
|
|
8927
8994
|
this._addSubcommand(new GitMmCommand());
|
|
8928
8995
|
this._addSubcommand(new GitPpCommand());
|
|
8929
8996
|
this._addSubcommand(new GitCheckoutCommand());
|
|
@@ -8989,13 +9056,13 @@ var HelloCommand = class extends BaseCommandGroup {
|
|
|
8989
9056
|
|
|
8990
9057
|
// src/modules/kv/kv-service.ts
|
|
8991
9058
|
import { Disposable as Disposable18 } from "rockbed/dispose";
|
|
8992
|
-
import { err as
|
|
9059
|
+
import { err as err34, ok as ok56 } from "rockbed/error";
|
|
8993
9060
|
|
|
8994
9061
|
// src/modules/kv/kv-value.ts
|
|
8995
|
-
import { err as
|
|
9062
|
+
import { err as err33, ok as ok55 } from "rockbed/error";
|
|
8996
9063
|
function validateKvAddress(scope, key) {
|
|
8997
9064
|
if (typeof scope !== "string" || scope.length === 0 || typeof key !== "string" || key.length === 0) {
|
|
8998
|
-
return
|
|
9065
|
+
return err33(1, "scope \u548C key \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32", {
|
|
8999
9066
|
stage: "input",
|
|
9000
9067
|
...typeof scope === "string" ? { scope } : {},
|
|
9001
9068
|
...typeof key === "string" ? { key } : {}
|
|
@@ -9008,16 +9075,16 @@ function parseKvValue(text) {
|
|
|
9008
9075
|
try {
|
|
9009
9076
|
value = JSON.parse(text);
|
|
9010
9077
|
} catch (caught) {
|
|
9011
|
-
return
|
|
9078
|
+
return err33(1, `value \u5FC5\u987B\u662F\u5408\u6CD5 JSON\uFF1A${caught instanceof Error ? caught.message : String(caught)}`, { stage: "input" });
|
|
9012
9079
|
}
|
|
9013
9080
|
return validateKvValue(value);
|
|
9014
9081
|
}
|
|
9015
9082
|
function validateKvValue(value) {
|
|
9016
9083
|
if (value === null || value === void 0) {
|
|
9017
|
-
return
|
|
9084
|
+
return err33(1, "set \u4E0D\u63A5\u53D7\u9876\u5C42 null \u6216\u7F3A\u5931\u7684 value\uFF1B\u5220\u9664\u8BF7\u4F7F\u7528 tt kv delete", { stage: "input" });
|
|
9018
9085
|
}
|
|
9019
9086
|
if (!isJsonValue(value)) {
|
|
9020
|
-
return
|
|
9087
|
+
return err33(1, "value \u5FC5\u987B\u662F\u53EF\u5B8C\u6574\u5E8F\u5217\u5316\u7684 JSON\uFF0C\u6240\u6709\u6570\u5B57\u5FC5\u987B\u6709\u9650", { stage: "input" });
|
|
9021
9088
|
}
|
|
9022
9089
|
return ok55(value);
|
|
9023
9090
|
}
|
|
@@ -9089,7 +9156,7 @@ var KvService = class extends Disposable18 {
|
|
|
9089
9156
|
const address = validateKvAddress(scope, key);
|
|
9090
9157
|
if (!address.ok) return address;
|
|
9091
9158
|
const parsed = validateKvValue(value);
|
|
9092
|
-
if (!parsed.ok) return
|
|
9159
|
+
if (!parsed.ok) return err34(parsed.code, parsed.msg, { stage: "input", ...address.value });
|
|
9093
9160
|
return this._write(address.value, parsed.value, "write");
|
|
9094
9161
|
}
|
|
9095
9162
|
async delete(scope, key) {
|
|
@@ -9102,7 +9169,7 @@ var KvService = class extends Disposable18 {
|
|
|
9102
9169
|
try {
|
|
9103
9170
|
body = JSON.stringify({ ...address, value });
|
|
9104
9171
|
} catch (caught) {
|
|
9105
|
-
return
|
|
9172
|
+
return err34(1, `value \u65E0\u6CD5\u5E8F\u5217\u5316\u4E3A JSON\uFF1A${describeError(caught)}`, { stage: "input", ...address });
|
|
9106
9173
|
}
|
|
9107
9174
|
const details = { stage, ...address };
|
|
9108
9175
|
const result = await this._request(KV_URL, {
|
|
@@ -9165,9 +9232,9 @@ function isEnvelope(value) {
|
|
|
9165
9232
|
function failure2(code, message, details, explicitlyRejected = false) {
|
|
9166
9233
|
if ((details.stage === "write" || details.stage === "delete") && !explicitlyRejected) {
|
|
9167
9234
|
const effect = details.stage === "delete" ? "\u5220\u9664" : "\u5199\u5165";
|
|
9168
|
-
return
|
|
9235
|
+
return err34(code, `${message}\uFF1B\u672C\u6B21${effect}\u7ED3\u679C\u672A\u786E\u8BA4\uFF0C\u53EF\u80FD\u5DF2${effect}\uFF0C\u672A\u81EA\u52A8\u91CD\u8BD5`, { ...details, outcome: "unconfirmed" });
|
|
9169
9236
|
}
|
|
9170
|
-
return
|
|
9237
|
+
return err34(code, message, details);
|
|
9171
9238
|
}
|
|
9172
9239
|
function describeError(caught) {
|
|
9173
9240
|
return caught instanceof Error ? caught.message : String(caught);
|
|
@@ -9382,7 +9449,7 @@ var KvCommand = class extends BaseCommandGroup {
|
|
|
9382
9449
|
};
|
|
9383
9450
|
|
|
9384
9451
|
// src/modules/pippit/douyin-video/cn-douyin-video.ts
|
|
9385
|
-
import { err as
|
|
9452
|
+
import { err as err35, ok as ok59 } from "rockbed/error";
|
|
9386
9453
|
|
|
9387
9454
|
// src/modules/pippit/request-json.ts
|
|
9388
9455
|
import { ok as ok58 } from "rockbed/error";
|
|
@@ -9507,7 +9574,7 @@ async function fetchDouyinVideoCn(options, dependencies = {}) {
|
|
|
9507
9574
|
return ok59({ video_url: videoUrl });
|
|
9508
9575
|
}
|
|
9509
9576
|
if (response.ret !== void 0 && String(response.ret) !== "0") {
|
|
9510
|
-
return
|
|
9577
|
+
return err35(
|
|
9511
9578
|
parseErrorCode(response.ret),
|
|
9512
9579
|
response.errmsg?.trim() || "\u6296\u97F3\u89C6\u9891\u89E3\u6790\u63A5\u53E3\u8FD4\u56DE\u9519\u8BEF\u3002"
|
|
9513
9580
|
);
|
|
@@ -9561,79 +9628,8 @@ var PippitCommand = class extends BaseCommandGroup {
|
|
|
9561
9628
|
}
|
|
9562
9629
|
};
|
|
9563
9630
|
|
|
9564
|
-
// src/commands/shortcut/shortcut-definitions.ts
|
|
9565
|
-
var SHORTCUT_DEFINITIONS = [
|
|
9566
|
-
{
|
|
9567
|
-
name: "pippit",
|
|
9568
|
-
aliases: ["pp"],
|
|
9569
|
-
description: "\u542F\u52A8 pippit \u9879\u76EE",
|
|
9570
|
-
cwd: "~/work/pippit",
|
|
9571
|
-
commandLine: "w2 start && emo start platform-business"
|
|
9572
|
-
},
|
|
9573
|
-
{
|
|
9574
|
-
name: "pippit-cn",
|
|
9575
|
-
aliases: ["ppc"],
|
|
9576
|
-
description: "\u5728 pippit \u9879\u76EE\u542F\u52A8 platform-xyq",
|
|
9577
|
-
cwd: "~/work/pippit",
|
|
9578
|
-
commandLine: "w2 start && emo start platform-xyq"
|
|
9579
|
-
}
|
|
9580
|
-
];
|
|
9581
|
-
|
|
9582
|
-
// src/commands/shortcut/shortcut-run-command.ts
|
|
9583
|
-
import { homedir as homedir4 } from "node:os";
|
|
9584
|
-
import { join as join9 } from "node:path";
|
|
9585
|
-
var ShortcutRunCommand = class extends BaseCommand {
|
|
9586
|
-
constructor(_definition) {
|
|
9587
|
-
super();
|
|
9588
|
-
this._definition = _definition;
|
|
9589
|
-
}
|
|
9590
|
-
_meta() {
|
|
9591
|
-
return {
|
|
9592
|
-
name: this._definition.name,
|
|
9593
|
-
description: this._definition.description,
|
|
9594
|
-
aliases: this._definition.aliases,
|
|
9595
|
-
output: "passthrough"
|
|
9596
|
-
};
|
|
9597
|
-
}
|
|
9598
|
-
_agentContract() {
|
|
9599
|
-
return ["stdout/stderr \u539F\u6837\u900F\u4F20\u5B50\u8FDB\u7A0B\u8F93\u51FA\uFF0C\u4E0D\u4F7F\u7528 JSON envelope\uFF1B\u5931\u8D25\u9000\u51FA\u7801\u4E3A 1\u3002"];
|
|
9600
|
-
}
|
|
9601
|
-
_execute(_ctx) {
|
|
9602
|
-
return runProcess(this._definition.commandLine, [], {
|
|
9603
|
-
cwd: expandHomeDir(this._definition.cwd),
|
|
9604
|
-
shell: true
|
|
9605
|
-
});
|
|
9606
|
-
}
|
|
9607
|
-
};
|
|
9608
|
-
function expandHomeDir(path15) {
|
|
9609
|
-
if (path15 === "~") {
|
|
9610
|
-
return homedir4();
|
|
9611
|
-
}
|
|
9612
|
-
if (path15.startsWith("~/")) {
|
|
9613
|
-
return join9(homedir4(), path15.slice(2));
|
|
9614
|
-
}
|
|
9615
|
-
return path15;
|
|
9616
|
-
}
|
|
9617
|
-
|
|
9618
|
-
// src/commands/shortcut/shortcut-command.ts
|
|
9619
|
-
var ShortcutCommand = class extends BaseCommandGroup {
|
|
9620
|
-
_meta() {
|
|
9621
|
-
return {
|
|
9622
|
-
name: "shortcut",
|
|
9623
|
-
description: "\u5E38\u7528 shell \u547D\u4EE4\u5FEB\u6377\u65B9\u5F0F",
|
|
9624
|
-
aliases: ["sc"],
|
|
9625
|
-
hidden: true
|
|
9626
|
-
};
|
|
9627
|
-
}
|
|
9628
|
-
_registerSubcommands() {
|
|
9629
|
-
for (const definition of SHORTCUT_DEFINITIONS) {
|
|
9630
|
-
this._addSubcommand(new ShortcutRunCommand(definition));
|
|
9631
|
-
}
|
|
9632
|
-
}
|
|
9633
|
-
};
|
|
9634
|
-
|
|
9635
9631
|
// src/commands/tool/tool-draw-command.ts
|
|
9636
|
-
import { err as
|
|
9632
|
+
import { err as err36, ok as ok60 } from "rockbed/error";
|
|
9637
9633
|
var ToolDrawCommand = class extends BaseCommand {
|
|
9638
9634
|
_meta() {
|
|
9639
9635
|
return {
|
|
@@ -9664,7 +9660,7 @@ var ToolDrawCommand = class extends BaseCommand {
|
|
|
9664
9660
|
}
|
|
9665
9661
|
const distributionText = stringifyDistributionArg(ctx.args[1]);
|
|
9666
9662
|
if (!distributionText) {
|
|
9667
|
-
return
|
|
9663
|
+
return err36(1, "\u6982\u7387\u5206\u5E03\u4E0D\u80FD\u4E3A\u7A7A");
|
|
9668
9664
|
}
|
|
9669
9665
|
const distributionResult = parseDistribution(distributionText);
|
|
9670
9666
|
if (!distributionResult.ok) {
|
|
@@ -9678,7 +9674,7 @@ var ToolDrawCommand = class extends BaseCommand {
|
|
|
9678
9674
|
function parseCount(value) {
|
|
9679
9675
|
const count = Number(String(value ?? "").trim());
|
|
9680
9676
|
if (!Number.isInteger(count) || count <= 0) {
|
|
9681
|
-
return
|
|
9677
|
+
return err36(1, "\u62BD\u53D6\u4E2A\u6570\u5FC5\u987B\u662F\u6B63\u6574\u6570");
|
|
9682
9678
|
}
|
|
9683
9679
|
return ok60(count);
|
|
9684
9680
|
}
|
|
@@ -9700,10 +9696,10 @@ function parseJsonDistribution(value) {
|
|
|
9700
9696
|
parsed = JSON.parse(value);
|
|
9701
9697
|
} catch (caughtError) {
|
|
9702
9698
|
const msg = caughtError instanceof Error ? caughtError.message : String(caughtError);
|
|
9703
|
-
return
|
|
9699
|
+
return err36(1, `JSON \u6982\u7387\u5206\u5E03\u89E3\u6790\u5931\u8D25: ${msg}`);
|
|
9704
9700
|
}
|
|
9705
9701
|
if (!Array.isArray(parsed)) {
|
|
9706
|
-
return
|
|
9702
|
+
return err36(1, "JSON \u6982\u7387\u5206\u5E03\u5FC5\u987B\u662F\u6570\u7EC4");
|
|
9707
9703
|
}
|
|
9708
9704
|
const entries = [];
|
|
9709
9705
|
for (let index = 0; index < parsed.length; index += 1) {
|
|
@@ -9718,7 +9714,7 @@ function parseJsonDistribution(value) {
|
|
|
9718
9714
|
function parseJsonDistributionEntry(value, index) {
|
|
9719
9715
|
const record = asRecord(value);
|
|
9720
9716
|
if (!record) {
|
|
9721
|
-
return
|
|
9717
|
+
return err36(1, `\u7B2C ${index + 1} \u9879\u5FC5\u987B\u662F\u5BF9\u8C61`);
|
|
9722
9718
|
}
|
|
9723
9719
|
const nameResult = parseEntryName(record.name, `\u7B2C ${index + 1} \u9879`);
|
|
9724
9720
|
if (!nameResult.ok) {
|
|
@@ -9748,11 +9744,11 @@ function parseShorthandDistribution(value) {
|
|
|
9748
9744
|
for (let index = 0; index < parts.length; index += 1) {
|
|
9749
9745
|
const part = parts[index].trim();
|
|
9750
9746
|
if (!part) {
|
|
9751
|
-
return
|
|
9747
|
+
return err36(1, `\u7B2C ${index + 1} \u9879\u4E3A\u7A7A`);
|
|
9752
9748
|
}
|
|
9753
9749
|
const separatorIndex = findLastWeightSeparator(part);
|
|
9754
9750
|
if (separatorIndex < 0) {
|
|
9755
|
-
return
|
|
9751
|
+
return err36(1, `\u7B2C ${index + 1} \u9879\u7F3A\u5C11\u6982\u7387\u5206\u9694\u7B26 ":"`);
|
|
9756
9752
|
}
|
|
9757
9753
|
const nameResult = parseEntryName(part.slice(0, separatorIndex), `\u7B2C ${index + 1} \u9879`);
|
|
9758
9754
|
if (!nameResult.ok) {
|
|
@@ -9771,11 +9767,11 @@ function findLastWeightSeparator(value) {
|
|
|
9771
9767
|
}
|
|
9772
9768
|
function parseEntryName(value, label) {
|
|
9773
9769
|
if (typeof value !== "string") {
|
|
9774
|
-
return
|
|
9770
|
+
return err36(1, `${label}\u7684\u540D\u79F0\u5FC5\u987B\u662F\u5B57\u7B26\u4E32`);
|
|
9775
9771
|
}
|
|
9776
9772
|
const name = value.trim();
|
|
9777
9773
|
if (!name) {
|
|
9778
|
-
return
|
|
9774
|
+
return err36(1, `${label}\u7684\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A`);
|
|
9779
9775
|
}
|
|
9780
9776
|
return ok60(name);
|
|
9781
9777
|
}
|
|
@@ -9783,13 +9779,13 @@ function parseWeight(value, label) {
|
|
|
9783
9779
|
const rawValue = typeof value === "string" ? value.trim().replace(/[%%]$/, "") : value;
|
|
9784
9780
|
const weight = Number(rawValue);
|
|
9785
9781
|
if (!Number.isFinite(weight) || weight <= 0) {
|
|
9786
|
-
return
|
|
9782
|
+
return err36(1, `${label}\u7684\u6982\u7387\u5FC5\u987B\u662F\u5927\u4E8E 0 \u7684\u6570\u5B57`);
|
|
9787
9783
|
}
|
|
9788
9784
|
return ok60(weight);
|
|
9789
9785
|
}
|
|
9790
9786
|
function validateDistribution(entries) {
|
|
9791
9787
|
if (entries.length === 0) {
|
|
9792
|
-
return
|
|
9788
|
+
return err36(1, "\u6982\u7387\u5206\u5E03\u81F3\u5C11\u9700\u8981 1 \u9879");
|
|
9793
9789
|
}
|
|
9794
9790
|
return ok60(entries);
|
|
9795
9791
|
}
|
|
@@ -9819,7 +9815,7 @@ function asRecord(value) {
|
|
|
9819
9815
|
}
|
|
9820
9816
|
|
|
9821
9817
|
// src/commands/tool/tool-get-config-command.ts
|
|
9822
|
-
import { err as
|
|
9818
|
+
import { err as err37, ok as ok61 } from "rockbed/error";
|
|
9823
9819
|
var ToolGetConfigCommand = class extends BaseCommand {
|
|
9824
9820
|
constructor(_settingsReader = new FileCrossAppSettingsReader()) {
|
|
9825
9821
|
super();
|
|
@@ -9871,14 +9867,14 @@ function toConfigCommandResponse(value) {
|
|
|
9871
9867
|
}
|
|
9872
9868
|
async function readConfigValue(settingsReader, key) {
|
|
9873
9869
|
if (!isValidCrossAppSettingKey(key)) {
|
|
9874
|
-
return
|
|
9870
|
+
return err37(
|
|
9875
9871
|
16002 /* InvalidDocument */,
|
|
9876
9872
|
`\u914D\u7F6E key \u65E0\u6548: ${key || "<empty>"}`
|
|
9877
9873
|
);
|
|
9878
9874
|
}
|
|
9879
9875
|
const snapshotResult = await settingsReader.read();
|
|
9880
9876
|
if (!snapshotResult.ok) {
|
|
9881
|
-
return
|
|
9877
|
+
return err37(snapshotResult.code, snapshotResult.msg);
|
|
9882
9878
|
}
|
|
9883
9879
|
const entry = snapshotResult.value.document.settings[key];
|
|
9884
9880
|
if (!entry) {
|
|
@@ -9951,22 +9947,22 @@ var ToolCommand = class extends BaseCommandGroup {
|
|
|
9951
9947
|
import { stat as stat5 } from "node:fs/promises";
|
|
9952
9948
|
import { resolve as resolve15 } from "node:path";
|
|
9953
9949
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
9954
|
-
import { err as
|
|
9950
|
+
import { err as err38, ok as ok63 } from "rockbed/error";
|
|
9955
9951
|
var DEFAULT_TRAEX_CWD = "/Users/bytedance/work/autogen";
|
|
9956
9952
|
var DEFAULT_TRAEX_MODEL = "gpt-5.6-sol";
|
|
9957
9953
|
var DEFAULT_TRAEX_REASONING = "xhigh";
|
|
9958
9954
|
var TRAEX_MODELS = ["gpt-5.6-sol", "gpt-6-astra"];
|
|
9959
9955
|
var TRAEX_REASONING_LEVELS = ["low", "medium", "high", "xhigh"];
|
|
9960
9956
|
async function launchTraex(input, launch = launchDefaultTraexWorker) {
|
|
9961
|
-
if (!input.prompt.trim()) return
|
|
9962
|
-
if (!TRAEX_MODELS.some((model) => model === input.model)) return
|
|
9963
|
-
if (!TRAEX_REASONING_LEVELS.some((level) => level === input.reasoning)) return
|
|
9964
|
-
if (!input.cwd.trim()) return
|
|
9957
|
+
if (!input.prompt.trim()) return err38(1, "\u8BF7\u8F93\u5165\u975E\u7A7A prompt");
|
|
9958
|
+
if (!TRAEX_MODELS.some((model) => model === input.model)) return err38(1, "\u4E0D\u652F\u6301\u7684\u6A21\u578B");
|
|
9959
|
+
if (!TRAEX_REASONING_LEVELS.some((level) => level === input.reasoning)) return err38(1, "\u4E0D\u652F\u6301\u7684\u63A8\u7406\u5F3A\u5EA6");
|
|
9960
|
+
if (!input.cwd.trim()) return err38(1, "\u5DE5\u4F5C\u76EE\u5F55\u4E0D\u80FD\u4E3A\u7A7A");
|
|
9965
9961
|
const cwd = resolve15(input.cwd);
|
|
9966
9962
|
try {
|
|
9967
|
-
if (!(await stat5(cwd)).isDirectory()) return
|
|
9963
|
+
if (!(await stat5(cwd)).isDirectory()) return err38(1, `\u5DE5\u4F5C\u76EE\u5F55\u4E0D\u662F\u76EE\u5F55: ${cwd}`);
|
|
9968
9964
|
} catch {
|
|
9969
|
-
return
|
|
9965
|
+
return err38(1, `\u5DE5\u4F5C\u76EE\u5F55\u4E0D\u5B58\u5728\u6216\u4E0D\u53EF\u8BBF\u95EE: ${cwd}`);
|
|
9970
9966
|
}
|
|
9971
9967
|
const result = await launch({ ...input, cwd });
|
|
9972
9968
|
if (!result.ok) return result;
|
|
@@ -10032,7 +10028,6 @@ function createRootCommands() {
|
|
|
10032
10028
|
new CodexCommand(),
|
|
10033
10029
|
new CodexExecCommand(),
|
|
10034
10030
|
new GitCommand(),
|
|
10035
|
-
new ShortcutCommand(),
|
|
10036
10031
|
new ToolCommand(),
|
|
10037
10032
|
new HelloCommand()
|
|
10038
10033
|
];
|
|
@@ -10073,9 +10068,8 @@ export {
|
|
|
10073
10068
|
KvSetCommand,
|
|
10074
10069
|
KvCommand,
|
|
10075
10070
|
PippitCommand,
|
|
10076
|
-
ShortcutCommand,
|
|
10077
10071
|
ToolCommand,
|
|
10078
10072
|
TraexCommand,
|
|
10079
10073
|
createRootCommands
|
|
10080
10074
|
};
|
|
10081
|
-
//# sourceMappingURL=chunk-
|
|
10075
|
+
//# sourceMappingURL=chunk-LRYUVB4W.js.map
|