nolo-cli 0.75.0-alpha.7 → 0.75.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 (134) hide show
  1. package/{_executeModel-MONX3AUM.js → _executeModel-I3XRMAJ2.js} +42 -42
  2. package/{action-D22U6CTH.js → action-7GHFPDSQ.js} +10 -10
  3. package/{addContentAction-XAPUTGL4.js → addContentAction-ZNVB2NOV.js} +8 -8
  4. package/{addDialogAgentAction-M7VLLBZM.js → addDialogAgentAction-CIDFWATM.js} +7 -7
  5. package/{agentDeleteCommand-UAMLWTPS.js → agentDeleteCommand-DCTG26JW.js} +27 -26
  6. package/{agentEmailCommands-QRVMJZ4C.js → agentEmailCommands-MRRHBLDQ.js} +54 -53
  7. package/{agentListCommands-63DOSBY7.js → agentListCommands-CUE46CSP.js} +29 -28
  8. package/{agentMachineCommands-BLILYHBN.js → agentMachineCommands-FYDEKBIO.js} +27 -26
  9. package/{agentProviderCommands-65ZC2WB4.js → agentProviderCommands-X3FA6BUM.js} +87 -0
  10. package/{agentPullCommand-N7L2CT7L.js → agentPullCommand-U73W5IBM.js} +1 -1
  11. package/{agentRecordCommands-4RQKVPNP.js → agentRecordCommands-P2MSNP7R.js} +52 -51
  12. package/{agentRunCommand-CDRQIDLW.js → agentRunCommand-QJGP7JEN.js} +52 -51
  13. package/{agentRuntimeLocal-XG3IDNOC.js → agentRuntimeLocal-T43UNWAY.js} +26 -25
  14. package/{agentSlice-BLCUNM5V.js → agentSlice-7GDS5Q2S.js} +9 -9
  15. package/{appDeleteCommands-TJXDMOYT.js → appDeleteCommands-YBKY3VEI.js} +27 -26
  16. package/{appDeployCommands-ECZJQAAL.js → appDeployCommands-EBC76HO4.js} +27 -26
  17. package/{appDeployStatusCommands-DZKVFG3Y.js → appDeployStatusCommands-WXRC5KEK.js} +27 -26
  18. package/{appGetCommands-JIT4OPUD.js → appGetCommands-VZZQEDOV.js} +27 -26
  19. package/{appListCommands-NR2HRMDY.js → appListCommands-HYSPVQ77.js} +27 -26
  20. package/{authCommand-EVGFLAHO.js → authCommand-E4GDVKMW.js} +91 -17
  21. package/{authCommands-ILTBI6JV.js → authCommands-VOTT6XWX.js} +3 -4
  22. package/builtinSkillRegistry-5SYVTS6Z.js +33 -0
  23. package/{chatQueueReduxAdapter-ROFM5SW7.js → chatQueueReduxAdapter-CXEWIDFZ.js} +22 -22
  24. package/{chunk-NG4UT4K4.js → chunk-23RQKXP6.js} +1 -1
  25. package/{chunk-C3FZR5EC.js → chunk-2F7RJC6L.js} +1 -1
  26. package/{chunk-3QPYFHAH.js → chunk-2XEVK4BT.js} +1 -1
  27. package/{chunk-HQUORJTM.js → chunk-3BMYXEUW.js} +1 -1
  28. package/{chunk-AFIWC5NH.js → chunk-3T4PRBHV.js} +1 -1
  29. package/{chunk-ZDONXM5U.js → chunk-4FRNB4ZG.js} +7 -7
  30. package/{chunk-YFADVSZE.js → chunk-5EJZGJS2.js} +6 -6
  31. package/{chunk-UJ63UXGE.js → chunk-6H7GN3JL.js} +1064 -752
  32. package/{chunk-BGIWMGSP.js → chunk-6RCZYDDC.js} +10 -172
  33. package/{chunk-RL5PTRUQ.js → chunk-6ZC5KPXV.js} +319 -29
  34. package/{chunk-BYEJ7K2Z.js → chunk-7S4YWN7P.js} +1 -1
  35. package/{chunk-SREASRV5.js → chunk-ABQYVJBJ.js} +1 -1
  36. package/{chunk-MQ25G6VQ.js → chunk-AYT2OKNM.js} +3 -3
  37. package/{chunk-ERD7UXVL.js → chunk-BNMZ7QUV.js} +1 -1
  38. package/{chunk-PGSKWZCB.js → chunk-DS3SQTDT.js} +1 -1
  39. package/{chunk-QC5LGHYP.js → chunk-EXWOCYCR.js} +3 -3
  40. package/chunk-FMODTASJ.js +109 -0
  41. package/{chunk-SZLVDREM.js → chunk-GIG262ZG.js} +3 -3
  42. package/{chunk-FPTQQSS6.js → chunk-GRJTR4PU.js} +25 -4
  43. package/{chunk-PZM3EENV.js → chunk-GXWEF4IZ.js} +1 -1
  44. package/chunk-HJKGQPYF.js +266 -0
  45. package/{chunk-3JQ2NRYU.js → chunk-HVURBGF3.js} +4 -4
  46. package/{chunk-CIHSMPAW.js → chunk-IMDA4FW4.js} +102 -34
  47. package/{chunk-L2Y24GRM.js → chunk-IO7DYRPW.js} +3 -3
  48. package/{chunk-UZ6XXCVR.js → chunk-IZAWJCG7.js} +15 -2
  49. package/{chunk-2SFNAHL6.js → chunk-JC2WQS66.js} +34 -22
  50. package/{chunk-XWNRAIUL.js → chunk-JITSBA52.js} +6 -16
  51. package/{chunk-6XIE5ZGI.js → chunk-JPGCXHNM.js} +1 -1
  52. package/{chunk-E36HZARC.js → chunk-KT6LENVP.js} +3 -3
  53. package/{chunk-N7DNNV6J.js → chunk-L2VNQQ7M.js} +78 -74
  54. package/{chunk-Q2DNZQEZ.js → chunk-LEYH5NOH.js} +5 -5
  55. package/{chunk-RXX4GDIH.js → chunk-LS2ZANRJ.js} +1 -1
  56. package/{chunk-4EJ5QYB5.js → chunk-LSV2BOJL.js} +1 -1
  57. package/{chunk-AFIKMMGC.js → chunk-MFW4BGJS.js} +1 -1
  58. package/{chunk-QH6NK22I.js → chunk-NVHJWYUO.js} +60 -788
  59. package/{chunk-Q6FF2MCK.js → chunk-OAJRZ35U.js} +1 -1
  60. package/{chunk-DSRXPQWA.js → chunk-OCL2YCAU.js} +7 -7
  61. package/{chunk-5J7W2VWW.js → chunk-OHUU52T3.js} +6 -265
  62. package/{chunk-V3ZKNK5D.js → chunk-OKCTLCKS.js} +9 -9
  63. package/chunk-P3AS5IPM.js +1624 -0
  64. package/{chunk-ZZCJUXUI.js → chunk-PHDKTASK.js} +2 -2
  65. package/{chunk-JFXQDXYJ.js → chunk-Q246OUG5.js} +9 -9
  66. package/{chunk-ZLPA7K55.js → chunk-Q4KVAB6L.js} +4 -4
  67. package/{chunk-AETZ7AD6.js → chunk-Q554LLSI.js} +1 -1
  68. package/{chunk-CGRJWXTE.js → chunk-S6STPUMG.js} +19 -15
  69. package/{chunk-K7AG465Q.js → chunk-T4F2EQGN.js} +4 -2
  70. package/{chunk-PYXL2CJL.js → chunk-TGRQUFLU.js} +1 -1
  71. package/{chunk-E6RGHPDR.js → chunk-UINEAQ2R.js} +3 -5
  72. package/{chunk-EXMHJN7C.js → chunk-UO66QKGI.js} +2 -2
  73. package/{chunk-BJCWNHVU.js → chunk-US463UAD.js} +2 -2
  74. package/{chunk-AJHEFRGJ.js → chunk-UWMQ6FPM.js} +4 -0
  75. package/{chunk-FSFQ3A7S.js → chunk-VARZWSKW.js} +9 -9
  76. package/{chunk-NHRQCXIQ.js → chunk-VMFTFOWF.js} +13 -3
  77. package/{chunk-3SPWIDHH.js → chunk-VQD6BTML.js} +3 -3
  78. package/{chunk-CUQ6PG2C.js → chunk-VW3YGKWR.js} +656 -98
  79. package/{chunk-G3O3PD6Q.js → chunk-W7PGACND.js} +14 -14
  80. package/{chunk-KIS76A2P.js → chunk-WSOMSDQB.js} +4 -4
  81. package/{chunk-CMH2SYHX.js → chunk-X77EN2BJ.js} +2 -2
  82. package/{chunk-MYU3MJCF.js → chunk-XCSSFPTB.js} +175 -7
  83. package/{chunk-QA6YKM3H.js → chunk-Y2IFJ7VM.js} +31 -3
  84. package/{chunk-UDQWGU7F.js → chunk-YZHP76TR.js} +1 -1
  85. package/{chunk-GBPZKFYK.js → chunk-ZIHJVHFH.js} +4 -4
  86. package/{chunk-DWPNOYMB.js → chunk-ZKGIAM7I.js} +1 -1
  87. package/chunk-ZSG2AQU4.js +626 -0
  88. package/{contentThunks-3BFZJFHI.js → contentThunks-Y2ACIFDB.js} +23 -23
  89. package/{createAgentAutomationAction-YCWUKLMK.js → createAgentAutomationAction-TNE3QMJR.js} +23 -23
  90. package/{createDialogAction-VULS2PKA.js → createDialogAction-BMGHBTQB.js} +26 -26
  91. package/{createPageAction-MZZLQPFE.js → createPageAction-FFNIZPIS.js} +24 -24
  92. package/{dbSlice-GKGGFNOB.js → dbSlice-4CUQE35F.js} +7 -7
  93. package/{deleteFile-LWSR674W.js → deleteFile-YG6QMJLU.js} +3 -3
  94. package/{dialogCommands-CJCAMML3.js → dialogCommands-3JC3BIXC.js} +28 -27
  95. package/{dialogSlice-NQO5ZETL.js → dialogSlice-3E7Z7HZV.js} +22 -22
  96. package/{docCreateCommands-H65RSKT4.js → docCreateCommands-6LNQLCTA.js} +28 -27
  97. package/{docDeleteCommands-PBYGJ6CZ.js → docDeleteCommands-ZJOAPWZS.js} +29 -28
  98. package/{docReadCommands-4VRYN5R5.js → docReadCommands-LJTRSBG6.js} +28 -27
  99. package/{docStore-AEJONTM4.js → docStore-R47ABXBB.js} +8 -8
  100. package/{docUpdateCommands-COZG3ZDB.js → docUpdateCommands-7P3QF3N2.js} +28 -27
  101. package/{fetchMessages-DRABNDPZ.js → fetchMessages-EIU7UFFK.js} +3 -4
  102. package/{getPricing-HRMSOF3E.js → getPricing-TV6ZB7ES.js} +4 -4
  103. package/{handleSendMessageAction-WIUO466V.js → handleSendMessageAction-FFYOGXAO.js} +22 -22
  104. package/index.js +61 -53
  105. package/{localDialogRead-PUQKFI73.js → localDialogRead-BTFJ4V2I.js} +2 -2
  106. package/{localRuntimeDb-P37ZTX55.js → localRuntimeDb-SYQGUF4U.js} +1 -1
  107. package/{machineCommands-BR3OIZHN.js → machineCommands-FN5GGQV3.js} +52 -51
  108. package/{machineWsRunDispatch-43YGAXOP.js → machineWsRunDispatch-H47IA7ZT.js} +50 -49
  109. package/{memberThunks-KATHH3F4.js → memberThunks-N35XAOC6.js} +8 -8
  110. package/{models-GS72DVJS.js → models-CMXFDBQH.js} +2 -2
  111. package/package.json +1 -1
  112. package/providerPresetApply-D2GGHPI7.js +214 -0
  113. package/providerRegistry-MU6C4ABD.js +31 -0
  114. package/{read-LC6HVYBN.js → read-2PV4PN2E.js} +4 -3
  115. package/{readDocTool-N3ERJHHF.js → readDocTool-FGK5XGAW.js} +1 -1
  116. package/{readlineWorkspace-RFSDCOKK.js → readlineWorkspace-NXKHYZEU.js} +263 -90
  117. package/{removeDialogAgentAction-F5GPTALR.js → removeDialogAgentAction-O2POGBOE.js} +10 -10
  118. package/{runAgentClientLoop-QHL2HNAI.js → runAgentClientLoop-CEBV5UPD.js} +41 -41
  119. package/{runtimeDoctorCommands-CROTMULY.js → runtimeDoctorCommands-X6WDBEQX.js} +2 -2
  120. package/{setDialogExtraReferencesAction-AY4ZCF3A.js → setDialogExtraReferencesAction-KPSVVY3C.js} +8 -8
  121. package/{setPrimaryDialogAgentAction-HPMG7V3R.js → setPrimaryDialogAgentAction-RMJETONI.js} +10 -10
  122. package/{settingSlice-OEJA4NQO.js → settingSlice-I6MTTNDX.js} +9 -9
  123. package/{spaceCommands-WGXHETMT.js → spaceCommands-JHT4ALCQ.js} +26 -25
  124. package/{streamAgentChatTurn-CE2H23VD.js → streamAgentChatTurn-SFCZP4GY.js} +49 -50
  125. package/{switchDialogAgentAction-HMDZTZ4I.js → switchDialogAgentAction-OQSGWVQQ.js} +7 -7
  126. package/{tools-F25QG6XS.js → tools-K3YOTESV.js} +37 -35
  127. package/{tuiSummaryLlmCaller-3Z24VUWM.js → tuiSummaryLlmCaller-T2OA5ZVB.js} +14 -14
  128. package/{updateDialogTitleAction-Z333XUN4.js → updateDialogTitleAction-CSPKYQRO.js} +23 -23
  129. package/chunk-3IT2PFHL.js +0 -611
  130. package/chunk-I42VC5KR.js +0 -15
  131. package/codingSkills-E6KSDNSJ.js +0 -48
  132. package/{chunk-3RAG2NAD.js → chunk-UKWGR5SS.js} +3 -3
  133. package/{db-VQSAOWAO.js → db-WK5MDZVN.js} +1 -1
  134. package/{localRuntimeAuthority-R5UBODT3.js → localRuntimeAuthority-6IR6BBXE.js} +3 -3
