nolo-cli 0.16.0-alpha.2 → 0.16.0-alpha.4

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.
Files changed (67) hide show
  1. package/{_executeModel-QAUS6B7J.js → _executeModel-TZUDMB24.js} +14 -13
  2. package/{agentDeleteCommand-365DMKHW.js → agentDeleteCommand-EMXLYNAH.js} +9 -8
  3. package/{agentEmailCommands-TQMXL36I.js → agentEmailCommands-A4U3WMMS.js} +19 -18
  4. package/{agentListCommands-6B5X4RC6.js → agentListCommands-HQZNTYEG.js} +10 -9
  5. package/{agentMachineCommands-LOEARB6V.js → agentMachineCommands-VFFEYHWZ.js} +9 -8
  6. package/{agentRecordCommands-DCH2WBL2.js → agentRecordCommands-MV6SFG6W.js} +18 -17
  7. package/{agentRunCommand-SGMH67WT.js → agentRunCommand-5M2V6PJT.js} +18 -17
  8. package/{agentRuntimeLocal-YSYZ33ER.js → agentRuntimeLocal-WGVEZMXW.js} +6 -5
  9. package/{agentSlice-IVE735EV.js → agentSlice-ILWKFTS5.js} +1 -1
  10. package/{appDeleteCommands-6QYOO3JB.js → appDeleteCommands-N5AHOOHG.js} +10 -9
  11. package/{appDeployCommands-WTCT6XO6.js → appDeployCommands-GDD4CHRI.js} +10 -9
  12. package/{appDeployStatusCommands-CGWGZJKB.js → appDeployStatusCommands-3ZQH2E2A.js} +10 -9
  13. package/{appGetCommands-O4OCAMRW.js → appGetCommands-U4BGN2SW.js} +10 -9
  14. package/{appListCommands-UENFP4XY.js → appListCommands-S5BF2T4A.js} +10 -9
  15. package/{authCommand-YFTR3347.js → authCommand-WKMPIXR6.js} +8 -2
  16. package/{chunk-HRQCKQA5.js → chunk-27DJM3CW.js} +1 -242
  17. package/{chunk-RKM3K52F.js → chunk-2L6OCZ6Z.js} +1 -1
  18. package/{chunk-YYIRR6QC.js → chunk-2ZDQ5PN5.js} +11 -11
  19. package/{chunk-Z24FGIU2.js → chunk-36GPBUJ2.js} +1 -1
  20. package/{chunk-J55UHASN.js → chunk-3GSNWWY3.js} +1 -1
  21. package/{chunk-6565R2TI.js → chunk-3SCCWSA3.js} +10 -8
  22. package/{chunk-YNHQIXX5.js → chunk-463YM7CS.js} +8 -8
  23. package/{chunk-EMXI3N3Z.js → chunk-4CANFLI7.js} +2 -2
  24. package/chunk-4MSDMVUW.js +247 -0
  25. package/{chunk-YC3DJILJ.js → chunk-7LFS3UL6.js} +8 -6
  26. package/{chunk-GRTFNYLR.js → chunk-AO2YB7PG.js} +2 -2
  27. package/{chunk-VE6XMVKG.js → chunk-CT3XKUX4.js} +8 -8
  28. package/{chunk-4IJYA27C.js → chunk-I4NUTIXT.js} +1 -1
  29. package/{chunk-RSYUDGGZ.js → chunk-LTZL7WC3.js} +1 -1
  30. package/{chunk-WRN5EQT7.js → chunk-MEZVPVXM.js} +1 -1
  31. package/{chunk-6MHDWKOT.js → chunk-MRDODOWX.js} +1 -1
  32. package/{chunk-WPN6RMDF.js → chunk-NCMP6Q3I.js} +3 -3
  33. package/{chunk-I66RU7P7.js → chunk-NY6KTTLA.js} +1 -1
  34. package/{chunk-QLFCNUVQ.js → chunk-OLNFFJVY.js} +44 -15
  35. package/{chunk-QZVGMD5F.js → chunk-ONELX7AM.js} +1 -1
  36. package/{chunk-O53CP2QR.js → chunk-TY27RYCD.js} +2 -2
  37. package/{chunk-BFRVXJJJ.js → chunk-VD24AND2.js} +6 -6
  38. package/{chunk-OQMPU2ML.js → chunk-VOVNQ4YU.js} +3 -3
  39. package/{chunk-ISYE6GZB.js → chunk-W3574B3G.js} +1 -1
  40. package/{chunk-E237VE6U.js → chunk-WFFFQD6S.js} +1 -1
  41. package/{chunk-G2MKOQCB.js → chunk-WIZX3ACC.js} +1 -1
  42. package/{chunk-4NLUNENX.js → chunk-WNUSEMPU.js} +1 -1
  43. package/{chunk-EHLHSX7R.js → chunk-XXUNUXCS.js} +9 -2
  44. package/{chunk-WA6KZL5V.js → chunk-ZODEA6YR.js} +9 -7
  45. package/{createAgentAutomationAction-TS6NNZ4X.js → createAgentAutomationAction-QHGTCNTZ.js} +2 -2
  46. package/{createDialogAction-5HVQ33EX.js → createDialogAction-BEO3QLUA.js} +3 -3
  47. package/{createPageAction-4F3ZGQJD.js → createPageAction-35EGISA5.js} +2 -2
  48. package/{dialogCommands-ZL6L24BS.js → dialogCommands-V7UHKTXT.js} +10 -9
  49. package/{dialogSlice-FAWUQDJW.js → dialogSlice-PWTRW5CX.js} +2 -2
  50. package/{docCreateCommands-LYROQTFH.js → docCreateCommands-TNC5RGE6.js} +9 -8
  51. package/{docDeleteCommands-6TWGTZNR.js → docDeleteCommands-PDMKS5KK.js} +10 -9
  52. package/{docReadCommands-PRULNF26.js → docReadCommands-GGAFPAUO.js} +9 -8
  53. package/{docStore-2UHVWLTV.js → docStore-BIJALNX5.js} +3 -3
  54. package/{docUpdateCommands-NNYYWJBI.js → docUpdateCommands-NCZK5UPH.js} +9 -8
  55. package/{handleSendMessageAction-LJPUYNOH.js → handleSendMessageAction-EN7ZJLBM.js} +190 -4
  56. package/index.js +47 -47
  57. package/{machineCommands-JQPEQFSE.js → machineCommands-WF2VFJD2.js} +17 -16
  58. package/{machineWsRunDispatch-FFFNWVEW.js → machineWsRunDispatch-7675PUSK.js} +17 -16
  59. package/package.json +1 -1
  60. package/{readlineWorkspace-QSXHSBHA.js → readlineWorkspace-4VTHXHUB.js} +23 -22
  61. package/{runAgentClientLoop-A75BUU6D.js → runAgentClientLoop-ZAZSFAAO.js} +11 -10
  62. package/{spaceCommands-4LE45GB7.js → spaceCommands-IASX6FPL.js} +9 -8
  63. package/{spaceSlice-444MFUP6.js → spaceSlice-HGDO7QJK.js} +2 -2
  64. package/{streamAgentChatTurn-DJAE7USZ.js → streamAgentChatTurn-KTDBTZUL.js} +13 -12
  65. package/{tools-YB6LXSVN.js → tools-IUKU5H6C.js} +5 -5
  66. package/{tuiSummaryLlmCaller-QQL3JA5I.js → tuiSummaryLlmCaller-RV6ZXCLV.js} +3 -2
  67. package/{updateDialogTitleAction-6HGFBM64.js → updateDialogTitleAction-6R62F4XS.js} +2 -2
