@tangle-network/agent-app 0.60.98 → 0.60.100
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/assistant/index.js +4 -4
- package/dist/chat-react/index.js +3 -3
- package/dist/chat-routes/index.d.ts +1 -0
- package/dist/chat-routes/index.js +101 -4
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/chat-routes/router-producer.d.ts +17 -0
- package/dist/{chunk-EBNIZHRX.js → chunk-BPN4TEAT.js} +2 -2
- package/dist/{chunk-BOEWSEGC.js → chunk-N2UQIEWN.js} +2 -2
- package/dist/chunk-TQ7K5FRG.js +442 -0
- package/dist/chunk-TQ7K5FRG.js.map +1 -0
- package/dist/{chunk-CYGXIJCQ.js → chunk-VIYABB6R.js} +2 -2
- package/dist/{chunk-MCYJON3F.js → chunk-WVESWAJJ.js} +22 -1
- package/dist/chunk-WVESWAJJ.js.map +1 -0
- package/dist/{chunk-6OQYTH7T.js → chunk-YL5ZTCRU.js} +3 -3
- package/dist/harness/index.d.ts +17 -0
- package/dist/harness/index.js +3 -1
- package/dist/public-consultation/index.d.ts +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +12 -142
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/openai-stream.d.ts +2 -0
- package/dist/runtime/router-turn.d.ts +135 -0
- package/dist/sandbox/index.js +2 -2
- package/dist/skills-placement/index.js +1 -1
- package/dist/web-react/agent-profile-editor.js +3 -3
- package/dist/web-react/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-MCYJON3F.js.map +0 -1
- package/dist/chunk-RN2N75EI.js +0 -119
- package/dist/chunk-RN2N75EI.js.map +0 -1
- /package/dist/{chunk-EBNIZHRX.js.map → chunk-BPN4TEAT.js.map} +0 -0
- /package/dist/{chunk-BOEWSEGC.js.map → chunk-N2UQIEWN.js.map} +0 -0
- /package/dist/{chunk-CYGXIJCQ.js.map → chunk-VIYABB6R.js.map} +0 -0
- /package/dist/{chunk-6OQYTH7T.js.map → chunk-YL5ZTCRU.js.map} +0 -0
package/dist/assistant/index.js
CHANGED
|
@@ -6,14 +6,14 @@ import "../chunk-3HUFJ5LO.js";
|
|
|
6
6
|
import "../chunk-FBVLEGEG.js";
|
|
7
7
|
import {
|
|
8
8
|
ChatComposer
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-VIYABB6R.js";
|
|
10
10
|
import "../chunk-L7MB2LLM.js";
|
|
11
11
|
import "../chunk-KHCJKVQN.js";
|
|
12
12
|
import "../chunk-XEURJVS5.js";
|
|
13
13
|
import "../chunk-E4AY62T2.js";
|
|
14
14
|
import "../chunk-SJWIZT7B.js";
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-YL5ZTCRU.js";
|
|
16
|
+
import "../chunk-BPN4TEAT.js";
|
|
17
17
|
import "../chunk-NJDQ2JCP.js";
|
|
18
18
|
import {
|
|
19
19
|
ModelPicker
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from "../chunk-LSUELMHY.js";
|
|
27
27
|
import "../chunk-FQYAJYPW.js";
|
|
28
28
|
import "../chunk-ZMU54CBG.js";
|
|
29
|
-
import "../chunk-
|
|
29
|
+
import "../chunk-WVESWAJJ.js";
|
|
30
30
|
import "../chunk-B7CL7ENS.js";
|
|
31
31
|
import "../chunk-PV33JZKV.js";
|
|
32
32
|
import "../chunk-7YA4QNTU.js";
|
package/dist/chat-react/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ComposerModeControls,
|
|
3
3
|
EntryComposer
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-VIYABB6R.js";
|
|
5
5
|
import "../chunk-L7MB2LLM.js";
|
|
6
6
|
import "../chunk-SJWIZT7B.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-BPN4TEAT.js";
|
|
8
8
|
import "../chunk-NJDQ2JCP.js";
|
|
9
9
|
import "../chunk-HG4OONJA.js";
|
|
10
10
|
import "../chunk-MLG6XKPV.js";
|
|
11
11
|
import "../chunk-ZMU54CBG.js";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-WVESWAJJ.js";
|
|
13
13
|
import "../chunk-7YA4QNTU.js";
|
|
14
14
|
import "../chunk-6E7LKHYV.js";
|
|
15
15
|
import "../chunk-TXD5HXLE.js";
|
|
@@ -14,6 +14,7 @@ export * from './turn-progress';
|
|
|
14
14
|
export * from './gateway-adapter';
|
|
15
15
|
export * from './stale-turn-lock';
|
|
16
16
|
export * from './sandbox-producer';
|
|
17
|
+
export * from './router-producer';
|
|
17
18
|
export * from './protected-runtime-producer';
|
|
18
19
|
export * from './model-failover-stream';
|
|
19
20
|
export * from './draft-persistence';
|
|
@@ -42,9 +42,9 @@ import {
|
|
|
42
42
|
flattenHistory,
|
|
43
43
|
readSandboxBinaryBytes,
|
|
44
44
|
statSandboxFileSize
|
|
45
|
-
} from "../chunk-
|
|
45
|
+
} from "../chunk-N2UQIEWN.js";
|
|
46
46
|
import "../chunk-4LBCTFBP.js";
|
|
47
|
-
import "../chunk-
|
|
47
|
+
import "../chunk-WVESWAJJ.js";
|
|
48
48
|
import "../chunk-LWSJK546.js";
|
|
49
49
|
import "../chunk-KSITU6BQ.js";
|
|
50
50
|
import "../chunk-6A7MYOUI.js";
|
|
@@ -54,9 +54,11 @@ import "../chunk-BMZTYGKE.js";
|
|
|
54
54
|
import "../chunk-UGWQLQDS.js";
|
|
55
55
|
import "../chunk-TMOYOMSW.js";
|
|
56
56
|
import {
|
|
57
|
-
ProtectedModelSettlementError
|
|
58
|
-
|
|
57
|
+
ProtectedModelSettlementError,
|
|
58
|
+
runRouterTurn
|
|
59
|
+
} from "../chunk-TQ7K5FRG.js";
|
|
59
60
|
import "../chunk-D6UJEOZQ.js";
|
|
61
|
+
import "../chunk-7YA4QNTU.js";
|
|
60
62
|
import {
|
|
61
63
|
assistantRowIdForTurn,
|
|
62
64
|
createAssistantDraftWriter,
|
|
@@ -1147,6 +1149,100 @@ ${diagnostic.userMessage}` : diagnostic.userMessage;
|
|
|
1147
1149
|
};
|
|
1148
1150
|
}
|
|
1149
1151
|
|
|
1152
|
+
// src/chat-routes/router-producer.ts
|
|
1153
|
+
function createRouterTurnProducer(options) {
|
|
1154
|
+
const queue = [];
|
|
1155
|
+
let wake = null;
|
|
1156
|
+
let done = false;
|
|
1157
|
+
let outcome = null;
|
|
1158
|
+
const parts = [];
|
|
1159
|
+
const toolParts = /* @__PURE__ */ new Map();
|
|
1160
|
+
let textPart = null;
|
|
1161
|
+
let textSegment = 0;
|
|
1162
|
+
const push = (event) => {
|
|
1163
|
+
queue.push(event);
|
|
1164
|
+
wake?.();
|
|
1165
|
+
};
|
|
1166
|
+
const run = runRouterTurn({
|
|
1167
|
+
...options,
|
|
1168
|
+
onEvent: (event) => {
|
|
1169
|
+
if (event.type === "text") {
|
|
1170
|
+
if (event.segment !== textSegment || !textPart) {
|
|
1171
|
+
textSegment = event.segment;
|
|
1172
|
+
textPart = { type: "text", text: "" };
|
|
1173
|
+
parts.push(textPart);
|
|
1174
|
+
}
|
|
1175
|
+
textPart.text += event.delta;
|
|
1176
|
+
push({ type: "text", text: event.delta });
|
|
1177
|
+
} else if (event.type === "tool") {
|
|
1178
|
+
if (event.status === "running") {
|
|
1179
|
+
const part = {
|
|
1180
|
+
type: "tool",
|
|
1181
|
+
id: event.callId,
|
|
1182
|
+
callID: event.callId,
|
|
1183
|
+
tool: event.toolName,
|
|
1184
|
+
state: { status: "running", input: event.input, time: { start: event.startedAt } }
|
|
1185
|
+
};
|
|
1186
|
+
toolParts.set(event.callId, part);
|
|
1187
|
+
parts.push(part);
|
|
1188
|
+
push({ type: "tool_call", call: { toolCallId: event.callId, toolName: event.toolName, args: event.input } });
|
|
1189
|
+
} else {
|
|
1190
|
+
const part = toolParts.get(event.callId);
|
|
1191
|
+
const state = event.status === "completed" ? { status: "completed", output: event.output, time: { start: event.startedAt, end: event.endedAt } } : { status: "error", error: event.error.message, time: { start: event.startedAt, end: event.endedAt } };
|
|
1192
|
+
if (part) part.state = { ...part.state, ...state };
|
|
1193
|
+
push({
|
|
1194
|
+
type: "tool_result",
|
|
1195
|
+
toolCallId: event.callId,
|
|
1196
|
+
toolName: event.toolName,
|
|
1197
|
+
outcome: event.status === "completed" ? { ok: true, result: event.output } : { ok: false, message: event.error.message }
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
} else if (event.type === "usage") {
|
|
1201
|
+
push({ type: "usage", usage: { promptTokens: event.promptTokens, completionTokens: event.completionTokens } });
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
}).then((result) => {
|
|
1205
|
+
outcome = result;
|
|
1206
|
+
options.onOutcome?.(result);
|
|
1207
|
+
if (result.failure) {
|
|
1208
|
+
push({ type: "error", data: { message: result.failure.message, code: result.failure.code } });
|
|
1209
|
+
}
|
|
1210
|
+
}).finally(() => {
|
|
1211
|
+
done = true;
|
|
1212
|
+
wake?.();
|
|
1213
|
+
});
|
|
1214
|
+
async function* stream() {
|
|
1215
|
+
for (; ; ) {
|
|
1216
|
+
while (queue.length) yield queue.shift();
|
|
1217
|
+
if (done) break;
|
|
1218
|
+
await new Promise((resolve) => {
|
|
1219
|
+
wake = resolve;
|
|
1220
|
+
});
|
|
1221
|
+
wake = null;
|
|
1222
|
+
}
|
|
1223
|
+
await run;
|
|
1224
|
+
}
|
|
1225
|
+
const usage = () => ({
|
|
1226
|
+
inputTokens: outcome?.usage.promptTokens ?? 0,
|
|
1227
|
+
outputTokens: outcome?.usage.completionTokens ?? 0
|
|
1228
|
+
});
|
|
1229
|
+
return {
|
|
1230
|
+
stream: stream(),
|
|
1231
|
+
finalText: () => outcome?.text ?? "",
|
|
1232
|
+
assistantParts: () => parts.map((part) => ({ ...part })),
|
|
1233
|
+
draftParts: () => parts.map((part) => ({ ...part })),
|
|
1234
|
+
usage,
|
|
1235
|
+
get model() {
|
|
1236
|
+
return outcome?.servedModel ?? options.model;
|
|
1237
|
+
},
|
|
1238
|
+
modelAttribution: () => ({
|
|
1239
|
+
requestedModel: options.model,
|
|
1240
|
+
...outcome?.servedModel ? { servedModel: outcome.servedModel } : {},
|
|
1241
|
+
echoReceived: Boolean(outcome?.servedModel)
|
|
1242
|
+
})
|
|
1243
|
+
};
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1150
1246
|
// src/chat-routes/protected-runtime-producer.ts
|
|
1151
1247
|
import { createExecutor, streamAgentTurn } from "@tangle-network/agent-runtime/kernel";
|
|
1152
1248
|
import {
|
|
@@ -3447,6 +3543,7 @@ export {
|
|
|
3447
3543
|
createChatTurnRoutes,
|
|
3448
3544
|
createD1PlanFollowUpGate,
|
|
3449
3545
|
createProtectedRuntimeChatProducer,
|
|
3546
|
+
createRouterTurnProducer,
|
|
3450
3547
|
createSandboxChatProducer,
|
|
3451
3548
|
createSandboxFileIndexRoute,
|
|
3452
3549
|
createUploadRoute,
|