@haklex/rich-agent-core 0.0.97 → 0.0.99
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/agent-executor.d.ts.map +1 -1
- package/dist/index.mjs +166 -83
- package/dist/initialState.d.ts +1 -1
- package/dist/initialState.d.ts.map +1 -1
- package/dist/provider/sse-openai.d.ts.map +1 -1
- package/dist/store-actions.d.ts +2 -0
- package/dist/store-actions.d.ts.map +1 -1
- package/dist/store.d.ts +2 -2
- package/dist/store.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-executor.d.ts","sourceRoot":"","sources":["../src/agent-executor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EAGf,WAAW,EACX,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,WAAW,CAAC;IACtB,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,mBAAmB,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,cAAc,EAAE,CAAC;CAC9B,CAAC;AA0CF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB;2BAmB1C,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,KAC/C,OAAO,CAAC,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-executor.d.ts","sourceRoot":"","sources":["../src/agent-executor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EAGf,WAAW,EACX,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,WAAW,CAAC;IACtB,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,mBAAmB,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,cAAc,EAAE,CAAC;CAC9B,CAAC;AA0CF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB;2BAmB1C,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,KAC/C,OAAO,CAAC,mBAAmB,CAAC;EAmMhC"}
|
package/dist/index.mjs
CHANGED
|
@@ -458,8 +458,68 @@ function createAgentExecutor(config) {
|
|
|
458
458
|
let hasThinking = false;
|
|
459
459
|
let thinkingId = "";
|
|
460
460
|
const toolCalls = [];
|
|
461
|
+
let streamGroupId = null;
|
|
462
|
+
const streamToolTurns = [];
|
|
463
|
+
let assistantBubbleOpen = false;
|
|
464
|
+
const runToolCallMidStream = async (tc) => {
|
|
465
|
+
if (assistantBubbleOpen) {
|
|
466
|
+
updateLastBubble({ type: "assistant", content: textAccum, streaming: false });
|
|
467
|
+
assistantBubbleOpen = false;
|
|
468
|
+
textAccum = "";
|
|
469
|
+
}
|
|
470
|
+
if (!streamGroupId) {
|
|
471
|
+
streamGroupId = nextGroupId();
|
|
472
|
+
addBubble({ type: "tool_call_group", id: streamGroupId, items: [] });
|
|
473
|
+
setStatus("calling_tool");
|
|
474
|
+
}
|
|
475
|
+
let params;
|
|
476
|
+
let parseError = null;
|
|
477
|
+
try {
|
|
478
|
+
params = JSON.parse(tc.arguments);
|
|
479
|
+
} catch (e) {
|
|
480
|
+
params = {};
|
|
481
|
+
parseError = e.message;
|
|
482
|
+
}
|
|
483
|
+
const { addToolCallItem, updateToolCallItem } = store.getState();
|
|
484
|
+
addToolCallItem(streamGroupId, {
|
|
485
|
+
id: tc.id,
|
|
486
|
+
toolName: tc.name,
|
|
487
|
+
description: describeToolCall(toolMap.get(tc.name), params),
|
|
488
|
+
params,
|
|
489
|
+
status: parseError ? "error" : "running",
|
|
490
|
+
startedAt: Date.now(),
|
|
491
|
+
...parseError ? { error: `JSON parse error: ${parseError}`, finishedAt: Date.now() } : {}
|
|
492
|
+
});
|
|
493
|
+
if (parseError) {
|
|
494
|
+
streamToolTurns.push({
|
|
495
|
+
role: "tool_result",
|
|
496
|
+
toolCallId: tc.id,
|
|
497
|
+
content: `JSON parse error: ${parseError}`,
|
|
498
|
+
isError: true
|
|
499
|
+
});
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
const result = await executeTool(tc.name, tc.arguments);
|
|
503
|
+
const content = result.ok ? result.content : JSON.stringify(result.error);
|
|
504
|
+
updateToolCallItem(streamGroupId, tc.id, {
|
|
505
|
+
status: result.ok ? "completed" : "error",
|
|
506
|
+
result: result.ok ? result.content : void 0,
|
|
507
|
+
resultPreview: result.ok ? result.content.slice(0, 80) : void 0,
|
|
508
|
+
error: !result.ok ? content : void 0,
|
|
509
|
+
finishedAt: Date.now()
|
|
510
|
+
});
|
|
511
|
+
streamToolTurns.push({
|
|
512
|
+
role: "tool_result",
|
|
513
|
+
toolCallId: tc.id,
|
|
514
|
+
content,
|
|
515
|
+
isError: !result.ok
|
|
516
|
+
});
|
|
517
|
+
if (operations.length > lastOpsLength) {
|
|
518
|
+
lastOpsLength = operations.length;
|
|
519
|
+
onOperationsChanged?.(operations);
|
|
520
|
+
}
|
|
521
|
+
};
|
|
461
522
|
setStatus("thinking");
|
|
462
|
-
addBubble({ type: "assistant", content: "", streaming: true });
|
|
463
523
|
for await (const chunk of provider.chat(messages, toolSchemas)) {
|
|
464
524
|
signal?.throwIfAborted();
|
|
465
525
|
if (chunk.type === "thinking") {
|
|
@@ -467,7 +527,7 @@ function createAgentExecutor(config) {
|
|
|
467
527
|
if (!hasThinking) {
|
|
468
528
|
hasThinking = true;
|
|
469
529
|
thinkingId = nextThinkingId();
|
|
470
|
-
|
|
530
|
+
addBubble({
|
|
471
531
|
type: "thinking",
|
|
472
532
|
content: chunk.text,
|
|
473
533
|
id: thinkingId,
|
|
@@ -488,24 +548,28 @@ function createAgentExecutor(config) {
|
|
|
488
548
|
continue;
|
|
489
549
|
}
|
|
490
550
|
if (chunk.type === "text") {
|
|
491
|
-
if (
|
|
551
|
+
if (!assistantBubbleOpen) {
|
|
492
552
|
addBubble({ type: "assistant", content: chunk.text, streaming: true });
|
|
553
|
+
assistantBubbleOpen = true;
|
|
554
|
+
textAccum = chunk.text;
|
|
493
555
|
setStatus("writing");
|
|
494
|
-
} else if (textAccum === "") {
|
|
495
|
-
setStatus("writing");
|
|
496
|
-
updateLastBubble({ type: "assistant", content: chunk.text, streaming: true });
|
|
497
556
|
} else {
|
|
557
|
+
textAccum += chunk.text;
|
|
498
558
|
updateLastBubble({
|
|
499
559
|
type: "assistant",
|
|
500
|
-
content: textAccum
|
|
560
|
+
content: textAccum,
|
|
501
561
|
streaming: true
|
|
502
562
|
});
|
|
503
563
|
}
|
|
504
|
-
textAccum += chunk.text;
|
|
505
564
|
continue;
|
|
506
565
|
}
|
|
507
566
|
if (chunk.type === "tool_call") {
|
|
508
567
|
toolCalls.push({ id: chunk.id, name: chunk.name, arguments: chunk.arguments });
|
|
568
|
+
await runToolCallMidStream({
|
|
569
|
+
id: chunk.id,
|
|
570
|
+
name: chunk.name,
|
|
571
|
+
arguments: chunk.arguments
|
|
572
|
+
});
|
|
509
573
|
}
|
|
510
574
|
}
|
|
511
575
|
if (hasThinking) {
|
|
@@ -526,71 +590,13 @@ function createAgentExecutor(config) {
|
|
|
526
590
|
store.setState({ bubbles: nextBubbles });
|
|
527
591
|
}
|
|
528
592
|
}
|
|
529
|
-
|
|
593
|
+
if (assistantBubbleOpen) {
|
|
594
|
+
updateLastBubble({ type: "assistant", content: textAccum, streaming: false });
|
|
595
|
+
assistantBubbleOpen = false;
|
|
596
|
+
}
|
|
530
597
|
if (toolCalls.length === 0) break;
|
|
531
598
|
turns.push({ role: "assistant_tool_call", toolCalls });
|
|
532
|
-
|
|
533
|
-
const groupId = nextGroupId();
|
|
534
|
-
const items = [];
|
|
535
|
-
for (const tc of toolCalls) {
|
|
536
|
-
let params;
|
|
537
|
-
try {
|
|
538
|
-
params = JSON.parse(tc.arguments);
|
|
539
|
-
} catch {
|
|
540
|
-
params = {};
|
|
541
|
-
}
|
|
542
|
-
items.push({
|
|
543
|
-
id: tc.id,
|
|
544
|
-
toolName: tc.name,
|
|
545
|
-
description: describeToolCall(toolMap.get(tc.name), params),
|
|
546
|
-
params,
|
|
547
|
-
status: "pending"
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
addBubble({ type: "tool_call_group", id: groupId, items });
|
|
551
|
-
const { updateToolCallItem } = store.getState();
|
|
552
|
-
for (let i = 0; i < toolCalls.length; i++) {
|
|
553
|
-
const tc = toolCalls[i];
|
|
554
|
-
updateToolCallItem(groupId, tc.id, {
|
|
555
|
-
status: "running",
|
|
556
|
-
startedAt: Date.now()
|
|
557
|
-
});
|
|
558
|
-
try {
|
|
559
|
-
JSON.parse(tc.arguments);
|
|
560
|
-
} catch (e) {
|
|
561
|
-
updateToolCallItem(groupId, tc.id, {
|
|
562
|
-
status: "error",
|
|
563
|
-
error: `JSON parse error: ${e.message}`,
|
|
564
|
-
finishedAt: Date.now()
|
|
565
|
-
});
|
|
566
|
-
turns.push({
|
|
567
|
-
role: "tool_result",
|
|
568
|
-
toolCallId: tc.id,
|
|
569
|
-
content: `JSON parse error: ${e.message}`,
|
|
570
|
-
isError: true
|
|
571
|
-
});
|
|
572
|
-
continue;
|
|
573
|
-
}
|
|
574
|
-
const result = await executeTool(tc.name, tc.arguments);
|
|
575
|
-
const content = result.ok ? result.content : JSON.stringify(result.error);
|
|
576
|
-
updateToolCallItem(groupId, tc.id, {
|
|
577
|
-
status: result.ok ? "completed" : "error",
|
|
578
|
-
result: result.ok ? result.content : void 0,
|
|
579
|
-
resultPreview: result.ok ? result.content.slice(0, 80) : void 0,
|
|
580
|
-
error: !result.ok ? content : void 0,
|
|
581
|
-
finishedAt: Date.now()
|
|
582
|
-
});
|
|
583
|
-
turns.push({
|
|
584
|
-
role: "tool_result",
|
|
585
|
-
toolCallId: tc.id,
|
|
586
|
-
content,
|
|
587
|
-
isError: !result.ok
|
|
588
|
-
});
|
|
589
|
-
if (operations.length > lastOpsLength) {
|
|
590
|
-
lastOpsLength = operations.length;
|
|
591
|
-
onOperationsChanged?.(operations);
|
|
592
|
-
}
|
|
593
|
-
}
|
|
599
|
+
for (const t of streamToolTurns) turns.push(t);
|
|
594
600
|
}
|
|
595
601
|
setStatus("done");
|
|
596
602
|
return { operations };
|
|
@@ -676,10 +682,10 @@ function buildDocumentContext(editorState, options) {
|
|
|
676
682
|
const registry = createDefaultRegistry();
|
|
677
683
|
return serializeToXml(editorState, registry, { compact: options.compact ?? true });
|
|
678
684
|
}
|
|
679
|
-
function createInitialAgentStoreState() {
|
|
685
|
+
function createInitialAgentStoreState(initialBubbles) {
|
|
680
686
|
return {
|
|
681
687
|
status: "idle",
|
|
682
|
-
bubbles: [],
|
|
688
|
+
bubbles: initialBubbles ?? [],
|
|
683
689
|
diffState: null,
|
|
684
690
|
reviewState: null
|
|
685
691
|
};
|
|
@@ -755,6 +761,58 @@ async function* parseOpenAISSE(response) {
|
|
|
755
761
|
const decoder = new TextDecoder();
|
|
756
762
|
let buffer = "";
|
|
757
763
|
const pendingToolCalls = /* @__PURE__ */ new Map();
|
|
764
|
+
function isBalanced(s) {
|
|
765
|
+
if (!s) return false;
|
|
766
|
+
let depth = 0;
|
|
767
|
+
let inString = false;
|
|
768
|
+
let escape = false;
|
|
769
|
+
let sawOpen = false;
|
|
770
|
+
for (let i = 0; i < s.length; i++) {
|
|
771
|
+
const c = s[i];
|
|
772
|
+
if (escape) {
|
|
773
|
+
escape = false;
|
|
774
|
+
continue;
|
|
775
|
+
}
|
|
776
|
+
if (c === "\\") {
|
|
777
|
+
escape = true;
|
|
778
|
+
continue;
|
|
779
|
+
}
|
|
780
|
+
if (c === '"') {
|
|
781
|
+
inString = !inString;
|
|
782
|
+
continue;
|
|
783
|
+
}
|
|
784
|
+
if (inString) continue;
|
|
785
|
+
if (c === "{" || c === "[") {
|
|
786
|
+
depth++;
|
|
787
|
+
sawOpen = true;
|
|
788
|
+
} else if (c === "}" || c === "]") {
|
|
789
|
+
depth--;
|
|
790
|
+
if (sawOpen && depth === 0) return true;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
return false;
|
|
794
|
+
}
|
|
795
|
+
function tryYieldReady() {
|
|
796
|
+
const ready = [];
|
|
797
|
+
for (const tc of pendingToolCalls.values()) {
|
|
798
|
+
if (tc.yielded) continue;
|
|
799
|
+
if (!tc.id || !tc.name) continue;
|
|
800
|
+
if (!isBalanced(tc.arguments)) continue;
|
|
801
|
+
try {
|
|
802
|
+
JSON.parse(tc.arguments);
|
|
803
|
+
} catch {
|
|
804
|
+
continue;
|
|
805
|
+
}
|
|
806
|
+
tc.yielded = true;
|
|
807
|
+
ready.push({
|
|
808
|
+
type: "tool_call",
|
|
809
|
+
id: tc.id,
|
|
810
|
+
name: tc.name,
|
|
811
|
+
arguments: tc.arguments
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
return ready;
|
|
815
|
+
}
|
|
758
816
|
try {
|
|
759
817
|
while (true) {
|
|
760
818
|
const { done, value } = await reader.read();
|
|
@@ -767,7 +825,13 @@ async function* parseOpenAISSE(response) {
|
|
|
767
825
|
const data = line.slice(6).trim();
|
|
768
826
|
if (data === "[DONE]") {
|
|
769
827
|
for (const tc of pendingToolCalls.values()) {
|
|
770
|
-
|
|
828
|
+
if (tc.yielded) continue;
|
|
829
|
+
yield {
|
|
830
|
+
type: "tool_call",
|
|
831
|
+
id: tc.id,
|
|
832
|
+
name: tc.name,
|
|
833
|
+
arguments: tc.arguments
|
|
834
|
+
};
|
|
771
835
|
}
|
|
772
836
|
pendingToolCalls.clear();
|
|
773
837
|
yield { type: "done" };
|
|
@@ -791,7 +855,8 @@ async function* parseOpenAISSE(response) {
|
|
|
791
855
|
pendingToolCalls.set(idx, {
|
|
792
856
|
id: tc.id || "",
|
|
793
857
|
name: tc.function?.name || "",
|
|
794
|
-
arguments: ""
|
|
858
|
+
arguments: "",
|
|
859
|
+
yielded: false
|
|
795
860
|
});
|
|
796
861
|
}
|
|
797
862
|
const pending = pendingToolCalls.get(idx);
|
|
@@ -799,13 +864,20 @@ async function* parseOpenAISSE(response) {
|
|
|
799
864
|
if (tc.function?.name) pending.name = tc.function.name;
|
|
800
865
|
if (tc.function?.arguments) pending.arguments += tc.function.arguments;
|
|
801
866
|
}
|
|
867
|
+
for (const ready of tryYieldReady()) yield ready;
|
|
802
868
|
}
|
|
803
869
|
const finishReason = parsed.choices?.[0]?.finish_reason;
|
|
804
870
|
if (finishReason === "tool_calls") {
|
|
805
871
|
for (const tc of pendingToolCalls.values()) {
|
|
806
|
-
|
|
872
|
+
if (tc.yielded) continue;
|
|
873
|
+
yield {
|
|
874
|
+
type: "tool_call",
|
|
875
|
+
id: tc.id,
|
|
876
|
+
name: tc.name,
|
|
877
|
+
arguments: tc.arguments
|
|
878
|
+
};
|
|
879
|
+
tc.yielded = true;
|
|
807
880
|
}
|
|
808
|
-
pendingToolCalls.clear();
|
|
809
881
|
}
|
|
810
882
|
}
|
|
811
883
|
}
|
|
@@ -1342,6 +1414,17 @@ class AgentStoreActionImpl {
|
|
|
1342
1414
|
return { bubbles: nextBubbles };
|
|
1343
1415
|
});
|
|
1344
1416
|
};
|
|
1417
|
+
this.addToolCallItem = (groupId, item) => {
|
|
1418
|
+
__privateGet(this, _set).call(this, (state) => {
|
|
1419
|
+
const idx = state.bubbles.findIndex((b) => b.type === "tool_call_group" && b.id === groupId);
|
|
1420
|
+
if (idx === -1) return {};
|
|
1421
|
+
const group = state.bubbles[idx];
|
|
1422
|
+
if (group.items.some((it) => it.id === item.id)) return {};
|
|
1423
|
+
const nextBubbles = [...state.bubbles];
|
|
1424
|
+
nextBubbles[idx] = { ...group, items: [...group.items, item] };
|
|
1425
|
+
return { bubbles: nextBubbles };
|
|
1426
|
+
});
|
|
1427
|
+
};
|
|
1345
1428
|
this.updateLastBubble = (bubble) => {
|
|
1346
1429
|
const { bubbles } = __privateGet(this, _get).call(this);
|
|
1347
1430
|
if (bubbles.length === 0) return;
|
|
@@ -1381,12 +1464,12 @@ const flattenActions = (actions) => {
|
|
|
1381
1464
|
}
|
|
1382
1465
|
return result;
|
|
1383
1466
|
};
|
|
1384
|
-
|
|
1385
|
-
...
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
return createStore()(
|
|
1467
|
+
function createAgentStore(initialBubbles) {
|
|
1468
|
+
const stateCreator = (...params) => ({
|
|
1469
|
+
...createInitialAgentStoreState(initialBubbles),
|
|
1470
|
+
...flattenActions([createAgentStoreSlice(...params)])
|
|
1471
|
+
});
|
|
1472
|
+
return createStore()(stateCreator);
|
|
1390
1473
|
}
|
|
1391
1474
|
export {
|
|
1392
1475
|
BaseEveryUserContentProvider,
|
package/dist/initialState.d.ts
CHANGED
|
@@ -59,5 +59,5 @@ export type AgentStoreState = {
|
|
|
59
59
|
diffState: DiffState | null;
|
|
60
60
|
reviewState: ReviewState | null;
|
|
61
61
|
};
|
|
62
|
-
export declare function createInitialAgentStoreState(): AgentStoreState;
|
|
62
|
+
export declare function createInitialAgentStoreState(initialBubbles?: ChatBubble[]): AgentStoreState;
|
|
63
63
|
//# sourceMappingURL=initialState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialState.d.ts","sourceRoot":"","sources":["../src/initialState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAE/E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3D;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GACxE;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IA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K,EAAE,iBAAiB,EAAE,CAAA;CAAE,GACnE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC7E;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7C,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,SAAS,GACT,UAAU,GACV,cAAc,GACd,SAAS,GACT,MAAM,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,wBAAgB,4BAA4B,CAAC,cAAc,CAAC,EAAE,UAAU,EAAE,GAAG,eAAe,CAO3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse-openai.d.ts","sourceRoot":"","sources":["../../src/provider/sse-openai.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"sse-openai.d.ts","sourceRoot":"","sources":["../../src/provider/sse-openai.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAS5C,wBAAuB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,CAmJjF"}
|
package/dist/store-actions.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export type AgentStoreActionMethods = {
|
|
|
22
22
|
setStatus: (status: AgentStoreStatus) => void;
|
|
23
23
|
updateLastBubble: (bubble: ChatBubble) => void;
|
|
24
24
|
updateToolCallItem: (groupId: string, itemId: string, patch: Partial<import('./initialState').ToolCallGroupItem>) => void;
|
|
25
|
+
addToolCallItem: (groupId: string, item: import('./initialState').ToolCallGroupItem) => void;
|
|
25
26
|
};
|
|
26
27
|
type Setter = StoreSetter<AgentStoreShape & AgentStoreActionMethods>;
|
|
27
28
|
export declare function createAgentStoreSlice(set: Setter, get: () => AgentStoreShape & AgentStoreActionMethods, api?: StoreApi<AgentStoreShape & AgentStoreActionMethods>): AgentStoreActionImpl;
|
|
@@ -39,6 +40,7 @@ export declare class AgentStoreActionImpl {
|
|
|
39
40
|
setReviewState: (reviewState: ReviewState | null) => void;
|
|
40
41
|
setStatus: (status: AgentStoreStatus) => void;
|
|
41
42
|
updateToolCallItem: (groupId: string, itemId: string, patch: Partial<import('./initialState').ToolCallGroupItem>) => void;
|
|
43
|
+
addToolCallItem: (groupId: string, item: import('./initialState').ToolCallGroupItem) => void;
|
|
42
44
|
updateLastBubble: (bubble: ChatBubble) => void;
|
|
43
45
|
}
|
|
44
46
|
export type AgentStoreActions = Pick<AgentStoreActionImpl, keyof AgentStoreActionImpl>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-actions.d.ts","sourceRoot":"","sources":["../src/store-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AAOxB,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,SAAS,EAAE,SAAS,GAAG,IAAI,C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;AAED,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,oBAAoB,CAAC,CAAC"}
|
package/dist/store.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { StoreApi } from 'zustand/vanilla';
|
|
2
|
-
import { AgentStoreState } from './initialState';
|
|
2
|
+
import { AgentStoreState, ChatBubble } from './initialState';
|
|
3
3
|
import { AgentStoreActions } from './store-actions';
|
|
4
4
|
export type { AgentStoreState, ChatBubble } from './initialState';
|
|
5
5
|
export type { AgentStoreActions } from './store-actions';
|
|
6
6
|
export type AgentStoreSlice = AgentStoreState & AgentStoreActions;
|
|
7
7
|
export type AgentStore = StoreApi<AgentStoreSlice>;
|
|
8
|
-
export declare function createAgentStore(): AgentStore;
|
|
8
|
+
export declare function createAgentStore(initialBubbles?: ChatBubble[]): AgentStore;
|
|
9
9
|
//# sourceMappingURL=store.d.ts.map
|
package/dist/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhF,OAAO,
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhF,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,iBAAiB,EAAyB,MAAM,iBAAiB,CAAC;AAGhF,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAClE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,iBAAiB,CAAC;AAClE,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;AAEnD,wBAAgB,gBAAgB,CAAC,cAAc,CAAC,EAAE,UAAU,EAAE,GAAG,UAAU,CAM1E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-agent-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.99",
|
|
4
4
|
"description": "Headless AI agent protocol, diff engine, and store for Lexical editor",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"nanoid": "^5.1.6",
|
|
24
24
|
"zustand": "^5.0.12",
|
|
25
|
-
"@haklex/rich-litexml": "0.0.
|
|
25
|
+
"@haklex/rich-litexml": "0.0.99"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"lexical": "^0.42.0",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"vite": "^7.3.1",
|
|
31
31
|
"vite-plugin-dts": "^4.5.4",
|
|
32
32
|
"vitest": "^4.0.18",
|
|
33
|
-
"@haklex/rich-editor": "0.0.
|
|
33
|
+
"@haklex/rich-editor": "0.0.99"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"lexical": "^0.42.0",
|
|
37
|
-
"@haklex/rich-editor": "0.0.
|
|
37
|
+
"@haklex/rich-editor": "0.0.99"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|