taskmeld 0.1.1 → 0.1.41

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.
Files changed (155) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +176 -172
  3. package/README.zh-CN.md +176 -172
  4. package/dist/src/app/app-context-env.js +1 -1
  5. package/dist/src/app/create-app-context.js +3 -3
  6. package/dist/src/app/data-dir.js +13 -3
  7. package/dist/src/app/pipeline-config.js +4 -4
  8. package/dist/src/app/pipeline-registry.js +11 -11
  9. package/dist/src/app/pipeline-runtime.js +6 -9
  10. package/dist/src/app/runtime-store.js +3 -3
  11. package/dist/src/artifacts/artifact-cleanup.js +17 -17
  12. package/dist/src/artifacts/artifact-index.js +14 -14
  13. package/dist/src/artifacts/artifact-rebuilder.js +3 -3
  14. package/dist/src/artifacts/storage-service.js +18 -18
  15. package/dist/src/cli/bootstrap.js +7 -7
  16. package/dist/src/cli/commands/agent.js +12 -11
  17. package/dist/src/cli/commands/artifact.js +31 -30
  18. package/dist/src/cli/commands/init.js +49 -47
  19. package/dist/src/cli/commands/pipeline/result.js +9 -8
  20. package/dist/src/cli/commands/pipeline/selector.js +1 -1
  21. package/dist/src/cli/commands/pipeline/watch.js +2 -2
  22. package/dist/src/cli/commands/pipeline.js +54 -53
  23. package/dist/src/cli/commands/scheduler.js +9 -8
  24. package/dist/src/cli/commands/server.js +12 -11
  25. package/dist/src/cli/commands/system.js +4 -3
  26. package/dist/src/cli/errors.js +2 -2
  27. package/dist/src/cli/help.js +18 -17
  28. package/dist/src/cli/i18n.js +46 -0
  29. package/dist/src/cli/locales/en.json +244 -0
  30. package/dist/src/cli/locales/zh.json +244 -0
  31. package/dist/src/cli/output.js +3 -3
  32. package/dist/src/cli/renderers/engine/markdown.js +1 -1
  33. package/dist/src/cli/renderers/specs/index.js +1 -1
  34. package/dist/src/cli/router.js +1 -1
  35. package/dist/src/cli/server-runtime-client.js +54 -95
  36. package/dist/src/cli/ui-prompts.js +96 -0
  37. package/dist/src/cli/ws-runtime-client.js +51 -0
  38. package/dist/src/gateway/gateway-client.js +4 -4
  39. package/dist/src/index.js +28 -2
  40. package/dist/src/logs/run-log-reader.js +1 -1
  41. package/dist/src/pipeline/agent-activity.js +2 -2
  42. package/dist/src/pipeline/artifact-storage.js +11 -11
  43. package/dist/src/pipeline/diagnostics/dependency-diagnostic.js +11 -11
  44. package/dist/src/pipeline/dispatch/pipeline-inbound-queue.js +2 -2
  45. package/dist/src/pipeline/execution/group-item-executor.js +1 -1
  46. package/dist/src/pipeline/execution/node-item-executor.js +3 -3
  47. package/dist/src/pipeline/execution/node-runner.js +7 -7
  48. package/dist/src/pipeline/execution/readiness-state.js +1 -1
  49. package/dist/src/pipeline/execution/reject-handler.js +5 -5
  50. package/dist/src/pipeline/execution/rejected-artifact-archiver.js +1 -1
  51. package/dist/src/pipeline/execution/route-item-manager.js +4 -4
  52. package/dist/src/pipeline/execution/run-abort-controller.js +5 -5
  53. package/dist/src/pipeline/execution/run-state-helpers.js +2 -2
  54. package/dist/src/pipeline/execution/service.js +4 -4
  55. package/dist/src/pipeline/execution/structured-node-runner.js +24 -24
  56. package/dist/src/pipeline/execution-timeout.js +3 -3
  57. package/dist/src/pipeline/identity/index.js +3 -3
  58. package/dist/src/pipeline/item-batch-controller.js +6 -6
  59. package/dist/src/pipeline/scheduler/dependency-state.js +5 -5
  60. package/dist/src/pipeline/scheduler-service.js +24 -24
  61. package/dist/src/pipeline/state-machine.js +2 -2
  62. package/dist/src/pipeline/structured-output/contract.js +4 -4
  63. package/dist/src/pipeline/structured-output/index.js +2 -2
  64. package/dist/src/pipeline/structured-output/parser.js +5 -5
  65. package/dist/src/pipeline/structured-output/prompt.js +38 -38
  66. package/dist/src/pipeline/structured-output/waiter.js +6 -6
  67. package/dist/src/pipeline/template.js +5 -5
  68. package/dist/src/pipeline/timeline-log-store.js +5 -5
  69. package/dist/src/pipeline/tool-activity.js +3 -3
  70. package/dist/src/pipeline/types/pipeline-output.js +1 -1
  71. package/dist/src/pipeline/workflow/branch-rules.js +19 -19
  72. package/dist/src/pipeline/workflow/io.js +1 -1
  73. package/dist/src/pipeline/workflow/normalize.js +18 -18
  74. package/dist/src/pipeline/workflow/template-mapper.js +3 -3
  75. package/dist/src/pipeline/workflow/validate.js +39 -39
  76. package/dist/src/pipeline/workflow-graph.js +10 -10
  77. package/dist/src/server/http-handler.js +74 -0
  78. package/dist/src/services/agent-service.js +2 -2
  79. package/dist/src/services/gateway-read-helpers.js +1 -1
  80. package/dist/src/services/pipeline-service.js +19 -19
  81. package/dist/src/services/pipeline-status.js +4 -4
  82. package/dist/src/services/read-services.js +1 -1
  83. package/dist/src/services/session-service.js +6 -6
  84. package/dist/src/services/system-service.js +1 -1
  85. package/dist/src/transport/ws-broker.js +12 -1
  86. package/dist/src/transport/ws-handler.js +60 -0
  87. package/dist/src/transport/ws-methods/agents.js +144 -0
  88. package/dist/src/transport/ws-methods/artifacts.js +171 -0
  89. package/dist/src/transport/ws-methods/gateway.js +16 -0
  90. package/dist/src/transport/ws-methods/logs.js +43 -0
  91. package/dist/src/transport/ws-methods/pipeline-batch.js +68 -0
  92. package/dist/src/transport/ws-methods/pipeline-links.js +100 -0
  93. package/dist/src/transport/ws-methods/pipeline-queue.js +51 -0
  94. package/dist/src/transport/ws-methods/pipeline-runtime.js +151 -0
  95. package/dist/src/transport/ws-methods/pipeline-scheduler.js +48 -0
  96. package/dist/src/transport/ws-methods/pipeline-workflow.js +127 -0
  97. package/dist/src/transport/ws-methods/pipelines.js +56 -0
  98. package/dist/src/transport/ws-methods/register-all.js +32 -0
  99. package/dist/src/transport/ws-methods/sessions.js +154 -0
  100. package/dist/src/transport/ws-methods/timeline.js +10 -0
  101. package/dist/src/{server/routes/pipeline-identity.js → transport/ws-methods/utils.js} +14 -9
  102. package/dist/src/version.js +1 -1
  103. package/package.json +16 -7
  104. package/web/dist/assets/agent-DP6TMcLj.js +1 -0
  105. package/web/dist/assets/agent-DmJHzLyj.js +1 -0
  106. package/web/dist/assets/artifact-BqnoZy2M.js +1 -0
  107. package/web/dist/assets/artifact-DfDkgkno.js +1 -0
  108. package/web/dist/assets/common-DRMTVwE9.js +1 -0
  109. package/web/dist/assets/common-DeXccbr2.js +1 -0
  110. package/web/dist/assets/dispatch-CBskGCQI.js +1 -0
  111. package/web/dist/assets/dispatch-sk4Wp30e.js +1 -0
  112. package/web/dist/assets/index-C8wTjZvH.css +1 -0
  113. package/web/dist/assets/index-DYDQZRLk.js +58 -0
  114. package/web/dist/assets/log-DN8cjb0w.js +1 -0
  115. package/web/dist/assets/log-HSeA_dYy.js +1 -0
  116. package/web/dist/assets/modal-BdNai9jf.js +1 -0
  117. package/web/dist/assets/modal-D9_KDpFD.js +1 -0
  118. package/web/dist/assets/nav-BmF7oAKg.js +1 -0
  119. package/web/dist/assets/nav-IjC2xqXQ.js +1 -0
  120. package/web/dist/assets/node-detail-CENRXcrh.js +1 -0
  121. package/web/dist/assets/node-detail-bndPr0IM.js +1 -0
  122. package/web/dist/assets/overview-B87zWAxq.js +1 -0
  123. package/web/dist/assets/overview-gQvk-NOK.js +1 -0
  124. package/web/dist/assets/pipeline-D4dSJRDz.js +1 -0
  125. package/web/dist/assets/pipeline-DZzyOqQa.js +1 -0
  126. package/web/dist/assets/session-CUWvU14v.js +5 -0
  127. package/web/dist/assets/session-DQ6UuCaJ.js +5 -0
  128. package/web/dist/assets/timeline-8y_2_0Em.js +1 -0
  129. package/web/dist/assets/timeline-CAPsXUTC.js +1 -0
  130. package/web/dist/index.html +3 -3
  131. package/dist/src/app/pipeline-plugin-config.js +0 -2
  132. package/dist/src/server/api-handler.js +0 -163
  133. package/dist/src/server/http-utils.js +0 -34
  134. package/dist/src/server/middleware.js +0 -61
  135. package/dist/src/server/router.js +0 -105
  136. package/dist/src/server/routes/agents.js +0 -189
  137. package/dist/src/server/routes/artifacts.js +0 -163
  138. package/dist/src/server/routes/gateway.js +0 -18
  139. package/dist/src/server/routes/health.js +0 -16
  140. package/dist/src/server/routes/logs.js +0 -73
  141. package/dist/src/server/routes/pipeline-batch.js +0 -163
  142. package/dist/src/server/routes/pipeline-diagnostics.js +0 -33
  143. package/dist/src/server/routes/pipeline-links.js +0 -117
  144. package/dist/src/server/routes/pipeline-outputs.js +0 -27
  145. package/dist/src/server/routes/pipeline-queue.js +0 -62
  146. package/dist/src/server/routes/pipeline-runtime.js +0 -162
  147. package/dist/src/server/routes/pipeline-scheduler.js +0 -69
  148. package/dist/src/server/routes/pipeline-workflow.js +0 -180
  149. package/dist/src/server/routes/pipelines.js +0 -96
  150. package/dist/src/server/routes/sessions.js +0 -244
  151. package/dist/src/server/routes/timeline.js +0 -14
  152. package/dist/src/server/serve-static.js +0 -42
  153. package/web/dist/assets/index-CWnfhkn-.js +0 -65
  154. package/web/dist/assets/index-gZ0xOfSO.css +0 -1
  155. /package/dist/src/{server → transport/ws-methods}/types.js +0 -0
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.pipelineRoutes = exports.pipelineDiagnoseCommand = exports.pipelineRetryNodeCommand = exports.pipelineStopCommand = exports.pipelineWatchCommand = exports.pipelineStatusCommand = exports.pipelineStartCommand = exports.pipelineGetCommand = exports.pipelineListCommand = void 0;
4
4
  const errors_1 = require("../errors");
