@tangle-network/agent-app 4.0.1 → 4.0.2
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-profiles/d1.js +1 -1
- package/dist/agent-profiles/index.d.ts +2 -1
- package/dist/agent-profiles/index.js +1 -1
- package/dist/chat-routes/index.js +12 -17
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/chat-routes/visible-text.d.ts +7 -0
- package/dist/{chunk-AFMLLZWU.js → chunk-GWATTXFR.js} +3 -3
- package/dist/{chunk-AFMLLZWU.js.map → chunk-GWATTXFR.js.map} +1 -1
- package/dist/{chunk-HES3IABJ.js → chunk-JKYCXQFI.js} +2 -2
- package/dist/{chunk-5DAEU3CP.js → chunk-SJKQUTGU.js} +11 -6
- package/dist/chunk-SJKQUTGU.js.map +1 -0
- package/dist/{chunk-JSWBJBPM.js → chunk-W5YQZEE4.js} +15 -10
- package/dist/chunk-W5YQZEE4.js.map +1 -0
- package/dist/{chunk-PISTUUEZ.js → chunk-XCUT2I52.js} +25 -12
- package/dist/{chunk-PISTUUEZ.js.map → chunk-XCUT2I52.js.map} +1 -1
- package/dist/{chunk-BRQ2SC6V.js → chunk-XKVJQVOT.js} +2 -1
- package/dist/chunk-XKVJQVOT.js.map +1 -0
- package/dist/preset-cloudflare/index.js +2 -2
- package/dist/public-consultation/index.d.ts +1 -1
- package/dist/public-consultation/index.js +5 -3
- package/dist/public-consultation/index.js.map +1 -1
- package/dist/runtime/index.js +4 -2
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/router-turn.d.ts +15 -0
- package/dist/runtime/router-turn.js +3 -1
- package/package.json +1 -1
- package/dist/chunk-5DAEU3CP.js.map +0 -1
- package/dist/chunk-BRQ2SC6V.js.map +0 -1
- package/dist/chunk-JSWBJBPM.js.map +0 -1
- /package/dist/{chunk-HES3IABJ.js.map → chunk-JKYCXQFI.js.map} +0 -0
|
@@ -532,6 +532,9 @@ function workspaceTurnCheckpoints(store, workspaceId, actor) {
|
|
|
532
532
|
}
|
|
533
533
|
|
|
534
534
|
// src/runtime/router-turn.ts
|
|
535
|
+
function narratesBefore(tool) {
|
|
536
|
+
return tool?.effect === "lookup";
|
|
537
|
+
}
|
|
535
538
|
function placeRouterTurn(input) {
|
|
536
539
|
return placeExecution({
|
|
537
540
|
profile: input.profile,
|
|
@@ -640,6 +643,7 @@ async function runRouterTurn(options) {
|
|
|
640
643
|
if (placement?.chosen === "sandbox") {
|
|
641
644
|
return {
|
|
642
645
|
text: "",
|
|
646
|
+
answer: "",
|
|
643
647
|
servedModel: null,
|
|
644
648
|
toolCalls: [],
|
|
645
649
|
usage: { promptTokens: 0, completionTokens: 0, modelCalls: 0 },
|
|
@@ -652,6 +656,7 @@ async function runRouterTurn(options) {
|
|
|
652
656
|
if (!apiKey) {
|
|
653
657
|
return {
|
|
654
658
|
text: "",
|
|
659
|
+
answer: "",
|
|
655
660
|
servedModel: null,
|
|
656
661
|
toolCalls: [],
|
|
657
662
|
usage: { promptTokens: 0, completionTokens: 0, modelCalls: 0 },
|
|
@@ -711,6 +716,7 @@ async function runRouterTurn(options) {
|
|
|
711
716
|
}
|
|
712
717
|
});
|
|
713
718
|
const segments = [];
|
|
719
|
+
const narrated = /* @__PURE__ */ new Set();
|
|
714
720
|
const usage = { promptTokens: 0, completionTokens: 0, modelCalls: 0 };
|
|
715
721
|
const reasoning = { deltas: 0, chars: 0 };
|
|
716
722
|
const toolCalls = [];
|
|
@@ -811,8 +817,9 @@ async function runRouterTurn(options) {
|
|
|
811
817
|
} else if (event.type === "tool_call_start") {
|
|
812
818
|
emit({ type: "tool_start", toolName: byFunction.get(event.toolName)?.name ?? event.toolName });
|
|
813
819
|
} else if (event.type === "tool_call") {
|
|
814
|
-
segmentOpen = false;
|
|
815
820
|
const tool = byFunction.get(event.call.toolName);
|
|
821
|
+
if (segmentOpen && narratesBefore(tool)) narrated.add(segments.length - 1);
|
|
822
|
+
segmentOpen = false;
|
|
816
823
|
event.call.toolCallId ||= callIdOf(void 0, event.call.toolName);
|
|
817
824
|
const callId = event.call.toolCallId;
|
|
818
825
|
started.set(callId, Date.now());
|
|
@@ -861,16 +868,21 @@ async function runRouterTurn(options) {
|
|
|
861
868
|
}
|
|
862
869
|
return "completed";
|
|
863
870
|
};
|
|
864
|
-
const outcome = (failure) =>
|
|
865
|
-
text
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
871
|
+
const outcome = (failure) => {
|
|
872
|
+
const text = joinText([options.continueFrom?.text ?? "", ...segments]);
|
|
873
|
+
const answer = joinText(segments.filter((_segment, index) => !narrated.has(index)));
|
|
874
|
+
return {
|
|
875
|
+
text,
|
|
876
|
+
answer: answer || text,
|
|
877
|
+
servedModel,
|
|
878
|
+
toolCalls,
|
|
879
|
+
usage: { ...usage },
|
|
880
|
+
reasoning: { ...reasoning },
|
|
881
|
+
toolEvents: [...toolEvents],
|
|
882
|
+
...placement ? { placement } : {},
|
|
883
|
+
...failure ? { failure } : {}
|
|
884
|
+
};
|
|
885
|
+
};
|
|
874
886
|
const repeat = options.repeat !== false;
|
|
875
887
|
const repeats = !repeat ? [] : options.fallbackModels?.length ? [...options.fallbackModels] : [options.model];
|
|
876
888
|
let stop;
|
|
@@ -978,6 +990,7 @@ export {
|
|
|
978
990
|
DURABLE_HOP_BUDGET_MS,
|
|
979
991
|
turnCheckpointPath,
|
|
980
992
|
workspaceTurnCheckpoints,
|
|
993
|
+
narratesBefore,
|
|
981
994
|
placeRouterTurn,
|
|
982
995
|
routerFunctionName,
|
|
983
996
|
perTurnPrefixBytes,
|
|
@@ -985,4 +998,4 @@ export {
|
|
|
985
998
|
composeRouterTurnPrompt,
|
|
986
999
|
runRouterTurn
|
|
987
1000
|
};
|
|
988
|
-
//# sourceMappingURL=chunk-
|
|
1001
|
+
//# sourceMappingURL=chunk-XCUT2I52.js.map
|