nolo-cli 0.88.0-alpha.2 → 0.89.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/{_executeModel-S7KQX4XS.js → _executeModel-I3XRMAJ2.js} +30 -30
  2. package/{action-JZ62BXLX.js → action-7GHFPDSQ.js} +4 -4
  3. package/{addContentAction-2ETXWERA.js → addContentAction-ZNVB2NOV.js} +2 -2
  4. package/{addDialogAgentAction-COSPGJ4K.js → addDialogAgentAction-CIDFWATM.js} +1 -1
  5. package/{agentDeleteCommand-J6Y2C5X2.js → agentDeleteCommand-DCTG26JW.js} +18 -18
  6. package/{agentEmailCommands-TGZ5DJAB.js → agentEmailCommands-MRRHBLDQ.js} +40 -40
  7. package/{agentListCommands-UIDWO3EG.js → agentListCommands-CUE46CSP.js} +20 -20
  8. package/{agentMachineCommands-FPSZ6FJ4.js → agentMachineCommands-FYDEKBIO.js} +18 -18
  9. package/{agentProviderCommands-65ZC2WB4.js → agentProviderCommands-X3FA6BUM.js} +87 -0
  10. package/{agentPullCommand-N7L2CT7L.js → agentPullCommand-U73W5IBM.js} +1 -1
  11. package/{agentRecordCommands-6SCONH5I.js → agentRecordCommands-P2MSNP7R.js} +39 -39
  12. package/{agentRunCommand-2IXI6Z2U.js → agentRunCommand-QJGP7JEN.js} +39 -39
  13. package/{agentRuntimeLocal-UYU2POZ7.js → agentRuntimeLocal-T43UNWAY.js} +15 -15
  14. package/{agentSlice-J5XXG3H7.js → agentSlice-7GDS5Q2S.js} +2 -2
  15. package/{appDeleteCommands-BVSKDJNM.js → appDeleteCommands-YBKY3VEI.js} +18 -18
  16. package/{appDeployCommands-UTPULKP3.js → appDeployCommands-EBC76HO4.js} +18 -18
  17. package/{appDeployStatusCommands-DKDE2ECO.js → appDeployStatusCommands-WXRC5KEK.js} +18 -18
  18. package/{appGetCommands-KT7A7JJQ.js → appGetCommands-VZZQEDOV.js} +18 -18
  19. package/{appListCommands-MTHRLBXS.js → appListCommands-HYSPVQ77.js} +18 -18
  20. package/{authCommand-NNFLRLGJ.js → authCommand-E4GDVKMW.js} +9 -9
  21. package/{authCommands-364ESL7K.js → authCommands-VOTT6XWX.js} +2 -2
  22. package/{builtinSkillRegistry-VXSNE7LM.js → builtinSkillRegistry-5SYVTS6Z.js} +3 -3
  23. package/{chatQueueReduxAdapter-6I4F5TQW.js → chatQueueReduxAdapter-CXEWIDFZ.js} +13 -13
  24. package/{chunk-NG4UT4K4.js → chunk-23RQKXP6.js} +1 -1
  25. package/{chunk-C3FZR5EC.js → chunk-2F7RJC6L.js} +1 -1
  26. package/{chunk-SR2I44ML.js → chunk-2XEVK4BT.js} +1 -1
  27. package/{chunk-BQKN5ZHZ.js → chunk-3T4PRBHV.js} +1 -1
  28. package/{chunk-M5K26BH3.js → chunk-4FRNB4ZG.js} +4 -4
  29. package/{chunk-X7WAX4JU.js → chunk-5EJZGJS2.js} +1 -1
  30. package/{chunk-MXUSPS2N.js → chunk-6H7GN3JL.js} +1554 -1529
  31. package/{chunk-5CEIOSBX.js → chunk-6RCZYDDC.js} +5 -5
  32. package/{chunk-PBMUDRON.js → chunk-6ZC5KPXV.js} +303 -18
  33. package/{chunk-MGRRXGZD.js → chunk-AYT2OKNM.js} +3 -3
  34. package/{chunk-KR3MGGC7.js → chunk-BNMZ7QUV.js} +1 -1
  35. package/{chunk-LHDV2QUI.js → chunk-DS3SQTDT.js} +1 -1
  36. package/{chunk-6LUUGZTS.js → chunk-EXWOCYCR.js} +3 -3
  37. package/{chunk-N4X2KIYL.js → chunk-GIG262ZG.js} +1 -1
  38. package/{chunk-WKJC6UOK.js → chunk-GRJTR4PU.js} +2 -2
  39. package/{chunk-T2EUOLNJ.js → chunk-GXWEF4IZ.js} +1 -1
  40. package/{chunk-M2ZBPSGH.js → chunk-IMDA4FW4.js} +19 -19
  41. package/{chunk-6IHWRTUK.js → chunk-IO7DYRPW.js} +3 -3
  42. package/{chunk-BEQGQMYW.js → chunk-IZAWJCG7.js} +1 -1
  43. package/{chunk-PP3LAL6G.js → chunk-JC2WQS66.js} +14 -14
  44. package/{chunk-S6FCVZ4I.js → chunk-JITSBA52.js} +2 -2
  45. package/{chunk-DJM4BCSB.js → chunk-KT6LENVP.js} +2 -2
  46. package/{chunk-QIU65GHY.js → chunk-L2VNQQ7M.js} +20 -20
  47. package/{chunk-IBT5GKZM.js → chunk-LEYH5NOH.js} +5 -5
  48. package/{chunk-RXX4GDIH.js → chunk-LS2ZANRJ.js} +1 -1
  49. package/{chunk-4YIWJYIX.js → chunk-LSV2BOJL.js} +1 -1
  50. package/{chunk-5HKWE6OQ.js → chunk-MFW4BGJS.js} +1 -1
  51. package/{chunk-NJBLAV2R.js → chunk-NVHJWYUO.js} +25 -25
  52. package/{chunk-IZWQKAGJ.js → chunk-OCL2YCAU.js} +3 -3
  53. package/{chunk-BXLB7DXE.js → chunk-P3AS5IPM.js} +97 -2
  54. package/{chunk-M67M3AK5.js → chunk-PHDKTASK.js} +1 -1
  55. package/{chunk-SENTM5XJ.js → chunk-Q246OUG5.js} +3 -3
  56. package/{chunk-WHYTL6XG.js → chunk-Q4KVAB6L.js} +2 -2
  57. package/{chunk-QDOYVIIL.js → chunk-S6STPUMG.js} +4 -4
  58. package/{chunk-PZCTYKGU.js → chunk-T4F2EQGN.js} +2 -2
  59. package/{chunk-A3GDWRW6.js → chunk-TGRQUFLU.js} +1 -1
  60. package/{chunk-KIAHQ37Z.js → chunk-UINEAQ2R.js} +1 -1
  61. package/{chunk-CADAR6QU.js → chunk-UO66QKGI.js} +2 -2
  62. package/{chunk-XPMTSMUR.js → chunk-US463UAD.js} +2 -2
  63. package/{chunk-AJHEFRGJ.js → chunk-UWMQ6FPM.js} +4 -0
  64. package/{chunk-TR54UTFI.js → chunk-VARZWSKW.js} +2 -2
  65. package/{chunk-KMIMGCZT.js → chunk-VQD6BTML.js} +3 -3
  66. package/{chunk-EVCXTAOR.js → chunk-VW3YGKWR.js} +8 -8
  67. package/{chunk-EFWQMKEG.js → chunk-W7PGACND.js} +9 -9
  68. package/{chunk-5XV64MAU.js → chunk-WSOMSDQB.js} +1 -1
  69. package/{chunk-TMPLPCVX.js → chunk-X77EN2BJ.js} +2 -2
  70. package/{chunk-WVXCW7DR.js → chunk-XCSSFPTB.js} +9 -4
  71. package/{chunk-2LX7X7HX.js → chunk-Y2IFJ7VM.js} +29 -1
  72. package/{chunk-EDZAJS6E.js → chunk-ZIHJVHFH.js} +1 -1
  73. package/{chunk-UMYXJWI3.js → chunk-ZKGIAM7I.js} +1 -1
  74. package/chunk-ZSG2AQU4.js +626 -0
  75. package/{contentThunks-2N2J3EGF.js → contentThunks-Y2ACIFDB.js} +14 -14
  76. package/{createAgentAutomationAction-7QO4ZVVP.js → createAgentAutomationAction-TNE3QMJR.js} +14 -14
  77. package/{createDialogAction-PC2IQ4T7.js → createDialogAction-BMGHBTQB.js} +16 -16
  78. package/{createPageAction-EFL5EC22.js → createPageAction-FFNIZPIS.js} +14 -14
  79. package/{dbSlice-JNK4XZ27.js → dbSlice-4CUQE35F.js} +1 -1
  80. package/{dialogCommands-BSOWO6CA.js → dialogCommands-3JC3BIXC.js} +18 -18
  81. package/{dialogSlice-W6X5G2KS.js → dialogSlice-3E7Z7HZV.js} +13 -13
  82. package/{docCreateCommands-LWZU23FP.js → docCreateCommands-6LNQLCTA.js} +17 -17
  83. package/{docDeleteCommands-RR6GKDDF.js → docDeleteCommands-ZJOAPWZS.js} +18 -18
  84. package/{docReadCommands-JP77ZTCY.js → docReadCommands-LJTRSBG6.js} +17 -17
  85. package/{docStore-DMNGPTL4.js → docStore-R47ABXBB.js} +2 -2
  86. package/{docUpdateCommands-T4OACV4V.js → docUpdateCommands-7P3QF3N2.js} +17 -17
  87. package/{getPricing-QVTUQQTM.js → getPricing-TV6ZB7ES.js} +3 -3
  88. package/{handleSendMessageAction-RJEXW5VS.js → handleSendMessageAction-FFYOGXAO.js} +13 -13
  89. package/index.js +58 -54
  90. package/{localDialogRead-GKTRZFAP.js → localDialogRead-BTFJ4V2I.js} +1 -1
  91. package/{localRuntimeDb-P37ZTX55.js → localRuntimeDb-SYQGUF4U.js} +1 -1
  92. package/{machineCommands-K3VQUSAX.js → machineCommands-FN5GGQV3.js} +37 -37
  93. package/{machineWsRunDispatch-P7RNOLMU.js → machineWsRunDispatch-H47IA7ZT.js} +37 -37
  94. package/{memberThunks-A6OAY77F.js → memberThunks-N35XAOC6.js} +2 -2
  95. package/{models-GS72DVJS.js → models-CMXFDBQH.js} +2 -2
  96. package/package.json +1 -1
  97. package/providerPresetApply-D2GGHPI7.js +214 -0
  98. package/providerRegistry-MU6C4ABD.js +31 -0
  99. package/{readlineWorkspace-FGQLVWLE.js → readlineWorkspace-NXKHYZEU.js} +45 -45
  100. package/{removeDialogAgentAction-6SGBZWSW.js → removeDialogAgentAction-O2POGBOE.js} +4 -4
  101. package/{runAgentClientLoop-75TQMT2H.js → runAgentClientLoop-CEBV5UPD.js} +28 -28
  102. package/{runtimeDoctorCommands-CROTMULY.js → runtimeDoctorCommands-X6WDBEQX.js} +2 -2
  103. package/{setDialogExtraReferencesAction-LC3SOVJO.js → setDialogExtraReferencesAction-KPSVVY3C.js} +2 -2
  104. package/{setPrimaryDialogAgentAction-XE2HIEVY.js → setPrimaryDialogAgentAction-RMJETONI.js} +4 -4
  105. package/{settingSlice-GJYAXZZ6.js → settingSlice-I6MTTNDX.js} +3 -3
  106. package/{spaceCommands-7GMVZQYI.js → spaceCommands-JHT4ALCQ.js} +17 -17
  107. package/{streamAgentChatTurn-JYKKAOEU.js → streamAgentChatTurn-SFCZP4GY.js} +34 -34
  108. package/{switchDialogAgentAction-EDYI5RLR.js → switchDialogAgentAction-OQSGWVQQ.js} +1 -1
  109. package/{tools-PCY3TDNR.js → tools-K3YOTESV.js} +25 -25
  110. package/{tuiSummaryLlmCaller-CCYGQDGB.js → tuiSummaryLlmCaller-T2OA5ZVB.js} +8 -8
  111. package/{updateDialogTitleAction-36NOSXEX.js → updateDialogTitleAction-CSPKYQRO.js} +14 -14
  112. package/{db-VQSAOWAO.js → db-WK5MDZVN.js} +1 -1
  113. package/{localRuntimeAuthority-R5UBODT3.js → localRuntimeAuthority-6IR6BBXE.js} +3 -3
