nolo-cli 0.109.0-alpha.3 → 0.111.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-OXVCJ2BM.js → _executeModel-S7OU2QIO.js} +13 -13
- package/{agentDeleteCommand-QJAHAZ4T.js → agentDeleteCommand-XWLL2PMB.js} +6 -6
- package/{agentEmailCommands-3SCPUF33.js → agentEmailCommands-PNEZCF6T.js} +15 -15
- package/{agentListCommands-QXGSCIV4.js → agentListCommands-MQVMQVOE.js} +17 -10
- package/{agentMachineCommands-E4NUTGI6.js → agentMachineCommands-SIVJRNKN.js} +6 -6
- package/{agentRecordCommands-OMWI6OH5.js → agentRecordCommands-6POMYCA7.js} +15 -15
- package/{agentRunCommand-GMSUBYF6.js → agentRunCommand-A5JN2A55.js} +15 -15
- package/{agentRuntimeLocal-7MO5IJV6.js → agentRuntimeLocal-73R544NQ.js} +3 -3
- package/{agentSlice-5H7MTCE7.js → agentSlice-UTLXHAFW.js} +1 -1
- package/{appDeleteCommands-UQ5YMNLP.js → appDeleteCommands-WOSWEWOC.js} +7 -7
- package/{appDeployCommands-QX6BL5XL.js → appDeployCommands-KSOWMHCG.js} +7 -7
- package/{appDeployStatusCommands-QHQVLR3J.js → appDeployStatusCommands-JCMJMYK4.js} +7 -7
- package/{appGetCommands-GY4NGSF4.js → appGetCommands-7LIJCRZ3.js} +7 -7
- package/{appListCommands-IZCYPSKI.js → appListCommands-T4JTSWDD.js} +7 -7
- package/{chatQueueReduxAdapter-LO7EUBKJ.js → chatQueueReduxAdapter-LXYPUM6T.js} +2 -2
- package/{chunk-Z77CRGTW.js → chunk-3AMA42ZI.js} +1 -1
- package/{chunk-IQPFGYO3.js → chunk-3YIAR5UI.js} +1 -1
- package/{chunk-LXATDEM7.js → chunk-4RMFGFRH.js} +3 -3
- package/{chunk-3OD2OTTR.js → chunk-5PJTI4EP.js} +1 -1
- package/{chunk-CQ5TTXPU.js → chunk-6S3QIHMN.js} +5 -5
- package/{chunk-2OASQKU2.js → chunk-CWQINZEA.js} +112 -2
- package/{chunk-DNAF7JC6.js → chunk-FBFEKY73.js} +94 -15
- package/{chunk-PHXD6JTX.js → chunk-FKNWP6SG.js} +1 -1
- package/{chunk-MRIHM22T.js → chunk-FORUBDQQ.js} +1 -1
- package/{chunk-APB6ES6B.js → chunk-FZK3Z2MJ.js} +1 -1
- package/{chunk-KZJP33ZK.js → chunk-HAFJ3NDE.js} +2 -2
- package/{chunk-IIVGDG4I.js → chunk-HCT7U36O.js} +3 -0
- package/{chunk-HSSRGGXJ.js → chunk-K36IXSCQ.js} +1 -1
- package/{chunk-PBF2K4ER.js → chunk-K4A446HZ.js} +2 -2
- package/{chunk-DGE5HEGA.js → chunk-L322LGOM.js} +2 -2
- package/{chunk-L6LNO27F.js → chunk-L4KM22WM.js} +10 -9
- package/{chunk-QHYC7W2Y.js → chunk-NJBXVHED.js} +2 -2
- package/{chunk-LWKP7AWH.js → chunk-QSHEEA5N.js} +1 -1
- package/{chunk-HQTMPHIS.js → chunk-TDGDSTGC.js} +29 -107
- package/{chunk-XA6KE2HD.js → chunk-WKWF4RJH.js} +8 -8
- package/{chunk-AODJ7WSF.js → chunk-WP5UXDA5.js} +4 -3
- package/{chunk-HLKK4S6U.js → chunk-WTDSXQIV.js} +2 -2
- package/{chunk-TJOYV65D.js → chunk-XRTLTE4O.js} +4 -4
- package/{chunk-HWGNS46C.js → chunk-YP7H6FE4.js} +4 -4
- package/{chunk-QPPZN3AA.js → chunk-YYYAN2NH.js} +2 -2
- package/{contentThunks-L4UB5RXR.js → contentThunks-BKHGW5JF.js} +3 -3
- package/{createAgentAutomationAction-FOXQWOJQ.js → createAgentAutomationAction-5VG5HN7Z.js} +3 -3
- package/{createDialogAction-YRAHHXWR.js → createDialogAction-MA7HM3BD.js} +4 -4
- package/{createPageAction-MVFMLE3N.js → createPageAction-G7IYJMTT.js} +3 -3
- package/{dialogCommands-HSLLNN4Y.js → dialogCommands-2PEE34TR.js} +7 -7
- package/{dialogSlice-VI4GR4PA.js → dialogSlice-ORVLG3AA.js} +2 -2
- package/{docCreateCommands-I2Y4IR2O.js → docCreateCommands-PZHUUFTX.js} +6 -6
- package/{docDeleteCommands-TLRPJXQ6.js → docDeleteCommands-CEWIA4CQ.js} +7 -7
- package/{docReadCommands-6AKGK2LU.js → docReadCommands-4TVEX6ZD.js} +6 -6
- package/{docStore-X75VCYIF.js → docStore-JFRTM66X.js} +1 -1
- package/{docUpdateCommands-54AZTMMH.js → docUpdateCommands-TW3PHXLY.js} +6 -6
- package/{handleSendMessageAction-E3B2YV3N.js → handleSendMessageAction-GALALRRM.js} +2 -2
- package/index.js +41 -41
- package/{machineCommands-MGVJGN3N.js → machineCommands-SLKZBMRB.js} +14 -14
- package/{machineWsRunDispatch-AHRZCOIG.js → machineWsRunDispatch-4JISAOO2.js} +14 -14
- package/package.json +1 -1
- package/{readlineWorkspace-2G3MDALM.js → readlineWorkspace-6USXFY6R.js} +49 -29
- package/{runAgentClientLoop-O4EDXPBJ.js → runAgentClientLoop-6DAWYFWZ.js} +11 -11
- package/{spaceCommands-ESJCQ5UY.js → spaceCommands-7Y5AUMLD.js} +6 -6
- package/{streamAgentChatTurn-OBSA4Z6K.js → streamAgentChatTurn-T7B7IVHX.js} +12 -12
- package/{tools-XBU2MRGG.js → tools-CGRUHWCA.js} +8 -8
- package/{updateDialogTitleAction-DATQ2KIC.js → updateDialogTitleAction-QMSKYS55.js} +3 -3
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
pickDefined,
|
|
6
6
|
printCliError,
|
|
7
7
|
resolveCliContext
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-K36IXSCQ.js";
|
|
9
9
|
import {
|
|
10
10
|
hasFlag,
|
|
11
11
|
hasHelpArg
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-FKNWP6SG.js";
|
|
13
|
+
import "./chunk-QSHEEA5N.js";
|
|
14
|
+
import "./chunk-3AMA42ZI.js";
|
|
15
15
|
import "./chunk-SV5IJK6K.js";
|
|
16
16
|
import "./chunk-VF4K2QE6.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-L322LGOM.js";
|
|
18
18
|
import "./chunk-H4AHY5BU.js";
|
|
19
19
|
import "./chunk-FV3JEYR3.js";
|
|
20
20
|
import "./chunk-GMZLP5DV.js";
|
|
@@ -23,9 +23,9 @@ import "./chunk-4MK3I7Y4.js";
|
|
|
23
23
|
import "./chunk-CQ3WA2NE.js";
|
|
24
24
|
import "./chunk-5ZUL4CUO.js";
|
|
25
25
|
import "./chunk-N7J63Q6C.js";
|
|
26
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-FORUBDQQ.js";
|
|
27
27
|
import "./chunk-PUOC4YRO.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-HCT7U36O.js";
|
|
29
29
|
import "./chunk-FDTR4QJ6.js";
|
|
30
30
|
import "./chunk-GNCCNNZD.js";
|
|
31
31
|
import "./chunk-6OZ36FXI.js";
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
} from "./chunk-YPREESF4.js";
|
|
5
5
|
import {
|
|
6
6
|
handleSendMessage
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WKWF4RJH.js";
|
|
8
8
|
import "./chunk-MC4XLIJ7.js";
|
|
9
9
|
import "./chunk-3BMYXEUW.js";
|
|
10
10
|
import "./chunk-YYLHWIW6.js";
|
|
11
11
|
import "./chunk-AGGIDPCZ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-4RMFGFRH.js";
|
|
13
13
|
import "./chunk-BFDFRLLQ.js";
|
|
14
14
|
import "./chunk-5RGU3J7P.js";
|
|
15
15
|
import {
|
|
@@ -304,7 +304,7 @@ var slice = createSliceWithThunks({
|
|
|
304
304
|
const overrides = {};
|
|
305
305
|
if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
|
|
306
306
|
if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
|
|
307
|
-
const { _executeModel } = await import("./_executeModel-
|
|
307
|
+
const { _executeModel } = await import("./_executeModel-S7OU2QIO.js");
|
|
308
308
|
return _executeModel(
|
|
309
309
|
{
|
|
310
310
|
isStreaming: args.isStreaming ?? false,
|
|
@@ -325,7 +325,7 @@ var slice = createSliceWithThunks({
|
|
|
325
325
|
* - 循环直到无工具调用或触发其他运行时停止条件
|
|
326
326
|
*/
|
|
327
327
|
runAgent: create.asyncThunk(async (args, thunkApi) => {
|
|
328
|
-
const { runAgentClientLoop } = await import("./runAgentClientLoop-
|
|
328
|
+
const { runAgentClientLoop } = await import("./runAgentClientLoop-6DAWYFWZ.js");
|
|
329
329
|
const { content: loopContent, toolCallCount } = await runAgentClientLoop(
|
|
330
330
|
{
|
|
331
331
|
agentKey: args.agentKey,
|
|
@@ -341,7 +341,7 @@ var slice = createSliceWithThunks({
|
|
|
341
341
|
* 聊天轮次流式 Agent 调用
|
|
342
342
|
*/
|
|
343
343
|
streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
|
|
344
|
-
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-
|
|
344
|
+
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-T7B7IVHX.js");
|
|
345
345
|
return streamAgentChatTurnHandler(args, thunkApi);
|
|
346
346
|
}),
|
|
347
347
|
/**
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
inlineImageUrlsForCustomProvider,
|
|
6
6
|
prepareTools,
|
|
7
7
|
shouldInlineImageUrlsForAgent
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NJBXVHED.js";
|
|
9
9
|
import {
|
|
10
10
|
INVALID_TOOL_ARGS_REPLACEMENT,
|
|
11
11
|
buildInvalidToolCallSelfHealResult,
|
|
12
12
|
parseToolCallArguments,
|
|
13
13
|
performFetchRequest,
|
|
14
14
|
sanitizeOutboundMessages
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-XRTLTE4O.js";
|
|
16
16
|
import {
|
|
17
17
|
createSSEParser,
|
|
18
18
|
createToolRunId,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
toolRunSetPending,
|
|
24
24
|
toolRunStarted,
|
|
25
25
|
toolRunSucceeded
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-TDGDSTGC.js";
|
|
27
27
|
import {
|
|
28
28
|
getPublicImageAgentMode
|
|
29
29
|
} from "./chunk-VIDPVFP3.js";
|
|
@@ -35,10 +35,10 @@ import {
|
|
|
35
35
|
messageStreamEnd,
|
|
36
36
|
messageStreaming,
|
|
37
37
|
updateToolMessage
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-WKWF4RJH.js";
|
|
39
39
|
import {
|
|
40
40
|
streamAgentChatTurn
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-4RMFGFRH.js";
|
|
42
42
|
import {
|
|
43
43
|
addActiveController,
|
|
44
44
|
removeActiveController,
|
|
@@ -3,7 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-YYLHWIW6.js";
|
|
4
4
|
import {
|
|
5
5
|
compareAgentSelection
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HCT7U36O.js";
|
|
7
|
+
import {
|
|
8
|
+
isAgentUnavailableNow
|
|
9
|
+
} from "./chunk-FDTR4QJ6.js";
|
|
7
10
|
import {
|
|
8
11
|
isAntigravityOAuthAgent
|
|
9
12
|
} from "./chunk-GNCCNNZD.js";
|
|
@@ -506,6 +509,110 @@ function toUnavailableAgentSummary(summary) {
|
|
|
506
509
|
return item;
|
|
507
510
|
}
|
|
508
511
|
|
|
512
|
+
// packages/ai/agent/agentDiscovery.ts
|
|
513
|
+
function isPreferredAgent(agent) {
|
|
514
|
+
return agent.isFavorite === true || agent.isOwned === true || agent.isOAuth === true || agent.billingSource === "user_subscription" || agent.billingSource === "user_api" || agent.billingSource === "local";
|
|
515
|
+
}
|
|
516
|
+
function isPublicDiscoveryAgent(agent) {
|
|
517
|
+
return agent.isPublic === true && !isPreferredAgent(agent);
|
|
518
|
+
}
|
|
519
|
+
function resolveDiscoveryScope(args) {
|
|
520
|
+
const rawScope = typeof args?.scope === "string" ? args.scope.trim().toLowerCase() : void 0;
|
|
521
|
+
const hasScope = rawScope !== void 0 && rawScope !== "";
|
|
522
|
+
const hasPublicOnly = typeof args?.publicOnly === "boolean";
|
|
523
|
+
const publicOnly = args?.publicOnly === true;
|
|
524
|
+
if (hasScope) {
|
|
525
|
+
if (rawScope !== "preferred" && rawScope !== "public" && rawScope !== "all") {
|
|
526
|
+
throw new Error(`Invalid scope '${args?.scope}': must be 'preferred', 'public', or 'all'.`);
|
|
527
|
+
}
|
|
528
|
+
const scope = rawScope;
|
|
529
|
+
if (hasPublicOnly) {
|
|
530
|
+
if (publicOnly && scope !== "public") {
|
|
531
|
+
throw new Error(
|
|
532
|
+
`Conflicting arguments: scope='${args?.scope}' conflicts with publicOnly=true.`
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
if (!publicOnly && scope === "public") {
|
|
536
|
+
throw new Error(
|
|
537
|
+
`Conflicting arguments: scope='${args?.scope}' conflicts with publicOnly=false.`
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
return scope;
|
|
542
|
+
}
|
|
543
|
+
if (hasPublicOnly && publicOnly) {
|
|
544
|
+
return "public";
|
|
545
|
+
}
|
|
546
|
+
return "preferred";
|
|
547
|
+
}
|
|
548
|
+
function agentIdentityKeys(agent) {
|
|
549
|
+
return [agent.agentKey, agent.publicKey, agent.id].filter(
|
|
550
|
+
(key) => typeof key === "string" && key.length > 0
|
|
551
|
+
);
|
|
552
|
+
}
|
|
553
|
+
function deduplicateAgentSummaries(agents) {
|
|
554
|
+
const byIdentity = /* @__PURE__ */ new Map();
|
|
555
|
+
for (const agent of agents) {
|
|
556
|
+
const keys = agentIdentityKeys(agent);
|
|
557
|
+
const existing = keys.map((key) => byIdentity.get(key)).find(Boolean);
|
|
558
|
+
if (!existing) {
|
|
559
|
+
for (const key of keys) byIdentity.set(key, agent);
|
|
560
|
+
continue;
|
|
561
|
+
}
|
|
562
|
+
const winner = isPreferredAgent(agent) && !isPreferredAgent(existing) ? agent : existing;
|
|
563
|
+
for (const key of /* @__PURE__ */ new Set([...agentIdentityKeys(existing), ...keys])) byIdentity.set(key, winner);
|
|
564
|
+
}
|
|
565
|
+
return [...new Set(byIdentity.values())];
|
|
566
|
+
}
|
|
567
|
+
function filterAgentsByScope(agents, scope) {
|
|
568
|
+
const unique = deduplicateAgentSummaries(agents);
|
|
569
|
+
if (scope === "preferred") return unique.filter((agent) => isPreferredAgent(agent));
|
|
570
|
+
if (scope === "public") return unique.filter((agent) => isPublicDiscoveryAgent(agent));
|
|
571
|
+
return unique.filter((agent) => isPreferredAgent(agent) || agent.isPublic === true);
|
|
572
|
+
}
|
|
573
|
+
function matchesAgentQuery(agent, query) {
|
|
574
|
+
if (!query || typeof query !== "string") return true;
|
|
575
|
+
const q = query.trim().toLowerCase();
|
|
576
|
+
if (!q) return true;
|
|
577
|
+
const candidates = [
|
|
578
|
+
agent.name,
|
|
579
|
+
agent.model,
|
|
580
|
+
agent.provider,
|
|
581
|
+
agent.handle,
|
|
582
|
+
agent.agentKey,
|
|
583
|
+
agent.publicKey,
|
|
584
|
+
agent.id
|
|
585
|
+
];
|
|
586
|
+
return candidates.some((text) => typeof text === "string" && text.toLowerCase().includes(q));
|
|
587
|
+
}
|
|
588
|
+
function buildAgentDiscoveryResult(options) {
|
|
589
|
+
const scope = resolveDiscoveryScope({
|
|
590
|
+
scope: options.scope,
|
|
591
|
+
publicOnly: options.publicOnly
|
|
592
|
+
});
|
|
593
|
+
const now = options.now ?? Date.now();
|
|
594
|
+
let scopedAgents = filterAgentsByScope(options.agents, scope);
|
|
595
|
+
if (options.query && typeof options.query === "string" && options.query.trim()) {
|
|
596
|
+
scopedAgents = scopedAgents.filter((a) => matchesAgentQuery(a, options.query));
|
|
597
|
+
}
|
|
598
|
+
const unavailableList = scopedAgents.filter((a) => isAgentUnavailableNow(a, now));
|
|
599
|
+
const unavailableCount = unavailableList.length;
|
|
600
|
+
const unavailableAgents = sortSafeAgentSummaries(unavailableList).map(toUnavailableAgentSummary);
|
|
601
|
+
const credentialGroups = summarizeCredentialGroups(scopedAgents, now);
|
|
602
|
+
if (options.showUnavailable !== true) {
|
|
603
|
+
scopedAgents = scopedAgents.filter((a) => !isAgentUnavailableNow(a, now));
|
|
604
|
+
}
|
|
605
|
+
const sortedAgents = sortSafeAgentSummaries(scopedAgents);
|
|
606
|
+
const projectedAgents = options.verbose === true ? sortedAgents.map(omitNullishAgentSummaryFields) : sortedAgents.map(toCompactAgentSummary);
|
|
607
|
+
return {
|
|
608
|
+
total: projectedAgents.length,
|
|
609
|
+
unavailableCount,
|
|
610
|
+
unavailableAgents,
|
|
611
|
+
credentialGroups,
|
|
612
|
+
agents: projectedAgents
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
|
|
509
616
|
export {
|
|
510
617
|
deriveCredentialGroup,
|
|
511
618
|
summarizeCredentialGroups,
|
|
@@ -513,5 +620,8 @@ export {
|
|
|
513
620
|
sortSafeAgentSummaries,
|
|
514
621
|
omitNullishAgentSummaryFields,
|
|
515
622
|
toCompactAgentSummary,
|
|
516
|
-
toUnavailableAgentSummary
|
|
623
|
+
toUnavailableAgentSummary,
|
|
624
|
+
resolveDiscoveryScope,
|
|
625
|
+
matchesAgentQuery,
|
|
626
|
+
buildAgentDiscoveryResult
|
|
517
627
|
};
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
resolveLocalUserId,
|
|
31
31
|
t,
|
|
32
32
|
toolLabel
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-L4KM22WM.js";
|
|
34
34
|
import {
|
|
35
35
|
createRunActivityTracker,
|
|
36
36
|
popSingleQueueMessage,
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
import {
|
|
52
52
|
readDbRecord,
|
|
53
53
|
resolveAgentRecordFromHybridStore
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-QSHEEA5N.js";
|
|
55
55
|
import {
|
|
56
56
|
isLocalCliAgentKey
|
|
57
57
|
} from "./chunk-SV5IJK6K.js";
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
} from "./chunk-LTRXGFMS.js";
|
|
65
65
|
import {
|
|
66
66
|
formatAgentListCard
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-TDGDSTGC.js";
|
|
68
68
|
import {
|
|
69
69
|
isTransientFetchError
|
|
70
70
|
} from "./chunk-5UTFL4QJ.js";
|
|
@@ -88,11 +88,11 @@ import {
|
|
|
88
88
|
chooseMemoryOwners,
|
|
89
89
|
loadMemoryCandidatesFromDb,
|
|
90
90
|
resolveAgentMemoryPolicy
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-YYYAN2NH.js";
|
|
92
92
|
import {
|
|
93
93
|
API_REPORTED_COST_MULTIPLIER,
|
|
94
94
|
parseUiAskChoiceContent
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-WKWF4RJH.js";
|
|
96
96
|
import {
|
|
97
97
|
isOAuthApiKeyRef
|
|
98
98
|
} from "./chunk-YYLHWIW6.js";
|
|
@@ -115,7 +115,7 @@ import {
|
|
|
115
115
|
LOCAL_AGENT_CONFIG_MISSING_CODE,
|
|
116
116
|
LOCAL_TURN_ABORTED_CODE,
|
|
117
117
|
readActionGate
|
|
118
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-L322LGOM.js";
|
|
119
119
|
import {
|
|
120
120
|
resolveAgentRuntimeConfigFromRecord
|
|
121
121
|
} from "./chunk-4MK3I7Y4.js";
|
|
@@ -9834,6 +9834,7 @@ ${this.text}
|
|
|
9834
9834
|
// packages/cli/client/agentRunOutput.ts
|
|
9835
9835
|
var IDENTITY_LABEL_SEPARATOR = " > ";
|
|
9836
9836
|
var THINKING_PREVIEW_BUFFER_LIMIT = 512;
|
|
9837
|
+
var TUI_PROGRESS_BUFFER_LIMIT = 320;
|
|
9837
9838
|
function appendThinkingPreview(current, chunk, limit = THINKING_PREVIEW_BUFFER_LIMIT) {
|
|
9838
9839
|
if (limit <= 0) return "";
|
|
9839
9840
|
const combined = current + chunk;
|
|
@@ -9895,6 +9896,15 @@ function formatToolJsonEvent(event) {
|
|
|
9895
9896
|
})}
|
|
9896
9897
|
`;
|
|
9897
9898
|
}
|
|
9899
|
+
function shouldPromoteTuiNarration(text) {
|
|
9900
|
+
if (text.length >= TUI_PROGRESS_BUFFER_LIMIT) return true;
|
|
9901
|
+
if (/\n\s*\n/.test(text)) return true;
|
|
9902
|
+
return /(^|\n)\s*(?:#{1,3}\s|```|[-*+]\s|\d+[.)]\s)/.test(text);
|
|
9903
|
+
}
|
|
9904
|
+
function narrationActivityLabel(text) {
|
|
9905
|
+
const oneLine = stripAnsi2(text).replace(/[`*_#>]/g, "").replace(/\s+/g, " ").trim();
|
|
9906
|
+
return truncateThinkingHint(oneLine, 60);
|
|
9907
|
+
}
|
|
9898
9908
|
function createCliTurnOutput(params) {
|
|
9899
9909
|
const { options } = params;
|
|
9900
9910
|
const workingLabel = params.workingLabel ?? `${options.agentName} -> working`;
|
|
@@ -9903,7 +9913,8 @@ function createCliTurnOutput(params) {
|
|
|
9903
9913
|
tuiTrees: options.output.tuiTrees === true
|
|
9904
9914
|
});
|
|
9905
9915
|
const eventMode = resolveAgentEventMode(options);
|
|
9906
|
-
const
|
|
9916
|
+
const assistantLabelManaged = options.output.assistantLabelManaged === true;
|
|
9917
|
+
const showThinking = !assistantLabelManaged && options.showThinking !== false;
|
|
9907
9918
|
let streamedAssistantText = false;
|
|
9908
9919
|
let everStreamedAnyText = false;
|
|
9909
9920
|
let printedAssistantLabel = false;
|
|
@@ -9940,7 +9951,6 @@ function createCliTurnOutput(params) {
|
|
|
9940
9951
|
}
|
|
9941
9952
|
};
|
|
9942
9953
|
let compactionEvent = null;
|
|
9943
|
-
const assistantLabelManaged = options.output.assistantLabelManaged === true;
|
|
9944
9954
|
const writeToolOutput = (chunk) => {
|
|
9945
9955
|
if (!chunk) return;
|
|
9946
9956
|
if (typeof options.output.writeToolBlock === "function") {
|
|
@@ -9952,9 +9962,25 @@ function createCliTurnOutput(params) {
|
|
|
9952
9962
|
const renderWriter = createRenderAwareStreamWriter({
|
|
9953
9963
|
write: (chunk) => options.output.write(chunk)
|
|
9954
9964
|
});
|
|
9965
|
+
let pendingTuiNarration = "";
|
|
9966
|
+
let tuiNarrationPromoted = false;
|
|
9967
|
+
const flushPendingTuiNarration = () => {
|
|
9968
|
+
if (!pendingTuiNarration) return;
|
|
9969
|
+
formatToolEvent.reset?.();
|
|
9970
|
+
renderWriter.push(pendingTuiNarration);
|
|
9971
|
+
pendingTuiNarration = "";
|
|
9972
|
+
tuiNarrationPromoted = true;
|
|
9973
|
+
streamedAssistantText = true;
|
|
9974
|
+
options.activityReporter?.(null);
|
|
9975
|
+
};
|
|
9976
|
+
const dropPendingTuiProgress = () => {
|
|
9977
|
+
pendingTuiNarration = "";
|
|
9978
|
+
tuiNarrationPromoted = false;
|
|
9979
|
+
options.activityReporter?.(null);
|
|
9980
|
+
};
|
|
9955
9981
|
const writeVisibleAssistantChunk = (chunk) => {
|
|
9956
9982
|
if (!chunk) return;
|
|
9957
|
-
formatToolEvent.reset?.();
|
|
9983
|
+
if (!assistantLabelManaged) formatToolEvent.reset?.();
|
|
9958
9984
|
const parsed = processThinkChunk(chunk, thinkState);
|
|
9959
9985
|
thinkState = parsed.state;
|
|
9960
9986
|
if (!parsed.content && !parsed.reasoning) return;
|
|
@@ -9970,8 +9996,23 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
9970
9996
|
}
|
|
9971
9997
|
printedAssistantLabel = true;
|
|
9972
9998
|
}
|
|
9973
|
-
streamedAssistantText = true;
|
|
9974
9999
|
everStreamedAnyText = true;
|
|
10000
|
+
if (assistantLabelManaged) {
|
|
10001
|
+
if (tuiNarrationPromoted) {
|
|
10002
|
+
renderWriter.push(parsed.content);
|
|
10003
|
+
streamedAssistantText = true;
|
|
10004
|
+
return;
|
|
10005
|
+
}
|
|
10006
|
+
pendingTuiNarration += parsed.content;
|
|
10007
|
+
if (shouldPromoteTuiNarration(pendingTuiNarration)) {
|
|
10008
|
+
flushPendingTuiNarration();
|
|
10009
|
+
} else {
|
|
10010
|
+
const label = narrationActivityLabel(pendingTuiNarration);
|
|
10011
|
+
if (label) options.activityReporter?.(label);
|
|
10012
|
+
}
|
|
10013
|
+
return;
|
|
10014
|
+
}
|
|
10015
|
+
streamedAssistantText = true;
|
|
9975
10016
|
renderWriter.push(parsed.content);
|
|
9976
10017
|
};
|
|
9977
10018
|
const handleToolEvent = (event) => {
|
|
@@ -9987,6 +10028,9 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
9987
10028
|
return;
|
|
9988
10029
|
}
|
|
9989
10030
|
if (event.type === "tool-call") {
|
|
10031
|
+
if (assistantLabelManaged && pendingTuiNarration) {
|
|
10032
|
+
dropPendingTuiProgress();
|
|
10033
|
+
}
|
|
9990
10034
|
renderWriter.flush();
|
|
9991
10035
|
formatToolEvent(event);
|
|
9992
10036
|
endThinkingPhase();
|
|
@@ -9994,6 +10038,7 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
9994
10038
|
options.output.write("\n");
|
|
9995
10039
|
streamedAssistantText = false;
|
|
9996
10040
|
}
|
|
10041
|
+
if (assistantLabelManaged) tuiNarrationPromoted = false;
|
|
9997
10042
|
const activeLabel = formatConservativeActiveToolLabel(event);
|
|
9998
10043
|
spinner.show(activeLabel);
|
|
9999
10044
|
options.activityReporter?.(activeLabel);
|
|
@@ -10017,6 +10062,26 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
10017
10062
|
return {
|
|
10018
10063
|
spinner,
|
|
10019
10064
|
eventMode,
|
|
10065
|
+
/**
|
|
10066
|
+
* Terminal cleanup for abort/error paths that never reach `finish()`.
|
|
10067
|
+
*
|
|
10068
|
+
* A user abort discards the transient TUI progress buffer: the user stopped
|
|
10069
|
+
* on purpose and the dock already showed that text as activity. A genuine
|
|
10070
|
+
* failure must not swallow prose that never got the chance to be *proven*
|
|
10071
|
+
* durable (only a following tool call proves "progress"), so it promotes the
|
|
10072
|
+
* pending buffer and flushes what was already promoted — otherwise a short
|
|
10073
|
+
* final answer followed by a transport error disappears from the transcript.
|
|
10074
|
+
*/
|
|
10075
|
+
cancel(cleanup) {
|
|
10076
|
+
if (assistantLabelManaged && cleanup?.preservePendingNarration) {
|
|
10077
|
+
flushPendingTuiNarration();
|
|
10078
|
+
if (streamedAssistantText) {
|
|
10079
|
+
renderWriter.flush();
|
|
10080
|
+
options.output.write("\n");
|
|
10081
|
+
}
|
|
10082
|
+
}
|
|
10083
|
+
dropPendingTuiProgress();
|
|
10084
|
+
},
|
|
10020
10085
|
pushText(chunk) {
|
|
10021
10086
|
writeVisibleAssistantChunk(chunk);
|
|
10022
10087
|
},
|
|
@@ -10024,10 +10089,6 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
10024
10089
|
markThinkingDelta(chunk);
|
|
10025
10090
|
},
|
|
10026
10091
|
handleToolEvent,
|
|
10027
|
-
/** 记录一条 compaction 观测事件(TUI 在 turn 结束时渲染一行 dim 摘要)。
|
|
10028
|
-
* 一轮内可能来多条(轮开始 + 每个 round),按显著性保留最高者:
|
|
10029
|
-
* 失败 > 新生成摘要 > 投影复用 > 跳过,避免末尾的例行跳过事件
|
|
10030
|
-
* 覆盖掉中途真正发生的压缩。 */
|
|
10031
10092
|
recordCompaction(event) {
|
|
10032
10093
|
const significance = (e) => e.failed ? 4 : e.summaryGenerated ? 3 : e.compressed ? 2 : 1;
|
|
10033
10094
|
if (!compactionEvent || significance(event) >= significance(compactionEvent)) {
|
|
@@ -10045,6 +10106,7 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
|
|
|
10045
10106
|
if (flushedThink.content) {
|
|
10046
10107
|
writeVisibleAssistantChunk(flushedThink.content);
|
|
10047
10108
|
}
|
|
10109
|
+
if (assistantLabelManaged) flushPendingTuiNarration();
|
|
10048
10110
|
endThinkingPhase();
|
|
10049
10111
|
spinner.stop();
|
|
10050
10112
|
options.activityReporter?.(null);
|
|
@@ -10149,6 +10211,7 @@ async function readStreamingAgentRun(options, res, existingSpinner) {
|
|
|
10149
10211
|
let content = "";
|
|
10150
10212
|
let dialogId;
|
|
10151
10213
|
let usage;
|
|
10214
|
+
let sawDone = false;
|
|
10152
10215
|
const handlePayload = (payload) => {
|
|
10153
10216
|
if (typeof payload?.dialogId === "string" && payload.dialogId.trim()) {
|
|
10154
10217
|
dialogId = payload.dialogId;
|
|
@@ -10161,6 +10224,7 @@ async function readStreamingAgentRun(options, res, existingSpinner) {
|
|
|
10161
10224
|
}
|
|
10162
10225
|
if (payload?.type === "done") {
|
|
10163
10226
|
usage = payload.usage;
|
|
10227
|
+
sawDone = true;
|
|
10164
10228
|
return;
|
|
10165
10229
|
}
|
|
10166
10230
|
if (payload?.type === "dialog" || payload?.type === "status") {
|
|
@@ -10214,6 +10278,9 @@ async function readStreamingAgentRun(options, res, existingSpinner) {
|
|
|
10214
10278
|
}
|
|
10215
10279
|
} catch (error) {
|
|
10216
10280
|
turnOutput.spinner.stop();
|
|
10281
|
+
turnOutput.cancel({
|
|
10282
|
+
preservePendingNarration: !options.abortSignal?.aborted
|
|
10283
|
+
});
|
|
10217
10284
|
if (options.abortSignal?.aborted) {
|
|
10218
10285
|
return {
|
|
10219
10286
|
exitCode: 0,
|
|
@@ -10243,6 +10310,15 @@ ${describeClientVersionTooOldFailure(message, error)}`);
|
|
|
10243
10310
|
`);
|
|
10244
10311
|
return { exitCode: 1 };
|
|
10245
10312
|
}
|
|
10313
|
+
if (options.abortSignal?.aborted && !sawDone) {
|
|
10314
|
+
turnOutput.spinner.stop();
|
|
10315
|
+
turnOutput.cancel();
|
|
10316
|
+
return {
|
|
10317
|
+
exitCode: 0,
|
|
10318
|
+
...dialogId ? { dialogId } : {},
|
|
10319
|
+
streamInterrupted: true
|
|
10320
|
+
};
|
|
10321
|
+
}
|
|
10246
10322
|
turnOutput.finish(content);
|
|
10247
10323
|
const usageText = formatUsage(usage, dialogId);
|
|
10248
10324
|
if (usageText && shouldShowUsage(options.env))
|
|
@@ -10459,7 +10535,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
|
|
|
10459
10535
|
// packages/cli/client/agentRun.ts
|
|
10460
10536
|
import { ulid as ulid2 } from "ulid";
|
|
10461
10537
|
async function loadRunLocalAgentTurn() {
|
|
10462
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
10538
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-73R544NQ.js");
|
|
10463
10539
|
return runLocalAgentTurn;
|
|
10464
10540
|
}
|
|
10465
10541
|
var stripDebugNoise = (s) => s.replace(/\s*raw="[\s\S]*"/g, "").replace(/\s*raw=\S+/g, "").replace(/\s*headers=\[[^\]]*\]/g, "").replace(/\s*headers=\S+/g, "").trim();
|
|
@@ -11286,6 +11362,9 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
11286
11362
|
};
|
|
11287
11363
|
} catch (error) {
|
|
11288
11364
|
turnOutput.spinner.stop();
|
|
11365
|
+
turnOutput.cancel({
|
|
11366
|
+
preservePendingNarration: error?.code !== LOCAL_TURN_ABORTED_CODE && !options.abortSignal?.aborted
|
|
11367
|
+
});
|
|
11289
11368
|
const savedDialogId = error?.dialogId;
|
|
11290
11369
|
const abortedUsageRecords = error?.usageRecords;
|
|
11291
11370
|
const abortedTurnCredits = sumPlatformCredits(abortedUsageRecords);
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
listUserRecordsFromServers,
|
|
8
8
|
readDbRecordFromServers,
|
|
9
9
|
readLiveDbRecordAfterTombstoneMerge
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3YIAR5UI.js";
|
|
11
11
|
import {
|
|
12
12
|
fetchWithTransientRetry
|
|
13
13
|
} from "./chunk-5UTFL4QJ.js";
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
boundSummaryText,
|
|
31
31
|
buildDialogReadEnvelope,
|
|
32
32
|
projectDialogReadForAgent
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-HCT7U36O.js";
|
|
34
34
|
import {
|
|
35
35
|
toErrorMessage
|
|
36
36
|
} from "./chunk-HNMXYYJR.js";
|
|
@@ -854,6 +854,7 @@ function buildNoloWorkspaceOpenAiTools(args) {
|
|
|
854
854
|
}
|
|
855
855
|
}, ["query"]);
|
|
856
856
|
add("listAgents", "List agents for delegation. Default scope='preferred' returns the user's favorites, owned, OAuth, custom API, and local agents only; scope='public' discovers shared/marketplace agents; scope='all' returns their deduplicated union. Public agents may consume platform credits. Copy the agentKey verbatim; use the runnable agentKey exactly and do not infer it from the display name. publicOnly is deprecated compatibility for scope='public'. Rate-limited agents are hidden unless showUnavailable is true.", {
|
|
857
|
+
query: stringToolParam("Optional case-insensitive search substring matching agent name, model, provider, handle, or agentKey."),
|
|
857
858
|
scope: { type: "string", enum: ["preferred", "public", "all"], description: "Discovery scope; preferred is the default and does not load the public marketplace." },
|
|
858
859
|
publicOnly: { type: "boolean", description: "Deprecated compatibility alias for scope='public'." },
|
|
859
860
|
showUnavailable: { type: "boolean", description: "Include agents currently rate-limited (429). Default false." },
|
|
@@ -1183,6 +1184,8 @@ function buildNoloWorkspaceCommandArgs(call) {
|
|
|
1183
1184
|
}
|
|
1184
1185
|
case "listAgents": {
|
|
1185
1186
|
const cliArgs = ["agent", "list"];
|
|
1187
|
+
const query = noloStringArg(args.query);
|
|
1188
|
+
if (query) cliArgs.push("--query", query);
|
|
1186
1189
|
const space = noloStringArg(args.space);
|
|
1187
1190
|
if (space) cliArgs.push("--space", space);
|
|
1188
1191
|
const scope = noloStringArg(args.scope);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clearCliLocalRuntimePreparedAgentCache
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-L4KM22WM.js";
|
|
4
4
|
import {
|
|
5
5
|
getReadableCliDb
|
|
6
6
|
} from "./chunk-LS2ZANRJ.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
resolveAgentRecordFromHybridStore,
|
|
13
13
|
sanitizeAgentRecordForCliOutput,
|
|
14
14
|
writeAgentRecord
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QSHEEA5N.js";
|
|
16
16
|
import {
|
|
17
17
|
resolveCliAgentKeyInput
|
|
18
18
|
} from "./chunk-SV5IJK6K.js";
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
requiresBareImageUrl,
|
|
50
50
|
resolveToolGuidedSections,
|
|
51
51
|
toBareImageUrlMessages
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-FORUBDQQ.js";
|
|
53
53
|
import {
|
|
54
54
|
convertMessagesToResponsesInput,
|
|
55
55
|
extractReasoningFromResponseOutput,
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
parseNoloWorkspaceToolArguments,
|
|
75
75
|
readTextStreamUpToChars,
|
|
76
76
|
resolveNoloDialogInput
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-HCT7U36O.js";
|
|
78
78
|
import {
|
|
79
79
|
buildProviderAuthHeaders,
|
|
80
80
|
buildProviderExecutionPlan
|