@hcmai/cli 0.4.14 → 0.4.17

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/dist/index.js CHANGED
@@ -1839,7 +1839,7 @@ __export(run_exports, {
1839
1839
  });
1840
1840
  import React3 from "react";
1841
1841
  import { render } from "ink";
1842
- import { HcmClient as HcmClient9, WsClient, DEFAULT_AGENT_ID as DEFAULT_AGENT_ID2 } from "@hcmai/sdk";
1842
+ import { HcmClient as HcmClient10, WsClient, DEFAULT_AGENT_ID as DEFAULT_AGENT_ID2 } from "@hcmai/sdk";
1843
1843
  async function runInkRepl(args) {
1844
1844
  if (process.stdout.isTTY) {
1845
1845
  process.stdout.write("\x1B[>4;1m");
@@ -1847,7 +1847,7 @@ async function runInkRepl(args) {
1847
1847
  }
1848
1848
  try {
1849
1849
  const ctx = await getActiveAuthContextFromCli(args);
1850
- const client3 = HcmClient9.fromAuthContext(ctx);
1850
+ const client3 = HcmClient10.fromAuthContext(ctx);
1851
1851
  const ws = new WsClient({
1852
1852
  endpoint: ctx.endpoint.replace(/^http/, "ws") + "/ws/conversation",
1853
1853
  getAccessToken: () => client3.getAccessToken(),
@@ -2286,9 +2286,9 @@ async function loginCommand(args) {
2286
2286
  } catch (e) {
2287
2287
  const err = e;
2288
2288
  if (err.isAxiosError) {
2289
- const { fromAxiosError: fromAxiosError23 } = await import("@hcmai/sdk");
2289
+ const { fromAxiosError: fromAxiosError24 } = await import("@hcmai/sdk");
2290
2290
  exitWithError(
2291
- fromAxiosError23(
2291
+ fromAxiosError24(
2292
2292
  e,
2293
2293
  envName
2294
2294
  )
@@ -2847,7 +2847,7 @@ async function createCommand(model, args) {
2847
2847
  fileFlag: "--data-file"
2848
2848
  });
2849
2849
  const client3 = HcmClient3.fromAuthContext(await getActiveAuthContextFromCli(args));
2850
- const res = await client3.create(model, data);
2850
+ const res = await client3.create(model, data, { i18n: args.i18n });
2851
2851
  const fmt = args.output ?? "json";
2852
2852
  if (fmt !== "json") process.stdout.write("\u2705 created\n");
2853
2853
  process.stdout.write(formatObject2(res, { format: fmt }) + "\n");
@@ -2881,7 +2881,7 @@ async function updateCommand(model, args) {
2881
2881
  fileFlag: "--data-file"
2882
2882
  });
2883
2883
  const client3 = HcmClient4.fromAuthContext(await getActiveAuthContextFromCli(args));
2884
- const result = await client3.update(model, args.id, data);
2884
+ const result = await client3.update(model, args.id, data, { i18n: args.i18n });
2885
2885
  const fmt = args.output ?? "json";
2886
2886
  if (fmt !== "json") process.stdout.write(`\u2705 ${model}#${args.id} \u5DF2\u66F4\u65B0
2887
2887
  `);
@@ -3104,22 +3104,124 @@ async function upgradeCommand(args) {
3104
3104
  process.exit(args.check && latest !== null && latest !== CLI_VERSION ? 1 : 0);
3105
3105
  }
3106
3106
 
3107
+ // src/commands/open.ts
3108
+ init_auth_guard();
3109
+ init_exit();
3110
+ import { spawn } from "child_process";
3111
+ import { CliError as CliError12, CliErrorCode as CliErrorCode11, fromAxiosError as fromAxiosError7, HcmClient as HcmClient6, loadEnv as loadEnv5 } from "@hcmai/sdk";
3112
+ var BROWSER_TICKET_PATH = "/api/auth/browser-ticket";
3113
+ var SSO_CALLBACK_PATH = "/sso/callback";
3114
+ function normalizeTarget(target) {
3115
+ const raw = (target ?? "").trim();
3116
+ if (!raw) return "/";
3117
+ if (/^[a-z][a-z0-9+.-]*:\/\//i.test(raw)) {
3118
+ throw new CliError12({
3119
+ code: CliErrorCode11.INVALID_ARGUMENT,
3120
+ message: `\u53EA\u6536\u7AD9\u5185\u8DEF\u5F84\uFF08\u5982 /dashboard/<id>\uFF09\uFF0C\u4E0D\u6536\u5B8C\u6574 URL\uFF1A${raw}`
3121
+ });
3122
+ }
3123
+ return raw.startsWith("/") ? raw : `/${raw}`;
3124
+ }
3125
+ function buildBrowserLoginUrl(frontend, ticket, target) {
3126
+ const base = frontend.trim().replace(/\/+$/, "");
3127
+ const query = new URLSearchParams({ ticket, redirect: normalizeTarget(target) });
3128
+ return `${base}${SSO_CALLBACK_PATH}?${query.toString()}`;
3129
+ }
3130
+ function launcherFor(platform, url) {
3131
+ if (platform === "darwin") return { cmd: "open", args: [url] };
3132
+ if (platform === "win32") return { cmd: "cmd", args: ["/c", "start", "", url] };
3133
+ return { cmd: "xdg-open", args: [url] };
3134
+ }
3135
+ function launchBrowser(url, platform = process.platform) {
3136
+ const { cmd, args } = launcherFor(platform, url);
3137
+ const child = spawn(cmd, args, { detached: true, stdio: "ignore" });
3138
+ child.on("error", () => {
3139
+ });
3140
+ child.unref();
3141
+ }
3142
+ async function runOpen(target, args, deps) {
3143
+ const path12 = normalizeTarget(target);
3144
+ if (!deps.frontend?.trim()) {
3145
+ throw new CliError12({
3146
+ code: CliErrorCode11.INVALID_ARGUMENT,
3147
+ message: `env '${args.envName}' \u6CA1\u914D\u524D\u7AEF\u5730\u5740\uFF0C\u5F00\u4E0D\u4E86\u9875\u9762\u3002\u5148\u8DD1\uFF1Ahcm env edit frontend <\u524D\u7AEF\u5730\u5740> --env ${args.envName}`
3148
+ });
3149
+ }
3150
+ const { ticket, expiresIn } = await deps.mintTicket();
3151
+ const url = buildBrowserLoginUrl(deps.frontend, ticket, path12);
3152
+ if (args.printUrl) {
3153
+ deps.write(`${url}
3154
+ `);
3155
+ } else {
3156
+ deps.launch(url);
3157
+ deps.write(`\u5DF2\u7528\u5F53\u524D\u8EAB\u4EFD\u6253\u5F00 ${path12}\uFF08\u7968\u636E ${expiresIn ?? 60}s \u5185\u6709\u6548\uFF0C\u53EA\u80FD\u7528\u4E00\u6B21\uFF09
3158
+ `);
3159
+ }
3160
+ return { url, expiresIn };
3161
+ }
3162
+ async function openCommand(target, args) {
3163
+ try {
3164
+ const ctx = await getActiveAuthContextFromCli(args);
3165
+ const envCfg = await loadEnv5(ctx.env);
3166
+ const client3 = HcmClient6.fromAuthContext(ctx);
3167
+ await runOpen(
3168
+ target,
3169
+ { printUrl: args.printUrl, envName: ctx.env },
3170
+ {
3171
+ frontend: envCfg.frontend,
3172
+ mintTicket: async () => {
3173
+ let data;
3174
+ try {
3175
+ const resp = await client3.raw().post(BROWSER_TICKET_PATH, {});
3176
+ data = resp.data?.data ?? resp.data ?? {};
3177
+ } catch (e) {
3178
+ const err = e;
3179
+ if (err?.isAxiosError && err.response?.status === 404) {
3180
+ throw new CliError12({
3181
+ code: CliErrorCode11.INVALID_ARGUMENT,
3182
+ message: `\u540E\u7AEF\u6CA1\u6709 ${BROWSER_TICKET_PATH}\uFF08\u9700\u8981\u542B\u6D4F\u89C8\u5668\u4F1A\u8BDD\u7968\u636E\u7684\u540E\u7AEF\u7248\u672C\uFF09\uFF0C\u5347\u7EA7\u540E\u7AEF\u540E\u518D\u8BD5\u3002\u672C\u547D\u4EE4\u4E0D\u4F1A\u628A\u4F1A\u8BDD token \u62FC\u8FDB URL \u515C\u5E95\u3002`
3183
+ });
3184
+ }
3185
+ if (err?.isAxiosError) throw fromAxiosError7(err, ctx.env);
3186
+ throw e;
3187
+ }
3188
+ if (typeof data.ticket !== "string" || !data.ticket) {
3189
+ throw new CliError12({
3190
+ code: CliErrorCode11.INVALID_ARGUMENT,
3191
+ message: "\u94F8\u7968\u54CD\u5E94\u91CC\u6CA1\u6709 ticket \u2014\u2014 \u540E\u7AEF\u7248\u672C\u4E0E\u672C CLI \u7684\u5951\u7EA6\u5BF9\u4E0D\u4E0A"
3192
+ });
3193
+ }
3194
+ return {
3195
+ ticket: data.ticket,
3196
+ expiresIn: typeof data.expiresIn === "number" ? data.expiresIn : void 0
3197
+ };
3198
+ },
3199
+ launch: launchBrowser,
3200
+ write: (line) => process.stdout.write(line)
3201
+ }
3202
+ );
3203
+ process.exit(0);
3204
+ } catch (e) {
3205
+ exitWithError(e);
3206
+ }
3207
+ }
3208
+
3107
3209
  // src/commands/delete.ts
3108
3210
  init_auth_guard();
3109
3211
  init_exit();
3110
3212
  import {
3111
- HcmClient as HcmClient6,
3213
+ HcmClient as HcmClient7,
3112
3214
  formatObject as formatObject6,
3113
- fromAxiosError as fromAxiosError7,
3114
- CliError as CliError12,
3115
- CliErrorCode as CliErrorCode11
3215
+ fromAxiosError as fromAxiosError8,
3216
+ CliError as CliError13,
3217
+ CliErrorCode as CliErrorCode12
3116
3218
  } from "@hcmai/sdk";
3117
3219
  async function deleteCommand(model, args) {
3118
3220
  try {
3119
3221
  if (!args.id) {
3120
- throw new CliError12({ code: CliErrorCode11.MISSING_FLAG, message: "--id <id> \u5FC5\u586B" });
3222
+ throw new CliError13({ code: CliErrorCode12.MISSING_FLAG, message: "--id <id> \u5FC5\u586B" });
3121
3223
  }
3122
- const client3 = HcmClient6.fromAuthContext(await getActiveAuthContextFromCli(args));
3224
+ const client3 = HcmClient7.fromAuthContext(await getActiveAuthContextFromCli(args));
3123
3225
  const res = await client3.remove(model, args.id);
3124
3226
  const fmt = args.output ?? "json";
3125
3227
  if (fmt !== "json") process.stdout.write("\u2705 deleted\n");
@@ -3127,7 +3229,7 @@ async function deleteCommand(model, args) {
3127
3229
  process.exit(0);
3128
3230
  } catch (e) {
3129
3231
  const err = e;
3130
- if (err?.isAxiosError) exitWithError(fromAxiosError7(err, args.profile));
3232
+ if (err?.isAxiosError) exitWithError(fromAxiosError8(err, args.profile));
3131
3233
  exitWithError(e);
3132
3234
  }
3133
3235
  }
@@ -3138,11 +3240,11 @@ init_auth_guard();
3138
3240
  import { readFileSync as readFileSync2, readdirSync, statSync, writeFileSync } from "fs";
3139
3241
  import { join, relative } from "path";
3140
3242
  import {
3141
- HcmClient as HcmClient7,
3243
+ HcmClient as HcmClient8,
3142
3244
  parseFixture,
3143
3245
  runImport,
3144
3246
  formatObject as formatObject7,
3145
- fromAxiosError as fromAxiosError8
3247
+ fromAxiosError as fromAxiosError9
3146
3248
  } from "@hcmai/sdk";
3147
3249
  function collectYmlFiles(path12) {
3148
3250
  if (statSync(path12).isFile()) return [path12];
@@ -3173,7 +3275,7 @@ async function importCommand(path12, args) {
3173
3275
  updateOnly: !!args.updateOnly,
3174
3276
  onError: args.onError === "stop" ? "stop" : "continue"
3175
3277
  };
3176
- const client3 = opts.dryRun ? DRY_RUN_CLIENT : HcmClient7.fromAuthContext(await getActiveAuthContextFromCli(args));
3278
+ const client3 = opts.dryRun ? DRY_RUN_CLIENT : HcmClient8.fromAuthContext(await getActiveAuthContextFromCli(args));
3177
3279
  const result = await runImport(client3, fixtures, opts);
3178
3280
  if (args.report) writeFileSync(args.report, JSON.stringify(result, null, 2));
3179
3281
  const fmt = args.output ?? "json";
@@ -3186,7 +3288,7 @@ async function importCommand(path12, args) {
3186
3288
  process.exit(result.failed > 0 ? 3 : 0);
3187
3289
  } catch (e) {
3188
3290
  const err = e;
3189
- if (err?.isAxiosError) exitWithError(fromAxiosError8(err, args.profile));
3291
+ if (err?.isAxiosError) exitWithError(fromAxiosError9(err, args.profile));
3190
3292
  exitWithError(e);
3191
3293
  }
3192
3294
  }
@@ -3195,13 +3297,13 @@ async function importCommand(path12, args) {
3195
3297
  init_exit();
3196
3298
  init_auth_guard();
3197
3299
  import {
3198
- HcmClient as HcmClient8,
3300
+ HcmClient as HcmClient9,
3199
3301
  formatObject as formatObject8,
3200
- fromAxiosError as fromAxiosError9
3302
+ fromAxiosError as fromAxiosError10
3201
3303
  } from "@hcmai/sdk";
3202
3304
  async function describeCommand(model, args) {
3203
3305
  try {
3204
- const client3 = HcmClient8.fromAuthContext(await getActiveAuthContextFromCli(args));
3306
+ const client3 = HcmClient9.fromAuthContext(await getActiveAuthContextFromCli(args));
3205
3307
  const desc = await client3.describe(model, { verbose: !!args.verbose });
3206
3308
  const fmt = args.output ?? "table";
3207
3309
  if (fmt !== "table") {
@@ -3213,7 +3315,7 @@ async function describeCommand(model, args) {
3213
3315
  } catch (e) {
3214
3316
  const err = e;
3215
3317
  if (err?.isAxiosError) {
3216
- exitWithError(fromAxiosError9(err, args.profile));
3318
+ exitWithError(fromAxiosError10(err, args.profile));
3217
3319
  }
3218
3320
  exitWithError(e);
3219
3321
  }
@@ -3253,7 +3355,7 @@ function formatDescriptionTable(desc, verbose = false) {
3253
3355
  init_exit();
3254
3356
  init_auth_guard();
3255
3357
  import {
3256
- HcmClient as HcmClient10,
3358
+ HcmClient as HcmClient11,
3257
3359
  WsClient as WsClient2,
3258
3360
  oneShot,
3259
3361
  sendMessageAndStream as sendMessageAndStream2,
@@ -3266,8 +3368,8 @@ import {
3266
3368
  fetchConversationTimelineStrict,
3267
3369
  fetchRecentConversations,
3268
3370
  findLastAssistantSeq,
3269
- CliError as CliError13,
3270
- CliErrorCode as CliErrorCode12,
3371
+ CliError as CliError14,
3372
+ CliErrorCode as CliErrorCode13,
3271
3373
  parseInteractionRequest as parseInteractionRequest2,
3272
3374
  parseInteractionResolved as parseInteractionResolved2,
3273
3375
  buildConfirm as buildConfirm2,
@@ -3280,8 +3382,8 @@ import chalk2 from "chalk";
3280
3382
  import * as fs4 from "fs/promises";
3281
3383
  function parseInjectOn(s) {
3282
3384
  const fail6 = (detail) => {
3283
- throw new CliError13({
3284
- code: CliErrorCode12.INVALID_ARGUMENT,
3385
+ throw new CliError14({
3386
+ code: CliErrorCode13.INVALID_ARGUMENT,
3285
3387
  message: `--inject-on \u683C\u5F0F <eventType>:<action>[:<arg>]\uFF0Caction \u2208 {interrupt, steer}\uFF08steer \u5FC5\u987B\u5E26 content\uFF09\uFF1B${detail}\uFF0C\u6536\u5230 "${s}"`
3286
3388
  });
3287
3389
  };
@@ -3307,21 +3409,21 @@ function parseOnConfirm(s) {
3307
3409
  if (s === "approve") return { decision: "approve" };
3308
3410
  if (s === "reject") return { decision: "reject" };
3309
3411
  if (s.startsWith("reject:")) return { decision: "reject", reason: s.slice("reject:".length) };
3310
- throw new CliError13({
3311
- code: CliErrorCode12.INVALID_ARGUMENT,
3412
+ throw new CliError14({
3413
+ code: CliErrorCode13.INVALID_ARGUMENT,
3312
3414
  message: `--on-confirm \u53D6\u503C approve | reject | reject:<reason>\uFF0C\u6536\u5230 "${s}"`
3313
3415
  });
3314
3416
  }
3315
3417
  function resolveResumeConversation(args) {
3316
3418
  if (args.resume && args.conversation) {
3317
- throw new CliError13({
3318
- code: CliErrorCode12.INVALID_ARGUMENT,
3419
+ throw new CliError14({
3420
+ code: CliErrorCode13.INVALID_ARGUMENT,
3319
3421
  message: "--resume \u548C --conversation \u4E0D\u80FD\u540C\u65F6\u4F7F\u7528\uFF1B\u65B0\u547D\u4EE4\u8BF7\u7528 --resume <conversationId>"
3320
3422
  });
3321
3423
  }
3322
3424
  if (args.resume === "NEW") {
3323
- throw new CliError13({
3324
- code: CliErrorCode12.INVALID_ARGUMENT,
3425
+ throw new CliError14({
3426
+ code: CliErrorCode13.INVALID_ARGUMENT,
3325
3427
  message: "--resume \u9700\u8981\u65E2\u5B58 conversationId\uFF1B\u65B0\u4F1A\u8BDD\u8BF7\u76F4\u63A5\u7701\u7565 --resume"
3326
3428
  });
3327
3429
  }
@@ -3332,8 +3434,8 @@ function resolveResumeConversation(args) {
3332
3434
  function parsePositiveInt(value, fallback, flag) {
3333
3435
  const n = Number(value ?? fallback);
3334
3436
  if (!Number.isInteger(n) || n <= 0) {
3335
- throw new CliError13({
3336
- code: CliErrorCode12.INVALID_ARGUMENT,
3437
+ throw new CliError14({
3438
+ code: CliErrorCode13.INVALID_ARGUMENT,
3337
3439
  message: `${flag} \u9700\u8981\u6B63\u6574\u6570\uFF0C\u6536\u5230 "${value}"`
3338
3440
  });
3339
3441
  }
@@ -3356,21 +3458,21 @@ function resolveEventsConversation(args) {
3356
3458
  const resumeConversationId = resolveResumeConversation(args);
3357
3459
  const eventConversationId = typeof args.events === "string" ? args.events.trim() : void 0;
3358
3460
  if (eventConversationId === "NEW") {
3359
- throw new CliError13({
3360
- code: CliErrorCode12.INVALID_ARGUMENT,
3461
+ throw new CliError14({
3462
+ code: CliErrorCode13.INVALID_ARGUMENT,
3361
3463
  message: "--events \u9700\u8981\u65E2\u5B58 conversationId\uFF1B\u65B0\u4F1A\u8BDD\u6CA1\u6709\u53EF\u67E5\u8BE2\u7684\u4E8B\u4EF6\u6D41"
3362
3464
  });
3363
3465
  }
3364
3466
  if (eventConversationId && resumeConversationId && eventConversationId !== resumeConversationId) {
3365
- throw new CliError13({
3366
- code: CliErrorCode12.INVALID_ARGUMENT,
3467
+ throw new CliError14({
3468
+ code: CliErrorCode13.INVALID_ARGUMENT,
3367
3469
  message: "--events <conversationId> \u4E0E --resume/--conversation \u6307\u5411\u4E0D\u540C\u4F1A\u8BDD\uFF1B\u8BF7\u53EA\u4FDD\u7559\u4E00\u4E2A id"
3368
3470
  });
3369
3471
  }
3370
3472
  const id = eventConversationId || resumeConversationId;
3371
3473
  if (!id) {
3372
- throw new CliError13({
3373
- code: CliErrorCode12.INVALID_ARGUMENT,
3474
+ throw new CliError14({
3475
+ code: CliErrorCode13.INVALID_ARGUMENT,
3374
3476
  message: "\u67E5\u8BE2\u4E8B\u4EF6\u6D41\u8BF7\u4F20 `hcm chat --events <conversationId>`\uFF0C\u6216 `hcm chat --resume <conversationId> --events`"
3375
3477
  });
3376
3478
  }
@@ -3436,7 +3538,7 @@ function eventPreview(value) {
3436
3538
  }
3437
3539
  async function printConversationEvents(conversationId, args) {
3438
3540
  const ctx = await getActiveAuthContextFromCli(args);
3439
- const client3 = HcmClient10.fromAuthContext(ctx);
3541
+ const client3 = HcmClient11.fromAuthContext(ctx);
3440
3542
  const items = await fetchConversationTimelineStrict(client3.raw(), conversationId);
3441
3543
  const fmt = args.output ?? "text";
3442
3544
  if (args.raw) {
@@ -3474,13 +3576,13 @@ async function printConversationEvents(conversationId, args) {
3474
3576
  }
3475
3577
  async function printConversationList(args) {
3476
3578
  if (args.events || args.resume || args.conversation || args.regenerateFrom || args.promptFile) {
3477
- throw new CliError13({
3478
- code: CliErrorCode12.INVALID_ARGUMENT,
3579
+ throw new CliError14({
3580
+ code: CliErrorCode13.INVALID_ARGUMENT,
3479
3581
  message: "--list \u53EA\u7528\u4E8E\u5217\u4F1A\u8BDD\uFF1B\u4E0D\u8981\u540C\u65F6\u4F20 --events/--resume/--conversation/--regenerate-from/--prompt-file"
3480
3582
  });
3481
3583
  }
3482
3584
  const ctx = await getActiveAuthContextFromCli(args);
3483
- const client3 = HcmClient10.fromAuthContext(ctx);
3585
+ const client3 = HcmClient11.fromAuthContext(ctx);
3484
3586
  const limit = parsePositiveInt(args.limit, 10, "--limit");
3485
3587
  const result = await fetchRecentConversations(client3.raw(), limit);
3486
3588
  const fmt = args.output ?? "text";
@@ -3505,8 +3607,8 @@ async function chatCommand(prompt, args) {
3505
3607
  try {
3506
3608
  if (args.list) {
3507
3609
  if (prompt) {
3508
- throw new CliError13({
3509
- code: CliErrorCode12.INVALID_ARGUMENT,
3610
+ throw new CliError14({
3611
+ code: CliErrorCode13.INVALID_ARGUMENT,
3510
3612
  message: "--list \u4E0D\u63A5\u53D7 prompt\uFF1B\u7528 `hcm chat --list` \u67E5\u770B\u6700\u8FD1\u4F1A\u8BDD"
3511
3613
  });
3512
3614
  }
@@ -3516,8 +3618,8 @@ async function chatCommand(prompt, args) {
3516
3618
  const eventsConversationId = resolveEventsConversation(args);
3517
3619
  if (eventsConversationId) {
3518
3620
  if (prompt || args.promptFile || args.regenerateFrom || args.attach?.length) {
3519
- throw new CliError13({
3520
- code: CliErrorCode12.INVALID_ARGUMENT,
3621
+ throw new CliError14({
3622
+ code: CliErrorCode13.INVALID_ARGUMENT,
3521
3623
  message: "--events \u662F\u53EA\u8BFB\u67E5\u8BE2\uFF1B\u4E0D\u8981\u540C\u65F6\u4F20 prompt/--prompt-file/--regenerate-from/--attach"
3522
3624
  });
3523
3625
  }
@@ -3534,15 +3636,15 @@ async function chatCommand(prompt, args) {
3534
3636
  } else {
3535
3637
  regenerateFromSeq = Number(args.regenerateFrom);
3536
3638
  if (!Number.isInteger(regenerateFromSeq) || regenerateFromSeq <= 0) {
3537
- throw new CliError13({
3538
- code: CliErrorCode12.INVALID_ARGUMENT,
3639
+ throw new CliError14({
3640
+ code: CliErrorCode13.INVALID_ARGUMENT,
3539
3641
  message: `--regenerate-from \u9700\u8981\u6B63\u6574\u6570 journal seq \u6216 last-assistant\uFF0C\u6536\u5230 "${args.regenerateFrom}"`
3540
3642
  });
3541
3643
  }
3542
3644
  }
3543
3645
  if (!requestedConversationId) {
3544
- throw new CliError13({
3545
- code: CliErrorCode12.INVALID_ARGUMENT,
3646
+ throw new CliError14({
3647
+ code: CliErrorCode13.INVALID_ARGUMENT,
3546
3648
  message: "--regenerate-from \u5FC5\u987B\u914D\u5408 --resume <\u65E2\u5B58\u4F1A\u8BDD id>\uFF08\u91CD\u8DD1\u65E2\u5B58\u6BB5\uFF0C\u65E0\u65B0 prompt\uFF09"
3547
3649
  });
3548
3650
  }
@@ -3556,8 +3658,8 @@ async function chatCommand(prompt, args) {
3556
3658
  prompt = await fs4.readFile(args.promptFile, "utf-8");
3557
3659
  }
3558
3660
  if (prompt === void 0 || !prompt && !regenerateMode) {
3559
- throw new CliError13({
3560
- code: CliErrorCode12.INVALID_ARGUMENT,
3661
+ throw new CliError14({
3662
+ code: CliErrorCode13.INVALID_ARGUMENT,
3561
3663
  message: "prompt is required (positional or --prompt-file)"
3562
3664
  });
3563
3665
  }
@@ -3565,7 +3667,7 @@ async function chatCommand(prompt, args) {
3565
3667
  const injectOn = args.injectOn ? parseInjectOn(args.injectOn) : void 0;
3566
3668
  const ctx = await getActiveAuthContextFromCli(args);
3567
3669
  const wsUrl = ctx.endpoint.replace(/^http/, "ws") + "/ws/conversation";
3568
- const client3 = HcmClient10.fromAuthContext(ctx);
3670
+ const client3 = HcmClient11.fromAuthContext(ctx);
3569
3671
  const stateKey = ctx.env;
3570
3672
  const agentId = args.agent ?? DEFAULT_AGENT_ID3;
3571
3673
  let resumeConversationId = requestedConversationId;
@@ -3578,8 +3680,8 @@ async function chatCommand(prompt, args) {
3578
3680
  const items = await fetchConversationTimeline2(client3.raw(), resumeConversationId);
3579
3681
  const lastSeq = findLastAssistantSeq(items);
3580
3682
  if (lastSeq == null) {
3581
- throw new CliError13({
3582
- code: CliErrorCode12.BUSINESS_RULE_VIOLATION,
3683
+ throw new CliError14({
3684
+ code: CliErrorCode13.BUSINESS_RULE_VIOLATION,
3583
3685
  message: `--regenerate-from last-assistant \u627E\u4E0D\u5230\u53EF\u91CD\u8DD1\u7684 chat-text seq: conversation=${resumeConversationId}`
3584
3686
  });
3585
3687
  }
@@ -3797,8 +3899,8 @@ async function chatCommand(prompt, args) {
3797
3899
  } catch (e) {
3798
3900
  process.removeListener("SIGINT", sigintHandler);
3799
3901
  await ws.close();
3800
- throw new CliError13({
3801
- code: e.code ?? CliErrorCode12.BUSINESS_RULE_VIOLATION,
3902
+ throw new CliError14({
3903
+ code: e.code ?? CliErrorCode13.BUSINESS_RULE_VIOLATION,
3802
3904
  message: e.message,
3803
3905
  traceId: e.traceId ?? void 0
3804
3906
  });
@@ -3863,11 +3965,11 @@ async function chatCommand(prompt, args) {
3863
3965
  init_auth_guard();
3864
3966
  init_exit();
3865
3967
  import { downloadDocument } from "@hcmai/sdk";
3866
- import { HcmClient as HcmClient11 } from "@hcmai/sdk";
3968
+ import { HcmClient as HcmClient12 } from "@hcmai/sdk";
3867
3969
  async function downloadCommand(documentId, args) {
3868
3970
  try {
3869
3971
  const ctx = await getActiveAuthContextFromCli(args);
3870
- const client3 = HcmClient11.fromAuthContext(ctx);
3972
+ const client3 = HcmClient12.fromAuthContext(ctx);
3871
3973
  const saved = await downloadDocument(client3.raw(), { documentId }, args.output);
3872
3974
  process.stdout.write(saved + "\n");
3873
3975
  process.exit(0);
@@ -3886,7 +3988,7 @@ async function downloadCommand(documentId, args) {
3886
3988
  // src/commands/trace.ts
3887
3989
  init_exit();
3888
3990
  init_auth_guard();
3889
- import { HcmClient as HcmClient12, formatObject as formatObject10, formatRows as formatRows4, fromAxiosError as fromAxiosError10 } from "@hcmai/sdk";
3991
+ import { HcmClient as HcmClient13, formatObject as formatObject10, formatRows as formatRows4, fromAxiosError as fromAxiosError11 } from "@hcmai/sdk";
3890
3992
  function parsePositiveInt2(value, fallback, flag) {
3891
3993
  const n = Number(value ?? fallback);
3892
3994
  if (!Number.isInteger(n) || n <= 0) {
@@ -4214,7 +4316,7 @@ async function gatherLlmTraceTree(http, rootConvId, maxDepth = 3) {
4214
4316
  }
4215
4317
  async function traceCommand(traceId, args) {
4216
4318
  try {
4217
- const client3 = HcmClient12.fromAuthContext(await getActiveAuthContextFromCli(args));
4319
+ const client3 = HcmClient13.fromAuthContext(await getActiveAuthContextFromCli(args));
4218
4320
  const http = client3.raw();
4219
4321
  const convId = args.conv ?? (args.llmCalls ? traceId ?? void 0 : void 0);
4220
4322
  if (convId) {
@@ -4264,7 +4366,7 @@ async function traceCommand(traceId, args) {
4264
4366
  } catch (e) {
4265
4367
  const err = e;
4266
4368
  if (err?.isAxiosError) {
4267
- exitWithError(fromAxiosError10(err, args.profile));
4369
+ exitWithError(fromAxiosError11(err, args.profile));
4268
4370
  }
4269
4371
  exitWithError(e);
4270
4372
  }
@@ -4274,15 +4376,15 @@ async function traceCommand(traceId, args) {
4274
4376
  init_exit();
4275
4377
  init_auth_guard();
4276
4378
  import {
4277
- HcmClient as HcmClient13,
4379
+ HcmClient as HcmClient14,
4278
4380
  formatObject as formatObject11,
4279
- fromAxiosError as fromAxiosError11,
4381
+ fromAxiosError as fromAxiosError12,
4280
4382
  getCacheStats,
4281
4383
  clearModelCache,
4282
4384
  clearMetaCache
4283
4385
  } from "@hcmai/sdk";
4284
4386
  async function withClient(args, fn) {
4285
- const client3 = HcmClient13.fromAuthContext(await getActiveAuthContextFromCli(args));
4387
+ const client3 = HcmClient14.fromAuthContext(await getActiveAuthContextFromCli(args));
4286
4388
  return fn(client3);
4287
4389
  }
4288
4390
  function emit(result, args, human) {
@@ -4293,7 +4395,7 @@ function emit(result, args, human) {
4293
4395
  }
4294
4396
  function fail2(e, args) {
4295
4397
  const err = e;
4296
- if (err?.isAxiosError) exitWithError(fromAxiosError11(err, args.env));
4398
+ if (err?.isAxiosError) exitWithError(fromAxiosError12(err, args.env));
4297
4399
  exitWithError(e);
4298
4400
  process.exit(1);
4299
4401
  }
@@ -4331,16 +4433,16 @@ init_exit();
4331
4433
  init_auth_guard();
4332
4434
  import { readFileSync as readFileSync3 } from "fs";
4333
4435
  import {
4334
- HcmClient as HcmClient14,
4436
+ HcmClient as HcmClient15,
4335
4437
  formatObject as formatObject12,
4336
- fromAxiosError as fromAxiosError12,
4438
+ fromAxiosError as fromAxiosError13,
4337
4439
  scriptDryRun,
4338
4440
  validateScriptManifest,
4339
4441
  queryScriptLogs,
4340
4442
  getScriptTask
4341
4443
  } from "@hcmai/sdk";
4342
4444
  async function withClient2(args, fn) {
4343
- const client3 = HcmClient14.fromAuthContext(await getActiveAuthContextFromCli(args));
4445
+ const client3 = HcmClient15.fromAuthContext(await getActiveAuthContextFromCli(args));
4344
4446
  return fn(client3);
4345
4447
  }
4346
4448
  function emit2(result, args, human) {
@@ -4351,7 +4453,7 @@ function emit2(result, args, human) {
4351
4453
  }
4352
4454
  function fail3(e, args) {
4353
4455
  const err = e;
4354
- if (err?.isAxiosError) exitWithError(fromAxiosError12(err, args.env));
4456
+ if (err?.isAxiosError) exitWithError(fromAxiosError13(err, args.env));
4355
4457
  exitWithError(e);
4356
4458
  process.exit(1);
4357
4459
  }
@@ -4441,16 +4543,16 @@ async function scriptTaskCommand(taskId, args) {
4441
4543
  init_exit();
4442
4544
  init_auth_guard();
4443
4545
  import {
4444
- HcmClient as HcmClient15,
4546
+ HcmClient as HcmClient16,
4445
4547
  formatObject as formatObject13,
4446
- fromAxiosError as fromAxiosError13,
4548
+ fromAxiosError as fromAxiosError14,
4447
4549
  uploadDocument as uploadDocument2
4448
4550
  } from "@hcmai/sdk";
4449
4551
  var DEFAULT_UPLOAD_CATEGORY = "attachment";
4450
4552
  async function uploadCommand(filePath, args) {
4451
4553
  try {
4452
4554
  const ctx = await getActiveAuthContextFromCli(args);
4453
- const client3 = HcmClient15.fromAuthContext(ctx);
4555
+ const client3 = HcmClient16.fromAuthContext(ctx);
4454
4556
  const meta2 = await uploadDocument2(
4455
4557
  client3.raw(),
4456
4558
  filePath,
@@ -4473,7 +4575,7 @@ async function uploadCommand(filePath, args) {
4473
4575
  } else if (status === 413) {
4474
4576
  exitWithError(new Error("\u6587\u4EF6\u8D85\u51FA\u670D\u52A1\u7AEF\u5927\u5C0F\u4E0A\u9650\uFF08413\uFF09"));
4475
4577
  } else if (err?.isAxiosError) {
4476
- exitWithError(fromAxiosError13(err, args.env));
4578
+ exitWithError(fromAxiosError14(err, args.env));
4477
4579
  } else {
4478
4580
  exitWithError(e);
4479
4581
  }
@@ -4484,9 +4586,9 @@ async function uploadCommand(filePath, args) {
4484
4586
  init_exit();
4485
4587
  init_auth_guard();
4486
4588
  import {
4487
- HcmClient as HcmClient16,
4589
+ HcmClient as HcmClient17,
4488
4590
  formatObject as formatObject14,
4489
- fromAxiosError as fromAxiosError14,
4591
+ fromAxiosError as fromAxiosError15,
4490
4592
  packDataPackage,
4491
4593
  installDataPackageArtifact,
4492
4594
  DEFAULT_ARTIFACT_CATEGORY
@@ -4510,7 +4612,7 @@ async function datapackagePackCommand(packageDir, args) {
4510
4612
  async function datapackageInstallCommand(artifactPath, args) {
4511
4613
  try {
4512
4614
  const ctx = await getActiveAuthContextFromCli(args);
4513
- const client3 = HcmClient16.fromAuthContext(ctx);
4615
+ const client3 = HcmClient17.fromAuthContext(ctx);
4514
4616
  const { documentId, view } = await installDataPackageArtifact(client3, artifactPath, {
4515
4617
  category: args.category ?? DEFAULT_ARTIFACT_CATEGORY
4516
4618
  });
@@ -4532,7 +4634,7 @@ async function datapackageInstallCommand(artifactPath, args) {
4532
4634
  if (err?.code === "ENOENT") {
4533
4635
  exitWithError(new Error(`\u5236\u54C1\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${artifactPath}`));
4534
4636
  } else if (err?.isAxiosError) {
4535
- exitWithError(fromAxiosError14(err, args.env));
4637
+ exitWithError(fromAxiosError15(err, args.env));
4536
4638
  } else {
4537
4639
  exitWithError(e);
4538
4640
  }
@@ -4561,16 +4663,16 @@ import {
4561
4663
  matchSkills,
4562
4664
  filterByStage,
4563
4665
  formatObject as formatObject16,
4564
- fromAxiosError as fromAxiosError15,
4565
- loadEnv as loadEnv5,
4666
+ fromAxiosError as fromAxiosError16,
4667
+ loadEnv as loadEnv6,
4566
4668
  loadGlobalConfig as loadGlobalConfig6,
4567
4669
  resolveActiveEnv as resolveActiveEnv3,
4568
- CliError as CliError16,
4569
- CliErrorCode as CliErrorCode15
4670
+ CliError as CliError17,
4671
+ CliErrorCode as CliErrorCode16
4570
4672
  } from "@hcmai/sdk";
4571
4673
 
4572
4674
  // src/commands/skills-catalog.ts
4573
- import { flattenSkills, CliError as CliError14, CliErrorCode as CliErrorCode13 } from "@hcmai/sdk";
4675
+ import { flattenSkills, CliError as CliError15, CliErrorCode as CliErrorCode14 } from "@hcmai/sdk";
4574
4676
  var CLI_CATEGORY_KEY = "cli-operations";
4575
4677
  var CLI_CATEGORY_NAME = "CLI \u64CD\u4F5C";
4576
4678
  function chironEntry(skill) {
@@ -4613,8 +4715,8 @@ var SOURCE_FILTERS = ["cli", "chiron", "all"];
4613
4715
  function parseSourceFilter(raw) {
4614
4716
  if (raw === void 0) return "all";
4615
4717
  if (SOURCE_FILTERS.includes(raw)) return raw;
4616
- throw new CliError14({
4617
- code: CliErrorCode13.INVALID_ARGUMENT,
4718
+ throw new CliError15({
4719
+ code: CliErrorCode14.INVALID_ARGUMENT,
4618
4720
  message: `--source \u53EA\u8BA4 ${SOURCE_FILTERS.join(" / ")}\uFF0C\u6536\u5230 "${raw}"\u3002\uFF08\`local\` \u4E0D\u662F\u53D6\u503C\uFF1A\u6CA1\u6709\u54EA\u4E00\u8D9F\u4F1A\u53BB\u300C\u626B local \u6765\u6E90\u300D\uFF0Cinstall --from \u88C5\u7684\u90A3\u4E9B\u5728\u4EFB\u4F55 --source \u4E0B\u90FD\u5355\u5217\u3001\u90FD\u4E0D\u53C2\u4E0E\u5347\u7EA7\u3002\uFF09`
4619
4721
  });
4620
4722
  }
@@ -4685,7 +4787,7 @@ function checkCrossSourceRequires(catalog) {
4685
4787
  // src/commands/skills-bundled.ts
4686
4788
  import { promises as fsp } from "fs";
4687
4789
  import * as path3 from "path";
4688
- import { CliError as CliError15, CliErrorCode as CliErrorCode14, assertSafeReferencePath, parseSkillRequirements } from "@hcmai/sdk";
4790
+ import { CliError as CliError16, CliErrorCode as CliErrorCode15, assertSafeReferencePath, parseSkillRequirements } from "@hcmai/sdk";
4689
4791
 
4690
4792
  // src/commands/skills-manifest.ts
4691
4793
  import { readFileSync as readFileSync4, readdirSync as readdirSync2, statSync as statSync3, existsSync } from "fs";
@@ -4777,8 +4879,8 @@ function listBundledSkills(dir = bundledSkillsDir()) {
4777
4879
  return collectBundledSkills(dir);
4778
4880
  }
4779
4881
  function unreachable(id, detail) {
4780
- return new CliError15({
4781
- code: CliErrorCode14.SKILL_SOURCE_UNREACHABLE,
4882
+ return new CliError16({
4883
+ code: CliErrorCode15.SKILL_SOURCE_UNREACHABLE,
4782
4884
  message: `\u88C5\u5728\u8FD9\u4EFD CLI \u91CC\u7684\u6280\u80FD\u8D44\u6E90\u8BFB\u4E0D\u5230\uFF08${detail}\uFF09\uFF0C\u91CD\u88C5 @hcmai/cli\u3002
4783
4885
  \u6280\u80FD id\uFF1A${id}\uFF1B\u627E\u7684\u4F4D\u7F6E\uFF1A${bundledSkillsDir()}`
4784
4886
  });
@@ -4835,8 +4937,8 @@ async function resolveBundledClosure(targetId, dir = bundledSkillsDir()) {
4835
4937
  const visit = async (id) => {
4836
4938
  if (state.get(id) === "done") return;
4837
4939
  if (state.get(id) === "visiting") {
4838
- throw new CliError15({
4839
- code: CliErrorCode14.INVALID_ARGUMENT,
4940
+ throw new CliError16({
4941
+ code: CliErrorCode15.INVALID_ARGUMENT,
4840
4942
  message: `\u81EA\u5E26\u6280\u80FD\u4F9D\u8D56\u6210\u73AF\uFF1A${[...stack, id].join(" \u2192 ")}`
4841
4943
  });
4842
4944
  }
@@ -4876,10 +4978,10 @@ async function resolveEndpoint(args) {
4876
4978
  if (args.endpoint) return args.endpoint.replace(/\/+$/, "");
4877
4979
  const g = await loadGlobalConfig6();
4878
4980
  const envName = resolveActiveEnv3({ envFlag: args.env }, process.env, g);
4879
- const env2 = await loadEnv5(envName).catch(() => null);
4981
+ const env2 = await loadEnv6(envName).catch(() => null);
4880
4982
  if (!env2?.endpoint) {
4881
- throw new CliError16({
4882
- code: CliErrorCode15.MISSING_FLAG,
4983
+ throw new CliError17({
4984
+ code: CliErrorCode16.MISSING_FLAG,
4883
4985
  message: "\u672A\u89E3\u6790\u5230 endpoint \u2014\u2014 \u4F20 --endpoint <url>\uFF0C\u6216\u5148 `hcm env add <name> --endpoint <url>`\u3002\uFF08\u6280\u80FD\u5E93\u514D\u8BA4\u8BC1\uFF0C\u4E0D\u9700\u8981\u5148 login\uFF09"
4884
4986
  });
4885
4987
  }
@@ -4898,8 +5000,8 @@ function decideTrackedEndpoint(options) {
4898
5000
  }
4899
5001
  if (!recorded) {
4900
5002
  if (!current) {
4901
- throw new CliError16({
4902
- code: CliErrorCode15.MISSING_FLAG,
5003
+ throw new CliError17({
5004
+ code: CliErrorCode16.MISSING_FLAG,
4903
5005
  message: "\u672A\u89E3\u6790\u5230 endpoint \u2014\u2014 \u4F20 --endpoint <url>\uFF0C\u6216\u5148 `hcm env add <name> --endpoint <url>`\u3002\uFF08\u6280\u80FD\u5E93\u514D\u8BA4\u8BC1\uFF0C\u4E0D\u9700\u8981\u5148 login\uFF09"
4904
5006
  });
4905
5007
  }
@@ -4959,7 +5061,7 @@ function fail4(e, args) {
4959
5061
  if (err?.response?.status === 404) {
4960
5062
  exitWithError(new Error("\u8BE5\u73AF\u5883\u6CA1\u6709\u8FD9\u4E2A\u6280\u80FD \u2014\u2014 \u8DD1 `hcm skills list` \u770B\u76EE\u5F55\uFF08\u6280\u80FD\u968F\u4EA7\u54C1\u7248\u672C\u8D70\uFF09"));
4961
5063
  }
4962
- if (err?.isAxiosError) exitWithError(fromAxiosError15(err, args.env));
5064
+ if (err?.isAxiosError) exitWithError(fromAxiosError16(err, args.env));
4963
5065
  exitWithError(e);
4964
5066
  process.exit(1);
4965
5067
  }
@@ -4978,8 +5080,8 @@ async function skillsListCommand(keyword, args) {
4978
5080
  const catalog = buildUnifiedCatalog({ source, chironManifest: manifest2, bundled, cliVersion: CLI_VERSION });
4979
5081
  const conflicts = detectIdConflicts(catalog);
4980
5082
  if (conflicts.ids.length > 0) {
4981
- throw new CliError16({
4982
- code: CliErrorCode15.SKILL_ID_CONFLICT,
5083
+ throw new CliError17({
5084
+ code: CliErrorCode16.SKILL_ID_CONFLICT,
4983
5085
  message: conflictMessage(conflicts.ids, endpoint ?? "(\u672A\u77E5\u73AF\u5883)")
4984
5086
  });
4985
5087
  }
@@ -5241,8 +5343,8 @@ async function skillsInstallCommand(id, args) {
5241
5343
  const catalog = buildUnifiedCatalog({ source, chironManifest: manifest2, bundled, cliVersion: CLI_VERSION });
5242
5344
  const conflicts = detectIdConflicts(catalog);
5243
5345
  if (conflicts.ids.length > 0) {
5244
- throw new CliError16({
5245
- code: CliErrorCode15.SKILL_ID_CONFLICT,
5346
+ throw new CliError17({
5347
+ code: CliErrorCode16.SKILL_ID_CONFLICT,
5246
5348
  message: conflictMessage(conflicts.ids, endpoint ?? "(\u672A\u77E5\u73AF\u5883)")
5247
5349
  });
5248
5350
  }
@@ -5697,7 +5799,7 @@ async function recordInstalled(baseDir, documents, meta2) {
5697
5799
  return state;
5698
5800
  }
5699
5801
  function invalid(message) {
5700
- return new CliError16({ code: CliErrorCode15.INVALID_ARGUMENT, message });
5802
+ return new CliError17({ code: CliErrorCode16.INVALID_ARGUMENT, message });
5701
5803
  }
5702
5804
  async function readInstalled(baseDir, id) {
5703
5805
  try {
@@ -5841,8 +5943,8 @@ async function skillsUpdateCommand(args) {
5841
5943
  const layout = await resolveInstallLayout(args);
5842
5944
  const state = await readSkillsState(layout.baseDir);
5843
5945
  if (!state || Object.keys(state.skills).length === 0) {
5844
- throw new CliError16({
5845
- code: CliErrorCode15.INVALID_ARGUMENT,
5946
+ throw new CliError17({
5947
+ code: CliErrorCode16.INVALID_ARGUMENT,
5846
5948
  message: `${path4.join(layout.baseDir, SKILLS_STATE_FILE)} \u4E0D\u5B58\u5728\u6216\u4E3A\u7A7A \u2014\u2014 \u8FD9\u4E2A\u76EE\u5F55\u4E0B\u8FD8\u6CA1\u6709\u7528\u672C CLI \u88C5\u8FC7\u6280\u80FD\u3002\u5148 \`hcm skills install <id>\`\uFF1B\u5982\u679C\u6280\u80FD\u662F\u624B\u5DE5\u62F7\u8FDB\u6765\u7684\uFF0C\u91CD\u88C5\u4E00\u6B21\u5373\u53EF\u63A5\u7BA1\u5347\u7EA7\u3002`
5847
5949
  });
5848
5950
  }
@@ -5969,12 +6071,12 @@ import {
5969
6071
  bootstrapTenant,
5970
6072
  createHttpClient as createHttpClient3,
5971
6073
  formatObject as formatObject17,
5972
- fromAxiosError as fromAxiosError16,
5973
- loadEnv as loadEnv6,
6074
+ fromAxiosError as fromAxiosError17,
6075
+ loadEnv as loadEnv7,
5974
6076
  loadGlobalConfig as loadGlobalConfig7,
5975
6077
  resolveActiveEnv as resolveActiveEnv4,
5976
- CliError as CliError17,
5977
- CliErrorCode as CliErrorCode16
6078
+ CliError as CliError18,
6079
+ CliErrorCode as CliErrorCode17
5978
6080
  } from "@hcmai/sdk";
5979
6081
  init_exit();
5980
6082
  async function resolveBootstrapKey(args, stdinTaken) {
@@ -5982,8 +6084,8 @@ async function resolveBootstrapKey(args, stdinTaken) {
5982
6084
  if (fromEnv) return fromEnv;
5983
6085
  if (args.bootstrapKeyStdin) {
5984
6086
  if (stdinTaken) {
5985
- throw new CliError17({
5986
- code: CliErrorCode16.INVALID_ARGUMENT,
6087
+ throw new CliError18({
6088
+ code: CliErrorCode17.INVALID_ARGUMENT,
5987
6089
  message: "--bootstrap-key-stdin \u4E0E --admin-password-stdin \u4E0D\u80FD\u540C\u65F6\u7528\uFF08stdin \u53EA\u6709\u4E00\u8DEF\uFF09\uFF1B\u628A\u5176\u4E2D\u4E00\u4E2A\u6539\u8D70 HCM_BOOTSTRAP_KEY \u73AF\u5883\u53D8\u91CF\u6216\u4EA4\u4E92\u8F93\u5165"
5988
6090
  });
5989
6091
  }
@@ -6011,10 +6113,10 @@ async function resolveEndpoint2(args) {
6011
6113
  if (args.endpoint) return args.endpoint;
6012
6114
  const g = await loadGlobalConfig7();
6013
6115
  const envName = resolveActiveEnv4({ envFlag: args.env }, process.env, g);
6014
- const env2 = await loadEnv6(envName).catch(() => null);
6116
+ const env2 = await loadEnv7(envName).catch(() => null);
6015
6117
  if (!env2?.endpoint) {
6016
- throw new CliError17({
6017
- code: CliErrorCode16.MISSING_FLAG,
6118
+ throw new CliError18({
6119
+ code: CliErrorCode17.MISSING_FLAG,
6018
6120
  message: "\u672A\u89E3\u6790\u5230 endpoint \u2014\u2014 \u4F20 --endpoint <url>\uFF0C\u6216\u5148 `hcm env add <name> --endpoint <url>`"
6019
6121
  });
6020
6122
  }
@@ -6023,8 +6125,8 @@ async function resolveEndpoint2(args) {
6023
6125
  async function tenantBootstrapCommand(args) {
6024
6126
  try {
6025
6127
  if (!args.tenantId || !args.adminUsername) {
6026
- throw new CliError17({
6027
- code: CliErrorCode16.MISSING_FLAG,
6128
+ throw new CliError18({
6129
+ code: CliErrorCode17.MISSING_FLAG,
6028
6130
  message: "--tenant-id \u4E0E --admin-username \u5FC5\u586B"
6029
6131
  });
6030
6132
  }
@@ -6067,7 +6169,7 @@ async function tenantBootstrapCommand(args) {
6067
6169
  if (err?.response?.status === 403) {
6068
6170
  exitWithError(new Error("bootstrap key \u65E0\u6548\uFF08403\uFF09\u2014\u2014 \u6838\u5BF9\u90E8\u7F72\u65B9\u63D0\u4F9B\u7684 key\uFF0C\u52FF\u590D\u7528\u5176\u4ED6\u73AF\u5883\u7684"));
6069
6171
  } else if (err?.isAxiosError) {
6070
- exitWithError(fromAxiosError16(err, args.env));
6172
+ exitWithError(fromAxiosError17(err, args.env));
6071
6173
  } else {
6072
6174
  exitWithError(e);
6073
6175
  }
@@ -6077,20 +6179,20 @@ async function tenantBootstrapCommand(args) {
6077
6179
  // src/commands/meta.ts
6078
6180
  import { promises as fsp3 } from "fs";
6079
6181
  import {
6080
- HcmClient as HcmClient17,
6182
+ HcmClient as HcmClient18,
6081
6183
  formatObject as formatObject18,
6082
- fromAxiosError as fromAxiosError17,
6184
+ fromAxiosError as fromAxiosError18,
6083
6185
  listTenantMeta,
6084
6186
  getTenantMeta,
6085
6187
  saveTenantMeta,
6086
6188
  deleteTenantMeta,
6087
- CliError as CliError18,
6088
- CliErrorCode as CliErrorCode17
6189
+ CliError as CliError19,
6190
+ CliErrorCode as CliErrorCode18
6089
6191
  } from "@hcmai/sdk";
6090
6192
  init_exit();
6091
6193
  init_auth_guard();
6092
6194
  async function client2(args) {
6093
- return HcmClient17.fromAuthContext(await getActiveAuthContextFromCli(args));
6195
+ return HcmClient18.fromAuthContext(await getActiveAuthContextFromCli(args));
6094
6196
  }
6095
6197
  function fail5(e, args) {
6096
6198
  const err = e;
@@ -6099,7 +6201,7 @@ function fail5(e, args) {
6099
6201
  new Error("\u5143\u6570\u636E\u5199\u5165\u88AB\u62D2\uFF08403\uFF09\u2014\u2014 \u9700 config-admin \u8EAB\u4EFD\u4E14\u5F53\u524D source \u53EF\u5199\uFF1B\u82E5\u5728\u79DF\u6237\u5F00\u53D1\u7A7A\u95F4\u5916\uFF0C\u5148 `hcm workspace bind <key>`")
6100
6202
  );
6101
6203
  }
6102
- if (err?.isAxiosError) exitWithError(fromAxiosError17(err, args.env));
6204
+ if (err?.isAxiosError) exitWithError(fromAxiosError18(err, args.env));
6103
6205
  exitWithError(e);
6104
6206
  process.exit(1);
6105
6207
  }
@@ -6134,8 +6236,8 @@ async function metaGetCommand(path12, args) {
6134
6236
  async function metaSetCommand(path12, args) {
6135
6237
  try {
6136
6238
  if (!args.file) {
6137
- throw new CliError18({
6138
- code: CliErrorCode17.MISSING_FLAG,
6239
+ throw new CliError19({
6240
+ code: CliErrorCode18.MISSING_FLAG,
6139
6241
  message: "--file <path> \u5FC5\u586B\uFF08\u4ECE\u6587\u4EF6\u8BFB\u53D6 meta \u539F\u6587\uFF1B\u7528 - \u8868\u793A stdin\uFF09"
6140
6242
  });
6141
6243
  }
@@ -6206,7 +6308,7 @@ import {
6206
6308
  formatObject as formatObject19,
6207
6309
  formatRows as formatRows5,
6208
6310
  getMiniStatus,
6209
- HcmClient as HcmClient18,
6311
+ HcmClient as HcmClient19,
6210
6312
  initMiniAppProject,
6211
6313
  inferMiniWritableTemplateOptionsFromModel,
6212
6314
  listWorkspaceFiles,
@@ -6216,7 +6318,7 @@ import {
6216
6318
  runMiniSmokeChecks,
6217
6319
  saveWorkspaceFileContent,
6218
6320
  validateMiniProject,
6219
- fromAxiosError as fromAxiosError18
6321
+ fromAxiosError as fromAxiosError19
6220
6322
  } from "@hcmai/sdk";
6221
6323
 
6222
6324
  // src/commands/workspace-format.ts
@@ -6263,7 +6365,7 @@ var RAW_WORKSPACE_EXCLUDED_DIRS = /* @__PURE__ */ new Set([
6263
6365
  var RAW_WORKSPACE_EXCLUDED_FILES = /* @__PURE__ */ new Set([WORKSPACE_CONTEXT_FILE, ".DS_Store"]);
6264
6366
  async function workspaceListCommand(args) {
6265
6367
  try {
6266
- const client3 = HcmClient18.fromAuthContext(await getActiveAuthContextFromCli(args));
6368
+ const client3 = HcmClient19.fromAuthContext(await getActiveAuthContextFromCli(args));
6267
6369
  const limit = parsePositiveInt3(args.limit, 50, "--limit");
6268
6370
  const result = await client3.query("TenantExtensionWorkspace", {
6269
6371
  keyword: args.keyword,
@@ -6292,7 +6394,7 @@ async function workspaceActiveCommand(args) {
6292
6394
  const ctx = await getActiveAuthContextFromCli(args, {
6293
6395
  fallbackEnv: localContext?.profile
6294
6396
  });
6295
- const client3 = HcmClient18.fromAuthContext(ctx);
6397
+ const client3 = HcmClient19.fromAuthContext(ctx);
6296
6398
  const result = await client3.query("TenantExtensionWorkspace", {
6297
6399
  filter: { devModeEnabled: true },
6298
6400
  fields: ["workspaceKey", "devModeEnabled"],
@@ -6347,7 +6449,7 @@ async function workspaceCreateCommand(workspaceKey, args) {
6347
6449
  `${WORKSPACE_CONTEXT_FILE} already binds workspace '${existing.workspaceKey}'; use --force to rebind`
6348
6450
  );
6349
6451
  }
6350
- const client3 = HcmClient18.fromAuthContext(await getActiveAuthContextFromCli(args));
6452
+ const client3 = HcmClient19.fromAuthContext(await getActiveAuthContextFromCli(args));
6351
6453
  const normalizedWorkspaceKey = normalizeWorkspaceKey(workspaceKey);
6352
6454
  const resp = await client3.raw().post("/api/models/TenantExtensionWorkspace", {
6353
6455
  workspaceKey: normalizedWorkspaceKey,
@@ -6394,7 +6496,7 @@ async function workspacePullCommand(args) {
6394
6496
  `workspace key is required; pass --workspace <key> or run hcm workspace bind <key> first`
6395
6497
  );
6396
6498
  }
6397
- const client3 = HcmClient18.fromAuthContext(
6499
+ const client3 = HcmClient19.fromAuthContext(
6398
6500
  await getActiveAuthContextFromCli(args, { fallbackEnv: existing?.profile })
6399
6501
  );
6400
6502
  const context = buildWorkspaceContext({
@@ -6564,7 +6666,7 @@ async function workspacePushCommand(args) {
6564
6666
  const rootDir = resolveRootDir(args.dir);
6565
6667
  const context = await requireWorkspaceContext(rootDir);
6566
6668
  const miniApps = await discoverMiniApps(rootDir);
6567
- const client3 = HcmClient18.fromAuthContext(
6669
+ const client3 = HcmClient19.fromAuthContext(
6568
6670
  await getActiveAuthContextFromCli(args, { fallbackEnv: context.profile })
6569
6671
  );
6570
6672
  const activeWorkspaceKey = args.dryRun ? null : await probeActiveWorkspaceKey(client3);
@@ -7087,7 +7189,7 @@ async function readMiniStatusSafely(app) {
7087
7189
  async function loadProfileClient(args) {
7088
7190
  try {
7089
7191
  const ctx = await getActiveAuthContextFromCli(args);
7090
- return HcmClient18.fromAuthContext(ctx);
7192
+ return HcmClient19.fromAuthContext(ctx);
7091
7193
  } catch (e) {
7092
7194
  if (args.env || args.profile) throw e;
7093
7195
  return null;
@@ -7498,7 +7600,7 @@ function formatStatusSummary(summary) {
7498
7600
  function exitWorkspaceError(err, profile) {
7499
7601
  const maybeAxios = err;
7500
7602
  if (maybeAxios?.isAxiosError) {
7501
- exitWithError(fromAxiosError18(err, profile));
7603
+ exitWithError(fromAxiosError19(err, profile));
7502
7604
  }
7503
7605
  exitWithError(err);
7504
7606
  }
@@ -7533,7 +7635,7 @@ async function setDevModeBinding(client3, workspaceKey) {
7533
7635
  }
7534
7636
  async function workspaceActivateCommand(workspaceKey, args) {
7535
7637
  try {
7536
- const client3 = HcmClient18.fromAuthContext(await getActiveAuthContextFromCli(args));
7638
+ const client3 = HcmClient19.fromAuthContext(await getActiveAuthContextFromCli(args));
7537
7639
  const key2 = normalizeWorkspaceKey(workspaceKey);
7538
7640
  await setDevModeBinding(client3, key2);
7539
7641
  const fmt = args.output ?? "table";
@@ -7555,15 +7657,15 @@ async function workspaceActivateCommand(workspaceKey, args) {
7555
7657
  // src/commands/identity.ts
7556
7658
  init_exit();
7557
7659
  import {
7558
- loadEnv as loadEnv7,
7660
+ loadEnv as loadEnv8,
7559
7661
  saveEnv as saveEnv3,
7560
7662
  loadIdentity as loadIdentity4,
7561
7663
  listIdentities as listIdentities2,
7562
7664
  deleteIdentity as deleteIdentity2,
7563
7665
  loadGlobalConfig as loadGlobalConfig8,
7564
7666
  TokenStore as TokenStore3,
7565
- CliError as CliError19,
7566
- CliErrorCode as CliErrorCode18
7667
+ CliError as CliError20,
7668
+ CliErrorCode as CliErrorCode19
7567
7669
  } from "@hcmai/sdk";
7568
7670
  async function identityList(args) {
7569
7671
  try {
@@ -7577,7 +7679,7 @@ async function identityList(args) {
7577
7679
  const lines = [];
7578
7680
  for (const n of names) {
7579
7681
  const meta2 = await loadIdentity4(n);
7580
- const env2 = await loadEnv7(meta2.env).catch(() => null);
7682
+ const env2 = await loadEnv8(meta2.env).catch(() => null);
7581
7683
  const isDefault = env2?.defaultIdentity === n ? "*" : " ";
7582
7684
  const expired = meta2.expiresAt && new Date(meta2.expiresAt) < /* @__PURE__ */ new Date() ? " (expired)" : "";
7583
7685
  lines.push(`${isDefault} ${n} scheme=${meta2.scheme} env=${meta2.env}${expired}`);
@@ -7590,9 +7692,9 @@ async function identityList(args) {
7590
7692
  async function identityUse(name) {
7591
7693
  try {
7592
7694
  const meta2 = await loadIdentity4(name);
7593
- const env2 = await loadEnv7(meta2.env).catch(() => {
7594
- throw new CliError19({
7595
- code: CliErrorCode18.IDENTITY_NOT_IN_ENV,
7695
+ const env2 = await loadEnv8(meta2.env).catch(() => {
7696
+ throw new CliError20({
7697
+ code: CliErrorCode19.IDENTITY_NOT_IN_ENV,
7596
7698
  message: `identity '${name}' references env '${meta2.env}' which no longer exists. Re-create the env, or remove this orphan: hcm identity remove ${name}`
7597
7699
  });
7598
7700
  });
@@ -7615,7 +7717,7 @@ async function identityRemove(name) {
7615
7717
  );
7616
7718
  }
7617
7719
  await deleteIdentity2(name);
7618
- const env2 = await loadEnv7(meta2.env).catch(() => null);
7720
+ const env2 = await loadEnv8(meta2.env).catch(() => null);
7619
7721
  if (env2?.defaultIdentity === name) {
7620
7722
  env2.defaultIdentity = void 0;
7621
7723
  await saveEnv3(meta2.env, env2);
@@ -7631,7 +7733,7 @@ init_auth_guard();
7631
7733
  import { existsSync as existsSync2, readFileSync as readFileSync5 } from "fs";
7632
7734
  import { join as pathJoin } from "path";
7633
7735
  import {
7634
- HcmClient as HcmClient19,
7736
+ HcmClient as HcmClient20,
7635
7737
  formatObject as formatObject20
7636
7738
  } from "@hcmai/sdk";
7637
7739
 
@@ -7738,6 +7840,12 @@ ${commandSha256}`).slice(0, 24),
7738
7840
  function classify(argv, actionResolution) {
7739
7841
  const name = argv[0] ?? "";
7740
7842
  const subcommand = argv[1] ?? "";
7843
+ if (name.startsWith("-")) {
7844
+ return forbidden(
7845
+ "malformed-argv",
7846
+ `\u88AB\u8BC4\u4F30\u7684\u547D\u4EE4\u540D\u89E3\u6790\u6210\u4E86 ${name} \u2014\u2014 \u90A3\u662F\u4E00\u4E2A\u9009\u9879\uFF0C\u4E0D\u662F\u547D\u4EE4\u3002\`hcm delivery assess\` \u81EA\u8EAB\u6CA1\u6709 --env/--as \u4E4B\u7C7B\u7684\u9009\u9879\uFF0C\`--\` \u4E4B\u540E\u7684\u4E00\u5207\u90FD\u7B97\u88AB\u8BC4\u4F30\u547D\u4EE4\u3002next_step=\u628A\u9009\u9879\u632A\u5230 \`--\` \u540E\u9762\uFF0C\u4F8B\u5982 \`hcm delivery assess -- meta set X --env <env>\``
7847
+ );
7848
+ }
7741
7849
  if (argv.some((arg) => APPROVAL_BYPASS_FLAGS.has(flagName(arg)))) {
7742
7850
  return forbidden("approval-bypass", "\u547D\u4EE4\u5305\u542B\u8DF3\u8FC7\u786E\u8BA4\u7684\u65D7\u6807\uFF0C\u987E\u95EE\u4EA4\u4ED8\u9762\u4E0D\u6267\u884C\u3002");
7743
7851
  }
@@ -7758,6 +7866,7 @@ function classify(argv, actionResolution) {
7758
7866
  return forbidden("credential-governance", "\u547D\u4EE4\u643A\u5E26\u8EAB\u4EFD\u51ED\u636E\u53C2\u6570\uFF0C\u5FC5\u987B\u8F6C\u4EA4\u8EAB\u4EFD\u6CBB\u7406\u6D41\u7A0B\u3002");
7759
7867
  }
7760
7868
  if (name === "version") return direct("R0", "product-discovery", "product-discovery");
7869
+ if (name === "open") return direct("R1", "remote-read", "browser-session-open");
7761
7870
  if (name === "delivery" && subcommand === "assess") {
7762
7871
  return direct("R0", "local-discovery", "risk-assessment");
7763
7872
  }
@@ -7868,7 +7977,10 @@ function classify(argv, actionResolution) {
7868
7977
  if (name === "chat") {
7869
7978
  return forbidden("agent-autonomy", "\u987E\u95EE\u63D2\u4EF6\u4E0D\u901A\u8FC7\u5D4C\u5957\u6570\u5B57\u5458\u5DE5\u5BF9\u8BDD\u6269\u5927\u81EA\u6CBB\u6267\u884C\u9762\u3002");
7870
7979
  }
7871
- return forbidden("unknown-command", "\u672A\u77E5\u547D\u4EE4\u6309\u6700\u9AD8\u98CE\u9669\u5173\u95ED\u3002");
7980
+ return forbidden(
7981
+ "unknown-command",
7982
+ `\u672A\u77E5\u547D\u4EE4\u6309\u6700\u9AD8\u98CE\u9669\u5173\u95ED\uFF1A\u89E3\u6790\u5230\u7684\u547D\u4EE4\u662F ${name || "(\u7A7A)"}` + (subcommand ? ` ${subcommand}` : "") + "\u3002next_step=\u7528 `hcm --help` \u6838\u5BF9\u547D\u4EE4\u540D\uFF1B\u82E5\u4F60\u786E\u4FE1\u8FD9\u6761\u547D\u4EE4\u5B58\u5728\uFF0C\u5148\u8DD1 `hcm upgrade` \u770B CLI \u662F\u4E0D\u662F\u65E7\u7248\uFF08\u98CE\u63A7\u8868\u968F CLI \u53D1\u5E03\u66F4\u65B0\uFF09"
7983
+ );
7872
7984
  }
7873
7985
  function summarizeTarget(argv, actionResolution) {
7874
7986
  const name = argv[0] ?? "";
@@ -8067,7 +8179,7 @@ async function resolveCoreAction(request) {
8067
8179
  as: request.identity,
8068
8180
  profile: request.profile
8069
8181
  });
8070
- const description = await HcmClient19.fromAuthContext(auth).describe(request.model);
8182
+ const description = await HcmClient20.fromAuthContext(auth).describe(request.model);
8071
8183
  const named = description.actions.filter((action2) => action2.name === request.action);
8072
8184
  if (named.length === 0) {
8073
8185
  const degraded = description.effectiveActionsAvailable ? "" : `\u26A0\uFE0F \u672C\u6B21\u6BD4\u5BF9\u4E0D\u542B\u811A\u672C Action\u2014\u2014${description.effectiveActionsNote ?? "\u539F\u56E0\u672A\u77E5"}\u3002`;
@@ -8294,10 +8406,10 @@ async function deliveryModeCommand(args) {
8294
8406
  init_auth_guard();
8295
8407
  init_exit();
8296
8408
  import {
8297
- HcmClient as HcmClient20,
8409
+ HcmClient as HcmClient21,
8298
8410
  fetchReconIdentity,
8299
8411
  formatObject as formatObject22,
8300
- fromAxiosError as fromAxiosError19,
8412
+ fromAxiosError as fromAxiosError20,
8301
8413
  httpProbe,
8302
8414
  runDoctor
8303
8415
  } from "@hcmai/sdk";
@@ -8316,7 +8428,7 @@ function render2(report) {
8316
8428
  async function deliveryDoctorCommand(args) {
8317
8429
  try {
8318
8430
  const ctx = await getActiveAuthContextFromCli(args);
8319
- const client3 = HcmClient20.fromAuthContext(ctx);
8431
+ const client3 = HcmClient21.fromAuthContext(ctx);
8320
8432
  const probe = httpProbe(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES);
8321
8433
  const identity2 = await fetchReconIdentity(probe, ctx.tenantId);
8322
8434
  const report = await runDoctor(probe, identity2);
@@ -8326,7 +8438,7 @@ async function deliveryDoctorCommand(args) {
8326
8438
  process.exit(report.ok ? 0 : 1);
8327
8439
  } catch (e) {
8328
8440
  const err = e;
8329
- if (err?.isAxiosError) exitWithError(fromAxiosError19(err, args.env));
8441
+ if (err?.isAxiosError) exitWithError(fromAxiosError20(err, args.env));
8330
8442
  exitWithError(e);
8331
8443
  process.exit(1);
8332
8444
  }
@@ -8336,12 +8448,12 @@ async function deliveryDoctorCommand(args) {
8336
8448
  init_auth_guard();
8337
8449
  init_exit();
8338
8450
  import {
8339
- HcmClient as HcmClient21,
8451
+ HcmClient as HcmClient22,
8340
8452
  ReconLayout,
8341
8453
  ROUND_EXIT_CODES,
8342
8454
  computeReconSourceKey,
8343
8455
  formatObject as formatObject23,
8344
- fromAxiosError as fromAxiosError20,
8456
+ fromAxiosError as fromAxiosError21,
8345
8457
  httpProbe as httpProbe2,
8346
8458
  inspectRound,
8347
8459
  renderRound,
@@ -8351,7 +8463,7 @@ var DEFAULT_CAPABILITIES2 = "default";
8351
8463
  async function deliveryReconCommand(args) {
8352
8464
  try {
8353
8465
  const ctx = await getActiveAuthContextFromCli(args);
8354
- const client3 = HcmClient21.fromAuthContext(ctx);
8466
+ const client3 = HcmClient22.fromAuthContext(ctx);
8355
8467
  const probe = httpProbe2(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES2);
8356
8468
  const sourceKey = await computeReconSourceKey(probe);
8357
8469
  const layout = new ReconLayout(args.out ?? ".", ctx.tenantId, sourceKey);
@@ -8363,7 +8475,7 @@ async function deliveryReconCommand(args) {
8363
8475
  process.stdout.write(formatObject23(summary, { format: args.output ?? "json" }) + "\n");
8364
8476
  } catch (e) {
8365
8477
  const err = e;
8366
- if (err?.isAxiosError) exitWithError(fromAxiosError20(err, args.env));
8478
+ if (err?.isAxiosError) exitWithError(fromAxiosError21(err, args.env));
8367
8479
  exitWithError(e);
8368
8480
  process.exit(1);
8369
8481
  }
@@ -8461,7 +8573,7 @@ import {
8461
8573
  DRY_RUN_TAIL,
8462
8574
  DriftDetected,
8463
8575
  FORCE_STALE_FLAG,
8464
- HcmClient as HcmClient22,
8576
+ HcmClient as HcmClient23,
8465
8577
  fetchReconIdentity as fetchReconIdentity2,
8466
8578
  INIT_EXIT_CODES,
8467
8579
  JOURNAL_STOP_KINDS,
@@ -8601,7 +8713,7 @@ async function authOrSignpost(args, cmd) {
8601
8713
  }
8602
8714
  async function deliverySeedPlanCommand(args) {
8603
8715
  const ctx = await authOrSignpost(args, "plan");
8604
- const client3 = HcmClient22.fromAuthContext(ctx);
8716
+ const client3 = HcmClient23.fromAuthContext(ctx);
8605
8717
  process.exitCode = await runSeedPlan(args, seedClient(client3, ctx));
8606
8718
  }
8607
8719
  function seedClient(client3, ctx) {
@@ -8775,7 +8887,7 @@ async function runSeedApply(args, client3) {
8775
8887
  }
8776
8888
  async function deliverySeedApplyCommand(args) {
8777
8889
  const ctx = await authOrSignpost(args, "apply");
8778
- const client3 = HcmClient22.fromAuthContext(ctx);
8890
+ const client3 = HcmClient23.fromAuthContext(ctx);
8779
8891
  process.exitCode = await runSeedApply(args, seedClient(client3, ctx));
8780
8892
  }
8781
8893
  async function runSeedVerify(args, client3) {
@@ -8799,7 +8911,7 @@ async function deliverySeedVerifyCommand(args) {
8799
8911
  return;
8800
8912
  }
8801
8913
  const ctx = await authOrSignpost(args, "verify");
8802
- const client3 = HcmClient22.fromAuthContext(ctx);
8914
+ const client3 = HcmClient23.fromAuthContext(ctx);
8803
8915
  process.exitCode = await runSeedVerify(args, await seedVerifyClient(client3, ctx));
8804
8916
  }
8805
8917
 
@@ -8914,7 +9026,7 @@ import {
8914
9026
  CHANGE_STATES,
8915
9027
  CHANGE_UNKNOWN,
8916
9028
  CODE_WORDS,
8917
- HcmClient as HcmClient23,
9029
+ HcmClient as HcmClient24,
8918
9030
  INIT_EXIT_CODES as INIT_EXIT_CODES3,
8919
9031
  META_WRITE_STEPS,
8920
9032
  META_VERIFY_STEPS,
@@ -9142,7 +9254,7 @@ function lowerCaseHeaders2(headers) {
9142
9254
  }
9143
9255
  async function deliveryMetaCommand(args) {
9144
9256
  const ctx = await getActiveAuthContextFromCli(args);
9145
- const client3 = HcmClient23.fromAuthContext(ctx);
9257
+ const client3 = HcmClient24.fromAuthContext(ctx);
9146
9258
  process.exitCode = await runDeliveryMeta(
9147
9259
  { ...args, tenant: args.tenant ?? String(ctx.tenantId ?? "") },
9148
9260
  metaClient(client3, ctx)
@@ -9154,7 +9266,7 @@ init_auth_guard();
9154
9266
  init_exit();
9155
9267
  import {
9156
9268
  computeReconSourceKey as computeReconSourceKey2,
9157
- HcmClient as HcmClient24,
9269
+ HcmClient as HcmClient25,
9158
9270
  httpProbe as httpProbe3,
9159
9271
  ReconLayout as ReconLayout2,
9160
9272
  runTriageRound
@@ -9210,7 +9322,7 @@ async function runTriage(args) {
9210
9322
  return premise4(e instanceof Error ? e.message : String(e), REQUESTS_SHAPE);
9211
9323
  }
9212
9324
  const ctx = await getActiveAuthContextFromCli(args);
9213
- const client3 = HcmClient24.fromAuthContext(ctx);
9325
+ const client3 = HcmClient25.fromAuthContext(ctx);
9214
9326
  const probe = httpProbe3(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES4);
9215
9327
  const artifactsDir = args.recon ?? new ReconLayout2(args.out ?? ".", ctx.tenantId, await computeReconSourceKey2(probe)).dir;
9216
9328
  const result = await runTriageRound(probe, artifactsDir, entriesIn);
@@ -9236,10 +9348,10 @@ async function deliveryTriageCommand(args) {
9236
9348
 
9237
9349
  // src/commands/delivery-execution.ts
9238
9350
  import { createHash as createHash5, randomBytes as secureRandomBytes } from "crypto";
9239
- import { spawn } from "child_process";
9351
+ import { spawn as spawn2 } from "child_process";
9240
9352
  import { createReadStream, promises as fs7 } from "fs";
9241
9353
  import path11 from "path";
9242
- import { CliError as CliError20, CliErrorCode as CliErrorCode19, formatObject as formatObject25 } from "@hcmai/sdk";
9354
+ import { CliError as CliError21, CliErrorCode as CliErrorCode20, formatObject as formatObject25 } from "@hcmai/sdk";
9243
9355
  init_exit();
9244
9356
  var EXECUTION_CONTRACT_VERSION = "2026-08-29.controlled-v3";
9245
9357
  var DEFAULT_TTL_SECONDS = 15 * 60;
@@ -9742,7 +9854,7 @@ async function runCurrentCliCommand(argv, cwd, streams) {
9742
9854
  const entry = process.argv[1];
9743
9855
  if (!entry) throw invalid2("\u65E0\u6CD5\u89E3\u6790\u5F53\u524D CLI entry");
9744
9856
  return new Promise((resolve4, reject) => {
9745
- const child = spawn(process.execPath, [entry, ...argv], {
9857
+ const child = spawn2(process.execPath, [entry, ...argv], {
9746
9858
  cwd,
9747
9859
  env: process.env,
9748
9860
  shell: false,
@@ -9885,7 +9997,7 @@ async function sha256File(file) {
9885
9997
  return hash.digest("hex");
9886
9998
  }
9887
9999
  function invalid2(message, cause) {
9888
- return new CliError20({ code: CliErrorCode19.INVALID_ARGUMENT, message, cause });
10000
+ return new CliError21({ code: CliErrorCode20.INVALID_ARGUMENT, message, cause });
9889
10001
  }
9890
10002
  function nextCommandHint(planId, project, argv) {
9891
10003
  const quoted = argv.map((a) => /[\s"'$`\\]/.test(a) ? `'${a.replace(/'/g, `'\\''`)}'` : a);
@@ -9897,25 +10009,25 @@ function nextCommandHint(planId, project, argv) {
9897
10009
  init_auth_guard();
9898
10010
  init_exit();
9899
10011
  import {
9900
- HcmClient as HcmClient25,
10012
+ HcmClient as HcmClient26,
9901
10013
  adminResetPassword,
9902
10014
  formatObject as formatObject26,
9903
- fromAxiosError as fromAxiosError21,
9904
- CliError as CliError21,
9905
- CliErrorCode as CliErrorCode20
10015
+ fromAxiosError as fromAxiosError22,
10016
+ CliError as CliError22,
10017
+ CliErrorCode as CliErrorCode21
9906
10018
  } from "@hcmai/sdk";
9907
10019
  function buildAdminResetPasswordRequest(args, password) {
9908
10020
  const hasId = Boolean(args.id);
9909
10021
  const hasUsername = Boolean(args.username);
9910
10022
  if (hasId === hasUsername) {
9911
- throw new CliError21({
9912
- code: CliErrorCode20.INVALID_ARGUMENT,
10023
+ throw new CliError22({
10024
+ code: CliErrorCode21.INVALID_ARGUMENT,
9913
10025
  message: "--id <uuid> \u4E0E --username <user> \u5FC5\u987B\u4E14\u53EA\u80FD\u63D0\u4F9B\u4E00\u4E2A"
9914
10026
  });
9915
10027
  }
9916
10028
  if (!password) {
9917
- throw new CliError21({
9918
- code: CliErrorCode20.INVALID_ARGUMENT,
10029
+ throw new CliError22({
10030
+ code: CliErrorCode21.INVALID_ARGUMENT,
9919
10031
  message: "\u65B0\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A"
9920
10032
  });
9921
10033
  }
@@ -9931,12 +10043,12 @@ async function userResetPasswordCommand(args) {
9931
10043
  try {
9932
10044
  const password = args.passwordStdin ? await readSecretFromStdin() : await promptPasswordTwice();
9933
10045
  const request = buildAdminResetPasswordRequest(args, password);
9934
- const client3 = HcmClient25.fromAuthContext(await getActiveAuthContextFromCli(args));
10046
+ const client3 = HcmClient26.fromAuthContext(await getActiveAuthContextFromCli(args));
9935
10047
  const result = await adminResetPassword(client3.raw(), request);
9936
10048
  process.stdout.write(formatObject26(result, { format: args.output ?? "json" }) + "\n");
9937
10049
  } catch (cause) {
9938
10050
  const err = cause;
9939
- if (err?.isAxiosError) exitWithError(fromAxiosError21(err, args.env));
10051
+ if (err?.isAxiosError) exitWithError(fromAxiosError22(err, args.env));
9940
10052
  exitWithError(cause);
9941
10053
  }
9942
10054
  }
@@ -9944,8 +10056,8 @@ async function promptPasswordTwice() {
9944
10056
  const password = await promptSecret("\u65B0\u5BC6\u7801: ");
9945
10057
  const confirmation = await promptSecret("\u518D\u6B21\u8F93\u5165\u65B0\u5BC6\u7801: ");
9946
10058
  if (password !== confirmation) {
9947
- throw new CliError21({
9948
- code: CliErrorCode20.INVALID_ARGUMENT,
10059
+ throw new CliError22({
10060
+ code: CliErrorCode21.INVALID_ARGUMENT,
9949
10061
  message: "\u4E24\u6B21\u8F93\u5165\u7684\u65B0\u5BC6\u7801\u4E0D\u4E00\u81F4"
9950
10062
  });
9951
10063
  }
@@ -9956,13 +10068,13 @@ async function promptPasswordTwice() {
9956
10068
  init_exit();
9957
10069
  init_auth_guard();
9958
10070
  import {
9959
- HcmClient as HcmClient26,
10071
+ HcmClient as HcmClient27,
9960
10072
  formatObject as formatObject27,
9961
- fromAxiosError as fromAxiosError22
10073
+ fromAxiosError as fromAxiosError23
9962
10074
  } from "@hcmai/sdk";
9963
10075
  async function modelsCommand(keyword, args) {
9964
10076
  try {
9965
- const client3 = HcmClient26.fromAuthContext(await getActiveAuthContextFromCli(args));
10077
+ const client3 = HcmClient27.fromAuthContext(await getActiveAuthContextFromCli(args));
9966
10078
  const all = await client3.listModels();
9967
10079
  const needle = keyword?.trim().toLowerCase();
9968
10080
  const rows = (needle ? all.filter((m) => JSON.stringify(m).toLowerCase().includes(needle)) : all).sort((a, b) => key(a).localeCompare(key(b)));
@@ -9992,7 +10104,7 @@ async function modelsCommand(keyword, args) {
9992
10104
  process.exit(0);
9993
10105
  } catch (e) {
9994
10106
  const err = e;
9995
- if (err?.isAxiosError) exitWithError(fromAxiosError22(err, args.profile));
10107
+ if (err?.isAxiosError) exitWithError(fromAxiosError23(err, args.profile));
9996
10108
  exitWithError(e);
9997
10109
  }
9998
10110
  }
@@ -10113,7 +10225,7 @@ program.command("query <Model>").description("\u67E5\u8BE2 Model \u5217\u8868\u6
10113
10225
  `\u8FC7\u6EE4 AST\uFF08ModelQueryDsl\uFF09\uFF1A\u53F6\u5B50 '{"field":"status","op":"eq","value":"ACTIVE"}'\uFF0C\u591A\u6761\u4EF6\u7528 '{"and":[\u53F6\u5B50,\u2026]}'\u3002\u26A0\uFE0F \u4E0D\u63A5\u53D7 {"\u5B57\u6BB5":"\u503C"} \u7B80\u5199\uFF0Cschema \u5C42\u4F1A\u62D2`
10114
10226
  ).option("--sort <JSON>", `\u6392\u5E8F\u6761\u4EF6 JSON\uFF0C\u4F8B\u5982 '[{"field":"hireDate","direction":"desc"}]'`).option("--fields <list>", "\u8FD4\u56DE\u5B57\u6BB5\u5217\u8868\uFF08\u9017\u53F7\u5206\u9694\uFF09\uFF0C\u4F8B\u5982 name,code,email").option("--keyword <text>", "\u5168\u6587\u68C0\u7D22\u5173\u952E\u5B57").option("--limit <n>", "\u6BCF\u9875\u5927\u5C0F", "20").option("--offset <n>", "\u504F\u79FB\u91CF\uFF08\u6309 limit \u81EA\u52A8\u6362\u7B97 page\uFF09").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((m, opts) => queryCommand(m, opts));
10115
10227
  program.command("action <Model.Action>").description("\u8C03\u7528 Model \u4E0A\u7684 Action\uFF08\u4E1A\u52A1\u65B9\u6CD5\uFF09\uFF0C\u4F8B\u5982 Employee.regularize").option("--id <id>", "\u76EE\u6807\u5B9E\u4F53 ID\uFF08object Action \u5FC5\u586B\uFF09").option("--ids <csv>", "\u6279\u91CF ID\uFF08\u9017\u53F7\u5206\u9694\uFF0Cbulk Action \u7528\uFF09").option("--method <method>", "HTTP \u65B9\u6CD5\uFF1AGET | POST | PUT | DELETE\uFF08\u9ED8\u8BA4\u6309 Core \u5143\u6570\u636E\u81EA\u52A8\u5224\u5B9A\uFF09").option("--scope <scope>", "\u5F3A\u5236 Action scope\uFF1Aclass | object\uFF08\u9ED8\u8BA4\uFF1A\u6709 --id \u4E3A object\uFF0C\u5426\u5219 class\uFF09").option("--params <JSON>", `Action \u5165\u53C2 JSON\uFF0C\u4F8B\u5982 '{"effectDate":"2026-06-01"}'`).option("--params-file <path>", "\u4ECE UTF-8 JSON \u6587\u4EF6\u8BFB\u53D6 Action \u5165\u53C2\uFF08\u4E0E --params \u4E92\u65A5\uFF09").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((spec, opts) => actionCommand(spec, opts));
10116
- program.command("create <Model>").description("\u521B\u5EFA\u4E00\u6761 Model \u8BB0\u5F55\uFF08\u8D70\u540E\u7AEF\u5B8C\u6574\u6821\u9A8C\uFF09").option("--data <JSON>", `\u8BB0\u5F55\u5B57\u6BB5 JSON\uFF0C\u4F8B\u5982 '{"code":"ORG_SALES","name":"\u9500\u552E\u90E8"}'`).option("--data-file <path>", "\u4ECE UTF-8 JSON \u6587\u4EF6\u8BFB\u53D6\u8BB0\u5F55\u5B57\u6BB5\uFF08\u4E0E --data \u4E92\u65A5\uFF09").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((m, opts) => createCommand(m, opts));
10228
+ program.command("create <Model>").description("\u521B\u5EFA\u4E00\u6761 Model \u8BB0\u5F55\uFF08\u8D70\u540E\u7AEF\u5B8C\u6574\u6821\u9A8C\uFF09").option("--data <JSON>", `\u8BB0\u5F55\u5B57\u6BB5 JSON\uFF0C\u4F8B\u5982 '{"code":"ORG_SALES","name":"\u9500\u552E\u90E8"}'`).option("--data-file <path>", "\u4ECE UTF-8 JSON \u6587\u4EF6\u8BFB\u53D6\u8BB0\u5F55\u5B57\u6BB5\uFF08\u4E0E --data \u4E92\u65A5\uFF09").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").option("--i18n", "\u591A\u8BED\u8A00\u5B57\u6BB5\u6309 Map \u5B8C\u6574\u66FF\u6362\uFF08\u952E\u7528 zh-CN / en-US \u8FDE\u5B57\u7B26\u5F62\uFF09\uFF1B\u4E0D\u4F20\u5219\u6309\u5B57\u7B26\u4E32\u53EA\u6539\u5F53\u524D\u8BED\u8A00").action((m, opts) => createCommand(m, opts));
10117
10229
  program.command("delete <Model>").description("\u5220\u9664\u4E00\u6761 Model \u8BB0\u5F55\uFF08\u8D70\u540E\u7AEF\u5B8C\u6574\u6821\u9A8C\uFF1B\u90E8\u5206 Model \u4F1A\u6267\u884C\u4E1A\u52A1\u64A4\u9500\uFF09").option("--id <id>", "\u76EE\u6807\u5B9E\u4F53 ID\uFF08\u5FC5\u586B\uFF09").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((m, opts) => deleteCommand(m, opts));
10118
10230
  program.command("import <path>").description("\u6CE8\u5165 DataPackage YAML \u6570\u636E\u96C6\uFF08\u76EE\u5F55\u6216\u5355\u6587\u4EF6\uFF0C\u8D70\u540E\u7AEF\u5B8C\u6574\u6821\u9A8C\uFF09").option("--dry-run", "\u53EA\u8DD1\u5BA2\u6237\u7AEF\u9759\u6001\u6821\u9A8C\uFF0C\u4E0D\u843D\u5E93\uFF08\u89C1 spec \xA78 \u9650\u5236\uFF09").option("--update-only", "\u5DF2\u5B58\u5728\uFF08\u6309 key_field\uFF09\u5219 PUT \u66F4\u65B0\uFF0C\u5426\u5219 create").option("--on-error <mode>", "stop | continue\uFF08\u9ED8\u8BA4 continue\uFF09", "continue").option("--report <path>", "\u5199 JSON \u6CE8\u5165\u62A5\u544A\uFF08\u9010\u884C\u7ED3\u679C + key\u2192id \u6620\u5C04\uFF09").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((p, opts) => importCommand(p, opts));
10119
10231
  program.command("models [keyword]").description("\u5217\u51FA\u76EE\u6807\u73AF\u5883\u6709\u54EA\u4E9B Model\uFF08describe \u7684\u4E0A\u4E00\u6B65\uFF09\uFF1B\u53EF\u5E26\u5173\u952E\u5B57\u8FC7\u6EE4").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((keyword, opts) => modelsCommand(keyword, opts));
@@ -10183,9 +10295,10 @@ skills.command("manifest").description("\u6253\u5370\u672C CLI \u7684\u547D\u4EE
10183
10295
  skills.command("show <id>").description("\u6253\u5370\u6280\u80FD\u539F\u6587\uFF08\u7BA1\u9053\u53CB\u597D\uFF09\uFF1B\u81EA\u5E26\u6280\u80FD\u76F4\u63A5\u8BFB\u672C\u5730\uFF0C\u4E0D\u8FDE\u7F51").option("--source <kind>", "\u8FD9\u4E00\u8D9F\u770B\u54EA\u4E9B\u6765\u6E90\uFF1Acli\uFF08\u53EA\u770B\u81EA\u5E26\uFF0C\u4E0D\u8FDE\u7F51\uFF09| chiron | all", "all").option("--endpoint <url>", "\u6280\u80FD\u5E93\u5730\u5740\uFF08\u9ED8\u8BA4\u53D6 activeEnv \u7684 endpoint\uFF09").option("--env <name>", "\u4ECE\u8BE5 env \u89E3\u6790 endpoint").action((id, opts) => skillsShowCommand(id, opts));
10184
10296
  skills.command("install [id]").description("\u8FDE\u540C requires \u524D\u7F6E\u6280\u80FD\u4E0E\u53C2\u8003\u6587\u4EF6\u88C5\u5230 agent \u6280\u80FD\u76EE\u5F55\uFF1B--all \u88C5\u6574\u4E2A\u6280\u80FD\u5E93").option("--all", "\u88C5\u6574\u4E2A\u6280\u80FD\u5E93\uFF0C\u5E76\u8BB0\u4E3A\u300C\u8DDF\u968F\u5168\u96C6\u300D\uFF08\u5F80\u540E update \u4F1A\u81EA\u52A8\u8865\u4E0A\u4EA7\u54C1\u65B0\u589E\u7684\u6280\u80FD\uFF09").option("--target <agent>", "\u88C5\u7ED9\u54EA\u4E2A agent\uFF1Aclaude\uFF08.claude/skills/\uFF09| codex\uFF08hcm-skills/ + AGENTS.md\uFF09| auto", "auto").option("--global", "\u88C5\u5230\u7528\u6237\u7EA7\u76EE\u5F55\u800C\u975E\u5F53\u524D\u9879\u76EE").option("--dir <path>", "\u88C5\u5230\u6307\u5B9A\u76EE\u5F55").option("--from <dir>", "\u4ECE\u672C\u5730\u76EE\u5F55\u88C5\uFF08\u73B0\u573A\u6539\u8FC7\u7684\u7248\u672C\uFF09\uFF0C\u4E0D\u8D70\u7F51\u7EDC").option("--source <kind>", "\u8FD9\u4E00\u8D9F\u770B\u54EA\u4E9B\u6765\u6E90\uFF1Acli\uFF08\u53EA\u770B\u81EA\u5E26\uFF0C\u4E0D\u8FDE\u7F51\uFF09| chiron | all", "all").option("--force", "\u8986\u76D6\u5DF2\u5B58\u5728\u7684\u540C\u540D\u6280\u80FD").option("--endpoint <url>", "\u6280\u80FD\u5E93\u5730\u5740\uFF08\u9ED8\u8BA4\u53D6 activeEnv \u7684 endpoint\uFF09").option("--env <name>", "\u4ECE\u8BE5 env \u89E3\u6790 endpoint").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((id, opts) => skillsInstallCommand(id, opts));
10185
10297
  skills.command("update").description("\u628A\u88C5\u8FC7\u7684\u6280\u80FD\u5347\u5230\u76EE\u6807\u73AF\u5883\u8FD9\u4E00\u7248\uFF08\u4EA7\u54C1\u5347\u7EA7\u540E\u8DD1\u5B83\uFF09").option("--all", "\u8FDE\u4EA7\u54C1\u65B0\u589E\u7684\u6280\u80FD\u4E00\u8D77\u88C5\u4E0A\uFF0C\u5E76\u8BB0\u4E3A\u300C\u8DDF\u968F\u5168\u96C6\u300D").option("--check", "\u53EA\u770B\u4F1A\u53D8\u4EC0\u4E48\uFF0C\u4E0D\u5199\u76D8").option("--target <agent>", "claude | codex | auto\uFF08\u9ED8\u8BA4\u6309\u5DF2\u5B89\u88C5\u76EE\u5F55\u63A2\uFF09", "auto").option("--global", "\u5347\u7EA7\u7528\u6237\u7EA7\u76EE\u5F55\u91CC\u7684\u6280\u80FD").option("--dir <path>", "\u5347\u7EA7\u6307\u5B9A\u76EE\u5F55\u91CC\u7684\u6280\u80FD").option("--force", "\u8FDE\u672C\u5730\u6539\u8FC7\u7684\u6280\u80FD\u4E00\u8D77\u8986\u76D6\u6210\u4EA7\u54C1\u8FD9\u4E00\u7248").option("--source <kind>", "\u8FD9\u4E00\u8D9F\u770B\u54EA\u4E9B\u6765\u6E90\uFF1Acli\uFF08\u53EA\u770B\u81EA\u5E26\uFF0C\u4E0D\u8FDE\u7F51\uFF09| chiron | all", "all").option("--endpoint <url>", "\u6280\u80FD\u5E93\u5730\u5740\uFF08\u9ED8\u8BA4\u53D6\u5B89\u88C5\u65F6\u8BB0\u5F55\u7684\u5730\u5740\uFF09").option("--env <name>", "\u4ECE\u8BE5 env \u89E3\u6790 endpoint").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => skillsUpdateCommand(opts));
10186
- program.command("update <Model>").description("\u66F4\u65B0\u4E00\u6761 Model \u8BB0\u5F55\uFF08\u8D70\u540E\u7AEF\u5B8C\u6574\u6821\u9A8C\uFF09\u3002\u5347\u7EA7 CLI \u8BF7\u7528 `hcm upgrade`").requiredOption("--id <id>", "\u8BB0\u5F55 ID").option("--data <JSON>", `\u8981\u66F4\u65B0\u7684\u5B57\u6BB5 JSON\uFF0C\u4F8B\u5982 '{"name":"\u65B0\u540D\u79F0"}'`).option("--data-file <path>", "\u4ECE UTF-8 JSON \u6587\u4EF6\u8BFB\u53D6\u66F4\u65B0\u5B57\u6BB5\uFF08\u4E0E --data \u4E92\u65A5\uFF09").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((model, opts) => updateCommand(model, opts));
10298
+ program.command("update <Model>").description("\u66F4\u65B0\u4E00\u6761 Model \u8BB0\u5F55\uFF08\u8D70\u540E\u7AEF\u5B8C\u6574\u6821\u9A8C\uFF09\u3002\u5347\u7EA7 CLI \u8BF7\u7528 `hcm upgrade`").requiredOption("--id <id>", "\u8BB0\u5F55 ID").option("--data <JSON>", `\u8981\u66F4\u65B0\u7684\u5B57\u6BB5 JSON\uFF0C\u4F8B\u5982 '{"name":"\u65B0\u540D\u79F0"}'`).option("--data-file <path>", "\u4ECE UTF-8 JSON \u6587\u4EF6\u8BFB\u53D6\u66F4\u65B0\u5B57\u6BB5\uFF08\u4E0E --data \u4E92\u65A5\uFF09").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").option("--i18n", "\u591A\u8BED\u8A00\u5B57\u6BB5\u6309 Map \u5B8C\u6574\u66FF\u6362\uFF08\u952E\u7528 zh-CN / en-US \u8FDE\u5B57\u7B26\u5F62\uFF09\uFF1B\u4E0D\u4F20\u5219\u6309\u5B57\u7B26\u4E32\u53EA\u6539\u5F53\u524D\u8BED\u8A00").action((model, opts) => updateCommand(model, opts));
10187
10299
  program.command("version").description("\u67E5 CLI \u4E0E\u540E\u7AEF\u4E24\u4E2A\u7248\u672C\uFF08commit / tag / \u6784\u5EFA\u65F6\u95F4\uFF09\u2014\u2014\u514D\u8BA4\u8BC1\uFF0C\u65E0\u9700\u5148 login").option("--endpoint <url>", "\u540E\u7AEF\u5730\u5740\uFF08\u9ED8\u8BA4\u53D6 activeEnv \u7684 endpoint\uFF09").option("--env <name>", "\u4ECE\u8BE5 env \u89E3\u6790 endpoint").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => versionCommand(opts));
10188
10300
  program.command("upgrade").alias("self-update").description("\u5347\u7EA7 CLI \u81EA\u5DF1\uFF08\u6CE8\u610F\uFF1A`hcm update` \u662F\u66F4\u65B0\u4E1A\u52A1\u8BB0\u5F55\uFF0C\u4E0D\u662F\u5347\u7EA7\uFF09").option("--check", "\u53EA\u68C0\u67E5\uFF1B\u6709\u65B0\u7248\u672C\u65F6\u4EE5\u9000\u51FA\u7801 1 \u7ED3\u675F\uFF0C\u4FBF\u4E8E\u811A\u672C\u5224\u65AD").action((opts) => upgradeCommand(opts));
10301
+ program.command("open [path]").description("\u7528\u5F53\u524D CLI \u8EAB\u4EFD\u6253\u5F00\u524D\u7AEF\u9875\u9762\uFF1A\u94F8\u4E00\u5F20 60s \u4E00\u6B21\u6027\u7968\u636E\u4EA4\u7ED9\u6D4F\u89C8\u5668\uFF0C\u4F1A\u8BDD token \u4E0D\u8FDB URL").option("--print-url", "\u53EA\u6253\u5370\u767B\u5F55 URL\uFF0C\u4E0D\u5F00\u6D4F\u89C8\u5668\uFF08\u7ED9 agent \u6D4F\u89C8\u5668 navigate \u7528\uFF09").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").action((path12, opts) => openCommand(path12, opts));
10189
10302
  var setting = program.command("setting").description("\u79DF\u6237\u7CFB\u7EDF\u53C2\u6570\uFF08\u767B\u5F55\u7B56\u7565 / \u5BC6\u7801\u7B56\u7565 / \u529F\u80FD\u5F00\u5173 / \u96C6\u6210\u53C2\u6570\uFF09");
10190
10303
  setting.command("get <domain>").description("\u8BFB\u67D0\u57DF\u53C2\u6570\uFF08\u5B9A\u4E49 + \u79DF\u6237\u8986\u76D6\u503C\u5408\u5E76\uFF0C\u7F3A\u5931\u56DE\u843D\u9ED8\u8BA4\u503C\uFF09").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((d, opts) => settingGetCommand(d, opts));
10191
10304
  setting.command("set <domain>").description("\u6539\u53C2\u6570\uFF0C\u53EF\u91CD\u590D --set\uFF1B\u8D70\u53D7\u63A7\u6821\u9A8C\u8DEF\u5F84\u800C\u975E\u6807\u51C6 CRUD").option("--set <assignment...>", "namespace.key=value\uFF0C\u4F8B\u5982 security.password.passwordPolicy=complex").option("--dry-run", "\u53EA\u663E\u793A\u5C06\u5199\u5165\u4EC0\u4E48\uFF0C\u4E0D\u5B9E\u9645\u5199\u5165").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((d, opts) => settingSetCommand(d, opts));