@@ -1,28 +1,28 @@
1
1
  import {
2
2
  addContentToSpace
3
- } from "./chunk-QDOYVIIL.js";
3
+ } from "./chunk-S6STPUMG.js";
4
4
  import {
5
5
  prepareAndPersistMessage,
6
6
  uiAskChoiceFunc,
7
7
  uiAskChoiceFunctionSchema
8
- } from "./chunk-QIU65GHY.js";
8
+ } from "./chunk-L2VNQQ7M.js";
9
9
  import {
10
10
  require_date_fns
11
11
  } from "./chunk-M76ECQRD.js";
12
12
  import {
13
13
  buildBuiltinObjectSkillReference
14
- } from "./chunk-WVXCW7DR.js";
14
+ } from "./chunk-XCSSFPTB.js";
15
15
  import {
16
16
  PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL,
17
17
  PLATFORM_HOSTED_KIMI_PROVIDER
18
- } from "./chunk-AJHEFRGJ.js";
18
+ } from "./chunk-UWMQ6FPM.js";
19
19
  import {
20
20
  read,
21
21
  readAndWait,
22
22
  removeCachedEntity,
23
23
  upsertSSREntity,
24
24
  write
25
- } from "./chunk-X7WAX4JU.js";
25
+ } from "./chunk-5EJZGJS2.js";
26
26
  import {
27
27
  createAgentKey,
28
28
  createDialogKey,
@@ -27,7 +27,7 @@ import {
27
27
  resolveLocalUserId,
28
28
  t,
29
29
  toolLabel
30
- } from "./chunk-M2ZBPSGH.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-2LX7X7HX.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-NJBLAV2R.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-5CEIOSBX.js";
87
+ } from "./chunk-6RCZYDDC.js";
88
88
  import {
89
89
  API_REPORTED_COST_MULTIPLIER,
90
90
  parseUiAskChoiceContent
91
- } from "./chunk-QIU65GHY.js";
91
+ } from "./chunk-L2VNQQ7M.js";
92
92
  import {
93
93
  isOAuthApiKeyRef
94
94
  } from "./chunk-YYLHWIW6.js";
