nolo-cli 0.16.0-alpha.8 → 0.16.0
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-BXOUO4QK.js → _executeModel-AVCA2NAV.js} +20 -21
- package/{agentDeleteCommand-X35VSSVM.js → agentDeleteCommand-QW5PUMDQ.js} +14 -15
- package/{agentEmailCommands-SBT6O7PR.js → agentEmailCommands-4ORVLGVQ.js} +25 -26
- package/{agentListCommands-LLQHUE4O.js → agentListCommands-YWBYRTYC.js} +16 -17
- package/{agentMachineCommands-XZCYBU3R.js → agentMachineCommands-JSQW4FOA.js} +14 -15
- package/{agentRecordCommands-RIYJOUA2.js → agentRecordCommands-AASIWOBT.js} +24 -25
- package/{agentRunCommand-A5XOHMND.js → agentRunCommand-TB5BHXUH.js} +24 -25
- package/{agentRuntimeLocal-N56G2ZJK.js → agentRuntimeLocal-QNPNJRVH.js} +12 -15
- package/{agentSlice-3FPEJY4O.js → agentSlice-RUNXC62Y.js} +1 -1
- package/{authCommand-P22WCVOP.js → authCommand-YFTR3347.js} +2 -8
- package/{chunk-KRGHIVPU.js → chunk-33BJUVK4.js} +2 -2
- package/{chunk-BIAWRSVQ.js → chunk-3663CXZN.js} +12 -39
- package/{chunk-OIX36K6R.js → chunk-3OIRVWXA.js} +10 -1
- package/{chunk-LSFAWXKC.js → chunk-3WGLLTK4.js} +3 -100
- package/{chunk-2B3BNWPC.js → chunk-4FX6NVDW.js} +134 -1
- package/{chunk-BOPYCNN3.js → chunk-4IJYA27C.js} +1 -1
- package/{chunk-4IF3B7WC.js → chunk-4L2OJPCU.js} +2 -2
- package/{chunk-CI2G2Z2L.js → chunk-55NSNCFM.js} +1 -1
- package/{chunk-5BP2BROQ.js → chunk-66X4VSRC.js} +4 -3
- package/{chunk-LJIJWXIT.js → chunk-6EVITP2G.js} +254 -13
- package/{chunk-C2BYYSAO.js → chunk-7UKFVQ5W.js} +27 -84
- package/{chunk-B2A62NRJ.js → chunk-AUURUT6L.js} +200 -65
- package/{chunk-KOW2R4MZ.js → chunk-AVVZUXXC.js} +13 -38
- package/{chunk-BS5STUTA.js → chunk-BEBNFWDU.js} +3 -3
- package/{chunk-YMMMHRM6.js → chunk-DGEYDWEZ.js} +3 -3
- package/{chunk-UVLYZNDL.js → chunk-DPAB4FQ7.js} +124 -629
- package/{chunk-J4VLNDI7.js → chunk-EHLHSX7R.js} +2 -9
- package/{chunk-LXT3EWFO.js → chunk-FRV6A633.js} +3 -3
- package/{chunk-5IMRNKUB.js → chunk-FY233ZFU.js} +18 -17
- package/{chunk-ZTRZ2O5B.js → chunk-GSINCD4P.js} +4 -4
- package/{chunk-6Z3S3UAU.js → chunk-IGXREZW2.js} +1 -1
- package/{chunk-B4KT7RN2.js → chunk-JTMNCCWF.js} +2 -2
- package/{chunk-ASZ2C44S.js → chunk-LPEUV5RE.js} +2 -2
- package/{chunk-QSWWWYGA.js → chunk-M43KDE25.js} +1 -1
- package/{chunk-E4STLOKO.js → chunk-MR6ISAGB.js} +2 -2
- package/{chunk-TPHRIFDJ.js → chunk-NSCHQQPU.js} +10 -10
- package/{chunk-AKYTMRBP.js → chunk-NVEWUJVX.js} +1 -1
- package/{chunk-ZRDWHLMQ.js → chunk-P3RIAYGG.js} +1 -1
- package/{chunk-FJHD7FHN.js → chunk-PCTUYVUM.js} +1 -1
- package/{chunk-YQMTILRW.js → chunk-RLCXU7A5.js} +1 -1
- package/{chunk-DRHXEIMY.js → chunk-S2LXHNHG.js} +3 -3
- package/{chunk-UALQTIWY.js → chunk-XBS2WYJ2.js} +1 -1
- package/{chunk-ND3KEKR5.js → chunk-Z5JQNBNY.js} +2 -2
- package/{chunk-HNLGEZZC.js → chunk-ZQBL7LIC.js} +24 -19
- package/{createAgentAutomationAction-P22E427A.js → createAgentAutomationAction-FNHPSKKO.js} +6 -6
- package/{createDialogAction-652TOTEI.js → createDialogAction-TZCVQ3NU.js} +7 -7
- package/{createPageAction-YOYLCN3U.js → createPageAction-EIGZ3BKT.js} +6 -6
- package/{dialogCommands-L4LMXQAI.js → dialogCommands-FO77J5DQ.js} +15 -16
- package/{dialogSlice-JDGM4LBU.js → dialogSlice-MM5U4KE2.js} +6 -6
- package/{docCreateCommands-C4HJCM47.js → docCreateCommands-I3BS3AZI.js} +17 -20
- package/{docDeleteCommands-Y6W6A3W6.js → docDeleteCommands-Q2OPV52P.js} +16 -19
- package/{docReadCommands-2WUIDAR6.js → docReadCommands-YOOFACYZ.js} +15 -18
- package/{docStore-WR2GOFTC.js → docStore-NGYQ2JTR.js} +7 -7
- package/{docUpdateCommands-XVL2CBKE.js → docUpdateCommands-2B32ITHN.js} +16 -19
- package/{getPricing-HXWUZAEN.js → getPricing-P4XRJRZB.js} +3 -3
- package/{handleSendMessageAction-VWLRU6MN.js → handleSendMessageAction-JRZWWBKP.js} +6 -6
- package/index.js +43 -74
- package/{machineCommands-2TWAI6PL.js → machineCommands-WRWF2ICZ.js} +23 -24
- package/{machineWsRunDispatch-YZV3WPSY.js → machineWsRunDispatch-ZX7Q3TWZ.js} +23 -24
- package/{models-DQUMNIGQ.js → models-WQ5N4OJM.js} +2 -2
- package/package.json +1 -1
- package/{readlineWorkspace-BWJFIKM5.js → readlineWorkspace-ZTGRGW46.js} +81 -78
- package/{runAgentClientLoop-S7STEKKR.js → runAgentClientLoop-JZCOP7LG.js} +16 -17
- package/{spaceCommands-PYFLKEAW.js → spaceCommands-VV4GTPQK.js} +14 -15
- package/{spaceSlice-VRX4URCY.js → spaceSlice-DRWWZJP7.js} +6 -6
- package/{streamAgentChatTurn-DVSLQIQE.js → streamAgentChatTurn-Y6WGATQR.js} +26 -27
- package/{tools-O2GBX7RP.js → tools-PUNBY3AH.js} +11 -11
- package/{tuiSummaryLlmCaller-ENLQTJUV.js → tuiSummaryLlmCaller-F64WLSAF.js} +5 -6
- package/{updateDialogTitleAction-SDAHAOAO.js → updateDialogTitleAction-YSR4TCMB.js} +6 -6
- package/appDeleteCommands-WHRYDQLZ.js +0 -125
- package/appDeployCommands-USRWBT6T.js +0 -164
- package/appDeployStatusCommands-R632IBVL.js +0 -145
- package/appGetCommands-PKGC2JWH.js +0 -120
- package/appListCommands-OMRAEOAL.js +0 -123
- package/chunk-EFNMO3YF.js +0 -107
- package/chunk-GFUIQ4RY.js +0 -136
- package/chunk-KFEVY3ST.js +0 -255
- /package/{chunk-LPWS7HMQ.js → chunk-O6W2O2DA.js} +0 -0
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getModelConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-66X4VSRC.js";
|
|
4
4
|
import {
|
|
5
5
|
asTrimmedLowercaseString
|
|
6
6
|
} from "./chunk-QSJ3HFEF.js";
|
|
7
7
|
import {
|
|
8
8
|
asTrimmedString
|
|
9
9
|
} from "./chunk-3EUW3WEO.js";
|
|
10
|
+
import {
|
|
11
|
+
isRecord
|
|
12
|
+
} from "./chunk-KUG52IAP.js";
|
|
10
13
|
import {
|
|
11
14
|
normalizeServerOrigin
|
|
12
15
|
} from "./chunk-CF7PE763.js";
|
|
@@ -28,7 +31,6 @@ function pickAgentRuntimeInferenceOptions(agentConfig) {
|
|
|
28
31
|
|
|
29
32
|
// packages/agent-runtime/platformProviderEndpoints.ts
|
|
30
33
|
var OPENAI_RESPONSES_ENDPOINT = "https://api.openai.com/v1/responses";
|
|
31
|
-
var DEEPSEEK_RESPONSES_ENDPOINT = "https://api.deepseek.com/v1/responses";
|
|
32
34
|
var PLATFORM_CHAT_COMPLETIONS_ENDPOINTS = {
|
|
33
35
|
deepinfra: "https://api.deepinfra.com/v1/openai/chat/completions",
|
|
34
36
|
// DeepSeek official API endpoint removed — all DeepSeek models now route
|
|
@@ -48,7 +50,6 @@ var PLATFORM_CHAT_COMPLETIONS_ENDPOINTS = {
|
|
|
48
50
|
};
|
|
49
51
|
function isOpenAiResponsesModel(args) {
|
|
50
52
|
const provider = asTrimmedLowercaseString(args.provider);
|
|
51
|
-
if (provider === "deepseek") return false;
|
|
52
53
|
if (provider !== "openai") return false;
|
|
53
54
|
if (args.endpointKey === "responses") return true;
|
|
54
55
|
if (!args.model) return false;
|
|
@@ -59,17 +60,11 @@ function isOpenAiResponsesModel(args) {
|
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
function resolvePlatformResponsesEndpoint(provider) {
|
|
62
|
-
|
|
63
|
-
case "openai":
|
|
64
|
-
return OPENAI_RESPONSES_ENDPOINT;
|
|
65
|
-
case "deepseek":
|
|
66
|
-
return DEEPSEEK_RESPONSES_ENDPOINT;
|
|
67
|
-
default:
|
|
68
|
-
return void 0;
|
|
69
|
-
}
|
|
63
|
+
return asTrimmedLowercaseString(provider) === "openai" ? OPENAI_RESPONSES_ENDPOINT : void 0;
|
|
70
64
|
}
|
|
71
65
|
var PLATFORM_PROVIDER_ENDPOINT_ALIASES = {
|
|
72
|
-
"ollama-cloud": "nolo"
|
|
66
|
+
"ollama-cloud": "nolo",
|
|
67
|
+
deepseek: "nolo"
|
|
73
68
|
};
|
|
74
69
|
function resolvePlatformChatCompletionsEndpoint(provider) {
|
|
75
70
|
const key = asTrimmedLowercaseString(provider);
|
|
@@ -341,6 +336,242 @@ async function buildProviderExecutionPlan(args) {
|
|
|
341
336
|
};
|
|
342
337
|
}
|
|
343
338
|
|
|
339
|
+
// packages/agent-runtime/openAiCompatibleMessages.ts
|
|
340
|
+
function preserveAgentStateFields(source, target, options) {
|
|
341
|
+
const mutableTarget = target;
|
|
342
|
+
if (source.role === "assistant") {
|
|
343
|
+
if (!options?.stripReasoningContent && typeof source.reasoning_content === "string") {
|
|
344
|
+
mutableTarget.reasoning_content = source.reasoning_content;
|
|
345
|
+
}
|
|
346
|
+
if (Array.isArray(source.tool_calls)) {
|
|
347
|
+
mutableTarget.tool_calls = source.tool_calls;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (source.role === "tool") {
|
|
351
|
+
const toolCallId = typeof source.tool_call_id === "string" ? source.tool_call_id.trim() : typeof source.toolCallId === "string" ? source.toolCallId.trim() : "";
|
|
352
|
+
if (toolCallId) mutableTarget.tool_call_id = toolCallId;
|
|
353
|
+
}
|
|
354
|
+
return target;
|
|
355
|
+
}
|
|
356
|
+
function toOpenAiCompatibleMessages(messages, options) {
|
|
357
|
+
return messages.map(
|
|
358
|
+
(message) => preserveAgentStateFields(message, {
|
|
359
|
+
role: message.role,
|
|
360
|
+
content: message.content ?? ""
|
|
361
|
+
}, options)
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
function shouldStripReasoningContentForOutbound(provider, model) {
|
|
365
|
+
const p = provider?.trim().toLowerCase();
|
|
366
|
+
const m = model?.trim().toLowerCase();
|
|
367
|
+
if (!p || !m) return false;
|
|
368
|
+
if (p === "deepseek" || p === "nolo") return m === "deepseek-v4-flash";
|
|
369
|
+
return false;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// packages/integrations/openai/responsesHelpers.ts
|
|
373
|
+
var RESPONSES_TOP_LEVEL_SCHEMA_KEYS = ["anyOf", "oneOf", "allOf", "enum", "not"];
|
|
374
|
+
var sanitizeResponsesParameters = (parameters) => {
|
|
375
|
+
if (!isRecord(parameters)) {
|
|
376
|
+
return parameters;
|
|
377
|
+
}
|
|
378
|
+
const next = { ...parameters };
|
|
379
|
+
for (const key of RESPONSES_TOP_LEVEL_SCHEMA_KEYS) {
|
|
380
|
+
delete next[key];
|
|
381
|
+
}
|
|
382
|
+
return next;
|
|
383
|
+
};
|
|
384
|
+
var appendTextPart = (parts, text, role) => {
|
|
385
|
+
if (!text) return;
|
|
386
|
+
const last = parts.at(-1);
|
|
387
|
+
const textType = role === "assistant" ? "output_text" : "input_text";
|
|
388
|
+
if (last?.type === textType) {
|
|
389
|
+
last.text += text;
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
parts.push({ type: textType, text });
|
|
393
|
+
};
|
|
394
|
+
var normalizeMessageParts = (content, role) => {
|
|
395
|
+
if (typeof content === "string") {
|
|
396
|
+
if (!content) return [];
|
|
397
|
+
return [
|
|
398
|
+
{
|
|
399
|
+
type: role === "assistant" ? "output_text" : "input_text",
|
|
400
|
+
text: content
|
|
401
|
+
}
|
|
402
|
+
];
|
|
403
|
+
}
|
|
404
|
+
const parts = [];
|
|
405
|
+
for (const part of content ?? []) {
|
|
406
|
+
const typedPart = part;
|
|
407
|
+
if (typedPart?.type === "text" && typeof typedPart.text === "string") {
|
|
408
|
+
appendTextPart(parts, typedPart.text, role);
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
if (typedPart?.type === "image_url" && typeof typedPart.image_url?.url === "string" && typedPart.image_url.url) {
|
|
412
|
+
if (role === "assistant") continue;
|
|
413
|
+
parts.push({
|
|
414
|
+
type: "input_image",
|
|
415
|
+
image_url: typedPart.image_url.url,
|
|
416
|
+
detail: typedPart.image_url.detail
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return parts;
|
|
421
|
+
};
|
|
422
|
+
var normalizeToolOutput = (content) => {
|
|
423
|
+
if (typeof content === "string") return content;
|
|
424
|
+
return JSON.stringify(content ?? "");
|
|
425
|
+
};
|
|
426
|
+
var toResponsesTools = (tools) => {
|
|
427
|
+
if (!Array.isArray(tools) || tools.length === 0) return void 0;
|
|
428
|
+
return tools.map((tool) => {
|
|
429
|
+
const fn = tool?.function;
|
|
430
|
+
if (!fn?.name) return null;
|
|
431
|
+
return {
|
|
432
|
+
type: "function",
|
|
433
|
+
name: fn.name,
|
|
434
|
+
description: fn.description,
|
|
435
|
+
parameters: sanitizeResponsesParameters(fn.parameters),
|
|
436
|
+
strict: fn.strict
|
|
437
|
+
};
|
|
438
|
+
}).filter(Boolean);
|
|
439
|
+
};
|
|
440
|
+
var convertMessagesToResponsesInput = (messages, options) => {
|
|
441
|
+
const input = [];
|
|
442
|
+
for (const message of messages) {
|
|
443
|
+
if (!message?.role) continue;
|
|
444
|
+
if (message.role === "tool") {
|
|
445
|
+
if (!message.tool_call_id) continue;
|
|
446
|
+
input.push({
|
|
447
|
+
type: "function_call_output",
|
|
448
|
+
call_id: message.tool_call_id,
|
|
449
|
+
output: normalizeToolOutput(message.content)
|
|
450
|
+
});
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
const role = message.role;
|
|
454
|
+
if (role === "assistant" && !options?.stripReasoningContent && typeof message.reasoning_content === "string" && message.reasoning_content) {
|
|
455
|
+
input.push({ type: "reasoning", content: message.reasoning_content });
|
|
456
|
+
}
|
|
457
|
+
const contentParts = normalizeMessageParts(message.content, role);
|
|
458
|
+
if (contentParts.length > 0) {
|
|
459
|
+
input.push({
|
|
460
|
+
type: "message",
|
|
461
|
+
role,
|
|
462
|
+
content: contentParts
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
if (role === "assistant" && Array.isArray(message.content)) {
|
|
466
|
+
const replayImages = message.content.map((part) => part).filter(
|
|
467
|
+
(part) => part?.type === "image_url" && typeof part.image_url?.url === "string" && Boolean(part.image_url.url)
|
|
468
|
+
).map((part) => ({
|
|
469
|
+
type: "input_image",
|
|
470
|
+
image_url: part.image_url.url,
|
|
471
|
+
detail: part.image_url.detail
|
|
472
|
+
}));
|
|
473
|
+
if (replayImages.length > 0) {
|
|
474
|
+
input.push({
|
|
475
|
+
type: "message",
|
|
476
|
+
role: "user",
|
|
477
|
+
content: replayImages
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
if (role === "assistant" && Array.isArray(message.tool_calls)) {
|
|
482
|
+
for (const toolCall of message.tool_calls) {
|
|
483
|
+
if (!toolCall?.id || !toolCall.function?.name) continue;
|
|
484
|
+
input.push({
|
|
485
|
+
type: "function_call",
|
|
486
|
+
call_id: toolCall.id,
|
|
487
|
+
name: toolCall.function.name,
|
|
488
|
+
arguments: typeof toolCall.function.arguments === "string" ? toolCall.function.arguments : JSON.stringify(toolCall.function.arguments ?? {})
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return input;
|
|
494
|
+
};
|
|
495
|
+
var extractTextFromResponseOutput = (response) => {
|
|
496
|
+
const parts = [];
|
|
497
|
+
for (const item of response?.output ?? []) {
|
|
498
|
+
if (item?.type !== "message") continue;
|
|
499
|
+
for (const content of item.content ?? []) {
|
|
500
|
+
if (content?.type === "output_text" && typeof content.text === "string") {
|
|
501
|
+
parts.push(content.text);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return parts.join("");
|
|
506
|
+
};
|
|
507
|
+
var toDataUrl = (base64Data, mimeType) => {
|
|
508
|
+
const normalizedMimeType = asOptionalTrimmedString(mimeType) ?? "image/png";
|
|
509
|
+
return `data:${normalizedMimeType};base64,${base64Data}`;
|
|
510
|
+
};
|
|
511
|
+
var extractImagePartsFromResponseOutput = (response) => {
|
|
512
|
+
const images = [];
|
|
513
|
+
for (const item of response?.output ?? []) {
|
|
514
|
+
if (item?.type === "image_generation_call") {
|
|
515
|
+
const result = asOptionalTrimmedString(item.result);
|
|
516
|
+
if (result) {
|
|
517
|
+
const outputFormat = asOptionalTrimmedString(item.output_format);
|
|
518
|
+
images.push({
|
|
519
|
+
type: "image_url",
|
|
520
|
+
image_url: {
|
|
521
|
+
url: toDataUrl(
|
|
522
|
+
result,
|
|
523
|
+
outputFormat ? `image/${outputFormat}` : void 0
|
|
524
|
+
)
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
if (item?.type !== "message") continue;
|
|
531
|
+
for (const content of item.content ?? []) {
|
|
532
|
+
const result = asOptionalTrimmedString(content?.result);
|
|
533
|
+
if (content?.type === "output_image" && result) {
|
|
534
|
+
images.push({
|
|
535
|
+
type: "image_url",
|
|
536
|
+
image_url: {
|
|
537
|
+
url: toDataUrl(
|
|
538
|
+
result,
|
|
539
|
+
content.mime_type ?? content.mimeType ?? null
|
|
540
|
+
)
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
return images;
|
|
547
|
+
};
|
|
548
|
+
var extractToolCallsFromResponseOutput = (response) => {
|
|
549
|
+
const calls = [];
|
|
550
|
+
for (const item of response?.output ?? []) {
|
|
551
|
+
if (item?.type !== "function_call") continue;
|
|
552
|
+
if (!item.call_id || !item.name) continue;
|
|
553
|
+
calls.push({
|
|
554
|
+
id: item.call_id,
|
|
555
|
+
type: "function",
|
|
556
|
+
function: {
|
|
557
|
+
name: item.name,
|
|
558
|
+
arguments: typeof item.arguments === "string" ? item.arguments : JSON.stringify(item.arguments ?? {})
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
return calls;
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
// packages/core/chat/imageParts.ts
|
|
566
|
+
function isImageUrlPart(part) {
|
|
567
|
+
return isRecord(part) && part.type === "image_url";
|
|
568
|
+
}
|
|
569
|
+
function hasImageParts(messages) {
|
|
570
|
+
return messages.some(
|
|
571
|
+
(message) => Array.isArray(message.content) && message.content.some(isImageUrlPart)
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
|
|
344
575
|
export {
|
|
345
576
|
pickAgentRuntimeInferenceOptions,
|
|
346
577
|
isOpenAiResponsesModel,
|
|
@@ -354,5 +585,15 @@ export {
|
|
|
354
585
|
resolveAgentRuntimeLocation,
|
|
355
586
|
resolveProviderTransportDecision,
|
|
356
587
|
buildProviderAuthHeaders,
|
|
357
|
-
buildProviderExecutionPlan
|
|
588
|
+
buildProviderExecutionPlan,
|
|
589
|
+
isImageUrlPart,
|
|
590
|
+
hasImageParts,
|
|
591
|
+
preserveAgentStateFields,
|
|
592
|
+
toOpenAiCompatibleMessages,
|
|
593
|
+
shouldStripReasoningContentForOutbound,
|
|
594
|
+
toResponsesTools,
|
|
595
|
+
convertMessagesToResponsesInput,
|
|
596
|
+
extractTextFromResponseOutput,
|
|
597
|
+
extractImagePartsFromResponseOutput,
|
|
598
|
+
extractToolCallsFromResponseOutput
|
|
358
599
|
};
|
|
@@ -4,34 +4,31 @@ import {
|
|
|
4
4
|
providerHttpFailure,
|
|
5
5
|
readSseFrames,
|
|
6
6
|
throwIfChatCompletionStreamFailed
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-AVVZUXXC.js";
|
|
8
8
|
import {
|
|
9
9
|
parseToolArgumentsJson
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-GSINCD4P.js";
|
|
11
11
|
import {
|
|
12
12
|
createThinkParserState,
|
|
13
13
|
createToolCallAccumulator,
|
|
14
|
-
createToolCallTextParserState,
|
|
15
14
|
extractThinkContent,
|
|
16
15
|
finalizeAccumulatedToolCalls
|
|
17
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-3WGLLTK4.js";
|
|
18
17
|
import {
|
|
19
18
|
requiresBareImageUrl,
|
|
20
19
|
toBareImageUrlMessages
|
|
21
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-LPEUV5RE.js";
|
|
22
21
|
import {
|
|
22
|
+
buildProviderAuthHeaders,
|
|
23
|
+
buildProviderExecutionPlan,
|
|
23
24
|
shouldStripReasoningContentForOutbound,
|
|
24
25
|
toOpenAiCompatibleMessages
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import {
|
|
27
|
-
buildProviderAuthHeaders,
|
|
28
|
-
buildProviderExecutionPlan
|
|
29
|
-
} from "./chunk-LJIJWXIT.js";
|
|
26
|
+
} from "./chunk-6EVITP2G.js";
|
|
30
27
|
import {
|
|
31
28
|
canonicalizeToolName,
|
|
32
29
|
createGlob,
|
|
33
30
|
resolveExecutableOnPath
|
|
34
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-JTMNCCWF.js";
|
|
35
32
|
import {
|
|
36
33
|
toErrorMessage
|
|
37
34
|
} from "./chunk-HNMXYYJR.js";
|
|
@@ -88,10 +85,6 @@ function parseSseDataLineJson(line) {
|
|
|
88
85
|
return null;
|
|
89
86
|
}
|
|
90
87
|
}
|
|
91
|
-
function parseSseDataLineObject(line) {
|
|
92
|
-
const parsed = parseSseDataLineJson(line);
|
|
93
|
-
return parsed && typeof parsed === "object" ? parsed : null;
|
|
94
|
-
}
|
|
95
88
|
|
|
96
89
|
// packages/agent-runtime/openAiCompatibleProvider.ts
|
|
97
90
|
function buildOpenAiCompatibleChatCompletionRequest(args) {
|
|
@@ -167,7 +160,6 @@ async function readOpenAiCompatibleSseCompletion(args) {
|
|
|
167
160
|
usage: void 0,
|
|
168
161
|
accumulatedToolCalls: createToolCallAccumulator(),
|
|
169
162
|
thinkState: createThinkParserState(),
|
|
170
|
-
toolCallTextState: createToolCallTextParserState(),
|
|
171
163
|
onTextDelta: args.onTextDelta,
|
|
172
164
|
onReasoningDelta: args.onReasoningDelta
|
|
173
165
|
};
|
|
@@ -841,16 +833,12 @@ var buildCombinedShellInput = (args) => {
|
|
|
841
833
|
typeof args.input === "string" ? args.input : ""
|
|
842
834
|
].filter(Boolean).join("\n");
|
|
843
835
|
};
|
|
844
|
-
function
|
|
836
|
+
function isDestructiveShellCommand(args) {
|
|
845
837
|
const combined = buildCombinedShellInput(args);
|
|
846
|
-
if (!combined.trim()) return
|
|
847
|
-
|
|
838
|
+
if (!combined.trim()) return false;
|
|
839
|
+
const scannable = SHELL_STRING_EXECUTION_PATTERNS.some(
|
|
848
840
|
(pattern) => pattern.test(combined)
|
|
849
841
|
) ? combined : stripQuotedSegments(combined);
|
|
850
|
-
}
|
|
851
|
-
function isDestructiveShellCommand(args) {
|
|
852
|
-
const scannable = resolveScannableShellInput(args);
|
|
853
|
-
if (scannable === void 0) return false;
|
|
854
842
|
return SHELL_DESTRUCTIVE_PATTERNS.some((pattern) => pattern.test(scannable));
|
|
855
843
|
}
|
|
856
844
|
var LONG_RUNNING_COMMAND_PATTERNS = [
|
|
@@ -866,42 +854,13 @@ var LONG_RUNNING_COMMAND_PATTERNS = [
|
|
|
866
854
|
/\bpm2\b.*\bstart\b/i
|
|
867
855
|
];
|
|
868
856
|
function isLongRunningShellCommand(args) {
|
|
869
|
-
const
|
|
870
|
-
if (
|
|
857
|
+
const combined = buildCombinedShellInput(args);
|
|
858
|
+
if (!combined.trim()) return false;
|
|
859
|
+
const scannable = SHELL_STRING_EXECUTION_PATTERNS.some(
|
|
860
|
+
(pattern) => pattern.test(combined)
|
|
861
|
+
) ? combined : stripQuotedSegments(combined);
|
|
871
862
|
return LONG_RUNNING_COMMAND_PATTERNS.some((pattern) => pattern.test(scannable));
|
|
872
863
|
}
|
|
873
|
-
var IMMEDIATE_DETACH_COMMAND_PATTERNS = [
|
|
874
|
-
/\btail\s+(?:-\S*[fF]\S*|--follow)\b/,
|
|
875
|
-
/\bwatch\s+\S/,
|
|
876
|
-
/\bwhile\s+(?:true|:|\[\s*true\s*\])\s*;\s*do\b/
|
|
877
|
-
];
|
|
878
|
-
var IMMEDIATE_DETACH_SLEEP_THRESHOLD_SECONDS = 5;
|
|
879
|
-
var SLEEP_PREFIX_PATTERN = /^(?:[A-Za-z_][A-Za-z0-9_]*=\S*\s+)*(?:nohup\s+|time\s+)*sleep\s+(\S+)/;
|
|
880
|
-
function parseSleepDurationSeconds(token) {
|
|
881
|
-
const match = /^(\d+(?:\.\d+)?)(s|m|h|d)?$/i.exec(token);
|
|
882
|
-
if (!match) return void 0;
|
|
883
|
-
const value = Number(match[1]);
|
|
884
|
-
if (!Number.isFinite(value)) return void 0;
|
|
885
|
-
const unit = (match[2] ?? "s").toLowerCase();
|
|
886
|
-
const factor = unit === "m" ? 60 : unit === "h" ? 3600 : unit === "d" ? 86400 : 1;
|
|
887
|
-
return value * factor;
|
|
888
|
-
}
|
|
889
|
-
function isLongSleepCommand(scannable) {
|
|
890
|
-
const match = SLEEP_PREFIX_PATTERN.exec(scannable.trim());
|
|
891
|
-
if (!match) return false;
|
|
892
|
-
const durationToken = match[1] ?? "";
|
|
893
|
-
if (/^inf(inity)?$/i.test(durationToken)) return true;
|
|
894
|
-
const seconds = parseSleepDurationSeconds(durationToken);
|
|
895
|
-
if (seconds === void 0) return true;
|
|
896
|
-
return seconds > IMMEDIATE_DETACH_SLEEP_THRESHOLD_SECONDS;
|
|
897
|
-
}
|
|
898
|
-
function isImmediateDetachShellCommand(args) {
|
|
899
|
-
const scannable = resolveScannableShellInput(args);
|
|
900
|
-
if (scannable === void 0) return false;
|
|
901
|
-
return isLongSleepCommand(scannable) || LONG_RUNNING_COMMAND_PATTERNS.some((pattern) => pattern.test(scannable)) || IMMEDIATE_DETACH_COMMAND_PATTERNS.some(
|
|
902
|
-
(pattern) => pattern.test(scannable)
|
|
903
|
-
);
|
|
904
|
-
}
|
|
905
864
|
function evaluateShellCommandPolicy(args) {
|
|
906
865
|
if (isDestructiveShellCommand(args) && !hasExplicitDestructivePermission(args.userInput)) {
|
|
907
866
|
return {
|
|
@@ -1584,7 +1543,7 @@ function buildExecShellTool(toolName) {
|
|
|
1584
1543
|
type: "function",
|
|
1585
1544
|
function: {
|
|
1586
1545
|
name: toolName,
|
|
1587
|
-
description: "Run a shell command in the local workspace. Commands already execute from the workspace root; do not cd into guessed paths such as /workspace, /repo, /home/user, or /home/user/workspace. Prefer one command that performs a complete verification or related git operation instead of many tiny commands. For branch setup, prefer idempotent commands such as git switch -C <branch> when replacing or recreating a benchmark branch is acceptable. Use portable POSIX commands for macOS/BSD shells; avoid GNU-only flags such as cat -A. Do not use cat -A. Do not use brittle byte-offset commands such as xxd -s -32. For separator lines, use echo or printf '%s\\n'. For text-file content or trailing-newline checks, prefer readFile over shell byte inspection when that tool is available. Do not run repeated git status, git log, git rev-parse, or branch checks after a successful command already returned the needed clean status and commit information; use one final verification command. If a command fails, use the error output to adjust the next command rather than repeating the same shape. For long-running commands that should keep running in the background (dev servers, watchers, REPLs, `--watch`/`serve`/`dev` scripts),
|
|
1546
|
+
description: "Run a shell command in the local workspace. Commands already execute from the workspace root; do not cd into guessed paths such as /workspace, /repo, /home/user, or /home/user/workspace. Prefer one command that performs a complete verification or related git operation instead of many tiny commands. For branch setup, prefer idempotent commands such as git switch -C <branch> when replacing or recreating a benchmark branch is acceptable. Use portable POSIX commands for macOS/BSD shells; avoid GNU-only flags such as cat -A. Do not use cat -A. Do not use brittle byte-offset commands such as xxd -s -32. For separator lines, use echo or printf '%s\\n'. For text-file content or trailing-newline checks, prefer readFile over shell byte inspection when that tool is available. Do not run repeated git status, git log, git rev-parse, or branch checks after a successful command already returned the needed clean status and commit information; use one final verification command. If a command fails, use the error output to adjust the next command rather than repeating the same shape. For long-running commands that should keep running in the background (dev servers, watchers, REPLs, `--watch`/`serve`/`dev` scripts), use launchProcess instead \u2014 execShell blocks until the command exits and will freeze the conversation.",
|
|
1588
1547
|
parameters: {
|
|
1589
1548
|
type: "object",
|
|
1590
1549
|
properties: {
|
|
@@ -1781,9 +1740,8 @@ function resolveExecShellTimeoutMs(override) {
|
|
|
1781
1740
|
return asOptionalPositiveFiniteNumber(Number(raw));
|
|
1782
1741
|
}
|
|
1783
1742
|
function resolveDetachMs(override) {
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
}
|
|
1743
|
+
const fromOverride = asOptionalPositiveFiniteNumber(override);
|
|
1744
|
+
if (fromOverride !== void 0) return fromOverride;
|
|
1787
1745
|
const raw = process.env[EXEC_SHELL_DETACH_ENV];
|
|
1788
1746
|
if (raw === void 0) return DEFAULT_EXEC_SHELL_DETACH_MS;
|
|
1789
1747
|
const parsed = asOptionalPositiveFiniteNumber(Number(raw));
|
|
@@ -2547,9 +2505,9 @@ async function runWorkspaceCommand(args) {
|
|
|
2547
2505
|
args.abortSignal.addEventListener("abort", abortListener, { once: true });
|
|
2548
2506
|
}) : null;
|
|
2549
2507
|
const effectiveDetachMs = resolveDetachMs(args.detachMs);
|
|
2550
|
-
const detachPromise = new Promise((r) => {
|
|
2508
|
+
const detachPromise = effectiveDetachMs ? new Promise((r) => {
|
|
2551
2509
|
detachTimer = setTimeout(() => r(detachResult), effectiveDetachMs);
|
|
2552
|
-
});
|
|
2510
|
+
}) : null;
|
|
2553
2511
|
const racers = [exitPromise];
|
|
2554
2512
|
if (timeoutMs) {
|
|
2555
2513
|
racers.push(
|
|
@@ -2559,7 +2517,7 @@ async function runWorkspaceCommand(args) {
|
|
|
2559
2517
|
);
|
|
2560
2518
|
}
|
|
2561
2519
|
if (abortPromise) racers.push(abortPromise);
|
|
2562
|
-
racers.push(detachPromise);
|
|
2520
|
+
if (detachPromise) racers.push(detachPromise);
|
|
2563
2521
|
let raceWinner;
|
|
2564
2522
|
try {
|
|
2565
2523
|
raceWinner = await Promise.race(racers);
|
|
@@ -2592,35 +2550,25 @@ async function runWorkspaceCommand(args) {
|
|
|
2592
2550
|
killChild("SIGKILL");
|
|
2593
2551
|
}
|
|
2594
2552
|
if (didDetach) {
|
|
2595
|
-
|
|
2596
|
-
});
|
|
2553
|
+
detachSignalCleanup();
|
|
2597
2554
|
const pid = typeof proc.pid === "number" ? proc.pid : 0;
|
|
2598
2555
|
const label = deriveLabel(args.command.join(" "));
|
|
2599
2556
|
const pgid = pid;
|
|
2600
2557
|
const registry2 = getProcessRegistry();
|
|
2601
2558
|
registry2.add({ pid, pgid, command: args.command.join(" "), label });
|
|
2602
2559
|
proc.on("close", (code) => {
|
|
2603
|
-
detachSignalCleanup();
|
|
2604
2560
|
registry2.markExited(pid, code ?? 1);
|
|
2605
2561
|
});
|
|
2606
|
-
const immediate = effectiveDetachMs === 0;
|
|
2607
|
-
const reason = immediate ? `command looks long-running; moved to background immediately (pid=${pid}, label=${label})` : `command detached to background after ${effectiveDetachMs}ms (pid=${pid}, label=${label})`;
|
|
2608
2562
|
return {
|
|
2609
2563
|
stdout: "",
|
|
2610
|
-
stderr:
|
|
2611
|
-
Use listProcesses to inspect
|
|
2564
|
+
stderr: `command detached to background after ${effectiveDetachMs}ms (pid=${pid}, label=${label})
|
|
2565
|
+
Use listProcesses / processRegistry to inspect.`,
|
|
2612
2566
|
exitCode: 0,
|
|
2613
2567
|
timedOut: false,
|
|
2614
2568
|
detached: true,
|
|
2615
2569
|
pid,
|
|
2616
2570
|
label,
|
|
2617
|
-
content: JSON.stringify({
|
|
2618
|
-
detached: true,
|
|
2619
|
-
pid,
|
|
2620
|
-
label,
|
|
2621
|
-
status: "running",
|
|
2622
|
-
...immediate ? { reason: "long-running-command" } : {}
|
|
2623
|
-
})
|
|
2571
|
+
content: JSON.stringify({ detached: true, pid, label, status: "running" })
|
|
2624
2572
|
};
|
|
2625
2573
|
}
|
|
2626
2574
|
const [stdout, rawStderr] = await Promise.all([
|
|
@@ -3452,11 +3400,7 @@ async function execShellTool(args) {
|
|
|
3452
3400
|
outputLimit: args.commandOutputLimit,
|
|
3453
3401
|
commandPrefix: args.commandPrefix,
|
|
3454
3402
|
abortSignal: args.abortSignal,
|
|
3455
|
-
|
|
3456
|
-
// servers, infinite loops) are promoted to background immediately so the
|
|
3457
|
-
// turn — and the user's conversation — keeps going. Everything else keeps
|
|
3458
|
-
// the caller/env detach grace window.
|
|
3459
|
-
detachMs: isImmediateDetachShellCommand({ command }) ? 0 : args.detachMs
|
|
3403
|
+
detachMs: args.detachMs
|
|
3460
3404
|
});
|
|
3461
3405
|
const activity = extractActivity(parsed);
|
|
3462
3406
|
return {
|
|
@@ -3630,7 +3574,6 @@ function createLocalWorkspaceToolExecutors(args) {
|
|
|
3630
3574
|
|
|
3631
3575
|
export {
|
|
3632
3576
|
parseSseDataLineJson,
|
|
3633
|
-
parseSseDataLineObject,
|
|
3634
3577
|
buildOpenAiCompatibleChatCompletionRequest,
|
|
3635
3578
|
parseOpenAiCompatibleChatCompletionResponse,
|
|
3636
3579
|
readOpenAiCompatibleSseCompletion,
|