nolo-cli 0.151.0-alpha.3 → 0.152.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{_executeModel-T7ANHTUW.js → _executeModel-4KHFMQT4.js} +15 -15
- package/{agentDeleteCommand-4L5KCKFY.js → agentDeleteCommand-EKFV5FC7.js} +15 -15
- package/{agentEmailCommands-2IMMIRO2.js → agentEmailCommands-MNV3MUH5.js} +17 -17
- package/{agentListCommands-TWFLUYIZ.js → agentListCommands-E6FYKXC3.js} +6 -6
- package/{agentMachineCommands-KIWXWT6L.js → agentMachineCommands-2GFUU7GF.js} +7 -7
- package/{agentRecordCommands-727NPCRW.js → agentRecordCommands-LPHHTEPM.js} +16 -16
- package/{agentRunCommand-JASIG3FZ.js → agentRunCommand-JSPW7W32.js} +17 -17
- package/{agentRuntimeLocal-KKSQJMTE.js → agentRuntimeLocal-ARS4TV77.js} +6 -6
- package/{agentSlice-SLV57QGU.js → agentSlice-IP4DZNNV.js} +1 -1
- package/{appDeleteCommands-4PL4KYRN.js → appDeleteCommands-JHTLKQSX.js} +6 -6
- package/{appDeployCommands-EEEXCEB6.js → appDeployCommands-5V26M2KA.js} +6 -6
- package/{appDeployStatusCommands-35ZX7T66.js → appDeployStatusCommands-SBSPS627.js} +6 -6
- package/{appGetCommands-WFCHXJWF.js → appGetCommands-NKPD2L45.js} +6 -6
- package/{appListCommands-XY2U6DPF.js → appListCommands-ZOGRZFYY.js} +6 -6
- package/{chunk-BPMPOFWP.js → chunk-4PXHOOFA.js} +784 -3
- package/{chunk-PKZKOVA5.js → chunk-64PFYIAY.js} +19 -13
- package/{chunk-BJEZC5RA.js → chunk-6LIKQYG4.js} +3 -3
- package/{chunk-CYJWI3NH.js → chunk-AHYBQP3M.js} +3 -3
- package/{chunk-AUIJZACN.js → chunk-BNDETALN.js} +76 -38
- package/{chunk-6CCFTVBP.js → chunk-DTODXBHK.js} +103 -1
- package/{chunk-LGN377P3.js → chunk-DYYMIUN4.js} +2 -2
- package/{chunk-ROCUB2H2.js → chunk-EHFS4XZO.js} +2 -2
- package/{chunk-3SZA4U64.js → chunk-HL3O3PCQ.js} +1 -1
- package/{chunk-UOKFKFPO.js → chunk-HSJPKBLC.js} +1 -1
- package/{chunk-TTH4HOJD.js → chunk-I5V3V2H4.js} +13 -11
- package/{chunk-I2XLRXVX.js → chunk-JWTSWUPS.js} +3 -3
- package/{chunk-626KHJNX.js → chunk-KMM2X7LP.js} +2 -2
- package/{chunk-DFDXM2Y4.js → chunk-LC23WBCU.js} +3 -3
- package/{chunk-V4EE3D54.js → chunk-MZHOLWW5.js} +2 -2
- package/{chunk-AJ3G7X2K.js → chunk-OFVFQYIE.js} +1 -1
- package/{chunk-U5ICMAFV.js → chunk-PFBIXTFB.js} +24 -105
- package/{chunk-U5GPBQDG.js → chunk-PMYAE4OZ.js} +1 -1
- package/{chunk-3T4ZG6AC.js → chunk-PPU323UE.js} +27 -22
- package/{chunk-IK2TSJQA.js → chunk-RQ6E3G5L.js} +1 -1
- package/{chunk-RN2GPWN6.js → chunk-T5BHHWA5.js} +2 -2
- package/{chunk-PIDUNDFS.js → chunk-VNP54NZL.js} +9 -7
- package/{chunk-AG7MCDLR.js → chunk-XCA6HQGS.js} +2 -2
- package/{chunk-VWW6O2TL.js → chunk-XTWDF6RU.js} +10 -10
- package/{commandRegistry-NBLZEMCW.js → commandRegistry-VBALU4Q4.js} +40 -40
- package/{contentThunks-6AIWNSGO.js → contentThunks-HPY2QNWZ.js} +5 -5
- package/{createAgentAutomationAction-4BUS65DZ.js → createAgentAutomationAction-6ADGPGY6.js} +5 -5
- package/{createDialogAction-QAIKSCG4.js → createDialogAction-6ABMSEW2.js} +6 -6
- package/{createPageAction-DXCZ334C.js → createPageAction-OC4NNRPC.js} +5 -5
- package/{dialogCommands-YZLSJB6X.js → dialogCommands-EIGBRSQP.js} +6 -6
- package/{dialogSlice-PVUSMKFW.js → dialogSlice-SI45KJOH.js} +4 -4
- package/{docCreateCommands-JB2RRMRJ.js → docCreateCommands-3JDBBMU5.js} +6 -6
- package/{docDeleteCommands-AQENULNM.js → docDeleteCommands-5M6C7UUB.js} +6 -6
- package/{docReadCommands-DYD25YLQ.js → docReadCommands-DUB57F6V.js} +6 -6
- package/{docStore-CSEBEMKP.js → docStore-L43MDEK4.js} +1 -1
- package/{docUpdateCommands-3GVS23QL.js → docUpdateCommands-WF7MAMPK.js} +6 -6
- package/{handleSendMessageAction-G2TLYGC4.js → handleSendMessageAction-BSMU7SVS.js} +9 -9
- package/index.js +4 -4
- package/{localRuntimeAdapter-B4TAYYA7.js → localRuntimeAdapter-N5PDR26F.js} +15 -15
- package/{machineCommands-6OBFD3XF.js → machineCommands-TMXJKZCE.js} +16 -16
- package/{machineWsRunDispatch-OO7N3O3Y.js → machineWsRunDispatch-25H63KEH.js} +16 -16
- package/package.json +1 -1
- package/{readlineWorkspace-UIQN7JUR.js → readlineWorkspace-BS7WVCL2.js} +202 -57
- package/{runAgentClientLoop-GS3SGG37.js → runAgentClientLoop-BVKRI4SY.js} +13 -13
- package/{spaceCommands-ZR5BR3GX.js → spaceCommands-5EWREUWS.js} +6 -6
- package/{streamAgentChatTurn-4XYC33KE.js → streamAgentChatTurn-B4VFUV52.js} +16 -16
- package/{tools-P77EE7Q4.js → tools-5WYAUKMK.js} +9 -9
- package/{tuiSummaryLlmCaller-BM3VSTBU.js → tuiSummaryLlmCaller-PPU7YDBG.js} +45 -23
- package/{updateDialogTitleAction-CIANVPZC.js → updateDialogTitleAction-YJHDKHFX.js} +5 -5
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
import {
|
|
63
63
|
inlineImageUrlsForCustomProvider,
|
|
64
64
|
prepareTools
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-MZHOLWW5.js";
|
|
66
66
|
import {
|
|
67
67
|
getServerProviderSecret
|
|
68
68
|
} from "./chunk-HS7MLR74.js";
|
|
@@ -84,7 +84,7 @@ import {
|
|
|
84
84
|
resolveCliLocalRuntimeKeyCapability,
|
|
85
85
|
resolveCliLocalSpawnDispatch,
|
|
86
86
|
resolveStartAgentRunCwd
|
|
87
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-PPU323UE.js";
|
|
88
88
|
import {
|
|
89
89
|
deriveCredentialGroup,
|
|
90
90
|
deriveCustomProviderCredentialGroup
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
} from "./chunk-I2ZMGXXF.js";
|
|
96
96
|
import {
|
|
97
97
|
resolveAgentRequiredPackIds
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-EHFS4XZO.js";
|
|
99
99
|
import {
|
|
100
100
|
applyBuiltinAgentRuntimeOverride,
|
|
101
101
|
applyTokenUsageToDayStats,
|
|
@@ -104,7 +104,7 @@ import {
|
|
|
104
104
|
resolveBuiltinPlatformAgentConfig,
|
|
105
105
|
runKeyed,
|
|
106
106
|
validateAskChoiceInput
|
|
107
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-PFBIXTFB.js";
|
|
108
108
|
import {
|
|
109
109
|
BUILTIN_DIALOG_LLM_CHAT_FALLBACK_MODEL,
|
|
110
110
|
BUILTIN_TITLE_LLM_CONFIG
|
|
@@ -114,7 +114,7 @@ import {
|
|
|
114
114
|
} from "./chunk-UKZX3NHN.js";
|
|
115
115
|
import {
|
|
116
116
|
fetchServerSyncedCredential
|
|
117
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-LC23WBCU.js";
|
|
118
118
|
import {
|
|
119
119
|
isTombstoneRecord
|
|
120
120
|
} from "./chunk-D2MDMY2M.js";
|
|
@@ -171,7 +171,7 @@ import {
|
|
|
171
171
|
runExecShellGates,
|
|
172
172
|
validateConfiguredRootExecutionLease,
|
|
173
173
|
verifyOwnerRouteAck
|
|
174
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-BNDETALN.js";
|
|
175
175
|
import {
|
|
176
176
|
accumulateGeminiChunks,
|
|
177
177
|
buildGeminiGenerateContentRequest,
|
|
@@ -194,14 +194,14 @@ import {
|
|
|
194
194
|
readPlatformChatSseCompletion,
|
|
195
195
|
resolvePlatformChatProviderConfig,
|
|
196
196
|
shouldUsePlatformChatProvider
|
|
197
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-DYYMIUN4.js";
|
|
198
198
|
import {
|
|
199
199
|
readSseDataValues,
|
|
200
200
|
readSseFrames
|
|
201
201
|
} from "./chunk-HNUWUO75.js";
|
|
202
202
|
import {
|
|
203
203
|
resolveAgentRuntimeConfigFromRecord
|
|
204
|
-
} from "./chunk-
|
|
204
|
+
} from "./chunk-HSJPKBLC.js";
|
|
205
205
|
import {
|
|
206
206
|
isDevinOAuthAgent
|
|
207
207
|
} from "./chunk-5ZUL4CUO.js";
|
|
@@ -214,7 +214,7 @@ import {
|
|
|
214
214
|
findAgentStatePairingIssues,
|
|
215
215
|
stablePromptCacheKey,
|
|
216
216
|
toResponsesTools
|
|
217
|
-
} from "./chunk-
|
|
217
|
+
} from "./chunk-HL3O3PCQ.js";
|
|
218
218
|
import {
|
|
219
219
|
buildNoloWorkspaceOpenAiTools,
|
|
220
220
|
parseNoloWorkspaceToolArguments,
|
|
@@ -232,14 +232,14 @@ import {
|
|
|
232
232
|
} from "./chunk-2MBTWINN.js";
|
|
233
233
|
import {
|
|
234
234
|
normalizeUsage
|
|
235
|
-
} from "./chunk-
|
|
235
|
+
} from "./chunk-DTODXBHK.js";
|
|
236
236
|
import {
|
|
237
237
|
createProviderCallTimingTracker,
|
|
238
238
|
finalizeProviderCallTiming,
|
|
239
239
|
observeMeaningfulProviderResponse,
|
|
240
240
|
observeMeaningfulProviderResponseAt,
|
|
241
241
|
withProviderCallTimingFields
|
|
242
|
-
} from "./chunk-
|
|
242
|
+
} from "./chunk-4PXHOOFA.js";
|
|
243
243
|
import {
|
|
244
244
|
clipCompactText
|
|
245
245
|
} from "./chunk-5MMAK75Q.js";
|
|
@@ -10504,7 +10504,8 @@ async function loadCliDialogSummary(args) {
|
|
|
10504
10504
|
...typeof summarizedBeforeId === "string" && summarizedBeforeId ? { summarizedBeforeId } : {},
|
|
10505
10505
|
...typeof sourceHash === "string" && sourceHash ? { sourceHash } : {},
|
|
10506
10506
|
...typeof sourceCount === "number" && sourceCount > 0 ? { sourceCount } : {},
|
|
10507
|
-
..."schemaVersion" in record3 ? { schemaVersion } : {}
|
|
10507
|
+
..."schemaVersion" in record3 ? { schemaVersion } : {},
|
|
10508
|
+
...Array.isArray(record3.referenceKeys) ? { referenceKeys: record3.referenceKeys.filter((key) => typeof key === "string") } : {}
|
|
10508
10509
|
};
|
|
10509
10510
|
}
|
|
10510
10511
|
async function saveCliDialogSummary(args) {
|
|
@@ -10523,6 +10524,10 @@ async function saveCliDialogSummary(args) {
|
|
|
10523
10524
|
...args.sourceHash !== void 0 ? { sourceHash: args.sourceHash } : {},
|
|
10524
10525
|
...args.sourceCount !== void 0 ? { sourceCount: args.sourceCount } : {},
|
|
10525
10526
|
...args.schemaVersion !== void 0 ? { schemaVersion: args.schemaVersion } : {},
|
|
10527
|
+
referenceKeys: Array.from(/* @__PURE__ */ new Set([
|
|
10528
|
+
...Array.isArray(existing.referenceKeys) ? existing.referenceKeys.filter((key) => typeof key === "string") : [],
|
|
10529
|
+
...args.referenceKeys ?? []
|
|
10530
|
+
])),
|
|
10526
10531
|
compressionCount,
|
|
10527
10532
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
10528
10533
|
});
|
|
@@ -11005,7 +11010,8 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
11005
11010
|
summarizedBeforeId: input.summarizedBeforeId,
|
|
11006
11011
|
sourceHash: input.sourceHash,
|
|
11007
11012
|
sourceCount: input.sourceCount,
|
|
11008
|
-
schemaVersion: input.schemaVersion
|
|
11013
|
+
schemaVersion: input.schemaVersion,
|
|
11014
|
+
referenceKeys: input.referenceKeys
|
|
11009
11015
|
}),
|
|
11010
11016
|
loadLastContextUsage: async (dialogId) => {
|
|
11011
11017
|
const fromDialog = await loadCliDialogLastContextUsage({
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
} from "./chunk-HS7MLR74.js";
|
|
7
7
|
import {
|
|
8
8
|
performServerProxyFetchWithRetry
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-T5BHHWA5.js";
|
|
10
10
|
import {
|
|
11
11
|
shouldUseServerProxy
|
|
12
12
|
} from "./chunk-UKZX3NHN.js";
|
|
13
13
|
import {
|
|
14
14
|
fetchServerSyncedCredential
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-LC23WBCU.js";
|
|
16
16
|
import {
|
|
17
17
|
buildSkillGuidancePromptBlock
|
|
18
18
|
} from "./chunk-HIQ4GF53.js";
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
resolveReasoningReplayOptions,
|
|
35
35
|
shouldStripReasoningContentForOutbound,
|
|
36
36
|
stablePromptCacheKey
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-HL3O3PCQ.js";
|
|
38
38
|
import {
|
|
39
39
|
createFileCredentialBroker
|
|
40
40
|
} from "./chunk-UHTDNB5Y.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fetchReferenceContents,
|
|
3
3
|
resolveReferenceAssets
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-T5BHHWA5.js";
|
|
5
5
|
import {
|
|
6
6
|
updateTokensAction
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PFBIXTFB.js";
|
|
8
8
|
import {
|
|
9
9
|
applyUpdateTokensFulfilled
|
|
10
10
|
} from "./chunk-OWYYDMGJ.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
extractReasoningFromResponseOutput,
|
|
13
13
|
extractTextFromResponseOutput,
|
|
14
14
|
extractToolCallsFromResponseOutput
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-HL3O3PCQ.js";
|
|
16
16
|
import {
|
|
17
17
|
isRecord
|
|
18
18
|
} from "./chunk-KUG52IAP.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
flushChatCompletionStream,
|
|
12
12
|
providerHttpFailure,
|
|
13
13
|
throwIfChatCompletionStreamFailed
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-DYYMIUN4.js";
|
|
15
15
|
import {
|
|
16
16
|
readSseFrames
|
|
17
17
|
} from "./chunk-HNUWUO75.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
hasImageInRuntimeMessages,
|
|
27
27
|
resolveAgentContextWindow,
|
|
28
28
|
stripImagePartsFromMessages
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-HSJPKBLC.js";
|
|
30
30
|
import {
|
|
31
31
|
clipToolText,
|
|
32
32
|
resolveAgentImageInputSupport,
|
|
@@ -87,7 +87,7 @@ import {
|
|
|
87
87
|
toOpenAiCompatibleMessages,
|
|
88
88
|
toResponsesTools,
|
|
89
89
|
transferDowngradedToolTurnOrigin
|
|
90
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-HL3O3PCQ.js";
|
|
91
91
|
import {
|
|
92
92
|
BRIDGE_STREAM_MAX_CHARS,
|
|
93
93
|
DEFAULT_READ_DIALOG_MAX_RESPONSE_CHARS,
|
|
@@ -108,6 +108,7 @@ import {
|
|
|
108
108
|
} from "./chunk-2MBTWINN.js";
|
|
109
109
|
import {
|
|
110
110
|
EMPTY_ASSISTANT_REPAIR_PROMPT,
|
|
111
|
+
extractReferenceKeysFromMessage,
|
|
111
112
|
hasAssistantVisibleOutput,
|
|
112
113
|
normalizeUsage,
|
|
113
114
|
readCacheCreationInputTokens,
|
|
@@ -115,7 +116,7 @@ import {
|
|
|
115
116
|
resolveEmptyAssistantFallbackMessage,
|
|
116
117
|
resolveEmptyAssistantOutcome,
|
|
117
118
|
resolveTruncatedReasoningTailLog
|
|
118
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-DTODXBHK.js";
|
|
119
120
|
import {
|
|
120
121
|
COMPACTION_SUMMARY_SCHEMA_VERSION,
|
|
121
122
|
COMPACTION_SUMMARY_SYSTEM_PROMPT,
|
|
@@ -123,6 +124,7 @@ import {
|
|
|
123
124
|
buildCompactionMetricsFromPlan,
|
|
124
125
|
buildCompactionUserContent,
|
|
125
126
|
computeSummaryInputTokenCap,
|
|
127
|
+
computeSummarySourceMetadata,
|
|
126
128
|
createProviderCallTimingTracker,
|
|
127
129
|
finalizeProviderCallTiming,
|
|
128
130
|
formatCompactionMetricsLog,
|
|
@@ -134,9 +136,10 @@ import {
|
|
|
134
136
|
planCompression,
|
|
135
137
|
planContextUsage,
|
|
136
138
|
resolveCompressionTriggerRatio,
|
|
139
|
+
sha256Hex,
|
|
137
140
|
truncateToolOutputForContext,
|
|
138
141
|
withProviderCallTimingFields
|
|
139
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-4PXHOOFA.js";
|
|
140
143
|
import {
|
|
141
144
|
clipCompactText
|
|
142
145
|
} from "./chunk-5MMAK75Q.js";
|
|
@@ -18692,22 +18695,34 @@ var normalizeContextBlockScopes = (legacyBlocks = void 0, scopes = void 0) => {
|
|
|
18692
18695
|
};
|
|
18693
18696
|
|
|
18694
18697
|
// packages/agent-runtime/localAutoCompaction.ts
|
|
18695
|
-
import {
|
|
18698
|
+
import { randomUUID } from "node:crypto";
|
|
18696
18699
|
function toPlanCompressionMessages(history) {
|
|
18697
18700
|
return history.map((message, index) => ({
|
|
18698
|
-
id: `local-${index}`,
|
|
18701
|
+
id: typeof message.id === "string" && message.id.length > 0 ? message.id : `local-${index}`,
|
|
18699
18702
|
role: message.role,
|
|
18700
|
-
content: message.content,
|
|
18703
|
+
content: message.content ?? "",
|
|
18701
18704
|
...Array.isArray(message.tool_calls) ? { tool_calls: message.tool_calls } : {}
|
|
18702
18705
|
}));
|
|
18703
18706
|
}
|
|
18707
|
+
function findSummaryAnchorIndex(bridged, anchorId) {
|
|
18708
|
+
const actual = bridged.findIndex((message) => message.id === anchorId);
|
|
18709
|
+
if (actual >= 0) return actual;
|
|
18710
|
+
const legacy = /^local-(0|[1-9]\d*)$/.exec(anchorId);
|
|
18711
|
+
if (!legacy) return -1;
|
|
18712
|
+
const index = Number(legacy[1]);
|
|
18713
|
+
return Number.isSafeInteger(index) && index < bridged.length ? index : -1;
|
|
18714
|
+
}
|
|
18704
18715
|
function hashSummarySourceSlice(history, summarizedBeforeId) {
|
|
18705
18716
|
if (!summarizedBeforeId) return void 0;
|
|
18706
18717
|
const bridged = toPlanCompressionMessages(history);
|
|
18707
|
-
const found = bridged
|
|
18718
|
+
const found = findSummaryAnchorIndex(bridged, summarizedBeforeId);
|
|
18708
18719
|
if (found === -1) return void 0;
|
|
18709
|
-
const slice = bridged.slice(0, found + 1)
|
|
18710
|
-
|
|
18720
|
+
const slice = bridged.slice(0, found + 1).map((message, index) => ({
|
|
18721
|
+
...message,
|
|
18722
|
+
id: `local-${index}`,
|
|
18723
|
+
content: message.content ?? ""
|
|
18724
|
+
}));
|
|
18725
|
+
return sha256Hex(JSON.stringify(slice));
|
|
18711
18726
|
}
|
|
18712
18727
|
function validateStoredSummary(args2) {
|
|
18713
18728
|
const { history, stored } = args2;
|
|
@@ -18720,9 +18735,7 @@ function validateStoredSummary(args2) {
|
|
|
18720
18735
|
return false;
|
|
18721
18736
|
}
|
|
18722
18737
|
const bridged = toPlanCompressionMessages(history);
|
|
18723
|
-
const found = bridged.
|
|
18724
|
-
(m) => m.id === stored.summarizedBeforeId
|
|
18725
|
-
);
|
|
18738
|
+
const found = findSummaryAnchorIndex(bridged, stored.summarizedBeforeId ?? "");
|
|
18726
18739
|
if (found === -1) return false;
|
|
18727
18740
|
const recomputed = hashSummarySourceSlice(history, stored.summarizedBeforeId);
|
|
18728
18741
|
if (recomputed === void 0) return false;
|
|
@@ -18741,7 +18754,7 @@ function projectHistoryWithSummary(args2) {
|
|
|
18741
18754
|
const bridged = toPlanCompressionMessages(args2.history);
|
|
18742
18755
|
let startIndex = 0;
|
|
18743
18756
|
if (args2.summarizedBeforeId) {
|
|
18744
|
-
const found = bridged
|
|
18757
|
+
const found = findSummaryAnchorIndex(bridged, args2.summarizedBeforeId);
|
|
18745
18758
|
if (found !== -1) startIndex = found + 1;
|
|
18746
18759
|
}
|
|
18747
18760
|
const projected = args2.history.slice(startIndex);
|
|
@@ -18761,15 +18774,16 @@ function isColdResume(history, nowMs) {
|
|
|
18761
18774
|
async function runSummaryFallback(fallback, content, options) {
|
|
18762
18775
|
try {
|
|
18763
18776
|
const text2 = await fallback(content, options);
|
|
18764
|
-
if (typeof text2 !== "string") return null;
|
|
18777
|
+
if (typeof text2 !== "string") return { summary: null, error: "non-string output" };
|
|
18765
18778
|
const trimmed = text2.trim();
|
|
18766
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
18779
|
+
return trimmed.length > 0 ? { summary: trimmed } : { summary: null, error: "empty summary" };
|
|
18767
18780
|
} catch (error) {
|
|
18768
18781
|
console.warn("[localLoop] auto-compaction summary fallback failed", {
|
|
18769
18782
|
attemptId: options.attemptId,
|
|
18770
18783
|
stage: "fallback"
|
|
18771
18784
|
});
|
|
18772
|
-
|
|
18785
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
18786
|
+
return { summary: null, error: message };
|
|
18773
18787
|
}
|
|
18774
18788
|
}
|
|
18775
18789
|
var COMPACTION_RETRY_BACKOFF_MS = 6e4;
|
|
@@ -18850,12 +18864,14 @@ async function maybeAutoCompactLocalHistory(args2) {
|
|
|
18850
18864
|
}
|
|
18851
18865
|
const existingSummary = typeof stored?.summary === "string" ? stored.summary : "";
|
|
18852
18866
|
const summarizedBeforeId = typeof stored?.summarizedBeforeId === "string" ? stored.summarizedBeforeId : void 0;
|
|
18867
|
+
const legacyAnchorIndex = summarizedBeforeId ? findSummaryAnchorIndex(bridged, summarizedBeforeId) : -1;
|
|
18868
|
+
const planAnchorId = summarizedBeforeId && /^local-(0|[1-9]\d*)$/.test(summarizedBeforeId) && legacyAnchorIndex >= 0 ? bridged[legacyAnchorIndex].id : summarizedBeforeId;
|
|
18853
18869
|
const contextWindow = typeof args2.contextWindow === "number" && Number.isFinite(args2.contextWindow) && args2.contextWindow > 0 ? args2.contextWindow : getModelContextWindow(args2.model ?? "");
|
|
18854
18870
|
const allMsgs = toPlanCompressionMessages(history);
|
|
18855
18871
|
const coldResume = isColdResume(history, args2.now?.() ?? Date.now());
|
|
18856
18872
|
const plan = planCompression({
|
|
18857
18873
|
allMsgs,
|
|
18858
|
-
summarizedBeforeId,
|
|
18874
|
+
summarizedBeforeId: planAnchorId,
|
|
18859
18875
|
summary: existingSummary,
|
|
18860
18876
|
contextWindow,
|
|
18861
18877
|
...coldResume ? { coldResume: true, reason: "cold_resume" } : {},
|
|
@@ -19021,9 +19037,10 @@ async function maybeAutoCompactLocalHistory(args2) {
|
|
|
19021
19037
|
});
|
|
19022
19038
|
}
|
|
19023
19039
|
const summaryFallback = args2.summaryFallback;
|
|
19040
|
+
let fallbackFailureDetail;
|
|
19024
19041
|
if (primaryFailure && summaryFallback) {
|
|
19025
19042
|
const fallbackT0 = Date.now();
|
|
19026
|
-
const
|
|
19043
|
+
const fallbackResult = await runSummaryFallback(
|
|
19027
19044
|
summaryFallback,
|
|
19028
19045
|
promptContent,
|
|
19029
19046
|
{
|
|
@@ -19038,10 +19055,19 @@ async function maybeAutoCompactLocalHistory(args2) {
|
|
|
19038
19055
|
compactionReason: "aborted"
|
|
19039
19056
|
});
|
|
19040
19057
|
}
|
|
19041
|
-
if (
|
|
19058
|
+
if (fallbackResult.summary) {
|
|
19059
|
+
newSummary = fallbackResult.summary;
|
|
19060
|
+
} else {
|
|
19061
|
+
fallbackFailureDetail = fallbackResult.error ?? "no summary";
|
|
19062
|
+
}
|
|
19042
19063
|
}
|
|
19043
19064
|
if (!newSummary) {
|
|
19044
|
-
|
|
19065
|
+
const failureNow = args2.now?.() ?? Date.now();
|
|
19066
|
+
recordCompactionFailure(dialogId, failureNow);
|
|
19067
|
+
const primaryDetail = outcome.kind === "provider-error" ? outcome.error instanceof Error ? outcome.error.message : String(outcome.error) : outcome.kind === "done" ? "summary model returned empty content" : `auto-compaction timed out after ${timeoutMs ?? primaryElapsedMs}ms`;
|
|
19068
|
+
const primaryDiagnostic = `primary failed (${primaryElapsedMs ?? 0}ms): ${primaryDetail}`;
|
|
19069
|
+
const fallbackDiagnostic = fallbackElapsedMs !== void 0 ? `; fallback failed (${fallbackElapsedMs}ms): ${fallbackFailureDetail ?? "no summary"}` : "";
|
|
19070
|
+
const combinedDetail = `${primaryDiagnostic}${fallbackDiagnostic}`;
|
|
19045
19071
|
if (outcome.kind === "done") {
|
|
19046
19072
|
console.warn(
|
|
19047
19073
|
"[localLoop] auto-compaction produced empty summary; keeping prior projection"
|
|
@@ -19049,34 +19075,43 @@ async function maybeAutoCompactLocalHistory(args2) {
|
|
|
19049
19075
|
logCompactionTiming("empty", {});
|
|
19050
19076
|
const failureReason = "provider-error";
|
|
19051
19077
|
emitPhase({ kind: "compaction-failed", reason: failureReason });
|
|
19078
|
+
const failureMessage = combinedDetail.slice(0, 200);
|
|
19052
19079
|
return {
|
|
19053
19080
|
...projectExisting(),
|
|
19054
|
-
failureMessage
|
|
19081
|
+
failureMessage,
|
|
19055
19082
|
failureReason,
|
|
19056
19083
|
decision: {
|
|
19057
19084
|
outcome: "failed",
|
|
19058
19085
|
reason: failureReason,
|
|
19059
|
-
detail:
|
|
19086
|
+
detail: failureMessage
|
|
19060
19087
|
}
|
|
19061
19088
|
};
|
|
19062
19089
|
}
|
|
19063
19090
|
const reason = primaryFailure ?? "provider-error";
|
|
19064
|
-
|
|
19065
|
-
|
|
19091
|
+
throw Object.assign(new Error(combinedDetail), {
|
|
19092
|
+
compactionReason: reason,
|
|
19093
|
+
primaryElapsedMs,
|
|
19094
|
+
fallbackElapsedMs
|
|
19095
|
+
});
|
|
19066
19096
|
}
|
|
19097
|
+
const sourceMeta = await computeSummarySourceMetadata(
|
|
19098
|
+
toPlanCompressionMessages(history),
|
|
19099
|
+
plan.newSummarizedBeforeId
|
|
19100
|
+
);
|
|
19067
19101
|
const saveT0 = Date.now();
|
|
19068
19102
|
await adapter.saveDialogSummary({
|
|
19069
19103
|
dialogId,
|
|
19070
19104
|
summary: newSummary,
|
|
19071
19105
|
summarizedBeforeId: plan.newSummarizedBeforeId,
|
|
19072
19106
|
// 内容寻址失效检测:存锚点切片哈希与长度,供下轮载入校验。
|
|
19073
|
-
sourceHash:
|
|
19074
|
-
sourceCount:
|
|
19075
|
-
|
|
19076
|
-
|
|
19077
|
-
|
|
19078
|
-
|
|
19079
|
-
|
|
19107
|
+
sourceHash: sourceMeta?.sourceHash,
|
|
19108
|
+
sourceCount: sourceMeta?.sourceCount ?? 0,
|
|
19109
|
+
schemaVersion: COMPACTION_SUMMARY_SCHEMA_VERSION,
|
|
19110
|
+
referenceKeys: Array.from(
|
|
19111
|
+
new Set(
|
|
19112
|
+
history.slice(0, sourceMeta?.sourceCount ?? 0).flatMap((message) => extractReferenceKeysFromMessage(message))
|
|
19113
|
+
)
|
|
19114
|
+
)
|
|
19080
19115
|
});
|
|
19081
19116
|
saveElapsedMs = Date.now() - saveT0;
|
|
19082
19117
|
const metricsReason = invalidSummary ? "invalid_summary" : coldResume ? "cold_resume" : "context_budget";
|
|
@@ -19122,7 +19157,8 @@ async function maybeAutoCompactLocalHistory(args2) {
|
|
|
19122
19157
|
const failureMessage = error instanceof Error && error.message ? error.message.slice(0, 200) : String(error).slice(0, 200);
|
|
19123
19158
|
const failureReason = error instanceof Error && "compactionReason" in error ? error.compactionReason : "provider-error";
|
|
19124
19159
|
logCompactionTiming(failureReason, {});
|
|
19125
|
-
|
|
19160
|
+
const failureNow = args2.now?.() ?? Date.now();
|
|
19161
|
+
if (failureReason !== "aborted") recordCompactionFailure(dialogId, failureNow);
|
|
19126
19162
|
emitPhase({ kind: "compaction-failed", reason: failureReason });
|
|
19127
19163
|
return {
|
|
19128
19164
|
...projectExisting(),
|
|
@@ -19271,8 +19307,8 @@ function createTurnCompactionController(args2) {
|
|
|
19271
19307
|
}
|
|
19272
19308
|
|
|
19273
19309
|
// packages/agent-runtime/providerCallTelemetry.ts
|
|
19274
|
-
import { createHash as
|
|
19275
|
-
var shortHash = (value) =>
|
|
19310
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
19311
|
+
var shortHash = (value) => createHash5("sha1").update(value).digest("hex").slice(0, 12);
|
|
19276
19312
|
var hashMessage = (message) => {
|
|
19277
19313
|
let text2;
|
|
19278
19314
|
try {
|
|
@@ -21080,12 +21116,14 @@ function dialogMessageRecordToAgentRuntimeMessage(record2) {
|
|
|
21080
21116
|
if (!record2 || typeof record2 !== "object") return null;
|
|
21081
21117
|
if (record2.role !== "user" && record2.role !== "assistant" && record2.role !== "tool") return null;
|
|
21082
21118
|
return {
|
|
21119
|
+
...typeof record2.id === "string" ? { id: record2.id } : {},
|
|
21083
21120
|
role: record2.role,
|
|
21084
21121
|
content: record2.content ?? "",
|
|
21085
21122
|
...record2.contextReference !== void 0 ? { context_reference: record2.contextReference } : {},
|
|
21086
21123
|
...typeof record2.reasoning_content === "string" ? { reasoning_content: record2.reasoning_content } : {},
|
|
21087
21124
|
...typeof record2.toolCallId === "string" ? { tool_call_id: record2.toolCallId } : {},
|
|
21088
21125
|
...Array.isArray(record2.tool_calls) ? { tool_calls: record2.tool_calls } : {},
|
|
21126
|
+
...record2.toolPayload !== void 0 ? { toolPayload: record2.toolPayload } : {},
|
|
21089
21127
|
...typeof record2.toolName === "string" ? { toolName: record2.toolName } : {},
|
|
21090
21128
|
// 写侧(dialogWritePlan)把 tool_result_metadata 以 `metadata` 字段落库;
|
|
21091
21129
|
// 回读必须还原,否则跨 turn 投影丢失 metadata 后缀,同一 tool 消息的字节
|
|
@@ -21690,14 +21728,14 @@ Available skills: ${available.join(", ")}`;
|
|
|
21690
21728
|
}
|
|
21691
21729
|
|
|
21692
21730
|
// packages/agent-runtime/sessionIdentity.ts
|
|
21693
|
-
import { createHash as
|
|
21731
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
21694
21732
|
var SALT = "nolo-session-identity-v1";
|
|
21695
21733
|
function isStableSessionIdentityEnabled(env = process.env) {
|
|
21696
21734
|
const v = env.NOLO_STABLE_SESSION_IDENTITY?.trim().toLowerCase();
|
|
21697
21735
|
return !(v === "0" || v === "false" || v === "off");
|
|
21698
21736
|
}
|
|
21699
21737
|
function deriveStableUuid(sessionKey, purpose) {
|
|
21700
|
-
const h =
|
|
21738
|
+
const h = createHash6("sha256").update(`${SALT}\0${purpose}\0${sessionKey}`).digest();
|
|
21701
21739
|
h[6] = h[6] & 15 | 80;
|
|
21702
21740
|
h[8] = h[8] & 63 | 128;
|
|
21703
21741
|
const x = h.subarray(0, 16).toString("hex");
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeTimingMs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4PXHOOFA.js";
|
|
4
4
|
import {
|
|
5
5
|
BUILTIN_NOLO_AGENT_KEY
|
|
6
6
|
} from "./chunk-EZVK3N5L.js";
|
|
7
|
+
import {
|
|
8
|
+
isDialogRecordKey,
|
|
9
|
+
isPageKey,
|
|
10
|
+
isTableMetaKey
|
|
11
|
+
} from "./chunk-5EMSBTQ6.js";
|
|
7
12
|
import {
|
|
8
13
|
asTrimmedNonEmptyStringArray
|
|
9
14
|
} from "./chunk-I42VC5KR.js";
|
|
10
15
|
import {
|
|
11
16
|
asOptionalFiniteNumber
|
|
12
17
|
} from "./chunk-WWC7I6TA.js";
|
|
18
|
+
import {
|
|
19
|
+
isRecord
|
|
20
|
+
} from "./chunk-KUG52IAP.js";
|
|
21
|
+
import {
|
|
22
|
+
asTrimmedString
|
|
23
|
+
} from "./chunk-3EUW3WEO.js";
|
|
13
24
|
import {
|
|
14
25
|
asOptionalTrimmedString
|
|
15
26
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -241,12 +252,103 @@ function resolveTruncatedReasoningTailLog(reason, reasoning_content) {
|
|
|
241
252
|
return null;
|
|
242
253
|
}
|
|
243
254
|
|
|
255
|
+
// packages/chat/messages/parseJsonRecord.ts
|
|
256
|
+
function asOptionalJsonRecord(value) {
|
|
257
|
+
if (typeof value === "string") {
|
|
258
|
+
if (!value.trim()) return void 0;
|
|
259
|
+
try {
|
|
260
|
+
const parsed = JSON.parse(value);
|
|
261
|
+
return isRecord(parsed) ? parsed : void 0;
|
|
262
|
+
} catch {
|
|
263
|
+
return void 0;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return isRecord(value) ? value : void 0;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// packages/chat/dialog/actions/extractReferenceKeys.ts
|
|
270
|
+
var REFERENCE_ARG_FIELDS = [
|
|
271
|
+
"pageKey",
|
|
272
|
+
"dialogKey",
|
|
273
|
+
"dbKey",
|
|
274
|
+
"docKey",
|
|
275
|
+
"key",
|
|
276
|
+
"id",
|
|
277
|
+
"rowDbKey",
|
|
278
|
+
"tableKey",
|
|
279
|
+
"table"
|
|
280
|
+
];
|
|
281
|
+
var isLoadableReferenceKey = (key) => isPageKey(key) || isDialogRecordKey(key) || isTableMetaKey(key);
|
|
282
|
+
var extractKeysFromArgs = (args, out) => {
|
|
283
|
+
if (!args) return;
|
|
284
|
+
for (const field of REFERENCE_ARG_FIELDS) {
|
|
285
|
+
const value = args[field];
|
|
286
|
+
const key = asTrimmedString(value);
|
|
287
|
+
if (key && isLoadableReferenceKey(key)) {
|
|
288
|
+
out.add(key);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
var extractKeysFromToolCalls = (msg, out) => {
|
|
293
|
+
const toolCalls = msg.tool_calls;
|
|
294
|
+
if (!Array.isArray(toolCalls)) return;
|
|
295
|
+
for (const call of toolCalls) {
|
|
296
|
+
const fn = call.function;
|
|
297
|
+
const argumentsText = asTrimmedString(fn.arguments);
|
|
298
|
+
if (!argumentsText) continue;
|
|
299
|
+
const parsed = asOptionalJsonRecord(argumentsText);
|
|
300
|
+
if (parsed) extractKeysFromArgs(parsed, out);
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
var extractKeysFromToolPayload = (toolPayload, out) => {
|
|
304
|
+
if (!toolPayload) return;
|
|
305
|
+
if (isRecord(toolPayload.input)) {
|
|
306
|
+
extractKeysFromArgs(
|
|
307
|
+
toolPayload.input,
|
|
308
|
+
out
|
|
309
|
+
);
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
const rawToolCall = toolPayload.rawToolCall;
|
|
313
|
+
if (isRecord(rawToolCall)) {
|
|
314
|
+
const fn = rawToolCall.function;
|
|
315
|
+
if (isRecord(fn)) {
|
|
316
|
+
const argumentsText = asTrimmedString(fn.arguments);
|
|
317
|
+
if (argumentsText) {
|
|
318
|
+
const parsed = asOptionalJsonRecord(argumentsText);
|
|
319
|
+
if (parsed) extractKeysFromArgs(parsed, out);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
var extractKeysFromContent = (msg, out) => {
|
|
325
|
+
const content = msg.content;
|
|
326
|
+
if (!content) return;
|
|
327
|
+
const parts = Array.isArray(content) ? content : [content];
|
|
328
|
+
for (const part of parts) {
|
|
329
|
+
if (!isRecord(part)) continue;
|
|
330
|
+
const pageKey = asTrimmedString(part.pageKey);
|
|
331
|
+
if (pageKey) out.add(pageKey);
|
|
332
|
+
const dialogKey = asTrimmedString(part.dialogKey);
|
|
333
|
+
if (dialogKey) out.add(dialogKey);
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
var extractReferenceKeysFromMessage = (msg) => {
|
|
337
|
+
const keys = /* @__PURE__ */ new Set();
|
|
338
|
+
extractKeysFromContent(msg, keys);
|
|
339
|
+
extractKeysFromToolCalls(msg, keys);
|
|
340
|
+
extractKeysFromToolPayload(msg.toolPayload, keys);
|
|
341
|
+
return Array.from(keys);
|
|
342
|
+
};
|
|
343
|
+
|
|
244
344
|
export {
|
|
245
345
|
DEFAULT_AUTO_EXECUTION_PROFILE,
|
|
246
346
|
resolveAutoExecutionProfile,
|
|
247
347
|
readCacheReadInputTokens,
|
|
248
348
|
readCacheCreationInputTokens,
|
|
249
349
|
normalizeUsage,
|
|
350
|
+
asOptionalJsonRecord,
|
|
351
|
+
extractReferenceKeysFromMessage,
|
|
250
352
|
EMPTY_ASSISTANT_REPAIR_PROMPT,
|
|
251
353
|
EMPTY_ASSISTANT_FALLBACK_MESSAGE,
|
|
252
354
|
LENGTH_TRUNCATED_FALLBACK_MESSAGE,
|
|
@@ -27,11 +27,11 @@ import {
|
|
|
27
27
|
stablePromptCacheKey,
|
|
28
28
|
toOpenAiCompatibleMessages,
|
|
29
29
|
toResponsesTools
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-HL3O3PCQ.js";
|
|
31
31
|
import {
|
|
32
32
|
isMeaningfulChatCompletionOutput,
|
|
33
33
|
isMeaningfulResponsesOutput
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-4PXHOOFA.js";
|
|
35
35
|
import {
|
|
36
36
|
clipCompactText
|
|
37
37
|
} from "./chunk-5MMAK75Q.js";
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-ZIWPQEFU.js";
|
|
9
9
|
import {
|
|
10
10
|
fetchAndCacheTableRows
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-OFVFQYIE.js";
|
|
12
12
|
import {
|
|
13
13
|
require_react
|
|
14
14
|
} from "./chunk-YDH3FDFQ.js";
|
|
@@ -517,7 +517,7 @@ var executeToolRun = createAsyncThunk(
|
|
|
517
517
|
if (!executionInput) {
|
|
518
518
|
throw new Error(`ToolRun ${id} has no input to execute with.`);
|
|
519
519
|
}
|
|
520
|
-
const { findToolExecutor } = await import("./tools-
|
|
520
|
+
const { findToolExecutor } = await import("./tools-5WYAUKMK.js");
|
|
521
521
|
const { executor } = findToolExecutor(run.toolName);
|
|
522
522
|
toolRunStarted({
|
|
523
523
|
id: run.id,
|