@@ -99,7 +99,7 @@ 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";
@@ -111,10 +111,10 @@ import {
111
111
  LOCAL_AGENT_CONFIG_MISSING_CODE,
112
112
  LOCAL_TURN_ABORTED_CODE,
113
113
  readActionGate
114
- } from "./chunk-EVCXTAOR.js";
114
+ } from "./chunk-VW3YGKWR.js";
115
115
  import {
116
116
  resolveAgentRuntimeConfigFromRecord
117
- } from "./chunk-5XV64MAU.js";
117
+ } from "./chunk-WSOMSDQB.js";
118
118
  import {
119
119
  createThinkParserState,
120
120
  flushThinkParser,
@@ -128,21 +128,21 @@ import {
128
128
  } from "./chunk-CJCJF5XB.js";
129
129
  import {
130
130
  isAntigravityOAuthAgent
131
- } from "./chunk-LHDV2QUI.js";
131
+ } from "./chunk-DS3SQTDT.js";
132
132
  import {
133
133
  resolveClientVersion
134
- } from "./chunk-TMPLPCVX.js";
134
+ } from "./chunk-X77EN2BJ.js";
135
135
  import {
136
136
  DEFAULT_CONTEXT_WINDOW,
137
137
  getModelContextWindow,
138
138
  normalizeUsage
139
- } from "./chunk-IZWQKAGJ.js";
139
+ } from "./chunk-OCL2YCAU.js";
140
140
  import {
141
141
  clipCompactText
142
- } from "./chunk-DJM4BCSB.js";
142
+ } from "./chunk-KT6LENVP.js";
143
143
  import {
144
144
  findModelConfig
145
- } from "./chunk-MXUSPS2N.js";
145
+ } from "./chunk-6H7GN3JL.js";
146
146
  import {
147
147
  compactWhitespace
148
148
  } from "./chunk-DWLEOOGR.js";
