@blade-hq/agent-client 2612.0.0-beta.26 → 2612.0.0-beta.27

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
@@ -236,7 +236,7 @@ revision 不增加,同 version 不同请求返回 409。`expected_revision`
236
236
  配置升级只追加当前规则快照或撤回说明,不改写或过滤已有模型消息,保持对话消息前缀。
237
237
  更换模型或修改 eager 工具 schema 时允许缓存失效。
238
238
 
239
- daemon/native 和回放会话不支持该接口。runtime_type、daemon_id、agent_runtime_id、父子
239
+ 回放会话不支持该接口。父子
240
240
  关系、聊天分组、template_id、primary_skill_id 等创建或绑定字段提交后返回 422,未知字段
241
241
  也返回 422。方案技能与用户已有技能同路径冲突时拒绝升级,用户文件不会被覆盖。
242
242
 
@@ -224,7 +224,7 @@ var ToolProvider = class {
224
224
 
225
225
  // src/version.ts
226
226
  var SDK_NAME = "agent-client";
227
- var SDK_VERSION = true ? "2612.0.0-beta.26" : "1.1.1";
227
+ var SDK_VERSION = true ? "2612.0.0-beta.27" : "1.1.1";
228
228
 
229
229
  // src/auth-login.ts
230
230
  function isAuthCallbackMessage(value) {
@@ -1850,10 +1850,7 @@ var ClientProjectionBuilder = class {
1850
1850
  if (!applyResponseBlockOrder(state, payload.response_blocks) && "content" in payload) {
1851
1851
  replaceTextContent(state, completedResponseText(payload.content));
1852
1852
  }
1853
- const isNativeProviderResponse = typeof payload.provider === "string" && payload.provider !== "";
1854
- if (state.toolCalls.length === 0 || isNativeProviderResponse && state.toolCalls.every(
1855
- (toolCall) => toolCall.status !== "pending" && toolCall.status !== "awaiting_answer"
1856
- )) {
1853
+ if (state.toolCalls.length === 0) {
1857
1854
  const childParent = this.answeredChildParents.get(loopId);
1858
1855
  if (childParent) {
1859
1856
  this.answeredChildParents.delete(loopId);
@@ -1920,8 +1917,7 @@ var ClientProjectionBuilder = class {
1920
1917
  this.displayNameResolver
1921
1918
  );
1922
1919
  }
1923
- const isNativeProviderResult = typeof payload.provider === "string" && payload.provider !== "";
1924
- if (!isNativeProviderResult && this.shouldFinalizeAfterToolResults(state)) {
1920
+ if (this.shouldFinalizeAfterToolResults(state)) {
1925
1921
  return this.finalize(loopId, "completed");
1926
1922
  }
1927
1923
  return this.syncPatch(state);
@@ -2360,7 +2356,6 @@ function projectHistory(entries) {
2360
2356
  const pendingChildPauses = /* @__PURE__ */ new Map();
2361
2357
  const childPauseEntries = [];
2362
2358
  const answeredToolCallIds = /* @__PURE__ */ new Set();
2363
- const nativeToolTurns = /* @__PURE__ */ new Set();
2364
2359
  const turnEntryAliases = /* @__PURE__ */ new Map();
2365
2360
  let latestRootMessage = null;
2366
2361
  let latestRootAssistant = null;
@@ -2478,40 +2473,11 @@ function projectHistory(entries) {
2478
2473
  if (refs.length) turn.refs = refs;
2479
2474
  turn.context_attachments = normalizeContextAttachments(message.context_attachments);
2480
2475
  }
2481
- const isNativeToolEntry = role === "assistant" && Array.isArray(message.tool_calls) && message.tool_calls.some(
2482
- (toolCall) => isRecord(toolCall) && typeof toolCall.provider === "string"
2483
- );
2484
- const previousTurn = turns[turns.length - 1];
2485
- if (role === "assistant" && previousTurn?.role === "assistant" && previousTurn.loop_id === loopId && nativeToolTurns.has(previousTurn)) {
2486
- nativeToolTurns.delete(previousTurn);
2487
- previousTurn.blocks.push(...turn.blocks);
2488
- previousTurn.tool_calls.push(...turn.tool_calls);
2489
- previousTurn.status = turn.status;
2490
- previousTurn.model = turn.model ?? previousTurn.model;
2491
- previousTurn.usage = turn.usage ?? previousTurn.usage;
2492
- if (turn.duration_ms) previousTurn.duration_ms = turn.duration_ms;
2493
- previousTurn.first_token_ms = turn.first_token_ms ?? previousTurn.first_token_ms;
2494
- previousTurn.stream_duration_ms = turn.stream_duration_ms ?? previousTurn.stream_duration_ms;
2495
- if (turn.has_reported_timing) {
2496
- previousTurn.started_at = turn.started_at;
2497
- previousTurn.has_reported_timing = true;
2498
- } else if (!previousTurn.has_reported_timing) {
2499
- previousTurn.started_at = previousTurn.started_at ?? turn.started_at;
2500
- }
2501
- previousTurn.id = turn.id;
2502
- previousTurn.turn_id = turn.turn_id;
2503
- if (isNativeToolEntry) nativeToolTurns.add(previousTurn);
2504
- turnEntryAliases.set(id, previousTurn);
2505
- if (loopId === "root") latestRootMessage = previousTurn;
2506
- latestAssistantByLoop.set(loopId, previousTurn);
2507
- continue;
2508
- }
2509
2476
  if (loopId === "root" && (role === "user" || role === "assistant")) {
2510
2477
  latestRootMessage = turn;
2511
2478
  }
2512
2479
  turns.push(turn);
2513
2480
  turnEntryAliases.set(id, turn);
2514
- if (isNativeToolEntry) nativeToolTurns.add(turn);
2515
2481
  if (role === "assistant") latestAssistantByLoop.set(loopId, turn);
2516
2482
  if (loopId === "root") {
2517
2483
  if (role === "assistant") latestRootAssistant = turn;
@@ -2932,7 +2898,7 @@ var HeadlessResource = class {
2932
2898
  });
2933
2899
  if (stopped.status !== "received") return { ...stopped, phase: "stop_ack", chat_run_id: runId };
2934
2900
  const ack = stopped.ack;
2935
- const confirmed = isRecord(ack) && ack.ok !== false && (!Object.hasOwn(ack, "chat_run_id") || ack.chat_run_id === runId) && typeof ack.status === "string" && ["stopping", "stopped", "idle", "done", "interrupted"].includes(ack.status);
2901
+ const confirmed = isRecord(ack) && ack.ok !== false && ack.chat_run_id === runId && typeof ack.status === "string" && ["stopping", "stopped", "idle", "done", "interrupted"].includes(ack.status);
2936
2902
  return {
2937
2903
  status: confirmed ? "confirmed" : "unconfirmed",
2938
2904
  phase: "stop_ack",
@@ -3233,7 +3199,6 @@ function waitForCleanupAck(socket, deadline, request) {
3233
3199
 
3234
3200
  // src/resources/computers.ts
3235
3201
  function computerState(computer) {
3236
- if (computer.is_primary) return "primary";
3237
3202
  if (computer.enabled) return "enabled";
3238
3203
  return computer.online ? "idle" : "offline";
3239
3204
  }
@@ -3253,9 +3218,6 @@ function computerPlatformLabel(computer) {
3253
3218
  function computerDaemonVersion(computer) {
3254
3219
  return (computer.daemon_version ?? "").trim();
3255
3220
  }
3256
- function canToggleComputer(computer) {
3257
- return !computer.is_primary;
3258
- }
3259
3221
  function sortComputers(computers) {
3260
3222
  return [...computers].sort((a, b) => {
3261
3223
  const byCreated = (a.created_at ?? "").localeCompare(b.created_at ?? "");
@@ -3349,9 +3311,6 @@ var SessionInfo = type({
3349
3311
  "is_example?": "boolean",
3350
3312
  "ports?": "unknown",
3351
3313
  "disable_tools?": "string[]",
3352
- "runtime_type?": "string | null",
3353
- "daemon_id?": "string | null",
3354
- "agent_runtime_id?": "string | null",
3355
3314
  "workspace_path?": "string | null",
3356
3315
  "ba_version?": "string | null",
3357
3316
  "sandbox_version?": "string | null",
@@ -3397,9 +3356,6 @@ function toCreateSessionPayload(request) {
3397
3356
  session_solution_asset_id: request.session_solution_asset_id ?? null,
3398
3357
  solution_snapshot_session_id: request.solution_snapshot_session_id ?? null,
3399
3358
  compaction_ratio: request.compaction_ratio ?? null,
3400
- ...request.runtime_type ? { runtime_type: request.runtime_type } : {},
3401
- ...request.daemon_id ? { daemon_id: request.daemon_id } : {},
3402
- ...request.agent_runtime_id ? { agent_runtime_id: request.agent_runtime_id } : {},
3403
3359
  ...request.chat_group_id ? { chat_group_id: request.chat_group_id } : {}
3404
3360
  };
3405
3361
  }
@@ -5750,8 +5706,6 @@ var AgentSession = class _AgentSession {
5750
5706
  }
5751
5707
  /** 最近一次还在等服务端结果的发送请求 id;排队中断的 chat:end 据此判断回滚是否过期。 */
5752
5708
  pendingChatRequestId = null;
5753
- /** 会话详情给出的运行时类型;"native" 时启用原生智能体的投影规则(见 _handleTurnEvents / _handleChatEnd)。 */
5754
- runtimeType = null;
5755
5709
  /** workflow_run_id → 触发它的 workflow:run 工具调用 id(只有 run:start 事件带工具调用 id)。 */
5756
5710
  workflowRunToolCalls = /* @__PURE__ */ new Map();
5757
5711
  /**
@@ -6568,7 +6522,6 @@ var AgentSession = class _AgentSession {
6568
6522
  Promise.resolve().then(fetchDetail).catch(() => fetchDetail()).catch(() => null)
6569
6523
  ]);
6570
6524
  if (this.disposed) return;
6571
- if (detail) this.runtimeType = detail.runtime_type ?? null;
6572
6525
  this.subscriptionReplaySource = "bootstrap_replay";
6573
6526
  try {
6574
6527
  await this.ensureJoined();
@@ -6604,7 +6557,6 @@ var AgentSession = class _AgentSession {
6604
6557
  /** 安装一份会话详情;`statusRevisionAtRequest` 是发出请求时的状态修订号。 */
6605
6558
  applySessionDetail(info, statusRevisionAtRequest) {
6606
6559
  if (this.disposed) return;
6607
- this.runtimeType = info.runtime_type ?? null;
6608
6560
  const replay = toReplaySnapshot(info.replay_state);
6609
6561
  const viewerRole = info.viewer_role ?? null;
6610
6562
  this.update((s) => ({
@@ -6751,7 +6703,6 @@ var AgentSession = class _AgentSession {
6751
6703
  const updates = this.projectionBuilder.processBatch(events);
6752
6704
  for (const update of updates) {
6753
6705
  if (update.kind === "upsert") {
6754
- if (this.isNativeBootstrapTurn(update.turn)) continue;
6755
6706
  this.applyTurn(
6756
6707
  update.turn,
6757
6708
  replayed ? this.subscriptionReplaySource ?? "bootstrap_replay" : "live"
@@ -6806,25 +6757,6 @@ var AgentSession = class _AgentSession {
6806
6757
  this.emitter.emit("chatEnd", { status });
6807
6758
  return true;
6808
6759
  }
6809
- if (this.runtimeType === "native") {
6810
- const updates = this.projectionBuilder.processBatch([
6811
- {
6812
- type: "chat:end",
6813
- payload: {
6814
- loop_name: "root",
6815
- status,
6816
- ...payload.pause_tool_data ? { pause_tool_data: payload.pause_tool_data } : {}
6817
- }
6818
- }
6819
- ]);
6820
- for (const update of updates) {
6821
- if (update.kind === "upsert") this.applyTurn(update.turn);
6822
- }
6823
- this.finishStreaming(status);
6824
- this.recentChatEndAt = Date.now();
6825
- this.emitter.emit("chatEnd", { status });
6826
- return true;
6827
- }
6828
6760
  this.completeChat(status);
6829
6761
  return true;
6830
6762
  }
@@ -7031,14 +6963,6 @@ var AgentSession = class _AgentSession {
7031
6963
  });
7032
6964
  this.applyDesiredStreamTokens();
7033
6965
  }
7034
- /**
7035
- * 原生智能体常在用户发言之前就宣告一个空的 assistant 回合(投影的起点),它的真实内容会随第一条
7036
- * 输出再发一次。消息列表在启动期间本来就显示一个「正在生成」占位,两者并存会出现两个占位,
7037
- * 所以只丢掉原生会话里这种空的流式回合。
7038
- */
7039
- isNativeBootstrapTurn(turn) {
7040
- return this.runtimeType === "native" && turn.role === "assistant" && turn.status === "streaming" && turn.blocks.length === 0 && turn.tool_calls.length === 0;
7041
- }
7042
6966
  /** 实时 workflow:* 事件叠加到对应工具调用的时间线上(见 workflow.ts 的来源规则)。 */
7043
6967
  applyWorkflowEvents(events) {
7044
6968
  for (const event of events) {
@@ -7075,7 +6999,7 @@ var AgentSession = class _AgentSession {
7075
6999
  completeChat(status) {
7076
7000
  this.finishStreaming(status);
7077
7001
  this.recentChatEndAt = Date.now();
7078
- if (this.runtimeType !== "native") void this.refreshAuthoritativeHistory();
7002
+ void this.refreshAuthoritativeHistory();
7079
7003
  this.emitter.emit("chatEnd", { status });
7080
7004
  }
7081
7005
  markTurnFresh(turnId) {
@@ -8581,7 +8505,6 @@ export {
8581
8505
  computerOS,
8582
8506
  computerPlatformLabel,
8583
8507
  computerDaemonVersion,
8584
- canToggleComputer,
8585
8508
  sortComputers,
8586
8509
  ComputersResource,
8587
8510
  ModelsResource,
@@ -8640,4 +8563,4 @@ export {
8640
8563
  createSocket,
8641
8564
  BladeClient
8642
8565
  };
8643
- //# sourceMappingURL=chunk-PK33EZM4.js.map
8566
+ //# sourceMappingURL=chunk-TQGO5CNX.js.map