@hcmai/sdk 0.28.0 → 0.29.0

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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AxiosInstance } from 'axios';
1
+ import { AxiosInstance, AxiosRequestConfig } from 'axios';
2
2
  import { IncomingMessage } from 'node:http';
3
3
 
4
4
  interface EnvironmentSafety {
@@ -243,6 +243,15 @@ interface ActionInput {
243
243
  type ActionHttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
244
244
  type ActionScope = 'class' | 'object';
245
245
  interface ActionResult<R = unknown> {
246
+ /** Core ActionResponse 信封;result/taskId 保留兼容既有返回。 */
247
+ success?: boolean;
248
+ data?: R;
249
+ message?: string;
250
+ error?: {
251
+ code?: string;
252
+ message?: string;
253
+ [key: string]: unknown;
254
+ };
246
255
  result?: R;
247
256
  taskId?: string;
248
257
  }
@@ -344,6 +353,13 @@ interface ActionMeta {
344
353
  * 与 `'UNKNOWN'`(有三态、产品侧说没人判过)不是一回事。
345
354
  */
346
355
  effect?: unknown;
356
+ /** Action 确认声明;保留服务端原值供审阅,不由 CLI 从 HTTP 方法推断。 */
357
+ confirm?: unknown;
358
+ /** 自动 source 准入需要显式 NO;UNKNOWN 必须保留。 */
359
+ hasExternalDep?: unknown;
360
+ sensitiveData?: unknown;
361
+ /** 有效 Action 端点提供的派生确认结论。 */
362
+ requiresConfirmation?: unknown;
347
363
  /** @deprecated 派生位(`effect === 'READ_ONLY'`),不是作者源。要区分「确认会写」与「没人判过」必须读 {@link effect}。 */
348
364
  readOnly?: boolean;
349
365
  paramTypes?: string[];
@@ -715,7 +731,8 @@ declare class HcmClient {
715
731
  profile?: string;
716
732
  }): Promise<HcmClient>;
717
733
  query<T = Record<string, unknown>>(model: string, dsl: ModelQueryDsl): Promise<QueryResult<T>>;
718
- action<R = unknown>(model: string, name: string, input: ActionInput): Promise<ActionResult<R>>;
734
+ /** requestConfig 只覆盖本次 Action 的等待时限,不改变客户端默认超时。 */
735
+ action<R = unknown>(model: string, name: string, input: ActionInput, requestConfig?: Pick<AxiosRequestConfig, 'timeout'>): Promise<ActionResult<R>>;
719
736
  /** 列出目标环境有哪些 Model —— `describe` 的上一步。 */
720
737
  listModels(): Promise<ModelEntry[]>;
721
738
  describe(model: string, opts?: DescribeOpts): Promise<ModelDescription>;
@@ -776,6 +793,8 @@ declare enum CliErrorCode {
776
793
  STREAM_FAILED_NO_SERVER_CODE = "STREAM_FAILED_NO_SERVER_CODE",
777
794
  MODEL_NOT_FOUND = "MODEL_NOT_FOUND",
778
795
  ACTION_NOT_FOUND = "ACTION_NOT_FOUND",
796
+ /** 老 Core 没有能力探针 Action:未拿到结论,需升级 Core。 */
797
+ LLM_PROBE_UNAVAILABLE = "LLM_PROBE_UNAVAILABLE",
779
798
  AGENT_NOT_FOUND = "AGENT_NOT_FOUND",
780
799
  TOOL_TIMEOUT = "TOOL_TIMEOUT",
781
800
  NETWORK_ERROR = "NETWORK_ERROR",
@@ -1326,7 +1345,8 @@ declare function assertExpectedTenant(principal: Principal | undefined, expected
1326
1345
 
1327
1346
  interface ClientCredentialsInput {
1328
1347
  endpoint: string;
1329
- tenantId: string;
1348
+ /** 不进请求(凭据本身决定租户),仅为调用方对称保留;可省略。 */
1349
+ tenantId?: string;
1330
1350
  clientId: string;
1331
1351
  clientSecret: string;
1332
1352
  profile: string;
@@ -1337,7 +1357,8 @@ declare function loginClientCredentials(input: ClientCredentialsInput): Promise<
1337
1357
 
1338
1358
  interface PatLoginInput {
1339
1359
  endpoint: string;
1340
- tenantId: string;
1360
+ /** 不进请求(凭据本身决定租户),仅为调用方对称保留;可省略。 */
1361
+ tenantId?: string;
1341
1362
  pat: string;
1342
1363
  profile: string;
1343
1364
  expectedTenantId?: string;
@@ -1347,7 +1368,12 @@ declare function loginPat(input: PatLoginInput): Promise<LoginOutcome>;
1347
1368
 
1348
1369
  interface PasswordLoginInput {
1349
1370
  endpoint: string;
1350
- tenantId: string;
1371
+ /**
1372
+ * 使用者**显式**要的租户。没给(undefined / 空白)就不往请求里放 `tenantId`:
1373
+ * ADR-412 之后租户由主机决定,服务端没有默认租户;替使用者猜一个 `'1'` 塞进去,
1374
+ * 在租户专属地址上必然撞 `TENANT_HOST_MISMATCH`(cli#374)。
1375
+ */
1376
+ tenantId?: string;
1351
1377
  username: string;
1352
1378
  password: string;
1353
1379
  profile: string;
@@ -3247,15 +3273,18 @@ declare function getScriptTask(http: AxiosInstance, taskId: string): Promise<Scr
3247
3273
  *
3248
3274
  * 后端契约(TenantBootstrapController):
3249
3275
  * - `POST /api/bootstrap/tenant`,header `X-Bootstrap-Key: <secret>`
3250
- * - body `{ tenantId, adminUsername, adminPassword, tenantName?, slug | host }`
3251
- * (ADR-412 D6:slug 与 host 二选一,同事务登记租户主机;不合法/保留/已占用 422,租户不登记)
3276
+ * - body `{ tenantId, adminUsername?, adminPassword, tenantName?, slug | host }`
3277
+ * (ADR-412 D6:slug 与 host 二选一,同事务登记租户主机;不合法/保留/已占用 422,租户不登记;
3278
+ * adminUsername 可省略:省略按服务端内置管理员名处理,给了但与内置名不一致回 400
3279
+ * TENANT_ADMIN_USERNAME_FIXED——cli#392)
3252
3280
  *
3253
3281
  * 🔴 该端点不走普通 Bearer 认证,用独立的 bootstrap key —— 它要在「还没有任何
3254
3282
  * 租户和用户」的时刻可用。key 由部署方持有,绝不写进 skill 正文或提交进仓库。
3255
3283
  */
3256
3284
  interface BootstrapTenantRequest {
3257
3285
  tenantId: string;
3258
- adminUsername: string;
3286
+ /** 可省略:服务端按内置管理员名(HCM_BUILTIN_ADMIN_USERNAME,默认 admin)处理;给了须与之一致。 */
3287
+ adminUsername?: string;
3259
3288
  adminPassword: string;
3260
3289
  tenantName?: string;
3261
3290
  /** SaaS 客户简称,主机为 `<slug>.<hcm.tenant.host.saas-base-domain>`;与 host 二选一。 */
@@ -3458,7 +3487,7 @@ declare function getColumnSlots(http: AxiosInstance, model: string, opts?: Colum
3458
3487
  /** `GET /api/tenant-extension/column-slots/sql?model=&field=[&slot=][&fromSlot=]` —— 返回服务端 `data` 原样。 */
3459
3488
  declare function getColumnSlotSql(http: AxiosInstance, params: ColumnSlotSqlParams, opts?: ColumnSlotRequestOpts): Promise<ColumnSlotSqlView>;
3460
3489
 
3461
- declare const META_SCHEMA_SOURCE_COMMIT = "6b872a5b3749147cd4fed9dd1a1598e5876c8c76";
3490
+ declare const META_SCHEMA_SOURCE_COMMIT = "206fd90621975757bd5c77c014e037ff74f2506c";
3462
3491
 
3463
3492
  type MetaIssueSeverity = 'error' | 'warn';
3464
3493
  interface MetaIssue {