@@ -0,0 +1,247 @@
1
+ import {
2
+ isRecord
3
+ } from "./chunk-KUG52IAP.js";
4
+ import {
5
+ asOptionalTrimmedString
6
+ } from "./chunk-G3SUCT4W.js";
7
+
8
+ // packages/agent-runtime/openAiCompatibleMessages.ts
9
+ function preserveAgentStateFields(source, target, options) {
10
+ const mutableTarget = target;
11
+ if (source.role === "assistant") {
12
+ if (!options?.stripReasoningContent && typeof source.reasoning_content === "string") {
13
+ mutableTarget.reasoning_content = source.reasoning_content;
14
+ }
15
+ if (Array.isArray(source.tool_calls)) {
16
+ mutableTarget.tool_calls = source.tool_calls;
17
+ }
18
+ }
19
+ if (source.role === "tool") {
20
+ const toolCallId = typeof source.tool_call_id === "string" ? source.tool_call_id.trim() : typeof source.toolCallId === "string" ? source.toolCallId.trim() : "";
21
+ if (toolCallId) mutableTarget.tool_call_id = toolCallId;
22
+ }
23
+ return target;
24
+ }
25
+ function toOpenAiCompatibleMessages(messages, options) {
26
+ return messages.map(
27
+ (message) => preserveAgentStateFields(message, {
28
+ role: message.role,
29
+ content: message.content ?? ""
30
+ }, options)
31
+ );
32
+ }
33
+
34
+ // packages/integrations/openai/responsesHelpers.ts
35
+ var RESPONSES_TOP_LEVEL_SCHEMA_KEYS = ["anyOf", "oneOf", "allOf", "enum", "not"];
36
+ var sanitizeResponsesParameters = (parameters) => {
37
+ if (!isRecord(parameters)) {
38
+ return parameters;
39
+ }
40
+ const next = { ...parameters };
41
+ for (const key of RESPONSES_TOP_LEVEL_SCHEMA_KEYS) {
42
+ delete next[key];
43
+ }
44
+ return next;
45
+ };
46
+ var appendTextPart = (parts, text, role) => {
47
+ if (!text) return;
48
+ const last = parts.at(-1);
49
+ const textType = role === "assistant" ? "output_text" : "input_text";
50
+ if (last?.type === textType) {
51
+ last.text += text;
52
+ return;
53
+ }
54
+ parts.push({ type: textType, text });
55
+ };
56
+ var normalizeMessageParts = (content, role) => {
57
+ if (typeof content === "string") {
58
+ if (!content) return [];
59
+ return [
60
+ {
61
+ type: role === "assistant" ? "output_text" : "input_text",
62
+ text: content
63
+ }
64
+ ];
65
+ }
66
+ const parts = [];
67
+ for (const part of content ?? []) {
68
+ const typedPart = part;
69
+ if (typedPart?.type === "text" && typeof typedPart.text === "string") {
70
+ appendTextPart(parts, typedPart.text, role);
71
+ continue;
72
+ }
73
+ if (typedPart?.type === "image_url" && typeof typedPart.image_url?.url === "string" && typedPart.image_url.url) {
74
+ if (role === "assistant") continue;
75
+ parts.push({
76
+ type: "input_image",
77
+ image_url: typedPart.image_url.url,
78
+ detail: typedPart.image_url.detail
79
+ });
80
+ }
81
+ }
82
+ return parts;
83
+ };
84
+ var normalizeToolOutput = (content) => {
85
+ if (typeof content === "string") return content;
86
+ return JSON.stringify(content ?? "");
87
+ };
88
+ var toResponsesTools = (tools) => {
89
+ if (!Array.isArray(tools) || tools.length === 0) return void 0;
90
+ return tools.map((tool) => {
91
+ const fn = tool?.function;
92
+ if (!fn?.name) return null;
93
+ return {
94
+ type: "function",
95
+ name: fn.name,
96
+ description: fn.description,
97
+ parameters: sanitizeResponsesParameters(fn.parameters),
98
+ strict: fn.strict
99
+ };
100
+ }).filter(Boolean);
101
+ };
102
+ var convertMessagesToResponsesInput = (messages) => {
103
+ const input = [];
104
+ for (const message of messages) {
105
+ if (!message?.role) continue;
106
+ if (message.role === "tool") {
107
+ if (!message.tool_call_id) continue;
108
+ input.push({
109
+ type: "function_call_output",
110
+ call_id: message.tool_call_id,
111
+ output: normalizeToolOutput(message.content)
112
+ });
113
+ continue;
114
+ }
115
+ const role = message.role;
116
+ if (role === "assistant" && typeof message.reasoning_content === "string" && message.reasoning_content) {
117
+ input.push({ type: "reasoning", content: message.reasoning_content });
118
+ }
119
+ const contentParts = normalizeMessageParts(message.content, role);
120
+ if (contentParts.length > 0) {
121
+ input.push({
122
+ type: "message",
123
+ role,
124
+ content: contentParts
125
+ });
126
+ }
127
+ if (role === "assistant" && Array.isArray(message.content)) {
128
+ const replayImages = message.content.map((part) => part).filter(
129
+ (part) => part?.type === "image_url" && typeof part.image_url?.url === "string" && Boolean(part.image_url.url)
130
+ ).map((part) => ({
131
+ type: "input_image",
132
+ image_url: part.image_url.url,
133
+ detail: part.image_url.detail
134
+ }));
135
+ if (replayImages.length > 0) {
136
+ input.push({
137
+ type: "message",
138
+ role: "user",
139
+ content: replayImages
140
+ });
141
+ }
142
+ }
143
+ if (role === "assistant" && Array.isArray(message.tool_calls)) {
144
+ for (const toolCall of message.tool_calls) {
145
+ if (!toolCall?.id || !toolCall.function?.name) continue;
146
+ input.push({
147
+ type: "function_call",
148
+ call_id: toolCall.id,
149
+ name: toolCall.function.name,
150
+ arguments: typeof toolCall.function.arguments === "string" ? toolCall.function.arguments : JSON.stringify(toolCall.function.arguments ?? {})
151
+ });
152
+ }
153
+ }
154
+ }
155
+ return input;
156
+ };
157
+ var extractTextFromResponseOutput = (response) => {
158
+ const parts = [];
159
+ for (const item of response?.output ?? []) {
160
+ if (item?.type !== "message") continue;
161
+ for (const content of item.content ?? []) {
162
+ if (content?.type === "output_text" && typeof content.text === "string") {
163
+ parts.push(content.text);
164
+ }
165
+ }
166
+ }
167
+ return parts.join("");
168
+ };
169
+ var toDataUrl = (base64Data, mimeType) => {
170
+ const normalizedMimeType = asOptionalTrimmedString(mimeType) ?? "image/png";
171
+ return `data:${normalizedMimeType};base64,${base64Data}`;
172
+ };
173
+ var extractImagePartsFromResponseOutput = (response) => {
174
+ const images = [];
175
+ for (const item of response?.output ?? []) {
176
+ if (item?.type === "image_generation_call") {
177
+ const result = asOptionalTrimmedString(item.result);
178
+ if (result) {
179
+ const outputFormat = asOptionalTrimmedString(item.output_format);
180
+ images.push({
181
+ type: "image_url",
182
+ image_url: {
183
+ url: toDataUrl(
184
+ result,
185
+ outputFormat ? `image/${outputFormat}` : void 0
186
+ )
187
+ }
188
+ });
189
+ }
190
+ continue;
191
+ }
192
+ if (item?.type !== "message") continue;
193
+ for (const content of item.content ?? []) {
194
+ const result = asOptionalTrimmedString(content?.result);
195
+ if (content?.type === "output_image" && result) {
196
+ images.push({
197
+ type: "image_url",
198
+ image_url: {
199
+ url: toDataUrl(
200
+ result,
201
+ content.mime_type ?? content.mimeType ?? null
202
+ )
203
+ }
204
+ });
205
+ }
206
+ }
207
+ }
208
+ return images;
209
+ };
210
+ var extractToolCallsFromResponseOutput = (response) => {
211
+ const calls = [];
212
+ for (const item of response?.output ?? []) {
213
+ if (item?.type !== "function_call") continue;
214
+ if (!item.call_id || !item.name) continue;
215
+ calls.push({
216
+ id: item.call_id,
217
+ type: "function",
218
+ function: {
219
+ name: item.name,
220
+ arguments: typeof item.arguments === "string" ? item.arguments : JSON.stringify(item.arguments ?? {})
221
+ }
222
+ });
223
+ }
224
+ return calls;
225
+ };
226
+
227
+ // packages/core/chat/imageParts.ts
228
+ function isImageUrlPart(part) {
229
+ return isRecord(part) && part.type === "image_url";
230
+ }
231
+ function hasImageParts(messages) {
232
+ return messages.some(
233
+ (message) => Array.isArray(message.content) && message.content.some(isImageUrlPart)
234
+ );
235
+ }
236
+
237
+ export {
238
+ isImageUrlPart,
239
+ hasImageParts,
240
+ preserveAgentStateFields,
241
+ toOpenAiCompatibleMessages,
242
+ toResponsesTools,
243
+ convertMessagesToResponsesInput,
244
+ extractTextFromResponseOutput,
245
+ extractImagePartsFromResponseOutput,
246
+ extractToolCallsFromResponseOutput
247
+ };
@@ -4,10 +4,10 @@ import {
4
4
  providerHttpFailure,
5
5
  readSseFrames,
6
6
  throwIfChatCompletionStreamFailed
7
- } from "./chunk-WA6KZL5V.js";
7
+ } from "./chunk-ZODEA6YR.js";
8
8
  import {
9
9
  parseToolArgumentsJson
10
- } from "./chunk-6MHDWKOT.js";
10
+ } from "./chunk-MRDODOWX.js";
11
11
  import {
12
12
  createThinkParserState,
13
13
  createToolCallAccumulator,
@@ -18,12 +18,14 @@ import {
18
18
  import {
19
19
  requiresBareImageUrl,
20
20
  toBareImageUrlMessages
21
- } from "./chunk-RKM3K52F.js";
21
+ } from "./chunk-2L6OCZ6Z.js";
22
22
  import {
23
- buildProviderAuthHeaders,
24
- buildProviderExecutionPlan,
25
23
  toOpenAiCompatibleMessages
26
- } from "./chunk-HRQCKQA5.js";
24
+ } from "./chunk-4MSDMVUW.js";
25
+ import {
26
+ buildProviderAuthHeaders,
27
+ buildProviderExecutionPlan
28
+ } from "./chunk-27DJM3CW.js";
27
29
  import {
28
30
  canonicalizeToolName,
29
31
  createGlob,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  listUserRecordsFromServers,
3
3
  readLiveDbRecordAfterTombstoneMerge
4
- } from "./chunk-J55UHASN.js";
4
+ } from "./chunk-3GSNWWY3.js";
5
5
  import {
6
6
  agentRecordHasConfiguredCredential
7
- } from "./chunk-4NLUNENX.js";
7
+ } from "./chunk-WNUSEMPU.js";
8
8
  import {
9
9
  toSafeAgentSummary
10
10
  } from "./chunk-OOIN7HSO.js";
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-KQHGZWSV.js";
16
16
  import {
17
17
  createDocState
18
- } from "./chunk-O53CP2QR.js";
18
+ } from "./chunk-TY27RYCD.js";
19
19
  import {
20
20
  readDocFunc,
21
21
  readDocFunctionSchema,
@@ -37,7 +37,7 @@ import {
37
37
  } from "./chunk-VF4K2QE6.js";
38
38
  import {
39
39
  createDialogAction
40
- } from "./chunk-Z24FGIU2.js";
40
+ } from "./chunk-36GPBUJ2.js";
41
41
  import {
42
42
  buildSkillDocMarkdown,
43
43
  normalizeSkillBudgetTier,
@@ -76,13 +76,13 @@ import {
76
76
  updateContentCategory,
77
77
  updateContentTitle,
78
78
  updateStep
79
- } from "./chunk-YNHQIXX5.js";
79
+ } from "./chunk-463YM7CS.js";
80
80
  import {
81
81
  createAgent,
82
82
  runLlm,
83
83
  streamAgentChatTurn,
84
84
  updateAgent
85
- } from "./chunk-OQMPU2ML.js";
85
+ } from "./chunk-VOVNQ4YU.js";
86
86
  import {
87
87
  NOLO_WORKSPACE_TOOL_NAMES,
88
88
  buildNoloSubjectRefQueryTarget,
@@ -14154,7 +14154,7 @@ async function deleteDialogsFunc(args, thunkApi) {
14154
14154
  const deletedDialogIds = [];
14155
14155
  const deletedDialogKeys = [];
14156
14156
  const failures = [];
14157
- const { deleteDialog } = await import("./dialogSlice-FAWUQDJW.js");
14157
+ const { deleteDialog } = await import("./dialogSlice-PWTRW5CX.js");
14158
14158
  for (const target of targets) {
14159
14159
  try {
14160
14160
  await thunkApi.dispatch(deleteDialog(target.dbKey)).unwrap();
@@ -23404,7 +23404,7 @@ var executeToolRun = createAsyncThunk(
23404
23404
  if (!executionInput) {
23405
23405
  throw new Error(`ToolRun ${id} has no input to execute with.`);
23406
23406
  }
23407
- const { findToolExecutor: findToolExecutor2 } = await import("./tools-YB6LXSVN.js");
23407
+ const { findToolExecutor: findToolExecutor2 } = await import("./tools-IUKU5H6C.js");
23408
23408
  const { executor } = findToolExecutor2(run.toolName);
23409
23409
  toolRunStarted({
23410
23410
  id: run.id,
@@ -23428,7 +23428,7 @@ var executeToolRun = createAsyncThunk(
23428
23428
  const latestState = thunkApi.getState();
23429
23429
  const userId = latestState.auth?.currentUser?.userId;
23430
23430
  if (userId) {
23431
- const { fetchUserSpaceMemberships } = await import("./spaceSlice-444MFUP6.js");
23431
+ const { fetchUserSpaceMemberships } = await import("./spaceSlice-HGDO7QJK.js");
23432
23432
  await thunkApi.dispatch(fetchUserSpaceMemberships(userId));
23433
23433
  }
23434
23434
  }
@@ -25911,7 +25911,7 @@ async function updateDocFunc(args, thunkApi) {
25911
25911
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
25912
25912
  };
25913
25913
  await dispatch(write({ data: updatedPageData, customKey: id })).unwrap();
25914
- const { getDocState, applyExternalDocUpdate } = await import("./docStore-2UHVWLTV.js");
25914
+ const { getDocState, applyExternalDocUpdate } = await import("./docStore-BIJALNX5.js");
25915
25915
  if (getDocState().pageKey === id) {
25916
25916
  applyExternalDocUpdate({
25917
25917
  slateData: finalSlateData,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  generatePkcePair,
3
3
  startCallbackServer
4
- } from "./chunk-EHLHSX7R.js";
4
+ } from "./chunk-XXUNUXCS.js";
5
5
  import {
6
6
  toErrorMessage
7
7
  } from "./chunk-HNMXYYJR.js";
@@ -7,7 +7,7 @@ import {
7
7
  listUserRecordsFromServers,
8
8
  readDbRecordFromServers,
9
9
  readLiveDbRecordAfterTombstoneMerge
10
- } from "./chunk-J55UHASN.js";
10
+ } from "./chunk-3GSNWWY3.js";
11
11
  import {
12
12
  buildDialogAttachmentPlan,
13
13
  extractFileContentIds
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  i18n_default,
3
3
  toolRegistry
4
- } from "./chunk-VE6XMVKG.js";
4
+ } from "./chunk-CT3XKUX4.js";
5
5
  import {
6
6
  canonicalizeToolNames
7
7
  } from "./chunk-B4KT7RN2.js";
@@ -2,7 +2,7 @@ import {
2
2
  buildCurrentTimeBlock,
3
3
  buildIdentityBlock,
4
4
  buildRuntimeGuidanceBlocks
5
- } from "./chunk-RKM3K52F.js";
5
+ } from "./chunk-2L6OCZ6Z.js";
6
6
  import {
7
7
  canonicalizeToolNames
8
8
  } from "./chunk-B4KT7RN2.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
3
  summarizeEndpoint
4
- } from "./chunk-QLFCNUVQ.js";
4
+ } from "./chunk-OLNFFJVY.js";
5
5
  import {
6
6
  clipMultilineText
7
- } from "./chunk-VE6XMVKG.js";
7
+ } from "./chunk-CT3XKUX4.js";
8
8
  import {
9
9
  runLocalAgentTurn
10
- } from "./chunk-6MHDWKOT.js";
10
+ } from "./chunk-MRDODOWX.js";
11
11
  import {
12
12
  resolveLocalRuntimeEnvFromPolicy
13
13
  } from "./chunk-5CS33IBL.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  requireTokenUser
3
- } from "./chunk-E237VE6U.js";
3
+ } from "./chunk-WFFFQD6S.js";
4
4
  import {
5
5
  resolveServerUrl
6
6
  } from "./chunk-A7GB5UGH.js";
