nolo-cli 0.9.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-UD44KGZ4.js → _executeModel-YAXYAUOK.js} +24 -24
  3. package/{action-ZJWE3Y5S.js → action-TLI3V62L.js} +8 -8
  4. package/{addContentAction-TVDBNJM5.js → addContentAction-PLWJSCOZ.js} +7 -7
  5. package/{addDialogAgentAction-EKH774VT.js → addDialogAgentAction-BJ6SB76X.js} +6 -6
  6. package/{agentDeleteCommand-TCPEFJTF.js → agentDeleteCommand-2VYX73U5.js} +6 -6
  7. package/{agentEmailCommands-CZ3UILZ4.js → agentEmailCommands-3GDZIX64.js} +27 -27
  8. package/{agentListCommands-SJKO2FFB.js → agentListCommands-UWVBT3LH.js} +7 -7
  9. package/{agentMachineCommands-PSNABISZ.js → agentMachineCommands-WOKMUG2Y.js} +6 -6
  10. package/{agentRecordCommands-MH2JKFHS.js → agentRecordCommands-MVNZRH3U.js} +27 -27
  11. package/{agentRunCommand-4KH6MIZR.js → agentRunCommand-K7THIJLA.js} +30 -28
  12. package/{agentRuntimeLocal-SKHJUWSS.js → agentRuntimeLocal-WJIGU24U.js} +3 -3
  13. package/{agentSlice-3WXXN4VK.js → agentSlice-LL5TKZEO.js} +7 -7
  14. package/{authCommand-PXFX6JDT.js → authCommand-TC2SW2CQ.js} +2 -2
  15. package/{authCommands-356AYWEK.js → authCommands-XPEHTKSM.js} +2 -2
  16. package/{chunk-CPB2YM4D.js → chunk-2O4IZNTG.js} +1 -1
  17. package/{chunk-KOCA5FCS.js → chunk-3Y3HW5PX.js} +89 -30
  18. package/{chunk-TSS3XJY4.js → chunk-4SIMLBEU.js} +5 -5
  19. package/{chunk-MGOJ5R6J.js → chunk-5JGGZCZL.js} +2 -2
  20. package/{chunk-7QRKCBOP.js → chunk-6JJWFVZ6.js} +3 -3
  21. package/{chunk-YBWOP46I.js → chunk-6KUOUWMP.js} +2 -2
  22. package/{chunk-XS466O7S.js → chunk-6SLCD4RB.js} +55 -20
  23. package/{chunk-KTVVPRJS.js → chunk-7KNKFIRO.js} +4 -4
  24. package/{chunk-2EISRLRC.js → chunk-7U44LYTR.js} +2 -2
  25. package/{chunk-6GANEXVO.js → chunk-A67QFHAA.js} +1 -1
  26. package/{chunk-XKIMRZO2.js → chunk-AS4PVWA4.js} +1 -1
  27. package/{chunk-COMXDWNM.js → chunk-BE2OOJ5P.js} +7 -7
  28. package/{chunk-2PUGVR6E.js → chunk-CDTLMEB3.js} +1 -1
  29. package/{chunk-GG4AJPSR.js → chunk-CL3IOKGK.js} +2 -2
  30. package/{chunk-ELRRLDWI.js → chunk-DSZUWUYB.js} +2 -2
  31. package/{chunk-LARL2V6G.js → chunk-EXXFGKF7.js} +84 -29
  32. package/{chunk-3WYQEUBI.js → chunk-HFASY3WO.js} +1 -1
  33. package/{chunk-PG5PNA7Y.js → chunk-HJGEVL7C.js} +5 -5
  34. package/{chunk-3TZDXYSF.js → chunk-HNW7IJSK.js} +1 -1
  35. package/{chunk-4K2KKCSD.js → chunk-I5URP43I.js} +8 -12
  36. package/{chunk-63SLEOLK.js → chunk-KBKYAONQ.js} +4 -4
  37. package/{chunk-PCWC3JTN.js → chunk-MTU75CZ2.js} +1 -1
  38. package/{chunk-5PJ3VWCS.js → chunk-NPVBXJY2.js} +3 -9
  39. package/{chunk-SH2CFQOH.js → chunk-O4BU24WZ.js} +2 -181
  40. package/chunk-OOSFSFMA.js +271 -0
  41. package/{chunk-7OOXPE3N.js → chunk-OR2XR25C.js} +2 -2
  42. package/{chunk-XE635NI4.js → chunk-OZMMKDBI.js} +11 -11
  43. package/{chunk-ZIG5LJ7X.js → chunk-PIVFPOW6.js} +54 -2294
  44. package/{chunk-2K2ECKSG.js → chunk-QAALPJS7.js} +2 -2
  45. package/{chunk-YYUCRDOK.js → chunk-SOTZ6RDN.js} +1 -1
  46. package/{chunk-G43KEVSC.js → chunk-T7R3NGUU.js} +3 -3
  47. package/{chunk-SBR32ZZS.js → chunk-TNPIMII7.js} +7 -7
  48. package/{chunk-MKMWT7SA.js → chunk-TYSCFY6S.js} +20 -20
  49. package/{chunk-EYEEHCU4.js → chunk-UTLZINAP.js} +1 -1
  50. package/{chunk-EXTIQUCI.js → chunk-VVX233PH.js} +1 -1
  51. package/{chunk-WKM6FH35.js → chunk-WPE4F4Z6.js} +1 -1
  52. package/{chunk-Q2YZULBH.js → chunk-XENYHRUE.js} +1 -1
  53. package/{chunk-UUJDGGAK.js → chunk-YIHFXH5Q.js} +3 -3
  54. package/{createAgentAutomationAction-63OIP6X5.js → createAgentAutomationAction-CCE7CWGQ.js} +13 -13
  55. package/{createDialogAction-ZLYZDYBB.js → createDialogAction-QTRR4AT7.js} +15 -15
  56. package/{createPageAction-AL5FSDCK.js → createPageAction-Y4KQOAJE.js} +13 -13
  57. package/{dbSlice-PR44QPXY.js → dbSlice-WWNV2SGX.js} +6 -6
  58. package/{deleteFile-4SKGPHOZ.js → deleteFile-OW53A6BX.js} +3 -3
  59. package/{dialogCommands-F6YI5742.js → dialogCommands-SMKIAC3Y.js} +8 -8
  60. package/{dialogSlice-JSBNZRLR.js → dialogSlice-PT7YBWNE.js} +13 -13
  61. package/{docCreateCommands-4CTO7ERT.js → docCreateCommands-RFNA4HNM.js} +6 -6
  62. package/{docDeleteCommands-VBWERDRG.js → docDeleteCommands-4YZ325M6.js} +7 -7
  63. package/{docReadCommands-KNP4MFYB.js → docReadCommands-RT6VAFFG.js} +6 -6
  64. package/{docStore-ADP5VYY4.js → docStore-QUQZAFZF.js} +14 -14
  65. package/{docUpdateCommands-4BCBJQHA.js → docUpdateCommands-EKKKNYPW.js} +6 -6
  66. package/{fetchMessages-U6ZHN56A.js → fetchMessages-KTNM7QAR.js} +2 -2
  67. package/{handleSendMessageAction-IJDQ6ARA.js → handleSendMessageAction-5NSYAS53.js} +13 -13
  68. package/index.js +55 -55
  69. package/{localDialogRead-Z5UTAJPU.js → localDialogRead-2VRI24F4.js} +1 -1
  70. package/{machineCommands-EA3M4XTN.js → machineCommands-DOOSIUKG.js} +26 -26
  71. package/{machineWsRunDispatch-NAPKE5ZA.js → machineWsRunDispatch-PIOIQRBW.js} +26 -26
  72. package/package.json +4 -2
  73. package/{read-RIJCIVKX.js → read-GW7ZEI23.js} +3 -3
  74. package/{readDocTool-GZD2N3LO.js → readDocTool-HUFU6OCT.js} +1 -1
  75. package/{readlineWorkspace-KMWT4T4S.js → readlineWorkspace-QEAOH5EP.js} +45 -40
  76. package/{removeDialogAgentAction-GJQJNDW6.js → removeDialogAgentAction-OHMCNSSD.js} +8 -8
  77. package/{runAgentClientLoop-U5Q6NDTJ.js → runAgentClientLoop-AIGLXC3R.js} +21 -21
  78. package/{setDialogExtraReferencesAction-M7OQG54N.js → setDialogExtraReferencesAction-YJUM5BWQ.js} +6 -6
  79. package/{setPrimaryDialogAgentAction-46UNFJDL.js → setPrimaryDialogAgentAction-EBAREZDM.js} +8 -8
  80. package/{settingSlice-FVUUH4JA.js → settingSlice-UW4IUI5L.js} +7 -7
  81. package/{spaceCommands-E2CFRPZJ.js → spaceCommands-BKHSPR73.js} +10 -14
  82. package/{spaceSlice-L3R6IMXE.js → spaceSlice-TYNWE3OC.js} +13 -13
  83. package/{streamAgentChatTurn-UBDAOQWE.js → streamAgentChatTurn-HRMFFA7E.js} +24 -24
  84. package/{tableCommands-GOFP7QKA.js → tableCommands-O7O2LBEG.js} +1 -1
  85. package/{tools-TMJXZTCA.js → tools-3JNDS3WH.js} +19 -19
  86. package/{understanding-GQKNDDWM.js → understanding-3CUQQ6SV.js} +3 -3
  87. package/{updateDialogTitleAction-ZTWRDXI2.js → updateDialogTitleAction-OCETSKCP.js} +13 -13
  88. package/chunk-QYXLLLGL.js +0 -4519