5
+ const i18n_1 = require("../i18n");
5
6
  const errors_2 = require("./pipeline/errors");
6
7
  const result_1 = require("./pipeline/result");
7
8
  const selector_1 = require("./pipeline/selector");
@@ -146,56 +147,56 @@ exports.pipelineRoutes = [
146
147
  {
147
148
  key: "pipeline.list",
148
149
  path: ["pipeline", "list"],
149
- description: "输出流水线列表",
150
+ description: (0, i18n_1.t)("pipeline.list.description"),
150
151
  handler: exports.pipelineListCommand,
151
152
  help: {
152
153
  usage: "taskmeld pipeline list [--format <json|md>]",
153
- summary: "输出流水线列表",
154
+ summary: (0, i18n_1.t)("pipeline.list.summary"),
154
155
  },
155
156
  },
156
157
  {
157
158
  key: "pipeline.get",
158
159
  path: ["pipeline", "get"],
159
- description: "输出指定流水线详情",
160
+ description: (0, i18n_1.t)("pipeline.get.description"),
160
161
  handler: exports.pipelineGetCommand,
161
162
  help: {
162
163
  usage: "taskmeld pipeline get <id> [--format <json|md>]",
163
- args: [{ name: "id", required: true, description: "流水线 ID" }],
164
- summary: "输出指定流水线详情",
164
+ args: [{ name: "id", required: true, description: (0, i18n_1.t)("pipeline.get.argId") }],
165
+ summary: (0, i18n_1.t)("pipeline.get.summary"),
165
166
  },
166
167
  },
167
168
  {
168
169
  key: "pipeline.start",
169
170
  path: ["pipeline", "start"],
170
- description: "发起指定流水线运行(不承诺已完成)",
171
+ description: (0, i18n_1.t)("pipeline.start.description"),
171
172
  handler: exports.pipelineStartCommand,
172
173
  bootstrap: { runtimeApiOnly: true, ensureServerReady: true },
173
174
  help: {
174
175
  usage: "taskmeld pipeline start <pipelineId> [--watch] [--timeout <ms>] [--interval <ms>] [--format <json|md>]",
175
- args: [{ name: "pipelineId", required: true, description: "流水线 ID" }],
176
+ args: [{ name: "pipelineId", required: true, description: (0, i18n_1.t)("pipeline.start.argPipelineId") }],
176
177
  options: [
177
- { flags: ["--watch"], description: "启动后继续等待运行完成" },
178
- { flags: ["--timeout"], valueName: "ms", description: "watch 超时时间,默认 600000" },
179
- { flags: ["--interval"], valueName: "ms", description: "watch 轮询间隔,默认 1200" },
178
+ { flags: ["--watch"], description: (0, i18n_1.t)("pipeline.start.optWatch") },
179
+ { flags: ["--timeout"], valueName: "ms", description: (0, i18n_1.t)("pipeline.start.optTimeout") },
180
+ { flags: ["--interval"], valueName: "ms", description: (0, i18n_1.t)("pipeline.start.optInterval") },
180
181
  ],
181
182
  notes: [
182
- "start 只负责发起运行请求,不承诺命令返回时业务已执行完成。",
183
- "--watch 会在发起成功后进入等待流程。",
183
+ (0, i18n_1.t)("pipeline.start.noteOnlyStart"),
184
+ (0, i18n_1.t)("pipeline.start.noteWatch"),
184
185
  ],
185
186
  },
186
187
  },
187
188
  {
188
189
  key: "pipeline.status",
189
190
  path: ["pipeline", "status"],
190
- description: "输出指定流水线当前运行状态",
191
+ description: (0, i18n_1.t)("pipeline.status.description"),
191
192
  handler: exports.pipelineStatusCommand,
192
193
  bootstrap: { runtimeApiOnly: true, ensureServerReady: true },
193
194
  help: {
194
195
  usage: "taskmeld pipeline status [<pipelineId>] [--run-id <id>] [--batch-run-id <id>] [--format <json|md>]",
195
- args: [{ name: "pipelineId", description: "兼容入口,按流水线 ID 查询当前运行" }],
196
+ args: [{ name: "pipelineId", description: (0, i18n_1.t)("pipeline.status.argPipelineId") }],
196
197
  options: [
197
- { flags: ["--run-id"], valueName: "id", description: "按单次运行 ID 精确查询" },
198
- { flags: ["--batch-run-id"], valueName: "id", description: "按批跑 ID 精确查询" },
198
+ { flags: ["--run-id"], valueName: "id", description: (0, i18n_1.t)("pipeline.status.optRunId") },
199
+ { flags: ["--batch-run-id"], valueName: "id", description: (0, i18n_1.t)("pipeline.status.optBatchRunId") },
199
200
  ],
200
201
  examples: [
201
202
  "taskmeld pipeline status A",
@@ -203,25 +204,25 @@ exports.pipelineRoutes = [
203
204
  "taskmeld pipeline status A --batch-run-id batch:A:2026-05-08T18:34:08.978Z",
204
205
  ],
205
206
  notes: [
206
- "需要至少提供 <pipelineId>、--run-id、--batch-run-id 之一。",
207
- "未提供 selector 时,默认按 pipelineId 查询当前活动运行。",
207
+ (0, i18n_1.t)("pipeline.status.noteNeedSelector"),
208
+ (0, i18n_1.t)("pipeline.status.noteDefaultQuery"),
208
209
  ],
209
210
  },
210
211
  },
211
212
  {
212
213
  key: "pipeline.watch",
213
214
  path: ["pipeline", "watch"],
214
- description: "监听指定流水线直到结束或超时",
215
+ description: (0, i18n_1.t)("pipeline.watch.description"),
215
216
  handler: exports.pipelineWatchCommand,
216
217
  bootstrap: { runtimeApiOnly: true, ensureServerReady: true },
217
218
  help: {
218
219
  usage: "taskmeld pipeline watch [<pipelineId>] [--run-id <id>] [--batch-run-id <id>] [--timeout <ms>] [--interval <ms>] [--format <json|md>]",
219
- args: [{ name: "pipelineId", description: "兼容入口,监听该流水线当前运行" }],
220
+ args: [{ name: "pipelineId", description: (0, i18n_1.t)("pipeline.watch.argPipelineId") }],
220
221
  options: [
221
- { flags: ["--run-id"], valueName: "id", description: "按单次运行 ID 精确监听" },
222
- { flags: ["--batch-run-id"], valueName: "id", description: "按批跑 ID 精确监听" },
223
- { flags: ["--timeout"], valueName: "ms", description: "watch 超时时间,默认 600000" },
224
- { flags: ["--interval"], valueName: "ms", description: "watch 轮询间隔,默认 1200" },
222
+ { flags: ["--run-id"], valueName: "id", description: (0, i18n_1.t)("pipeline.watch.optRunId") },
223
+ { flags: ["--batch-run-id"], valueName: "id", description: (0, i18n_1.t)("pipeline.watch.optBatchRunId") },
224
+ { flags: ["--timeout"], valueName: "ms", description: (0, i18n_1.t)("pipeline.watch.optTimeout") },
225
+ { flags: ["--interval"], valueName: "ms", description: (0, i18n_1.t)("pipeline.watch.optInterval") },
225
226
  ],
226
227
  examples: [
227
228
  "taskmeld pipeline watch A",
@@ -229,68 +230,68 @@ exports.pipelineRoutes = [
229
230
  "taskmeld pipeline watch --batch-run-id batch:A:2026-05-08T18:34:08.978Z --timeout 900000",
230
231
  ],
231
232
  notes: [
232
- "watch 是监听命令,不负责发起新运行。",
233
- "需要至少提供 <pipelineId>、--run-id、--batch-run-id 之一。",
234
- "当前 watch 语义为事件流优先,轮询作为兜底路径。",
233
+ (0, i18n_1.t)("pipeline.watch.noteIsWatch"),
234
+ (0, i18n_1.t)("pipeline.watch.noteNeedSelector"),
235
+ (0, i18n_1.t)("pipeline.watch.notePollingFallback"),
235
236
  ],
236
237
  },
237
238
  },
238
239
  {
239
240
  key: "pipeline.stop",
240
241
  path: ["pipeline", "stop"],
241
- description: "停止指定流水线批跑任务",
242
+ description: (0, i18n_1.t)("pipeline.stop.description"),
242
243
  handler: exports.pipelineStopCommand,
243
244
  bootstrap: { runtimeApiOnly: true, ensureServerReady: true },
244
245
  help: {
245
246
  usage: "taskmeld pipeline stop [<pipelineId>] [--run-id <id>] [--batch-run-id <id>] [--format <json|md>]",
246
- args: [{ name: "pipelineId", description: "兼容入口,停止该流水线当前运行" }],
247
+ args: [{ name: "pipelineId", description: (0, i18n_1.t)("pipeline.stop.argPipelineId") }],
247
248
  options: [
248
- { flags: ["--run-id"], valueName: "id", description: "按单次运行 ID 精确停止" },
249
- { flags: ["--batch-run-id"], valueName: "id", description: "按批跑 ID 精确停止" },
249
+ { flags: ["--run-id"], valueName: "id", description: (0, i18n_1.t)("pipeline.stop.optRunId") },
250
+ { flags: ["--batch-run-id"], valueName: "id", description: (0, i18n_1.t)("pipeline.stop.optBatchRunId") },
250
251
  ],
251
252
  notes: [
252
- "需要至少提供 <pipelineId>、--run-id、--batch-run-id 之一。",
253
- "当前 stop 主要用于停止批跑任务。",
254
- "对非批跑运行会返回业务错误,而不是静默成功。",
253
+ (0, i18n_1.t)("pipeline.stop.noteNeedSelector"),
254
+ (0, i18n_1.t)("pipeline.stop.noteBatchOnly"),
255
+ (0, i18n_1.t)("pipeline.stop.noteNonBatch"),
255
256
  ],
256
257
  },
257
258
  },
258
259
  {
259
260
  key: "pipeline.retry-node",
260
261
  path: ["pipeline", "retry-node"],
261
- description: "重试指定节点或节点条目",
262
+ description: (0, i18n_1.t)("pipeline.retryNode.description"),
262
263
  handler: exports.pipelineRetryNodeCommand,
263
264
  bootstrap: { gateway: "required" },
264
265
  help: {
265
266
  usage: "taskmeld pipeline retry-node <pipelineId> <nodeId> [--item <itemKey>] [--format <json|md>]",
266
267
  args: [
267
- { name: "pipelineId", required: true, description: "流水线 ID" },
268
- { name: "nodeId", required: true, description: "节点 ID" },
268
+ { name: "pipelineId", required: true, description: (0, i18n_1.t)("pipeline.retryNode.argPipelineId") },
269
+ { name: "nodeId", required: true, description: (0, i18n_1.t)("pipeline.retryNode.argNodeId") },
269
270
  ],
270
- options: [{ flags: ["--item"], valueName: "itemKey", description: "指定重试的条目键" }],
271
- summary: "重试指定节点或节点条目",
271
+ options: [{ flags: ["--item"], valueName: "itemKey", description: (0, i18n_1.t)("pipeline.retryNode.optItem") }],
272
+ summary: (0, i18n_1.t)("pipeline.retryNode.summary"),
272
273
  },
273
274
  },
274
275
  {
275
276
  key: "pipeline.diagnose",
276
277
  path: ["pipeline", "diagnose"],
277
- description: "诊断指定节点依赖状态,输出阻塞原因",
278
+ description: (0, i18n_1.t)("pipeline.diagnose.description"),
278
279
  handler: exports.pipelineDiagnoseCommand,
279
280
  bootstrap: { runtimeApiOnly: true, ensureServerReady: true },
280
281
  help: {
281
282
  usage: "taskmeld pipeline diagnose <pipelineId> <nodeId> [--item <itemKey>] [--format <json|md>]",
282
283
  args: [
283
- { name: "pipelineId", required: true, description: "流水线 ID" },
284
- { name: "nodeId", required: true, description: "节点 ID" },
284
+ { name: "pipelineId", required: true, description: (0, i18n_1.t)("pipeline.diagnose.argPipelineId") },
285
+ { name: "nodeId", required: true, description: (0, i18n_1.t)("pipeline.diagnose.argNodeId") },
285
286
  ],
286
- options: [{ flags: ["--item"], valueName: "itemKey", description: "可选,指定条目键精确诊断" }],
287
- summary: "诊断指定节点依赖状态,输出阻塞原因",
287
+ options: [{ flags: ["--item"], valueName: "itemKey", description: (0, i18n_1.t)("pipeline.diagnose.optItem") }],
288
+ summary: (0, i18n_1.t)("pipeline.diagnose.summary"),
288
289
  },
289
290
  },
290
291
  {
291
292
  key: "pipeline.output",
292
293
  path: ["pipeline", "output"],
293
- description: "查询流水线最终产物",
294
+ description: (0, i18n_1.t)("pipeline.output.description"),
294
295
  handler: async (input, ctx) => {
295
296
  const pipelineId = (0, errors_1.assertRequiredArg)(input.args[0], "pipelineId");
296
297
  const runId = (0, selector_1.pickOptionalStringFlag)(input.flags.run);
@@ -303,28 +304,28 @@ exports.pipelineRoutes = [
303
304
  },
304
305
  help: {
305
306
  usage: "taskmeld pipeline output <pipelineId> [--run <runId>]",
306
- args: [{ name: "pipelineId", required: true, description: "流水线 ID" }],
307
- options: [{ flags: ["--run"], valueName: "runId", description: "按 runId 精确查询" }],
308
- summary: "查询流水线最终产物",
307
+ args: [{ name: "pipelineId", required: true, description: (0, i18n_1.t)("pipeline.output.argPipelineId") }],
308
+ options: [{ flags: ["--run"], valueName: "runId", description: (0, i18n_1.t)("pipeline.output.optRun") }],
309
+ summary: (0, i18n_1.t)("pipeline.output.summary"),
309
310
  },
310
311
  },
311
312
  {
312
313
  key: "pipeline.link-list",
313
314
  path: ["pipeline", "link", "list"],
314
- description: "列出所有流水线投递链接",
315
+ description: (0, i18n_1.t)("pipeline.linkList.description"),
315
316
  handler: async (_input, ctx) => {
316
317
  const links = await ctx.app.pipelineService.listLinks();
317
318
  return { ok: true, items: links };
318
319
  },
319
320
  help: {
320
321
  usage: "taskmeld pipeline link list",
321
- summary: "列出所有流水线投递链接",
322
+ summary: (0, i18n_1.t)("pipeline.linkList.summary"),
322
323
  },
323
324
  },
324
325
  {
325
326
  key: "pipeline.queue",
326
327
  path: ["pipeline", "queue"],
327
- description: "查询流水线接收队列",
328
+ description: (0, i18n_1.t)("pipeline.queue.description"),
328
329
  handler: async (input, ctx) => {
329
330
  const pipelineId = (0, errors_1.assertRequiredArg)(input.args[0], "pipelineId");
330
331
  const items = ctx.app.pipelineService.getQueue(pipelineId);
@@ -332,8 +333,8 @@ exports.pipelineRoutes = [
332
333
  },
333
334
  help: {
334
335
  usage: "taskmeld pipeline queue <pipelineId>",
335
- args: [{ name: "pipelineId", required: true, description: "流水线 ID" }],
336
- summary: "查询流水线接收队列",
336
+ args: [{ name: "pipelineId", required: true, description: (0, i18n_1.t)("pipeline.queue.argPipelineId") }],
337
+ summary: (0, i18n_1.t)("pipeline.queue.summary"),
337
338
  },
338
339
  },
339
340
  ];
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schedulerRoutes = exports.schedulerModeCommand = exports.schedulerToggleCommand = void 0;
4
4
  const errors_1 = require("../errors");
5
+ const i18n_1 = require("../i18n");
5
6
  const assertSchedulerMode = (value) => {
6
7
  if (typeof value === "string") {
7
8
  const normalized = value.trim().toLowerCase();
@@ -57,25 +58,25 @@ exports.schedulerRoutes = [
57
58
  {
58
59
  key: "scheduler.toggle",
59
60
  path: ["scheduler", "toggle"],
60
- description: "启用或停用调度器",
61
+ description: (0, i18n_1.t)("scheduler.toggle.description"),
61
62
  handler: exports.schedulerToggleCommand,
62
63
  help: {
63
64
  usage: "taskmeld scheduler toggle <pipelineId> --enabled <true|false> [--format <json|md>]",
64
- args: [{ name: "pipelineId", required: true, description: "流水线 ID" }],
65
- options: [{ flags: ["--enabled"], valueName: "true|false", required: true, description: "是否启用调度器" }],
66
- notes: ["<pipelineId> 与 --enabled 均为必填控制项。"],
65
+ args: [{ name: "pipelineId", required: true, description: (0, i18n_1.t)("scheduler.toggle.argPipelineId") }],
66
+ options: [{ flags: ["--enabled"], valueName: "true|false", required: true, description: (0, i18n_1.t)("scheduler.toggle.optEnabled") }],
67
+ notes: [(0, i18n_1.t)("scheduler.toggle.note")],
67
68
  },
68
69
  },
69
70
  {
70
71
  key: "scheduler.mode",
71
72
  path: ["scheduler", "mode"],
72
- description: "切换调度器模式",
73
+ description: (0, i18n_1.t)("scheduler.mode.description"),
73
74
  handler: exports.schedulerModeCommand,
74
75
  help: {
75
76
  usage: "taskmeld scheduler mode <pipelineId> --mode <auto|manual> [--format <json|md>]",
76
- args: [{ name: "pipelineId", required: true, description: "流水线 ID" }],
77
- options: [{ flags: ["--mode"], valueName: "auto|manual", required: true, description: "调度器模式" }],
78
- notes: ["<pipelineId> 与 --mode 均为必填控制项。"],
77
+ args: [{ name: "pipelineId", required: true, description: (0, i18n_1.t)("scheduler.mode.argPipelineId") }],
78
+ options: [{ flags: ["--mode"], valueName: "auto|manual", required: true, description: (0, i18n_1.t)("scheduler.mode.optMode") }],
79
+ notes: [(0, i18n_1.t)("scheduler.mode.note")],
79
80
  },
80
81
  },
81
82
  ];
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.serverRoutes = exports.serverStopCommand = exports.serverStatusCommand = exports.serverStartCommand = exports.serverEnsureCommand = void 0;
4
+ const i18n_1 = require("../i18n");
4
5
  const serverEnsureCommand = async (_input, ctx) => {
5
6
  return ctx.app.serverService.ensureServerReady();
6
7
  };
@@ -21,50 +22,50 @@ exports.serverRoutes = [
21
22
  {
22
23
  key: "server.ensure",
23
24
  path: ["server", "ensure"],
24
- description: "确保本地控制面后端已启动并健康",
25
+ description: (0, i18n_1.t)("server.ensure.description"),
25
26
  handler: exports.serverEnsureCommand,
26
27
  bootstrap: { runtimeApiOnly: true },
27
28
  help: {
28
29
  usage: "taskmeld server ensure [--format <json|md>]",
29
- summary: "确保本地 control-plane daemon 已启动并健康",
30
+ summary: (0, i18n_1.t)("server.ensure.summary"),
30
31
  notes: [
31
- "daemon-first 语义:优先复用已存在且健康的本地实例。",
32
- "仅在没有可复用健康实例时,才会启动新的 daemon。",
32
+ (0, i18n_1.t)("server.ensure.noteDaemonFirst"),
33
+ (0, i18n_1.t)("server.ensure.noteNewDaemon"),
33
34
  ],
34
35
  },
35
36
  },
36
37
  {
37
38
  key: "server.start",
38
39
  path: ["server", "start"],
39
- description: "显式启动本地控制面后端",
40
+ description: (0, i18n_1.t)("server.start.description"),
40
41
  handler: exports.serverStartCommand,
41
42
  bootstrap: { runtimeApiOnly: true },
42
43
  help: {
43
44
  usage: "taskmeld server start [--format <json|md>]",
44
- summary: "显式启动本地 control-plane daemon",
45
+ summary: (0, i18n_1.t)("server.start.summary"),
45
46
  },
46
47
  },
47
48
  {
48
49
  key: "server.status",
49
50
  path: ["server", "status"],
50
- description: "输出本地控制面后端状态",
51
+ description: (0, i18n_1.t)("server.status.description"),
51
52
  handler: exports.serverStatusCommand,
52
53
  bootstrap: { runtimeApiOnly: true },
53
54
  help: {
54
55
  usage: "taskmeld server status [--format <json|md>]",
55
- summary: "查看本地 control-plane daemon 的健康、ownership 与 pid 信息",
56
- notes: ["状态输出用于确认本地 daemon 是否可复用以及当前 owner 元数据是否一致。"],
56
+ summary: (0, i18n_1.t)("server.status.summary"),
57
+ notes: [(0, i18n_1.t)("server.status.note")],
57
58
  },
58
59
  },
59
60
  {
60
61
  key: "server.stop",
61
62
  path: ["server", "stop"],
62
- description: "停止本地控制面后端",
63
+ description: (0, i18n_1.t)("server.stop.description"),
63
64
  handler: exports.serverStopCommand,
64
65
  bootstrap: { runtimeApiOnly: true },
65
66
  help: {
66
67
  usage: "taskmeld server stop [--format <json|md>]",
67
- summary: "停止本地 control-plane daemon",
68
+ summary: (0, i18n_1.t)("server.stop.summary"),
68
69
  },
69
70
  },
70
71
  ];
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.systemRoutes = exports.systemSnapshotCommand = void 0;
4
+ const i18n_1 = require("../i18n");
4
5
  const systemSnapshotCommand = async (_input, ctx) => {
5
- // 系统快照由主线 service 层提供,CLI 只做编排与输出。
6
+ // The system snapshot is provided by the mainline service layer; the CLI only handles orchestration and output.
6
7
  return ctx.app.systemService.getSnapshot();
7
8
  };
8
9
  exports.systemSnapshotCommand = systemSnapshotCommand;
@@ -10,12 +11,12 @@ exports.systemRoutes = [
10
11
  {
11
12
  key: "system.snapshot",
12
13
  path: ["system", "snapshot"],
13
- description: "输出系统全局快照",
14
+ description: (0, i18n_1.t)("system.snapshot.description"),
14
15
  handler: exports.systemSnapshotCommand,
15
16
  bootstrap: { gateway: "warmup" },
16
17
  help: {
17
18
  usage: "taskmeld system snapshot [--format <json|md>]",
18
- summary: "输出系统全局快照",
19
+ summary: (0, i18n_1.t)("system.snapshot.summary"),
19
20
  },
20
21
  },
21
22
  ];
@@ -14,7 +14,7 @@ class CliError extends Error {
14
14
  }
15
15
  }
16
16
  exports.CliError = CliError;
17
- // 统一把未知异常规范化,避免 CLI 输出结构漂移。
17
+ // Unify unknown exception normalization to prevent CLI output structure drift.
18
18
  const toCliError = (error) => {
19
19
  if (error instanceof CliError)
20
20
  return error;
@@ -31,7 +31,7 @@ const toCliError = (error) => {
31
31
  });
32
32
  };
33
33
  exports.toCliError = toCliError;
34
- // 在不改动原错误元信息的前提下,为参数类错误附加帮助提示。
34
+ // Without altering the original error metadata, attach a help hint to argument-type errors.
35
35
  const withHelpHint = (error, hint) => {
36
36
  if (!hint.trim())
37
37
  return error;
@@ -1,21 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveHelpHintByRouteKey = exports.resolveHelpHint = exports.resolveHelp = void 0;
4
- const ROOT_USAGE = "taskmeld <resource> <action> [args] [--flags]";
4
+ const i18n_1 = require("./i18n");
5
+ const ROOT_USAGE = (0, i18n_1.t)("help.usage");
5
6
  const GROUP_DESCRIPTIONS = {
6
- agent: "智能体管理",
7
- artifact: "产物管理",
8
- init: "First-time setup",
9
- pipeline: "流水线管理",
10
- scheduler: "调度控制",
11
- server: "后端服务管理",
12
- system: "系统信息",
7
+ agent: (0, i18n_1.t)("help.groups.agent"),
8
+ artifact: (0, i18n_1.t)("help.groups.artifact"),
9
+ init: (0, i18n_1.t)("help.groups.init"),
10
+ pipeline: (0, i18n_1.t)("help.groups.pipeline"),
11
+ scheduler: (0, i18n_1.t)("help.groups.scheduler"),
12
+ server: (0, i18n_1.t)("help.groups.server"),
13
+ system: (0, i18n_1.t)("help.groups.system"),
13
14
  };
14
15
  const COMMON_OPTIONS_LINES = [
15
- "Common Options:",
16
- " -f, --format <json|md> 输出格式(默认: md)",
17
- " --envelope 仅与 --format json 搭配可用,输出完整包装层",
18
- " -h, --help 显示当前命令帮助",
16
+ (0, i18n_1.t)("help.commonOptions.title"),
17
+ ` -f, --format <json|md> ${(0, i18n_1.t)("help.commonOptions.format")}`,
18
+ ` --envelope ${(0, i18n_1.t)("help.commonOptions.envelope")}`,
19
+ ` -h, --help ${(0, i18n_1.t)("help.commonOptions.help")}`,
19
20
  ];
20
21
  const listPublicRoutes = (routes) => {
21
22
  return routes.filter((route) => route.hidden !== true);
@@ -38,7 +39,7 @@ const formatArgsBlock = (args) => {
38
39
  "Arguments:",
39
40
  ...args.map((item) => {
40
41
  const printableName = item.name.startsWith("<") ? item.name : `<${item.name}>`;
41
- const requiredLabel = item.required ? "必填" : "可选";
42
+ const requiredLabel = item.required ? (0, i18n_1.t)("help.label.required") : (0, i18n_1.t)("help.label.optional");
42
43
  const detail = item.description ? `,${item.description}` : "";
43
44
  return ` ${printableName} ${requiredLabel}${detail}`;
44
45
  }),
@@ -52,7 +53,7 @@ const formatOptionsBlock = (options) => {
52
53
  ...options.map((item) => {
53
54
  const flagName = item.flags.join(", ");
54
55
  const valueHint = item.valueName ? ` <${item.valueName}>` : "";
55
- const requiredLabel = item.required ? "必填" : "可选";
56
+ const requiredLabel = item.required ? (0, i18n_1.t)("help.label.required") : (0, i18n_1.t)("help.label.optional");
56
57
  const detail = item.description ? `,${item.description}` : "";
57
58
  return ` ${flagName}${valueHint} ${requiredLabel}${detail}`;
58
59
  }),
@@ -84,8 +85,8 @@ const renderRoot = (routes) => {
84
85
  }),
85
86
  "",
86
87
  "Tips:",
87
- " taskmeld <resource> -h 查看一级命令帮助",
88
- " taskmeld <resource> <action> -h 查看二级命令帮助",
88
+ ` taskmeld <resource> -h ${(0, i18n_1.t)("help.tips.groupHelp")}`,
89
+ ` taskmeld <resource> <action> -h ${(0, i18n_1.t)("help.tips.commandHelp")}`,
89
90
  ];
90
91
  return lines.join("\n");
91
92
  };
@@ -127,7 +128,7 @@ const renderAutoCommandHelp = (route) => {
127
128
  return lines.join("\n");
128
129
  };
129
130
  const renderCommand = (route) => {
130
- // 保留特例出口是为了兼容未来极少数需要完全自定义排版的命令;默认路径必须使用路由元数据生成。
131
+ // This special-case exit point exists for future compatibility with the very few commands that require fully custom layout; the default path must use route metadata generation.
131
132
  const text = route.renderHelp ? route.renderHelp(route) : renderAutoCommandHelp(route);
132
133
  const lines = text.split("\n");
133
134
  appendCommonOptions(lines);
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.changeLocale = exports.t = void 0;
7
+ const node_os_1 = require("node:os");
8
+ const node_path_1 = require("node:path");
9
+ const node_fs_1 = require("node:fs");
10
+ const i18next_1 = __importDefault(require("i18next"));
11
+ const zh_json_1 = __importDefault(require("./locales/zh.json"));
12
+ const en_json_1 = __importDefault(require("./locales/en.json"));
13
+ const resolveLocale = () => {
14
+ // 1. env override
15
+ const envLocale = process.env.TASKMELD_LOCALE?.trim();
16
+ if (envLocale && ["zh", "en"].includes(envLocale))
17
+ return envLocale;
18
+ // 2. config.json
19
+ try {
20
+ const configPath = (0, node_path_1.join)((0, node_os_1.homedir)(), ".taskmeld", "config.json");
21
+ const raw = (0, node_fs_1.readFileSync)(configPath, "utf8");
22
+ const config = JSON.parse(raw);
23
+ if (config.locale && ["zh", "en"].includes(config.locale)) {
24
+ return config.locale;
25
+ }
26
+ }
27
+ catch {
28
+ // config file not found or invalid, fall through
29
+ }
30
+ return "en";
31
+ };
32
+ i18next_1.default.init({
33
+ lng: resolveLocale(),
34
+ resources: {
35
+ zh: { cli: zh_json_1.default },
36
+ en: { cli: en_json_1.default },
37
+ },
38
+ defaultNS: "cli",
39
+ fallbackLng: "en",
40
+ interpolation: { escapeValue: false },
41
+ });
42
+ exports.t = i18next_1.default.t.bind(i18next_1.default);
43
+ const changeLocale = async (locale) => {
44
+ await i18next_1.default.changeLanguage(locale);
45
+ };
46
+ exports.changeLocale = changeLocale;