@@ -27,7 +27,7 @@ import {
27
27
  resolveLocalUserId,
28
28
  t,
29
29
  toolLabel
30
- } from "./chunk-CIHSMPAW.js";
30
+ } from "./chunk-IMDA4FW4.js";
31
31
  import {
32
32
  createRunActivityTracker,
33
33
  popSingleQueueMessage,
@@ -43,11 +43,11 @@ import {
43
43
  } from "./chunk-DWUCB2A3.js";
44
44
  import {
45
45
  getReadableCliDb
46
- } from "./chunk-RXX4GDIH.js";
46
+ } from "./chunk-LS2ZANRJ.js";
47
47
  import {
48
48
  readDbRecord,
49
49
  resolveAgentRecordFromHybridStore
50
- } from "./chunk-QA6YKM3H.js";
50
+ } from "./chunk-Y2IFJ7VM.js";
51
51
  import {
52
52
  isLocalCliAgentKey
53
53
  } from "./chunk-SPAQ4PVV.js";
@@ -63,7 +63,7 @@ import {
63
63
  } from "./chunk-LTRXGFMS.js";
64
64
  import {
65
65
  formatAgentListCard
66
- } from "./chunk-QH6NK22I.js";
66
+ } from "./chunk-NVHJWYUO.js";
67
67
  import {
68
68
  isTransientFetchError
69
69
  } from "./chunk-5XTOKQLW.js";