@@ -624,6 +624,37 @@ function extractUserInputText(content) {
624
624
  if (!Array.isArray(content)) return "";
625
625
  return content.flatMap((part) => part?.type === "text" && part.text ? [part.text] : []).join("\n").trim();
626
626
  }
627
+ function attachDialogIdToError(error, dialogId) {
628
+ if (!dialogId) return;
629
+ if (typeof error === "object" && error !== null) {
630
+ error.dialogId = dialogId;
631
+ }
632
+ }
633
+ async function persistFailedLocalTurn(args) {
634
+ const errorMessage = toErrorMessage(args.error);
635
+ try {
636
+ const saved = await args.adapter.saveTurn({
637
+ agentKey: args.agentKey,
638
+ messages: args.messages,
639
+ result: {
640
+ content: args.partialContent || `[nolo] Agent run failed: ${errorMessage}`,
641
+ model: args.model ?? "unknown",
642
+ toolCallCount: args.toolCallCount ?? 0,
643
+ error: true,
644
+ errorMessage
645
+ },
646
+ ...args.input.runtimeContext ? { runtimeContext: args.input.runtimeContext } : {},
647
+ ...args.input.continueDialogId ? { continueDialogId: args.input.continueDialogId } : {},
648
+ ...args.input.spaceId ? { spaceId: args.input.spaceId } : {},
649
+ ...args.input.category ? { category: args.input.category } : {},
650
+ ...args.input.inheritedFromDialogKey ? { inheritedFromDialogKey: args.input.inheritedFromDialogKey } : {},
651
+ ...args.input.parentDialogId ? { parentDialogId: args.input.parentDialogId } : {}
652
+ });
653
+ return saved?.dialogId;
654
+ } catch {
655
+ return args.input.continueDialogId;
656
+ }
657
+ }
627
658
  async function runLocalAgentTurn(input) {
628
659
  const agentConfig = await input.adapter.loadAgentConfig(input.agentRef);
629
660
  if (!agentConfig) {
@@ -632,7 +663,21 @@ async function runLocalAgentTurn(input) {
632
663
  error.agentRef = input.agentRef;
633
664
  throw error;
634
665
  }
635
- const history = input.continueDialogId ? await input.adapter.loadDialogHistory(input.continueDialogId) : [];
666
+ let history = [];
667
+ try {
668
+ history = input.continueDialogId ? await input.adapter.loadDialogHistory(input.continueDialogId) : [];
669
+ } catch (error) {
670
+ const dialogId = await persistFailedLocalTurn({
671
+ adapter: input.adapter,
672
+ agentKey: agentConfig.key,
673
+ messages: [{ role: "user", content: input.input }],
674
+ error,
675
+ model: agentConfig.model,
676
+ input
677
+ });
678
+ attachDialogIdToError(error, dialogId);
679
+ throw error;
680
+ }
636
681
  const identityBlock = buildIdentityBlock({
637
682
  agentName: agentConfig.name,
638
683
  agentId: agentConfig.key,
@@ -669,7 +714,6 @@ async function runLocalAgentTurn(input) {
669
714
  history,
670
715
  input: input.input
671
716
  });
672
- const provider = await input.adapter.resolveProvider(agentConfig);
673
717
  const supportsImages = resolveAgentImageInputSupport({
674
718
  apiSource: agentConfig.apiSource,
675
719
  provider: agentConfig.provider,
@@ -688,6 +732,7 @@ async function runLocalAgentTurn(input) {
688
732
  let skipFinalAppend = false;
689
733
  let partialContent = "";
690
734
  try {
735
+ const provider = await input.adapter.resolveProvider(agentConfig);
691
736
  while (true) {
692
737
  partialContent = "";
693
738
  throwIfAborted(input);
@@ -858,28 +903,18 @@ async function runLocalAgentTurn(input) {
858
903
  loopError = error;
859
904
  }
860
905
  if (loopError) {
861
- const errorMessage = toErrorMessage(loopError);
862
906
  const turnMessages2 = messages.slice(turnStartIndex);
863
- const saved2 = await input.adapter.saveTurn({
907
+ const dialogId = await persistFailedLocalTurn({
908
+ adapter: input.adapter,
864
909
  agentKey: agentConfig.key,
865
910
  messages: turnMessages2,
866
- result: {
867
- content: partialContent || `[nolo] Agent run failed: ${errorMessage}`,
868
- model: agentConfig.model ?? "unknown",
869
- toolCallCount,
870
- error: true,
871
- errorMessage
872
- },
873
- ...input.runtimeContext ? { runtimeContext: input.runtimeContext } : {},
874
- ...input.continueDialogId ? { continueDialogId: input.continueDialogId } : {},
875
- ...input.spaceId ? { spaceId: input.spaceId } : {},
876
- ...input.category ? { category: input.category } : {},
877
- ...input.inheritedFromDialogKey ? { inheritedFromDialogKey: input.inheritedFromDialogKey } : {},
878
- ...input.parentDialogId ? { parentDialogId: input.parentDialogId } : {}
911
+ error: loopError,
912
+ model: agentConfig.model,
913
+ toolCallCount,
914
+ partialContent,
915
+ input
879
916
  });
880
- if (saved2?.dialogId && typeof loopError === "object" && loopError !== null) {
881
- loopError.dialogId = saved2.dialogId;
882
- }
917
+ attachDialogIdToError(loopError, dialogId);
883
918
  throw loopError;
884
919
  }
885
920
  result = result;
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  selectCurrentServer
3
- } from "./chunk-TSS3XJY4.js";
3
+ } from "./chunk-4SIMLBEU.js";
4
4
  import {
5
5
  patch
6
- } from "./chunk-COMXDWNM.js";
6
+ } from "./chunk-BE2OOJ5P.js";
7
7
  import {
8
8
  selectIdentityToken
9
- } from "./chunk-EYEEHCU4.js";
9
+ } from "./chunk-UTLZINAP.js";
10
10
  import {
11
11
  getIsDesktopApp
12
- } from "./chunk-QYXLLLGL.js";
12
+ } from "./chunk-OOSFSFMA.js";
13
13
 
14
14
  // packages/ai/agent/cliChatClient.ts
15
15
  function getCliChatRequestConfig(thunkApi) {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getRuntimeServerContext,
3
3
  scheduleDeleteReplication
4
- } from "./chunk-EYEEHCU4.js";
4
+ } from "./chunk-UTLZINAP.js";
5
5
  import {
6
6
  fetchFromClientDb
7
- } from "./chunk-QYXLLLGL.js";
7
+ } from "./chunk-OOSFSFMA.js";
8
8
  import {
9
9
  buildTombstoneRecord
10
10
  } from "./chunk-GBRG75BQ.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_AGENT_BASE_POLICY,
3
3
  DEFAULT_USER_PREFERENCE_PROFILE
4
- } from "./chunk-TSS3XJY4.js";
4
+ } from "./chunk-4SIMLBEU.js";
5
5
 
6
6
  // packages/ai/policy/runtimePolicy.ts
7
7
  var clampLevel = (value, fallback) => {
@@ -199,7 +199,7 @@ async function readDocFunc(args, thunkApi) {
199
199
  throw new Error(`\u65E0\u6548\u7684\u9875\u9762 ID: ${id}\u3002\u9875\u9762 ID \u901A\u5E38\u4EE5 "page-" \u5F00\u5934\u3002`);
200
200
  }
201
201
  try {
202
- const { readAction } = await import("./read-RIJCIVKX.js");
202
+ const { readAction } = await import("./read-GW7ZEI23.js");
203
203
  const pageData = await readAction({ dbKey: id }, thunkApi);
204
204
  if (!pageData) {
205
205
  throw new Error(`\u672A\u627E\u5230 ID \u4E3A ${id} \u7684\u9875\u9762\u3002`);
@@ -5,17 +5,17 @@ import {
5
5
  loadFileFromIndexedDb,
6
6
  removeAction,
7
7
  saveFileToIndexedDb
8
- } from "./chunk-2EISRLRC.js";
8
+ } from "./chunk-7U44LYTR.js";
9
9
  import {
10
10
  fileKey,
11
11
  getFileIdFromKey,
12
12
  ulid
13
- } from "./chunk-SH2CFQOH.js";
13
+ } from "./chunk-O4BU24WZ.js";
14
14
  import {
15
15
  readAction,
16
16
  readRequestManager,
17
17
  resolveAgentReadServers
18
- } from "./chunk-ELRRLDWI.js";
18
+ } from "./chunk-DSZUWUYB.js";
19
19
  import {
20
20
  asyncThunkCreator,
21
21
  buildCreateSlice,
@@ -35,13 +35,13 @@ import {
35
35
  shouldReplaceLocalWithRemoteRecord,
36
36
  shouldReplicateLocalRecord,
37
37
  uploadToCurrentServer
38
- } from "./chunk-EYEEHCU4.js";
38
+ } from "./chunk-UTLZINAP.js";
39
39
  import {
40
40
  fetchFromClientDb,
41
41
  fetchFromServer,
42
42
  logger,
43
43
  normalizeTimeFields
44
- } from "./chunk-QYXLLLGL.js";
44
+ } from "./chunk-OOSFSFMA.js";
45
45
  import {
46
46
  isTombstoneRecord
47
47
  } from "./chunk-GBRG75BQ.js";
