@cqfe/sxin-chat-core 1.0.5 → 1.0.7
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/dist/{ChatCore-DkvD2GqL.d.cts → ChatCore-BVPcUZE4.d.cts} +5 -3
- package/dist/{ChatCore-DkvD2GqL.d.ts → ChatCore-BVPcUZE4.d.ts} +5 -3
- package/dist/{chunk-N2BKXRQO.mjs → chunk-7A4ZPM4E.mjs} +37 -2
- package/dist/index.cjs +37 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/vue/index.cjs +35 -0
- package/dist/vue/index.d.cts +2 -2
- package/dist/vue/index.d.ts +2 -2
- package/dist/vue/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -527,8 +527,8 @@ declare function isSameArgs(a: unknown, b: unknown): boolean;
|
|
|
527
527
|
* currentArgsList[i] 为 null 表示该请求无业务表单(通用回退只读),按未修改处理
|
|
528
528
|
*/
|
|
529
529
|
declare function buildHitlDecisions(requests: HitlActionRequest[], currentArgsList: Array<Record<string, unknown> | null>): HitlDecision[];
|
|
530
|
-
/** 构造「拒绝」恢复决策:拒绝作用于该中断的所有 action request */
|
|
531
|
-
declare function buildRejectDecisions(requests: HitlActionRequest[]): HitlDecision[];
|
|
530
|
+
/** 构造「拒绝」恢复决策:拒绝作用于该中断的所有 action request;message 为可选拒绝原因(新后端 response_schema 已支持) */
|
|
531
|
+
declare function buildRejectDecisions(requests: HitlActionRequest[], message?: string): HitlDecision[];
|
|
532
532
|
/** 由 interrupt 合成审核 Block;负载非法时返回 null(调用方不渲染) */
|
|
533
533
|
declare function buildInterruptReviewBlock(interrupt: Interrupt, responded: boolean): InterruptReviewBlock | null;
|
|
534
534
|
|
|
@@ -1092,6 +1092,8 @@ interface ChatCore {
|
|
|
1092
1092
|
isGenerating: Ref<boolean>;
|
|
1093
1093
|
isLoadingThread: Ref<boolean>;
|
|
1094
1094
|
currentThreadId: Ref<string | null>;
|
|
1095
|
+
/** 当前活跃会话 runtime(调试/高级用法入口;内部成员为 ComputedRef,取值需 .value;无活跃会话时为 undefined) */
|
|
1096
|
+
activeRuntime: ComputedRef<ThreadRuntime | undefined>;
|
|
1095
1097
|
threads: Ref<Thread<AgentThreadState>[]>;
|
|
1096
1098
|
threadsPagination: Ref<ThreadsPagination>;
|
|
1097
1099
|
runsInfo: Ref<Map<string, RunInfo>>;
|
|
@@ -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;
|
|
@@ -527,8 +527,8 @@ declare function isSameArgs(a: unknown, b: unknown): boolean;
|
|
|
527
527
|
* currentArgsList[i] 为 null 表示该请求无业务表单(通用回退只读),按未修改处理
|
|
528
528
|
*/
|
|
529
529
|
declare function buildHitlDecisions(requests: HitlActionRequest[], currentArgsList: Array<Record<string, unknown> | null>): HitlDecision[];
|
|
530
|
-
/** 构造「拒绝」恢复决策:拒绝作用于该中断的所有 action request */
|
|
531
|
-
declare function buildRejectDecisions(requests: HitlActionRequest[]): HitlDecision[];
|
|
530
|
+
/** 构造「拒绝」恢复决策:拒绝作用于该中断的所有 action request;message 为可选拒绝原因(新后端 response_schema 已支持) */
|
|
531
|
+
declare function buildRejectDecisions(requests: HitlActionRequest[], message?: string): HitlDecision[];
|
|
532
532
|
/** 由 interrupt 合成审核 Block;负载非法时返回 null(调用方不渲染) */
|
|
533
533
|
declare function buildInterruptReviewBlock(interrupt: Interrupt, responded: boolean): InterruptReviewBlock | null;
|
|
534
534
|
|
|
@@ -1092,6 +1092,8 @@ interface ChatCore {
|
|
|
1092
1092
|
isGenerating: Ref<boolean>;
|
|
1093
1093
|
isLoadingThread: Ref<boolean>;
|
|
1094
1094
|
currentThreadId: Ref<string | null>;
|
|
1095
|
+
/** 当前活跃会话 runtime(调试/高级用法入口;内部成员为 ComputedRef,取值需 .value;无活跃会话时为 undefined) */
|
|
1096
|
+
activeRuntime: ComputedRef<ThreadRuntime | undefined>;
|
|
1095
1097
|
threads: Ref<Thread<AgentThreadState>[]>;
|
|
1096
1098
|
threadsPagination: Ref<ThreadsPagination>;
|
|
1097
1099
|
runsInfo: Ref<Map<string, RunInfo>>;
|
|
@@ -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(() =>
|
|
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);
|
|
@@ -1343,6 +1367,9 @@ function applyToolMessage(msg, tools, byCallId) {
|
|
|
1343
1367
|
if (extracted) tool.extracted = extracted;
|
|
1344
1368
|
tool.status = String(msg?.status || "") === "error" ? "error" : "finished";
|
|
1345
1369
|
}
|
|
1370
|
+
function isPresentFilesTool(name) {
|
|
1371
|
+
return String(name || "").trim().toLowerCase() === "present_files";
|
|
1372
|
+
}
|
|
1346
1373
|
function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
1347
1374
|
const byKind = /* @__PURE__ */ new Map();
|
|
1348
1375
|
for (const tool of tools) {
|
|
@@ -1358,6 +1385,13 @@ function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
|
1358
1385
|
});
|
|
1359
1386
|
} else if (ex?.kind === "artifact") {
|
|
1360
1387
|
byKind.set("artifact", { kind: "artifact", files: ex.files });
|
|
1388
|
+
} else if (isPresentFilesTool(tool.name)) {
|
|
1389
|
+
const paths = tool.input?.filepaths;
|
|
1390
|
+
if (Array.isArray(paths) && paths.length) {
|
|
1391
|
+
const prev = byKind.get("artifact");
|
|
1392
|
+
const prevFiles = prev?.kind === "artifact" && Array.isArray(prev.files) ? prev.files : [];
|
|
1393
|
+
byKind.set("artifact", { kind: "artifact", files: [...prevFiles, ...paths] });
|
|
1394
|
+
}
|
|
1361
1395
|
} else if (twinEnabled && tool.name.includes(twinToolPrefix)) {
|
|
1362
1396
|
byKind.set("twin", { kind: "twin", payload: tool.input });
|
|
1363
1397
|
}
|
|
@@ -2625,6 +2659,7 @@ function createChatCore(options) {
|
|
|
2625
2659
|
isGenerating,
|
|
2626
2660
|
isLoadingThread,
|
|
2627
2661
|
currentThreadId,
|
|
2662
|
+
activeRuntime,
|
|
2628
2663
|
threads,
|
|
2629
2664
|
threadsPagination,
|
|
2630
2665
|
runsInfo,
|
package/dist/index.cjs
CHANGED
|
@@ -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(() =>
|
|
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);
|
|
@@ -1765,6 +1789,9 @@ function applyToolMessage(msg, tools, byCallId) {
|
|
|
1765
1789
|
if (extracted) tool.extracted = extracted;
|
|
1766
1790
|
tool.status = String(msg?.status || "") === "error" ? "error" : "finished";
|
|
1767
1791
|
}
|
|
1792
|
+
function isPresentFilesTool(name) {
|
|
1793
|
+
return String(name || "").trim().toLowerCase() === "present_files";
|
|
1794
|
+
}
|
|
1768
1795
|
function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
1769
1796
|
const byKind = /* @__PURE__ */ new Map();
|
|
1770
1797
|
for (const tool of tools) {
|
|
@@ -1780,6 +1807,13 @@ function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
|
1780
1807
|
});
|
|
1781
1808
|
} else if (ex?.kind === "artifact") {
|
|
1782
1809
|
byKind.set("artifact", { kind: "artifact", files: ex.files });
|
|
1810
|
+
} else if (isPresentFilesTool(tool.name)) {
|
|
1811
|
+
const paths = tool.input?.filepaths;
|
|
1812
|
+
if (Array.isArray(paths) && paths.length) {
|
|
1813
|
+
const prev = byKind.get("artifact");
|
|
1814
|
+
const prevFiles = prev?.kind === "artifact" && Array.isArray(prev.files) ? prev.files : [];
|
|
1815
|
+
byKind.set("artifact", { kind: "artifact", files: [...prevFiles, ...paths] });
|
|
1816
|
+
}
|
|
1783
1817
|
} else if (twinEnabled && tool.name.includes(twinToolPrefix)) {
|
|
1784
1818
|
byKind.set("twin", { kind: "twin", payload: tool.input });
|
|
1785
1819
|
}
|
|
@@ -3047,6 +3081,7 @@ function createChatCore(options) {
|
|
|
3047
3081
|
isGenerating,
|
|
3048
3082
|
isLoadingThread,
|
|
3049
3083
|
currentThreadId,
|
|
3084
|
+
activeRuntime,
|
|
3050
3085
|
threads,
|
|
3051
3086
|
threadsPagination,
|
|
3052
3087
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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
package/dist/vue/index.cjs
CHANGED
|
@@ -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) {
|
|
@@ -1264,6 +1288,9 @@ function applyToolMessage(msg, tools, byCallId) {
|
|
|
1264
1288
|
if (extracted) tool.extracted = extracted;
|
|
1265
1289
|
tool.status = String(msg?.status || "") === "error" ? "error" : "finished";
|
|
1266
1290
|
}
|
|
1291
|
+
function isPresentFilesTool(name) {
|
|
1292
|
+
return String(name || "").trim().toLowerCase() === "present_files";
|
|
1293
|
+
}
|
|
1267
1294
|
function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
1268
1295
|
const byKind = /* @__PURE__ */ new Map();
|
|
1269
1296
|
for (const tool of tools) {
|
|
@@ -1279,6 +1306,13 @@ function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
|
1279
1306
|
});
|
|
1280
1307
|
} else if (ex?.kind === "artifact") {
|
|
1281
1308
|
byKind.set("artifact", { kind: "artifact", files: ex.files });
|
|
1309
|
+
} else if (isPresentFilesTool(tool.name)) {
|
|
1310
|
+
const paths = tool.input?.filepaths;
|
|
1311
|
+
if (Array.isArray(paths) && paths.length) {
|
|
1312
|
+
const prev = byKind.get("artifact");
|
|
1313
|
+
const prevFiles = prev?.kind === "artifact" && Array.isArray(prev.files) ? prev.files : [];
|
|
1314
|
+
byKind.set("artifact", { kind: "artifact", files: [...prevFiles, ...paths] });
|
|
1315
|
+
}
|
|
1282
1316
|
} else if (twinEnabled && tool.name.includes(twinToolPrefix)) {
|
|
1283
1317
|
byKind.set("twin", { kind: "twin", payload: tool.input });
|
|
1284
1318
|
}
|
|
@@ -2175,6 +2209,7 @@ function createChatCore(options) {
|
|
|
2175
2209
|
isGenerating,
|
|
2176
2210
|
isLoadingThread,
|
|
2177
2211
|
currentThreadId,
|
|
2212
|
+
activeRuntime,
|
|
2178
2213
|
threads,
|
|
2179
2214
|
threadsPagination,
|
|
2180
2215
|
runsInfo,
|
package/dist/vue/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { v as ChatCoreOptions, u as ChatCore } from '../ChatCore-
|
|
2
|
-
export { ax as createChatCore } from '../ChatCore-
|
|
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
|
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { v as ChatCoreOptions, u as ChatCore } from '../ChatCore-
|
|
2
|
-
export { ax as createChatCore } from '../ChatCore-
|
|
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
|
|
package/dist/vue/index.mjs
CHANGED