@@ -84,11 +84,11 @@ import {
84
84
  chooseMemoryOwners,
85
85
  loadMemoryCandidatesFromDb,
86
86
  resolveAgentMemoryPolicy
87
- } from "./chunk-BGIWMGSP.js";
87
+ } from "./chunk-6RCZYDDC.js";
88
88
  import {
89
89
  API_REPORTED_COST_MULTIPLIER,
90
90
  parseUiAskChoiceContent
91
- } from "./chunk-N7DNNV6J.js";
91
+ } from "./chunk-L2VNQQ7M.js";
92
92
  import {
93
93
  isOAuthApiKeyRef
94
94
  } from "./chunk-YYLHWIW6.js";
@@ -99,50 +99,50 @@ import {
99
99
  } from "./chunk-TRV2MIDW.js";
100
100
  import {
101
101
  getDefaultCliLocalRuntimeDb
102
- } from "./chunk-C3FZR5EC.js";
102
+ } from "./chunk-2F7RJC6L.js";
103
103
  import {
104
104
  buildSkillDiscoveryContextLayer
105
105
  } from "./chunk-E4MARS3Q.js";
106
106
  import {
107
107
  parseExternalSkillMarkdown,
108
108
  parseSkillDocProtocol
109
- } from "./chunk-AETZ7AD6.js";
109
+ } from "./chunk-Q554LLSI.js";
110
110
  import {
111
111
  LOCAL_AGENT_CONFIG_MISSING_CODE,
112
112
  LOCAL_TURN_ABORTED_CODE,
113
113
  readActionGate
114
- } from "./chunk-CUQ6PG2C.js";
114
+ } from "./chunk-VW3YGKWR.js";
115
115
  import {
116
116
  resolveAgentRuntimeConfigFromRecord
117
- } from "./chunk-KIS76A2P.js";
117
+ } from "./chunk-WSOMSDQB.js";
118
118
  import {
119
119
  createThinkParserState,
120
120
  flushThinkParser,
121
121
  processThinkChunk
122
122
  } from "./chunk-N7J63Q6C.js";