@@ -674,7 +674,7 @@ var dbSlice = createSliceWithThunks({
674
674
  // 动态 import 在调用期解析,避开 TDZ/求值顺序问题(同下方 share)。
675
675
  read: create.asyncThunk(
676
676
  async (payload, thunkApi) => {
677
- const { readAction: readAction2 } = await import("./read-RIJCIVKX.js");
677
+ const { readAction: readAction2 } = await import("./read-GW7ZEI23.js");
678
678
  return readAction2(payload, thunkApi);
679
679
  },
680
680
  {
@@ -748,7 +748,7 @@ var dbSlice = createSliceWithThunks({
748
748
  // 这里改成动态 import,运行期才解析,彻底断开这条边。
749
749
  share: create.asyncThunk(
750
750
  async (config, thunkApi) => {
751
- const { shareResourceAction } = await import("./action-ZJWE3Y5S.js");
751
+ const { shareResourceAction } = await import("./action-TLI3V62L.js");
752
752
  return shareResourceAction(config, thunkApi);
753
753
  }
754
754
  ),
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  buildAgentRuntimeAgentLookupKeys,
3
3
  shouldFetchAgentRuntimeRecordRemotely
4
- } from "./chunk-YBWOP46I.js";
4
+ } from "./chunk-6KUOUWMP.js";
5
5
 
6
6
  // packages/cli/client/localAgentRecords.ts
7
7
  var buildLocalAgentLookupKeys = buildAgentRuntimeAgentLookupKeys;
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  listUserRecordsFromServers,
3
3
  readLiveDbRecordAfterTombstoneMerge
4
- } from "./chunk-WKM6FH35.js";
4
+ } from "./chunk-WPE4F4Z6.js";
5
5
  import {
6
6
  agentRecordHasConfiguredCredential
7
- } from "./chunk-7OOXPE3N.js";
7
+ } from "./chunk-OR2XR25C.js";
8
8
 
9
9
  // packages/cli/agentListHelpers.ts
10
10
  function parseAgentRecordId(privateKey, explicitId) {
@@ -7,14 +7,14 @@ import {
7
7
  scheduleExistingRecordReplication,
8
8
  shouldReplaceLocalWithRemoteRecord,
9
9
  shouldReplicateLocalRecord
10
- } from "./chunk-EYEEHCU4.js";
10
+ } from "./chunk-UTLZINAP.js";
11
11
  import {
12
12
  fetchFromClientDb,
13
13
  fetchFromServer,
14
14
  isAbortError,
15
15
  isReadTimeoutError,
16
16
  logger
17
- } from "./chunk-QYXLLLGL.js";
17
+ } from "./chunk-OOSFSFMA.js";
18
18
  import {
19
19
  shouldReplaceWithNextRecord
20
20
  } from "./chunk-GBRG75BQ.js";
