nolo-cli 0.138.0-alpha.1 → 0.140.0-alpha.1
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-JWLH2Z7S.js → _executeModel-GJGGE6JX.js} +14 -13
- package/{agentDeleteCommand-UZGJZS5J.js → agentDeleteCommand-DAM4LEEO.js} +1 -1
- package/{agentEmailCommands-2SVG6LS3.js → agentEmailCommands-BTUG55AL.js} +13 -13
- package/{agentListCommands-GADYFX2S.js → agentListCommands-T3V5EL27.js} +1 -1
- package/{agentMachineCommands-JALXFO3Y.js → agentMachineCommands-5NBFFTBT.js} +2 -2
- package/{agentRecordCommands-INRNLAFR.js → agentRecordCommands-GFA7RVTG.js} +13 -13
- package/{agentRunCommand-TKHBLWSI.js → agentRunCommand-NXT7TWBS.js} +13 -13
- package/{agentRuntimeLocal-F44W2XTL.js → agentRuntimeLocal-DKFAWMRZ.js} +1 -1
- package/{agentSlice-T53NW4SS.js → agentSlice-WQVGFRLD.js} +1 -1
- package/{appDeleteCommands-GEVEUPWJ.js → appDeleteCommands-PBCGWJZQ.js} +1 -1
- package/{appDeployCommands-FMAHPMA2.js → appDeployCommands-E7KRDPZ5.js} +1 -1
- package/{appDeployStatusCommands-7DRR4X7F.js → appDeployStatusCommands-TZ64EREZ.js} +1 -1
- package/{appGetCommands-EOULTSHM.js → appGetCommands-3M2OIBJ3.js} +1 -1
- package/{appListCommands-ARJVCFDJ.js → appListCommands-D7H6I62Y.js} +1 -1
- package/{chatQueueReduxAdapter-GSD7C24T.js → chatQueueReduxAdapter-FUXS7NRR.js} +2 -2
- package/{chunk-TNYKI3LI.js → chunk-44YE37DR.js} +5 -5
- package/chunk-6OTOA5MH.js +108 -0
- package/{chunk-ZTQANKS2.js → chunk-AA2TX625.js} +2 -2
- package/{chunk-ZWJ6WQBO.js → chunk-AR7XM7CQ.js} +1 -1
- package/{chunk-MLXQO7X4.js → chunk-C6EZXUCB.js} +3 -3
- package/{chunk-DXXCZYEZ.js → chunk-CZNXUKLA.js} +9 -9
- package/{chunk-2LFG5CGH.js → chunk-ENU52AJZ.js} +1 -1
- package/chunk-GOMR6S5Z.js +83 -0
- package/{chunk-FSEVS4U3.js → chunk-KFMLZ3B5.js} +16 -8
- package/{chunk-3SPFKUP5.js → chunk-LJVUX3LF.js} +1 -1
- package/{chunk-27YNIIBN.js → chunk-NRXXVGOQ.js} +2 -2
- package/chunk-PWOXYPE6.js +194 -0
- package/{chunk-PA2BRUNR.js → chunk-QFDNAM7T.js} +3 -3
- package/{chunk-KQW2EHWB.js → chunk-RY3FI23Y.js} +19 -78
- package/{chunk-VIOF5352.js → chunk-TJUQIJQR.js} +8 -6
- package/{chunk-J2RGIFX5.js → chunk-UOCZAVYF.js} +2 -2
- package/{chunk-IEEGKL6X.js → chunk-YBUA6LCU.js} +2068 -1700
- package/{chunk-TTMVLXU5.js → chunk-ZOOAFELH.js} +6 -108
- package/{commandRegistry-DMS5KFOK.js → commandRegistry-XMFDAEN3.js} +40 -40
- package/{contentThunks-SDVFY3MX.js → contentThunks-CDGRYZSO.js} +3 -3
- package/{createAgentAutomationAction-CD6QYRC2.js → createAgentAutomationAction-HJZH45UP.js} +3 -3
- package/{createDialogAction-MB6BOVJJ.js → createDialogAction-W2U3KOFN.js} +4 -4
- package/{createPageAction-Y2A5MARX.js → createPageAction-4VGPW4AZ.js} +3 -3
- package/{dialogCommands-G7ZTYMIA.js → dialogCommands-FBSQ4KJR.js} +2 -2
- package/{dialogSlice-5C3POHWD.js → dialogSlice-MGEPXTGX.js} +2 -2
- package/{docCreateCommands-AEZC5UXB.js → docCreateCommands-N2TPCEZ7.js} +1 -1
- package/{docDeleteCommands-DXXYWOXH.js → docDeleteCommands-FJA7Q6CI.js} +1 -1
- package/{docReadCommands-G6PL2543.js → docReadCommands-2UZB5OR7.js} +1 -1
- package/{docStore-ZX7AIY5W.js → docStore-P6JMWIVK.js} +1 -1
- package/{docUpdateCommands-TWKJOXYT.js → docUpdateCommands-BID4C3QP.js} +1 -1
- package/{handleSendMessageAction-2AF42N6F.js → handleSendMessageAction-HAVG5ANU.js} +397 -6
- package/index.js +2 -2
- package/{machineCommands-ZY5BB4O3.js → machineCommands-WDAQIYYL.js} +13 -13
- package/{machineWsRunDispatch-5XE37H4C.js → machineWsRunDispatch-Y3MHLPCI.js} +13 -13
- package/package.json +1 -1
- package/{readlineWorkspace-HDAVBAL5.js → readlineWorkspace-AGIDALGO.js} +13 -13
- package/{runAgentClientLoop-TVA5UASR.js → runAgentClientLoop-7RNZVACU.js} +12 -11
- package/{spaceCommands-G2UBKO4F.js → spaceCommands-TKFZFVCA.js} +1 -1
- package/{streamAgentChatTurn-B6H35UWR.js → streamAgentChatTurn-T3WC62NT.js} +30 -210
- package/{tools-EEAEICHM.js → tools-UHCAPZ22.js} +9 -9
- package/{updateDialogTitleAction-UPPVYQ7R.js → updateDialogTitleAction-WBIR5A4A.js} +3 -3
- package/chunk-N4G4PKQ6.js +0 -23
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
import {
|
|
2
2
|
scanValidationDetails
|
|
3
3
|
} from "./chunk-BMQ2MJUK.js";
|
|
4
|
+
import {
|
|
5
|
+
buildForegroundTurnAdmissionFetchInit,
|
|
6
|
+
consumeAgentRunStream
|
|
7
|
+
} from "./chunk-PWOXYPE6.js";
|
|
4
8
|
import {
|
|
5
9
|
CONTEXT_OVERFLOW_ACTIONS,
|
|
6
10
|
CONTEXT_TOO_LARGE_ACTIONS,
|
|
7
11
|
isContextOverflowText
|
|
8
12
|
} from "./chunk-OCZKATRC.js";
|
|
9
13
|
import {
|
|
14
|
+
performServerProxyFetchWithRetry
|
|
15
|
+
} from "./chunk-6OTOA5MH.js";
|
|
16
|
+
import {
|
|
17
|
+
createSSEParser,
|
|
10
18
|
waitForAbortableDelay
|
|
11
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-GOMR6S5Z.js";
|
|
20
|
+
import "./chunk-NF64D32W.js";
|
|
21
|
+
import "./chunk-3L2WKC3W.js";
|
|
12
22
|
import {
|
|
23
|
+
initMsgs,
|
|
13
24
|
messageStreamEnd,
|
|
25
|
+
messageStreaming,
|
|
14
26
|
prepareAndPersistUserMessage,
|
|
27
|
+
removeTransientMessage,
|
|
15
28
|
resolveHandleSendMessageContext,
|
|
16
29
|
selectAllMsgs
|
|
17
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-KFMLZ3B5.js";
|
|
18
31
|
import "./chunk-MC4XLIJ7.js";
|
|
19
32
|
import "./chunk-YYLHWIW6.js";
|
|
20
33
|
import "./chunk-6O4IK4V2.js";
|
|
21
34
|
import {
|
|
22
35
|
streamAgentChatTurn
|
|
23
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-QFDNAM7T.js";
|
|
24
37
|
import "./chunk-D76D3RTR.js";
|
|
25
38
|
import "./chunk-5RGU3J7P.js";
|
|
26
39
|
import "./chunk-M76ECQRD.js";
|
|
@@ -45,9 +58,14 @@ import "./chunk-W7XHHYWM.js";
|
|
|
45
58
|
import "./chunk-B7ANJQWZ.js";
|
|
46
59
|
import "./chunk-UAD2WT54.js";
|
|
47
60
|
import "./chunk-HNGRBWYF.js";
|
|
61
|
+
import {
|
|
62
|
+
canonicalizeToolName
|
|
63
|
+
} from "./chunk-O6OSWFZQ.js";
|
|
48
64
|
import "./chunk-ACTMNVHM.js";
|
|
49
65
|
import "./chunk-Q67DOFOO.js";
|
|
50
|
-
import
|
|
66
|
+
import {
|
|
67
|
+
selectCurrentServer
|
|
68
|
+
} from "./chunk-3IYMTWYZ.js";
|
|
51
69
|
import "./chunk-Y5GCAMGP.js";
|
|
52
70
|
import "./chunk-QDSINZM3.js";
|
|
53
71
|
import "./chunk-KX6YBIHG.js";
|
|
@@ -63,8 +81,13 @@ import "./chunk-WWC7I6TA.js";
|
|
|
63
81
|
import "./chunk-QSJ3HFEF.js";
|
|
64
82
|
import "./chunk-EFZKILX6.js";
|
|
65
83
|
import "./chunk-AUXHZ2M5.js";
|
|
66
|
-
import
|
|
67
|
-
|
|
84
|
+
import {
|
|
85
|
+
getIsDesktopApp
|
|
86
|
+
} from "./chunk-QOKAKDPE.js";
|
|
87
|
+
import {
|
|
88
|
+
selectIdentityToken,
|
|
89
|
+
selectIdentityUserId
|
|
90
|
+
} from "./chunk-SEJ5OS6F.js";
|
|
68
91
|
import "./chunk-OW765XBU.js";
|
|
69
92
|
import "./chunk-GBRG75BQ.js";
|
|
70
93
|
import "./chunk-KUG52IAP.js";
|
|
@@ -80,6 +103,344 @@ import "./chunk-CF7PE763.js";
|
|
|
80
103
|
import "./chunk-G3SUCT4W.js";
|
|
81
104
|
import "./chunk-4VNS5WPM.js";
|
|
82
105
|
|
|
106
|
+
// packages/ai/agent/serverOwnedWebForegroundEligibility.ts
|
|
107
|
+
var FIRST_DURABLE_WEB_TOOL = "ask_user";
|
|
108
|
+
function readToolName(value) {
|
|
109
|
+
if (typeof value === "string") {
|
|
110
|
+
const name2 = value.trim();
|
|
111
|
+
return name2 || null;
|
|
112
|
+
}
|
|
113
|
+
if (!value || typeof value !== "object") return null;
|
|
114
|
+
const record = value;
|
|
115
|
+
const candidate = typeof record.name === "string" && record.name || typeof record.toolName === "string" && record.toolName || typeof record.function?.name === "string" && record.function.name || "";
|
|
116
|
+
const name = candidate.trim();
|
|
117
|
+
return name || null;
|
|
118
|
+
}
|
|
119
|
+
function configuredToolNames(agent) {
|
|
120
|
+
const values = [];
|
|
121
|
+
if (Array.isArray(agent.tools)) values.push(...agent.tools);
|
|
122
|
+
if (Array.isArray(agent.toolNames)) values.push(...agent.toolNames);
|
|
123
|
+
const policies = [
|
|
124
|
+
agent.runtimeToolPolicy,
|
|
125
|
+
agent.runtimeBinding?.runtimeToolPolicy,
|
|
126
|
+
agent.runtimeBinding?.runtimeToolPolicySnapshot
|
|
127
|
+
];
|
|
128
|
+
for (const policy of policies) {
|
|
129
|
+
if (!policy || typeof policy !== "object") continue;
|
|
130
|
+
if (Array.isArray(policy.agentTools)) values.push(...policy.agentTools);
|
|
131
|
+
if (Array.isArray(policy.runtimeTools)) values.push(...policy.runtimeTools);
|
|
132
|
+
}
|
|
133
|
+
return [...new Set(values.map(readToolName).filter((name) => !!name))];
|
|
134
|
+
}
|
|
135
|
+
function hasSupportedDurableToolSurface(agent) {
|
|
136
|
+
const policies = [
|
|
137
|
+
agent.runtimeToolPolicy,
|
|
138
|
+
agent.runtimeBinding?.runtimeToolPolicy,
|
|
139
|
+
agent.runtimeBinding?.runtimeToolPolicySnapshot
|
|
140
|
+
];
|
|
141
|
+
if (policies.some(
|
|
142
|
+
(policy) => policy && typeof policy === "object" && (policy.shell?.enabled === true || policy.workspace?.mode === "lease")
|
|
143
|
+
)) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
const names = configuredToolNames(agent);
|
|
147
|
+
return names.length === 0 || names.every((name) => name === FIRST_DURABLE_WEB_TOOL);
|
|
148
|
+
}
|
|
149
|
+
function shouldUseServerOwnedWebForegroundTurn(input) {
|
|
150
|
+
if (input.isDesktopApp) return false;
|
|
151
|
+
if (!input.currentServer?.trim() || !input.token?.trim()) return false;
|
|
152
|
+
if (typeof input.userInput !== "string" || !input.userInput.trim()) return false;
|
|
153
|
+
const agent = input.agentConfig;
|
|
154
|
+
if (!agent) return false;
|
|
155
|
+
if (agent.useServerProxy === false) return false;
|
|
156
|
+
if (agent.apiSource === "cli") return false;
|
|
157
|
+
if (agent.runtimeBinding?.machineId) return false;
|
|
158
|
+
if (!hasSupportedDurableToolSurface(agent)) return false;
|
|
159
|
+
const runtimeOptions = input.runtimeOptions;
|
|
160
|
+
if (runtimeOptions?.extraTools?.length) return false;
|
|
161
|
+
if (runtimeOptions?.editingTarget) return false;
|
|
162
|
+
if (runtimeOptions?.imageConfigOverride) return false;
|
|
163
|
+
if (runtimeOptions?.quickChatModelOverride) return false;
|
|
164
|
+
if (runtimeOptions?.workspaceToolsHint) return false;
|
|
165
|
+
if (runtimeOptions?.cwd) return false;
|
|
166
|
+
if (runtimeOptions?.restrictShellToWorkspace) return false;
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// packages/ai/agent/serverOwnedAskUserProjection.ts
|
|
171
|
+
function parseToolArgs(raw) {
|
|
172
|
+
if (typeof raw !== "string" || !raw.trim()) return {};
|
|
173
|
+
try {
|
|
174
|
+
const parsed = JSON.parse(raw);
|
|
175
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
176
|
+
} catch {
|
|
177
|
+
return {};
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function createServerOwnedAskUserProjection(args) {
|
|
181
|
+
const transientByCallId = /* @__PURE__ */ new Map();
|
|
182
|
+
const handlePayload = (payload) => {
|
|
183
|
+
if (!payload || typeof payload !== "object") return;
|
|
184
|
+
if (payload.type === "assistant_tool_calls") {
|
|
185
|
+
const calls = Array.isArray(payload.tool_calls) ? payload.tool_calls : [];
|
|
186
|
+
for (const call of calls) {
|
|
187
|
+
const callId = typeof call?.id === "string" ? call.id : "";
|
|
188
|
+
const toolName = canonicalizeToolName(call?.function?.name ?? "");
|
|
189
|
+
if (!callId || toolName !== "ask_user") continue;
|
|
190
|
+
if (transientByCallId.has(callId)) continue;
|
|
191
|
+
const { key, messageId } = createDialogMessageKeyAndId(args.dialogId);
|
|
192
|
+
const input = parseToolArgs(call?.function?.arguments);
|
|
193
|
+
const message = {
|
|
194
|
+
id: messageId,
|
|
195
|
+
dialogId: args.dialogId,
|
|
196
|
+
dbKey: key,
|
|
197
|
+
role: "tool",
|
|
198
|
+
// Pending args, not a tool result: the panel renders the question card
|
|
199
|
+
// from `content`, so a single-question call (question + choices, no
|
|
200
|
+
// `questions`) would otherwise render as an empty row until the
|
|
201
|
+
// tool_result arrives. The canonical payload replaces this on done.
|
|
202
|
+
content: JSON.stringify({ type: "ask_user", ...input }),
|
|
203
|
+
isStreaming: true,
|
|
204
|
+
toolName: "ask_user",
|
|
205
|
+
toolCallId: callId,
|
|
206
|
+
toolPayload: {
|
|
207
|
+
toolName: "ask_user",
|
|
208
|
+
status: "running",
|
|
209
|
+
input,
|
|
210
|
+
rawToolCall: call,
|
|
211
|
+
summary: ""
|
|
212
|
+
},
|
|
213
|
+
...args.messageMetadata
|
|
214
|
+
};
|
|
215
|
+
transientByCallId.set(callId, message);
|
|
216
|
+
args.dispatch(messageStreaming(message));
|
|
217
|
+
}
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (payload.type === "tool_result") {
|
|
221
|
+
const callId = typeof payload.toolCallId === "string" ? payload.toolCallId : "";
|
|
222
|
+
const existing = transientByCallId.get(callId);
|
|
223
|
+
if (!existing || canonicalizeToolName(payload.toolName ?? existing.toolName) !== "ask_user") {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const message = {
|
|
227
|
+
...existing,
|
|
228
|
+
content: typeof payload.content === "string" ? payload.content : "",
|
|
229
|
+
// Keep read-only until canonical server persistence is reloaded.
|
|
230
|
+
isStreaming: true,
|
|
231
|
+
toolPayload: {
|
|
232
|
+
...existing.toolPayload ?? {},
|
|
233
|
+
status: "running"
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
transientByCallId.set(callId, message);
|
|
237
|
+
args.dispatch(messageStreaming(message));
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
const cleanup = () => {
|
|
241
|
+
for (const message of transientByCallId.values()) {
|
|
242
|
+
args.dispatch(
|
|
243
|
+
removeTransientMessage({ id: message.id, dialogId: args.dialogId })
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
transientByCallId.clear();
|
|
247
|
+
};
|
|
248
|
+
return { handlePayload, cleanup, transientByCallId };
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// packages/ai/agent/serverOwnedWebForegroundTurn.ts
|
|
252
|
+
async function canRunServerOwnedWebForegroundTurn(args, thunk) {
|
|
253
|
+
let agentConfig = args.agentConfig ?? void 0;
|
|
254
|
+
if (!agentConfig) {
|
|
255
|
+
try {
|
|
256
|
+
const { readAndWait: readAndWait2 } = await import("./dbSlice-HFPIJT5P.js");
|
|
257
|
+
agentConfig = await thunk.dispatch(readAndWait2(args.agentKey)).unwrap();
|
|
258
|
+
} catch {
|
|
259
|
+
return { eligible: false };
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
const state = thunk.getState();
|
|
263
|
+
const currentServer = selectCurrentServer(state);
|
|
264
|
+
const token = selectIdentityToken(state);
|
|
265
|
+
return {
|
|
266
|
+
eligible: shouldUseServerOwnedWebForegroundTurn({
|
|
267
|
+
agentConfig,
|
|
268
|
+
userInput: args.userInput,
|
|
269
|
+
runtimeOptions: args.runtimeOptions,
|
|
270
|
+
currentServer,
|
|
271
|
+
token,
|
|
272
|
+
isDesktopApp: getIsDesktopApp()
|
|
273
|
+
}),
|
|
274
|
+
agentConfig
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
async function runServerOwnedWebForegroundTurn(args, thunk) {
|
|
278
|
+
const state = thunk.getState();
|
|
279
|
+
const currentServer = String(selectCurrentServer(state) ?? "").replace(/\/+$/, "");
|
|
280
|
+
const token = selectIdentityToken(state);
|
|
281
|
+
if (!currentServer || !token) {
|
|
282
|
+
throw new Error("Server-owned foreground turn requires an authenticated server");
|
|
283
|
+
}
|
|
284
|
+
const dialogKey = args.dialogConfig.dbKey;
|
|
285
|
+
const dialogId = args.dialogConfig.id ?? (dialogKey ? extractCustomId(dialogKey) : "");
|
|
286
|
+
if (!dialogId || !dialogKey) {
|
|
287
|
+
throw new Error("Server-owned foreground turn requires an existing dialog");
|
|
288
|
+
}
|
|
289
|
+
const userInput = typeof args.userInput === "string" ? args.userInput : "";
|
|
290
|
+
if (!userInput.trim()) {
|
|
291
|
+
throw new Error("Server-owned foreground turn requires text input");
|
|
292
|
+
}
|
|
293
|
+
const userId = selectIdentityUserId(thunk.getState());
|
|
294
|
+
const { key: transientKey, messageId: transientId } = createDialogMessageKeyAndId(dialogId);
|
|
295
|
+
const controller = new AbortController();
|
|
296
|
+
const loopKey = `server-owned:${dialogId}:${transientId}`;
|
|
297
|
+
let accumulated = "";
|
|
298
|
+
const askUserProjection = createServerOwnedAskUserProjection({
|
|
299
|
+
dialogId,
|
|
300
|
+
dispatch: thunk.dispatch,
|
|
301
|
+
messageMetadata: {
|
|
302
|
+
cybotKey: args.agentKey,
|
|
303
|
+
agentKey: args.agentKey,
|
|
304
|
+
userId
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
thunk.dispatch(
|
|
308
|
+
addActiveController({
|
|
309
|
+
messageId: loopKey,
|
|
310
|
+
controller,
|
|
311
|
+
dialogKey
|
|
312
|
+
})
|
|
313
|
+
);
|
|
314
|
+
thunk.dispatch(
|
|
315
|
+
messageStreaming({
|
|
316
|
+
id: transientId,
|
|
317
|
+
dialogId,
|
|
318
|
+
dbKey: transientKey,
|
|
319
|
+
role: "assistant",
|
|
320
|
+
content: "",
|
|
321
|
+
cybotKey: args.agentKey,
|
|
322
|
+
agentKey: args.agentKey,
|
|
323
|
+
userId
|
|
324
|
+
})
|
|
325
|
+
);
|
|
326
|
+
const body = JSON.stringify({
|
|
327
|
+
agentKey: args.agentKey,
|
|
328
|
+
userInput,
|
|
329
|
+
stream: true,
|
|
330
|
+
persistDialog: true,
|
|
331
|
+
continueDialogId: dialogId,
|
|
332
|
+
runtimeContext: {
|
|
333
|
+
surface: "web",
|
|
334
|
+
host: "browser",
|
|
335
|
+
runtime: "react",
|
|
336
|
+
entrypoint: "chat-dialog-server-owned",
|
|
337
|
+
capabilities: [
|
|
338
|
+
"streaming",
|
|
339
|
+
"dialog-ui",
|
|
340
|
+
"durable-foreground",
|
|
341
|
+
"client-user-prepersisted",
|
|
342
|
+
"ask-user-tool-card"
|
|
343
|
+
],
|
|
344
|
+
...args.dialogConfig.agentMode === "auto" ? { dialogAgentMode: "auto" } : { dialogAgentMode: "fixed" }
|
|
345
|
+
},
|
|
346
|
+
...args.runtimeOptions ? { runtimeOptions: args.runtimeOptions } : {},
|
|
347
|
+
...args.contextBlocks?.length ? { contextBlocks: args.contextBlocks } : {},
|
|
348
|
+
...args.dialogConfig.spaceId ? { spaceId: args.dialogConfig.spaceId } : {}
|
|
349
|
+
});
|
|
350
|
+
const init = buildForegroundTurnAdmissionFetchInit({
|
|
351
|
+
body,
|
|
352
|
+
headers: {
|
|
353
|
+
"Content-Type": "application/json",
|
|
354
|
+
Accept: "text/event-stream",
|
|
355
|
+
Authorization: `Bearer ${token}`
|
|
356
|
+
},
|
|
357
|
+
signal: controller.signal
|
|
358
|
+
});
|
|
359
|
+
try {
|
|
360
|
+
let response;
|
|
361
|
+
try {
|
|
362
|
+
response = await performServerProxyFetchWithRetry({
|
|
363
|
+
execute: () => fetch(`${currentServer}/api/agent/run`, init),
|
|
364
|
+
signal: controller.signal,
|
|
365
|
+
// This is an at-most-once foreground admission. A network error is
|
|
366
|
+
// ambiguous: the server may already own the execution, so never POST it again.
|
|
367
|
+
retryNetworkErrors: false,
|
|
368
|
+
logPrefix: "[serverOwnedWebForegroundTurn]"
|
|
369
|
+
});
|
|
370
|
+
} catch (error) {
|
|
371
|
+
if (controller.signal.aborted) return { serverOwned: true, aborted: true };
|
|
372
|
+
console.warn("[chat] server-owned foreground detached before response", {
|
|
373
|
+
dialogId,
|
|
374
|
+
error
|
|
375
|
+
});
|
|
376
|
+
return { serverOwned: true, detached: true };
|
|
377
|
+
}
|
|
378
|
+
if (!response.ok) {
|
|
379
|
+
const text = await response.text().catch(() => "");
|
|
380
|
+
throw new Error(text || `Agent run failed (${response.status})`);
|
|
381
|
+
}
|
|
382
|
+
const reader = response.body?.getReader();
|
|
383
|
+
if (!reader) {
|
|
384
|
+
return { serverOwned: true, detached: true };
|
|
385
|
+
}
|
|
386
|
+
const parseSSE = createSSEParser();
|
|
387
|
+
const decoder = new TextDecoder();
|
|
388
|
+
const outcome = await consumeAgentRunStream({
|
|
389
|
+
reader,
|
|
390
|
+
decoder,
|
|
391
|
+
parseChunk: (raw) => parseSSE(raw),
|
|
392
|
+
isAborted: () => controller.signal.aborted,
|
|
393
|
+
signal: controller.signal,
|
|
394
|
+
isDoneEvent: (payload) => payload?.type === "done",
|
|
395
|
+
onAbort: async () => {
|
|
396
|
+
},
|
|
397
|
+
onPayload: (payload) => {
|
|
398
|
+
if (payload?.type === "error") {
|
|
399
|
+
return { reject: payload.message || "Agent execution failed" };
|
|
400
|
+
}
|
|
401
|
+
askUserProjection.handlePayload(payload);
|
|
402
|
+
if (payload?.type === "text" && typeof payload.content === "string") {
|
|
403
|
+
accumulated += payload.content;
|
|
404
|
+
thunk.dispatch(
|
|
405
|
+
messageStreaming({
|
|
406
|
+
id: transientId,
|
|
407
|
+
dialogId,
|
|
408
|
+
dbKey: transientKey,
|
|
409
|
+
role: "assistant",
|
|
410
|
+
content: accumulated,
|
|
411
|
+
cybotKey: args.agentKey,
|
|
412
|
+
agentKey: args.agentKey,
|
|
413
|
+
userId
|
|
414
|
+
})
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
if (outcome.outcome === "aborted") {
|
|
420
|
+
return { serverOwned: true, aborted: true };
|
|
421
|
+
}
|
|
422
|
+
if (outcome.outcome === "rejected") {
|
|
423
|
+
throw new Error(outcome.message);
|
|
424
|
+
}
|
|
425
|
+
if (!outcome.sawDone) {
|
|
426
|
+
return { serverOwned: true, detached: true };
|
|
427
|
+
}
|
|
428
|
+
askUserProjection.cleanup();
|
|
429
|
+
thunk.dispatch(removeTransientMessage({ id: transientId, dialogId }));
|
|
430
|
+
await thunk.dispatch(initMsgs({ dialogId })).unwrap();
|
|
431
|
+
return { serverOwned: true };
|
|
432
|
+
} finally {
|
|
433
|
+
thunk.dispatch(
|
|
434
|
+
removeActiveController({
|
|
435
|
+
messageId: loopKey,
|
|
436
|
+
dialogKey
|
|
437
|
+
})
|
|
438
|
+
);
|
|
439
|
+
askUserProjection.cleanup();
|
|
440
|
+
thunk.dispatch(removeTransientMessage({ id: transientId, dialogId }));
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
83
444
|
// packages/chat/dialog/actions/parseOAuthError.ts
|
|
84
445
|
var PROVIDER_NAMES = {
|
|
85
446
|
antigravity: "Antigravity (Google)",
|
|
@@ -568,6 +929,36 @@ var handleSendMessageAction = async (args, { dispatch, getState, rejectWithValue
|
|
|
568
929
|
const userInputText = typeof effectiveRawUserInput === "string" ? effectiveRawUserInput : "";
|
|
569
930
|
const isDesktopContext = typeof window !== "undefined" && typeof location !== "undefined" && (location.hostname === "127.0.0.1" || location.hostname === "localhost");
|
|
570
931
|
const browseContextPrefix = isDesktopContext ? await resolveBrowseContextPrefix(userInputText) : "";
|
|
932
|
+
const serverOwnedCandidate = await canRunServerOwnedWebForegroundTurn(
|
|
933
|
+
{
|
|
934
|
+
agentKey: agentKeyToUse,
|
|
935
|
+
agentConfig: agentConfigToUse,
|
|
936
|
+
userInput: effectiveRawUserInput,
|
|
937
|
+
dialogConfig,
|
|
938
|
+
runtimeOptions: effectiveRuntimeOptions,
|
|
939
|
+
contextBlocks: browseContextPrefix ? [browseContextPrefix] : void 0
|
|
940
|
+
},
|
|
941
|
+
{ dispatch, getState }
|
|
942
|
+
);
|
|
943
|
+
if (serverOwnedCandidate.eligible && serverOwnedCandidate.agentConfig) {
|
|
944
|
+
const serverOwnedResult = await runServerOwnedWebForegroundTurn(
|
|
945
|
+
{
|
|
946
|
+
agentKey: agentKeyToUse,
|
|
947
|
+
agentConfig: serverOwnedCandidate.agentConfig,
|
|
948
|
+
userInput: effectiveRawUserInput,
|
|
949
|
+
dialogConfig,
|
|
950
|
+
runtimeOptions: effectiveRuntimeOptions,
|
|
951
|
+
contextBlocks: browseContextPrefix ? [browseContextPrefix] : void 0
|
|
952
|
+
},
|
|
953
|
+
{ dispatch, getState }
|
|
954
|
+
);
|
|
955
|
+
if (serverOwnedResult.aborted || serverOwnedResult.detached) return;
|
|
956
|
+
logQuickChatPerfStage(args.quickChatPerfStartedAt, "handle-send-message-server-owned-finished", {
|
|
957
|
+
dialogKey: dialogConfig.dbKey,
|
|
958
|
+
agentKey: agentKeyToUse
|
|
959
|
+
});
|
|
960
|
+
return;
|
|
961
|
+
}
|
|
571
962
|
const effectiveUserInput = browseContextPrefix ? `${browseContextPrefix}
|
|
572
963
|
|
|
573
964
|
${userInputText}` : effectiveRawUserInput ?? "";
|
package/index.js
CHANGED
|
@@ -71,7 +71,7 @@ async function runScript(script, forwardedArgs, env) {
|
|
|
71
71
|
return proc.exited;
|
|
72
72
|
}
|
|
73
73
|
async function launchTuiWorkspace(args2) {
|
|
74
|
-
const { startTuiWorkspace } = await import("./readlineWorkspace-
|
|
74
|
+
const { startTuiWorkspace } = await import("./readlineWorkspace-AGIDALGO.js");
|
|
75
75
|
const { createTuiSummaryLlmCaller } = await import("./tuiSummaryLlmCaller-W36LJRZU.js");
|
|
76
76
|
return startTuiWorkspace({
|
|
77
77
|
...args2,
|
|
@@ -81,7 +81,7 @@ async function launchTuiWorkspace(args2) {
|
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
async function main() {
|
|
84
|
-
const { createCliRuntimeContext, looksLikeDaemonShortcut, renderHelpText, resolveCommand, runResolvedCommand } = await import("./commandRegistry-
|
|
84
|
+
const { createCliRuntimeContext, looksLikeDaemonShortcut, renderHelpText, resolveCommand, runResolvedCommand } = await import("./commandRegistry-XMFDAEN3.js");
|
|
85
85
|
const { buildCliRuntimeEnv, loadProfileConfig } = await import("./profileConfig-ZGOFORWV.js");
|
|
86
86
|
const { resolveTuiLaunchMode } = await import("./runtimeModeArgs-2Y7BALTO.js");
|
|
87
87
|
const runtimeEnv = {
|
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
buildMachinePermissionPromptBlock,
|
|
3
3
|
handleConnectorRunMessage,
|
|
4
4
|
resolveMachineRunPermissionPolicy
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-C6EZXUCB.js";
|
|
6
6
|
import {
|
|
7
7
|
isConnectorWebSocketAuthError,
|
|
8
8
|
isConnectorWebSocketRetryableError,
|
|
9
9
|
resolveConnectorWebSocketTarget
|
|
10
10
|
} from "./chunk-ALXHV7NK.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-44YE37DR.js";
|
|
12
12
|
import "./chunk-XSW2IKJM.js";
|
|
13
13
|
import "./chunk-OY5IJI2N.js";
|
|
14
14
|
import "./chunk-62IL3KQV.js";
|
|
@@ -25,35 +25,35 @@ import "./chunk-4XEYAFLY.js";
|
|
|
25
25
|
import "./chunk-JBTJAPUF.js";
|
|
26
26
|
import "./chunk-QJLEMM2V.js";
|
|
27
27
|
import "./chunk-ATNTHIZI.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-UOCZAVYF.js";
|
|
29
29
|
import "./chunk-HS7MLR74.js";
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-NF64D32W.js";
|
|
30
|
+
import "./chunk-RY3FI23Y.js";
|
|
32
31
|
import "./chunk-YSC3EI23.js";
|
|
33
32
|
import "./chunk-5UTFL4QJ.js";
|
|
33
|
+
import "./chunk-KQHGZWSV.js";
|
|
34
|
+
import "./chunk-GOMR6S5Z.js";
|
|
35
|
+
import "./chunk-NF64D32W.js";
|
|
34
36
|
import {
|
|
35
37
|
CORE_DRAIN_REASON
|
|
36
38
|
} from "./chunk-3L2WKC3W.js";
|
|
37
|
-
import "./chunk-KQHGZWSV.js";
|
|
38
|
-
import "./chunk-N4G4PKQ6.js";
|
|
39
39
|
import "./chunk-3VNWWVKB.js";
|
|
40
|
-
import "./chunk-
|
|
40
|
+
import "./chunk-NRXXVGOQ.js";
|
|
41
41
|
import "./chunk-HNRASX3X.js";
|
|
42
42
|
import "./chunk-YRRASA5Q.js";
|
|
43
43
|
import "./chunk-63W5N6P3.js";
|
|
44
44
|
import "./chunk-VF4K2QE6.js";
|
|
45
|
-
import "./chunk-
|
|
45
|
+
import "./chunk-AA2TX625.js";
|
|
46
46
|
import "./chunk-Z7IZQF56.js";
|
|
47
47
|
import "./chunk-XPRWFQQK.js";
|
|
48
48
|
import "./chunk-BJUDYFV5.js";
|
|
49
49
|
import "./chunk-MEYIRKDN.js";
|
|
50
|
-
import "./chunk-
|
|
50
|
+
import "./chunk-AR7XM7CQ.js";
|
|
51
51
|
import "./chunk-ZJ7UHBJS.js";
|
|
52
|
-
import "./chunk-
|
|
52
|
+
import "./chunk-KFMLZ3B5.js";
|
|
53
53
|
import "./chunk-MC4XLIJ7.js";
|
|
54
54
|
import "./chunk-YYLHWIW6.js";
|
|
55
55
|
import "./chunk-6O4IK4V2.js";
|
|
56
|
-
import "./chunk-
|
|
56
|
+
import "./chunk-QFDNAM7T.js";
|
|
57
57
|
import "./chunk-D76D3RTR.js";
|
|
58
58
|
import "./chunk-5RGU3J7P.js";
|
|
59
59
|
import "./chunk-M76ECQRD.js";
|
|
@@ -71,7 +71,7 @@ import "./chunk-KHCLMKZZ.js";
|
|
|
71
71
|
import {
|
|
72
72
|
PATH_FIELD_ALIASES,
|
|
73
73
|
createLocalWorkspaceToolExecutors
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-YBUA6LCU.js";
|
|
75
75
|
import "./chunk-VG72WLGI.js";
|
|
76
76
|
import "./chunk-ZNFJWEN4.js";
|
|
77
77
|
import "./chunk-6JPUN447.js";
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
runtimeWorkspacePermissionPolicy,
|
|
12
12
|
scopePermissionPolicyToRuntimeWorkspace,
|
|
13
13
|
summarizeAgentConfigForLogs
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-C6EZXUCB.js";
|
|
15
|
+
import "./chunk-44YE37DR.js";
|
|
16
16
|
import "./chunk-XSW2IKJM.js";
|
|
17
17
|
import "./chunk-OY5IJI2N.js";
|
|
18
18
|
import "./chunk-62IL3KQV.js";
|
|
@@ -26,33 +26,33 @@ import "./chunk-4XEYAFLY.js";
|
|
|
26
26
|
import "./chunk-JBTJAPUF.js";
|
|
27
27
|
import "./chunk-QJLEMM2V.js";
|
|
28
28
|
import "./chunk-ATNTHIZI.js";
|
|
29
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-UOCZAVYF.js";
|
|
30
30
|
import "./chunk-HS7MLR74.js";
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-NF64D32W.js";
|
|
31
|
+
import "./chunk-RY3FI23Y.js";
|
|
33
32
|
import "./chunk-YSC3EI23.js";
|
|
34
33
|
import "./chunk-5UTFL4QJ.js";
|
|
35
|
-
import "./chunk-3L2WKC3W.js";
|
|
36
34
|
import "./chunk-KQHGZWSV.js";
|
|
37
|
-
import "./chunk-
|
|
35
|
+
import "./chunk-GOMR6S5Z.js";
|
|
36
|
+
import "./chunk-NF64D32W.js";
|
|
37
|
+
import "./chunk-3L2WKC3W.js";
|
|
38
38
|
import "./chunk-3VNWWVKB.js";
|
|
39
|
-
import "./chunk-
|
|
39
|
+
import "./chunk-NRXXVGOQ.js";
|
|
40
40
|
import "./chunk-HNRASX3X.js";
|
|
41
41
|
import "./chunk-YRRASA5Q.js";
|
|
42
42
|
import "./chunk-63W5N6P3.js";
|
|
43
43
|
import "./chunk-VF4K2QE6.js";
|
|
44
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-AA2TX625.js";
|
|
45
45
|
import "./chunk-Z7IZQF56.js";
|
|
46
46
|
import "./chunk-XPRWFQQK.js";
|
|
47
47
|
import "./chunk-BJUDYFV5.js";
|
|
48
48
|
import "./chunk-MEYIRKDN.js";
|
|
49
|
-
import "./chunk-
|
|
49
|
+
import "./chunk-AR7XM7CQ.js";
|
|
50
50
|
import "./chunk-ZJ7UHBJS.js";
|
|
51
|
-
import "./chunk-
|
|
51
|
+
import "./chunk-KFMLZ3B5.js";
|
|
52
52
|
import "./chunk-MC4XLIJ7.js";
|
|
53
53
|
import "./chunk-YYLHWIW6.js";
|
|
54
54
|
import "./chunk-6O4IK4V2.js";
|
|
55
|
-
import "./chunk-
|
|
55
|
+
import "./chunk-QFDNAM7T.js";
|
|
56
56
|
import "./chunk-D76D3RTR.js";
|
|
57
57
|
import "./chunk-5RGU3J7P.js";
|
|
58
58
|
import "./chunk-M76ECQRD.js";
|
|
@@ -67,7 +67,7 @@ import "./chunk-J5H6SUOW.js";
|
|
|
67
67
|
import "./chunk-WC6A2Q7S.js";
|
|
68
68
|
import "./chunk-AUDNYVRC.js";
|
|
69
69
|
import "./chunk-KHCLMKZZ.js";
|
|
70
|
-
import "./chunk-
|
|
70
|
+
import "./chunk-YBUA6LCU.js";
|
|
71
71
|
import "./chunk-VG72WLGI.js";
|
|
72
72
|
import "./chunk-ZNFJWEN4.js";
|
|
73
73
|
import "./chunk-6JPUN447.js";
|