@kanyun-ai-infra/agenthub 1.19.0 → 1.20.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/CHANGELOG.md +15 -0
- package/dist/index.cjs +87 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +87 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/agenthub-sdk/SKILL.md +106 -38
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
本文件从 1.12.0 开始记录;更早的版本见 git 历史中的 `chore(agenthub-sdk): release X.Y.Z` 提交。
|
|
4
4
|
|
|
5
|
+
## 1.20.0
|
|
6
|
+
|
|
7
|
+
### 新增(主入口)
|
|
8
|
+
|
|
9
|
+
- `sessions.create` 的 `CreateSessionRequestInput` 与 `CreatePlatformSessionRequestSchema` 支持可选的 `pushBackPaths: string[]`,用于创建 Rondo 会话。与 `deliveryMode: "push_back"`、`repoUrl`、`repoRef` 配合使用;路径数组按原顺序发送,保留重复项,省略或传 `undefined` 时不输出该字段。Rondo 授权与 glob 规则由服务端校验,SDK 不另加路径校验。字段随共享请求契约引入(#5489),wire 回归测试及公开说明见 #5537。
|
|
10
|
+
|
|
11
|
+
### 随包文档
|
|
12
|
+
|
|
13
|
+
- Quickstart 按签发令牌、创建带初版的 agent、创建会话、发送回合四步组织,补充宿主接入前置条件、scope 和模型服务要求(#5504)。
|
|
14
|
+
- `SKILL.md` 补充 Rondo 会话示例、路径范围与服务端前置条件;随包 skill 版本由 0.29.0 升至 0.29.2(#5504、#5537)。
|
|
15
|
+
|
|
16
|
+
### 迁移说明
|
|
17
|
+
|
|
18
|
+
- 相对 npm 1.19.0,公开导出名称不增不减;请求 schema 新增可选字段,已有调用方无需改代码。`realtime` 子入口的类型声明不变。需要 `pushBackPaths` 的调用方应升级到 1.20.0;1.19.0 会在发送请求前以未知字段拒绝它(#5489、#5537)。
|
|
19
|
+
|
|
5
20
|
## 1.19.0
|
|
6
21
|
|
|
7
22
|
宿主接入线(#5492)R0 的 SDK 面:新增 webhook 订阅、vault 与凭据、项目模型服务、项目级 agent 列表四个入口,`agents.create` 可以带初版定义一步出可跑版本,客户端可以声明代终端用户调用的归因用户。对导出面是纯增量,已有调用方不用改代码。
|
package/dist/index.cjs
CHANGED
|
@@ -564,9 +564,10 @@ var EXECUTOR_FORMAT_REGISTRY = {
|
|
|
564
564
|
toolFiltering: false,
|
|
565
565
|
approvals: false
|
|
566
566
|
},
|
|
567
|
-
//
|
|
568
|
-
//
|
|
569
|
-
|
|
567
|
+
// Shape only (pi spec PI-M1): the worker registers the chosen id at run
|
|
568
|
+
// time (PI-M3), so any id the bound model service serves can run. Not a
|
|
569
|
+
// reachability guard; PI-P2's three guards keep pi unreachable.
|
|
570
|
+
allowedModels: { kind: "wellFormedId" },
|
|
570
571
|
// Pi's MCP goes through managed MCP only (owner 2026-09-28): no rush
|
|
571
572
|
// direct references, no self-loaded MCP client extension.
|
|
572
573
|
mcpMode: "bridge",
|
|
@@ -2731,6 +2732,7 @@ var STANDARD_EVENT_TYPES = Object.keys(
|
|
|
2731
2732
|
);
|
|
2732
2733
|
var StandardEventTypeSchema = import_zod16.z.enum(STANDARD_EVENT_TYPES);
|
|
2733
2734
|
var PUSH_BACK_PATTERNS_MAX = 50;
|
|
2735
|
+
var COMMIT_AUTHOR_LDAP_PATTERN = /^[a-z][a-z0-9._-]{0,63}$/;
|
|
2734
2736
|
var BRANCH_CHARS_RE = /^[A-Za-z0-9][A-Za-z0-9._/-]*$/;
|
|
2735
2737
|
function isPushBackBranchName(branch) {
|
|
2736
2738
|
if (branch.length > 255 || !BRANCH_CHARS_RE.test(branch)) return false;
|
|
@@ -2745,7 +2747,7 @@ var PushBackPolicySchema = import_zod24.z.object({
|
|
|
2745
2747
|
projectId: import_zod24.z.string(),
|
|
2746
2748
|
branchPatterns: import_zod24.z.array(import_zod24.z.string())
|
|
2747
2749
|
});
|
|
2748
|
-
var
|
|
2750
|
+
var PodAgentPushBackPolicySchema = import_zod24.z.object({
|
|
2749
2751
|
mode: import_zod24.z.literal("push_back"),
|
|
2750
2752
|
/** The repo's default branch; pushing to it is refused. */
|
|
2751
2753
|
defaultBranch: import_zod24.z.string().min(1).optional(),
|
|
@@ -2756,6 +2758,26 @@ var PodAgentPushPolicySchema = import_zod24.z.object({
|
|
|
2756
2758
|
/** PB-11: the session's frozen commit author email. */
|
|
2757
2759
|
authorEmail: import_zod24.z.string().min(1).optional()
|
|
2758
2760
|
}).strict();
|
|
2761
|
+
var PodAgentRondoPushPolicySchema = import_zod24.z.object({
|
|
2762
|
+
mode: import_zod24.z.literal("rondo"),
|
|
2763
|
+
/** The session's `repoUrl`; clone of any other repo is refused. */
|
|
2764
|
+
repoUrl: import_zod24.z.string().min(1).optional(),
|
|
2765
|
+
/** The session's `repoRef`: the only branch clone checks out and push targets. */
|
|
2766
|
+
branch: import_zod24.z.string().min(1).optional(),
|
|
2767
|
+
/** The remote default branch frozen at creation (sync base, path-guard tip). */
|
|
2768
|
+
defaultBranch: import_zod24.z.string().min(1).optional(),
|
|
2769
|
+
/** The session's frozen `pushBackPaths` (RS-2 globs). */
|
|
2770
|
+
paths: import_zod24.z.array(import_zod24.z.string().min(1)).optional(),
|
|
2771
|
+
/** PB-11: the session's frozen commit author email. */
|
|
2772
|
+
authorEmail: import_zod24.z.string().min(1).optional()
|
|
2773
|
+
}).strict();
|
|
2774
|
+
var PodAgentPushPolicySchema = import_zod24.z.discriminatedUnion("mode", [
|
|
2775
|
+
PodAgentPushBackPolicySchema,
|
|
2776
|
+
PodAgentRondoPushPolicySchema
|
|
2777
|
+
]);
|
|
2778
|
+
var PUSH_BACK_PATHS_MAX = 50;
|
|
2779
|
+
var PUSH_BACK_PATH_MAX_LENGTH = 255;
|
|
2780
|
+
var REQUESTED_BY_MAX = 20;
|
|
2759
2781
|
var POD_AGENT_ENDPOINT_PORT = 8790;
|
|
2760
2782
|
var AgentPortSpecSchema = import_zod25.z.object({
|
|
2761
2783
|
name: import_zod25.z.string().min(1).max(63),
|
|
@@ -2966,7 +2988,12 @@ var FailureReasonCodeSchema = import_zod13.z.enum([
|
|
|
2966
2988
|
* delivery pipeline PB-3:`push_back` 会话复活重放的那一轮被拒(开关关、或分支已不再通过项目
|
|
2967
2989
|
* 推回策略)。什么都不发、不回落 MR;`source: control_plane`。
|
|
2968
2990
|
*/
|
|
2969
|
-
"PUSH_BACK_DELIVERY_REJECTED"
|
|
2991
|
+
"PUSH_BACK_DELIVERY_REJECTED",
|
|
2992
|
+
/**
|
|
2993
|
+
* delivery pipeline RS-6:Rondo 会话复活重放的那一轮读不到 GitLab(超时 / 5xx / 401 / 403),不发;
|
|
2994
|
+
* 会话按 REV-EX-F 回到终止态但不记仓库复核的终止理由,下一轮照常复活重试。`source: control_plane`。
|
|
2995
|
+
*/
|
|
2996
|
+
"RONDO_REPO_CHECK_UNAVAILABLE"
|
|
2970
2997
|
]);
|
|
2971
2998
|
var WorkerHealthStateSchema = import_zod13.z.enum(["heartbeat", "ready", "failed"]);
|
|
2972
2999
|
var WorkerHealthReasonCodeSchema = import_zod13.z.enum([
|
|
@@ -3641,7 +3668,6 @@ var PodAgentStartWorkerResponseSchema = import_zod13.z.discriminatedUnion("kind"
|
|
|
3641
3668
|
})
|
|
3642
3669
|
]);
|
|
3643
3670
|
var SessionDeliveryModeSchema = import_zod13.z.enum(["merge_request", "direct_push", "push_back"]);
|
|
3644
|
-
var COMMIT_AUTHOR_LDAP_PATTERN = /^[a-z][a-z0-9._-]{0,63}$/;
|
|
3645
3671
|
var CreateSessionRequestSchema = import_zod13.z.object({
|
|
3646
3672
|
/**
|
|
3647
3673
|
* P4 Phase 1.5 — optional caller-supplied resource id. When present, the
|
|
@@ -3873,7 +3899,14 @@ var CreateSessionRequestSchema = import_zod13.z.object({
|
|
|
3873
3899
|
* 交付 commit 的作者是 `<ldap>@<AGENTHUB_COMMIT_EMAIL_DOMAIN>`,建会话时算好冻结。
|
|
3874
3900
|
* `ldap` 须是项目成员;省略 = 取会话发起人。只对 `push_back` 有意义,别的模式带它 → 400。
|
|
3875
3901
|
*/
|
|
3876
|
-
commitAuthor: import_zod13.z.object({ ldap: import_zod13.z.string().regex(COMMIT_AUTHOR_LDAP_PATTERN) }).strict().optional()
|
|
3902
|
+
commitAuthor: import_zod13.z.object({ ldap: import_zod13.z.string().regex(COMMIT_AUTHOR_LDAP_PATTERN) }).strict().optional(),
|
|
3903
|
+
/**
|
|
3904
|
+
* Rondo 会话(delivery pipeline RS-1 / RS-2):带这个键 = 在 band 项目之外的目标仓库上推回,
|
|
3905
|
+
* 只许改命中这些 glob 的路径。schema 只挡离谱的体积;1–50 条、每条的形状由 control-plane
|
|
3906
|
+
* 在 RS-1 的开关与身份门之后判,答 400 `PUSH_BACK_PATHS_INVALID`(不让一个不该开 Rondo 会话的
|
|
3907
|
+
* 调用方先拿到路径语法的反馈)。
|
|
3908
|
+
*/
|
|
3909
|
+
pushBackPaths: import_zod13.z.array(import_zod13.z.string().max(PUSH_BACK_PATH_MAX_LENGTH * 4)).max(PUSH_BACK_PATHS_MAX * 10).optional()
|
|
3877
3910
|
}).strict().refine(
|
|
3878
3911
|
(data) => {
|
|
3879
3912
|
if (!data.vault_ids) return true;
|
|
@@ -7565,6 +7598,7 @@ var SandboxStatusSchema = import_zod35.z.enum([
|
|
|
7565
7598
|
"creating",
|
|
7566
7599
|
"running",
|
|
7567
7600
|
"idle",
|
|
7601
|
+
"paused",
|
|
7568
7602
|
"destroying",
|
|
7569
7603
|
"destroyed",
|
|
7570
7604
|
"error"
|
|
@@ -8106,6 +8140,12 @@ var PilotCoderRunConfigV1Schema = import_zod38.z.object({
|
|
|
8106
8140
|
requestedBy: import_zod38.z.string().min(1).max(255),
|
|
8107
8141
|
submittedBy: import_zod38.z.string().min(1).max(255)
|
|
8108
8142
|
}).strict().optional(),
|
|
8143
|
+
/**
|
|
8144
|
+
* delivery pipeline RS-10:Rondo 会话冻结的 `pushBackPaths`,只随 `pushBackBranch` 出现。worker
|
|
8145
|
+
* 交付 commit 前用它检查待提交路径,有越界的就以 `push:policy_violation` 失败、零 push;权威
|
|
8146
|
+
* 判定在 pod-agent 的路径守卫(RS-9)。WC-1 版本 3 的必需字段:低版本 Pod 拒发、不裁剪。
|
|
8147
|
+
*/
|
|
8148
|
+
pushBackPaths: import_zod38.z.array(import_zod38.z.string().min(1).max(PUSH_BACK_PATH_MAX_LENGTH)).min(1).max(PUSH_BACK_PATHS_MAX).optional(),
|
|
8109
8149
|
/**
|
|
8110
8150
|
* AgentHub eval (T6/闸2b) — hard-off switch for ALL delivery side effects.
|
|
8111
8151
|
* When true, agent-worker skips the delivery loop entirely (no git push, no
|
|
@@ -8187,6 +8227,8 @@ var RUN_CONFIG_FIELD_MIN_CONTRACT_VERSION = {
|
|
|
8187
8227
|
pushBackBranch: 2,
|
|
8188
8228
|
commitAuthor: 2,
|
|
8189
8229
|
commitTrailers: 2,
|
|
8230
|
+
// Rondo sessions (delivery pipeline RS-10): required, its readers also prove pod-agent knows RS-9.
|
|
8231
|
+
pushBackPaths: 3,
|
|
8190
8232
|
deliveryDisabled: 0,
|
|
8191
8233
|
fixturesRepoUrl: 0,
|
|
8192
8234
|
fixturesRef: 0,
|
|
@@ -8744,7 +8786,13 @@ var PlatformScopeSchema = import_zod46.z.enum([
|
|
|
8744
8786
|
* 不经签发入口,由校验时的主体清单兜底)。所以它**不进**
|
|
8745
8787
|
* `ADMIN_ONLY_SCOPE_VALUES`——那张表的语义是「admin 可以签」,而这里 admin 也不行。
|
|
8746
8788
|
*/
|
|
8747
|
-
"actor:delegate"
|
|
8789
|
+
"actor:delegate",
|
|
8790
|
+
/**
|
|
8791
|
+
* 建 Rondo 会话(delivery pipeline RS-1:带 `pushBackPaths` 的 `POST /api/sessions`)。持有者
|
|
8792
|
+
* 能让 Rondo 的 GitLab 账号在它有成员资格的任何仓库上推送,量级与 `actor:delegate` 同:
|
|
8793
|
+
* **仅系统签发**,token 主人还要在 `FIRST_PARTY_RONDO_PRINCIPALS` 里。
|
|
8794
|
+
*/
|
|
8795
|
+
"rondo-sessions:create"
|
|
8748
8796
|
]);
|
|
8749
8797
|
var X_PILOT_ACT_AS_HEADER = "x-pilot-act-as";
|
|
8750
8798
|
var ScopeTemplateSchema = import_zod46.z.enum([
|
|
@@ -8794,13 +8842,16 @@ var NEVER_IN_PRESET_SCOPE_VALUES = [
|
|
|
8794
8842
|
"templates:promote",
|
|
8795
8843
|
// 代表声明的准入条件:仅系统签发(见 SYSTEM_ISSUED_ONLY_SCOPE_VALUES),预设里出现它 =
|
|
8796
8844
|
// 每张预设 token 都离「代表任意用户」只差一个主体条件。
|
|
8797
|
-
"actor:delegate"
|
|
8845
|
+
"actor:delegate",
|
|
8846
|
+
// 建 Rondo 会话:仅系统签发(RS-1)。
|
|
8847
|
+
"rondo-sessions:create"
|
|
8798
8848
|
];
|
|
8799
8849
|
var NEVER_IN_PRESET_SCOPES = new Set(
|
|
8800
8850
|
NEVER_IN_PRESET_SCOPE_VALUES
|
|
8801
8851
|
);
|
|
8802
8852
|
var SYSTEM_ISSUED_ONLY_SCOPE_VALUES = [
|
|
8803
|
-
"actor:delegate"
|
|
8853
|
+
"actor:delegate",
|
|
8854
|
+
"rondo-sessions:create"
|
|
8804
8855
|
];
|
|
8805
8856
|
var SYSTEM_ISSUED_ONLY_SCOPES = new Set(
|
|
8806
8857
|
SYSTEM_ISSUED_ONLY_SCOPE_VALUES
|
|
@@ -12353,7 +12404,14 @@ var SessionTurnRequestSchema = import_zod73.z.object({
|
|
|
12353
12404
|
* splices the URLs into `promptText` as a trailing context block; the
|
|
12354
12405
|
* worker (LLM) treats them as references it can fetch.
|
|
12355
12406
|
*/
|
|
12356
|
-
attachments: import_zod73.z.array(AttachmentMetaSchema).max(20).optional()
|
|
12407
|
+
attachments: import_zod73.z.array(AttachmentMetaSchema).max(20).optional(),
|
|
12408
|
+
/**
|
|
12409
|
+
* delivery pipeline RS-7: who asked for this turn (1–20 ldaps). Only a Rondo
|
|
12410
|
+
* session accepts it (other sessions answer 400 `REQUESTED_BY_NOT_ALLOWED`);
|
|
12411
|
+
* it becomes this turn's `Requested-by` trailer, the commit author stays the
|
|
12412
|
+
* session's frozen one.
|
|
12413
|
+
*/
|
|
12414
|
+
requestedBy: import_zod73.z.array(import_zod73.z.string().regex(COMMIT_AUTHOR_LDAP_PATTERN)).min(1).max(REQUESTED_BY_MAX).optional()
|
|
12357
12415
|
}).strict().superRefine((value, ctx) => {
|
|
12358
12416
|
var _a;
|
|
12359
12417
|
if (value.text.length > 0) return;
|
|
@@ -13607,6 +13665,11 @@ var FileAgentPiDefinitionSchema = import_zod83.z.object({
|
|
|
13607
13665
|
* CI 红过一次后补上(agenthub-cli `check --refs` 按三臂共面读该键)。
|
|
13608
13666
|
*/
|
|
13609
13667
|
modelService: FileAgentModelServiceNameSchema.optional(),
|
|
13668
|
+
environment: FileAgentEnvironmentNameSchema.optional(),
|
|
13669
|
+
mcpServers: FileAgentMcpServerListSchema.optional(),
|
|
13670
|
+
setupScript: WorkloadManifestSetupScriptSchema.optional(),
|
|
13671
|
+
setupScriptFile: FileAgentSetupScriptFileSchema.optional(),
|
|
13672
|
+
env: SessionConfigValuesSchema.optional(),
|
|
13610
13673
|
memory: FileAgentMemorySchema.optional(),
|
|
13611
13674
|
channels: WorkloadManifestChannelsSchema.optional(),
|
|
13612
13675
|
pi: import_zod83.z.object({}).strict().optional(),
|
|
@@ -13614,6 +13677,9 @@ var FileAgentPiDefinitionSchema = import_zod83.z.object({
|
|
|
13614
13677
|
/** promote 门禁档位 —— 与其它臂同义同形(#4870 G1,门禁与执行器正交)。 */
|
|
13615
13678
|
promoteGate: PromoteGateModeSchema.optional()
|
|
13616
13679
|
}).strict();
|
|
13680
|
+
function isFileAgentSandboxDefinition(definition) {
|
|
13681
|
+
return definition.format === "claude_code" || definition.format === "pi";
|
|
13682
|
+
}
|
|
13617
13683
|
var FileAgentDefinitionSchema = import_zod83.z.discriminatedUnion("format", [
|
|
13618
13684
|
FileAgentClaudeCodeDefinitionSchema,
|
|
13619
13685
|
FileAgentLiveDefinitionSchema,
|
|
@@ -13622,8 +13688,8 @@ var FileAgentDefinitionSchema = import_zod83.z.discriminatedUnion("format", [
|
|
|
13622
13688
|
for (const violation of findRealtimeVoiceViolations(definition)) {
|
|
13623
13689
|
ctx.addIssue(__spreadValues({ code: import_zod83.z.ZodIssueCode.custom }, violation));
|
|
13624
13690
|
}
|
|
13625
|
-
if (definition
|
|
13626
|
-
if (definition.systemPrompt !== void 0 && definition.systemPromptFile !== void 0) {
|
|
13691
|
+
if (!isFileAgentSandboxDefinition(definition)) return;
|
|
13692
|
+
if (definition.format === "claude_code" && definition.systemPrompt !== void 0 && definition.systemPromptFile !== void 0) {
|
|
13627
13693
|
ctx.addIssue({
|
|
13628
13694
|
code: import_zod83.z.ZodIssueCode.custom,
|
|
13629
13695
|
path: ["systemPromptFile"],
|
|
@@ -13752,6 +13818,11 @@ var CLAUDE_CODE_ONLY_SECTION_KEYS = new Set(
|
|
|
13752
13818
|
(key) => !(key in FileAgentLiveDefinitionSchema.shape)
|
|
13753
13819
|
)
|
|
13754
13820
|
);
|
|
13821
|
+
var CLAUDE_CODE_ONLY_KEYS_ON_PI = new Set(
|
|
13822
|
+
Object.keys(FileAgentClaudeCodeDefinitionSchema.shape).filter(
|
|
13823
|
+
(key) => !(key in FileAgentPiDefinitionSchema.shape)
|
|
13824
|
+
)
|
|
13825
|
+
);
|
|
13755
13826
|
var WECOM_FOREIGN_INBOUND_KEYS = Object.keys(SlackChannelInboundSchema.shape).filter(
|
|
13756
13827
|
(key) => !(key in ChannelInboundSchema.shape)
|
|
13757
13828
|
);
|
|
@@ -14306,8 +14377,9 @@ var ProjectBillingResponseSchema = import_zod90.z.object({
|
|
|
14306
14377
|
tokens: ProjectBillingTokenTotalsSchema,
|
|
14307
14378
|
/**
|
|
14308
14379
|
* CLI 自报成本参考值(§3:`cost_usd` 照旧落库,读面可作参考值展示且
|
|
14309
|
-
* **必须标注非平台计价**——标注即 `source`/`note`
|
|
14310
|
-
*
|
|
14380
|
+
* **必须标注非平台计价**——标注即 `source`/`note` 两字段)。只合计
|
|
14381
|
+
* `cost_source = claude_code_cli` 的轮,其它来源不计入(§7-1)。null =
|
|
14382
|
+
* 区间内没有该来源的成本上报。
|
|
14311
14383
|
*/
|
|
14312
14384
|
costUsdReference: import_zod90.z.object({
|
|
14313
14385
|
amountUsd: import_zod90.z.number().nonnegative(),
|