@@ -8,7 +8,7 @@ import {
8
8
  buildLocalAgentLookupKeys,
9
9
  normalizeAgentHandle,
10
10
  shouldReadAgentKeyRemotely
11
- } from "./chunk-2PUGVR6E.js";
11
+ } from "./chunk-CDTLMEB3.js";
12
12
  import {
13
13
  LOCAL_CODEX_AGENT_ID,
14
14
  LOCAL_CODEX_AGENT_KEY,
@@ -17,7 +17,7 @@ import {
17
17
  } from "./chunk-VHBWHNVT.js";
18
18
  import {
19
19
  inferCaptureIntent
20
- } from "./chunk-6GANEXVO.js";
20
+ } from "./chunk-A67QFHAA.js";
21
21
  import {
22
22
  CliProviderQuotaError,
23
23
  executeCli
@@ -27,7 +27,7 @@ import {
27
27
  } from "./chunk-ATNTHIZI.js";
28
28
  import {
29
29
  prepareTools
30
- } from "./chunk-CPB2YM4D.js";
30
+ } from "./chunk-2O4IZNTG.js";
31
31
  import {
32
32
  getAntigravityUserAgent,
33
33
  isAntigravityOAuthAgent,
@@ -43,7 +43,7 @@ import {
43
43
  readXPostFunctionSchema,
44
44
  readXhsProfileFunc,
45
45
  readXhsProfileFunctionSchema
46
- } from "./chunk-MKMWT7SA.js";
46
+ } from "./chunk-TYSCFY6S.js";
47
47
  import {
48
48
  normalizeDialogTitle
49
49
  } from "./chunk-OWOHNGCN.js";
