nolo-cli 0.140.0-alpha.2 → 0.141.0-alpha.2
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-SOYFJXV6.js → _executeModel-PHFKA2OL.js} +11 -11
- package/{agentEmailCommands-FMB2MKEQ.js → agentEmailCommands-COB4Z4JG.js} +14 -13
- package/{agentListCommands-FKMX7KWB.js → agentListCommands-MWAR7A4K.js} +19 -0
- package/{agentMachineCommands-XMVB676S.js → agentMachineCommands-N5TMIAPZ.js} +1 -1
- package/{agentRecordCommands-KGBQJLVJ.js → agentRecordCommands-EF4O73ZD.js} +13 -12
- package/{agentRunCommand-SEDWFYXO.js → agentRunCommand-QXC6SUES.js} +12 -12
- package/{agentRunControl-AVJR4JW4.js → agentRunControl-MD72KLQA.js} +2 -2
- package/{agentSlice-CFXREBVL.js → agentSlice-EYRJX2J6.js} +1 -1
- package/{authCommand-K62FH4X2.js → authCommand-CYPLLWIC.js} +2 -2
- package/{chatQueueReduxAdapter-PUEMG7YZ.js → chatQueueReduxAdapter-YNI7ALFW.js} +2 -2
- package/{chunk-VPNHD2TS.js → chunk-63ZFMDDF.js} +1 -1
- package/{chunk-37GBLNHI.js → chunk-6YT7I7KF.js} +5 -5
- package/{chunk-F5IMTLHP.js → chunk-A3JENOEB.js} +2 -2
- package/{chunk-X6KARM5G.js → chunk-A3OTEZGZ.js} +2 -2
- package/{chunk-3EFEN43K.js → chunk-ATXCJGRN.js} +1 -1
- package/{chunk-Q6QLBANW.js → chunk-BWSBFGQN.js} +6 -6
- package/{chunk-XWVHWH35.js → chunk-CRGSU5DB.js} +1 -1
- package/{chunk-OMI6BKIS.js → chunk-DT7WS4NV.js} +3 -3
- package/{chunk-3VNWWVKB.js → chunk-L4KXQ6QP.js} +11 -0
- package/{chunk-K3NOJJUS.js → chunk-MPRDXX4T.js} +17 -9
- package/{chunk-I3TQJXQ7.js → chunk-QFPJEU36.js} +5 -2
- package/{chunk-PP6FTGA6.js → chunk-SFRMB7XN.js} +15 -12
- package/{chunk-OXY64W6K.js → chunk-SUFNELDG.js} +2 -2
- package/{chunk-2VMY5RLA.js → chunk-TS5BDIPV.js} +8 -8
- package/{chunk-XFEBG6NU.js → chunk-TUETDBTI.js} +2 -2
- package/{chunk-SNVNLFVK.js → chunk-TV5ODOAF.js} +3 -3
- package/chunk-U4STABYN.js +81 -0
- package/{chunk-LLVHGBUH.js → chunk-W5UYXCQE.js} +76 -9
- package/{chunk-ZW4TU76B.js → chunk-X45MLRN4.js} +16 -1
- package/{commandRegistry-I7INNYGB.js → commandRegistry-2RDTD6CT.js} +27 -27
- package/{contentThunks-BHQXUKKG.js → contentThunks-2PJ4QDAV.js} +3 -3
- package/{createAgentAutomationAction-QS5HQOP5.js → createAgentAutomationAction-SWO62RE2.js} +3 -3
- package/{createDialogAction-ZTC23O42.js → createDialogAction-2BMDM4X3.js} +4 -4
- package/{createPageAction-RFAUZO6Y.js → createPageAction-HLSLX4R4.js} +3 -3
- package/{dialogSlice-OU5IGCJ5.js → dialogSlice-7IGCUDZE.js} +2 -2
- package/{docStore-UQF3EY2X.js → docStore-OD3NRNBN.js} +1 -1
- package/{handleSendMessageAction-NFT57BBK.js → handleSendMessageAction-PRF7JNOH.js} +2 -2
- package/index.js +2 -2
- package/{machineCommands-2WI4ISEU.js → machineCommands-Y5QYMVTJ.js} +12 -12
- package/{machineWsRunDispatch-XQDTKFVP.js → machineWsRunDispatch-4DWFWYZ6.js} +12 -12
- package/package.json +1 -1
- package/{readlineWorkspace-XDHXGQ4Z.js → readlineWorkspace-YHJMMTC7.js} +51 -107
- package/{runAgentClientLoop-ZHN7EVIF.js → runAgentClientLoop-66UNGCTW.js} +9 -9
- package/{streamAgentChatTurn-KV7NADH2.js → streamAgentChatTurn-6F3M4KUY.js} +10 -10
- package/{tools-ZX3DP5DJ.js → tools-VSECJ5T7.js} +7 -7
- package/{updateDialogTitleAction-6ZCZK2I7.js → updateDialogTitleAction-WE5KY3SM.js} +3 -3
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
parseRetryAfterHeaderMs
|
|
25
25
|
} from "./chunk-3L2WKC3W.js";
|
|
26
26
|
import {
|
|
27
|
+
RUN_TITLE_MAX,
|
|
27
28
|
TASK_PREVIEW_MAX,
|
|
28
29
|
buildDelegatedTaskContent,
|
|
29
30
|
calculateDelegatedPayloadMetrics,
|
|
@@ -32,11 +33,12 @@ import {
|
|
|
32
33
|
formatStartRunCard,
|
|
33
34
|
formatStatusRunCard,
|
|
34
35
|
formatStopRunCard,
|
|
36
|
+
normalizeRunTitle,
|
|
35
37
|
resolveRunLabel
|
|
36
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-L4KXQ6QP.js";
|
|
37
39
|
import {
|
|
38
40
|
createDialogAction
|
|
39
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-A3JENOEB.js";
|
|
40
42
|
import {
|
|
41
43
|
addMemberSpace,
|
|
42
44
|
fetchAuthoritativeRemoteSpace,
|
|
@@ -60,7 +62,7 @@ import {
|
|
|
60
62
|
} from "./chunk-VF4K2QE6.js";
|
|
61
63
|
import {
|
|
62
64
|
createDocState
|
|
63
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-TUETDBTI.js";
|
|
64
66
|
import {
|
|
65
67
|
setDialogExtraReferencesAction
|
|
66
68
|
} from "./chunk-Z7IZQF56.js";
|
|
@@ -99,7 +101,7 @@ import {
|
|
|
99
101
|
updateContentCategory,
|
|
100
102
|
updateContentTitle,
|
|
101
103
|
writeStoredCollapsedCategories
|
|
102
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-CRGSU5DB.js";
|
|
103
105
|
import {
|
|
104
106
|
getCurrentSpaceId,
|
|
105
107
|
getCurrentSpaceIdRaw,
|
|
@@ -121,14 +123,14 @@ import {
|
|
|
121
123
|
selectMsgById,
|
|
122
124
|
uiAskChoiceFunc,
|
|
123
125
|
uiAskChoiceFunctionSchema
|
|
124
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-TS5BDIPV.js";
|
|
125
127
|
import {
|
|
126
128
|
createAgent,
|
|
127
129
|
deleteServerSyncedCredential,
|
|
128
130
|
runLlm,
|
|
129
131
|
streamAgentChatTurn,
|
|
130
132
|
updateAgent
|
|
131
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-TV5ODOAF.js";
|
|
132
134
|
import {
|
|
133
135
|
getActiveDialogKey,
|
|
134
136
|
selectCurrentDialogKey,
|
|
@@ -3976,7 +3978,7 @@ async function deleteDialogsFunc(args, thunkApi) {
|
|
|
3976
3978
|
const deletedDialogIds = [];
|
|
3977
3979
|
const deletedDialogKeys = [];
|
|
3978
3980
|
const failures = [];
|
|
3979
|
-
const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-
|
|
3981
|
+
const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-7IGCUDZE.js");
|
|
3980
3982
|
for (const target of targets) {
|
|
3981
3983
|
try {
|
|
3982
3984
|
await thunkApi.dispatch(deleteDialog2(target.dbKey)).unwrap();
|
|
@@ -13223,6 +13225,10 @@ function buildStartAgentRunFunctionSchema(opts) {
|
|
|
13223
13225
|
type: "string",
|
|
13224
13226
|
description: "\u53EF\u9009\u3002\u7531 listAgents/readAgent \u5F97\u5230\u7684\u53EF\u8BFB Agent \u540D\u79F0\uFF0C\u7528\u4E8E TUI \u8FD0\u884C\u5361\u7247\u5C55\u793A\u3002"
|
|
13225
13227
|
},
|
|
13228
|
+
title: {
|
|
13229
|
+
type: "string",
|
|
13230
|
+
description: `\u53EF\u9009\u3002\u8FD9\u6B21\u5B50\u4EFB\u52A1\u7684\u77ED\u6807\u9898\uFF08\u2264${RUN_TITLE_MAX} \u5B57\uFF0C\u4E00\u884C\uFF0C\u5982\u300C\u590D\u5BA1\u989D\u5EA6 diff\u300D\u300COpus \u672C\u5730\u62C9\u53D6\u8BBE\u8BA1\u300D\uFF09\u3002\u672C\u5730 TUI \u7684\u8FD0\u884C\u533A\u7528\u5B83\u6807\u8BC6\u8FD9\u4E2A run\uFF08\u670D\u52A1\u7AEF Web \u8DEF\u5F84\u53EA\u5728\u8FD4\u56DE\u503C\u91CC\u56DE\u663E\uFF0C\u4E0D\u6301\u4E45\u5316\uFF09\u3002\u540C\u4E00\u4E2A agent \u5E76\u53D1\u591A\u4E2A run \u65F6\u540D\u5B57\u5B8C\u5168\u76F8\u540C\u3001brief \u5F00\u5934\u53C8\u5E38\u662F\u540C\u6837\u7684\u5957\u8BDD\uFF0C\u5F3A\u70C8\u5EFA\u8BAE\u586B\u5199\uFF1B\u4E0D\u586B\u5219\u4E0D\u663E\u793A\u6807\u9898\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u4ECE\u4EFB\u52A1\u6B63\u6587\u751F\u6210\u3002`
|
|
13231
|
+
},
|
|
13226
13232
|
// 刻意不向模型暴露 ephemeral:AI 不需要知道这个选项,不提供即默认持久化。
|
|
13227
13233
|
// 非持久化 run 在失败/stall/输出被截断时不会留下任何可找回的结论,而
|
|
13228
13234
|
// review findings 与子任务产出都必须可回读——把选项藏起来比写一条
|
|
@@ -13346,6 +13352,7 @@ async function startAgentRunFunc(args, thunkApi, _context) {
|
|
|
13346
13352
|
const resolvedName = agentName?.trim() || bgResult.agentName || bgResult.name;
|
|
13347
13353
|
const identity = { agentName: resolvedName, agentKey, runId };
|
|
13348
13354
|
const taskPreview = task.replace(/\s+/g, " ").trim().slice(0, TASK_PREVIEW_MAX);
|
|
13355
|
+
const title = normalizeRunTitle(args.title);
|
|
13349
13356
|
return {
|
|
13350
13357
|
rawData: {
|
|
13351
13358
|
runId,
|
|
@@ -13358,6 +13365,7 @@ async function startAgentRunFunc(args, thunkApi, _context) {
|
|
|
13358
13365
|
batchId: effectiveBatchId,
|
|
13359
13366
|
...resolvedName ? { agentName: resolvedName } : {},
|
|
13360
13367
|
...taskPreview ? { taskPreview } : {},
|
|
13368
|
+
...title ? { title } : {},
|
|
13361
13369
|
payloadMetrics
|
|
13362
13370
|
},
|
|
13363
13371
|
displayData: formatStartRunCard(resolveRunLabel(identity), status, {
|
|
@@ -15035,7 +15043,7 @@ var executeToolRun = createAsyncThunk(
|
|
|
15035
15043
|
if (!executionInput) {
|
|
15036
15044
|
throw new Error(`ToolRun ${id} has no input to execute with.`);
|
|
15037
15045
|
}
|
|
15038
|
-
const { findToolExecutor: findToolExecutor2 } = await import("./tools-
|
|
15046
|
+
const { findToolExecutor: findToolExecutor2 } = await import("./tools-VSECJ5T7.js");
|
|
15039
15047
|
const { executor } = findToolExecutor2(run.toolName);
|
|
15040
15048
|
toolRunStarted({
|
|
15041
15049
|
id: run.id,
|
|
@@ -17542,7 +17550,7 @@ async function updateDocFunc(args, thunkApi) {
|
|
|
17542
17550
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
17543
17551
|
};
|
|
17544
17552
|
await dispatch(write({ data: updatedPageData, customKey: id })).unwrap();
|
|
17545
|
-
const { getDocState, applyExternalDocUpdate } = await import("./docStore-
|
|
17553
|
+
const { getDocState, applyExternalDocUpdate } = await import("./docStore-OD3NRNBN.js");
|
|
17546
17554
|
if (getDocState().pageKey === id) {
|
|
17547
17555
|
applyExternalDocUpdate({
|
|
17548
17556
|
slateData: finalSlateData,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
isAgentRunTerminalStatus
|
|
3
|
-
|
|
2
|
+
isAgentRunTerminalStatus,
|
|
3
|
+
normalizeRunTitle
|
|
4
|
+
} from "./chunk-L4KXQ6QP.js";
|
|
4
5
|
import {
|
|
5
6
|
isCompiledBinary,
|
|
6
7
|
resolveCliEntrypointPath
|
|
@@ -836,10 +837,12 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
|
|
|
836
837
|
}
|
|
837
838
|
} catch {
|
|
838
839
|
}
|
|
840
|
+
const title = normalizeRunTitle(input.title);
|
|
839
841
|
const record = {
|
|
840
842
|
runId,
|
|
841
843
|
agentKey: input.agentKey,
|
|
842
844
|
...typeof input.agentName === "string" && input.agentName.trim() ? { agentName: input.agentName.trim() } : {},
|
|
845
|
+
...title ? { title } : {},
|
|
843
846
|
cwd: input.cwd,
|
|
844
847
|
...messagePath ? { msgFile: messagePath } : input.msgFile ? { msgFile: input.msgFile } : {},
|
|
845
848
|
startedAt: now().toISOString(),
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
refreshAntigravityOAuthToken,
|
|
5
5
|
refreshOpenAiCodexToken,
|
|
6
6
|
xaiRefresh
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-W5UYXCQE.js";
|
|
8
8
|
import {
|
|
9
9
|
createChromeConnectorClient,
|
|
10
10
|
createVerifiedChromeConnectorClient,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
terminateRunProcess,
|
|
47
47
|
transitionRunToTerminal,
|
|
48
48
|
withQueueLock
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-QFPJEU36.js";
|
|
50
50
|
import {
|
|
51
51
|
getDefaultCliLocalRuntimeDb
|
|
52
52
|
} from "./chunk-ZOVKKMF6.js";
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
import {
|
|
64
64
|
inlineImageUrlsForCustomProvider,
|
|
65
65
|
prepareTools
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-SUFNELDG.js";
|
|
67
67
|
import {
|
|
68
68
|
getServerProviderSecret
|
|
69
69
|
} from "./chunk-HS7MLR74.js";
|
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
rememberMemoryFunctionSchema,
|
|
83
83
|
resolveAgentRequiredPackIds,
|
|
84
84
|
setTodoListFunc
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-MPRDXX4T.js";
|
|
86
86
|
import {
|
|
87
87
|
deriveCredentialGroup,
|
|
88
88
|
deriveCustomProviderCredentialGroup
|
|
@@ -100,23 +100,24 @@ import {
|
|
|
100
100
|
formatStopRunCard,
|
|
101
101
|
isAgentNameFallback,
|
|
102
102
|
isAgentRunTerminalStatus,
|
|
103
|
+
normalizeRunTitle,
|
|
103
104
|
resolveRunLabel,
|
|
104
105
|
shortRunId
|
|
105
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-L4KXQ6QP.js";
|
|
106
107
|
import {
|
|
107
108
|
applyBuiltinAgentRuntimeOverride,
|
|
108
109
|
applyTokenUsageToDayStats,
|
|
109
110
|
prepareTokenUsageData,
|
|
110
111
|
resolveBuiltinPlatformAgentConfig,
|
|
111
112
|
runKeyed
|
|
112
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-TS5BDIPV.js";
|
|
113
114
|
import {
|
|
114
115
|
BUILTIN_DIALOG_LLM_CHAT_FALLBACK_MODEL,
|
|
115
116
|
BUILTIN_TITLE_LLM_CONFIG
|
|
116
117
|
} from "./chunk-MC4XLIJ7.js";
|
|
117
118
|
import {
|
|
118
119
|
fetchServerSyncedCredential
|
|
119
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-TV5ODOAF.js";
|
|
120
121
|
import {
|
|
121
122
|
require_date_fns
|
|
122
123
|
} from "./chunk-M76ECQRD.js";
|
|
@@ -468,10 +469,6 @@ var STRINGS = {
|
|
|
468
469
|
en: "Esc to stop",
|
|
469
470
|
zh: "Esc \u505C\u6B62\u56DE\u590D"
|
|
470
471
|
},
|
|
471
|
-
queuedHint: {
|
|
472
|
-
en: "queued",
|
|
473
|
-
zh: "\u6392\u961F"
|
|
474
|
-
},
|
|
475
472
|
flushQueuedIdleHint: {
|
|
476
473
|
en: "Flushed {0} queued messages as one.",
|
|
477
474
|
zh: "\u5DF2\u628A {0} \u6761\u6392\u961F\u6D88\u606F\u5408\u5E76\u53D1\u9001\u3002"
|
|
@@ -11269,6 +11266,7 @@ function buildSnapshot(parsed, event) {
|
|
|
11269
11266
|
});
|
|
11270
11267
|
const logLines = readLogLines(parsed);
|
|
11271
11268
|
const taskPreview = readString(parsed.taskPreview);
|
|
11269
|
+
const title = normalizeRunTitle(parsed.title);
|
|
11272
11270
|
const lastToolNames = readToolNames(parsed.lastToolNames);
|
|
11273
11271
|
const lastAssistantText = readString(parsed.lastAssistantText);
|
|
11274
11272
|
const errorMessage = readString(parsed.errorMessage);
|
|
@@ -11281,6 +11279,7 @@ function buildSnapshot(parsed, event) {
|
|
|
11281
11279
|
// site: an unnamed run should render no name row, not the word "agent".
|
|
11282
11280
|
...isAgentNameFallback(label) ? {} : { agentName: label },
|
|
11283
11281
|
...taskPreview ? { taskPreview } : {},
|
|
11282
|
+
...title ? { title } : {},
|
|
11284
11283
|
...typeof parsed.toolCallCount === "number" && Number.isFinite(parsed.toolCallCount) ? { toolCallCount: parsed.toolCallCount } : {},
|
|
11285
11284
|
...lastToolNames ? { lastToolNames } : {},
|
|
11286
11285
|
...lastAssistantText ? { lastAssistantText } : {},
|
|
@@ -11749,9 +11748,11 @@ function createCliStartAgentRunExecutor(deps = {}) {
|
|
|
11749
11748
|
...batchId ? { batchId } : {},
|
|
11750
11749
|
...parentDialogId ? { parentDialogId } : {},
|
|
11751
11750
|
...typeof args.credentialGroup === "string" && args.credentialGroup.trim() ? { credentialGroup: args.credentialGroup.trim() } : {},
|
|
11752
|
-
allowUnknownCredential: args.allowUnknownCredential === true
|
|
11751
|
+
allowUnknownCredential: args.allowUnknownCredential === true,
|
|
11752
|
+
allowCredentialConcurrency: args.allowCredentialConcurrency === true
|
|
11753
11753
|
});
|
|
11754
11754
|
const dodCommands = Array.isArray(args.dodCommands) ? args.dodCommands.filter((c) => typeof c === "string" && c.trim().length > 0).map((c) => c.trim()) : typeof args.dod === "string" && args.dod.trim().length > 0 ? [args.dod.trim()] : Array.isArray(args.dod) ? args.dod.filter((c) => typeof c === "string" && c.trim().length > 0).map((c) => c.trim()) : void 0;
|
|
11755
|
+
const runTitle = normalizeRunTitle(args.title);
|
|
11755
11756
|
const { runId, batchId: resolvedBatchId } = await spawnLocalBackgroundRun(
|
|
11756
11757
|
{
|
|
11757
11758
|
rawArgs,
|
|
@@ -11759,6 +11760,7 @@ function createCliStartAgentRunExecutor(deps = {}) {
|
|
|
11759
11760
|
cliEntrypointPath: deps.cliEntrypoint,
|
|
11760
11761
|
agentKey,
|
|
11761
11762
|
...agentName ? { agentName } : {},
|
|
11763
|
+
...runTitle ? { title: runTitle } : {},
|
|
11762
11764
|
...batchId ? { batchId } : {},
|
|
11763
11765
|
...credentialGroup ? { credentialGroup } : {},
|
|
11764
11766
|
...parentDialogId ? { parentDialogId } : {},
|
|
@@ -11807,6 +11809,7 @@ function createCliStartAgentRunExecutor(deps = {}) {
|
|
|
11807
11809
|
batchId: resolvedBatchId,
|
|
11808
11810
|
...agentName ? { agentName } : {},
|
|
11809
11811
|
...taskPreview ? { taskPreview } : {},
|
|
11812
|
+
...runTitle ? { title: runTitle } : {},
|
|
11810
11813
|
payloadMetrics
|
|
11811
11814
|
}),
|
|
11812
11815
|
metadata: {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./chunk-6O4IK4V2.js";
|
|
12
12
|
import {
|
|
13
13
|
runLlm
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-TV5ODOAF.js";
|
|
15
15
|
import {
|
|
16
16
|
cleanupCliSessionForDialog
|
|
17
17
|
} from "./chunk-D76D3RTR.js";
|
|
@@ -23937,7 +23937,7 @@ var messageSlice = createSliceWithThunks({
|
|
|
23937
23937
|
runtimeOptions: args.runtimeOptions
|
|
23938
23938
|
});
|
|
23939
23939
|
if (agentKeyToUse) {
|
|
23940
|
-
const { streamAgentChatTurn } = await import("./agentSlice-
|
|
23940
|
+
const { streamAgentChatTurn } = await import("./agentSlice-EYRJX2J6.js");
|
|
23941
23941
|
await dispatch(
|
|
23942
23942
|
streamAgentChatTurn({
|
|
23943
23943
|
agentKey: agentKeyToUse,
|
|
@@ -25073,7 +25073,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
|
|
|
25073
25073
|
}
|
|
25074
25074
|
if (isCurrentDialog) {
|
|
25075
25075
|
await thunkApi.dispatch(resetMsgs());
|
|
25076
|
-
const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-
|
|
25076
|
+
const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-7IGCUDZE.js");
|
|
25077
25077
|
dispatch(clearPendingAttachments2());
|
|
25078
25078
|
}
|
|
25079
25079
|
return { dialogKey, isCurrentDialog, attachmentPlan };
|
|
@@ -25081,15 +25081,15 @@ var deleteDialogThunk = async (payload, thunkApi) => {
|
|
|
25081
25081
|
|
|
25082
25082
|
// packages/chat/dialog/dialogSlice.ts
|
|
25083
25083
|
var runCreateDialogAction = async (args, thunkApi) => {
|
|
25084
|
-
const { createDialogAction } = await import("./createDialogAction-
|
|
25084
|
+
const { createDialogAction } = await import("./createDialogAction-2BMDM4X3.js");
|
|
25085
25085
|
return createDialogAction(args, thunkApi);
|
|
25086
25086
|
};
|
|
25087
25087
|
var runCreateAgentAutomationAction = async (args, thunkApi) => {
|
|
25088
|
-
const { createAgentAutomationAction } = await import("./createAgentAutomationAction-
|
|
25088
|
+
const { createAgentAutomationAction } = await import("./createAgentAutomationAction-SWO62RE2.js");
|
|
25089
25089
|
return createAgentAutomationAction(args, thunkApi);
|
|
25090
25090
|
};
|
|
25091
25091
|
var runUpdateDialogTitleAction = async (args, thunkApi) => {
|
|
25092
|
-
const { updateDialogTitleAction } = await import("./updateDialogTitleAction-
|
|
25092
|
+
const { updateDialogTitleAction } = await import("./updateDialogTitleAction-WE5KY3SM.js");
|
|
25093
25093
|
return updateDialogTitleAction(args, thunkApi);
|
|
25094
25094
|
};
|
|
25095
25095
|
var runAddDialogAgentAction = async (args, thunkApi) => {
|
|
@@ -25113,7 +25113,7 @@ var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
|
|
|
25113
25113
|
return setDialogExtraReferencesAction(args, thunkApi);
|
|
25114
25114
|
};
|
|
25115
25115
|
var runHandleSendMessageAction = async (args, thunkApi) => {
|
|
25116
|
-
const { handleSendMessageAction } = await import("./handleSendMessageAction-
|
|
25116
|
+
const { handleSendMessageAction } = await import("./handleSendMessageAction-PRF7JNOH.js");
|
|
25117
25117
|
return handleSendMessageAction(args, thunkApi);
|
|
25118
25118
|
};
|
|
25119
25119
|
function clearDialogState() {
|
|
@@ -25126,7 +25126,7 @@ var createPageAndAddReference = createAsyncThunk(
|
|
|
25126
25126
|
async (payload, { dispatch, getState, rejectWithValue }) => {
|
|
25127
25127
|
const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
|
|
25128
25128
|
try {
|
|
25129
|
-
const { createDocState } = await import("./docStore-
|
|
25129
|
+
const { createDocState } = await import("./docStore-OD3NRNBN.js");
|
|
25130
25130
|
const pageKey = await createDocState(
|
|
25131
25131
|
{ slateData, title },
|
|
25132
25132
|
{ dispatch, getState }
|
|
@@ -326,7 +326,7 @@ async function saveDocState(arg, { dispatch, getState }) {
|
|
|
326
326
|
).unwrap();
|
|
327
327
|
if (dbSpaceId) {
|
|
328
328
|
try {
|
|
329
|
-
const { updateContentTitle } = await import("./contentThunks-
|
|
329
|
+
const { updateContentTitle } = await import("./contentThunks-2PJ4QDAV.js");
|
|
330
330
|
await dispatch(
|
|
331
331
|
updateContentTitle({
|
|
332
332
|
spaceId: dbSpaceId,
|
|
@@ -365,7 +365,7 @@ async function saveDocState(arg, { dispatch, getState }) {
|
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
367
|
async function createDocState(args, thunkApi) {
|
|
368
|
-
const { createPageAction } = await import("./createPageAction-
|
|
368
|
+
const { createPageAction } = await import("./createPageAction-HLSLX4R4.js");
|
|
369
369
|
return createPageAction(args, thunkApi);
|
|
370
370
|
}
|
|
371
371
|
function subscribe(listener) {
|
|
@@ -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-PHFKA2OL.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-66UNGCTW.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-6F3M4KUY.js");
|
|
345
345
|
return streamAgentChatTurnHandler(args, thunkApi);
|
|
346
346
|
}),
|
|
347
347
|
/**
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveAuthToken,
|
|
3
|
+
resolveServerUrl
|
|
4
|
+
} from "./chunk-A7GB5UGH.js";
|
|
5
|
+
|
|
6
|
+
// packages/cli/subscriptionQuotaRefresh.ts
|
|
7
|
+
var CATALOG_QUOTA_REFRESH_TIMEOUT_MS = 2e3;
|
|
8
|
+
var CATALOG_QUOTA_STALE_MS = 6e4;
|
|
9
|
+
var EMPTY_REFRESH_BACKOFF_MS = 5 * 6e4;
|
|
10
|
+
var lastRefreshEmptyAt = 0;
|
|
11
|
+
function quotaIsFresh(entry, now) {
|
|
12
|
+
const observedAt = entry.quota?.observedAt;
|
|
13
|
+
return typeof observedAt === "number" && Number.isFinite(observedAt) && now - observedAt < CATALOG_QUOTA_STALE_MS;
|
|
14
|
+
}
|
|
15
|
+
async function refreshSubscriptionQuotas(args) {
|
|
16
|
+
const fresh = {};
|
|
17
|
+
try {
|
|
18
|
+
const now = Date.now();
|
|
19
|
+
const needsRefresh = args.entries.some(
|
|
20
|
+
(entry) => entry.probeable !== false && (!args.onlyKeys || args.onlyKeys.includes(entry.key)) && !quotaIsFresh(entry, now)
|
|
21
|
+
);
|
|
22
|
+
if (!needsRefresh) return fresh;
|
|
23
|
+
const wholeBatch = !args.onlyKeys || args.onlyKeys.length === 0;
|
|
24
|
+
if (wholeBatch && lastRefreshEmptyAt && now - lastRefreshEmptyAt < EMPTY_REFRESH_BACKOFF_MS) {
|
|
25
|
+
return fresh;
|
|
26
|
+
}
|
|
27
|
+
const env = args.env ?? process.env;
|
|
28
|
+
const authToken = resolveAuthToken(args.cliArgs ?? [], env);
|
|
29
|
+
if (!authToken) return fresh;
|
|
30
|
+
const fetchImpl = args.fetchImpl ?? fetch;
|
|
31
|
+
const refreshPromise = (async () => {
|
|
32
|
+
const res = await fetchImpl(
|
|
33
|
+
`${resolveServerUrl(args.cliArgs ?? [], env)}/api/agents/quota/refresh`,
|
|
34
|
+
{
|
|
35
|
+
method: "POST",
|
|
36
|
+
headers: {
|
|
37
|
+
"Content-Type": "application/json",
|
|
38
|
+
Authorization: `Bearer ${authToken}`
|
|
39
|
+
},
|
|
40
|
+
body: JSON.stringify(
|
|
41
|
+
args.onlyKeys && args.onlyKeys.length > 0 ? { agentKeys: args.onlyKeys } : {}
|
|
42
|
+
),
|
|
43
|
+
signal: AbortSignal.timeout(CATALOG_QUOTA_REFRESH_TIMEOUT_MS)
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
if (!res.ok) return;
|
|
47
|
+
const payload = await res.json().catch(() => null);
|
|
48
|
+
const quotas = payload?.quotas;
|
|
49
|
+
if (!quotas || typeof quotas !== "object") return;
|
|
50
|
+
const probed = typeof payload?.probed === "number" ? payload.probed : 0;
|
|
51
|
+
if (probed === 0 && Object.keys(quotas).length === 0) {
|
|
52
|
+
if (wholeBatch) lastRefreshEmptyAt = Date.now();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (wholeBatch) lastRefreshEmptyAt = 0;
|
|
56
|
+
for (const entry of args.entries) {
|
|
57
|
+
const quota = quotas[entry.key];
|
|
58
|
+
if (quota && Array.isArray(quota.windows)) {
|
|
59
|
+
fresh[entry.key] = quota;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
})();
|
|
63
|
+
let timer;
|
|
64
|
+
await Promise.race([
|
|
65
|
+
refreshPromise,
|
|
66
|
+
new Promise((resolve) => {
|
|
67
|
+
timer = setTimeout(resolve, CATALOG_QUOTA_REFRESH_TIMEOUT_MS);
|
|
68
|
+
})
|
|
69
|
+
]).catch(() => {
|
|
70
|
+
});
|
|
71
|
+
if (timer) clearTimeout(timer);
|
|
72
|
+
refreshPromise.catch(() => {
|
|
73
|
+
});
|
|
74
|
+
} catch {
|
|
75
|
+
}
|
|
76
|
+
return fresh;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export {
|
|
80
|
+
refreshSubscriptionQuotas
|
|
81
|
+
};
|
|
@@ -367,6 +367,77 @@ async function refreshAntigravityOAuthToken(credential, deps = {}) {
|
|
|
367
367
|
// packages/cli/oauth/flows/openai-codex.ts
|
|
368
368
|
import { createHash as createHash2 } from "node:crypto";
|
|
369
369
|
|
|
370
|
+
// packages/agent-runtime/oauthRefreshError.ts
|
|
371
|
+
var PERMANENT_REFRESH_CODES = /* @__PURE__ */ new Set([
|
|
372
|
+
"invalid_grant",
|
|
373
|
+
// OpenAI 令牌端点对失效/不存在的 refresh token 返回 401
|
|
374
|
+
// {"error":{"code":"invalid_refresh_token",...}}(2026-10-01 用必然无效的
|
|
375
|
+
// token 实测)。线上 chatgpt 凭据正是因为没认出它,被当成临时的
|
|
376
|
+
// "unauthorized"、每 15 分钟重试一次且永远不提示重新授权。
|
|
377
|
+
"invalid_refresh_token",
|
|
378
|
+
"refresh_token_reused",
|
|
379
|
+
"invalid_client"
|
|
380
|
+
]);
|
|
381
|
+
var SAFE_MESSAGES = {
|
|
382
|
+
invalid_grant: "refresh token \u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0\u6388\u6743",
|
|
383
|
+
invalid_refresh_token: "refresh token \u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0\u6388\u6743",
|
|
384
|
+
refresh_token_reused: "refresh token \u5DF2\u88AB\u5176\u4ED6\u526F\u672C\u4F7F\u7528\uFF0C\u8BF7\u91CD\u65B0\u6388\u6743",
|
|
385
|
+
invalid_client: "OAuth \u5BA2\u6237\u7AEF\u88AB\u62D2\u7EDD\uFF0C\u8BF7\u91CD\u65B0\u6388\u6743",
|
|
386
|
+
unauthorized: "\u4E0A\u6E38\u62D2\u7EDD\u4E86\u5237\u65B0\u8BF7\u6C42\uFF08401/403\uFF09",
|
|
387
|
+
rate_limited: "\u4E0A\u6E38\u9650\u6D41\uFF0C\u7A0D\u540E\u91CD\u8BD5",
|
|
388
|
+
http_5xx: "\u4E0A\u6E38\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528",
|
|
389
|
+
network: "\u65E0\u6CD5\u8FDE\u63A5\u4E0A\u6E38",
|
|
390
|
+
bad_response: "\u4E0A\u6E38\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94",
|
|
391
|
+
unknown: "\u5237\u65B0\u5931\u8D25"
|
|
392
|
+
};
|
|
393
|
+
var OAuthRefreshError = class extends Error {
|
|
394
|
+
code;
|
|
395
|
+
status;
|
|
396
|
+
retryAfterMs;
|
|
397
|
+
constructor(code, opts = {}) {
|
|
398
|
+
super(SAFE_MESSAGES[code]);
|
|
399
|
+
this.name = "OAuthRefreshError";
|
|
400
|
+
this.code = code;
|
|
401
|
+
if (opts.status !== void 0) this.status = opts.status;
|
|
402
|
+
if (opts.retryAfterMs !== void 0) this.retryAfterMs = opts.retryAfterMs;
|
|
403
|
+
}
|
|
404
|
+
get permanent() {
|
|
405
|
+
return PERMANENT_REFRESH_CODES.has(this.code);
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
function readErrorCode(payload) {
|
|
409
|
+
if (!payload || typeof payload !== "object") return void 0;
|
|
410
|
+
const err = payload.error;
|
|
411
|
+
if (typeof err === "string") return err;
|
|
412
|
+
if (err && typeof err === "object") {
|
|
413
|
+
const code = err.code;
|
|
414
|
+
if (typeof code === "string") return code;
|
|
415
|
+
}
|
|
416
|
+
return void 0;
|
|
417
|
+
}
|
|
418
|
+
function classifyOAuthRefreshHttpFailure(status, payload, headers) {
|
|
419
|
+
const raw = readErrorCode(payload)?.toLowerCase();
|
|
420
|
+
if (raw === "invalid_grant") return new OAuthRefreshError("invalid_grant", { status });
|
|
421
|
+
if (raw === "invalid_refresh_token") {
|
|
422
|
+
return new OAuthRefreshError("invalid_refresh_token", { status });
|
|
423
|
+
}
|
|
424
|
+
if (raw === "refresh_token_reused") {
|
|
425
|
+
return new OAuthRefreshError("refresh_token_reused", { status });
|
|
426
|
+
}
|
|
427
|
+
if (raw === "invalid_client") return new OAuthRefreshError("invalid_client", { status });
|
|
428
|
+
if (status === 429) {
|
|
429
|
+
const seconds = Number(headers?.get("retry-after"));
|
|
430
|
+
return new OAuthRefreshError("rate_limited", {
|
|
431
|
+
status,
|
|
432
|
+
...Number.isFinite(seconds) && seconds > 0 ? { retryAfterMs: seconds * 1e3 } : {}
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
if (status === 401 || status === 403) return new OAuthRefreshError("unauthorized", { status });
|
|
436
|
+
if (status >= 500) return new OAuthRefreshError("http_5xx", { status });
|
|
437
|
+
return new OAuthRefreshError("unknown", { status });
|
|
438
|
+
}
|
|
439
|
+
var TRANSIENT_MAX_MS = 15 * 6e4;
|
|
440
|
+
|
|
370
441
|
// packages/agent-runtime/openaiCodexOAuth.ts
|
|
371
442
|
var OPENAI_CODEX_CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann";
|
|
372
443
|
var OPENAI_CODEX_SCOPES = [
|
|
@@ -463,17 +534,14 @@ async function refreshOpenAiCodexToken(credential, deps = {}) {
|
|
|
463
534
|
signal: AbortSignal.timeout(OPENAI_CODEX_TOKEN_REQUEST_TIMEOUT_MS)
|
|
464
535
|
});
|
|
465
536
|
} catch (error) {
|
|
466
|
-
throw new
|
|
467
|
-
`OpenAI Codex token refresh failed: ${toErrorMessage(error)}`
|
|
468
|
-
);
|
|
537
|
+
throw new OAuthRefreshError("network");
|
|
469
538
|
}
|
|
470
539
|
const payload = await response.json().catch(() => ({}));
|
|
471
540
|
if (!response.ok) {
|
|
472
|
-
|
|
473
|
-
throw new Error(`OpenAI Codex token refresh failed: ${detail}`);
|
|
541
|
+
throw classifyOAuthRefreshHttpFailure(response.status, payload, response.headers);
|
|
474
542
|
}
|
|
475
543
|
if (typeof payload.access_token !== "string" || !payload.access_token.trim()) {
|
|
476
|
-
throw new
|
|
544
|
+
throw new OAuthRefreshError("bad_response");
|
|
477
545
|
}
|
|
478
546
|
const now = deps.now?.() ?? Date.now();
|
|
479
547
|
return normalizeOpenAiCodexTokenPayload({
|
|
@@ -1047,11 +1115,10 @@ async function refreshAnthropicToken(credential, deps = {}) {
|
|
|
1047
1115
|
});
|
|
1048
1116
|
const payload = await response.json().catch(() => ({}));
|
|
1049
1117
|
if (!response.ok) {
|
|
1050
|
-
|
|
1051
|
-
throw new Error(`Claude token refresh failed: ${detail}`);
|
|
1118
|
+
throw classifyOAuthRefreshHttpFailure(response.status, payload, response.headers);
|
|
1052
1119
|
}
|
|
1053
1120
|
if (typeof payload.access_token !== "string" || !payload.access_token.trim()) {
|
|
1054
|
-
throw new
|
|
1121
|
+
throw new OAuthRefreshError("bad_response");
|
|
1055
1122
|
}
|
|
1056
1123
|
const now = deps.now?.() ?? Date.now();
|
|
1057
1124
|
return normalizeAnthropicTokenPayload({
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
refreshSubscriptionQuotas
|
|
3
|
+
} from "./chunk-U4STABYN.js";
|
|
1
4
|
import {
|
|
2
5
|
clearCliLocalRuntimePreparedAgentCache
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SFRMB7XN.js";
|
|
4
7
|
import {
|
|
5
8
|
getReadableCliDb
|
|
6
9
|
} from "./chunk-CTUQJVQM.js";
|
|
@@ -67,8 +70,20 @@ async function runAgentReadCommand(args, deps = {}) {
|
|
|
67
70
|
if (!result) {
|
|
68
71
|
throw new Error(`agent not found: ${agentKey}`);
|
|
69
72
|
}
|
|
73
|
+
const rawRecord = result.record;
|
|
74
|
+
const recordQuota = rawRecord?.quota;
|
|
75
|
+
const hasSubscriptionCredential = typeof rawRecord?.apiKeyRef === "string" && rawRecord.apiKeyRef.trim() !== "";
|
|
76
|
+
const fresh = hasSubscriptionCredential ? await refreshSubscriptionQuotas({
|
|
77
|
+
entries: [{ key: result.agentKey, ...recordQuota ? { quota: recordQuota } : {} }],
|
|
78
|
+
onlyKeys: [result.agentKey],
|
|
79
|
+
env,
|
|
80
|
+
cliArgs: args,
|
|
81
|
+
fetchImpl
|
|
82
|
+
}) : {};
|
|
83
|
+
const quota = fresh[result.agentKey] ?? recordQuota;
|
|
70
84
|
output.write(JSON.stringify({
|
|
71
85
|
...normalizeAgentRecordForOutput(result.agentKey, authToken, result.record),
|
|
86
|
+
...quota ? { quota } : {},
|
|
72
87
|
source: result.source
|
|
73
88
|
}, null, 2));
|
|
74
89
|
output.write("\n");
|