@cqfe/sxin-chat-core 1.0.4 → 1.0.6

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.
@@ -30,7 +30,7 @@ interface IQuote {
30
30
  */
31
31
  /** 允许的审核决策 */
32
32
  type HitlDecisionType = 'approve' | 'edit' | 'reject';
33
- /** 单个待审核的动作请求(interrupt.value.action_requests 元素) */
33
+ /** 单个待审核的动作请求(interrupt.value.action_requests 元素;新后端 tool_approval 格式经 parseHitlPayload 归一化为单元素数组) */
34
34
  interface HitlActionRequest {
35
35
  /** 工具运行时名,如 city-property_submit_repair_event */
36
36
  name: string;
@@ -327,10 +327,23 @@ interface IKwargs {
327
327
  human_input_response?: Record<string, unknown>;
328
328
  attachments?: IAttachment[];
329
329
  selection?: Record<string, unknown>;
330
+ /** 页面引用条目:用户在业务页面明确选中的条目(sxin-additional-kwargs 协议 §5.7) */
331
+ page_references?: IPageReference[];
330
332
  context?: Record<string, unknown>;
331
333
  capability?: string[];
332
334
  workflow?: Record<string, any>;
333
335
  }
336
+ /** 页面引用条目:contract + id 定位业务对象,display_text 提供可读快照(仅消歧用) */
337
+ interface IPageReference {
338
+ /** sxin-item 的业务语义编码,如 visit.record,不是 Skill 或工具名称 */
339
+ contract: string;
340
+ /** 业务系统原始 ID,保持原值 */
341
+ id: string;
342
+ /** 唯一定位或读取该条目所需的参数,键名/值格式由业务工具校验 */
343
+ params?: Record<string, unknown>;
344
+ /** 单行纯文本快照,推荐"业务类型 + 2~4 个区分性字段",不代替实时查询 */
345
+ display_text?: string;
346
+ }
334
347
  interface GenerateBodyRequest {
335
348
  templateId: string;
336
349
  outline: OutlineChapter[];
@@ -514,8 +527,8 @@ declare function isSameArgs(a: unknown, b: unknown): boolean;
514
527
  * currentArgsList[i] 为 null 表示该请求无业务表单(通用回退只读),按未修改处理
515
528
  */
516
529
  declare function buildHitlDecisions(requests: HitlActionRequest[], currentArgsList: Array<Record<string, unknown> | null>): HitlDecision[];
517
- /** 构造「拒绝」恢复决策:拒绝作用于该中断的所有 action request */
518
- declare function buildRejectDecisions(requests: HitlActionRequest[]): HitlDecision[];
530
+ /** 构造「拒绝」恢复决策:拒绝作用于该中断的所有 action request;message 为可选拒绝原因(新后端 response_schema 已支持) */
531
+ declare function buildRejectDecisions(requests: HitlActionRequest[], message?: string): HitlDecision[];
519
532
  /** 由 interrupt 合成审核 Block;负载非法时返回 null(调用方不渲染) */
520
533
  declare function buildInterruptReviewBlock(interrupt: Interrupt, responded: boolean): InterruptReviewBlock | null;
521
534
 
@@ -1079,6 +1092,8 @@ interface ChatCore {
1079
1092
  isGenerating: Ref<boolean>;
1080
1093
  isLoadingThread: Ref<boolean>;
1081
1094
  currentThreadId: Ref<string | null>;
1095
+ /** 当前活跃会话 runtime(调试/高级用法入口;内部成员为 ComputedRef,取值需 .value;无活跃会话时为 undefined) */
1096
+ activeRuntime: ComputedRef<ThreadRuntime | undefined>;
1082
1097
  threads: Ref<Thread<AgentThreadState>[]>;
1083
1098
  threadsPagination: Ref<ThreadsPagination>;
1084
1099
  runsInfo: Ref<Map<string, RunInfo>>;
@@ -1135,4 +1150,4 @@ interface ChatCore {
1135
1150
  }
1136
1151
  declare function createChatCore(options: ChatCoreOptions): ChatCore;
1137
1152
 
1138
- export { type InterruptReviewBlock as $, type AsmRow as A, type Block as B, type CitationItem as C, type FormBlock as D, type ExtractedPayload as E, type FetchMessagesPageOptions as F, type GroupMessageTool as G, type HitlResponse as H, type IKwargs as I, type FormFieldItem as J, type FormFieldType as K, type GenerateBodyRequest as L, type MessageTokenUsage as M, type GenerateBodyResult as N, type OutlineSubChapter as O, type ProjectRunsInput as P, type HitlActionRequest as Q, type RunInfo as R, type StreamSubmitInput as S, type ThreadInitialValues as T, type HitlDecision as U, type HitlDecisionType as V, type HitlInterruptPayload as W, type HitlReviewConfig as X, type IAttachment as Y, type IQuote as Z, type InlineCitation as _, type RunMessage as a, type ItemSegment as a0, type ListBlock as a1, type ListItem as a2, type Message as a3, type MessageMetadata as a4, type MessageRole as a5, type MessageSource as a6, type MessageStatus as a7, type PendingRun as a8, type ReportAttachment as a9, normalizeForCompare as aA, parseHitlPayload as aB, pickRunMessageMetadata as aC, sliceBodySegments as aD, type ReportGenerateBodyHumanKwargs as aa, type ReportSelectedArtifact as ab, type ReportSelectedTemplate as ac, type RunInputKind as ad, type RunMeta as ae, type RunTokens as af, type SearchThreadsOptions as ag, type SendMessageOptions as ah, type TextBlock as ai, ThreadDirectory as aj, type ThreadDirectoryOptions as ak, type ThreadRuntime as al, type ThreadRuntimeOptions as am, type ThreadsPagination as an, type ToolRun as ao, type XmlAttrs as ap, buildHitlDecisions as aq, buildInterruptReviewBlock as ar, buildRejectDecisions as as, buildRunDirectLatencyMs as at, buildRunInfo as au, buildRunMeta as av, createChatCore as aw, createThreadRuntime as ax, getAllowedDecisions as ay, isSameArgs as az, type ReportBodyPayload as b, type ReportOutlinePayload as c, type BlockBuilderOptions as d, type OutlineChapter as e, type RunItem as f, type RunStatus as g, type ChatTransport as h, type MessagesPage as i, type ThreadTokenUsage as j, type StreamSubmitOptions as k, type CreateStreamOptions as l, type AcquireResult as m, type AgentThreadState as n, type ArtifactFile as o, type Attachment as p, type BlockBase as q, type BlockSource as r, type BlockStatus as s, type BodySegment as t, type ChatCore as u, type ChatCoreOptions as v, type ChatNotify as w, type ChatStreamHandle as x, type ClarificationRecord as y, type CustomBlock as z };
1153
+ export { type InlineCitation as $, type AsmRow as A, type Block as B, type CitationItem as C, type FormBlock as D, type ExtractedPayload as E, type FetchMessagesPageOptions as F, type GroupMessageTool as G, type HitlResponse as H, type IKwargs as I, type FormFieldItem as J, type FormFieldType as K, type GenerateBodyRequest as L, type MessageTokenUsage as M, type GenerateBodyResult as N, type OutlineSubChapter as O, type ProjectRunsInput as P, type HitlActionRequest as Q, type RunInfo as R, type StreamSubmitInput as S, type ThreadInitialValues as T, type HitlDecision as U, type HitlDecisionType as V, type HitlInterruptPayload as W, type HitlReviewConfig as X, type IAttachment as Y, type IPageReference as Z, type IQuote as _, type RunMessage as a, type InterruptReviewBlock as a0, type ItemSegment as a1, type ListBlock as a2, type ListItem as a3, type Message as a4, type MessageMetadata as a5, type MessageRole as a6, type MessageSource as a7, type MessageStatus as a8, type PendingRun as a9, isSameArgs as aA, normalizeForCompare as aB, parseHitlPayload as aC, pickRunMessageMetadata as aD, sliceBodySegments as aE, type ReportAttachment as aa, type ReportGenerateBodyHumanKwargs as ab, type ReportSelectedArtifact as ac, type ReportSelectedTemplate as ad, type RunInputKind as ae, type RunMeta as af, type RunTokens as ag, type SearchThreadsOptions as ah, type SendMessageOptions as ai, type TextBlock as aj, ThreadDirectory as ak, type ThreadDirectoryOptions as al, type ThreadRuntime as am, type ThreadRuntimeOptions as an, type ThreadsPagination as ao, type ToolRun as ap, type XmlAttrs as aq, buildHitlDecisions as ar, buildInterruptReviewBlock as as, buildRejectDecisions as at, buildRunDirectLatencyMs as au, buildRunInfo as av, buildRunMeta as aw, createChatCore as ax, createThreadRuntime as ay, getAllowedDecisions as az, type ReportBodyPayload as b, type ReportOutlinePayload as c, type BlockBuilderOptions as d, type OutlineChapter as e, type RunItem as f, type RunStatus as g, type ChatTransport as h, type MessagesPage as i, type ThreadTokenUsage as j, type StreamSubmitOptions as k, type CreateStreamOptions as l, type AcquireResult as m, type AgentThreadState as n, type ArtifactFile as o, type Attachment as p, type BlockBase as q, type BlockSource as r, type BlockStatus as s, type BodySegment as t, type ChatCore as u, type ChatCoreOptions as v, type ChatNotify as w, type ChatStreamHandle as x, type ClarificationRecord as y, type CustomBlock as z };
@@ -30,7 +30,7 @@ interface IQuote {
30
30
  */
31
31
  /** 允许的审核决策 */
32
32
  type HitlDecisionType = 'approve' | 'edit' | 'reject';
33
- /** 单个待审核的动作请求(interrupt.value.action_requests 元素) */
33
+ /** 单个待审核的动作请求(interrupt.value.action_requests 元素;新后端 tool_approval 格式经 parseHitlPayload 归一化为单元素数组) */
34
34
  interface HitlActionRequest {
35
35
  /** 工具运行时名,如 city-property_submit_repair_event */
36
36
  name: string;
@@ -327,10 +327,23 @@ interface IKwargs {
327
327
  human_input_response?: Record<string, unknown>;
328
328
  attachments?: IAttachment[];
329
329
  selection?: Record<string, unknown>;
330
+ /** 页面引用条目:用户在业务页面明确选中的条目(sxin-additional-kwargs 协议 §5.7) */
331
+ page_references?: IPageReference[];
330
332
  context?: Record<string, unknown>;
331
333
  capability?: string[];
332
334
  workflow?: Record<string, any>;
333
335
  }
336
+ /** 页面引用条目:contract + id 定位业务对象,display_text 提供可读快照(仅消歧用) */
337
+ interface IPageReference {
338
+ /** sxin-item 的业务语义编码,如 visit.record,不是 Skill 或工具名称 */
339
+ contract: string;
340
+ /** 业务系统原始 ID,保持原值 */
341
+ id: string;
342
+ /** 唯一定位或读取该条目所需的参数,键名/值格式由业务工具校验 */
343
+ params?: Record<string, unknown>;
344
+ /** 单行纯文本快照,推荐"业务类型 + 2~4 个区分性字段",不代替实时查询 */
345
+ display_text?: string;
346
+ }
334
347
  interface GenerateBodyRequest {
335
348
  templateId: string;
336
349
  outline: OutlineChapter[];
@@ -514,8 +527,8 @@ declare function isSameArgs(a: unknown, b: unknown): boolean;
514
527
  * currentArgsList[i] 为 null 表示该请求无业务表单(通用回退只读),按未修改处理
515
528
  */
516
529
  declare function buildHitlDecisions(requests: HitlActionRequest[], currentArgsList: Array<Record<string, unknown> | null>): HitlDecision[];
517
- /** 构造「拒绝」恢复决策:拒绝作用于该中断的所有 action request */
518
- declare function buildRejectDecisions(requests: HitlActionRequest[]): HitlDecision[];
530
+ /** 构造「拒绝」恢复决策:拒绝作用于该中断的所有 action request;message 为可选拒绝原因(新后端 response_schema 已支持) */
531
+ declare function buildRejectDecisions(requests: HitlActionRequest[], message?: string): HitlDecision[];
519
532
  /** 由 interrupt 合成审核 Block;负载非法时返回 null(调用方不渲染) */
520
533
  declare function buildInterruptReviewBlock(interrupt: Interrupt, responded: boolean): InterruptReviewBlock | null;
521
534
 
@@ -1079,6 +1092,8 @@ interface ChatCore {
1079
1092
  isGenerating: Ref<boolean>;
1080
1093
  isLoadingThread: Ref<boolean>;
1081
1094
  currentThreadId: Ref<string | null>;
1095
+ /** 当前活跃会话 runtime(调试/高级用法入口;内部成员为 ComputedRef,取值需 .value;无活跃会话时为 undefined) */
1096
+ activeRuntime: ComputedRef<ThreadRuntime | undefined>;
1082
1097
  threads: Ref<Thread<AgentThreadState>[]>;
1083
1098
  threadsPagination: Ref<ThreadsPagination>;
1084
1099
  runsInfo: Ref<Map<string, RunInfo>>;
@@ -1135,4 +1150,4 @@ interface ChatCore {
1135
1150
  }
1136
1151
  declare function createChatCore(options: ChatCoreOptions): ChatCore;
1137
1152
 
1138
- export { type InterruptReviewBlock as $, type AsmRow as A, type Block as B, type CitationItem as C, type FormBlock as D, type ExtractedPayload as E, type FetchMessagesPageOptions as F, type GroupMessageTool as G, type HitlResponse as H, type IKwargs as I, type FormFieldItem as J, type FormFieldType as K, type GenerateBodyRequest as L, type MessageTokenUsage as M, type GenerateBodyResult as N, type OutlineSubChapter as O, type ProjectRunsInput as P, type HitlActionRequest as Q, type RunInfo as R, type StreamSubmitInput as S, type ThreadInitialValues as T, type HitlDecision as U, type HitlDecisionType as V, type HitlInterruptPayload as W, type HitlReviewConfig as X, type IAttachment as Y, type IQuote as Z, type InlineCitation as _, type RunMessage as a, type ItemSegment as a0, type ListBlock as a1, type ListItem as a2, type Message as a3, type MessageMetadata as a4, type MessageRole as a5, type MessageSource as a6, type MessageStatus as a7, type PendingRun as a8, type ReportAttachment as a9, normalizeForCompare as aA, parseHitlPayload as aB, pickRunMessageMetadata as aC, sliceBodySegments as aD, type ReportGenerateBodyHumanKwargs as aa, type ReportSelectedArtifact as ab, type ReportSelectedTemplate as ac, type RunInputKind as ad, type RunMeta as ae, type RunTokens as af, type SearchThreadsOptions as ag, type SendMessageOptions as ah, type TextBlock as ai, ThreadDirectory as aj, type ThreadDirectoryOptions as ak, type ThreadRuntime as al, type ThreadRuntimeOptions as am, type ThreadsPagination as an, type ToolRun as ao, type XmlAttrs as ap, buildHitlDecisions as aq, buildInterruptReviewBlock as ar, buildRejectDecisions as as, buildRunDirectLatencyMs as at, buildRunInfo as au, buildRunMeta as av, createChatCore as aw, createThreadRuntime as ax, getAllowedDecisions as ay, isSameArgs as az, type ReportBodyPayload as b, type ReportOutlinePayload as c, type BlockBuilderOptions as d, type OutlineChapter as e, type RunItem as f, type RunStatus as g, type ChatTransport as h, type MessagesPage as i, type ThreadTokenUsage as j, type StreamSubmitOptions as k, type CreateStreamOptions as l, type AcquireResult as m, type AgentThreadState as n, type ArtifactFile as o, type Attachment as p, type BlockBase as q, type BlockSource as r, type BlockStatus as s, type BodySegment as t, type ChatCore as u, type ChatCoreOptions as v, type ChatNotify as w, type ChatStreamHandle as x, type ClarificationRecord as y, type CustomBlock as z };
1153
+ export { type InlineCitation as $, type AsmRow as A, type Block as B, type CitationItem as C, type FormBlock as D, type ExtractedPayload as E, type FetchMessagesPageOptions as F, type GroupMessageTool as G, type HitlResponse as H, type IKwargs as I, type FormFieldItem as J, type FormFieldType as K, type GenerateBodyRequest as L, type MessageTokenUsage as M, type GenerateBodyResult as N, type OutlineSubChapter as O, type ProjectRunsInput as P, type HitlActionRequest as Q, type RunInfo as R, type StreamSubmitInput as S, type ThreadInitialValues as T, type HitlDecision as U, type HitlDecisionType as V, type HitlInterruptPayload as W, type HitlReviewConfig as X, type IAttachment as Y, type IPageReference as Z, type IQuote as _, type RunMessage as a, type InterruptReviewBlock as a0, type ItemSegment as a1, type ListBlock as a2, type ListItem as a3, type Message as a4, type MessageMetadata as a5, type MessageRole as a6, type MessageSource as a7, type MessageStatus as a8, type PendingRun as a9, isSameArgs as aA, normalizeForCompare as aB, parseHitlPayload as aC, pickRunMessageMetadata as aD, sliceBodySegments as aE, type ReportAttachment as aa, type ReportGenerateBodyHumanKwargs as ab, type ReportSelectedArtifact as ac, type ReportSelectedTemplate as ad, type RunInputKind as ae, type RunMeta as af, type RunTokens as ag, type SearchThreadsOptions as ah, type SendMessageOptions as ai, type TextBlock as aj, ThreadDirectory as ak, type ThreadDirectoryOptions as al, type ThreadRuntime as am, type ThreadRuntimeOptions as an, type ThreadsPagination as ao, type ToolRun as ap, type XmlAttrs as aq, buildHitlDecisions as ar, buildInterruptReviewBlock as as, buildRejectDecisions as at, buildRunDirectLatencyMs as au, buildRunInfo as av, buildRunMeta as aw, createChatCore as ax, createThreadRuntime as ay, getAllowedDecisions as az, type ReportBodyPayload as b, type ReportOutlinePayload as c, type BlockBuilderOptions as d, type OutlineChapter as e, type RunItem as f, type RunStatus as g, type ChatTransport as h, type MessagesPage as i, type ThreadTokenUsage as j, type StreamSubmitOptions as k, type CreateStreamOptions as l, type AcquireResult as m, type AgentThreadState as n, type ArtifactFile as o, type Attachment as p, type BlockBase as q, type BlockSource as r, type BlockStatus as s, type BodySegment as t, type ChatCore as u, type ChatCoreOptions as v, type ChatNotify as w, type ChatStreamHandle as x, type ClarificationRecord as y, type CustomBlock as z };
@@ -331,6 +331,19 @@ import { isEqual } from "lodash";
331
331
  function parseHitlPayload(value) {
332
332
  if (!value || typeof value !== "object") return null;
333
333
  const raw = value;
334
+ if (raw.type === "tool_approval" && typeof raw.name === "string" && raw.args && typeof raw.args === "object") {
335
+ const allowed = extractAllowedDecisionsFromSchema(raw.response_schema);
336
+ return {
337
+ actionRequests: [
338
+ {
339
+ name: raw.name,
340
+ args: raw.args,
341
+ description: typeof raw.description === "string" ? raw.description : void 0
342
+ }
343
+ ],
344
+ reviewConfigs: allowed ? [{ action_name: raw.name, allowedDecisions: allowed }] : []
345
+ };
346
+ }
334
347
  const requests = raw.actionRequests ?? raw.action_requests;
335
348
  if (!Array.isArray(requests) || !requests.length) return null;
336
349
  const configs = raw.reviewConfigs ?? raw.review_configs;
@@ -339,6 +352,17 @@ function parseHitlPayload(value) {
339
352
  reviewConfigs: Array.isArray(configs) ? configs : []
340
353
  };
341
354
  }
355
+ function extractAllowedDecisionsFromSchema(responseSchema) {
356
+ const oneOf = responseSchema?.oneOf;
357
+ if (!Array.isArray(oneOf)) return null;
358
+ const allowed = /* @__PURE__ */ new Set();
359
+ for (const variant of oneOf) {
360
+ const typeConst = variant?.properties;
361
+ const v = typeConst?.type;
362
+ if (v?.const === "approve" || v?.const === "edit" || v?.const === "reject") allowed.add(v.const);
363
+ }
364
+ return allowed.size ? [...allowed] : null;
365
+ }
342
366
  function getAllowedDecisions(configs, actionName) {
343
367
  const cfg = configs.find((c) => c.action_name === actionName);
344
368
  const list = cfg?.allowedDecisions ?? cfg?.allowed_decisions;
@@ -364,8 +388,8 @@ function buildHitlDecisions(requests, currentArgsList) {
364
388
  return { type: "edit", edited_action: { name: req.name, args: current } };
365
389
  });
366
390
  }
367
- function buildRejectDecisions(requests) {
368
- return requests.map(() => ({ type: "reject" }));
391
+ function buildRejectDecisions(requests, message) {
392
+ return requests.map(() => message ? { type: "reject", message } : { type: "reject" });
369
393
  }
370
394
  function buildInterruptReviewBlock(interrupt, responded) {
371
395
  const payload = parseHitlPayload(interrupt.value);
@@ -1883,6 +1907,61 @@ function extractLiveIncrement(snapshot, lastSeenIds) {
1883
1907
  return fresh;
1884
1908
  }
1885
1909
 
1910
+ // src/assembler/stable-project-runs.ts
1911
+ var refSeq = 0;
1912
+ var refIds = /* @__PURE__ */ new WeakMap();
1913
+ function refId(value) {
1914
+ if (value === null || value === void 0) return "-";
1915
+ if (typeof value === "object") {
1916
+ let id = refIds.get(value);
1917
+ if (id === void 0) {
1918
+ id = ++refSeq;
1919
+ refIds.set(value, id);
1920
+ }
1921
+ return String(id);
1922
+ }
1923
+ return String(value);
1924
+ }
1925
+ function runFingerprint(run) {
1926
+ let fp = `${run.status}|${run.input.kind}|${run.input.text}`;
1927
+ if (run.createdAt !== void 0) fp += `|c${run.createdAt}`;
1928
+ if (run.tokens !== void 0) fp += `|t${JSON.stringify(run.tokens)}`;
1929
+ const stopReason = run.stopReason;
1930
+ if (stopReason !== void 0) fp += `|s${String(stopReason)}`;
1931
+ for (const row of run.rawMessages) {
1932
+ fp += `|${row.seq}:${refId(row.msg)}:${refId(row.feedback ?? null)}`;
1933
+ }
1934
+ return fp;
1935
+ }
1936
+ function globalSignal(input, next) {
1937
+ const runIds = next.map((r) => r.runId).join(",");
1938
+ const runsListRef = input.runsList.length ? refId(input.runsList) : "empty";
1939
+ const answersRef = input.answers && input.answers.size ? refId(input.answers) : "empty";
1940
+ return `${runIds}#${runsListRef}#${answersRef}`;
1941
+ }
1942
+ function createStableRunsProjector() {
1943
+ let cache = /* @__PURE__ */ new Map();
1944
+ let lastGlobal = "";
1945
+ return function projectRunsStable(input) {
1946
+ const next = projectRuns(input);
1947
+ const signal = globalSignal(input, next);
1948
+ if (signal !== lastGlobal) {
1949
+ lastGlobal = signal;
1950
+ cache = /* @__PURE__ */ new Map();
1951
+ }
1952
+ const activeId = input.streaming ? input.activeRunId : null;
1953
+ const pendingId = input.pendingRun?.runId ?? null;
1954
+ return next.map((run) => {
1955
+ if (run.runId === activeId || run.runId === pendingId) return run;
1956
+ const fingerprint = runFingerprint(run);
1957
+ const hit = cache.get(run.runId);
1958
+ if (hit && hit.fingerprint === fingerprint) return hit.item;
1959
+ cache.set(run.runId, { fingerprint, item: run });
1960
+ return run;
1961
+ });
1962
+ };
1963
+ }
1964
+
1886
1965
  // src/runtime/values-projection.ts
1887
1966
  function createValuesChannel(options = {}) {
1888
1967
  let latestStreamMessages = [];
@@ -2045,8 +2124,9 @@ function createThreadRuntime(options) {
2045
2124
  const pendingRun = shallowRef3(null);
2046
2125
  const answers = shallowRef3(/* @__PURE__ */ new Map());
2047
2126
  const activeRunId = computed2(() => runs.currentRunId.value);
2127
+ const projectRunsStable = createStableRunsProjector();
2048
2128
  const runsProjection = computed2(
2049
- () => projectRuns({
2129
+ () => projectRunsStable({
2050
2130
  rows: rowsStore.rows.value,
2051
2131
  liveMessages: liveMessages.value,
2052
2132
  activeRunId: activeRunId.value,
@@ -2569,6 +2649,7 @@ function createChatCore(options) {
2569
2649
  isGenerating,
2570
2650
  isLoadingThread,
2571
2651
  currentThreadId,
2652
+ activeRuntime,
2572
2653
  threads,
2573
2654
  threadsPagination,
2574
2655
  runsInfo,
package/dist/index.cjs CHANGED
@@ -496,7 +496,7 @@ var normalizeOne = (raw) => {
496
496
  for (const [field, keys] of Object.entries(STRING_FIELD_KEYS)) {
497
497
  str[field] = pickString(raw, meta, keys);
498
498
  }
499
- const { refId, globalRef, minioBucket, minioObject, previewUrl, docUrl, docId, title, fileType } = str;
499
+ const { refId: refId2, globalRef, minioBucket, minioObject, previewUrl, docUrl, docId, title, fileType } = str;
500
500
  const arr = {};
501
501
  for (const [field, keys] of Object.entries(ARRAY_FIELD_KEYS)) {
502
502
  arr[field] = pickStringArray(raw, meta, keys);
@@ -508,7 +508,7 @@ var normalizeOne = (raw) => {
508
508
  if (!key && !previewUrl && !docUrl) return null;
509
509
  return {
510
510
  key,
511
- refId: orUndefined(refId),
511
+ refId: orUndefined(refId2),
512
512
  globalRef: orUndefined(globalRef),
513
513
  title,
514
514
  docId,
@@ -550,10 +550,10 @@ function extractCitationAnchorsFromSpec(spec) {
550
550
  }
551
551
  }
552
552
  for (const item of candidates) {
553
- const refId = pickFirstString(item, REF_ID_KEYS);
554
- if (!refId || seen.has(refId)) continue;
555
- seen.add(refId);
556
- const anchor = { refId, title: "" };
553
+ const refId2 = pickFirstString(item, REF_ID_KEYS);
554
+ if (!refId2 || seen.has(refId2)) continue;
555
+ seen.add(refId2);
556
+ const anchor = { refId: refId2, title: "" };
557
557
  const searchText = pickFirstString(item, SEARCH_TEXT_KEYS);
558
558
  if (searchText) anchor.searchText = searchText;
559
559
  anchors.push(anchor);
@@ -604,6 +604,19 @@ function genBlockId() {
604
604
  function parseHitlPayload(value) {
605
605
  if (!value || typeof value !== "object") return null;
606
606
  const raw = value;
607
+ if (raw.type === "tool_approval" && typeof raw.name === "string" && raw.args && typeof raw.args === "object") {
608
+ const allowed = extractAllowedDecisionsFromSchema(raw.response_schema);
609
+ return {
610
+ actionRequests: [
611
+ {
612
+ name: raw.name,
613
+ args: raw.args,
614
+ description: typeof raw.description === "string" ? raw.description : void 0
615
+ }
616
+ ],
617
+ reviewConfigs: allowed ? [{ action_name: raw.name, allowedDecisions: allowed }] : []
618
+ };
619
+ }
607
620
  const requests = raw.actionRequests ?? raw.action_requests;
608
621
  if (!Array.isArray(requests) || !requests.length) return null;
609
622
  const configs = raw.reviewConfigs ?? raw.review_configs;
@@ -612,6 +625,17 @@ function parseHitlPayload(value) {
612
625
  reviewConfigs: Array.isArray(configs) ? configs : []
613
626
  };
614
627
  }
628
+ function extractAllowedDecisionsFromSchema(responseSchema) {
629
+ const oneOf = responseSchema?.oneOf;
630
+ if (!Array.isArray(oneOf)) return null;
631
+ const allowed = /* @__PURE__ */ new Set();
632
+ for (const variant of oneOf) {
633
+ const typeConst = variant?.properties;
634
+ const v = typeConst?.type;
635
+ if (v?.const === "approve" || v?.const === "edit" || v?.const === "reject") allowed.add(v.const);
636
+ }
637
+ return allowed.size ? [...allowed] : null;
638
+ }
615
639
  function getAllowedDecisions(configs, actionName) {
616
640
  const cfg = configs.find((c) => c.action_name === actionName);
617
641
  const list = cfg?.allowedDecisions ?? cfg?.allowed_decisions;
@@ -637,8 +661,8 @@ function buildHitlDecisions(requests, currentArgsList) {
637
661
  return { type: "edit", edited_action: { name: req.name, args: current } };
638
662
  });
639
663
  }
640
- function buildRejectDecisions(requests) {
641
- return requests.map(() => ({ type: "reject" }));
664
+ function buildRejectDecisions(requests, message) {
665
+ return requests.map(() => message ? { type: "reject", message } : { type: "reject" });
642
666
  }
643
667
  function buildInterruptReviewBlock(interrupt, responded) {
644
668
  const payload = parseHitlPayload(interrupt.value);
@@ -2305,6 +2329,61 @@ function extractLiveIncrement(snapshot, lastSeenIds) {
2305
2329
  return fresh;
2306
2330
  }
2307
2331
 
2332
+ // src/assembler/stable-project-runs.ts
2333
+ var refSeq = 0;
2334
+ var refIds = /* @__PURE__ */ new WeakMap();
2335
+ function refId(value) {
2336
+ if (value === null || value === void 0) return "-";
2337
+ if (typeof value === "object") {
2338
+ let id = refIds.get(value);
2339
+ if (id === void 0) {
2340
+ id = ++refSeq;
2341
+ refIds.set(value, id);
2342
+ }
2343
+ return String(id);
2344
+ }
2345
+ return String(value);
2346
+ }
2347
+ function runFingerprint(run) {
2348
+ let fp = `${run.status}|${run.input.kind}|${run.input.text}`;
2349
+ if (run.createdAt !== void 0) fp += `|c${run.createdAt}`;
2350
+ if (run.tokens !== void 0) fp += `|t${JSON.stringify(run.tokens)}`;
2351
+ const stopReason = run.stopReason;
2352
+ if (stopReason !== void 0) fp += `|s${String(stopReason)}`;
2353
+ for (const row of run.rawMessages) {
2354
+ fp += `|${row.seq}:${refId(row.msg)}:${refId(row.feedback ?? null)}`;
2355
+ }
2356
+ return fp;
2357
+ }
2358
+ function globalSignal(input, next) {
2359
+ const runIds = next.map((r) => r.runId).join(",");
2360
+ const runsListRef = input.runsList.length ? refId(input.runsList) : "empty";
2361
+ const answersRef = input.answers && input.answers.size ? refId(input.answers) : "empty";
2362
+ return `${runIds}#${runsListRef}#${answersRef}`;
2363
+ }
2364
+ function createStableRunsProjector() {
2365
+ let cache = /* @__PURE__ */ new Map();
2366
+ let lastGlobal = "";
2367
+ return function projectRunsStable(input) {
2368
+ const next = projectRuns(input);
2369
+ const signal = globalSignal(input, next);
2370
+ if (signal !== lastGlobal) {
2371
+ lastGlobal = signal;
2372
+ cache = /* @__PURE__ */ new Map();
2373
+ }
2374
+ const activeId = input.streaming ? input.activeRunId : null;
2375
+ const pendingId = input.pendingRun?.runId ?? null;
2376
+ return next.map((run) => {
2377
+ if (run.runId === activeId || run.runId === pendingId) return run;
2378
+ const fingerprint = runFingerprint(run);
2379
+ const hit = cache.get(run.runId);
2380
+ if (hit && hit.fingerprint === fingerprint) return hit.item;
2381
+ cache.set(run.runId, { fingerprint, item: run });
2382
+ return run;
2383
+ });
2384
+ };
2385
+ }
2386
+
2308
2387
  // src/runtime/values-projection.ts
2309
2388
  function createValuesChannel(options = {}) {
2310
2389
  let latestStreamMessages = [];
@@ -2467,8 +2546,9 @@ function createThreadRuntime(options) {
2467
2546
  const pendingRun = (0, import_vue4.shallowRef)(null);
2468
2547
  const answers = (0, import_vue4.shallowRef)(/* @__PURE__ */ new Map());
2469
2548
  const activeRunId = (0, import_vue4.computed)(() => runs.currentRunId.value);
2549
+ const projectRunsStable = createStableRunsProjector();
2470
2550
  const runsProjection = (0, import_vue4.computed)(
2471
- () => projectRuns({
2551
+ () => projectRunsStable({
2472
2552
  rows: rowsStore.rows.value,
2473
2553
  liveMessages: liveMessages.value,
2474
2554
  activeRunId: activeRunId.value,
@@ -2991,6 +3071,7 @@ function createChatCore(options) {
2991
3071
  isGenerating,
2992
3072
  isLoadingThread,
2993
3073
  currentThreadId,
3074
+ activeRuntime,
2994
3075
  threads,
2995
3076
  threadsPagination,
2996
3077
  runsInfo,
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as Block, C as CitationItem, I as IKwargs, R as RunInfo, a as RunMessage, b as ReportBodyPayload, c as ReportOutlinePayload, d as BlockBuilderOptions, G as GroupMessageTool, M as MessageTokenUsage, O as OutlineSubChapter, e as OutlineChapter, P as ProjectRunsInput, f as RunItem, A as AsmRow, g as RunStatus, E as ExtractedPayload, h as ChatTransport, T as ThreadInitialValues, i as MessagesPage, j as ThreadTokenUsage, S as StreamSubmitInput, k as StreamSubmitOptions, H as HitlResponse, l as CreateStreamOptions } from './ChatCore-CCeoxjP9.cjs';
2
- export { m as AcquireResult, n as AgentThreadState, o as ArtifactFile, p as Attachment, q as BlockBase, r as BlockSource, s as BlockStatus, t as BodySegment, u as ChatCore, v as ChatCoreOptions, w as ChatNotify, x as ChatStreamHandle, y as ClarificationRecord, z as CustomBlock, F as FetchMessagesPageOptions, D as FormBlock, J as FormFieldItem, K as FormFieldType, L as GenerateBodyRequest, N as GenerateBodyResult, Q as HitlActionRequest, U as HitlDecision, V as HitlDecisionType, W as HitlInterruptPayload, X as HitlReviewConfig, Y as IAttachment, Z as IQuote, _ as InlineCitation, $ as InterruptReviewBlock, a0 as ItemSegment, a1 as ListBlock, a2 as ListItem, a3 as Message, a4 as MessageMetadata, a5 as MessageRole, a6 as MessageSource, a7 as MessageStatus, a8 as PendingRun, a9 as ReportAttachment, aa as ReportGenerateBodyHumanKwargs, ab as ReportSelectedArtifact, ac as ReportSelectedTemplate, ad as RunInputKind, ae as RunMeta, af as RunTokens, ag as SearchThreadsOptions, ah as SendMessageOptions, ai as TextBlock, aj as ThreadDirectory, ak as ThreadDirectoryOptions, al as ThreadRuntime, am as ThreadRuntimeOptions, an as ThreadsPagination, ao as ToolRun, ap as XmlAttrs, aq as buildHitlDecisions, ar as buildInterruptReviewBlock, as as buildRejectDecisions, at as buildRunDirectLatencyMs, au as buildRunInfo, av as buildRunMeta, aw as createChatCore, ax as createThreadRuntime, ay as getAllowedDecisions, az as isSameArgs, aA as normalizeForCompare, aB as parseHitlPayload, aC as pickRunMessageMetadata, aD as sliceBodySegments } from './ChatCore-CCeoxjP9.cjs';
1
+ import { B as Block, C as CitationItem, I as IKwargs, R as RunInfo, a as RunMessage, b as ReportBodyPayload, c as ReportOutlinePayload, d as BlockBuilderOptions, G as GroupMessageTool, M as MessageTokenUsage, O as OutlineSubChapter, e as OutlineChapter, P as ProjectRunsInput, f as RunItem, A as AsmRow, g as RunStatus, E as ExtractedPayload, h as ChatTransport, T as ThreadInitialValues, i as MessagesPage, j as ThreadTokenUsage, S as StreamSubmitInput, k as StreamSubmitOptions, H as HitlResponse, l as CreateStreamOptions } from './ChatCore-BVPcUZE4.cjs';
2
+ export { m as AcquireResult, n as AgentThreadState, o as ArtifactFile, p as Attachment, q as BlockBase, r as BlockSource, s as BlockStatus, t as BodySegment, u as ChatCore, v as ChatCoreOptions, w as ChatNotify, x as ChatStreamHandle, y as ClarificationRecord, z as CustomBlock, F as FetchMessagesPageOptions, D as FormBlock, J as FormFieldItem, K as FormFieldType, L as GenerateBodyRequest, N as GenerateBodyResult, Q as HitlActionRequest, U as HitlDecision, V as HitlDecisionType, W as HitlInterruptPayload, X as HitlReviewConfig, Y as IAttachment, Z as IPageReference, _ as IQuote, $ as InlineCitation, a0 as InterruptReviewBlock, a1 as ItemSegment, a2 as ListBlock, a3 as ListItem, a4 as Message, a5 as MessageMetadata, a6 as MessageRole, a7 as MessageSource, a8 as MessageStatus, a9 as PendingRun, aa as ReportAttachment, ab as ReportGenerateBodyHumanKwargs, ac as ReportSelectedArtifact, ad as ReportSelectedTemplate, ae as RunInputKind, af as RunMeta, ag as RunTokens, ah as SearchThreadsOptions, ai as SendMessageOptions, aj as TextBlock, ak as ThreadDirectory, al as ThreadDirectoryOptions, am as ThreadRuntime, an as ThreadRuntimeOptions, ao as ThreadsPagination, ap as ToolRun, aq as XmlAttrs, ar as buildHitlDecisions, as as buildInterruptReviewBlock, at as buildRejectDecisions, au as buildRunDirectLatencyMs, av as buildRunInfo, aw as buildRunMeta, ax as createChatCore, ay as createThreadRuntime, az as getAllowedDecisions, aA as isSameArgs, aB as normalizeForCompare, aC as parseHitlPayload, aD as pickRunMessageMetadata, aE as sliceBodySegments } from './ChatCore-BVPcUZE4.cjs';
3
3
  import { Message, Interrupt } from '@langchain/langgraph-sdk';
4
4
  import 'vue';
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as Block, C as CitationItem, I as IKwargs, R as RunInfo, a as RunMessage, b as ReportBodyPayload, c as ReportOutlinePayload, d as BlockBuilderOptions, G as GroupMessageTool, M as MessageTokenUsage, O as OutlineSubChapter, e as OutlineChapter, P as ProjectRunsInput, f as RunItem, A as AsmRow, g as RunStatus, E as ExtractedPayload, h as ChatTransport, T as ThreadInitialValues, i as MessagesPage, j as ThreadTokenUsage, S as StreamSubmitInput, k as StreamSubmitOptions, H as HitlResponse, l as CreateStreamOptions } from './ChatCore-CCeoxjP9.js';
2
- export { m as AcquireResult, n as AgentThreadState, o as ArtifactFile, p as Attachment, q as BlockBase, r as BlockSource, s as BlockStatus, t as BodySegment, u as ChatCore, v as ChatCoreOptions, w as ChatNotify, x as ChatStreamHandle, y as ClarificationRecord, z as CustomBlock, F as FetchMessagesPageOptions, D as FormBlock, J as FormFieldItem, K as FormFieldType, L as GenerateBodyRequest, N as GenerateBodyResult, Q as HitlActionRequest, U as HitlDecision, V as HitlDecisionType, W as HitlInterruptPayload, X as HitlReviewConfig, Y as IAttachment, Z as IQuote, _ as InlineCitation, $ as InterruptReviewBlock, a0 as ItemSegment, a1 as ListBlock, a2 as ListItem, a3 as Message, a4 as MessageMetadata, a5 as MessageRole, a6 as MessageSource, a7 as MessageStatus, a8 as PendingRun, a9 as ReportAttachment, aa as ReportGenerateBodyHumanKwargs, ab as ReportSelectedArtifact, ac as ReportSelectedTemplate, ad as RunInputKind, ae as RunMeta, af as RunTokens, ag as SearchThreadsOptions, ah as SendMessageOptions, ai as TextBlock, aj as ThreadDirectory, ak as ThreadDirectoryOptions, al as ThreadRuntime, am as ThreadRuntimeOptions, an as ThreadsPagination, ao as ToolRun, ap as XmlAttrs, aq as buildHitlDecisions, ar as buildInterruptReviewBlock, as as buildRejectDecisions, at as buildRunDirectLatencyMs, au as buildRunInfo, av as buildRunMeta, aw as createChatCore, ax as createThreadRuntime, ay as getAllowedDecisions, az as isSameArgs, aA as normalizeForCompare, aB as parseHitlPayload, aC as pickRunMessageMetadata, aD as sliceBodySegments } from './ChatCore-CCeoxjP9.js';
1
+ import { B as Block, C as CitationItem, I as IKwargs, R as RunInfo, a as RunMessage, b as ReportBodyPayload, c as ReportOutlinePayload, d as BlockBuilderOptions, G as GroupMessageTool, M as MessageTokenUsage, O as OutlineSubChapter, e as OutlineChapter, P as ProjectRunsInput, f as RunItem, A as AsmRow, g as RunStatus, E as ExtractedPayload, h as ChatTransport, T as ThreadInitialValues, i as MessagesPage, j as ThreadTokenUsage, S as StreamSubmitInput, k as StreamSubmitOptions, H as HitlResponse, l as CreateStreamOptions } from './ChatCore-BVPcUZE4.js';
2
+ export { m as AcquireResult, n as AgentThreadState, o as ArtifactFile, p as Attachment, q as BlockBase, r as BlockSource, s as BlockStatus, t as BodySegment, u as ChatCore, v as ChatCoreOptions, w as ChatNotify, x as ChatStreamHandle, y as ClarificationRecord, z as CustomBlock, F as FetchMessagesPageOptions, D as FormBlock, J as FormFieldItem, K as FormFieldType, L as GenerateBodyRequest, N as GenerateBodyResult, Q as HitlActionRequest, U as HitlDecision, V as HitlDecisionType, W as HitlInterruptPayload, X as HitlReviewConfig, Y as IAttachment, Z as IPageReference, _ as IQuote, $ as InlineCitation, a0 as InterruptReviewBlock, a1 as ItemSegment, a2 as ListBlock, a3 as ListItem, a4 as Message, a5 as MessageMetadata, a6 as MessageRole, a7 as MessageSource, a8 as MessageStatus, a9 as PendingRun, aa as ReportAttachment, ab as ReportGenerateBodyHumanKwargs, ac as ReportSelectedArtifact, ad as ReportSelectedTemplate, ae as RunInputKind, af as RunMeta, ag as RunTokens, ah as SearchThreadsOptions, ai as SendMessageOptions, aj as TextBlock, ak as ThreadDirectory, al as ThreadDirectoryOptions, am as ThreadRuntime, an as ThreadRuntimeOptions, ao as ThreadsPagination, ap as ToolRun, aq as XmlAttrs, ar as buildHitlDecisions, as as buildInterruptReviewBlock, at as buildRejectDecisions, au as buildRunDirectLatencyMs, av as buildRunInfo, aw as buildRunMeta, ax as createChatCore, ay as createThreadRuntime, az as getAllowedDecisions, aA as isSameArgs, aB as normalizeForCompare, aC as parseHitlPayload, aD as pickRunMessageMetadata, aE as sliceBodySegments } from './ChatCore-BVPcUZE4.js';
3
3
  import { Message, Interrupt } from '@langchain/langgraph-sdk';
4
4
  import 'vue';
5
5
 
package/dist/index.mjs CHANGED
@@ -78,7 +78,7 @@ import {
78
78
  toRunMessage,
79
79
  tokenizeSxin,
80
80
  validateOutline
81
- } from "./chunk-DJ67AYSH.mjs";
81
+ } from "./chunk-7M2OXIYQ.mjs";
82
82
 
83
83
  // src/parser/citation.ts
84
84
  var toStringArray = (v) => {
@@ -785,6 +785,19 @@ var import_lodash = require("lodash");
785
785
  function parseHitlPayload(value) {
786
786
  if (!value || typeof value !== "object") return null;
787
787
  const raw = value;
788
+ if (raw.type === "tool_approval" && typeof raw.name === "string" && raw.args && typeof raw.args === "object") {
789
+ const allowed = extractAllowedDecisionsFromSchema(raw.response_schema);
790
+ return {
791
+ actionRequests: [
792
+ {
793
+ name: raw.name,
794
+ args: raw.args,
795
+ description: typeof raw.description === "string" ? raw.description : void 0
796
+ }
797
+ ],
798
+ reviewConfigs: allowed ? [{ action_name: raw.name, allowedDecisions: allowed }] : []
799
+ };
800
+ }
788
801
  const requests = raw.actionRequests ?? raw.action_requests;
789
802
  if (!Array.isArray(requests) || !requests.length) return null;
790
803
  const configs = raw.reviewConfigs ?? raw.review_configs;
@@ -793,6 +806,17 @@ function parseHitlPayload(value) {
793
806
  reviewConfigs: Array.isArray(configs) ? configs : []
794
807
  };
795
808
  }
809
+ function extractAllowedDecisionsFromSchema(responseSchema) {
810
+ const oneOf = responseSchema?.oneOf;
811
+ if (!Array.isArray(oneOf)) return null;
812
+ const allowed = /* @__PURE__ */ new Set();
813
+ for (const variant of oneOf) {
814
+ const typeConst = variant?.properties;
815
+ const v = typeConst?.type;
816
+ if (v?.const === "approve" || v?.const === "edit" || v?.const === "reject") allowed.add(v.const);
817
+ }
818
+ return allowed.size ? [...allowed] : null;
819
+ }
796
820
 
797
821
  // src/runtime/runtime-stream-actions.ts
798
822
  function createStreamActions(ctx) {
@@ -1431,6 +1455,61 @@ function projectRuns(input) {
1431
1455
  return runs;
1432
1456
  }
1433
1457
 
1458
+ // src/assembler/stable-project-runs.ts
1459
+ var refSeq = 0;
1460
+ var refIds = /* @__PURE__ */ new WeakMap();
1461
+ function refId(value) {
1462
+ if (value === null || value === void 0) return "-";
1463
+ if (typeof value === "object") {
1464
+ let id = refIds.get(value);
1465
+ if (id === void 0) {
1466
+ id = ++refSeq;
1467
+ refIds.set(value, id);
1468
+ }
1469
+ return String(id);
1470
+ }
1471
+ return String(value);
1472
+ }
1473
+ function runFingerprint(run) {
1474
+ let fp = `${run.status}|${run.input.kind}|${run.input.text}`;
1475
+ if (run.createdAt !== void 0) fp += `|c${run.createdAt}`;
1476
+ if (run.tokens !== void 0) fp += `|t${JSON.stringify(run.tokens)}`;
1477
+ const stopReason = run.stopReason;
1478
+ if (stopReason !== void 0) fp += `|s${String(stopReason)}`;
1479
+ for (const row of run.rawMessages) {
1480
+ fp += `|${row.seq}:${refId(row.msg)}:${refId(row.feedback ?? null)}`;
1481
+ }
1482
+ return fp;
1483
+ }
1484
+ function globalSignal(input, next) {
1485
+ const runIds = next.map((r) => r.runId).join(",");
1486
+ const runsListRef = input.runsList.length ? refId(input.runsList) : "empty";
1487
+ const answersRef = input.answers && input.answers.size ? refId(input.answers) : "empty";
1488
+ return `${runIds}#${runsListRef}#${answersRef}`;
1489
+ }
1490
+ function createStableRunsProjector() {
1491
+ let cache = /* @__PURE__ */ new Map();
1492
+ let lastGlobal = "";
1493
+ return function projectRunsStable(input) {
1494
+ const next = projectRuns(input);
1495
+ const signal = globalSignal(input, next);
1496
+ if (signal !== lastGlobal) {
1497
+ lastGlobal = signal;
1498
+ cache = /* @__PURE__ */ new Map();
1499
+ }
1500
+ const activeId = input.streaming ? input.activeRunId : null;
1501
+ const pendingId = input.pendingRun?.runId ?? null;
1502
+ return next.map((run) => {
1503
+ if (run.runId === activeId || run.runId === pendingId) return run;
1504
+ const fingerprint = runFingerprint(run);
1505
+ const hit = cache.get(run.runId);
1506
+ if (hit && hit.fingerprint === fingerprint) return hit.item;
1507
+ cache.set(run.runId, { fingerprint, item: run });
1508
+ return run;
1509
+ });
1510
+ };
1511
+ }
1512
+
1434
1513
  // src/runtime/values-projection.ts
1435
1514
  function createValuesChannel(options = {}) {
1436
1515
  let latestStreamMessages = [];
@@ -1593,8 +1672,9 @@ function createThreadRuntime(options) {
1593
1672
  const pendingRun = (0, import_vue4.shallowRef)(null);
1594
1673
  const answers = (0, import_vue4.shallowRef)(/* @__PURE__ */ new Map());
1595
1674
  const activeRunId = (0, import_vue4.computed)(() => runs.currentRunId.value);
1675
+ const projectRunsStable = createStableRunsProjector();
1596
1676
  const runsProjection = (0, import_vue4.computed)(
1597
- () => projectRuns({
1677
+ () => projectRunsStable({
1598
1678
  rows: rowsStore.rows.value,
1599
1679
  liveMessages: liveMessages.value,
1600
1680
  activeRunId: activeRunId.value,
@@ -2119,6 +2199,7 @@ function createChatCore(options) {
2119
2199
  isGenerating,
2120
2200
  isLoadingThread,
2121
2201
  currentThreadId,
2202
+ activeRuntime,
2122
2203
  threads,
2123
2204
  threadsPagination,
2124
2205
  runsInfo,
@@ -1,5 +1,5 @@
1
- import { v as ChatCoreOptions, u as ChatCore } from '../ChatCore-CCeoxjP9.cjs';
2
- export { aw as createChatCore } from '../ChatCore-CCeoxjP9.cjs';
1
+ import { v as ChatCoreOptions, u as ChatCore } from '../ChatCore-BVPcUZE4.cjs';
2
+ export { ax as createChatCore } from '../ChatCore-BVPcUZE4.cjs';
3
3
  import 'vue';
4
4
  import '@langchain/langgraph-sdk';
5
5
 
@@ -1,5 +1,5 @@
1
- import { v as ChatCoreOptions, u as ChatCore } from '../ChatCore-CCeoxjP9.js';
2
- export { aw as createChatCore } from '../ChatCore-CCeoxjP9.js';
1
+ import { v as ChatCoreOptions, u as ChatCore } from '../ChatCore-BVPcUZE4.js';
2
+ export { ax as createChatCore } from '../ChatCore-BVPcUZE4.js';
3
3
  import 'vue';
4
4
  import '@langchain/langgraph-sdk';
5
5
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createChatCore
3
- } from "../chunk-DJ67AYSH.mjs";
3
+ } from "../chunk-7M2OXIYQ.mjs";
4
4
 
5
5
  // src/vue/index.ts
6
6
  var instance = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cqfe/sxin-chat-core",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "SXin 对话数据层核心:thread/session 管理、消息分组、block 解析(平台无关)",
5
5
  "type": "module",
6
6
  "sideEffects": false,