@@ -52,7 +52,7 @@ import {
52
52
  } from "./chunk-4ZDM73SD.js";
53
53
  import {
54
54
  fetchServerSyncedCredential
55
- } from "./chunk-4K2KKCSD.js";
55
+ } from "./chunk-I5URP43I.js";
56
56
  import {
57
57
  isCompiledBinary,
58
58
  parseUserIdFromAuthToken
@@ -73,7 +73,7 @@ import {
73
73
  parseSseDataLineJson,
74
74
  readOpenAiCompatibleSseCompletion,
75
75
  resolveOpenAiCompatibleProviderConfig
76
- } from "./chunk-YBWOP46I.js";
76
+ } from "./chunk-6KUOUWMP.js";
77
77
  import {
78
78
  buildPlatformChatCompletionRequest,
79
79
  canUsePlatformChatProvider,
@@ -89,7 +89,7 @@ import {
89
89
  import {
90
90
  parseToolArgumentsJson,
91
91
  summarizeToolArguments
92
- } from "./chunk-XS466O7S.js";
92
+ } from "./chunk-6SLCD4RB.js";
93
93
  import {
94
94
  buildNoloWorkspaceCliToolExecutors,
95
95
  buildNoloWorkspaceOpenAiTools,
@@ -123,9 +123,8 @@ import {
123
123
  asRecordOrEmpty
124
124
  } from "./chunk-KX6YBIHG.js";
125
125
  import {
126
- dialogMessageRange,
127
- require_index_umd
128
- } from "./chunk-SH2CFQOH.js";
126
+ dialogMessageRange
127
+ } from "./chunk-O4BU24WZ.js";
129
128
  import {
130
129
  asTrimmedNonEmptyStringArray
131
130
  } from "./chunk-I42VC5KR.js";
@@ -139,7 +138,7 @@ import {
139
138
  PUBLIC_GLM_52_AGENT_KEY,
140
139
  PUBLIC_KIMI_K26_IMAGE_AGENT_KEY,
141
140
  PUBLIC_KIMI_K27_CODING_AGENT_KEY
142
- } from "./chunk-ELRRLDWI.js";
141
+ } from "./chunk-DSZUWUYB.js";
143
142
  import {
144
143
  isLoopbackHostname
145
144
  } from "./chunk-4SN6J65J.js";