123
- import {
124
- isAntigravityOAuthAgent
125
- } from "./chunk-PGSKWZCB.js";
126
- import {
127
- resolveClientVersion
128
- } from "./chunk-CMH2SYHX.js";
129
123
  import {
130
124
  isQuotaExhaustedError,
131
125
  isQuotaLimited403Body,
132
126
  mergeAvailabilityDeadline,
133
127
  resolveCooldownGate
134
128
  } from "./chunk-CJCJF5XB.js";
129
+ import {
130
+ isAntigravityOAuthAgent
131
+ } from "./chunk-DS3SQTDT.js";
132
+ import {
133
+ resolveClientVersion
134
+ } from "./chunk-X77EN2BJ.js";
135
135
  import {
136
136
  DEFAULT_CONTEXT_WINDOW,
137
137
  getModelContextWindow,
138
138
  normalizeUsage
139
- } from "./chunk-DSRXPQWA.js";
139
+ } from "./chunk-OCL2YCAU.js";
140
140
  import {
141
141
  clipCompactText
142
- } from "./chunk-E36HZARC.js";
142
+ } from "./chunk-KT6LENVP.js";
143
143
  import {
144
144
  findModelConfig
145
- } from "./chunk-UJ63UXGE.js";
145
+ } from "./chunk-6H7GN3JL.js";
146
146
  import {
147
147
  compactWhitespace
148
148
  } from "./chunk-DWLEOOGR.js";
@@ -167,13 +167,13 @@ import {
167
167
  CLIENT_VERSION_TOO_OLD_CODE,
168
168
  NOLO_CLIENT_VERSION_HEADER,
169
169
  buildClientVersionUpgradeMessage
170
- } from "./chunk-AJHEFRGJ.js";
170
+ } from "./chunk-UWMQ6FPM.js";
171
171
  import {
172
172
  parsePositiveFiniteNumberOrFallback
173
173
  } from "./chunk-Y5GCAMGP.js";
174
174
  import {
175
175
  createMemoryKey
176
- } from "./chunk-NHRQCXIQ.js";
176
+ } from "./chunk-VMFTFOWF.js";
177
177
  import {
178
178
  asTrimmedLowercaseString
179
179
  } from "./chunk-QSJ3HFEF.js";
@@ -181,7 +181,7 @@ import {
181
181
  BUILTIN_NOLO_AGENT_KEY,
182
182
  BUILTIN_NOLO_AGENT_NAME,
183
183
  builtinAgentCatalogEntryById
184
- } from "./chunk-5J7W2VWW.js";
184
+ } from "./chunk-HJKGQPYF.js";
185
185
  import {
186
186
  parsePublicAgentId
187
187
  } from "./chunk-BJIRLHJR.js";
@@ -1496,8 +1496,8 @@ function userSurfaceBackgroundSequence(env = process.env, brightness = resolveTu
1496
1496
  return "";
1497
1497
  }
1498
1498
  const palette = THEME_PALETTES[activeThemeName] ?? THEME_PALETTES.trail;
1499
- const surfaceHex = brightness === "light" ? palette.light.chrome.hex : palette.dark.accent.hex;
1500
- const weight = brightness === "dark" ? 0.3 : 0.08;
1499
+ const weight = brightness === "dark" ? 0.3 : 0.14;
1500
+ const surfaceHex = (brightness === "light" ? palette.light : palette.dark).accent.hex;
1501
1501
  return hexToBgSgr(blendHex(surfaceHex, resolveTerminalBaseHex(brightness), weight));
1502
1502
  }
1503
1503
  function themeText(text, token, colorEnabled = resolveCliColorEnabled(), env = process.env) {
@@ -10413,7 +10413,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
10413
10413
  // packages/cli/client/agentRun.ts
10414
10414
  import { ulid } from "ulid";
10415
10415
  async function loadRunLocalAgentTurn() {
10416
- const { runLocalAgentTurn } = await import("./agentRuntimeLocal-XG3IDNOC.js");
10416
+ const { runLocalAgentTurn } = await import("./agentRuntimeLocal-T43UNWAY.js");
10417
10417
  return runLocalAgentTurn;
10418
10418
  }
10419
10419
  var stripDebugNoise = (s) => s.replace(/\s*raw="[\s\S]*"/g, "").replace(/\s*raw=\S+/g, "").replace(/\s*headers=\[[^\]]*\]/g, "").replace(/\s*headers=\S+/g, "").trim();
@@ -11079,6 +11079,12 @@ async function runLocalAgentTurnForCli(options, settings) {
11079
11079
  ...options.parentDialogId ? { parentThreadId: options.parentDialogId } : {}
11080
11080
  } : void 0;
11081
11081
  const currentDialogId = options.continueDialogId ?? ulid();
11082
+ const turnId = `turn-${ulid()}`;
11083
+ const runtimeContextWithOwnership = {
11084
+ ...runtimeContext ?? {},
11085
+ dialogId: currentDialogId,
11086
+ turnId
11087
+ };
11082
11088
  const adapter = baseAdapter;
11083
11089
  const expandedMessage = options.pastedTextStore?.items.size ? expandCollapsedPastes(options.message, options.pastedTextStore) : options.message;
11084
11090
  const workingLabel = `${options.agentName} -> working locally`;
@@ -11114,11 +11120,10 @@ async function runLocalAgentTurnForCli(options, settings) {
11114
11120
  category: options.category,
11115
11121
  inheritedFromDialogKey: options.inheritedFromDialogKey,
11116
11122
  parentDialogId: options.parentDialogId,
11117
- runtimeContext,
11123
+ runtimeContext: runtimeContextWithOwnership,
11118
11124
  runKind: options.env.NOLO_AGENT_RUN_CHILD === "1" ? "subtask" : "interactive",
11119
11125
  background: options.background,
11120
11126
  noStream: options.noStream,
11121
- ...runtimeContext ? { runtimeContext } : {},
11122
11127
  ...options.contextBlockScopes?.length ? { contextBlockScopes: options.contextBlockScopes } : options.extraContextBlocks?.length ? { contextBlocks: options.extraContextBlocks } : {},
11123
11128
  ...typeof options.timeoutMs === "number" ? { timeoutMs: options.timeoutMs } : {},
11124
11129
  ...options.actionGateHandler ? { onActionGate: options.actionGateHandler } : {},
@@ -12068,6 +12073,273 @@ var rankMemoryCandidates = (items, query, context) => {
12068
12073
  });
