nolo-cli 0.8.0-alpha.11 → 0.8.0-alpha.13
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/{_executeModel-GPU2276G.js → _executeModel-EBU7YBDV.js} +26 -22
- package/{action-PAXRPJJF.js → action-SQGI5JY5.js} +5 -4
- package/{addContentAction-CZVWF3QZ.js → addContentAction-ZX2PUS3X.js} +4 -3
- package/{addDialogAgentAction-CCIDTPHC.js → addDialogAgentAction-ULADQX2Q.js} +3 -2
- package/{agentDeleteCommand-4ZZFM6AT.js → agentDeleteCommand-GNVYHOGZ.js} +11 -8
- package/{agentEmailCommands-C4FIVQYV.js → agentEmailCommands-IC52LATA.js} +29 -25
- package/{agentListCommands-VQAKVNEX.js → agentListCommands-FM4OWXYT.js} +12 -9
- package/{agentMachineCommands-ONFDXZUQ.js → agentMachineCommands-SFWC6KN4.js} +11 -8
- package/{agentRecordCommands-QANUGHLK.js → agentRecordCommands-VLMLWLCM.js} +29 -25
- package/{agentRunCommand-A3OSRB5Q.js → agentRunCommand-D2PVHUGR.js} +30 -25
- package/{agentRuntimeLocal-62ZB2ODP.js → agentRuntimeLocal-XL5PLRJV.js} +16 -12
- package/{agentSlice-GCGLVR2N.js → agentSlice-IIC7AISR.js} +5 -4
- package/{chunk-YOUZDXU7.js → chunk-3N55DSXH.js} +21 -17
- package/chunk-4ZDM73SD.js +34 -0
- package/{chunk-TDIQFT2F.js → chunk-5CS33IBL.js} +1 -1
- package/{chunk-IYQV26RA.js → chunk-6A3LI5TZ.js} +2 -2
- package/{chunk-VEJLAVTC.js → chunk-6CBN7GGH.js} +2 -2
- package/{chunk-BSTNFPHD.js → chunk-6XKX2N2E.js} +1 -1
- package/{chunk-7OC5VCLW.js → chunk-7EPLXPTM.js} +4 -4
- package/{chunk-GCMRDRCQ.js → chunk-7IPLJUYC.js} +1 -1
- package/{chunk-53DNV5AT.js → chunk-7U4TQSWU.js} +3 -3
- package/{chunk-GGUO4FKF.js → chunk-7XN726FS.js} +41 -19
- package/{chunk-I3D64LRJ.js → chunk-BKPVTIEK.js} +4 -4
- package/{chunk-7YLKNMOM.js → chunk-DAB7DRXD.js} +6 -6
- package/{chunk-LM25IZBJ.js → chunk-DG7AAAR3.js} +1 -1
- package/{chunk-F6QQI5YI.js → chunk-DGFWICQJ.js} +1 -1
- package/chunk-DSNONPGW.js +386 -0
- package/{chunk-LAWBMYBC.js → chunk-FE2TZO7Z.js} +2 -2
- package/{chunk-R2HXWML7.js → chunk-HLM6MG7F.js} +19 -20
- package/chunk-I42VC5KR.js +15 -0
- package/{chunk-J5KV47ZW.js → chunk-IBJC3GOP.js} +2 -2
- package/chunk-JEXVIMYZ.js +55 -0
- package/{chunk-6B7G54GE.js → chunk-KH4OXCBK.js} +5 -5
- package/{chunk-SYOF5TAS.js → chunk-MXLQWBVM.js} +36 -95
- package/chunk-OPZYGHUC.js +89 -0
- package/{chunk-J4576WMJ.js → chunk-PCWC3JTN.js} +1 -1
- package/{chunk-HEIIIZBX.js → chunk-Q2YZULBH.js} +1 -1
- package/{chunk-KB7YFGL6.js → chunk-Q3K5K4KS.js} +1 -1
- package/{chunk-IAXBCTTE.js → chunk-QO4YO77G.js} +2 -2
- package/{chunk-GGXABIPP.js → chunk-RJKDVL4L.js} +2 -2
- package/{chunk-CJH2VTEU.js → chunk-RLCFUU46.js} +3 -3
- package/{chunk-2UZXR7WO.js → chunk-SACYB45H.js} +19 -378
- package/{chunk-PN7AFLOK.js → chunk-SH2CFQOH.js} +3 -13
- package/{chunk-XBIUN5CR.js → chunk-TWPGVS2U.js} +2 -2
- package/{chunk-G5H7RNFL.js → chunk-V2AISYMA.js} +2 -2
- package/{chunk-TZNCFAUP.js → chunk-XOH46MRF.js} +8 -15
- package/{chunk-CQAHS7YO.js → chunk-YDESHYQC.js} +56 -12
- package/{chunk-AUGHVUFE.js → chunk-YYUCRDOK.js} +1 -1
- package/{chunk-H2RMRZJE.js → chunk-ZDXZSXYQ.js} +1 -1
- package/{chunk-NXZGF7F7.js → chunk-ZQ2UM4KG.js} +1 -1
- package/{chunk-QR5IPGT3.js → chunk-ZRS4MX3R.js} +170 -176
- package/{createAgentAutomationAction-537X433B.js → createAgentAutomationAction-GNRYFKTT.js} +12 -10
- package/{createDialogAction-YUD4RKBS.js → createDialogAction-Q4ISCARO.js} +15 -13
- package/{createPageAction-KJMFHL4C.js → createPageAction-7YCAZPK3.js} +13 -11
- package/{dbSlice-C4UJLRZP.js → dbSlice-TO2TSMWM.js} +3 -2
- package/{dialogCommands-H74KJKHC.js → dialogCommands-DWSE4PMW.js} +13 -10
- package/{dialogSlice-ETSD4YWS.js → dialogSlice-5KZA46HM.js} +12 -10
- package/{docCreateCommands-ADUSU34K.js → docCreateCommands-UFJL5PUM.js} +12 -9
- package/{docDeleteCommands-ZXV3S5OS.js → docDeleteCommands-XHEIBAB2.js} +13 -10
- package/{docReadCommands-YYYI6LT7.js → docReadCommands-PEDIC2CW.js} +12 -9
- package/{docStore-ZBF5DDKR.js → docStore-M7K7QFVS.js} +13 -11
- package/{docUpdateCommands-7MGJ3BYA.js → docUpdateCommands-WBRODQ7P.js} +12 -9
- package/{fetchMessages-JOCYIFKL.js → fetchMessages-U6ZHN56A.js} +3 -2
- package/{handleSendMessageAction-MGKI62Y6.js → handleSendMessageAction-SEV4YIPL.js} +12 -10
- package/index.js +40 -36
- package/{localDialogRead-D3BELSTF.js → localDialogRead-Z5UTAJPU.js} +1 -1
- package/{machineCommands-RMTMN7VQ.js → machineCommands-T4DN3MOU.js} +28 -24
- package/{machineWsRunDispatch-UIP355FN.js → machineWsRunDispatch-QRIIT2AK.js} +28 -24
- package/package.json +1 -1
- package/{readlineWorkspace-CRNQRZ6D.js → readlineWorkspace-DXOTOVHL.js} +163 -31
- package/{removeDialogAgentAction-CXLST3N6.js → removeDialogAgentAction-3MUQGFZX.js} +5 -4
- package/{runAgentClientLoop-2S334SGA.js → runAgentClientLoop-UEQEP3XG.js} +21 -19
- package/{setDialogExtraReferencesAction-LP6VYGU7.js → setDialogExtraReferencesAction-MXHX2HPK.js} +3 -2
- package/{setPrimaryDialogAgentAction-D3GGH23T.js → setPrimaryDialogAgentAction-7DLDZHDT.js} +5 -4
- package/{settingSlice-J4I3Z5H7.js → settingSlice-PNLASZGI.js} +4 -3
- package/{spaceCommands-NDEWMFZJ.js → spaceCommands-ORSFAWEY.js} +11 -8
- package/{spaceSlice-RLB6RTHO.js → spaceSlice-HOMW64JA.js} +12 -10
- package/{streamAgentChatTurn-Y2TTYPBD.js → streamAgentChatTurn-REWDBIL3.js} +28 -26
- package/{tools-YZYLY2ZQ.js → tools-L4UQS5VW.js} +19 -17
- package/tuiSummaryLlmCaller-JSI4GL6W.js +78 -0
- package/{understanding-HCSFPE7R.js → understanding-YH4X3XU6.js} +3 -2
- package/{updateDialogTitleAction-LQV6QLBW.js → updateDialogTitleAction-CKLNP73H.js} +14 -11
|
@@ -1,29 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyChatCompletionDelta,
|
|
3
|
+
finalizeAccumulatedToolCalls,
|
|
4
|
+
flushChatCompletionStream,
|
|
5
|
+
readSseFrames,
|
|
6
|
+
throwIfChatCompletionStreamFailed,
|
|
7
|
+
toOpenAiCompatibleMessages
|
|
8
|
+
} from "./chunk-DSNONPGW.js";
|
|
9
|
+
import {
|
|
10
|
+
parseToolArgumentsJson
|
|
11
|
+
} from "./chunk-MXLQWBVM.js";
|
|
1
12
|
import {
|
|
2
13
|
createThinkParserState,
|
|
3
|
-
extractThinkContent
|
|
4
|
-
|
|
5
|
-
parseToolArgumentsJson,
|
|
6
|
-
processThinkChunk
|
|
7
|
-
} from "./chunk-SYOF5TAS.js";
|
|
14
|
+
extractThinkContent
|
|
15
|
+
} from "./chunk-OPZYGHUC.js";
|
|
8
16
|
import {
|
|
9
17
|
buildProviderAuthHeaders,
|
|
10
|
-
buildProviderExecutionPlan
|
|
11
|
-
canUsePlatformChatProvider,
|
|
12
|
-
convertMessagesToResponsesInput,
|
|
13
|
-
extractTextFromResponseOutput,
|
|
14
|
-
extractToolCallsFromResponseOutput,
|
|
15
|
-
hasDirectOpenAiCompatibleProvider,
|
|
16
|
-
resolveAgentRuntimeLocation,
|
|
17
|
-
resolvePlatformAuthToken,
|
|
18
|
-
resolvePlatformServerUrl,
|
|
19
|
-
resolveProviderTransportDecision,
|
|
20
|
-
toResponsesTools
|
|
18
|
+
buildProviderExecutionPlan
|
|
21
19
|
} from "./chunk-XDVAYP26.js";
|
|
22
20
|
import {
|
|
23
21
|
canonicalizeToolName,
|
|
24
22
|
createGlob,
|
|
25
23
|
resolveExecutableOnPath
|
|
26
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-DG7AAAR3.js";
|
|
27
25
|
import {
|
|
28
26
|
toErrorMessage
|
|
29
27
|
} from "./chunk-HNMXYYJR.js";
|
|
@@ -31,9 +29,11 @@ import {
|
|
|
31
29
|
asRecordOrEmpty
|
|
32
30
|
} from "./chunk-KX6YBIHG.js";
|
|
33
31
|
import {
|
|
34
|
-
asTrimmedNonEmptyStringArray,
|
|
35
32
|
dialogMessageKey
|
|
36
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-SH2CFQOH.js";
|
|
34
|
+
import {
|
|
35
|
+
asTrimmedNonEmptyStringArray
|
|
36
|
+
} from "./chunk-I42VC5KR.js";
|
|
37
37
|
import {
|
|
38
38
|
asOptionalFiniteNumber
|
|
39
39
|
} from "./chunk-WWC7I6TA.js";
|
|
@@ -56,119 +56,6 @@ import {
|
|
|
56
56
|
isRecord
|
|
57
57
|
} from "./chunk-KUG52IAP.js";
|
|
58
58
|
|
|
59
|
-
// packages/agent-runtime/toolCallAccumulator.ts
|
|
60
|
-
function accumulateToolCallDelta(accumulated, deltas) {
|
|
61
|
-
for (const delta of deltas) {
|
|
62
|
-
const index = typeof delta.index === "number" ? delta.index : 0;
|
|
63
|
-
const current = accumulated[index] ?? {
|
|
64
|
-
id: "",
|
|
65
|
-
type: "function",
|
|
66
|
-
function: { name: "", arguments: "" }
|
|
67
|
-
};
|
|
68
|
-
if (typeof delta.id === "string" && delta.id) current.id = delta.id;
|
|
69
|
-
const fn = delta.function;
|
|
70
|
-
if (fn && typeof fn === "object") {
|
|
71
|
-
const functionDelta = fn;
|
|
72
|
-
if (typeof functionDelta.name === "string" && functionDelta.name) {
|
|
73
|
-
current.function.name += functionDelta.name;
|
|
74
|
-
}
|
|
75
|
-
if (typeof functionDelta.arguments === "string" && functionDelta.arguments) {
|
|
76
|
-
current.function.arguments += functionDelta.arguments;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
accumulated[index] = current;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function finalizeAccumulatedToolCalls(accumulated) {
|
|
83
|
-
return Object.keys(accumulated).map((key) => accumulated[Number(key)]).filter((call) => call?.function?.name);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// packages/agent-runtime/processChatCompletionDelta.ts
|
|
87
|
-
function extractChatCompletionStreamError(parsed) {
|
|
88
|
-
const raw = parsed?.error;
|
|
89
|
-
if (!raw) return null;
|
|
90
|
-
if (typeof raw === "string") {
|
|
91
|
-
return raw.trim() ? { message: raw.trim() } : null;
|
|
92
|
-
}
|
|
93
|
-
if (typeof raw !== "object") return null;
|
|
94
|
-
const message = typeof raw.msg === "string" && raw.msg.trim() ? raw.msg.trim() : typeof raw.message === "string" && raw.message.trim() ? raw.message.trim() : "";
|
|
95
|
-
const code = typeof raw.code === "string" && raw.code.trim() ? raw.code.trim() : typeof raw.type === "string" && raw.type.trim() ? raw.type.trim() : void 0;
|
|
96
|
-
if (!message && !code) return null;
|
|
97
|
-
return {
|
|
98
|
-
message: message || "upstream stream error",
|
|
99
|
-
...code ? { code } : {}
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function throwIfChatCompletionStreamFailed(state) {
|
|
103
|
-
const failure = state.streamError;
|
|
104
|
-
if (!failure) return;
|
|
105
|
-
const error = new Error(
|
|
106
|
-
failure.code ? `${failure.message} (${failure.code})` : failure.message
|
|
107
|
-
);
|
|
108
|
-
if (failure.code) error.code = failure.code;
|
|
109
|
-
throw error;
|
|
110
|
-
}
|
|
111
|
-
function applyChatCompletionDelta(parsed, state) {
|
|
112
|
-
const streamError = extractChatCompletionStreamError(parsed);
|
|
113
|
-
if (streamError && !state.streamError) {
|
|
114
|
-
state.streamError = streamError;
|
|
115
|
-
}
|
|
116
|
-
if (parsed?.usage && typeof parsed.usage === "object") {
|
|
117
|
-
state.usage = parsed.usage;
|
|
118
|
-
}
|
|
119
|
-
const rawFinishReason = parsed?.choices?.[0]?.finish_reason;
|
|
120
|
-
if (typeof rawFinishReason === "string" && rawFinishReason.length > 0) {
|
|
121
|
-
state.finishReason = rawFinishReason;
|
|
122
|
-
}
|
|
123
|
-
const delta = parsed?.choices?.[0]?.delta;
|
|
124
|
-
if (!delta || typeof delta !== "object") return false;
|
|
125
|
-
const reasoningChunk = typeof delta.reasoning_content === "string" ? delta.reasoning_content : typeof delta.reasoning === "string" ? delta.reasoning : "";
|
|
126
|
-
if (reasoningChunk) {
|
|
127
|
-
state.reasoning += reasoningChunk;
|
|
128
|
-
state.onReasoningDelta?.(reasoningChunk);
|
|
129
|
-
}
|
|
130
|
-
if (Array.isArray(delta.tool_calls) && delta.tool_calls.length > 0) {
|
|
131
|
-
accumulateToolCallDelta(state.accumulatedToolCalls, delta.tool_calls);
|
|
132
|
-
}
|
|
133
|
-
const textChunk = typeof delta.content === "string" ? delta.content : "";
|
|
134
|
-
if (textChunk) {
|
|
135
|
-
const parsedChunk = processThinkChunk(textChunk, state.thinkState);
|
|
136
|
-
state.thinkState = parsedChunk.state;
|
|
137
|
-
if (parsedChunk.content) {
|
|
138
|
-
state.content += parsedChunk.content;
|
|
139
|
-
state.onTextDelta?.(parsedChunk.content);
|
|
140
|
-
}
|
|
141
|
-
if (parsedChunk.reasoning) {
|
|
142
|
-
state.reasoning += parsedChunk.reasoning;
|
|
143
|
-
state.onReasoningDelta?.(parsedChunk.reasoning);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return true;
|
|
147
|
-
}
|
|
148
|
-
function flushChatCompletionStream(state) {
|
|
149
|
-
const flushed = flushThinkParser(state.thinkState);
|
|
150
|
-
state.thinkState = flushed.state;
|
|
151
|
-
if (flushed.content) {
|
|
152
|
-
state.content += flushed.content;
|
|
153
|
-
state.onTextDelta?.(flushed.content);
|
|
154
|
-
}
|
|
155
|
-
if (flushed.reasoning) {
|
|
156
|
-
state.reasoning += flushed.reasoning;
|
|
157
|
-
state.onReasoningDelta?.(flushed.reasoning);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// packages/agent-runtime/openAiCompatibleMessages.ts
|
|
162
|
-
function toOpenAiCompatibleMessages(messages) {
|
|
163
|
-
return messages.map((message) => ({
|
|
164
|
-
role: message.role,
|
|
165
|
-
content: message.content ?? "",
|
|
166
|
-
...message.tool_call_id ? { tool_call_id: message.tool_call_id } : {},
|
|
167
|
-
...Array.isArray(message.tool_calls) ? { tool_calls: message.tool_calls } : {},
|
|
168
|
-
...message.reasoning_content ? { reasoning_content: message.reasoning_content } : {}
|
|
169
|
-
}));
|
|
170
|
-
}
|
|
171
|
-
|
|
172
59
|
// packages/agent-runtime/kimiUserAgent.ts
|
|
173
60
|
var KIMI_CODE_CLI_VERSION = "0.29.2";
|
|
174
61
|
var KIMI_CODE_USER_AGENT = `kimi-code-cli/${KIMI_CODE_CLI_VERSION} (nolo)`;
|
|
@@ -192,51 +79,6 @@ function parseSseDataLineJson(line) {
|
|
|
192
79
|
}
|
|
193
80
|
}
|
|
194
81
|
|
|
195
|
-
// packages/agent-runtime/sseFrames.ts
|
|
196
|
-
async function* readSseFrames(response) {
|
|
197
|
-
const reader = response.body?.getReader();
|
|
198
|
-
if (!reader) {
|
|
199
|
-
throw new Error("SSE response did not include a readable body.");
|
|
200
|
-
}
|
|
201
|
-
const decoder = new TextDecoder();
|
|
202
|
-
let buffer = "";
|
|
203
|
-
while (true) {
|
|
204
|
-
const { done, value } = await reader.read();
|
|
205
|
-
if (done) break;
|
|
206
|
-
buffer += decoder.decode(value, { stream: true });
|
|
207
|
-
let boundary = buffer.indexOf("\n\n");
|
|
208
|
-
while (boundary !== -1) {
|
|
209
|
-
yield buffer.slice(0, boundary);
|
|
210
|
-
buffer = buffer.slice(boundary + 2);
|
|
211
|
-
boundary = buffer.indexOf("\n\n");
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
if (buffer.trim()) yield buffer;
|
|
215
|
-
}
|
|
216
|
-
async function readSseDataValues(response, parse) {
|
|
217
|
-
const reader = response.body?.getReader();
|
|
218
|
-
if (!reader) return [];
|
|
219
|
-
const decoder = new TextDecoder();
|
|
220
|
-
const values = [];
|
|
221
|
-
let buffer = "";
|
|
222
|
-
while (true) {
|
|
223
|
-
const { done, value } = await reader.read();
|
|
224
|
-
if (done) break;
|
|
225
|
-
buffer += decoder.decode(value, { stream: true });
|
|
226
|
-
const lines = buffer.split("\n");
|
|
227
|
-
buffer = lines.pop() ?? "";
|
|
228
|
-
for (const line of lines) {
|
|
229
|
-
const parsed = parse(line);
|
|
230
|
-
if (parsed) values.push(parsed);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
if (buffer.trim()) {
|
|
234
|
-
const parsed = parse(buffer);
|
|
235
|
-
if (parsed) values.push(parsed);
|
|
236
|
-
}
|
|
237
|
-
return values;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
82
|
// packages/agent-runtime/openAiCompatibleProvider.ts
|
|
241
83
|
function buildOpenAiCompatibleChatCompletionRequest(args) {
|
|
242
84
|
const body = {
|
|
@@ -529,199 +371,6 @@ public class NoloCredNative {
|
|
|
529
371
|
}
|
|
530
372
|
`.trim();
|
|
531
373
|
|
|
532
|
-
// packages/agent-runtime/platformChatProvider.ts
|
|
533
|
-
var CHAT_PROXY_PATH = "/api/v1/chat";
|
|
534
|
-
function shouldDisableThinking(providerConfig) {
|
|
535
|
-
return providerConfig.provider.toLowerCase() === "mimo" || /xiaomimimo\.com/i.test(providerConfig.endpoint);
|
|
536
|
-
}
|
|
537
|
-
function isResponsesEndpoint(endpoint) {
|
|
538
|
-
return /\/responses$/i.test(endpoint.trim());
|
|
539
|
-
}
|
|
540
|
-
function toResponsesRequestOptions(options) {
|
|
541
|
-
const next = { ...options };
|
|
542
|
-
const reasoningEffort = next.reasoning_effort;
|
|
543
|
-
if (typeof reasoningEffort === "string" && reasoningEffort) {
|
|
544
|
-
next.reasoning = { effort: reasoningEffort };
|
|
545
|
-
delete next.reasoning_effort;
|
|
546
|
-
}
|
|
547
|
-
if (next.max_tokens !== void 0) {
|
|
548
|
-
next.max_output_tokens = next.max_tokens;
|
|
549
|
-
delete next.max_tokens;
|
|
550
|
-
}
|
|
551
|
-
return next;
|
|
552
|
-
}
|
|
553
|
-
async function resolvePlatformChatProviderConfig(args) {
|
|
554
|
-
const plan = await buildProviderExecutionPlan({
|
|
555
|
-
agentConfig: args.agentConfig,
|
|
556
|
-
env: args.env,
|
|
557
|
-
runtimeKind: "local",
|
|
558
|
-
...args.apiKeyRefResolver ? { apiKeyRefResolver: args.apiKeyRefResolver } : {},
|
|
559
|
-
...args.credentialBroker ? { credentialBroker: args.credentialBroker } : {},
|
|
560
|
-
...args.syncFetcher ? { syncFetcher: args.syncFetcher } : {}
|
|
561
|
-
});
|
|
562
|
-
if (plan.mode === "cli") {
|
|
563
|
-
throw new Error("Platform chat provider does not support cli agents.");
|
|
564
|
-
}
|
|
565
|
-
if (plan.transport === "direct") {
|
|
566
|
-
return {
|
|
567
|
-
serverUrl: resolvePlatformServerUrl(args.env),
|
|
568
|
-
authToken: resolvePlatformAuthToken(args.env),
|
|
569
|
-
agentKey: args.agentConfig.key,
|
|
570
|
-
model: plan.model,
|
|
571
|
-
provider: plan.provider,
|
|
572
|
-
endpoint: plan.endpoint,
|
|
573
|
-
requestOptions: plan.requestOptions,
|
|
574
|
-
...plan.apiKey ? { apiKey: plan.apiKey } : {},
|
|
575
|
-
...plan.apiKeyHeader ? { apiKeyHeader: plan.apiKeyHeader } : {},
|
|
576
|
-
...args.agentConfig.apiSource ? { apiSource: args.agentConfig.apiSource } : {}
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
return {
|
|
580
|
-
serverUrl: plan.serverUrl,
|
|
581
|
-
authToken: plan.authToken,
|
|
582
|
-
agentKey: plan.agentKey,
|
|
583
|
-
model: plan.model,
|
|
584
|
-
provider: plan.provider,
|
|
585
|
-
endpoint: plan.endpoint,
|
|
586
|
-
requestOptions: plan.requestOptions,
|
|
587
|
-
...plan.apiKey ? { apiKey: plan.apiKey } : {},
|
|
588
|
-
...plan.apiKeyHeader ? { apiKeyHeader: plan.apiKeyHeader } : {},
|
|
589
|
-
...plan.apiSource ? { apiSource: plan.apiSource } : {}
|
|
590
|
-
};
|
|
591
|
-
}
|
|
592
|
-
function buildPlatformChatCompletionRequest(args) {
|
|
593
|
-
const usesResponsesApi = isResponsesEndpoint(args.providerConfig.endpoint);
|
|
594
|
-
const requestOptions = usesResponsesApi ? toResponsesRequestOptions(args.providerConfig.requestOptions) : args.providerConfig.requestOptions;
|
|
595
|
-
const body = {
|
|
596
|
-
model: args.providerConfig.model,
|
|
597
|
-
...usesResponsesApi ? { input: convertMessagesToResponsesInput(args.messages) } : { messages: toOpenAiCompatibleMessages(args.messages) },
|
|
598
|
-
stream: args.stream ?? false,
|
|
599
|
-
...args.stream ? { stream_options: { include_usage: true } } : {},
|
|
600
|
-
...requestOptions,
|
|
601
|
-
...args.tools && args.tools.length > 0 ? {
|
|
602
|
-
tools: usesResponsesApi ? toResponsesTools(args.tools) : args.tools,
|
|
603
|
-
...usesResponsesApi ? {} : { tool_choice: "auto" }
|
|
604
|
-
} : {},
|
|
605
|
-
...shouldDisableThinking(args.providerConfig) ? { thinking: { type: "disabled" } } : {},
|
|
606
|
-
url: args.providerConfig.endpoint,
|
|
607
|
-
provider: args.providerConfig.provider,
|
|
608
|
-
agentKey: args.providerConfig.agentKey,
|
|
609
|
-
...args.providerConfig.apiSource ? { apiSource: args.providerConfig.apiSource } : {},
|
|
610
|
-
...args.providerConfig.apiKey ? { KEY: args.providerConfig.apiKey } : {},
|
|
611
|
-
...args.providerConfig.apiKeyHeader ? { apiKeyHeader: args.providerConfig.apiKeyHeader } : {}
|
|
612
|
-
};
|
|
613
|
-
return {
|
|
614
|
-
url: `${args.providerConfig.serverUrl}${CHAT_PROXY_PATH}`,
|
|
615
|
-
init: {
|
|
616
|
-
method: "POST",
|
|
617
|
-
headers: {
|
|
618
|
-
"Content-Type": "application/json",
|
|
619
|
-
Authorization: `Bearer ${args.providerConfig.authToken}`
|
|
620
|
-
},
|
|
621
|
-
body: JSON.stringify(body)
|
|
622
|
-
}
|
|
623
|
-
};
|
|
624
|
-
}
|
|
625
|
-
function tryParseJson(raw) {
|
|
626
|
-
try {
|
|
627
|
-
return JSON.parse(raw);
|
|
628
|
-
} catch {
|
|
629
|
-
return null;
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
function extractJsonObjects(raw) {
|
|
633
|
-
const objects = [];
|
|
634
|
-
let depth = 0;
|
|
635
|
-
let start = -1;
|
|
636
|
-
let inString = false;
|
|
637
|
-
let escaped = false;
|
|
638
|
-
for (let index = 0; index < raw.length; index += 1) {
|
|
639
|
-
const char = raw[index];
|
|
640
|
-
if (inString) {
|
|
641
|
-
if (escaped) {
|
|
642
|
-
escaped = false;
|
|
643
|
-
} else if (char === "\\") {
|
|
644
|
-
escaped = true;
|
|
645
|
-
} else if (char === '"') {
|
|
646
|
-
inString = false;
|
|
647
|
-
}
|
|
648
|
-
continue;
|
|
649
|
-
}
|
|
650
|
-
if (char === '"') {
|
|
651
|
-
inString = true;
|
|
652
|
-
continue;
|
|
653
|
-
}
|
|
654
|
-
if (char === "{") {
|
|
655
|
-
if (depth === 0) start = index;
|
|
656
|
-
depth += 1;
|
|
657
|
-
continue;
|
|
658
|
-
}
|
|
659
|
-
if (char !== "}" || depth === 0) continue;
|
|
660
|
-
depth -= 1;
|
|
661
|
-
if (depth === 0 && start >= 0) {
|
|
662
|
-
const parsed = tryParseJson(raw.slice(start, index + 1));
|
|
663
|
-
if (parsed) objects.push(parsed);
|
|
664
|
-
start = -1;
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
return objects;
|
|
668
|
-
}
|
|
669
|
-
function parsePlatformChatCompletionData(raw) {
|
|
670
|
-
const direct = tryParseJson(raw.trim());
|
|
671
|
-
if (direct) return direct;
|
|
672
|
-
const objects = extractJsonObjects(raw);
|
|
673
|
-
return objects.find((object) => Array.isArray(object?.choices)) ?? objects[0] ?? {};
|
|
674
|
-
}
|
|
675
|
-
function parsePlatformChatCompletionResponse(args) {
|
|
676
|
-
if (isResponsesEndpoint(args.providerConfig.endpoint)) {
|
|
677
|
-
const content2 = extractTextFromResponseOutput(args.data);
|
|
678
|
-
const tool_calls = extractToolCallsFromResponseOutput(args.data);
|
|
679
|
-
return {
|
|
680
|
-
content: content2,
|
|
681
|
-
model: args.providerConfig.model,
|
|
682
|
-
provider: args.providerConfig.provider,
|
|
683
|
-
...tool_calls.length > 0 ? { tool_calls } : {},
|
|
684
|
-
usage: args.data?.usage,
|
|
685
|
-
trace: args.trace
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
|
-
const choiceMessage = args.data?.choices?.[0]?.message ?? {};
|
|
689
|
-
const rawContent = String(choiceMessage?.content ?? "");
|
|
690
|
-
const { content, reasoning } = extractThinkContent(rawContent);
|
|
691
|
-
return {
|
|
692
|
-
content,
|
|
693
|
-
model: args.providerConfig.model,
|
|
694
|
-
provider: args.providerConfig.provider,
|
|
695
|
-
...Array.isArray(choiceMessage?.tool_calls) ? { tool_calls: choiceMessage.tool_calls } : {},
|
|
696
|
-
...reasoning ? { reasoning_content: reasoning } : typeof choiceMessage?.reasoning_content === "string" && choiceMessage.reasoning_content ? { reasoning_content: choiceMessage.reasoning_content } : {},
|
|
697
|
-
usage: args.data?.usage,
|
|
698
|
-
trace: args.trace
|
|
699
|
-
};
|
|
700
|
-
}
|
|
701
|
-
function canUsePlatformChatProvider2(env) {
|
|
702
|
-
return canUsePlatformChatProvider(env);
|
|
703
|
-
}
|
|
704
|
-
function hasDirectOpenAiCompatibleProvider2(env) {
|
|
705
|
-
return hasDirectOpenAiCompatibleProvider(env);
|
|
706
|
-
}
|
|
707
|
-
function shouldUsePlatformChatProvider(env, agentConfig) {
|
|
708
|
-
if (!agentConfig) {
|
|
709
|
-
return resolveProviderTransportDecision({
|
|
710
|
-
agentConfig: { key: "default-platform" },
|
|
711
|
-
env,
|
|
712
|
-
runtimeLocation: "local-host"
|
|
713
|
-
}).transport === "proxy";
|
|
714
|
-
}
|
|
715
|
-
return resolveProviderTransportDecision({
|
|
716
|
-
agentConfig,
|
|
717
|
-
env,
|
|
718
|
-
runtimeLocation: resolveAgentRuntimeLocation({
|
|
719
|
-
agentConfig,
|
|
720
|
-
runtimeKind: "local"
|
|
721
|
-
})
|
|
722
|
-
}).transport === "proxy";
|
|
723
|
-
}
|
|
724
|
-
|
|
725
374
|
// packages/agent-runtime/agentRecordKeys.ts
|
|
726
375
|
function buildAgentRuntimeAgentLookupKeys(args) {
|
|
727
376
|
if (/^agent(-pub)?-/.test(args.agentRef)) {
|
|
@@ -3600,19 +3249,11 @@ function createLocalWorkspaceToolExecutors(args) {
|
|
|
3600
3249
|
|
|
3601
3250
|
export {
|
|
3602
3251
|
parseSseDataLineJson,
|
|
3603
|
-
readSseDataValues,
|
|
3604
3252
|
buildOpenAiCompatibleChatCompletionRequest,
|
|
3605
3253
|
parseOpenAiCompatibleChatCompletionResponse,
|
|
3606
3254
|
readOpenAiCompatibleSseCompletion,
|
|
3607
3255
|
executeOpenAiCompatibleChatCompletion,
|
|
3608
3256
|
resolveOpenAiCompatibleProviderConfig,
|
|
3609
|
-
resolvePlatformChatProviderConfig,
|
|
3610
|
-
buildPlatformChatCompletionRequest,
|
|
3611
|
-
parsePlatformChatCompletionData,
|
|
3612
|
-
parsePlatformChatCompletionResponse,
|
|
3613
|
-
canUsePlatformChatProvider2 as canUsePlatformChatProvider,
|
|
3614
|
-
hasDirectOpenAiCompatibleProvider2 as hasDirectOpenAiCompatibleProvider,
|
|
3615
|
-
shouldUsePlatformChatProvider,
|
|
3616
3257
|
buildAgentRuntimeAgentLookupKeys,
|
|
3617
3258
|
shouldFetchAgentRuntimeRecordRemotely,
|
|
3618
3259
|
dialogMessageRecordToAgentRuntimeMessage,
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
asNonEmptyStringArray
|
|
3
|
+
} from "./chunk-I42VC5KR.js";
|
|
1
4
|
import {
|
|
2
5
|
asOptionalFiniteNumber
|
|
3
6
|
} from "./chunk-WWC7I6TA.js";
|
|
@@ -2568,17 +2571,6 @@ var require_rambda = __commonJS({
|
|
|
2568
2571
|
}
|
|
2569
2572
|
});
|
|
2570
2573
|
|
|
2571
|
-
// packages/core/stringArray.ts
|
|
2572
|
-
function asNonEmptyStringArray(value) {
|
|
2573
|
-
if (!Array.isArray(value)) return [];
|
|
2574
|
-
return value.filter(
|
|
2575
|
-
(item) => typeof item === "string" && !!item.trim()
|
|
2576
|
-
);
|
|
2577
|
-
}
|
|
2578
|
-
function asTrimmedNonEmptyStringArray(value) {
|
|
2579
|
-
return asNonEmptyStringArray(value).map((item) => item.trim());
|
|
2580
|
-
}
|
|
2581
|
-
|
|
2582
2574
|
// packages/core/toTrimmedString.ts
|
|
2583
2575
|
function toTrimmedString(value) {
|
|
2584
2576
|
return typeof value === "string" ? value.trim() : value == null ? "" : String(value).trim();
|
|
@@ -3351,8 +3343,6 @@ var sanitizeShareData = (data) => {
|
|
|
3351
3343
|
};
|
|
3352
3344
|
|
|
3353
3345
|
export {
|
|
3354
|
-
asNonEmptyStringArray,
|
|
3355
|
-
asTrimmedNonEmptyStringArray,
|
|
3356
3346
|
require_index_umd,
|
|
3357
3347
|
ulid,
|
|
3358
3348
|
toTrimmedString,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listUserRecordsFromServers,
|
|
3
3
|
readLiveDbRecordAfterTombstoneMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7IPLJUYC.js";
|
|
5
5
|
import {
|
|
6
6
|
agentRecordHasConfiguredCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RJKDVL4L.js";
|
|
8
8
|
|
|
9
9
|
// packages/cli/agentListHelpers.ts
|
|
10
10
|
function parseAgentRecordId(privateKey, explicitId) {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
fileKey,
|
|
11
11
|
getFileIdFromKey,
|
|
12
12
|
ulid
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-SH2CFQOH.js";
|
|
14
14
|
import {
|
|
15
15
|
readAction,
|
|
16
16
|
readRequestManager,
|
|
@@ -748,7 +748,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
748
748
|
// 这里改成动态 import,运行期才解析,彻底断开这条边。
|
|
749
749
|
share: create.asyncThunk(
|
|
750
750
|
async (config, thunkApi) => {
|
|
751
|
-
const { shareResourceAction } = await import("./action-
|
|
751
|
+
const { shareResourceAction } = await import("./action-SQGI5JY5.js");
|
|
752
752
|
return shareResourceAction(config, thunkApi);
|
|
753
753
|
}
|
|
754
754
|
),
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
clipMultilineText,
|
|
11
11
|
fetchAndSerializeTable
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7XN726FS.js";
|
|
13
13
|
import {
|
|
14
14
|
normalizeNonNegativeMs,
|
|
15
15
|
parseRetryAfterHeaderMs
|
|
@@ -22,14 +22,14 @@ import {
|
|
|
22
22
|
} from "./chunk-VP4WJWKW.js";
|
|
23
23
|
import {
|
|
24
24
|
resolvePageSkillMetadata
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-ZQ2UM4KG.js";
|
|
26
26
|
import {
|
|
27
27
|
estimateTokenCount,
|
|
28
28
|
fetchAndCacheMessages
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-ZRS4MX3R.js";
|
|
30
30
|
import {
|
|
31
31
|
fetchServerSyncedCredential
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-DAB7DRXD.js";
|
|
33
33
|
import {
|
|
34
34
|
createSpaceKey
|
|
35
35
|
} from "./chunk-UAD2WT54.js";
|
|
@@ -42,14 +42,14 @@ import {
|
|
|
42
42
|
} from "./chunk-XDVAYP26.js";
|
|
43
43
|
import {
|
|
44
44
|
canonicalizeToolNames
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-DG7AAAR3.js";
|
|
46
46
|
import {
|
|
47
47
|
getModelConfig,
|
|
48
48
|
isModelSupportReasoningEffort
|
|
49
49
|
} from "./chunk-572EKYLF.js";
|
|
50
50
|
import {
|
|
51
51
|
createFileCredentialBroker
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-5CS33IBL.js";
|
|
53
53
|
import {
|
|
54
54
|
isDeepInfraKimiModel,
|
|
55
55
|
isFireworksKimiModel,
|
|
@@ -63,10 +63,10 @@ import {
|
|
|
63
63
|
} from "./chunk-HNMXYYJR.js";
|
|
64
64
|
import {
|
|
65
65
|
read
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-V2AISYMA.js";
|
|
67
67
|
import {
|
|
68
68
|
asNonEmptyStringArray
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-I42VC5KR.js";
|
|
70
70
|
import {
|
|
71
71
|
asTrimmedLowercaseString
|
|
72
72
|
} from "./chunk-QSJ3HFEF.js";
|
|
@@ -1223,8 +1223,6 @@ ${contexts.userGlobalPrompt.trim()} ` : "";
|
|
|
1223
1223
|
const referenceMaterialsSection = buildReferenceMaterialsBlock(contexts);
|
|
1224
1224
|
const dialogSummarySection = contexts.dialogSummary?.trim() ? `--- \u5386\u53F2\u5BF9\u8BDD\u6458\u8981 ---
|
|
1225
1225
|
${wrapHistoricalSummaryWithReplayGuard(contexts.dialogSummary)}` : "";
|
|
1226
|
-
const proactiveSummarySection = contexts.proactiveSummary?.trim() ? `--- \u9636\u6BB5\u5DE5\u4F5C\u6458\u8981 ---
|
|
1227
|
-
${wrapHistoricalSummaryWithReplayGuard(contexts.proactiveSummary)}` : "";
|
|
1228
1226
|
return compileContextLayers([
|
|
1229
1227
|
{ id: "identity", owner: "platform", cacheScope: "session", content: identitySection },
|
|
1230
1228
|
{ id: "startup-protocol", owner: "platform", cacheScope: "static", content: startupProtocol },
|
|
@@ -1259,7 +1257,6 @@ ${wrapHistoricalSummaryWithReplayGuard(contexts.proactiveSummary)}` : "";
|
|
|
1259
1257
|
{ id: "memory-overlay", owner: "runtime", cacheScope: "turn", content: memoryOverlaySection },
|
|
1260
1258
|
{ id: "app-working-memory", owner: "runtime", cacheScope: "turn", content: appWorkingMemorySection },
|
|
1261
1259
|
{ id: "dialog-summary", owner: "runtime", cacheScope: "turn", content: dialogSummarySection },
|
|
1262
|
-
{ id: "proactive-summary", owner: "runtime", cacheScope: "turn", content: proactiveSummarySection },
|
|
1263
1260
|
{ id: "editing-context", owner: "runtime", cacheScope: "turn", content: editingContextSection },
|
|
1264
1261
|
{
|
|
1265
1262
|
id: "current-time",
|
|
@@ -1960,7 +1957,6 @@ var fetchDialogReference = async (dbKey, refContent, dispatch) => {
|
|
|
1960
1957
|
const dialogId = extractCustomId(dbKey) || dbKey.replace(/^dialog-/, "");
|
|
1961
1958
|
const checkpoint = dialogConfig.runtimeCheckpoint || null;
|
|
1962
1959
|
const summary = asTrimmedString(dialogConfig.summary);
|
|
1963
|
-
const proactiveSummary = asTrimmedString(dialogConfig.proactiveSummary);
|
|
1964
1960
|
const messages = await dispatch(
|
|
1965
1961
|
async (_dispatch, getState, { db }) => {
|
|
1966
1962
|
const state = getState();
|
|
@@ -2005,7 +2001,6 @@ var fetchDialogReference = async (dbKey, refContent, dispatch) => {
|
|
|
2005
2001
|
`- Use this when continuing work, transferring to another Agent, comparing with the current task, or preparing a document/plan from the prior discussion.`,
|
|
2006
2002
|
`- Current state source: ${checkpointLines.length ? "Runtime Checkpoint" : "summaries and recent transcript"}.`,
|
|
2007
2003
|
summary ? `- Compressed background: passive summary is available below; treat it as lossy, not original wording.` : "",
|
|
2008
|
-
proactiveSummary ? `- Recent work: proactive summary is available below; use it for current direction, not exact evidence.` : "",
|
|
2009
2004
|
recentToolEvidence.length ? `- Recent tool evidence:
|
|
2010
2005
|
${recentToolEvidence.join("\n")}` : `- Recent tool evidence: none loaded in the latest ${DIALOG_REFERENCE_MESSAGE_LIMIT} messages.`,
|
|
2011
2006
|
`- For exact claims, old decisions, original wording, files/tools mentioned earlier, or anything not visible in the recent transcript, call searchDialogMessages with DB Key ${dbKey}.`
|
|
@@ -2022,8 +2017,6 @@ ${handoffLines.join("\n")}`,
|
|
|
2022
2017
|
${checkpointLines.join("\n")}` : "",
|
|
2023
2018
|
summary ? `Passive Summary (compressed history, not original wording):
|
|
2024
2019
|
${wrapHistoricalSummaryWithReplayGuard(summary)}` : "",
|
|
2025
|
-
proactiveSummary ? `Proactive Summary (recent work summary, not original wording):
|
|
2026
|
-
${wrapHistoricalSummaryWithReplayGuard(proactiveSummary)}` : "",
|
|
2027
2020
|
`Recent Transcript (original message excerpts, oldest to newest):
|
|
2028
2021
|
${transcript || "[no recent messages loaded]"}`,
|
|
2029
2022
|
[
|