@@ -158,9 +157,6 @@ import {
158
157
  import {
159
158
  isRecord
160
159
  } from "./chunk-KUG52IAP.js";
161
- import {
162
- __toESM
163
- } from "./chunk-4VNS5WPM.js";
164
160
 
165
161
  // packages/cli/client/localRuntimeAdapter.ts
166
162
  import { dirname, extname, join } from "node:path";
@@ -6329,6 +6325,24 @@ var CURSOR_CLIENT_VERSION = "cli-2026.01.09-231024f";
6329
6325
  var CURSOR_REQUEST_PATH = "/agent.v1.AgentService/Run";
6330
6326
  var CONNECT_END_STREAM_FLAG = 2;
6331
6327
  var HEARTBEAT_INTERVAL_MS = 5e3;
6328
+ var CURSOR_WIRE_MODEL_ALIASES = {
6329
+ // First-party — Cursor Models pool
6330
+ "cursor-grok-4.5": "cursor-grok-4.5-high",
6331
+ "cursor-grok-4.5-fast": "cursor-grok-4.5-high-fast",
6332
+ "grok-4.5": "cursor-grok-4.5-high",
6333
+ "grok-4.5-fast": "cursor-grok-4.5-high-fast",
6334
+ "cursor-composer-2.5": "composer-2.5-fast",
6335
+ "composer-2.5": "composer-2.5",
6336
+ // Third-party convenience aliases we previously published in the registry
6337
+ "cursor-claude-4.6-sonnet": "claude-4.6-sonnet-medium",
6338
+ "cursor-claude-4.6-opus": "claude-4.6-opus-high",
6339
+ "cursor-gemini-3.1-pro": "gemini-3.1-pro"
6340
+ };
6341
+ function resolveCursorWireModelId(model) {
6342
+ const trimmed = model.trim();
6343
+ if (!trimmed) return trimmed;
6344
+ return CURSOR_WIRE_MODEL_ALIASES[trimmed] ?? trimmed;
6345
+ }
6332
6346
  function createBlobId(data) {
6333
6347
  return new Uint8Array(createHash("sha256").update(data).digest());
6334
6348
  }
@@ -6624,11 +6638,11 @@ function buildCursorRunRequestBytes(args) {
6624
6638
  selfSummaryCount: 0,
6625
6639
  readPaths: []
6626
6640
  });
6627
- const wireModelId = args.model;
6641
+ const wireModelId = resolveCursorWireModelId(args.model);
6628
6642
  const modelDetails = create(ModelDetailsSchema, {
6629
6643
  modelId: wireModelId,
6630
- displayModelId: args.model,
6631
- displayName: args.model
6644
+ displayModelId: wireModelId,
6645
+ displayName: wireModelId
6632
6646
  });