12069
12074
  };
12070
12075
 
12076
+ // packages/ai/memory/vnext/store.ts
12077
+ var enc = (value) => encodeURIComponent(value).replace(/-/g, "%2D");
12078
+ var rangeOf = (prefix) => ({ gte: prefix, lte: `${prefix}\uFFFF` });
12079
+ var entityOwnerPrefix = (ownerId) => `mem2-e-${enc(ownerId)}-`;
12080
+ var stateEntityIndexPrefix = (ownerId, entityId) => `mem2-si-${enc(ownerId)}-${enc(entityId)}-`;
12081
+ var readIndexed = async (db, prefix) => {
12082
+ const refs = [];
12083
+ for await (const [, value] of db.iterator({ ...rangeOf(prefix), reverse: false })) {
12084
+ if (typeof value?.key === "string") refs.push(value.key);
12085
+ }
12086
+ const rows = await Promise.all(refs.map((key) => db.get(key).catch(() => null)));
12087
+ return rows.filter((row) => !!row);
12088
+ };
12089
+ var listMemoryEntitiesVNext = async (db, ownerId) => {
12090
+ const rows = [];
12091
+ for await (const [, value] of db.iterator({
12092
+ ...rangeOf(entityOwnerPrefix(ownerId)),
12093
+ reverse: false
12094
+ })) {
12095
+ if (value) rows.push(value);
12096
+ }
12097
+ return rows;
12098
+ };
12099
+ var listMemoryStatesForEntityVNext = (db, ownerId, entityId) => readIndexed(db, stateEntityIndexPrefix(ownerId, entityId));
12100
+
12101
+ // packages/ai/memory/vnext/recall.ts
12102
+ var MAX_RECALL_REFS = 6;
12103
+ var stripFence = (raw) => {
12104
+ const trimmed = raw.trim();
12105
+ const match = trimmed.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/i);
12106
+ return match ? match[1].trim() : trimmed;
12107
+ };
12108
+ var parseSelection = (raw) => {
12109
+ let parsed;
12110
+ try {
12111
+ parsed = JSON.parse(stripFence(raw));
12112
+ } catch {
12113
+ throw new Error("memory recall selector output is not valid JSON");
12114
+ }
12115
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
12116
+ throw new Error("memory recall selector output must be an object");
12117
+ }
12118
+ const obj = parsed;
12119
+ if (!Array.isArray(obj.refs) || !obj.refs.every((item) => typeof item === "string")) {
12120
+ throw new Error("memory recall selector refs must be string[]");
12121
+ }
12122
+ if (typeof obj.reason !== "string") {
12123
+ throw new Error("memory recall selector reason must be string");
12124
+ }
12125
+ return {
12126
+ refs: [...new Set(obj.refs)].slice(0, MAX_RECALL_REFS),
12127
+ reason: obj.reason
12128
+ };
12129
+ };
12130
+ var buildCatalog = async (db, ownerId) => {
12131
+ const entities = await listMemoryEntitiesVNext(db, ownerId);
12132
+ const states = [];
12133
+ for (const entity of entities) {
12134
+ states.push(...await listMemoryStatesForEntityVNext(db, ownerId, entity.id));
12135
+ }
12136
+ return { entities, states };
12137
+ };
12138
+ var catalogText = (entities, states) => JSON.stringify(
12139
+ {
12140
+ entities: entities.map((entity) => ({
12141
+ id: entity.id,
12142
+ type: entity.type,
12143
+ name: entity.name,
12144
+ ...entity.subtype ? { subtype: entity.subtype } : {},
12145
+ ...entity.aliases?.length ? { aliases: entity.aliases } : {}
12146
+ })),
12147
+ states: states.map((state2) => ({
12148
+ id: state2.id,
12149
+ entityId: state2.entityId,
12150
+ facet: state2.facet,
12151
+ text: state2.text,
12152
+ // Retired (superseded) States stay listed as recoverable history; the
12153
+ // boolean — not the retiredAt timestamp — enters the prompt so no
12154
+ // timestamps reach LLM text.
12155
+ ...state2.retiredAt ? { retired: true } : {}
12156
+ }))
12157
+ },
12158
+ null,
12159
+ 2
12160
+ );
12161
+ var createMemoryVNextRecall = (input) => async (query) => {
12162
+ const startedAt = performance.now();
12163
+ const { entities, states } = await buildCatalog(input.db, input.ownerId);
12164
+ if (entities.length === 0 && states.length === 0) {
12165
+ return {
12166
+ query,
12167
+ refs: [],
12168
+ entities: [],
12169
+ states: [],
12170
+ reason: "memory catalog is empty",
12171
+ trace: {
12172
+ candidateEntities: 0,
12173
+ candidateStates: 0,
12174
+ selectedRefs: 0,
12175
+ elapsedMs: Math.round((performance.now() - startedAt) * 10) / 10
12176
+ }
12177
+ };
12178
+ }
12179
+ const result = await input.provider.complete(
12180
+ [
12181
+ {
12182
+ role: "system",
12183
+ content: [
12184
+ "Select the smallest useful set of long-lived memory entrances for the user query.",
12185
+ 'Return ONLY JSON: {"refs":["exact-id"],"reason":"short explanation"}.',
12186
+ `Select at most ${MAX_RECALL_REFS} exact ids from the supplied catalog.`,
12187
+ "Prefer State ids when current durable understanding answers the query.",
12188
+ "Select an Entity id when it is a useful navigation anchor and no single State is enough.",
12189
+ "Do not select unrelated memories merely because they are personal or interesting.",
12190
+ "Historical-detail questions may select the relevant current State/Entity as an entrance; deeper evidence is handled by inspect, not here."
12191
+ ].join("\n")
12192
+ },
12193
+ {
12194
+ role: "user",
12195
+ content: `Query:
12196
+ ${query}
12197
+
12198
+ Memory catalog:
12199
+ ${catalogText(entities, states)}`
12200
+ }
12201
+ ],
12202
+ input.timeoutMs ? { timeoutMs: input.timeoutMs } : void 0
12203
+ );
12204
+ const selected = parseSelection(result.content);
12205
+ const entityById = new Map(entities.map((entity) => [entity.id, entity]));
12206
+ const stateById = new Map(states.map((state2) => [state2.id, state2]));
12207
+ const validRefs = selected.refs.filter((ref) => entityById.has(ref) || stateById.has(ref));
12208
+ return {
12209
+ query,
12210
+ refs: validRefs,
12211
+ entities: validRefs.flatMap((ref) => {
12212
+ const entity = entityById.get(ref);
12213
+ return entity ? [entity] : [];
12214
+ }),
12215
+ states: validRefs.flatMap((ref) => {
12216
+ const state2 = stateById.get(ref);
12217
+ return state2 ? [state2] : [];
12218
+ }),
12219
+ reason: selected.reason,
12220
+ trace: {
12221
+ candidateEntities: entities.length,
12222
+ candidateStates: states.length,
12223
+ selectedRefs: validRefs.length,
12224
+ elapsedMs: Math.round((performance.now() - startedAt) * 10) / 10
12225
+ }
12226
+ };
12227
+ };
12228
+
12229
+ // packages/ai/memory/vnext/legacyMigration.ts
12230
+ var resolveLegacyMemoryPrincipal = (item) => ({
12231
+ ownerType: item.ownerType,
12232
+ ownerId: item.ownerId,
12233
+ principalId: `${item.ownerType}:${encodeURIComponent(item.ownerId)}`
12234
+ });
12235
+
12236
+ // packages/ai/memory/vnext/shadowRead.ts
12237
+ var SHADOW_TIMEOUT_MS = 2e4;
12238
+ var ERROR_MESSAGE_MAX = 120;
12239
+ var normalizeTextKey = (text) => text.trim().replace(/\s+/g, " ").toLowerCase();
12240
+ var legacyItemKeys = (item) => {
12241
+ const keys = [normalizeTextKey(item.content ?? "")];
12242
+ return keys.filter((key) => key.length > 0);
12243
+ };
12244
+ var vnextResultKeys = (result) => {
12245
+ const keys = [];
12246
+ for (const entity of result.entities) {
12247
+ if (entity.name) keys.push(normalizeTextKey(entity.name));
12248
+ }
12249
+ for (const state2 of result.states) {
12250
+ if (state2.text) keys.push(normalizeTextKey(state2.text));
12251
+ }
12252
+ return keys.filter((key) => key.length > 0);
12253
+ };
12254
+ var vnextContextChars = (result) => result.entities.reduce(
12255
+ (sum, entity) => sum + (entity.name?.length ?? 0),
12256
+ result.states.reduce((sum, state2) => sum + (state2.text?.length ?? 0), 0)
12257
+ );
12258
+ var shortError = (error) => {
12259
+ const message = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
12260
+ return message.length > ERROR_MESSAGE_MAX ? `${message.slice(0, ERROR_MESSAGE_MAX)}\u2026` : message;
12261
+ };
12262
+ var withTimeout = async (promise, timeoutMs, label) => {
12263
+ let timer;
12264
+ const timeout = new Promise((_, reject) => {
12265
+ timer = setTimeout(() => reject(new Error(label)), timeoutMs);
12266
+ });
12267
+ try {
12268
+ return await Promise.race([promise, timeout]);
12269
+ } finally {
12270
+ if (timer) clearTimeout(timer);
12271
+ }
12272
+ };
12273
+ var runMemoryVNextShadowRead = async (input) => {
12274
+ const now = input.ctx.now ?? (() => performance.now());
12275
+ const emit = input.emit ?? ((observation2) => console.info("[memory] vnext shadow read", {
12276
+ event: "memory_vnext_shadow_read",
12277
+ ...observation2
12278
+ }));
12279
+ const legacyKeys = new Set(
12280
+ input.legacyItems.flatMap((item) => legacyItemKeys(item))
12281
+ );
12282
+ const vnextStartedAt = now();
12283
+ let vnextHitCount = 0;
12284
+ let vnextChars = 0;
12285
+ const vnextKeys = /* @__PURE__ */ new Set();
12286
+ let vnextError;
12287
+ try {
12288
+ const shadowTimeoutMs = input.ctx.shadowTimeoutMs ?? SHADOW_TIMEOUT_MS;
12289
+ const perOwner = async (owner) => {
12290
+ const principal = resolveLegacyMemoryPrincipal({
12291
+ ownerType: owner.ownerType,
12292
+ ownerId: owner.ownerId
12293
+ });
12294
+ const recall = createMemoryVNextRecall({
12295
+ db: input.ctx.db,
12296
+ ownerId: principal.principalId,
12297
+ provider: input.ctx.provider,
12298
+ timeoutMs: input.ctx.timeoutMs
12299
+ });
12300
+ return recall(input.ctx.query);
12301
+ };
12302
+ const results = await withTimeout(
12303
+ Promise.all(input.ctx.owners.map((owner) => perOwner(owner))),
12304
+ shadowTimeoutMs,
12305
+ `memory vnext shadow read timed out after ${shadowTimeoutMs}ms`
12306
+ );
12307
+ for (const result of results) {
12308
+ vnextHitCount += result.refs.length;
12309
+ vnextChars += vnextContextChars(result);
12310
+ for (const key of vnextResultKeys(result)) vnextKeys.add(key);
12311
+ }
12312
+ } catch (error) {
12313
+ vnextError = shortError(error);
12314
+ }
12315
+ const vnextLatencyMs = Math.round((now() - vnextStartedAt) * 10) / 10;
12316
+ let overlapCount = null;
12317
+ let legacyOnlyCount = null;
12318
+ let vnextOnlyCount = null;
12319
+ if (!vnextError) {
12320
+ let overlap = 0;
12321
+ for (const key of vnextKeys) if (legacyKeys.has(key)) overlap += 1;
12322
+ overlapCount = overlap;
12323
+ legacyOnlyCount = Math.max(0, legacyKeys.size - overlap);
12324
+ vnextOnlyCount = Math.max(0, vnextKeys.size - overlap);
12325
+ }
12326
+ const observation = {
12327
+ legacyHitCount: input.legacyItems.length,
12328
+ vnextHitCount,
12329
+ overlapCount,
12330
+ legacyOnlyCount,
12331
+ vnextOnlyCount,
12332
+ legacyLatencyMs: input.legacyLatencyMs,
12333
+ vnextLatencyMs,
12334
+ legacyContextChars: input.legacyContextChars,
12335
+ vnextContextChars: vnextChars,
12336
+ ...vnextError ? { vnextError } : {}
12337
+ };
12338
+ emit(observation);
12339
+ return observation;
12340
+ };
12341
+ var isMemoryVNextShadowReadEnabled = (env = typeof process !== "undefined" ? process.env : {}) => env.NOLO_MEMORY_VNEXT_SHADOW_READ === "1" || env.NOLO_MEMORY_VNEXT_SHADOW_READ === "true";
12342
+
12071
12343
  // packages/ai/memory/runtime.ts