@@ -167,7 +167,7 @@ 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";
@@ -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-UYU2POZ7.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();
@@ -12073,6 +12073,273 @@ var rankMemoryCandidates = (items, query, context) => {
12073
12073
  });
12074
12074
  };
12075
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
+
12076
12343
  // packages/ai/memory/runtime.ts
12077
12344
  var COLD_STORAGE_CONFIDENCE = 0.3;
12078
12345
  var MEMORY_OVERLAY_TOKEN_BUDGET = DEFAULT_MEMORY_OVERLAY_TOKEN_BUDGET;
@@ -12196,6 +12463,7 @@ var resolveMemoryRuntime = async (input) => {
12196
12463
  return { selectedItems: [], promptBlock: null };
12197
12464
  }
12198
12465
  const policy = resolveAgentMemoryPolicy({ agentKey: input.agentKey });
12466
+ const legacyStartedAt = performance.now();
12199
12467
  const candidates = await loadMemoryCandidatesFromDb(input.db, {
12200
12468
  owners,
12201
12469
  subjects: buildMemorySubjectsForAgent({
@@ -12222,13 +12490,29 @@ var resolveMemoryRuntime = async (input) => {
12222
12490
  input.userInput
12223
12491
  );
12224
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
+ }
12225
12509
  if (selected.length === 0) {
12226
12510
  return { selectedItems: [], promptBlock: null };
12227
12511
  }
12228
12512
  await touchMemoryItemsInDb(input.db, selected);
12229
12513
  return {
12230
12514
  selectedItems: selected,
12231
- promptBlock: buildMemoryOverlay(selected, { maxTokens: MEMORY_OVERLAY_TOKEN_BUDGET })
12515
+ promptBlock
12232
12516
  };
12233
12517
  };
12234
12518
 
@@ -12272,7 +12556,8 @@ var queryLocalMemory = async (env, agentKey, userInput, spaceId) => {
12272
12556
  userId: machineId,
12273
12557
  agentKey,
12274
12558
  userInput,
12275
- ...spaceId ? { spaceId } : {}
12559
+ ...spaceId ? { spaceId } : {},
12560
+ ...isMemoryVNextShadowReadEnabled(env) ? { vNextShadowProvider: void 0 } : {}
12276
12561
  });
12277
12562
  return resolution.promptBlock;
12278
12563
  };
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  patch,
12
12
  readAndWait
