nolo-cli 0.48.0 → 0.49.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-36GKPAEZ.js → _executeModel-KE4PQSZ3.js} +19 -19
- package/{agentDeleteCommand-SBODEUPE.js → agentDeleteCommand-Z67TJG3W.js} +10 -10
- package/{agentEmailCommands-ME7BCY5S.js → agentEmailCommands-7LPIK7JE.js} +23 -23
- package/{agentListCommands-QBWPKN5D.js → agentListCommands-5J2IM3IT.js} +12 -12
- package/{agentMachineCommands-KFFUPELZ.js → agentMachineCommands-YXH6FXUQ.js} +11 -11
- package/{agentRecordCommands-4BF6JIHS.js → agentRecordCommands-GZLCDVUS.js} +22 -22
- package/{agentRunCommand-4MA7D6SV.js → agentRunCommand-WYH5Q54Q.js} +22 -22
- package/{agentRuntimeLocal-RD52NPCG.js → agentRuntimeLocal-A6EF3RUY.js} +10 -10
- package/{agentSlice-AJABGQHU.js → agentSlice-ARTDF6VD.js} +1 -1
- package/{appDeleteCommands-I42NL3LP.js → appDeleteCommands-V2B7ZCLC.js} +10 -10
- package/{appDeployCommands-CZWHXVPU.js → appDeployCommands-AXQU44RD.js} +10 -10
- package/{appDeployStatusCommands-PIQYXACM.js → appDeployStatusCommands-FWGSC2UM.js} +10 -10
- package/{appGetCommands-CI2OWLT7.js → appGetCommands-67R3RFZK.js} +10 -10
- package/{appListCommands-LWLSHPCP.js → appListCommands-TTASJPGV.js} +10 -10
- package/{authCommand-WLWOEVYI.js → authCommand-QOPOEYEK.js} +7 -7
- package/{chatQueueReduxAdapter-V37RK3A6.js → chatQueueReduxAdapter-6CAHUQ4O.js} +7 -7
- package/{chunk-Y7TGWSUN.js → chunk-56W233KG.js} +1 -1
- package/{chunk-C2WF2OY7.js → chunk-5WADL4O7.js} +1 -1
- package/{chunk-DFY6O64O.js → chunk-6SMMK7MD.js} +2 -2
- package/{chunk-4ZL2KBI7.js → chunk-757BGY6Y.js} +1 -1
- package/{chunk-XPW6JLOB.js → chunk-AVKUDHJO.js} +3 -3
- package/{chunk-VKSBVRGP.js → chunk-CVT7L2WZ.js} +1 -1
- package/{chunk-PGKZ2KGE.js → chunk-EURF2SV6.js} +11 -11
- package/{chunk-QF27IZB3.js → chunk-EXDR5D6X.js} +3 -3
- package/{chunk-AZ6DT2UD.js → chunk-GBADO3SM.js} +1 -1
- package/{chunk-XB7ACJFH.js → chunk-GDGIEGHV.js} +2 -2
- package/{chunk-PJASTA2U.js → chunk-GFD7TIZU.js} +2 -2
- package/{chunk-IVKEJD7I.js → chunk-GFUOVFQA.js} +1 -1
- package/{chunk-H5QLIP6S.js → chunk-HCMFFI2G.js} +2 -2
- package/{chunk-TZRB2I2M.js → chunk-HPZL4IBN.js} +9 -9
- package/{chunk-QTH72J3N.js → chunk-IKSFDJXB.js} +112 -19
- package/{chunk-W3RZLXMA.js → chunk-IKTHA3JH.js} +2 -2
- package/{chunk-67Q6IHM5.js → chunk-IRJVFYOH.js} +87 -45
- package/{chunk-CY5KIIPU.js → chunk-K524MUQC.js} +8 -8
- package/{chunk-OZKJBDG4.js → chunk-NN3AMBY3.js} +1 -1
- package/{chunk-BO3YFOZR.js → chunk-QDHZCAH3.js} +1 -1
- package/{chunk-POLE2QLO.js → chunk-QUCSAM43.js} +94 -27
- package/{chunk-Z7A54NFZ.js → chunk-RU5D3B22.js} +1 -1
- package/{chunk-JBL24PK6.js → chunk-SP3DPVBH.js} +2 -2
- package/{chunk-F22JQTSX.js → chunk-SW7RCUGA.js} +2 -2
- package/{chunk-3YVCM5PE.js → chunk-U5Z7LFZF.js} +1 -1
- package/{chunk-JVKFKKYN.js → chunk-UQWFIWHX.js} +1 -1
- package/{chunk-AV4Z57LV.js → chunk-VRJUIUIY.js} +2 -2
- package/{chunk-5SLTA66C.js → chunk-WKOEOQCI.js} +13 -13
- package/{chunk-VFN256RI.js → chunk-WL3UOGYO.js} +25 -0
- package/{chunk-KOZ2G3ZG.js → chunk-WX5E6HZS.js} +3 -3
- package/{createAgentAutomationAction-5OZIWOK4.js → createAgentAutomationAction-7BBF5YXN.js} +8 -8
- package/{createDialogAction-334CHPJF.js → createDialogAction-B5URPHP4.js} +9 -9
- package/{createPageAction-LXY22WTA.js → createPageAction-ISJKM5Q3.js} +8 -8
- package/{dialogCommands-4MGUHAJI.js → dialogCommands-XHH4MVA4.js} +10 -10
- package/{dialogSlice-76W7S3C4.js → dialogSlice-NRAN5X7F.js} +7 -7
- package/{docCreateCommands-346W5443.js → docCreateCommands-FUN2Z7HQ.js} +10 -10
- package/{docDeleteCommands-FKEEPUUS.js → docDeleteCommands-OZDPFXPF.js} +10 -10
- package/{docReadCommands-AACI4DVO.js → docReadCommands-FIPK7LE3.js} +10 -10
- package/{docStore-N7QTPHAX.js → docStore-LUS7SWC3.js} +9 -9
- package/{docUpdateCommands-WHWVZ2XE.js → docUpdateCommands-BZ5GKAN4.js} +10 -10
- package/{getPricing-JNOCWYDH.js → getPricing-HAU62AFM.js} +3 -3
- package/{handleSendMessageAction-EAXEX5AX.js → handleSendMessageAction-RA4OD2ZH.js} +7 -7
- package/index.js +47 -47
- package/{machineCommands-XNWLQVTN.js → machineCommands-WDAYEFBE.js} +22 -22
- package/{machineWsRunDispatch-56HWQ67L.js → machineWsRunDispatch-TPQ2FQVS.js} +22 -22
- package/{models-N4NXQ44D.js → models-4QF4BJVY.js} +2 -2
- package/package.json +1 -1
- package/{readlineWorkspace-AXTB7DJC.js → readlineWorkspace-HN44KGIF.js} +86 -33
- package/{runAgentClientLoop-PU3R3UXA.js → runAgentClientLoop-ZYUI22EA.js} +17 -17
- package/{spaceCommands-JYI3X4N2.js → spaceCommands-OJ2567D4.js} +10 -10
- package/{spaceSlice-ERZ3RGWC.js → spaceSlice-F7JCOZEF.js} +8 -8
- package/{streamAgentChatTurn-2IH4MTQC.js → streamAgentChatTurn-FNFMMGNN.js} +20 -20
- package/{tools-DJUTQEMP.js → tools-QCDR3UMD.js} +12 -12
- package/{tuiSummaryLlmCaller-U4EGD2SX.js → tuiSummaryLlmCaller-LCGT62QC.js} +5 -5
- package/{updateDialogTitleAction-OVOPGTC3.js → updateDialogTitleAction-Y3OGJWDB.js} +8 -8
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
providerHttpFailure,
|
|
8
8
|
readSseFrames,
|
|
9
9
|
throwIfChatCompletionStreamFailed
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-GDGIEGHV.js";
|
|
11
11
|
import {
|
|
12
12
|
FRESH_TOOL_OUTPUT_MAX_CHARS,
|
|
13
13
|
MAX_HISTORICAL_TOOL_CONTENT_CHARS,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
resolveHistoricalToolContentCap,
|
|
18
18
|
resolveToolOutputProfile,
|
|
19
19
|
stripImagePartsFromMessages
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-CVT7L2WZ.js";
|
|
21
21
|
import {
|
|
22
22
|
sanitizeForOutbound
|
|
23
23
|
} from "./chunk-T27IEBNQ.js";
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
requiresBareImageUrl,
|
|
37
37
|
resolveToolGuidedSections,
|
|
38
38
|
toBareImageUrlMessages
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-NN3AMBY3.js";
|
|
40
40
|
import {
|
|
41
41
|
convertMessagesToResponsesInput,
|
|
42
42
|
extractReasoningFromResponseOutput,
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
import {
|
|
51
51
|
buildProviderAuthHeaders,
|
|
52
52
|
buildProviderExecutionPlan
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-SP3DPVBH.js";
|
|
54
54
|
import {
|
|
55
55
|
NOLO_WORKSPACE_TOOL_NAMES,
|
|
56
56
|
buildNoloWorkspaceCommandArgs,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
resolveEmptyAssistantFallbackMessage,
|
|
70
70
|
resolveEmptyAssistantOutcome,
|
|
71
71
|
resolveTruncatedReasoningTailLog
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-SW7RCUGA.js";
|
|
73
73
|
import {
|
|
74
74
|
COMPACTION_SUMMARY_SCHEMA_VERSION,
|
|
75
75
|
COMPACTION_SUMMARY_SYSTEM_PROMPT,
|
|
@@ -174,6 +174,26 @@ function readTitleParams(value) {
|
|
|
174
174
|
return Object.fromEntries(entries);
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
// packages/agent-runtime/fileWritePolicy.ts
|
|
178
|
+
function evaluateFileWritePolicy(args) {
|
|
179
|
+
if (args.sessionApproved) return { permissionDecision: "allow" };
|
|
180
|
+
return {
|
|
181
|
+
permissionDecision: "ask",
|
|
182
|
+
permissionRequest: {
|
|
183
|
+
id: "permission-file-write-session",
|
|
184
|
+
tool: args.tool,
|
|
185
|
+
action: "file_write",
|
|
186
|
+
title: "\u786E\u8BA4\u5199\u5165\u6587\u4EF6",
|
|
187
|
+
body: `\u672C\u4F1A\u8BDD\u9996\u6B21\u5199\u5165\u6587\u4EF6\uFF1A${args.path}\u3002\u6279\u51C6\u540E\u672C\u4F1A\u8BDD\u540E\u7EED\u5199\u5165\u4E0D\u518D\u9010\u6B21\u786E\u8BA4\u3002`,
|
|
188
|
+
command: args.path,
|
|
189
|
+
suggestedRule: {
|
|
190
|
+
scope: "session",
|
|
191
|
+
pattern: { capability: "file_write", target: "session" }
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
177
197
|
// packages/agent-runtime/toolCallPairing.ts
|
|
178
198
|
function readToolCallId(message) {
|
|
179
199
|
if (typeof message.tool_call_id === "string" && message.tool_call_id) {
|
|
@@ -1540,6 +1560,41 @@ function applyPersistedTurnInput(messages, persistedInput, persistedInputReferen
|
|
|
1540
1560
|
};
|
|
1541
1561
|
});
|
|
1542
1562
|
}
|
|
1563
|
+
var fileWriteSessionApproval = /* @__PURE__ */ new WeakMap();
|
|
1564
|
+
var fileWriteSessionKeys = /* @__PURE__ */ new Map();
|
|
1565
|
+
function getFileWriteSessionApproval(input) {
|
|
1566
|
+
if (input.fileWriteSessionId) {
|
|
1567
|
+
let key2 = fileWriteSessionKeys.get(input.fileWriteSessionId);
|
|
1568
|
+
if (!key2) {
|
|
1569
|
+
key2 = {};
|
|
1570
|
+
fileWriteSessionKeys.set(input.fileWriteSessionId, key2);
|
|
1571
|
+
}
|
|
1572
|
+
const existing2 = fileWriteSessionApproval.get(key2);
|
|
1573
|
+
if (existing2) return existing2;
|
|
1574
|
+
const created2 = { approved: false };
|
|
1575
|
+
fileWriteSessionApproval.set(key2, created2);
|
|
1576
|
+
return created2;
|
|
1577
|
+
}
|
|
1578
|
+
const key = input.adapter;
|
|
1579
|
+
const existing = fileWriteSessionApproval.get(key);
|
|
1580
|
+
if (existing) return existing;
|
|
1581
|
+
const created = { approved: false };
|
|
1582
|
+
fileWriteSessionApproval.set(key, created);
|
|
1583
|
+
return created;
|
|
1584
|
+
}
|
|
1585
|
+
function readToolPathForWriteGate(argumentsValue) {
|
|
1586
|
+
try {
|
|
1587
|
+
const parsed = JSON.parse(argumentsValue);
|
|
1588
|
+
return typeof parsed.path === "string" && parsed.path.trim() ? parsed.path.trim() : "the requested file";
|
|
1589
|
+
} catch {
|
|
1590
|
+
return "the requested file";
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
function isCompletedActionGateResult(value) {
|
|
1594
|
+
return Boolean(
|
|
1595
|
+
value && typeof value === "object" && value.status === "completed"
|
|
1596
|
+
);
|
|
1597
|
+
}
|
|
1543
1598
|
async function runLocalAgentTurn(input) {
|
|
1544
1599
|
const agentConfig = await input.adapter.loadAgentConfig(input.agentRef);
|
|
1545
1600
|
if (!agentConfig) {
|
|
@@ -1865,25 +1920,62 @@ ${reasoningTailLog}
|
|
|
1865
1920
|
}
|
|
1866
1921
|
);
|
|
1867
1922
|
try {
|
|
1868
|
-
const
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1923
|
+
const writeTool = toolName === "writeFile" || toolName === "editFile";
|
|
1924
|
+
if (writeTool && input.onActionGate) {
|
|
1925
|
+
const writeSession = getFileWriteSessionApproval(input);
|
|
1926
|
+
const policy = evaluateFileWritePolicy({
|
|
1927
|
+
tool: toolName,
|
|
1928
|
+
path: readToolPathForWriteGate(toolCall.function.arguments),
|
|
1929
|
+
sessionApproved: writeSession.approved
|
|
1930
|
+
});
|
|
1931
|
+
if (policy.permissionDecision === "ask") {
|
|
1932
|
+
const gate = {
|
|
1933
|
+
...policy.permissionRequest,
|
|
1934
|
+
id: `${policy.permissionRequest.id}-${toolCall.id}`,
|
|
1935
|
+
kind: "confirm",
|
|
1936
|
+
toolName,
|
|
1937
|
+
toolCallId: toolCall.id
|
|
1938
|
+
};
|
|
1939
|
+
const replacement = await raceWithAbort(
|
|
1940
|
+
input,
|
|
1941
|
+
input.onActionGate(gate),
|
|
1942
|
+
`${toolName} confirmation`
|
|
1943
|
+
);
|
|
1944
|
+
const gateResult = replacement?.metadata?.actionGateResult;
|
|
1945
|
+
if (replacement !== void 0 && isCompletedActionGateResult(gateResult)) {
|
|
1946
|
+
writeSession.approved = true;
|
|
1947
|
+
} else {
|
|
1948
|
+
toolResult = replacement ?? {
|
|
1949
|
+
content: `${toolName} cancelled: user declined file write confirmation.`,
|
|
1950
|
+
metadata: {
|
|
1951
|
+
cancelled: true,
|
|
1952
|
+
actionGateResult: { gateId: gate.id, status: "cancelled" }
|
|
1953
|
+
}
|
|
1954
|
+
};
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
if (!toolResult) {
|
|
1959
|
+
const executePromise = input.adapter.executeTool({
|
|
1960
|
+
id: toolCall.id,
|
|
1961
|
+
name: toolName,
|
|
1962
|
+
arguments: toolCall.function.arguments,
|
|
1963
|
+
...userInputText ? { userInput: userInputText } : {},
|
|
1964
|
+
...input.runtimeContext ? { runtimeContext: input.runtimeContext } : {},
|
|
1965
|
+
...input.abortSignal ? { abortSignal: input.abortSignal } : {}
|
|
1966
|
+
}, {
|
|
1967
|
+
...input.abortSignal ? { abortSignal: input.abortSignal } : {},
|
|
1968
|
+
...input.runtimeContext ? { runtimeContext: input.runtimeContext } : {}
|
|
1969
|
+
});
|
|
1970
|
+
toolResult = await raceWithAbort(input, executePromise, toolName);
|
|
1971
|
+
}
|
|
1880
1972
|
const actionGate = buildActionGate({
|
|
1881
1973
|
toolName,
|
|
1882
1974
|
toolCallId: toolCall.id,
|
|
1883
1975
|
metadata: toolResult.metadata
|
|
1884
1976
|
});
|
|
1885
1977
|
if (actionGate && input.onActionGate) {
|
|
1886
|
-
const replacement = await input.onActionGate(actionGate);
|
|
1978
|
+
const replacement = await raceWithAbort(input, input.onActionGate(actionGate), `${toolName} action gate`);
|
|
1887
1979
|
if (replacement) {
|
|
1888
1980
|
toolResult = replacement;
|
|
1889
1981
|
}
|
|
@@ -1899,7 +1991,7 @@ ${reasoningTailLog}
|
|
|
1899
1991
|
toolCallId: toolCall.id,
|
|
1900
1992
|
toolName,
|
|
1901
1993
|
atMs: finishedAt,
|
|
1902
|
-
ok: true,
|
|
1994
|
+
ok: toolResult.metadata?.cancelled !== true && toolResult.metadata?.actionGateResult?.status !== "cancelled" && toolResult.metadata?.actionGateResult?.status !== "failed",
|
|
1903
1995
|
elapsedMs: Math.max(0, finishedAt - startedAt),
|
|
1904
1996
|
...summary ? { summary } : {},
|
|
1905
1997
|
...safeMetadata ? { metadata: safeMetadata } : {}
|
|
@@ -6950,6 +7042,7 @@ Available skills: ${available.join(", ")}`;
|
|
|
6950
7042
|
export {
|
|
6951
7043
|
readCommandActionGatePayload,
|
|
6952
7044
|
readActionGate,
|
|
7045
|
+
evaluateFileWritePolicy,
|
|
6953
7046
|
summarizeToolArguments,
|
|
6954
7047
|
LOCAL_AGENT_CONFIG_MISSING_CODE,
|
|
6955
7048
|
LOCAL_TURN_ABORTED_CODE,
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-AGGIDPCZ.js";
|
|
7
7
|
import {
|
|
8
8
|
getModelConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QDHZCAH3.js";
|
|
10
10
|
import {
|
|
11
11
|
isPlatformHostedImageModel
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WL3UOGYO.js";
|
|
13
13
|
import {
|
|
14
14
|
asOptionalFiniteNumber
|
|
15
15
|
} from "./chunk-WWC7I6TA.js";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
parseAgentRunEvent,
|
|
20
20
|
t,
|
|
21
21
|
toolLabel
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-QUCSAM43.js";
|
|
23
23
|
import {
|
|
24
24
|
getReadableCliDb
|
|
25
25
|
} from "./chunk-43CXXVJD.js";
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
} from "./chunk-LTRXGFMS.js";
|
|
53
53
|
import {
|
|
54
54
|
formatAgentListCard
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-WKOEOQCI.js";
|
|
56
56
|
import {
|
|
57
57
|
isTransientFetchError
|
|
58
58
|
} from "./chunk-5XTOKQLW.js";
|
|
@@ -74,12 +74,12 @@ import {
|
|
|
74
74
|
chooseMemoryOwners,
|
|
75
75
|
loadMemoryCandidatesFromDb,
|
|
76
76
|
resolveAgentMemoryPolicy
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-AVKUDHJO.js";
|
|
78
78
|
import {
|
|
79
79
|
API_REPORTED_COST_MULTIPLIER,
|
|
80
80
|
normalizeUsage,
|
|
81
81
|
parseUiAskChoiceContent
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-EURF2SV6.js";
|
|
83
83
|
import {
|
|
84
84
|
getDefaultCliLocalRuntimeDb
|
|
85
85
|
} from "./chunk-IA3A5373.js";
|
|
@@ -95,10 +95,10 @@ import {
|
|
|
95
95
|
LOCAL_TURN_ABORTED_CODE,
|
|
96
96
|
readActionGate,
|
|
97
97
|
readCommandActionGatePayload
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-IKSFDJXB.js";
|
|
99
99
|
import {
|
|
100
100
|
resolveAgentRuntimeConfigFromRecord
|
|
101
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-CVT7L2WZ.js";
|
|
102
102
|
import {
|
|
103
103
|
createThinkParserState,
|
|
104
104
|
flushThinkParser,
|
|
@@ -107,20 +107,20 @@ import {
|
|
|
107
107
|
import {
|
|
108
108
|
resolveClientVersion,
|
|
109
109
|
resolvePlatformAuthToken
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-SP3DPVBH.js";
|
|
111
111
|
import {
|
|
112
112
|
isQuotaExhaustedError
|
|
113
113
|
} from "./chunk-IWUMSAQF.js";
|
|
114
114
|
import {
|
|
115
115
|
DEFAULT_CONTEXT_WINDOW,
|
|
116
116
|
getModelContextWindow
|
|
117
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-SW7RCUGA.js";
|
|
118
118
|
import {
|
|
119
119
|
clipCompactText
|
|
120
120
|
} from "./chunk-HR5XDXYM.js";
|
|
121
121
|
import {
|
|
122
122
|
findModelConfig
|
|
123
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-QDHZCAH3.js";
|
|
124
124
|
import {
|
|
125
125
|
compactWhitespace
|
|
126
126
|
} from "./chunk-DWLEOOGR.js";
|
|
@@ -145,7 +145,7 @@ import {
|
|
|
145
145
|
CLIENT_VERSION_TOO_OLD_CODE,
|
|
146
146
|
NOLO_CLIENT_VERSION_HEADER,
|
|
147
147
|
buildClientVersionUpgradeMessage
|
|
148
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-WL3UOGYO.js";
|
|
149
149
|
import {
|
|
150
150
|
parsePositiveFiniteNumberOrFallback
|
|
151
151
|
} from "./chunk-Y5GCAMGP.js";
|
|
@@ -3999,36 +3999,45 @@ function formatToolTraceLine(text, colorEnabled, accent = "none") {
|
|
|
3999
3999
|
return `${dimCliText(text, true)}
|
|
4000
4000
|
`;
|
|
4001
4001
|
}
|
|
4002
|
+
var cleanUserText = (value) => stripAnsi2(value).replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim();
|
|
4002
4003
|
function renderRunCard(snapshot, opts) {
|
|
4003
4004
|
const labels = agentRunCardLabels();
|
|
4004
4005
|
const timing = { startedAt: snapshot.startedAt, finishedAt: snapshot.finishedAt };
|
|
4005
|
-
const
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
});
|
|
4018
|
-
}
|
|
4019
|
-
return formatStatusRunCard(name, snapshot.status, {
|
|
4006
|
+
const safe = opts?.safe === true;
|
|
4007
|
+
const name = safe ? cleanUserText(snapshot.agentName ?? "agent") : snapshot.agentName ?? "agent";
|
|
4008
|
+
const source = safe ? {
|
|
4009
|
+
...snapshot,
|
|
4010
|
+
agentName: snapshot.agentName ? cleanUserText(snapshot.agentName) : snapshot.agentName,
|
|
4011
|
+
taskPreview: snapshot.taskPreview ? cleanUserText(snapshot.taskPreview) : snapshot.taskPreview,
|
|
4012
|
+
lastAssistantText: snapshot.lastAssistantText ? cleanUserText(snapshot.lastAssistantText) : snapshot.lastAssistantText,
|
|
4013
|
+
lastToolNames: snapshot.lastToolNames?.map(cleanUserText)
|
|
4014
|
+
} : snapshot;
|
|
4015
|
+
const hadError = safe && Boolean(source.errorMessage?.trim());
|
|
4016
|
+
const errorFields = safe ? { errorMessage: void 0, logLines: void 0 } : { errorMessage: source.errorMessage, logLines: source.logLines };
|
|
4017
|
+
const body = isAgentRunTerminalStatus(snapshot.status) ? formatFinishedRunCard(name, snapshot.status, {
|
|
4020
4018
|
runId: snapshot.runId,
|
|
4021
|
-
toolCallCount:
|
|
4022
|
-
lastToolNames:
|
|
4023
|
-
lastAssistantText:
|
|
4024
|
-
|
|
4025
|
-
|
|
4019
|
+
toolCallCount: source.toolCallCount,
|
|
4020
|
+
lastToolNames: source.lastToolNames,
|
|
4021
|
+
lastAssistantText: source.lastAssistantText,
|
|
4022
|
+
...errorFields,
|
|
4023
|
+
timing,
|
|
4024
|
+
...opts?.includeLogTail !== void 0 ? { includeLogTail: opts.includeLogTail } : {},
|
|
4025
|
+
labels
|
|
4026
|
+
}) : formatStatusRunCard(name, snapshot.status, {
|
|
4027
|
+
runId: snapshot.runId,
|
|
4028
|
+
toolCallCount: source.toolCallCount,
|
|
4029
|
+
lastToolNames: source.lastToolNames,
|
|
4030
|
+
lastAssistantText: source.lastAssistantText,
|
|
4031
|
+
...errorFields,
|
|
4026
4032
|
timing,
|
|
4027
4033
|
...opts?.includeLogTail !== void 0 ? { includeLogTail: opts.includeLogTail } : {},
|
|
4028
4034
|
labels
|
|
4029
4035
|
});
|
|
4036
|
+
return hadError ? `${body}
|
|
4037
|
+
error ${t("runDiagnosticsHidden")}` : body;
|
|
4030
4038
|
}
|
|
4031
|
-
function recoverOrchestrationCard(event, toolName) {
|
|
4039
|
+
function recoverOrchestrationCard(event, toolName, opts) {
|
|
4040
|
+
const safe = opts?.safe === true;
|
|
4032
4041
|
const content = typeof event.content === "string" ? event.content : "";
|
|
4033
4042
|
const trimmed = content.trim();
|
|
4034
4043
|
if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) return null;
|
|
@@ -4059,27 +4068,30 @@ function recoverOrchestrationCard(event, toolName) {
|
|
|
4059
4068
|
if (!parsedEvent) return null;
|
|
4060
4069
|
const { kind, snapshot } = parsedEvent;
|
|
4061
4070
|
if (kind === "start") {
|
|
4062
|
-
|
|
4063
|
-
|
|
4071
|
+
const name = safe ? cleanUserText(snapshot.agentName ?? "agent") : snapshot.agentName ?? "agent";
|
|
4072
|
+
const task = snapshot.taskPreview ? safe ? cleanUserText(snapshot.taskPreview) : snapshot.taskPreview : snapshot.taskPreview;
|
|
4073
|
+
return formatStartRunCard(name, snapshot.status, {
|
|
4074
|
+
task,
|
|
4064
4075
|
runId: snapshot.runId,
|
|
4065
4076
|
labels
|
|
4066
4077
|
});
|
|
4067
4078
|
}
|
|
4068
4079
|
if (kind === "gone") return formatNotFoundRunCard(labels);
|
|
4069
4080
|
if (kind === "stop") return formatStopRunCard(snapshot.status, labels);
|
|
4070
|
-
return renderRunCard(snapshot);
|
|
4081
|
+
return renderRunCard(snapshot, opts);
|
|
4071
4082
|
}
|
|
4072
4083
|
function parseControlAgentRunStatusEvent(event) {
|
|
4073
4084
|
const parsed = parseAgentRunEvent(event);
|
|
4074
4085
|
return parsed?.kind === "status" ? parsed.snapshot : null;
|
|
4075
4086
|
}
|
|
4076
|
-
function formatOrchestrationCardBlock(event, toolName, colorEnabled) {
|
|
4087
|
+
function formatOrchestrationCardBlock(event, toolName, colorEnabled, opts) {
|
|
4088
|
+
const safe = opts?.safe === true;
|
|
4077
4089
|
const rawLabel = toolLabel(toolName);
|
|
4078
4090
|
const bakedCard = typeof event.metadata?.displayData === "string" && event.metadata.displayData.trim() ? event.metadata.displayData : "";
|
|
4079
|
-
const rawDataStr = recoverOrchestrationCard(event, toolName) || bakedCard || (typeof event.content === "string" ? event.content : "");
|
|
4091
|
+
const rawDataStr = recoverOrchestrationCard(event, toolName, { safe }) || bakedCard || (typeof event.content === "string" ? event.content : "");
|
|
4080
4092
|
const failed = event.type === "tool-error" || isFailedToolResult(event) || Boolean(event.metadata?.failed) || /^Error:/i.test(rawDataStr.trim());
|
|
4081
4093
|
if (failed) {
|
|
4082
|
-
const firstLine = rawDataStr.trim().split("\n")[0] || event.summary || event.message || t("toolFailed");
|
|
4094
|
+
const firstLine = safe ? t("toolFailed") : rawDataStr.trim().split("\n")[0] || event.summary || event.message || t("toolFailed");
|
|
4083
4095
|
const message = clip(firstLine, 96);
|
|
4084
4096
|
if (!colorEnabled) {
|
|
4085
4097
|
return `\u2717 ${rawLabel} ${message}
|
|
@@ -4092,11 +4104,12 @@ function formatOrchestrationCardBlock(event, toolName, colorEnabled) {
|
|
|
4092
4104
|
`;
|
|
4093
4105
|
}
|
|
4094
4106
|
const displayData = rawDataStr.trim();
|
|
4095
|
-
const lines = displayData ? displayData.split("\n")
|
|
4107
|
+
const lines = displayData ? displayData.split("\n") : [];
|
|
4108
|
+
const projected = safe ? sanitizeRunCardForNormal(lines) : lines;
|
|
4096
4109
|
if (!colorEnabled) {
|
|
4097
4110
|
let out2 = `\u25CF ${rawLabel}
|
|
4098
4111
|
`;
|
|
4099
|
-
for (const line of
|
|
4112
|
+
for (const line of projected) {
|
|
4100
4113
|
out2 += ` ${line}
|
|
4101
4114
|
`;
|
|
4102
4115
|
}
|
|
@@ -4106,12 +4119,40 @@ function formatOrchestrationCardBlock(event, toolName, colorEnabled) {
|
|
|
4106
4119
|
const labelPart = themeText(rawLabel, "muted", true);
|
|
4107
4120
|
let out = `${bullet} ${labelPart}
|
|
4108
4121
|
`;
|
|
4109
|
-
for (const line of
|
|
4122
|
+
for (const line of projected) {
|
|
4110
4123
|
out += ` ${themeText(line, "muted", true)}
|
|
4111
4124
|
`;
|
|
4112
4125
|
}
|
|
4113
4126
|
return out;
|
|
4114
4127
|
}
|
|
4128
|
+
function sanitizeRunCardForNormal(lines) {
|
|
4129
|
+
const out = [];
|
|
4130
|
+
let errorIndent = null;
|
|
4131
|
+
for (const line of lines) {
|
|
4132
|
+
if (/^(log tail:?|日志尾部:?)$/i.test(line.trim())) {
|
|
4133
|
+
if (out.length > 0 && out[out.length - 1].trim() === "") out.pop();
|
|
4134
|
+
break;
|
|
4135
|
+
}
|
|
4136
|
+
if (/^\s*error\b/i.test(line)) {
|
|
4137
|
+
out.push(` error ${t("runDiagnosticsHidden")}`);
|
|
4138
|
+
errorIndent = line.length - line.trimStart().length;
|
|
4139
|
+
continue;
|
|
4140
|
+
}
|
|
4141
|
+
if (errorIndent !== null) {
|
|
4142
|
+
if (line.trim() === "") {
|
|
4143
|
+
errorIndent = null;
|
|
4144
|
+
out.push(line);
|
|
4145
|
+
continue;
|
|
4146
|
+
}
|
|
4147
|
+
const indent = line.length - line.trimStart().length;
|
|
4148
|
+
const isLabelRow = /^\s{2}[a-z][a-zA-Z0-9]*\s{2,}/.test(line);
|
|
4149
|
+
if (indent > errorIndent && !isLabelRow) continue;
|
|
4150
|
+
errorIndent = null;
|
|
4151
|
+
}
|
|
4152
|
+
out.push(line);
|
|
4153
|
+
}
|
|
4154
|
+
return out;
|
|
4155
|
+
}
|
|
4115
4156
|
function mergeRunSnapshot(previous, next) {
|
|
4116
4157
|
return {
|
|
4117
4158
|
...previous,
|
|
@@ -4176,10 +4217,10 @@ function formatNormalToolLine(event, pending, colorEnabled) {
|
|
|
4176
4217
|
if (block) return block;
|
|
4177
4218
|
}
|
|
4178
4219
|
if (event.type === "tool-result" && (toolName === "listAgents" || toolName === "startAgentRun" || toolName === "controlAgentRun")) {
|
|
4179
|
-
return formatOrchestrationCardBlock(event, toolName, colorEnabled);
|
|
4220
|
+
return formatOrchestrationCardBlock(event, toolName, colorEnabled, { safe: true });
|
|
4180
4221
|
}
|
|
4181
4222
|
if (event.type === "tool-result" && toolName === "loadSkill") {
|
|
4182
|
-
return formatLoadSkillBlock(event, colorEnabled) ?? "";
|
|
4223
|
+
return formatLoadSkillBlock(event, colorEnabled, { safe: true }) ?? "";
|
|
4183
4224
|
}
|
|
4184
4225
|
const label = toolLabel(toolName);
|
|
4185
4226
|
if (readActionGate(event.metadata?.actionGate)) {
|
|
@@ -4382,14 +4423,14 @@ function formatTodoListForCli(event, colorEnabled) {
|
|
|
4382
4423
|
const text = [`\u2611 Todo (${todos.length})`, ...lines].join("\n") + "\n";
|
|
4383
4424
|
return colorEnabled ? themeText(text, "chrome") : text;
|
|
4384
4425
|
}
|
|
4385
|
-
function formatLoadSkillBlock(event, colorEnabled) {
|
|
4426
|
+
function formatLoadSkillBlock(event, colorEnabled, opts) {
|
|
4386
4427
|
if (event.type !== "tool-result" || event.toolName !== "loadSkill") return null;
|
|
4387
4428
|
const skillName = resolveLoadSkillName(event);
|
|
4388
4429
|
const content = typeof event.content === "string" ? event.content : "";
|
|
4389
4430
|
const failed = /^Skill\s+"[^"]*"\s+not found/.test(content) || isFailedToolResult(event);
|
|
4390
4431
|
const labelText = t("usedSkillLabel");
|
|
4391
4432
|
if (failed) {
|
|
4392
|
-
const message = clip(content.split("\n")[0] || t("toolFailed"), 96);
|
|
4433
|
+
const message = opts?.safe === true ? t("toolFailed") : clip(content.split("\n")[0] || t("toolFailed"), 96);
|
|
4393
4434
|
return formatToolTraceLine(`\u25B8 ${labelText} (${skillName}) \u2717 ${message}`, colorEnabled, "error");
|
|
4394
4435
|
}
|
|
4395
4436
|
if (!colorEnabled) {
|
|
@@ -5512,7 +5553,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
|
|
|
5512
5553
|
// packages/cli/client/agentRun.ts
|
|
5513
5554
|
import { ulid } from "ulid";
|
|
5514
5555
|
async function loadRunLocalAgentTurn() {
|
|
5515
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
5556
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-A6EF3RUY.js");
|
|
5516
5557
|
return runLocalAgentTurn;
|
|
5517
5558
|
}
|
|
5518
5559
|
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();
|
|
@@ -6137,6 +6178,7 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
6137
6178
|
contextReferenceResolver: (reference) => canResolveCollapsedPasteReference(options.pastedTextStore, reference)
|
|
6138
6179
|
} : {},
|
|
6139
6180
|
continueDialogId: currentDialogId,
|
|
6181
|
+
fileWriteSessionId: currentDialogId,
|
|
6140
6182
|
spaceId: options.spaceId,
|
|
6141
6183
|
category: options.category,
|
|
6142
6184
|
inheritedFromDialogKey: options.inheritedFromDialogKey,
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
inlineImageUrlsForCustomProvider,
|
|
6
6
|
prepareTools,
|
|
7
7
|
shouldInlineImageUrlsForAgent
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HCMFFI2G.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-HPZL4IBN.js";
|
|
16
16
|
import {
|
|
17
17
|
createSSEParser,
|
|
18
18
|
createToolRunId,
|
|
@@ -23,22 +23,22 @@ import {
|
|
|
23
23
|
toolRunSetPending,
|
|
24
24
|
toolRunStarted,
|
|
25
25
|
toolRunSucceeded
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-WKOEOQCI.js";
|
|
27
27
|
import {
|
|
28
28
|
getPublicImageAgentMode
|
|
29
29
|
} from "./chunk-VIDPVFP3.js";
|
|
30
30
|
import {
|
|
31
31
|
getCurrentSpaceId
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-6SMMK7MD.js";
|
|
33
33
|
import {
|
|
34
34
|
addToolMessage,
|
|
35
35
|
messageStreamEnd,
|
|
36
36
|
messageStreaming,
|
|
37
37
|
updateToolMessage
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-EURF2SV6.js";
|
|
39
39
|
import {
|
|
40
40
|
streamAgentChatTurn
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-WX5E6HZS.js";
|
|
42
42
|
import {
|
|
43
43
|
addActiveController,
|
|
44
44
|
removeActiveController,
|
|
@@ -56,10 +56,10 @@ import {
|
|
|
56
56
|
import {
|
|
57
57
|
EMPTY_ASSISTANT_REPAIR_PROMPT,
|
|
58
58
|
getModelInfo
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-SW7RCUGA.js";
|
|
60
60
|
import {
|
|
61
61
|
getApiEndpoint
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-QDHZCAH3.js";
|
|
63
63
|
import {
|
|
64
64
|
toErrorMessage
|
|
65
65
|
} from "./chunk-HNMXYYJR.js";
|