12072
12344
  var COLD_STORAGE_CONFIDENCE = 0.3;
12073
12345
  var MEMORY_OVERLAY_TOKEN_BUDGET = DEFAULT_MEMORY_OVERLAY_TOKEN_BUDGET;
@@ -12191,6 +12463,7 @@ var resolveMemoryRuntime = async (input) => {
12191
12463
  return { selectedItems: [], promptBlock: null };
12192
12464
  }
12193
12465
  const policy = resolveAgentMemoryPolicy({ agentKey: input.agentKey });
12466
+ const legacyStartedAt = performance.now();
12194
12467
  const candidates = await loadMemoryCandidatesFromDb(input.db, {
12195
12468
  owners,
12196
12469
  subjects: buildMemorySubjectsForAgent({
@@ -12217,13 +12490,29 @@ var resolveMemoryRuntime = async (input) => {
12217
12490
  input.userInput
12218
12491
  );
12219
12492
  const selected = [...residentItems, ...ranked];
12493
+ const legacyLatencyMs = Math.round((performance.now() - legacyStartedAt) * 10) / 10;
12494
+ const promptBlock = selected.length === 0 ? null : buildMemoryOverlay(selected, { maxTokens: MEMORY_OVERLAY_TOKEN_BUDGET });
12495
+ const shadowEnabled = input.vNextShadowProvider != null && isMemoryVNextShadowReadEnabled();
12496
+ if (shadowEnabled) {
12497
+ await runMemoryVNextShadowRead({
12498
+ ctx: {
12499
+ db: input.db,
12500
+ owners,
12501
+ query: input.userInput,
12502
+ provider: input.vNextShadowProvider
12503
+ },
12504
+ legacyItems: selected,
12505
+ legacyLatencyMs,
12506
+ legacyContextChars: promptBlock?.length ?? 0
12507
+ });
12508
+ }
12220
12509
  if (selected.length === 0) {
12221
12510
  return { selectedItems: [], promptBlock: null };
12222
12511
  }
12223
12512
  await touchMemoryItemsInDb(input.db, selected);
12224
12513
  return {
12225
12514
  selectedItems: selected,
12226
- promptBlock: buildMemoryOverlay(selected, { maxTokens: MEMORY_OVERLAY_TOKEN_BUDGET })
12515
+ promptBlock
12227
12516
  };
12228
12517
  };
12229
12518
 
@@ -12267,7 +12556,8 @@ var queryLocalMemory = async (env, agentKey, userInput, spaceId) => {
12267
12556
  userId: machineId,
12268
12557
  agentKey,
12269
12558
  userInput,
12270
- ...spaceId ? { spaceId } : {}
12559
+ ...spaceId ? { spaceId } : {},
12560
+ ...isMemoryVNextShadowReadEnabled(env) ? { vNextShadowProvider: void 0 } : {}
12271
12561
  });
12272
12562
  return resolution.promptBlock;
12273
12563
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dialogMessageRange
3
- } from "./chunk-NHRQCXIQ.js";
3
+ } from "./chunk-VMFTFOWF.js";
4
4
  import {
5
5
  isTombstoneRecord
6
6
  } from "./chunk-GBRG75BQ.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getRuntimeServerContext,
