@cqfe/sxin-chat-core 1.0.4 → 1.0.5

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.
@@ -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[];
@@ -1135,4 +1148,4 @@ interface ChatCore {
1135
1148
  }
1136
1149
  declare function createChatCore(options: ChatCoreOptions): ChatCore;
1137
1150
 
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 };
1151
+ 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 };
@@ -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[];
@@ -1135,4 +1148,4 @@ interface ChatCore {
1135
1148
  }
1136
1149
  declare function createChatCore(options: ChatCoreOptions): ChatCore;
1137
1150
 
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 };
1151
+ 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 };
@@ -1883,6 +1883,61 @@ function extractLiveIncrement(snapshot, lastSeenIds) {
1883
1883
  return fresh;
1884
1884
  }
1885
1885
 
1886
+ // src/assembler/stable-project-runs.ts
1887
+ var refSeq = 0;
1888
+ var refIds = /* @__PURE__ */ new WeakMap();
1889
+ function refId(value) {
1890
+ if (value === null || value === void 0) return "-";
1891
+ if (typeof value === "object") {
1892
+ let id = refIds.get(value);
1893
+ if (id === void 0) {
1894
+ id = ++refSeq;
1895
+ refIds.set(value, id);
1896
+ }
1897
+ return String(id);
1898
+ }
1899
+ return String(value);
1900
+ }
1901
+ function runFingerprint(run) {
1902
+ let fp = `${run.status}|${run.input.kind}|${run.input.text}`;
1903
+ if (run.createdAt !== void 0) fp += `|c${run.createdAt}`;
1904
+ if (run.tokens !== void 0) fp += `|t${JSON.stringify(run.tokens)}`;
1905
+ const stopReason = run.stopReason;
1906
+ if (stopReason !== void 0) fp += `|s${String(stopReason)}`;
1907
+ for (const row of run.rawMessages) {
1908
+ fp += `|${row.seq}:${refId(row.msg)}:${refId(row.feedback ?? null)}`;
1909
+ }
1910
+ return fp;
1911
+ }
1912
+ function globalSignal(input, next) {
1913
+ const runIds = next.map((r) => r.runId).join(",");
1914
+ const runsListRef = input.runsList.length ? refId(input.runsList) : "empty";
1915
+ const answersRef = input.answers && input.answers.size ? refId(input.answers) : "empty";
1916
+ return `${runIds}#${runsListRef}#${answersRef}`;
1917
+ }
1918
+ function createStableRunsProjector() {
1919
+ let cache = /* @__PURE__ */ new Map();
1920
+ let lastGlobal = "";
1921
+ return function projectRunsStable(input) {
1922
+ const next = projectRuns(input);
1923
+ const signal = globalSignal(input, next);
1924
+ if (signal !== lastGlobal) {
1925
+ lastGlobal = signal;
1926
+ cache = /* @__PURE__ */ new Map();
1927
+ }
1928
+ const activeId = input.streaming ? input.activeRunId : null;
1929
+ const pendingId = input.pendingRun?.runId ?? null;
1930
+ return next.map((run) => {
1931
+ if (run.runId === activeId || run.runId === pendingId) return run;
1932
+ const fingerprint = runFingerprint(run);
1933
+ const hit = cache.get(run.runId);
1934
+ if (hit && hit.fingerprint === fingerprint) return hit.item;
1935
+ cache.set(run.runId, { fingerprint, item: run });
1936
+ return run;
1937
+ });
1938
+ };
1939
+ }
1940
+
1886
1941
  // src/runtime/values-projection.ts