6633
6647
  const requestedModel = create(RequestedModelSchema, {
6634
6648
  modelId: wireModelId,
@@ -6901,6 +6915,7 @@ function toolResultText(result) {
6901
6915
  function toolResultIsError(result) {
6902
6916
  const meta = result.metadata;
6903
6917
  if (!meta) return false;
6918
+ if (meta.error === true) return true;
6904
6919
  if (typeof meta.error === "string" && meta.error.length > 0) return true;
6905
6920
  if (typeof meta.exitCode === "number" && meta.exitCode !== 0) return true;
6906
6921
  if (typeof meta.reason === "string" && meta.reason === "error") return true;
@@ -7207,6 +7222,28 @@ function synthesizeCursorExecToolCall(ctx, toolCallId, toolName, args) {
7207
7222
  ctx.blocks.push(block);
7208
7223
  return block;
7209
7224
  }
7225
+ function toErrorMessage2(e) {
7226
+ if (e instanceof Error) return e.message;
7227
+ if (typeof e === "string") return e;
7228
+ try {
7229
+ return JSON.stringify(e);
7230
+ } catch {
7231
+ return String(e);
7232
+ }
7233
+ }
7234
+ function fillToolCallBlockError(toolCallBlock, error, extras) {
7235
+ const message = toErrorMessage2(error);
7236
+ const result = {
7237
+ content: message,
7238
+ metadata: {
7239
+ error: true,
7240
+ message,
7241
+ ...extras ?? {}
7242
+ }
7243
+ };
7244
+ toolCallBlock.result = result;
7245
+ return result;
7246
+ }
7210
7247
  function decodeMcpArgValue(value) {
7211
7248
  try {
7212
7249
  const parsed = fromBinary(ValueSchema, value);
@@ -7288,6 +7325,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
7288
7325
  ...toolResult.metadata ? { metadata: toolResult.metadata } : {}
7289
7326
  });
7290
7327
  } catch (e) {
7328
+ fillToolCallBlockError(toolCallBlock, e);
7291
7329
  result = create(ReadResultSchema, {
7292
7330
  result: {
7293
7331
  case: "error",
@@ -7303,6 +7341,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
7303
7341
  });
7304
7342
  }
7305
7343
  } else {
7344
+ fillToolCallBlockError(toolCallBlock, "Tool execution not configured", { reason: "rejected" });
7306
7345
  result = create(ReadResultSchema, {
7307
7346
  result: {
7308
7347
  case: "rejected",
@@ -7356,6 +7395,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
7356
7395
  ...toolResult.metadata ? { metadata: toolResult.metadata } : {}
7357
7396
  });
7358
7397
  } catch (e) {
7398
+ fillToolCallBlockError(toolCallBlock, e);
7359
7399
  result = create(ShellResultSchema, {
7360
7400
  result: {
7361
7401
  case: "failure",
@@ -7380,6 +7420,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
7380
7420
  });
7381
7421
  }
7382
7422
  } else {
7423
+ fillToolCallBlockError(toolCallBlock, "Tool execution not configured", { reason: "rejected" });
7383
7424
  result = create(ShellResultSchema, {
7384
7425
  result: {
7385
7426
  case: "rejected",
@@ -7455,6 +7496,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
7455
7496
  ...toolResult.metadata ? { metadata: toolResult.metadata } : {}
7456
7497
  });
7457
7498
  } catch (e) {
7499
+ fillToolCallBlockError(toolCallBlock, e);
7458
7500
  result = create(GrepResultSchema, {
7459
7501
  result: {
7460
7502
  case: "error",
@@ -7470,6 +7512,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
7470
7512
  });
7471
7513
  }
7472
7514
  } else {
7515
+ fillToolCallBlockError(toolCallBlock, "Tool execution not configured", { reason: "rejected" });
7473
7516
  result = create(GrepResultSchema, {
7474
7517
  result: {
7475
7518
  case: "error",
@@ -7516,6 +7559,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
7516
7559
  ...toolResult.metadata ? { metadata: toolResult.metadata } : {}
7517
7560
  });
7518
7561
  } catch (e) {
7562
+ fillToolCallBlockError(toolCallBlock, e);
7519
7563
  result = create(WriteResultSchema, {
7520
7564
  result: {
7521
7565
  case: "error",
@@ -7531,6 +7575,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
7531
7575
  });
7532
7576
  }
7533
7577
  } else {
7578
+ fillToolCallBlockError(toolCallBlock, "Tool execution not configured", { reason: "rejected" });
7534
7579
  result = create(WriteResultSchema, {
7535
7580
  result: {
7536
7581
  case: "rejected",
@@ -7573,6 +7618,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
7573
7618
  ...toolResult.metadata ? { metadata: toolResult.metadata } : {}
7574
7619
  });
7575
7620
  } catch (e) {
7621
+ fillToolCallBlockError(toolCallBlock, e);
7576
7622
  result = create(DeleteResultSchema, {
7577
7623
  result: {
7578
7624
  case: "error",
@@ -7588,6 +7634,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
7588
7634
  });
7589
7635
  }
7590
7636
  } else {
7637
+ fillToolCallBlockError(toolCallBlock, "Tool execution not configured", { reason: "rejected" });
7591
7638
  result = create(DeleteResultSchema, {
7592
7639
  result: {
7593
7640
  case: "rejected",
@@ -7630,6 +7677,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
7630
7677
  ...toolResult.metadata ? { metadata: toolResult.metadata } : {}
7631
7678
  });
7632
7679
  } catch (e) {
7680
+ fillToolCallBlockError(toolCallBlock, e);
7633
7681
  result = create(LsResultSchema, {
7634
7682
  result: {
7635
7683
  case: "error",
@@ -7645,6 +7693,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
7645
7693
  });
7646
7694
  }
7647
7695
  } else {
7696
+ fillToolCallBlockError(toolCallBlock, "Tool execution not configured", { reason: "rejected" });
7648
7697
  result = create(LsResultSchema, {
7649
7698
  result: {
7650
7699
  case: "rejected",
@@ -7691,6 +7740,7 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
7691
7740
  ...toolResult.metadata ? { metadata: toolResult.metadata } : {}
7692
7741
  });
7693
7742
  } catch (e) {
7743
+ fillToolCallBlockError(toolCallBlock, e);
7694
7744
  result = create(McpResultSchema, {
7695
7745
  result: {
7696
7746
  case: "error",
@@ -7706,6 +7756,10 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
7706
7756
  });
7707
7757
  }
7708
7758
  } else {
7759
+ fillToolCallBlockError(toolCallBlock, `Tool not found: ${toolName}`, {
7760
+ reason: "toolNotFound",
7761
+ toolName
7762
+ });
7709
7763
  result = buildMcpToolNotFoundResult(toolName);
7710
7764
  }
7711
7765
  sendExecClientMessage(h2Request, execMsg, "mcpResult", result);
@@ -7717,15 +7771,6 @@ async function handleExecServerMessage(execMsg, h2Request, ctx) {
7717
7771
  }
7718
7772
  }
7719
7773
  }
7720
- function toErrorMessage2(e) {
7721
- if (e instanceof Error) return e.message;
7722
- if (typeof e === "string") return e;
7723
- try {
7724
- return JSON.stringify(e);
7725
- } catch {
7726
- return String(e);
7727
- }
7728
- }
7729
7774
  function clipArgumentsPreview(toolName, rawArgs) {
7730
7775
  return summarizeToolArguments(toolName, rawArgs);
7731
7776
  }
@@ -7976,7 +8021,7 @@ function createCliHybridRecordStore(deps) {
7976
8021
  }
7977
8022
 
7978
8023
  // packages/cli/client/localRuntimeAdapter.ts
7979
- var import_ulid = __toESM(require_index_umd(), 1);
8024
+ import { ulid } from "ulid";
7980
8025
  var resolveRuntimeAuthToken2 = resolveRuntimeAuthToken;
7981
8026
  var currentMetaFile = fileURLToPath(import.meta.url);
7982
8027
  var isJsBundle = extname(currentMetaFile) === ".js";
@@ -7999,7 +8044,7 @@ async function defaultLocalRuntimeDb() {
7999
8044
  return getDefaultCliLocalRuntimeDb();
8000
8045
  }
8001
8046
  function createFallbackId() {
8002
- return (0, import_ulid.ulid)();
8047
+ return ulid();
8003
8048
  }
8004
8049
  function logLocalRuntimeDiagnostic(event, fields) {
8005
8050
  if (process.env.NOLO_LOCAL_RUNTIME_DEBUG !== "1" && process.env.NOLO_DEBUG !== "1") {
@@ -8870,8 +8915,18 @@ function createCliLocalRuntimeAdapter(deps) {
8870
8915
  if (!res.ok) {
8871
8916
  const raw2 = await res.text().catch(() => "");
8872
8917
  const data2 = parsePlatformChatCompletionData(raw2);
8918
+ const rawPreview = raw2.length > 200 ? `${raw2.slice(0, 200)}\u2026(${raw2.length}b)` : raw2;
8919
+ const gatewayHeaders = [
8920
+ "server",
8921
+ "cf-ray",
8922
+ "cf-cache-status",
8923
+ "content-length"
8924
+ ].map((h) => {
8925
+ const v = res.headers.get(h);
8926
+ return v ? `${h}=${v}` : null;
8927
+ }).filter(Boolean).join(" ");
8873
8928
  throw new Error(
8874
- `platform provider failed: HTTP ${res.status} ${JSON.stringify(data2)}`
8929
+ `platform provider failed: HTTP ${res.status} ${JSON.stringify(data2)}` + (rawPreview ? ` raw="${rawPreview}"` : "") + (gatewayHeaders ? ` headers=[${gatewayHeaders}]` : "")
8875
8930
  );
8876
8931
  }
8877
8932
  const contentType = res.headers.get("content-type") ?? "";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-SBR32ZZS.js";
4
+ } from "./chunk-TNPIMII7.js";
5
5
 
6
6
  // packages/ai/agent/fetchAgentContexts.ts
7
7
  async function fetchAgentContexts(references, dispatch) {
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  chooseMemoryOwners,
3
3
  loadMemoryCandidatesFromDb
4
- } from "./chunk-Q2YZULBH.js";
4
+ } from "./chunk-XENYHRUE.js";
5
5
  import {
6
6
  addContentToSpace,
7
7
  prepareAndPersistMessage,
8
8
  uiAskChoiceFunc,
9
9
  uiAskChoiceFunctionSchema
10
- } from "./chunk-ZIG5LJ7X.js";
10
+ } from "./chunk-PIVFPOW6.js";
11
11
  import {
12
12
  require_date_fns
13
13
  } from "./chunk-M76ECQRD.js";
@@ -27,16 +27,16 @@ import {
27
27
  removeCachedEntity,
28
28
  upsertSSREntity,
29
29
  write
30
- } from "./chunk-COMXDWNM.js";
30
+ } from "./chunk-BE2OOJ5P.js";
31
31
  import {
32
32
  createAgentKey,
33
33
  createDialogKey,
34
34
  createKey,
35
35
  dialogMessageRange
36
- } from "./chunk-SH2CFQOH.js";
36
+ } from "./chunk-O4BU24WZ.js";
37
37
  import {
38
38
  selectIdentityUserId
39
- } from "./chunk-EYEEHCU4.js";
39
+ } from "./chunk-UTLZINAP.js";
40
40
  import {
41
41
  asTrimmedString
42
42
  } from "./chunk-3EUW3WEO.js";
@@ -3,7 +3,7 @@ import {
3
3
  createMemoryOwnerIndexKey,
4
4
  createMemorySubjectKindIndexKey,
5
5
  ulid
6
- } from "./chunk-SH2CFQOH.js";
6
+ } from "./chunk-O4BU24WZ.js";
7
7
 
8
8
  // packages/ai/memory/storeShared.ts
9
9
  var createMemoryItem = (input) => {