@kanyun-ai-infra/agenthub 1.9.0 → 1.10.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/README.md +17 -0
- package/dist/index.cjs +1482 -1186
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +276 -2
- package/dist/index.d.ts +276 -2
- package/dist/index.js +1479 -1186
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/agenthub-sdk/SKILL.md +154 -4
package/README.md
CHANGED
|
@@ -108,6 +108,23 @@ const ready = await agenthub.sessions.wait(session.sessionId); // status === "re
|
|
|
108
108
|
> 要额外给槽位绑一个 Environment,才有资源规格定制、canary 灰度、drift 检测、
|
|
109
109
|
> 一键回滚这些能力:完整走一遍见下方「完整参考」里的发布闭环六幕示例。
|
|
110
110
|
|
|
111
|
+
### 代表用户调用(仅第一方服务)
|
|
112
|
+
|
|
113
|
+
服务到服务的场景(门户、后台任务等)可以用**第一方服务 token** 声明「代表某个用户」:
|
|
114
|
+
给客户端传 `actAs`(用户 LDAP),此后该客户端发出的**每个**请求——JSON、multipart
|
|
115
|
+
上传、SSE(首连与带 `Last-Event-ID` 的重连)——都带代表声明头。
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
const agenthub = new PilotPlatformClient({
|
|
119
|
+
token: process.env.PILOT_SERVICE_TOKEN, // 第一方服务 token(actor:delegate)
|
|
120
|
+
actAs: "zhangsan", // 代表 zhangsan 行事
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
仅第一方服务 token 可用:其他 token 带它会得到 403 `ACT_AS_NOT_ALLOWED`(服务端开关
|
|
125
|
+
未开:403 `ACT_AS_DISABLED`;值不是用户标识:400 `ACT_AS_INVALID`)。空串 / 纯空白在
|
|
126
|
+
构造时即抛。`defaultHeaders` 或单次请求的 `headers` 里写同名头不能覆盖 `actAs`。
|
|
127
|
+
|
|
111
128
|
## 核心模型
|
|
112
129
|
|
|
113
130
|
```text
|