@@ -3,12 +3,12 @@ import {
3
3
  refreshAntigravityOAuthToken,
4
4
  refreshOpenAiCodexToken,
5
5
  refreshXaiOAuthToken
6
- } from "./chunk-EHLHSX7R.js";
6
+ } from "./chunk-XXUNUXCS.js";
7
7
  import {
8
8
  buildLocalAgentLookupKeys,
9
9
  normalizeAgentHandle,
10
10
  shouldReadAgentKeyRemotely
11
- } from "./chunk-QZVGMD5F.js";
11
+ } from "./chunk-ONELX7AM.js";
12
12
  import {
13
13
  LOCAL_CODEX_AGENT_ID,
14
14
  LOCAL_CODEX_AGENT_KEY,
@@ -21,13 +21,13 @@ import {
21
21
  import {
22
22
  inlineImageUrlsForCustomProvider,
23
23
  prepareTools
24
- } from "./chunk-WRN5EQT7.js";
24
+ } from "./chunk-MEZVPVXM.js";
25
25
  import {
26
26
  getAntigravityUserAgent,
27
27
  isAntigravityOAuthAgent,
28
28
  readAntigravityProjectId,
29
29
  resolveAntigravityCloudCodeBaseUrl
30
- } from "./chunk-ISYE6GZB.js";
30
+ } from "./chunk-W3574B3G.js";
31
31
  import {
32
32
  FORCED_TOOLS,
33
33
  addDefaultLightWebToolsForConfiguredAgents,
@@ -47,7 +47,7 @@ import {
47
47
  readXhsProfileFunctionSchema,
48
48
  rememberMemoryFunctionSchema,
49
49
  resolveEffectiveEnabledPacks
50
- } from "./chunk-VE6XMVKG.js";
50
+ } from "./chunk-CT3XKUX4.js";
51
51
  import {
52
52
  createDrainExhaustedResponse,
53
53
  isCoreDrainingBody,
@@ -59,13 +59,13 @@ import {
59
59
  } from "./chunk-OWOHNGCN.js";
60
60
  import {
61
61
  prepareTokenUsageData
62
- } from "./chunk-YNHQIXX5.js";
62
+ } from "./chunk-463YM7CS.js";
63
63
  import {
64
64
  BUILTIN_TITLE_LLM_CONFIG
65
65
  } from "./chunk-V2J635L5.js";
