nolo-cli 0.25.2 → 0.26.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/README.md +9 -18
- package/{_executeModel-LXNDVFT2.js → _executeModel-ZPNYAEFW.js} +18 -18
- package/{agentDeleteCommand-DMAYEVOP.js → agentDeleteCommand-5ZV4433K.js} +12 -12
- package/{agentEmailCommands-RVGRDAD6.js → agentEmailCommands-Z7KOYDVQ.js} +23 -23
- package/{agentListCommands-SMW3NENV.js → agentListCommands-UQUXJYUN.js} +14 -14
- package/{agentMachineCommands-VGE5A52U.js → agentMachineCommands-53O6P6L5.js} +12 -12
- package/{agentRecordCommands-UHFL5OLB.js → agentRecordCommands-ZRYNBSSS.js} +22 -22
- package/{agentRunCommand-GG4Z735K.js → agentRunCommand-B73MKVOG.js} +22 -22
- package/{agentRuntimeLocal-7N2SUWO2.js → agentRuntimeLocal-GVNERRKQ.js} +11 -9
- package/{agentSlice-WY7SEYXO.js → agentSlice-OJBHIL34.js} +1 -1
- package/{appDeleteCommands-AUC7KDHU.js → appDeleteCommands-23Z3Z6KE.js} +13 -13
- package/{appDeployCommands-OVYWXTNP.js → appDeployCommands-3MFAR4Z7.js} +13 -13
- package/{appDeployStatusCommands-DNUCH3KK.js → appDeployStatusCommands-JHU6GSN4.js} +13 -13
- package/{appGetCommands-4DLM2P37.js → appGetCommands-24J55H2Y.js} +13 -13
- package/{appListCommands-CL4VLCZW.js → appListCommands-HE5KP3PH.js} +13 -13
- package/{authCommand-W2BDNL4D.js → authCommand-KGRK6MNU.js} +8 -8
- package/{authCommands-NYZM2B2I.js → authCommands-JSOG2H4E.js} +2 -2
- package/{chunk-OBO5YB35.js → chunk-5DWZ46RJ.js} +1 -1
- package/{chunk-E2VQTGUO.js → chunk-5EDKWSQN.js} +8 -8
- package/{chunk-B6RCQ4BM.js → chunk-AAWJ5S3G.js} +1 -1
- package/{chunk-THN2YFSR.js → chunk-ADE6577S.js} +62 -17
- package/{chunk-SDDOGQ6M.js → chunk-AOPOTHFK.js} +1 -1
- package/{chunk-OTIS3VY6.js → chunk-AZW5AHMW.js} +1 -1
- package/{chunk-7HD7MCCZ.js → chunk-CV6BM7LU.js} +1 -1
- package/{chunk-ACBCDO2E.js → chunk-CWTT2NZ6.js} +2 -2
- package/{chunk-OHK3HE4G.js → chunk-CZHE6LLV.js} +74 -11
- package/{chunk-35RYGII3.js → chunk-FXFGNOT2.js} +67 -1
- package/{chunk-T3EOQH72.js → chunk-G36SUBHA.js} +14 -4
- package/{chunk-QJZJW65A.js → chunk-GD23ZX7Z.js} +3 -3
- package/{chunk-DXJS7VSG.js → chunk-GE6IWA5N.js} +9 -2
- package/{chunk-P5AVCQF3.js → chunk-GGB6MPHD.js} +19 -18
- package/{chunk-NZXRTSOY.js → chunk-GNGOZMU2.js} +2 -2
- package/{chunk-6NUG4BJE.js → chunk-J2WT5CEO.js} +1 -1
- package/{chunk-XJBAAOKS.js → chunk-JJ2WUBFN.js} +1 -1
- package/{chunk-ONGWRXVA.js → chunk-KURQBS7S.js} +1 -1
- package/{chunk-J6MEBHAT.js → chunk-LEHTC2FI.js} +1 -1
- package/{chunk-6OMNSBFW.js → chunk-LLDGWLML.js} +8 -8
- package/{chunk-MSBHAQVV.js → chunk-MCXQNEJ3.js} +1 -1
- package/{chunk-WV3WZRYZ.js → chunk-P3RZ6DHN.js} +74 -15
- package/{chunk-5IIJMMC3.js → chunk-PMCKFQYC.js} +1 -1
- package/{chunk-UTADKKM7.js → chunk-PTKI7TIN.js} +101 -23
- package/{chunk-5UI2CDQG.js → chunk-PXPISYEH.js} +14 -9
- package/{chunk-LWHK7TZR.js → chunk-PY7VGC5M.js} +24 -5
- package/{chunk-C4JWF4EX.js → chunk-RM464B7I.js} +2 -2
- package/{chunk-2KPE5HQM.js → chunk-S7AV3NCK.js} +47 -14
- package/{chunk-5TAM6OX3.js → chunk-SIUEKVK4.js} +136 -41
- package/{chunk-XR6PNQ3N.js → chunk-TLYHUIWF.js} +3 -3
- package/{chunk-RRJD2ZUV.js → chunk-TNM27YZ7.js} +3 -3
- package/{chunk-J3HWN4B5.js → chunk-TWA4L7J7.js} +1 -1
- package/{chunk-UZH44DWK.js → chunk-WCP5FDTF.js} +13 -20
- package/{chunk-4POUK2BV.js → chunk-WSQLK2KR.js} +1 -1
- package/{chunk-OMWJXZSZ.js → chunk-XNZJVYFS.js} +1 -1
- package/{chunk-KF3VWOQ6.js → chunk-YJY7HODU.js} +1 -1
- package/{chunk-DZNONG7L.js → chunk-ZFL3LTU7.js} +2 -2
- package/{createAgentAutomationAction-B5G57KMG.js → createAgentAutomationAction-PO62NUR7.js} +6 -6
- package/{createDialogAction-SYKO3ACQ.js → createDialogAction-ORFRYI3C.js} +7 -7
- package/{createPageAction-UBO6CXTT.js → createPageAction-XWVMNTYH.js} +6 -6
- package/{dialogCommands-FQPSK7QE.js → dialogCommands-XTJHROXM.js} +13 -13
- package/{dialogSlice-OFGPXYFS.js → dialogSlice-DJXC53YW.js} +6 -6
- package/{docCreateCommands-ELKBZBHI.js → docCreateCommands-T2XRVXYS.js} +12 -12
- package/{docDeleteCommands-R6X3FKHX.js → docDeleteCommands-L7RXFXY3.js} +13 -13
- package/{docReadCommands-QNVUXQNM.js → docReadCommands-M5PYNADQ.js} +12 -12
- package/{docStore-WFMCDOGV.js → docStore-6LKLLFDW.js} +7 -7
- package/{docUpdateCommands-OOR4CWYI.js → docUpdateCommands-OA5EGPLQ.js} +12 -12
- package/{getPricing-ZOASM7TQ.js → getPricing-6C3C47Y4.js} +3 -3
- package/{handleSendMessageAction-R3AP5MQY.js → handleSendMessageAction-ILFGZTN5.js} +6 -6
- package/index.js +68 -68
- package/{machineCommands-FPZ2UVCS.js → machineCommands-AKAQGPAO.js} +21 -21
- package/{machineWsRunDispatch-XAVKPZLL.js → machineWsRunDispatch-RSBERM64.js} +21 -21
- package/{models-DUNBMXRQ.js → models-ILWKIX2Y.js} +2 -2
- package/package.json +1 -1
- package/{readlineWorkspace-O3D2LRYG.js → readlineWorkspace-TUH3SFHO.js} +112 -62
- package/{runAgentClientLoop-UWNABHIZ.js → runAgentClientLoop-C3QB2EXV.js} +15 -15
- package/{spaceCommands-L6R7DD2L.js → spaceCommands-SXYOFGUJ.js} +12 -12
- package/{spaceSlice-2UQAI6GT.js → spaceSlice-6BHMRP5O.js} +6 -6
- package/{streamAgentChatTurn-SS62OWZZ.js → streamAgentChatTurn-GF5W5OIP.js} +18 -18
- package/{tableCommands-HEQYT2KP.js → tableCommands-QSZILI7I.js} +1 -1
- package/{tools-NVSLAOK4.js → tools-KBCLJ43G.js} +11 -11
- package/{tuiSummaryLlmCaller-A7OO23I4.js → tuiSummaryLlmCaller-ARIMGILF.js} +4 -4
- package/{updateCommands-HTCOBXCA.js → updateCommands-AK2RDOFR.js} +8 -2
- package/{updateDialogTitleAction-WMWZQ764.js → updateDialogTitleAction-LMHZUY4Q.js} +6 -6
|
@@ -3,11 +3,10 @@ import {
|
|
|
3
3
|
refreshAntigravityOAuthToken,
|
|
4
4
|
refreshOpenAiCodexToken,
|
|
5
5
|
refreshXaiOAuthToken
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TWA4L7J7.js";
|
|
7
7
|
import {
|
|
8
|
-
buildLocalAgentLookupKeys
|
|
9
|
-
|
|
10
|
-
} from "./chunk-OTIS3VY6.js";
|
|
8
|
+
buildLocalAgentLookupKeys
|
|
9
|
+
} from "./chunk-AZW5AHMW.js";
|
|
11
10
|
import {
|
|
12
11
|
LOCAL_CODEX_AGENT_ID,
|
|
13
12
|
LOCAL_CODEX_AGENT_KEY,
|
|
@@ -20,13 +19,13 @@ import {
|
|
|
20
19
|
import {
|
|
21
20
|
inlineImageUrlsForCustomProvider,
|
|
22
21
|
prepareTools
|
|
23
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ZFL3LTU7.js";
|
|
24
23
|
import {
|
|
25
24
|
getAntigravityUserAgent,
|
|
26
25
|
isAntigravityOAuthAgent,
|
|
27
26
|
readAntigravityProjectId,
|
|
28
27
|
resolveAntigravityCloudCodeBaseUrl
|
|
29
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-XNZJVYFS.js";
|
|
30
29
|
import {
|
|
31
30
|
readXPostFunc,
|
|
32
31
|
readXPostFunctionSchema,
|
|
@@ -35,7 +34,7 @@ import {
|
|
|
35
34
|
rememberMemoryFunctionSchema,
|
|
36
35
|
resolveAgentRequiredPackIds,
|
|
37
36
|
setTodoListFunc
|
|
38
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-GGB6MPHD.js";
|
|
39
38
|
import {
|
|
40
39
|
createDrainExhaustedResponse,
|
|
41
40
|
isCoreDrainingBody,
|
|
@@ -46,15 +45,20 @@ import {
|
|
|
46
45
|
getDefaultCliLocalRuntimeDb
|
|
47
46
|
} from "./chunk-WJRJDX2W.js";
|
|
48
47
|
import {
|
|
48
|
+
applyTokenUsageToDayStats,
|
|
49
49
|
prepareTokenUsageData,
|
|
50
|
-
resolveBuiltinPlatformAgentConfig
|
|
51
|
-
|
|
50
|
+
resolveBuiltinPlatformAgentConfig,
|
|
51
|
+
runKeyed
|
|
52
|
+
} from "./chunk-ADE6577S.js";
|
|
52
53
|
import {
|
|
53
54
|
BUILTIN_TITLE_LLM_CONFIG
|
|
54
55
|
} from "./chunk-XOIF2TNF.js";
|
|
55
56
|
import {
|
|
56
57
|
fetchServerSyncedCredential
|
|
57
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-GD23ZX7Z.js";
|
|
59
|
+
import {
|
|
60
|
+
require_date_fns
|
|
61
|
+
} from "./chunk-M76ECQRD.js";
|
|
58
62
|
import {
|
|
59
63
|
FORCED_TOOLS,
|
|
60
64
|
addDefaultLightWebToolsForConfiguredAgents,
|
|
@@ -76,11 +80,14 @@ import {
|
|
|
76
80
|
dialogMessageRecordToAgentRuntimeMessage,
|
|
77
81
|
executeLocalToolWithPolicy,
|
|
78
82
|
executeOpenAiCompatibleChatCompletion,
|
|
83
|
+
isAgentCoolingDown,
|
|
79
84
|
parseSseDataLineJson,
|
|
80
85
|
parseSseDataLineObject,
|
|
86
|
+
parseSyncServersEnv,
|
|
81
87
|
readOpenAiCompatibleSseCompletion,
|
|
88
|
+
resolveAgentNextAvailableAt,
|
|
82
89
|
resolveOpenAiCompatibleProviderConfig
|
|
83
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-SIUEKVK4.js";
|
|
84
91
|
import {
|
|
85
92
|
buildPlatformChatCompletionRequest,
|
|
86
93
|
canUsePlatformChatProvider,
|
|
@@ -90,25 +97,25 @@ import {
|
|
|
90
97
|
readSseDataValues,
|
|
91
98
|
resolvePlatformChatProviderConfig,
|
|
92
99
|
shouldUsePlatformChatProvider
|
|
93
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-MCXQNEJ3.js";
|
|
94
101
|
import {
|
|
95
102
|
resolveAgentRuntimeConfigFromRecord
|
|
96
103
|
} from "./chunk-OIQPORYI.js";
|
|
97
104
|
import {
|
|
98
105
|
summarizeToolArguments
|
|
99
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-P3RZ6DHN.js";
|
|
100
107
|
import {
|
|
101
108
|
convertMessagesToResponsesInput,
|
|
102
109
|
toResponsesTools
|
|
103
110
|
} from "./chunk-D34RI6NI.js";
|
|
104
111
|
import {
|
|
105
112
|
resolvePlatformAuthToken
|
|
106
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-PXPISYEH.js";
|
|
107
114
|
import {
|
|
108
115
|
buildNoloWorkspaceOpenAiTools,
|
|
109
116
|
parseNoloWorkspaceToolArguments,
|
|
110
117
|
resolveRuntimeToolSurfaceForAgent
|
|
111
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-WCP5FDTF.js";
|
|
112
119
|
import {
|
|
113
120
|
buildDialogFallbackTitleFromUserInput,
|
|
114
121
|
normalizeDialogTitle
|
|
@@ -130,7 +137,7 @@ import {
|
|
|
130
137
|
} from "./chunk-JZPBVBIY.js";
|
|
131
138
|
import {
|
|
132
139
|
isAdaptiveThinkingModelId
|
|
133
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-LEHTC2FI.js";
|
|
134
141
|
import {
|
|
135
142
|
canonicalizeToolNames
|
|
136
143
|
} from "./chunk-ZZ2MH7LE.js";
|
|
@@ -177,6 +184,7 @@ import {
|
|
|
177
184
|
} from "./chunk-OLZBQWZU.js";
|
|
178
185
|
import {
|
|
179
186
|
createTokenKey,
|
|
187
|
+
createTokenStatsKey,
|
|
180
188
|
createUserKey,
|
|
181
189
|
dialogMessageRange
|
|
182
190
|
} from "./chunk-NRY4GCKJ.js";
|
|
@@ -207,6 +215,9 @@ import {
|
|
|
207
215
|
import {
|
|
208
216
|
asOptionalTrimmedString
|
|
209
217
|
} from "./chunk-G3SUCT4W.js";
|
|
218
|
+
import {
|
|
219
|
+
__toESM
|
|
220
|
+
} from "./chunk-4VNS5WPM.js";
|
|
210
221
|
|
|
211
222
|
// packages/cli/tui/i18n.ts
|
|
212
223
|
var ZH_PATTERNS = /^zh/i;
|
|
@@ -862,6 +873,10 @@ Use /switch, /switch list, /switch minimax-m3, or a full agent key.`,
|
|
|
862
873
|
zh: "nolo {0}\n\u7528 nolo update \u66F4\u65B0\u5F53\u524D\u5B89\u88C5\u3002\n\u5982\u679C\u672C\u5730\u4ED3\u5E93\u8F93\u51FA\u7684\u7248\u672C\u4E0D\u540C\uFF0C\u8BF7\u5148\u53D1\u5E03/\u5B89\u88C5\u6700\u65B0\u7684 npm \u5305\u3002"
|
|
863
874
|
},
|
|
864
875
|
versionUnknown: { en: "unknown version", zh: "\u672A\u77E5\u7248\u672C" },
|
|
876
|
+
updateAvailable: {
|
|
877
|
+
en: "New nolo {0} available (you have {1}) \u2014 run /update to upgrade",
|
|
878
|
+
zh: "\u65B0\u7248\u672C nolo {0} \u53EF\u7528\uFF08\u5F53\u524D {1}\uFF09\u2014 \u8FD0\u884C /update \u5347\u7EA7"
|
|
879
|
+
},
|
|
865
880
|
// --- Dialog list / timestamps -----------------------------------------
|
|
866
881
|
recentDialogs: { en: "Recent dialogs:", zh: "\u6700\u8FD1\u5BF9\u8BDD\uFF1A" },
|
|
867
882
|
dialogListTip: {
|
|
@@ -1576,9 +1591,7 @@ function resolveBuiltinLocalCliAgentConfig(agentRef, userId) {
|
|
|
1576
1591
|
}
|
|
1577
1592
|
async function readAgentFromStore(args) {
|
|
1578
1593
|
for (const key of buildLocalAgentLookupKeys(args)) {
|
|
1579
|
-
const record = await args.store.read(key
|
|
1580
|
-
remote: shouldReadAgentKeyRemotely(key)
|
|
1581
|
-
});
|
|
1594
|
+
const record = await args.store.read(key);
|
|
1582
1595
|
if (!record || typeof record !== "object") continue;
|
|
1583
1596
|
return resolveAgentRuntimeConfigFromRecord(key, record);
|
|
1584
1597
|
}
|
|
@@ -2582,8 +2595,8 @@ function createCliControlAgentRunExecutor(deps = {}) {
|
|
|
2582
2595
|
runSummaries.push({
|
|
2583
2596
|
runId: rec.runId,
|
|
2584
2597
|
status: rec.status,
|
|
2585
|
-
startedAt: readTimestamp(rec.startedAt),
|
|
2586
|
-
finishedAt: readTimestamp(rec.endedAt),
|
|
2598
|
+
startedAt: readTimestamp(rec.startedAt)?.toString(),
|
|
2599
|
+
finishedAt: readTimestamp(rec.endedAt)?.toString(),
|
|
2587
2600
|
...rec.agentName ? { agentName: rec.agentName } : {}
|
|
2588
2601
|
});
|
|
2589
2602
|
}
|
|
@@ -2928,6 +2941,9 @@ import { randomUUID } from "node:crypto";
|
|
|
2928
2941
|
|
|
2929
2942
|
// packages/agent-runtime/antigravityWireModel.ts
|
|
2930
2943
|
var WIRE_PROFILES = {
|
|
2944
|
+
"gemini-3.7-flash-low": { maxOutputTokens: 65536 },
|
|
2945
|
+
"gemini-3.7-flash-medium": { maxOutputTokens: 65536 },
|
|
2946
|
+
"gemini-3.7-flash-high": { maxOutputTokens: 65536 },
|
|
2931
2947
|
"gemini-3.6-flash-low": { maxOutputTokens: 65536 },
|
|
2932
2948
|
"gemini-3.6-flash-medium": { maxOutputTokens: 65536 },
|
|
2933
2949
|
"gemini-3.6-flash-high": { maxOutputTokens: 65536 },
|
|
@@ -2949,6 +2965,10 @@ function resolveAntigravityWireModel(logicalModelId) {
|
|
|
2949
2965
|
const wireModelId = "gemini-3.5-flash-low";
|
|
2950
2966
|
return { wireModelId, profile: WIRE_PROFILES[wireModelId] };
|
|
2951
2967
|
}
|
|
2968
|
+
if (lower === "gemini-3.7-flash") {
|
|
2969
|
+
const wireModelId = "gemini-3.7-flash-low";
|
|
2970
|
+
return { wireModelId, profile: WIRE_PROFILES[wireModelId] };
|
|
2971
|
+
}
|
|
2952
2972
|
if (lower === "gemini-3.6-flash") {
|
|
2953
2973
|
const wireModelId = "gemini-3.6-flash-low";
|
|
2954
2974
|
return { wireModelId, profile: WIRE_PROFILES[wireModelId] };
|
|
@@ -3547,6 +3567,9 @@ function buildAnthropicMessagesBody(args) {
|
|
|
3547
3567
|
input_schema: fn?.parameters && typeof fn.parameters === "object" ? fn.parameters : { type: "object", properties: {} }
|
|
3548
3568
|
}];
|
|
3549
3569
|
}) : [];
|
|
3570
|
+
if (tools.length > 0 && !tools.some((tool) => isCacheControl(tool.cache_control))) {
|
|
3571
|
+
tools[tools.length - 1].cache_control = { type: "ephemeral" };
|
|
3572
|
+
}
|
|
3550
3573
|
const model = stringValue(args.openAiBody.model) ?? args.agentConfig.model ?? "claude-sonnet-5";
|
|
3551
3574
|
const maxTokensRaw = args.openAiBody.max_completion_tokens ?? args.openAiBody.max_tokens ?? args.agentConfig.max_tokens;
|
|
3552
3575
|
const maxTokens = typeof maxTokensRaw === "number" && Number.isFinite(maxTokensRaw) ? Math.max(1, Math.floor(maxTokensRaw)) : 8192;
|
|
@@ -3654,7 +3677,7 @@ async function fetchAnthropicMessagesCompletion(args) {
|
|
|
3654
3677
|
const payload = await response.json().catch(async () => ({
|
|
3655
3678
|
error: { message: await response.text().catch(() => response.statusText) }
|
|
3656
3679
|
}));
|
|
3657
|
-
if (!response.ok) return { status: response.status, body: payload };
|
|
3680
|
+
if (!response.ok) return { status: response.status, body: payload, headers: response.headers };
|
|
3658
3681
|
return { status: 200, body: mapAnthropicMessageToOpenAi(payload) };
|
|
3659
3682
|
}
|
|
3660
3683
|
function isAnthropicOAuthAgent(agent) {
|
|
@@ -10378,6 +10401,7 @@ function resolveFallbackServers(env) {
|
|
|
10378
10401
|
const values = [
|
|
10379
10402
|
env.NOLO_SERVER_URL,
|
|
10380
10403
|
env.BASE_URL,
|
|
10404
|
+
...parseSyncServersEnv(env),
|
|
10381
10405
|
...NOLO_CLUSTER_SERVERS
|
|
10382
10406
|
].filter((value) => typeof value === "string" && value.trim().length > 0);
|
|
10383
10407
|
return [...new Set(values.map(normalizeServerOrigin))];
|
|
@@ -10563,6 +10587,7 @@ function isRemoteAuthEndpoint(endpoint) {
|
|
|
10563
10587
|
}
|
|
10564
10588
|
|
|
10565
10589
|
// packages/cli/client/localRuntimeDialog.ts
|
|
10590
|
+
var import_date_fns = __toESM(require_date_fns(), 1);
|
|
10566
10591
|
async function resolveStore(deps) {
|
|
10567
10592
|
if (deps.store) return deps.store;
|
|
10568
10593
|
return createCliHybridRecordStore({
|
|
@@ -10662,6 +10687,8 @@ async function writeLocalTokenRecord(args) {
|
|
|
10662
10687
|
entry_path: "cli-local"
|
|
10663
10688
|
});
|
|
10664
10689
|
const recordKey = createTokenKey.recordForStableCall(args.userId, callId);
|
|
10690
|
+
const existingToken = await args.store.read(recordKey, { remote: false }).catch(() => null);
|
|
10691
|
+
if (existingToken) continue;
|
|
10665
10692
|
const tokenRecord = {
|
|
10666
10693
|
id: args.createId(),
|
|
10667
10694
|
type: "token",
|
|
@@ -10669,6 +10696,26 @@ async function writeLocalTokenRecord(args) {
|
|
|
10669
10696
|
};
|
|
10670
10697
|
await args.store.write(recordKey, tokenRecord);
|
|
10671
10698
|
ops.push({ type: "put", key: recordKey, value: tokenRecord });
|
|
10699
|
+
const dateKey = (0, import_date_fns.format)(timestamp, "yyyy-MM-dd");
|
|
10700
|
+
const statsKey = createTokenStatsKey(args.userId, dateKey);
|
|
10701
|
+
await runKeyed(statsKey, async () => {
|
|
10702
|
+
let existingStats = null;
|
|
10703
|
+
try {
|
|
10704
|
+
existingStats = await args.store.read(statsKey, { remote: false });
|
|
10705
|
+
} catch {
|
|
10706
|
+
}
|
|
10707
|
+
const newStats = applyTokenUsageToDayStats(existingStats, {
|
|
10708
|
+
userId: args.userId,
|
|
10709
|
+
timeKey: dateKey,
|
|
10710
|
+
model: prepared.billedModel,
|
|
10711
|
+
provider: prepared.recordProvider,
|
|
10712
|
+
input_tokens: prepared.usage.input_tokens,
|
|
10713
|
+
output_tokens: prepared.usage.output_tokens,
|
|
10714
|
+
cost: prepared.tokenData.cost
|
|
10715
|
+
});
|
|
10716
|
+
const statsRecord = { ...newStats, id: statsKey, type: "token" };
|
|
10717
|
+
await args.store.write(statsKey, statsRecord);
|
|
10718
|
+
});
|
|
10672
10719
|
}
|
|
10673
10720
|
return ops;
|
|
10674
10721
|
}
|
|
@@ -10973,6 +11020,21 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
10973
11020
|
})
|
|
10974
11021
|
}),
|
|
10975
11022
|
resolveProvider: async (agentConfig) => {
|
|
11023
|
+
if (isAgentCoolingDown(agentConfig, now())) {
|
|
11024
|
+
throw new Error(
|
|
11025
|
+
`agent temporarily unavailable until ${new Date(Number(agentConfig.nextAvailableAt)).toISOString()}`
|
|
11026
|
+
);
|
|
11027
|
+
}
|
|
11028
|
+
const recordLocalAvailability = async (status, body) => {
|
|
11029
|
+
const key = typeof agentConfig.key === "string" ? agentConfig.key : "";
|
|
11030
|
+
if (!key || status !== 200 && status !== 429) return;
|
|
11031
|
+
const current = await getOrCreateSharedStore(deps).then((store) => store.read(key, { remote: false })).catch(() => null);
|
|
11032
|
+
if (!current || typeof current !== "object") return;
|
|
11033
|
+
const next = { ...current };
|
|
11034
|
+
if (status === 429) next.nextAvailableAt = resolveAgentNextAvailableAt(body, now());
|
|
11035
|
+
else delete next.nextAvailableAt;
|
|
11036
|
+
await getOrCreateSharedStore(deps).then((store) => store.write(key, next)).catch(() => void 0);
|
|
11037
|
+
};
|
|
10976
11038
|
if (isCliProviderAgent(agentConfig)) {
|
|
10977
11039
|
const provider = resolveCliProviderName(agentConfig);
|
|
10978
11040
|
logLocalRuntimeDiagnostic("provider.selected", {
|
|
@@ -11023,7 +11085,20 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
11023
11085
|
const credentialBroker = createFileCredentialBroker();
|
|
11024
11086
|
const serverUrl = asOptionalTrimmedString(deps.env.NOLO_SERVER) ?? "https://us.nolo.chat";
|
|
11025
11087
|
const authToken = asOptionalTrimmedString(deps.env.AUTH_TOKEN);
|
|
11026
|
-
const syncFetcher = authToken ? (ref) =>
|
|
11088
|
+
const syncFetcher = authToken ? async (ref) => {
|
|
11089
|
+
try {
|
|
11090
|
+
return await fetchServerSyncedCredential(
|
|
11091
|
+
{ currentServer: serverUrl, authToken },
|
|
11092
|
+
ref
|
|
11093
|
+
);
|
|
11094
|
+
} catch (error) {
|
|
11095
|
+
logLocalRuntimeDiagnostic("credential.sync.unavailable", {
|
|
11096
|
+
ref,
|
|
11097
|
+
error: toErrorMessage(error)
|
|
11098
|
+
});
|
|
11099
|
+
return null;
|
|
11100
|
+
}
|
|
11101
|
+
} : void 0;
|
|
11027
11102
|
if (isAntigravityOAuthAgent(agentConfig)) {
|
|
11028
11103
|
const accessToken = await apiKeyRefResolver("antigravity");
|
|
11029
11104
|
if (!accessToken) {
|
|
@@ -11077,6 +11152,7 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
11077
11152
|
loopbackRequest
|
|
11078
11153
|
})
|
|
11079
11154
|
});
|
|
11155
|
+
await recordLocalAvailability(result.status, result.body);
|
|
11080
11156
|
if (result.status < 200 || result.status >= 300) {
|
|
11081
11157
|
const errMsg = result.body && typeof result.body === "object" && result.body.error && typeof result.body.error.message === "string" ? result.body.error.message : JSON.stringify(result.body);
|
|
11082
11158
|
throw new Error(
|
|
@@ -11145,6 +11221,7 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
11145
11221
|
loopbackRequest
|
|
11146
11222
|
})
|
|
11147
11223
|
});
|
|
11224
|
+
await recordLocalAvailability(result.status, result.body);
|
|
11148
11225
|
if (result.status < 200 || result.status >= 300) {
|
|
11149
11226
|
const errMsg = result.body?.error && typeof result.body.error === "object" && typeof result.body.error.message === "string" ? result.body.error.message : JSON.stringify(result.body);
|
|
11150
11227
|
throw new Error(
|
|
@@ -11215,6 +11292,7 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
11215
11292
|
loopbackRequest
|
|
11216
11293
|
})
|
|
11217
11294
|
});
|
|
11295
|
+
await recordLocalAvailability(result.status, result.body);
|
|
11218
11296
|
if (result.status < 200 || result.status >= 300) {
|
|
11219
11297
|
const errMsg = result.body?.error && typeof result.body.error === "object" && typeof result.body.error.message === "string" ? result.body.error.message : JSON.stringify(result.body);
|
|
11220
11298
|
throw new Error(
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getModelConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LEHTC2FI.js";
|
|
4
4
|
import {
|
|
5
5
|
isPlatformHostedClaudeModel,
|
|
6
6
|
isPlatformHostedGrokModel
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CZHE6LLV.js";
|
|
8
8
|
import {
|
|
9
9
|
asTrimmedLowercaseString
|
|
10
10
|
} from "./chunk-QSJ3HFEF.js";
|
|
@@ -249,7 +249,11 @@ async function buildProviderExecutionPlan(args) {
|
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
if (!apiKey2 && agentConfig.credentialSynced && args.syncFetcher && credentialRef2) {
|
|
252
|
-
|
|
252
|
+
let synced = null;
|
|
253
|
+
try {
|
|
254
|
+
synced = await args.syncFetcher(credentialRef2);
|
|
255
|
+
} catch {
|
|
256
|
+
}
|
|
253
257
|
const trimmed = asTrimmedString(synced);
|
|
254
258
|
if (trimmed) {
|
|
255
259
|
try {
|
|
@@ -316,13 +320,10 @@ async function buildProviderExecutionPlan(args) {
|
|
|
316
320
|
serverUrl: resolvePlatformServerUrl(env),
|
|
317
321
|
authToken: resolvePlatformAuthToken(env),
|
|
318
322
|
agentKey: agentConfig.key,
|
|
319
|
-
...agentConfig.apiSource ? { apiSource: agentConfig.apiSource } : {}
|
|
323
|
+
...agentConfig.apiSource ? { apiSource: agentConfig.apiSource } : {}
|
|
320
324
|
// Platform agents use the server-managed provider credential. Never
|
|
321
325
|
// forward a raw credential from a stale/local agent record through the
|
|
322
|
-
// platform proxy
|
|
323
|
-
// for the proxy's configured upstream.
|
|
324
|
-
...mode === "custom" && agentConfig.apiKey?.trim() ? { apiKey: agentConfig.apiKey.trim() } : {},
|
|
325
|
-
...mode === "custom" && agentConfig.apiKeyHeader?.trim() ? { apiKeyHeader: agentConfig.apiKeyHeader.trim() } : {}
|
|
326
|
+
// platform proxy; credentials are resolved by the platform server.
|
|
326
327
|
};
|
|
327
328
|
}
|
|
328
329
|
let apiKey = "";
|
|
@@ -334,7 +335,11 @@ async function buildProviderExecutionPlan(args) {
|
|
|
334
335
|
}
|
|
335
336
|
}
|
|
336
337
|
if (!apiKey && agentConfig.credentialSynced && args.syncFetcher && credentialRef) {
|
|
337
|
-
|
|
338
|
+
let synced = null;
|
|
339
|
+
try {
|
|
340
|
+
synced = await args.syncFetcher(credentialRef);
|
|
341
|
+
} catch {
|
|
342
|
+
}
|
|
338
343
|
const trimmed = asTrimmedString(synced);
|
|
339
344
|
if (trimmed) {
|
|
340
345
|
try {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MODEL_LOOKUP_MAP
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LEHTC2FI.js";
|
|
4
4
|
import {
|
|
5
5
|
ALL_MODELS
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-G36SUBHA.js";
|
|
7
7
|
import {
|
|
8
8
|
addContentAction
|
|
9
9
|
} from "./chunk-OXLLFZNF.js";
|
|
@@ -463,6 +463,11 @@ var classifyConversationLoad = (msgs) => {
|
|
|
463
463
|
}
|
|
464
464
|
return "medium";
|
|
465
465
|
};
|
|
466
|
+
var normalizeContextUsageRatio = (value) => {
|
|
467
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
|
|
468
|
+
const ratio = value > 1 ? value / 100 : value;
|
|
469
|
+
return ratio >= 0 && ratio <= 1 ? ratio : void 0;
|
|
470
|
+
};
|
|
466
471
|
var emptyPlan = (startIndex) => ({
|
|
467
472
|
shouldCompress: false,
|
|
468
473
|
compressCount: 0,
|
|
@@ -478,7 +483,8 @@ function planCompression(input) {
|
|
|
478
483
|
summary,
|
|
479
484
|
contextWindow,
|
|
480
485
|
force = false,
|
|
481
|
-
reason
|
|
486
|
+
reason,
|
|
487
|
+
realContextUsagePercent
|
|
482
488
|
} = input;
|
|
483
489
|
let startIndex = 0;
|
|
484
490
|
if (summarizedBeforeId) {
|
|
@@ -504,8 +510,20 @@ function planCompression(input) {
|
|
|
504
510
|
summaryTokens: adjustedSummaryTokens,
|
|
505
511
|
recentLoad
|
|
506
512
|
});
|
|
513
|
+
let shouldTriggerByUsage = false;
|
|
514
|
+
const usageRatio = normalizeContextUsageRatio(realContextUsagePercent);
|
|
515
|
+
if (usageRatio !== void 0) {
|
|
516
|
+
if (usageRatio >= 0.78) {
|
|
517
|
+
shouldTriggerByUsage = true;
|
|
518
|
+
} else if (usageRatio >= 0.65 && isActiveSummaryWorthDoing(pendingTokens, contextWindow)) {
|
|
519
|
+
shouldTriggerByUsage = true;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if (totalUsed >= historyBudget) {
|
|
523
|
+
shouldTriggerByUsage = true;
|
|
524
|
+
}
|
|
507
525
|
const shouldRunActiveSummary = force && reason === "manual" && !hasOpenEndedToolCall(pendingMsgs[pendingMsgs.length - 1]) && isActiveSummaryWorthDoing(pendingTokens, contextWindow);
|
|
508
|
-
if (
|
|
526
|
+
if (!shouldTriggerByUsage && !shouldRunActiveSummary) {
|
|
509
527
|
return emptyPlan(startIndex);
|
|
510
528
|
}
|
|
511
529
|
let tokensToKeep = 0;
|
|
@@ -516,7 +534,8 @@ function planCompression(input) {
|
|
|
516
534
|
tokensToKeep += t;
|
|
517
535
|
keepCount++;
|
|
518
536
|
}
|
|
519
|
-
|
|
537
|
+
const triggeredByRealUsage = usageRatio !== void 0 && shouldTriggerByUsage;
|
|
538
|
+
let compressCount = (shouldRunActiveSummary || triggeredByRealUsage) && totalUsed < historyBudget ? Math.max(0, pendingMsgs.length - ACTIVE_SUMMARY_TAIL_KEEP_COUNT) : pendingMsgs.length - keepCount;
|
|
520
539
|
while (compressCount > 0 && compressCount < pendingMsgs.length && pendingMsgs[compressCount].role === "tool") {
|
|
521
540
|
compressCount--;
|
|
522
541
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clearCliLocalRuntimePreparedAgentCache
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PTKI7TIN.js";
|
|
4
4
|
import {
|
|
5
5
|
getReadableCliDb
|
|
6
6
|
} from "./chunk-WFHXMLHZ.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
resolveAgentRecordFromHybridStore,
|
|
13
13
|
sanitizeAgentRecordForCliOutput,
|
|
14
14
|
writeAgentRecord
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-J2WT5CEO.js";
|
|
16
16
|
import {
|
|
17
17
|
resolveCliAgentKeyInput
|
|
18
18
|
} from "./chunk-VHBWHNVT.js";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
parseAgentRunEvent,
|
|
20
20
|
t,
|
|
21
21
|
toolLabel
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-PTKI7TIN.js";
|
|
23
23
|
import {
|
|
24
24
|
getReadableCliDb
|
|
25
25
|
} from "./chunk-WFHXMLHZ.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
normalizeAgentHandle,
|
|
28
28
|
readDbRecord,
|
|
29
29
|
resolveAgentRecordFromHybridStore
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-J2WT5CEO.js";
|
|
31
31
|
import {
|
|
32
32
|
NOLO_PROJECT_MANAGER_AGENT_KEY,
|
|
33
33
|
isLocalCliAgentKey
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
} from "./chunk-LTRXGFMS.js";
|
|
39
39
|
import {
|
|
40
40
|
formatAgentListCard
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-GGB6MPHD.js";
|
|
42
42
|
import {
|
|
43
43
|
isGatewayHttpStatus
|
|
44
44
|
} from "./chunk-RQSOAMPJ.js";
|
|
@@ -50,12 +50,12 @@ import {
|
|
|
50
50
|
chooseMemoryOwners,
|
|
51
51
|
loadMemoryCandidatesFromDb,
|
|
52
52
|
resolveAgentMemoryPolicy
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-GNGOZMU2.js";
|
|
54
54
|
import {
|
|
55
55
|
API_REPORTED_COST_MULTIPLIER,
|
|
56
56
|
normalizeUsage,
|
|
57
57
|
parseUiAskChoiceContent
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-ADE6577S.js";
|
|
59
59
|
import {
|
|
60
60
|
buildSkillDiscoveryContextBlock
|
|
61
61
|
} from "./chunk-7OBMZCRD.js";
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
LOCAL_TURN_ABORTED_CODE,
|
|
72
72
|
readActionGate,
|
|
73
73
|
readCommandActionGatePayload
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-P3RZ6DHN.js";
|
|
75
75
|
import {
|
|
76
76
|
createThinkParserState,
|
|
77
77
|
flushThinkParser,
|
|
@@ -79,17 +79,17 @@ import {
|
|
|
79
79
|
} from "./chunk-N7J63Q6C.js";
|
|
80
80
|
import {
|
|
81
81
|
resolvePlatformAuthToken
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-PXPISYEH.js";
|
|
83
83
|
import {
|
|
84
84
|
DEFAULT_CONTEXT_WINDOW,
|
|
85
85
|
getModelContextWindow
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-PY7VGC5M.js";
|
|
87
87
|
import {
|
|
88
88
|
clipCompactText
|
|
89
89
|
} from "./chunk-5MMAK75Q.js";
|
|
90
90
|
import {
|
|
91
91
|
findModelConfig
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-LEHTC2FI.js";
|
|
93
93
|
import {
|
|
94
94
|
buildMemoryOverlayLayer,
|
|
95
95
|
buildMemoryUseGuidanceLayer
|
|
@@ -285,9 +285,20 @@ function formatUsage(usage, dialogId) {
|
|
|
285
285
|
const parts = [];
|
|
286
286
|
if (typeof dialogId === "string" && dialogId)
|
|
287
287
|
parts.push(`dialog=${dialogId}`);
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
288
|
+
if (usage && typeof usage === "object") {
|
|
289
|
+
const normalized = normalizeUsage(usage);
|
|
290
|
+
const input = Number(normalized.input_tokens || usage?.input_tokens || usage?.prompt_tokens || 0);
|
|
291
|
+
const output = Number(normalized.output_tokens || usage?.output_tokens || usage?.completion_tokens || 0);
|
|
292
|
+
const cacheHit = Number(normalized.cache_read_input_tokens || 0);
|
|
293
|
+
if (input || output) {
|
|
294
|
+
let tokenStr = `tokens=${input}+${output}`;
|
|
295
|
+
if (cacheHit > 0 && input > 0) {
|
|
296
|
+
const hitPercent = (cacheHit / (input + cacheHit) * 100).toFixed(1).replace(/\.0$/, "");
|
|
297
|
+
tokenStr += ` (cache: ${formatTokenCount(cacheHit)} / ${hitPercent}%)`;
|
|
298
|
+
}
|
|
299
|
+
parts.push(tokenStr);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
291
302
|
return parts.length ? ` (${parts.join(" ")})` : "";
|
|
292
303
|
}
|
|
293
304
|
|
|
@@ -1405,9 +1416,28 @@ function createRenderAwareStreamWriter(args) {
|
|
|
1405
1416
|
let inFence = false;
|
|
1406
1417
|
let fenceLang = "unknown";
|
|
1407
1418
|
let lastKind = null;
|
|
1419
|
+
const PARTIAL_FLUSH_THRESHOLD = 48;
|
|
1408
1420
|
const emitBreathIfNeeded = (nextKind) => {
|
|
1409
1421
|
if (needsListProseBreath(lastKind, nextKind)) args.write("\n");
|
|
1410
1422
|
};
|
|
1423
|
+
const flushPartialProse = () => {
|
|
1424
|
+
if (inFence || buffer.length < PARTIAL_FLUSH_THRESHOLD) return;
|
|
1425
|
+
const firstLine = buffer.split("\n", 1)[0] ?? "";
|
|
1426
|
+
if (isTableRow(firstLine) || classifyStreamLine(firstLine) !== "prose") return;
|
|
1427
|
+
const Segmenter = Intl.Segmenter;
|
|
1428
|
+
const graphemes = typeof Segmenter === "function" ? Array.from(new Segmenter(void 0, { granularity: "grapheme" }).segment(firstLine), (part) => part.segment) : Array.from(firstLine);
|
|
1429
|
+
if (graphemes.length < PARTIAL_FLUSH_THRESHOLD) return;
|
|
1430
|
+
let cut = PARTIAL_FLUSH_THRESHOLD;
|
|
1431
|
+
const whitespaceIndex = graphemes.slice(0, cut).findLastIndex((part) => /\s/.test(part));
|
|
1432
|
+
if (whitespaceIndex > 0) cut = whitespaceIndex + 1;
|
|
1433
|
+
const prefix = graphemes.slice(0, cut).join("");
|
|
1434
|
+
const hasUnsafeMarkdownPrefix = /[`*_~\[]/.test(prefix) || /^\s*[#>]/.test(prefix) || /!\[/.test(prefix);
|
|
1435
|
+
if (hasUnsafeMarkdownPrefix) return;
|
|
1436
|
+
emitBreathIfNeeded("prose");
|
|
1437
|
+
emitFormattedAssistantBlock(args.write, prefix, false);
|
|
1438
|
+
lastKind = "prose";
|
|
1439
|
+
buffer = prefix.length === buffer.length ? "" : buffer.slice(prefix.length);
|
|
1440
|
+
};
|
|
1411
1441
|
const flushCompleteBlocks = () => {
|
|
1412
1442
|
while (buffer.includes("\n")) {
|
|
1413
1443
|
const lines = buffer.split("\n");
|
|
@@ -1467,6 +1497,7 @@ function createRenderAwareStreamWriter(args) {
|
|
|
1467
1497
|
if (!chunk) return;
|
|
1468
1498
|
buffer += chunk;
|
|
1469
1499
|
flushCompleteBlocks();
|
|
1500
|
+
flushPartialProse();
|
|
1470
1501
|
},
|
|
1471
1502
|
flush() {
|
|
1472
1503
|
if (!buffer) return;
|
|
@@ -3449,7 +3480,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
|
|
|
3449
3480
|
// packages/cli/client/agentRun.ts
|
|
3450
3481
|
import { ulid } from "ulid";
|
|
3451
3482
|
async function loadRunLocalAgentTurn() {
|
|
3452
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
3483
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-GVNERRKQ.js");
|
|
3453
3484
|
return runLocalAgentTurn;
|
|
3454
3485
|
}
|
|
3455
3486
|
async function resolveCurrentMachineId(options) {
|
|
@@ -4969,7 +5000,9 @@ ${mdContent}`);
|
|
|
4969
5000
|
const memoryAgentKey = effectiveAgentKey;
|
|
4970
5001
|
const memorySpaceId = parsed.spaceId ?? void 0;
|
|
4971
5002
|
try {
|
|
4972
|
-
|
|
5003
|
+
const resolvedRuntimeMode = parsed.runtimeMode ?? (env.NOLO_RUNTIME_MODE === "local" || env.NOLO_RUNTIME_MODE === "server" || env.NOLO_RUNTIME_MODE === "auto" ? env.NOLO_RUNTIME_MODE : "auto");
|
|
5004
|
+
const usesExplicitServerRuntime = resolvedRuntimeMode === "server";
|
|
5005
|
+
if (usesExplicitServerRuntime && memoryAuthToken && memoryServerUrl) {
|
|
4973
5006
|
const memoryResponse = await fetch(`${memoryServerUrl}/api/memory/query`, {
|
|
4974
5007
|
method: "POST",
|
|
4975
5008
|
headers: {
|