3
3
  scheduleDeleteReplication
4
- } from "./chunk-3RAG2NAD.js";
4
+ } from "./chunk-UKWGR5SS.js";
5
5
  import {
6
6
  fetchFromClientDb
7
7
  } from "./chunk-QOKAKDPE.js";
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  patch,
12
12
  readAndWait
13
- } from "./chunk-YFADVSZE.js";
13
+ } from "./chunk-5EJZGJS2.js";
14
14
  import {
15
15
  asOptionalTrimmedString
16
16
  } from "./chunk-G3SUCT4W.js";
@@ -326,7 +326,7 @@ async function saveDocState(arg, { dispatch, getState }) {
326
326
  ).unwrap();
327
327
  if (dbSpaceId) {
328
328
  try {
329
- const { updateContentTitle } = await import("./contentThunks-3BFZJFHI.js");
329
+ const { updateContentTitle } = await import("./contentThunks-Y2ACIFDB.js");
330
330
  await dispatch(
331
331
  updateContentTitle({
332
332
  spaceId: dbSpaceId,
@@ -365,7 +365,7 @@ async function saveDocState(arg, { dispatch, getState }) {
365
365
  }
366
366
  }
367
367
  async function createDocState(args, thunkApi) {
368
- const { createPageAction } = await import("./createPageAction-MZZLQPFE.js");
368
+ const { createPageAction } = await import("./createPageAction-FFNIZPIS.js");
369
369
  return createPageAction(args, thunkApi);
370
370
  }
371
371
  function subscribe(listener) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-2SFNAHL6.js";
4
+ } from "./chunk-JC2WQS66.js";
5
5
 
6
6
  // packages/ai/agent/fetchAgentContexts.ts
7
7
  async function fetchAgentContexts(references, dispatch) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  trimTrailingSlash
3
- } from "./chunk-CMH2SYHX.js";
3
+ } from "./chunk-X77EN2BJ.js";
4
4
  import {
5
5
  toErrorMessage
6
6
  } from "./chunk-HNMXYYJR.js";
@@ -35,15 +35,15 @@ import {
35
35
  resolvePlatformAuthToken,
36
36
  resolvePlatformServerUrl,
37
37
  resolveProviderTransportDecision
38
- } from "./chunk-CMH2SYHX.js";
38
+ } from "./chunk-X77EN2BJ.js";
39
39
  import {
40
40
  clipCompactText,
41
41
  isMeaningfulChatCompletionOutput,
42
42
  isMeaningfulResponsesOutput
43
- } from "./chunk-E36HZARC.js";
43
+ } from "./chunk-KT6LENVP.js";
44
44
  import {
45
45
  NOLO_CLIENT_VERSION_HEADER
46
- } from "./chunk-AJHEFRGJ.js";
46
+ } from "./chunk-UWMQ6FPM.js";
47
47
  import {
48
48
  isRecord
49
49
  } from "./chunk-KUG52IAP.js";