66
66
  import {
67
67
  fetchServerSyncedCredential
68
- } from "./chunk-OQMPU2ML.js";
68
+ } from "./chunk-VOVNQ4YU.js";
69
69
  import {
70
70
  buildAgentRuntimeDialogWritePlan,
71
71
  buildLocalWorkspaceOpenAiTools,
@@ -78,7 +78,7 @@ import {
78
78
  parseSseDataLineJson,
79
79
  readOpenAiCompatibleSseCompletion,
80
80
  resolveOpenAiCompatibleProviderConfig
81
- } from "./chunk-YC3DJILJ.js";
81
+ } from "./chunk-7LFS3UL6.js";
82
82
  import {
83
83
  buildPlatformChatCompletionRequest,
84
84
  canUsePlatformChatProvider,
@@ -88,17 +88,17 @@ import {
88
88
  resolveLegacyDeepSeekProxyChatFallback,
89
89
  resolvePlatformChatProviderConfig,
90
90
  shouldUsePlatformChatProvider
91
- } from "./chunk-WA6KZL5V.js";
91
+ } from "./chunk-ZODEA6YR.js";
92
92
  import {
93
93
  resolveAgentRuntimeConfigFromRecord
94
94
  } from "./chunk-OIQPORYI.js";
95
95
  import {
96
96
  parseToolArgumentsJson,
97
97
  summarizeToolArguments
98
- } from "./chunk-6MHDWKOT.js";
98
+ } from "./chunk-MRDODOWX.js";
99
99
  import {
100
100
  resolvePlatformAuthToken
101
- } from "./chunk-HRQCKQA5.js";
101
+ } from "./chunk-27DJM3CW.js";
102
102
  import {
103
103
  buildLoadSkillExecutor,
104
104
  buildNoloWorkspaceCliToolExecutors,
@@ -2772,25 +2772,38 @@ var CLAUDE_CODE_IDENTITY_PATTERNS = [
2772
2772
  function stringValue(value) {
2773
2773
  return typeof value === "string" && value.length > 0 ? value : void 0;
2774
2774
  }
2775
+ function isCacheControl(value) {
2776
+ return Boolean(
2777
+ value && typeof value === "object" && !Array.isArray(value) && typeof value.type === "string"
2778
+ );
2779
+ }
2775
2780
  function toAnthropicContent(content) {
2776
- if (typeof content === "string") return [{ type: "text", text: content }];
2781
+ if (typeof content === "string") {
2782
+ return content.length > 0 ? [{ type: "text", text: content }] : [];
2783
+ }
2777
2784
  if (!Array.isArray(content)) return [];
2778
2785
  const blocks = [];
2779
2786
  for (const raw of content) {
2780
2787
  if (!raw || typeof raw !== "object") continue;
2781
2788
  const part = raw;
2782
2789
  if ((part.type === "text" || part.type === "input_text") && typeof part.text === "string") {
2783
- blocks.push({ type: "text", text: part.text });
2790
+ if (part.text.length > 0) {
2791
+ const block2 = { type: "text", text: part.text };
2792
+ if (isCacheControl(part.cache_control)) block2.cache_control = part.cache_control;
2793
+ blocks.push(block2);
2794
+ }
2784
2795
  continue;
2785
2796
  }
2786
2797
  if (part.type !== "image_url") continue;
2787
2798
  const imageUrl = typeof part.image_url === "string" ? part.image_url : stringValue(part.image_url?.url);
2788
2799
  if (!imageUrl) continue;
2789
2800
  const dataMatch = imageUrl.match(/^data:([^;,]+);base64,(.+)$/s);
2790
- blocks.push({
2801
+ const block = {
2791
2802
  type: "image",
2792
2803
  source: dataMatch ? { type: "base64", media_type: dataMatch[1], data: dataMatch[2] } : { type: "url", url: imageUrl }
2793
- });
2804
+ };
2805
+ if (isCacheControl(part.cache_control)) block.cache_control = part.cache_control;
2806
+ blocks.push(block);
2794
2807
  }
2795
2808
  return blocks;
2796
2809
  }
@@ -2866,6 +2879,12 @@ function buildAnthropicMessagesBody(args) {
2866
2879
  if (!hasClaudeCodeIdentity(system)) {
2867
2880
  system.unshift({ type: "text", text: CLAUDE_CODE_SYSTEM_INSTRUCTION });
2868
2881
  }
2882
+ if (system.length > 0) {
2883
+ const last = system[system.length - 1];
2884
+ if (!isCacheControl(last.cache_control)) {
2885
+ last.cache_control = { type: "ephemeral" };
2886
+ }
2887
+ }
2869
2888
  const tools = Array.isArray(args.openAiBody.tools) ? args.openAiBody.tools.flatMap((raw) => {
2870
2889
  if (!raw || typeof raw !== "object") return [];
2871
2890
  const fn = raw.function;
@@ -2880,6 +2899,16 @@ function buildAnthropicMessagesBody(args) {
2880
2899
  const model = stringValue(args.openAiBody.model) ?? args.agentConfig.model ?? "claude-sonnet-5";
2881
2900
  const maxTokensRaw = args.openAiBody.max_completion_tokens ?? args.openAiBody.max_tokens ?? args.agentConfig.max_tokens;
2882
2901
  const maxTokens = typeof maxTokensRaw === "number" && Number.isFinite(maxTokensRaw) ? Math.max(1, Math.floor(maxTokensRaw)) : 8192;
2902
+ if (messages.length > 0) {
2903
+ const lastMessage = messages[messages.length - 1];
2904
+ const content = Array.isArray(lastMessage.content) ? lastMessage.content : [];
2905
+ if (content.length > 0) {
2906
+ const lastBlock = content[content.length - 1];
2907
+ if (!isCacheControl(lastBlock.cache_control)) {
2908
+ lastBlock.cache_control = { type: "ephemeral" };
2909
+ }
2910
+ }
2911
+ }
2883
2912
  return {
2884
2913
  model,
2885
2914
  messages,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  buildAgentRuntimeAgentLookupKeys,
3
3
  shouldFetchAgentRuntimeRecordRemotely
4
- } from "./chunk-YC3DJILJ.js";
4
+ } from "./chunk-7LFS3UL6.js";
5
5
 
6
6
  // packages/cli/client/localAgentRecords.ts
7
7
  var buildLocalAgentLookupKeys = buildAgentRuntimeAgentLookupKeys;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  updateContentTitle
3
- } from "./chunk-YNHQIXX5.js";
3
+ } from "./chunk-463YM7CS.js";
4
4
  import {
5
5
  require_date_fns
6
6
  } from "./chunk-M76ECQRD.js";
@@ -367,7 +367,7 @@ async function saveDocState(arg, { dispatch, getState }) {
367
367
  }
368
368
  }
369
369
  async function createDocState(args, thunkApi) {
370
- const { createPageAction } = await import("./createPageAction-4F3ZGQJD.js");
370
+ const { createPageAction } = await import("./createPageAction-35EGISA5.js");
371
371
  return createPageAction(args, thunkApi);
372
372
  }
373
373
  function subscribe(listener) {
@@ -5,10 +5,10 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-WRN5EQT7.js";
8
+ } from "./chunk-MEZVPVXM.js";
9
9
  import {
10
10
  performFetchRequest
11
- } from "./chunk-6565R2TI.js";
11
+ } from "./chunk-3SCCWSA3.js";
12
12
  import {
13
13
  createSSEParser,
14
14
  createToolRunId,
@@ -19,7 +19,7 @@ import {
19
19
  toolRunSetPending,
20
20
  toolRunStarted,
21
21
  toolRunSucceeded
22
- } from "./chunk-VE6XMVKG.js";
22
+ } from "./chunk-CT3XKUX4.js";
23
23
  import {
24
24
  getPublicImageAgentMode
25
25
  } from "./chunk-VIDPVFP3.js";
@@ -29,13 +29,13 @@ import {
29
29
  messageStreaming,
30
30
  selectCurrentSpaceId,
31
31
  updateToolMessage
32
- } from "./chunk-YNHQIXX5.js";
32
+ } from "./chunk-463YM7CS.js";
33
33
  import {
34
34
  streamAgentChatTurn
35
- } from "./chunk-OQMPU2ML.js";
35
+ } from "./chunk-VOVNQ4YU.js";
36
36
  import {
37
37
  EMPTY_ASSISTANT_REPAIR_PROMPT
38
- } from "./chunk-6MHDWKOT.js";
38
+ } from "./chunk-MRDODOWX.js";
39
39
  import {
40
40
  accumulateToolCallDelta,
41
41
  createThinkParserState,
@@ -300,7 +300,7 @@ var slice = createSliceWithThunks({
300
300
  const overrides = {};
301
301
  if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
302
302
  if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
303
- const { _executeModel } = await import("./_executeModel-QAUS6B7J.js");
303
+ const { _executeModel } = await import("./_executeModel-TZUDMB24.js");
304
304
  return _executeModel(
305
305
  {
306
306
  isStreaming: args.isStreaming ?? false,
@@ -321,7 +321,7 @@ var slice = createSliceWithThunks({
321
321
  * - 循环直到无工具调用或触发其他运行时停止条件
322
322
  */
323
323
  runAgent: create.asyncThunk(async (args, thunkApi) => {
324
- const { runAgentClientLoop } = await import("./runAgentClientLoop-A75BUU6D.js");
324
+ const { runAgentClientLoop } = await import("./runAgentClientLoop-ZAZSFAAO.js");
325
325
  const { content: loopContent, toolCallCount } = await runAgentClientLoop(
326
326
  {
327
327
  agentKey: args.agentKey,
@@ -337,7 +337,7 @@ var slice = createSliceWithThunks({
337
337
  * 聊天轮次流式 Agent 调用
338
338
  */
339
339
  streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
340
- const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-DJAE7USZ.js");
340
+ const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-KTDBTZUL.js");
341
341
  return streamAgentChatTurnHandler(args, thunkApi);
342
342
  }),
343
343
  /**