13
- } from "./chunk-X7WAX4JU.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-2N2J3EGF.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-EFL5EC22.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-PP3LAL6G.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-TMPLPCVX.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-TMPLPCVX.js";
38
+ } from "./chunk-X77EN2BJ.js";
39
39
  import {
40
40
  clipCompactText,
41
41
  isMeaningfulChatCompletionOutput,
42
42
  isMeaningfulResponsesOutput
43
- } from "./chunk-DJM4BCSB.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";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  selectCurrentServer,
3
3
  selectRemoteServers
4
- } from "./chunk-S6FCVZ4I.js";
4
+ } from "./chunk-JITSBA52.js";
5
5
  import {
6
6
  createUserKey,
7
7
  extractAgentInfo,
@@ -6,10 +6,10 @@ import {
6
6
  } from "./chunk-OKCTLCKS.js";
7
7
  import {
8
8
  isAntigravityOAuthAgent
9
- } from "./chunk-LHDV2QUI.js";
9
+ } from "./chunk-DS3SQTDT.js";
10
10
  import {
11
11
  getModelAbility
12
- } from "./chunk-NG4UT4K4.js";
12
+ } from "./chunk-23RQKXP6.js";
13
13
  import {
14
14
  isOwnedAgentKey,
15
15
  ownedAgentKey,
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-UAD2WT54.js";
8
8
  import {
9
9
  toTimestampMs
10
- } from "./chunk-X7WAX4JU.js";
10
+ } from "./chunk-5EJZGJS2.js";
11
11
  import {
12
12
  fetchFromServer,
13
13
  getAllServers