@blade-hq/agent-client 2610.0.3 → 2610.0.4

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.
@@ -1,4 +1,4 @@
1
- import type { ContentBlock, PendingQuestionRef, ToolBridgeContent } from "./projection";
1
+ import type { ContentBlock, PendingQuestionRef, RunTiming, ToolBridgeContent } from "./projection";
2
2
  import type { ContextProjectionData } from "./context";
3
3
  export interface TextContentPart {
4
4
  type: "text";
@@ -72,6 +72,7 @@ export interface ChatMessage {
72
72
  tool_calls?: ToolCallInfo[];
73
73
  status?: "streaming" | "completed" | "paused" | "failed" | "interrupted";
74
74
  duration_ms?: number;
75
+ chat_run?: RunTiming | null;
75
76
  timestamp?: string;
76
77
  entry_id?: string;
77
78
  /** Stable React key retained when an optimistic user message is confirmed. */
@@ -72,6 +72,8 @@ export interface TurnProjection {
72
72
  usage?: Record<string, unknown> | null;
73
73
  /** 模型请求区间(不含后续工具);未知时为 null,不用 0 冒充。 */
74
74
  duration_ms?: number | null;
75
+ /** Root chat wall time; model/tool samples remain separate. */
76
+ chat_run?: RunTiming | null;
75
77
  first_token_ms?: number | null;
76
78
  stream_duration_ms?: number | null;
77
79
  first_token_delivery_ms?: number | null;
@@ -34,12 +34,15 @@ export declare class ClientProjectionBuilder {
34
34
  private pendingMemoryRefs;
35
35
  private activeCompactions;
36
36
  private failedCompactions;
37
+ private chatRun;
38
+ private chatTurnIds;
37
39
  private seq;
38
40
  private syntheticCounter;
39
41
  private displayNameResolver;
40
42
  constructor(displayNameResolver?: (name: string) => string);
41
43
  processBatch(events: RawEvent[]): ProjectionUpdate[];
42
44
  processEvent(event: RawEvent): ProjectionUpdate[] | null;
45
+ private processTurnEvent;
43
46
  reset(): void;
44
47
  seedSequence(maxSeq: number): void;
45
48
  _seedTurns(turns: TurnProjection[]): void;
@@ -0,0 +1,6 @@
1
+ import type { RunTiming, TurnProjection } from "../../schemas/projection";
2
+ import type { RawHistoryEntry } from "./history";
3
+ export declare function readChatRun(payload: Record<string, unknown>, ended?: boolean): RunTiming | null;
4
+ /** Detached run annotations are shared by every root response in their interval.
5
+ * Ignore unreachable branch anchors; the last annotation for a run settles it. */
6
+ export declare function applyHistoryChatRuns(turns: TurnProjection[], entries: RawHistoryEntry[], aliases: Map<string, TurnProjection>): void;
@@ -229,9 +229,11 @@ export type AgentBoardProjectUnsubscribePayload = AgentBoardProjectUnsubscribePa
229
229
  export declare namespace ChatStartPayloadSchema {
230
230
  type SessionId = (string | null);
231
231
  type ChatRunId = (string | null);
232
+ type StartedAt = (string | null);
232
233
  interface ChatStartPayload {
233
234
  session_id?: SessionId;
234
235
  chat_run_id?: ChatRunId;
236
+ started_at?: StartedAt;
235
237
  [k: string]: unknown;
236
238
  }
237
239
  }
@@ -242,6 +244,8 @@ export declare namespace ChatEndPayloadSchema {
242
244
  type CancelledClientRequestIds = (string[] | null);
243
245
  type FinishReason = (string | null);
244
246
  type ChatRunId = (string | null);
247
+ type StartedAt = (string | null);
248
+ type DurationMs = (number | null);
245
249
  interface ChatEndPayload {
246
250
  session_id?: SessionId;
247
251
  status?: Status;
@@ -249,6 +253,8 @@ export declare namespace ChatEndPayloadSchema {
249
253
  result?: unknown;
250
254
  finish_reason?: FinishReason;
251
255
  chat_run_id?: ChatRunId;
256
+ started_at?: StartedAt;
257
+ duration_ms?: DurationMs;
252
258
  [k: string]: unknown;
253
259
  }
254
260
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blade-hq/agent-client",
3
- "version": "2610.0.3",
3
+ "version": "2610.0.4",
4
4
  "description": "Blade Agent 框架无关客户端:会话实时状态机、REST 通道、弹窗登录、页面协作。浏览器与 Node.js 通用。",
5
5
  "repository": {
6
6
  "type": "git",
package/public-api.md CHANGED
@@ -396,6 +396,7 @@ update: (groupId: string, payload: { name?: string; instructions?: string; }) =>
396
396
 
397
397
  ```ts
398
398
  blocks: ContentBlock[] | undefined
399
+ chat_run: RunTiming | null | undefined
399
400
  compaction: CompactionInfo | undefined
400
401
  content: MessageContent
401
402
  context: ContextProjectionData | undefined
@@ -2263,6 +2264,7 @@ archived_count: number | null | undefined
2263
2264
  archived_files: ArchivedFileInfo[] | null | undefined
2264
2265
  archived_tool_calls: ArchivedToolCallInfo[] | null | undefined
2265
2266
  blocks: ContentBlock[]
2267
+ chat_run: RunTiming | null | undefined
2266
2268
  client_render_id: string | null | undefined
2267
2269
  client_request_id: string | null | undefined
2268
2270
  compaction_id: string | null | undefined