@@ -0,0 +1,109 @@
1
+ // packages/agent-runtime/devinOAuth.ts
2
+ import { existsSync, readFileSync } from "node:fs";
3
+ import { homedir } from "node:os";
4
+ import { join } from "node:path";
5
+ var DEVIN_CONNECT_URL = "https://server.codeium.com/exa.api_server_pb.ApiServerService/GetChatMessage";
6
+ function buildDevinAuthUrl(orgId) {
7
+ const cleanOrg = orgId?.trim();
8
+ if (cleanOrg) {
9
+ return `https://app.devin.ai/org/${encodeURIComponent(cleanOrg)}/settings/keys`;
10
+ }
11
+ return "https://app.devin.ai/settings/keys";
12
+ }
13
+ function extractDevinToken(input) {
14
+ const raw = input?.trim();
15
+ if (!raw) return null;
16
+ if (/^https?:\/\//i.test(raw)) {
17
+ try {
18
+ const url = new URL(raw);
19
+ const queryToken = url.searchParams.get("token") || url.searchParams.get("access_token") || url.searchParams.get("auth_token");
20
+ if (queryToken?.trim()) return queryToken.trim();
21
+ if (url.hash) {
22
+ const hashParams = new URLSearchParams(url.hash.replace(/^#/, ""));
23
+ const hashToken = hashParams.get("token") || hashParams.get("access_token") || hashParams.get("auth_token");
24
+ if (hashToken?.trim()) return hashToken.trim();
25
+ }
26
+ } catch {
27
+ }
28
+ }
29
+ return raw || null;
30
+ }
31
+ function parseDevinCredentialsToml(content) {
32
+ for (const line of content.split(/\r?\n/)) {
33
+ const cogMatch = line.match(/(cog_[A-Za-z0-9_-]+)/);
34
+ if (cogMatch?.[1]) {
35
+ return cogMatch[1].trim();
36
+ }
37
+ const match = line.match(
38
+ /^\s*(?:windsurf_api_key|devin_api_key|api_key|api_token|token)\s*=\s*"([^"]+)"\s*$/i
39
+ );
40
+ if (match?.[1]) {
41
+ return match[1].trim();
42
+ }
43
+ }
44
+ return null;
45
+ }
46
+ function detectLocalDevinCredentials(options) {
47
+ const baseHome = options?.homeDir || homedir();
48
+ const xdgData = process.env.XDG_DATA_HOME;
49
+ const candidateCliPaths = [
50
+ xdgData ? join(xdgData, "devin", "credentials.toml") : null,
51
+ join(baseHome, ".local", "share", "devin", "credentials.toml"),
52
+ process.env.APPDATA ? join(process.env.APPDATA, "devin", "credentials.toml") : null
53
+ ].filter((p) => Boolean(p));
54
+ for (const credPath of candidateCliPaths) {
55
+ if (existsSync(credPath)) {
56
+ try {
57
+ const content = readFileSync(credPath, "utf-8");
58
+ const token = parseDevinCredentialsToml(content);
59
+ if (token) {
60
+ return {
61
+ found: true,
62
+ token,
63
+ source: "devin-cli",
64
+ sourcePath: credPath
65
+ };
66
+ }
67
+ } catch {
68
+ }
69
+ }
70
+ }
71
+ const codeiumPath = join(baseHome, ".codeium", "config.json");
72
+ if (existsSync(codeiumPath)) {
73
+ try {
74
+ const parsed = JSON.parse(readFileSync(codeiumPath, "utf-8"));
75
+ const token = parsed.apiKey || parsed.api_key;
76
+ if (token?.trim()) {
77
+ return {
78
+ found: true,
79
+ token: token.trim(),
80
+ source: "codeium-config",
81
+ sourcePath: codeiumPath
82
+ };
83
+ }
84
+ } catch {
85
+ }
86
+ }
87
+ return { found: false };
88
+ }
89
+ function buildDevinOAuthCredential(token, now = Date.now()) {
90
+ return {
91
+ provider: "devin",
92
+ accessToken: token.trim(),
93
+ obtainedAt: now
94
+ };
95
+ }
96
+ function isDevinOAuthAgent(agent) {
97
+ const ref = agent.apiKeyRef?.trim().toLowerCase();
98
+ const prov = agent.provider?.trim().toLowerCase();
99
+ return ref === "devin" || prov === "devin";
100
+ }
101
+
102
+ export {
103
+ DEVIN_CONNECT_URL,
104
+ buildDevinAuthUrl,
105
+ extractDevinToken,
106
+ detectLocalDevinCredentials,
107
+ buildDevinOAuthCredential,
108
+ isDevinOAuthAgent
109
+ };