1887
1942
  function createValuesChannel(options = {}) {
1888
1943
  let latestStreamMessages = [];
@@ -2045,8 +2100,9 @@ function createThreadRuntime(options) {
2045
2100
  const pendingRun = shallowRef3(null);
2046
2101
  const answers = shallowRef3(/* @__PURE__ */ new Map());
2047
2102
  const activeRunId = computed2(() => runs.currentRunId.value);
2103
+ const projectRunsStable = createStableRunsProjector();
2048
2104
  const runsProjection = computed2(
2049
- () => projectRuns({
2105
+ () => projectRunsStable({
2050
2106
  rows: rowsStore.rows.value,
2051
2107
  liveMessages: liveMessages.value,
2052
2108
  activeRunId: activeRunId.value,
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);
@@ -2305,6 +2305,61 @@ function extractLiveIncrement(snapshot, lastSeenIds) {
2305
2305
  return fresh;
2306
2306
  }
2307
2307
 
2308
+ // src/assembler/stable-project-runs.ts
2309
+ var refSeq = 0;
2310
+ var refIds = /* @__PURE__ */ new WeakMap();
2311
+ function refId(value) {
2312
+ if (value === null || value === void 0) return "-";
2313
+ if (typeof value === "object") {
2314
+ let id = refIds.get(value);
2315
+ if (id === void 0) {
2316
+ id = ++refSeq;
2317
+ refIds.set(value, id);
2318
+ }
2319
+ return String(id);
2320
+ }
2321
+ return String(value);
2322
+ }
2323
+ function runFingerprint(run) {
2324
+ let fp = `${run.status}|${run.input.kind}|${run.input.text}`;
2325
+ if (run.createdAt !== void 0) fp += `|c${run.createdAt}`;
2326
+ if (run.tokens !== void 0) fp += `|t${JSON.stringify(run.tokens)}`;
2327
+ const stopReason = run.stopReason;
2328
+ if (stopReason !== void 0) fp += `|s${String(stopReason)}`;
2329
+ for (const row of run.rawMessages) {
2330
+ fp += `|${row.seq}:${refId(row.msg)}:${refId(row.feedback ?? null)}`;
2331
+ }
2332
+ return fp;
2333
+ }
2334
+ function globalSignal(input, next) {
2335
+ const runIds = next.map((r) => r.runId).join(",");
2336
+ const runsListRef = input.runsList.length ? refId(input.runsList) : "empty";
2337
+ const answersRef = input.answers && input.answers.size ? refId(input.answers) : "empty";
2338
+ return `${runIds}#${runsListRef}#${answersRef}`;
2339
+ }
2340
+ function createStableRunsProjector() {
2341
+ let cache = /* @__PURE__ */ new Map();
2342
+ let lastGlobal = "";
2343
+ return function projectRunsStable(input) {
2344
+ const next = projectRuns(input);
2345
+ const signal = globalSignal(input, next);
2346
+ if (signal !== lastGlobal) {
2347
+ lastGlobal = signal;
2348
+ cache = /* @__PURE__ */ new Map();
2349
+ }
2350
+ const activeId = input.streaming ? input.activeRunId : null;
2351
+ const pendingId = input.pendingRun?.runId ?? null;
2352
+ return next.map((run) => {
2353
+ if (run.runId === activeId || run.runId === pendingId) return run;
2354
+ const fingerprint = runFingerprint(run);
2355
+ const hit = cache.get(run.runId);
2356
+ if (hit && hit.fingerprint === fingerprint) return hit.item;
2357
+ cache.set(run.runId, { fingerprint, item: run });
2358
+ return run;
2359
+ });
2360
+ };
2361
+ }
2362
+
2308
2363
  // src/runtime/values-projection.ts
2309
2364
  function createValuesChannel(options = {}) {
2310
2365
  let latestStreamMessages = [];
@@ -2467,8 +2522,9 @@ function createThreadRuntime(options) {
2467
2522
  const pendingRun = (0, import_vue4.shallowRef)(null);
2468
2523
  const answers = (0, import_vue4.shallowRef)(/* @__PURE__ */ new Map());
2469
2524
  const activeRunId = (0, import_vue4.computed)(() => runs.currentRunId.value);
2525
+ const projectRunsStable = createStableRunsProjector();
2470
2526
  const runsProjection = (0, import_vue4.computed)(
2471
- () => projectRuns({
2527
+ () => projectRunsStable({
2472
2528
  rows: rowsStore.rows.value,
2473
2529
  liveMessages: liveMessages.value,
2474
2530
  activeRunId: activeRunId.value,
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-DkvD2GqL.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-DkvD2GqL.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-DkvD2GqL.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-DkvD2GqL.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-N2BKXRQO.mjs";
82
82
 
83
83
  // src/parser/citation.ts
84
84
  var toStringArray = (v) => {
@@ -1431,6 +1431,61 @@ function projectRuns(input) {
1431
1431
  return runs;
1432
1432
  }
1433
1433
 
1434
+ // src/assembler/stable-project-runs.ts
1435
+ var refSeq = 0;
1436
+ var refIds = /* @__PURE__ */ new WeakMap();
1437
+ function refId(value) {
1438
+ if (value === null || value === void 0) return "-";
1439
+ if (typeof value === "object") {
1440
+ let id = refIds.get(value);
1441
+ if (id === void 0) {
1442
+ id = ++refSeq;
1443
+ refIds.set(value, id);
1444
+ }
1445
+ return String(id);
1446
+ }
1447
+ return String(value);
1448
+ }
1449
+ function runFingerprint(run) {
1450
+ let fp = `${run.status}|${run.input.kind}|${run.input.text}`;
1451
+ if (run.createdAt !== void 0) fp += `|c${run.createdAt}`;
1452
+ if (run.tokens !== void 0) fp += `|t${JSON.stringify(run.tokens)}`;
1453
+ const stopReason = run.stopReason;
1454
+ if (stopReason !== void 0) fp += `|s${String(stopReason)}`;
1455
+ for (const row of run.rawMessages) {
1456
+ fp += `|${row.seq}:${refId(row.msg)}:${refId(row.feedback ?? null)}`;
1457
+ }
1458
+ return fp;
1459
+ }
1460
+ function globalSignal(input, next) {
1461
+ const runIds = next.map((r) => r.runId).join(",");
1462
+ const runsListRef = input.runsList.length ? refId(input.runsList) : "empty";
1463
+ const answersRef = input.answers && input.answers.size ? refId(input.answers) : "empty";
1464
+ return `${runIds}#${runsListRef}#${answersRef}`;
1465
+ }
1466
+ function createStableRunsProjector() {
1467
+ let cache = /* @__PURE__ */ new Map();
1468
+ let lastGlobal = "";
1469
+ return function projectRunsStable(input) {
1470
+ const next = projectRuns(input);
1471
+ const signal = globalSignal(input, next);
1472
+ if (signal !== lastGlobal) {
1473
+ lastGlobal = signal;
1474
+ cache = /* @__PURE__ */ new Map();
1475
+ }
1476
+ const activeId = input.streaming ? input.activeRunId : null;
1477
+ const pendingId = input.pendingRun?.runId ?? null;
1478
+ return next.map((run) => {
1479
+ if (run.runId === activeId || run.runId === pendingId) return run;
1480
+ const fingerprint = runFingerprint(run);
1481
+ const hit = cache.get(run.runId);
1482
+ if (hit && hit.fingerprint === fingerprint) return hit.item;
1483
+ cache.set(run.runId, { fingerprint, item: run });
1484
+ return run;
1485
+ });
1486
+ };
1487
+ }
1488
+
1434
1489
  // src/runtime/values-projection.ts
1435
1490
  function createValuesChannel(options = {}) {
1436
1491
  let latestStreamMessages = [];
@@ -1593,8 +1648,9 @@ function createThreadRuntime(options) {
1593
1648
  const pendingRun = (0, import_vue4.shallowRef)(null);
1594
1649
  const answers = (0, import_vue4.shallowRef)(/* @__PURE__ */ new Map());
1595
1650
  const activeRunId = (0, import_vue4.computed)(() => runs.currentRunId.value);
1651
+ const projectRunsStable = createStableRunsProjector();
1596
1652
  const runsProjection = (0, import_vue4.computed)(
1597
- () => projectRuns({
1653
+ () => projectRunsStable({
1598
1654
  rows: rowsStore.rows.value,
1599
1655
  liveMessages: liveMessages.value,
1600
1656
  activeRunId: activeRunId.value,
@@ -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-DkvD2GqL.cjs';
2
+ export { ax as createChatCore } from '../ChatCore-DkvD2GqL.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-DkvD2GqL.js';
2
+ export { ax as createChatCore } from '../ChatCore-DkvD2GqL.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-N2BKXRQO.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.5",
4
4
  "description": "SXin 对话数据层核心:thread/session 管理、消息分组、block 解析(平台无关)",
5
5
  "type": "module",
6
6
  "sideEffects": false,