@blade-hq/agent-client 2610.0.0 → 2610.0.1

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 CHANGED
@@ -320,7 +320,8 @@ session.on("replayMismatch", ({ expectedMessage, actualMessage, respond }) => {
320
320
 
321
321
  ```ts
322
322
  await client.sessions.listDir(id, "") // 列目录
323
- await client.sessions.uploadFiles(id, "", fileInput.files) // 上传(支持进度回调)
323
+ const upload = await client.sessions.uploadFiles(id, "", fileInput.files) // 支持进度回调
324
+ upload.results[0] // { index: 0, path: "..." },失败时为 { index: 0, error: "..." }
324
325
  await client.sessions.writeFile(id, "notes.md", "# 内容")
325
326
  await client.sessions.deleteFile(id, "notes.md")
326
327
  client.buildAuthedUrl(`/api/sessions/${id}/files/report.pdf`) // 带鉴权的下载/预览地址
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/version.ts
2
2
  var SDK_NAME = "agent-client";
3
- var SDK_VERSION = true ? "2610.0.0" : "1.1.1";
3
+ var SDK_VERSION = true ? "2610.0.1" : "1.1.1";
4
4
 
5
5
  // src/auth-login.ts
6
6
  function isAuthCallbackMessage(value) {
@@ -2514,7 +2514,7 @@ function projectHistory(entries) {
2514
2514
  ++sequence,
2515
2515
  compactionId,
2516
2516
  loopId,
2517
- data.status === "failed" ? "failed" : "completed",
2517
+ data.status === "interrupted" ? "interrupted" : data.status === "failed" ? "failed" : "completed",
2518
2518
  {
2519
2519
  ...data,
2520
2520
  content
@@ -5178,7 +5178,11 @@ var AgentSession = class _AgentSession {
5178
5178
  trigger: "manual"
5179
5179
  }
5180
5180
  }));
5181
- return this.runtime.emitWithAck("chat:compact", { session_id: this.sessionId }, 3e4).then((response) => response ?? {}).catch((error) => {
5181
+ return this.runtime.emitWithAck("chat:compact", { session_id: this.sessionId }, 3e4).then((response) => {
5182
+ const result = response ?? {};
5183
+ if (result.status !== "accepted") this.manualCompactionPending = false;
5184
+ return result;
5185
+ }).catch((error) => {
5182
5186
  this.manualCompactionPending = false;
5183
5187
  throw error;
5184
5188
  }).finally(() => {
@@ -5780,7 +5784,10 @@ var AgentSession = class _AgentSession {
5780
5784
  return this.replaceFromHistory({
5781
5785
  ...options,
5782
5786
  // 锚点在**这次操作真正开始**时采样:排队期间用户可能刚定位过,那时窗口首条才是他要的。
5783
- fromEntryId: () => this.state.turns[0]?.turn_id,
5787
+ fromEntryId: () => {
5788
+ const anchor = this.state.turns[0]?.turn_id;
5789
+ return anchor?.startsWith("local-user-") ? void 0 : anchor;
5790
+ },
5784
5791
  onError: (error) => {
5785
5792
  entryGone = isEntryGoneError(error);
5786
5793
  }
@@ -6399,12 +6406,10 @@ function resolveAuthToken(options) {
6399
6406
 
6400
6407
  // src/socket.ts
6401
6408
  function createSocket(options) {
6402
- const token = resolveAuthToken(options);
6403
6409
  return io(options.baseUrl, {
6404
6410
  path: options.path ?? "/socket.io",
6405
6411
  withCredentials: true,
6406
6412
  ...options.transports ? { transports: options.transports } : {},
6407
- query: token ? { token } : void 0,
6408
6413
  auth: typeof options.token === "function" ? (cb) => cb(buildSocketAuth(options) ?? {}) : buildSocketAuth(options) ?? {},
6409
6414
  autoConnect: false
6410
6415
  });