nolo-cli 0.95.0 → 0.95.2

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 (66) hide show
  1. package/{_executeModel-4NTXSCYT.js → _executeModel-FHVKWYM6.js} +12 -11
  2. package/{agentDeleteCommand-QYCCUQ35.js → agentDeleteCommand-DOLMLJZY.js} +2 -2
  3. package/{agentEmailCommands-GJ7KXHA6.js → agentEmailCommands-VCSJEPS5.js} +12 -11
  4. package/{agentListCommands-JDU7V3M5.js → agentListCommands-KDUUK43W.js} +5 -4
  5. package/{agentMachineCommands-PXJG3EDI.js → agentMachineCommands-T4S2SKM7.js} +2 -2
  6. package/{agentProviderCommands-YK2BIIXZ.js → agentProviderCommands-EMZCM6VA.js} +1 -1
  7. package/{agentRecordCommands-3ONMYU6P.js → agentRecordCommands-KWYFBGGM.js} +12 -11
  8. package/{agentRunCommand-L6NJGDBA.js → agentRunCommand-TSJYA3FG.js} +13 -11
  9. package/{agentSlice-X63VSE6R.js → agentSlice-TAN3VE3F.js} +1 -1
  10. package/{appDeleteCommands-IP22BHZE.js → appDeleteCommands-NP3I5YYM.js} +3 -3
  11. package/{appDeployCommands-5ZTQL6UL.js → appDeployCommands-IYN5MAGE.js} +3 -3
  12. package/{appDeployStatusCommands-G6EMAT75.js → appDeployStatusCommands-OYXWAOZY.js} +3 -3
  13. package/{appGetCommands-UXBDAYEM.js → appGetCommands-REZRXL5C.js} +3 -3
  14. package/{appListCommands-J274GTVP.js → appListCommands-BWBQVCHS.js} +3 -3
  15. package/{authCommand-W6I6GD3F.js → authCommand-2YPMMIJN.js} +3 -1
  16. package/{authCommands-GBIFZWD3.js → authCommands-FFDS4FVX.js} +3 -1
  17. package/{chatQueueReduxAdapter-KN774OKJ.js → chatQueueReduxAdapter-LUITNDHM.js} +2 -2
  18. package/{chunk-LVITW736.js → chunk-45LEXXBA.js} +1 -1
  19. package/{chunk-XTDH3PGV.js → chunk-46QN2LLF.js} +2 -2
  20. package/{chunk-5T2W2ZZN.js → chunk-5HA43UJR.js} +2 -2
  21. package/{chunk-V2SAIXHE.js → chunk-73UI35ZR.js} +8 -8
  22. package/{chunk-IX27RP45.js → chunk-747P46PX.js} +1 -1
  23. package/{chunk-67HHBCFJ.js → chunk-7IJ3GSRH.js} +1 -1
  24. package/{chunk-DA54MHPJ.js → chunk-BOXCA27H.js} +1 -1
  25. package/{chunk-ALFH24P3.js → chunk-DAWDCRIG.js} +26 -1
  26. package/{chunk-6UPZ63YT.js → chunk-DSGNKZJQ.js} +3 -3
  27. package/{chunk-S3VFZW75.js → chunk-GTOC7LZK.js} +3 -3
  28. package/{chunk-2JCOP36I.js → chunk-HFVB2C5R.js} +2 -2
  29. package/{chunk-5B7XS6UO.js → chunk-HP2HV7RZ.js} +7 -0
  30. package/{chunk-M73PVOVS.js → chunk-JHIBHYFI.js} +5 -5
  31. package/{chunk-RE3CDVRX.js → chunk-JQ3LMOON.js} +5 -5
  32. package/{chunk-CQMQXVFQ.js → chunk-NZI2ZYHG.js} +22 -82
  33. package/{chunk-VPFEPRME.js → chunk-OTEMQQZI.js} +71 -5
  34. package/{chunk-M3LRSBOX.js → chunk-QXWGM7NK.js} +1 -1
  35. package/{chunk-CJXHT3S7.js → chunk-QZIMXTVA.js} +2 -2
  36. package/{chunk-IUVCUGQR.js → chunk-SDAPKV2N.js} +1 -1
  37. package/{chunk-67T7O467.js → chunk-SN2U5EE7.js} +1 -1
  38. package/chunk-TY3TIUJK.js +89 -0
  39. package/{chunk-HWRQVJGX.js → chunk-WMWWWEOD.js} +3 -3
  40. package/{chunk-7VJHIB2S.js → chunk-ZB74UNQO.js} +18 -11
  41. package/{chunk-RKGKDQGJ.js → chunk-ZGESTNDD.js} +6 -3
  42. package/{commandRegistry-NPS6IYBO.js → commandRegistry-QOHT7JSU.js} +52 -52
  43. package/{contentThunks-EB4JFL4K.js → contentThunks-IZNZSYYA.js} +3 -3
  44. package/{createAgentAutomationAction-NZS7N4AW.js → createAgentAutomationAction-CXAH6ILC.js} +3 -3
  45. package/{createDialogAction-4Q4J7P4T.js → createDialogAction-SWNFDMW7.js} +4 -4
  46. package/{createPageAction-FPKRGV7D.js → createPageAction-FLSNADKO.js} +3 -3
  47. package/{dialogCommands-XXZH5K6U.js → dialogCommands-HGPLTR7F.js} +3 -3
  48. package/{dialogSlice-DXEZ3PA3.js → dialogSlice-YQYHIFM2.js} +2 -2
  49. package/{docCreateCommands-FLNUDWG6.js → docCreateCommands-JF7ESYW4.js} +2 -2
  50. package/{docDeleteCommands-74OURFAB.js → docDeleteCommands-AW73ITQG.js} +3 -3
  51. package/{docReadCommands-QENWDQVH.js → docReadCommands-EBDXJIOQ.js} +2 -2
  52. package/{docStore-2JTPJVFK.js → docStore-L53U56P2.js} +1 -1
  53. package/{docUpdateCommands-J4HWJ5JO.js → docUpdateCommands-CWY6K7MV.js} +2 -2
  54. package/{handleSendMessageAction-FGPHI364.js → handleSendMessageAction-KRJ6MAIU.js} +2 -2
  55. package/index.js +2 -2
  56. package/{machineCommands-26AZP4AS.js → machineCommands-7APHQRKW.js} +11 -10
  57. package/{machineWsRunDispatch-GQ5XJ2DL.js → machineWsRunDispatch-NB4P2AAX.js} +11 -10
  58. package/package.json +1 -1
  59. package/{providerPresetApply-DD6NGWW6.js → providerPresetApply-76AVU3HD.js} +1 -1
  60. package/{providerRegistry-XDRLMYGJ.js → providerRegistry-Z62NC45X.js} +5 -1
  61. package/{readlineWorkspace-B7NBQCX6.js → readlineWorkspace-BMLSOADY.js} +17 -15
  62. package/{runAgentClientLoop-RVB5K6R2.js → runAgentClientLoop-AWNTP65H.js} +10 -9
  63. package/{spaceCommands-BYDGOMW7.js → spaceCommands-RGR6F3DS.js} +2 -2
  64. package/{streamAgentChatTurn-HV3FSRHN.js → streamAgentChatTurn-2ESML36B.js} +11 -10
  65. package/{tools-AZR26MXC.js → tools-EPBZAWEI.js} +8 -7
  66. package/{updateDialogTitleAction-HEWCCXZZ.js → updateDialogTitleAction-N2HDHPVN.js} +3 -3
@@ -16,6 +16,9 @@ import {
16
16
  PLATFORM_HOSTED_DEEPSEEK_PRO_OFF_PEAK_PRICE,
17
17
  PLATFORM_HOSTED_DEEPSEEK_PRO_PEAK_PRICE
18
18
  } from "./chunk-Y3PMXGLH.js";
19
+ import {
20
+ asTrimmedLowercaseString
21
+ } from "./chunk-QSJ3HFEF.js";
19
22
 
20
23
  // packages/integrations/commandcode/models.ts
21
24
  var commandCodeModels = [
@@ -715,6 +718,26 @@ function isCustomApiKeyTemplate(id) {
715
718
  if (!id) return false;
716
719
  return CUSTOM_API_KEY_TEMPLATES.some((p) => p.id === id);
717
720
  }
721
+ function normalizeEndpointUrl(url) {
722
+ return asTrimmedLowercaseString(url).replace(/\/+$/, "");
723
+ }
724
+ var SUBSCRIPTION_ENDPOINT_URLS = new Set(
725
+ CUSTOM_API_KEY_TEMPLATES.filter((t) => t.commercialKind === "subscription").map(
726
+ (t) => normalizeEndpointUrl(t.baseUrl)
727
+ )
728
+ );
729
+ var SUBSCRIPTION_OAUTH_APIKEY_REFS = new Set(
730
+ SUBSCRIPTION_OAUTH_PROVIDERS.map((p) => asTrimmedLowercaseString(p.apiKeyRef))
731
+ );
732
+ function isSubscriptionEndpoint(customProviderUrl) {
733
+ if (typeof customProviderUrl !== "string") return false;
734
+ const normalized = normalizeEndpointUrl(customProviderUrl);
735
+ return normalized.length > 0 && SUBSCRIPTION_ENDPOINT_URLS.has(normalized);
736
+ }
737
+ function isSubscriptionOAuthCredential(apiKeyRef) {
738
+ const ref = asTrimmedLowercaseString(apiKeyRef ?? "");
739
+ return ref.length > 0 && SUBSCRIPTION_OAUTH_APIKEY_REFS.has(ref);
740
+ }
718
741
 
719
742
  export {
720
743
  SUBSCRIPTION_OAUTH_PROVIDERS,
@@ -722,5 +745,7 @@ export {
722
745
  ALL_PROVIDER_REGISTRY,
723
746
  findProviderById,
724
747
  isSubscriptionOAuthProvider,
725
- isCustomApiKeyTemplate
748
+ isCustomApiKeyTemplate,
749
+ isSubscriptionEndpoint,
750
+ isSubscriptionOAuthCredential
726
751
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  clearCliLocalRuntimePreparedAgentCache
3
- } from "./chunk-RE3CDVRX.js";
3
+ } from "./chunk-JQ3LMOON.js";
4
4
  import {
5
5
  getReadableCliDb
6
6
  } from "./chunk-CTUQJVQM.js";
@@ -12,7 +12,7 @@ import {
12
12
  resolveAgentRecordFromHybridStore,
13
13
  sanitizeAgentRecordForCliOutput,
14
14
  writeAgentRecord
15
- } from "./chunk-M3LRSBOX.js";
15
+ } from "./chunk-QXWGM7NK.js";
16
16
  import {
17
17
  resolveCliAgentKeyInput
18
18
  } from "./chunk-SV5IJK6K.js";
@@ -212,7 +212,7 @@ async function runAgentCreateCommand(args, deps = {}) {
212
212
  clearCliLocalRuntimePreparedAgentCache();
213
213
  let verifyResult;
214
214
  if (parsed.verify) {
215
- const { verifyCustomProvider } = await import("./agentProviderCommands-YK2BIIXZ.js");
215
+ const { verifyCustomProvider } = await import("./agentProviderCommands-EMZCM6VA.js");
216
216
  const rec = built.nextRecord;
217
217
  verifyResult = await verifyCustomProvider({
218
218
  providerUrl: rec.customProviderUrl,
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  clipMultilineText,
9
9
  fetchAndSerializeTable
10
- } from "./chunk-7VJHIB2S.js";
10
+ } from "./chunk-ZB74UNQO.js";
11
11
  import {
12
12
  isGatewayHttpStatus
13
13
  } from "./chunk-NF64D32W.js";
@@ -29,13 +29,13 @@ import {
29
29
  } from "./chunk-MEYIRKDN.js";
30
30
  import {
31
31
  fetchAndCacheMessages
32
- } from "./chunk-V2SAIXHE.js";
32
+ } from "./chunk-73UI35ZR.js";
33
33
  import {
34
34
  shouldUseServerProxy
35
35
  } from "./chunk-YYLHWIW6.js";
36
36
  import {
37
37
  fetchServerSyncedCredential
38
- } from "./chunk-HWRQVJGX.js";
38
+ } from "./chunk-WMWWWEOD.js";
39
39
  import {
40
40
  buildSkillGuidancePromptBlock,
41
41
  extractRuntimePageCapabilities,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  toolRegistry
3
- } from "./chunk-7VJHIB2S.js";
3
+ } from "./chunk-ZB74UNQO.js";
4
4
  import {
5
5
  runtime_default
6
- } from "./chunk-V2SAIXHE.js";
6
+ } from "./chunk-73UI35ZR.js";
7
7
  import {
8
8
  canonicalizeToolNames
9
9
  } from "./chunk-XUWRURDF.js";
@@ -1,3 +1,7 @@
1
+ import {
2
+ isSubscriptionEndpoint,
3
+ isSubscriptionOAuthCredential
4
+ } from "./chunk-DAWDCRIG.js";
1
5
  import {
2
6
  isOAuthApiKeyRef
3
7
  } from "./chunk-YYLHWIW6.js";
@@ -39,6 +43,9 @@ function resolveBillingSource(candidate) {
39
43
  }
40
44
  if (candidate?.isOAuth === true || candidate?.billingSource === "user_subscription" || candidate?.apiSource === "oauth" || isOAuthApiKeyRef(candidate?.apiKeyRef)) return "user_subscription";
41
45
  if (candidate?.apiSource === "custom" || candidate?.billingSource === "user_api") {
46
+ if (isSubscriptionEndpoint(candidate?.customProviderUrl) || isSubscriptionOAuthCredential(candidate?.apiKeyRef)) {
47
+ return "user_subscription";
48
+ }
42
49
  return "user_api";
43
50
  }
44
51
  return "platform_credits";
@@ -5,7 +5,7 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-2JCOP36I.js";
8
+ } from "./chunk-HFVB2C5R.js";
9
9
  import {
10
10
  parseApiError
11
11
  } from "./chunk-OCZKATRC.js";
@@ -15,7 +15,7 @@ import {
15
15
  parseToolCallArguments,
16
16
  performFetchRequest,
17
17
  sanitizeOutboundMessages
18
- } from "./chunk-S3VFZW75.js";
18
+ } from "./chunk-GTOC7LZK.js";
19
19
  import {
20
20
  createSSEParser,
21
21
  createToolRunId,
@@ -26,7 +26,7 @@ import {
26
26
  toolRunSetPending,
27
27
  toolRunStarted,
28
28
  toolRunSucceeded
29
- } from "./chunk-7VJHIB2S.js";
29
+ } from "./chunk-ZB74UNQO.js";
30
30
  import {
31
31
  getCurrentSpaceId
32
32
  } from "./chunk-ZJ7UHBJS.js";
@@ -35,10 +35,10 @@ import {
35
35
  messageStreamEnd,
36
36
  messageStreaming,
37
37
  updateToolMessage
38
- } from "./chunk-V2SAIXHE.js";
38
+ } from "./chunk-73UI35ZR.js";
39
39
  import {
40
40
  streamAgentChatTurn
41
- } from "./chunk-HWRQVJGX.js";
41
+ } from "./chunk-WMWWWEOD.js";
42
42
  import {
43
43
  addActiveController,
44
44
  removeActiveController,
@@ -66,7 +66,7 @@ import {
66
66
  import {
67
67
  inlineImageUrlsForCustomProvider,
68
68
  prepareTools
69
- } from "./chunk-2JCOP36I.js";
69
+ } from "./chunk-HFVB2C5R.js";
70
70
  import {
71
71
  getServerProviderSecret
72
72
  } from "./chunk-HS7MLR74.js";
@@ -84,11 +84,11 @@ import {
84
84
  rememberMemoryFunctionSchema,
85
85
  resolveAgentRequiredPackIds,
86
86
  setTodoListFunc
87
- } from "./chunk-7VJHIB2S.js";
87
+ } from "./chunk-ZB74UNQO.js";
88
88
  import {
89
89
  deriveCredentialGroup,
90
90
  deriveCustomProviderCredentialGroup
91
- } from "./chunk-5B7XS6UO.js";
91
+ } from "./chunk-HP2HV7RZ.js";
92
92
  import {
93
93
  fetchWithTransientRetry,
94
94
  isTransientFetchError
@@ -112,14 +112,14 @@ import {
112
112
  prepareTokenUsageData,
113
113
  resolveBuiltinPlatformAgentConfig,
114
114
  runKeyed
115
- } from "./chunk-V2SAIXHE.js";
115
+ } from "./chunk-73UI35ZR.js";
116
116
  import {
117
117
  BUILTIN_DIALOG_LLM_CHAT_FALLBACK_MODEL,
118
118
  BUILTIN_TITLE_LLM_CONFIG
119
119
  } from "./chunk-523DITKR.js";
120
120
  import {
121
121
  fetchServerSyncedCredential
122
- } from "./chunk-HWRQVJGX.js";
122
+ } from "./chunk-WMWWWEOD.js";
123
123
  import {
124
124
  getModelPricing
125
125
  } from "./chunk-4DPP773Q.js";
@@ -28,7 +28,7 @@ import {
28
28
  t,
29
29
  toolLabel,
30
30
  toolLabelVariants
31
- } from "./chunk-RE3CDVRX.js";
31
+ } from "./chunk-JQ3LMOON.js";
32
32
  import {
33
33
  clearCredentialAvailability,
34
34
  readCredentialEntry,
@@ -37,13 +37,27 @@ import {
37
37
  import {
38
38
  getReadableCliDb
39
39
  } from "./chunk-CTUQJVQM.js";
40
+ import {
41
+ _appendEntityBatch,
42
+ _appendEvidenceBatch,
43
+ _appendRelationBatch,
44
+ _appendRetiredStateBatch,
45
+ _appendStateBatch,
46
+ getMemoryEntityVNext,
47
+ getMemoryEvidenceVNext,
48
+ getMemoryEvidenceVNextStrict,
49
+ getMemoryStateVNext,
50
+ listMemoryStatesForEntityVNext,
51
+ loadMemoryVNextCatalog,
52
+ putMemoryEvidenceVNext
53
+ } from "./chunk-TY3TIUJK.js";
40
54
  import {
41
55
  resolveMachineId
42
56
  } from "./chunk-ESHYE7WU.js";
43
57
  import {
44
58
  readDbRecord,
45
59
  resolveAgentRecordFromHybridStore
46
- } from "./chunk-M3LRSBOX.js";
60
+ } from "./chunk-QXWGM7NK.js";
47
61
  import {
48
62
  isLocalCliAgentKey
49
63
  } from "./chunk-SV5IJK6K.js";
@@ -75,7 +89,7 @@ import {
75
89
  } from "./chunk-LTRXGFMS.js";
76
90
  import {
77
91
  formatAgentListCard
78
- } from "./chunk-7VJHIB2S.js";
92
+ } from "./chunk-ZB74UNQO.js";
79
93
  import {
80
94
  isGatewayHttpStatus
81
95
  } from "./chunk-NF64D32W.js";
@@ -96,11 +110,11 @@ import {
96
110
  chooseMemoryOwners,
97
111
  loadMemoryCandidatesFromDb,
98
112
  resolveAgentMemoryPolicy
99
- } from "./chunk-5T2W2ZZN.js";
113
+ } from "./chunk-5HA43UJR.js";
100
114
  import {
101
115
  API_REPORTED_COST_MULTIPLIER,
102
116
  parseUiAskChoiceContent
103
- } from "./chunk-V2SAIXHE.js";
117
+ } from "./chunk-73UI35ZR.js";
104
118
  import {
105
119
  isOAuthApiKeyRef
106
120
  } from "./chunk-YYLHWIW6.js";
@@ -188,9 +202,6 @@ import {
188
202
  import {
189
203
  asTrimmedLowercaseString
190
204
  } from "./chunk-QSJ3HFEF.js";
191
- import {
192
- isLevelNotFoundError
193
- } from "./chunk-OW765XBU.js";
194
205
  import {
195
206
  BUILTIN_NOLO_AGENT_KEY,
196
207
  BUILTIN_NOLO_AGENT_NAME,
@@ -12476,77 +12487,6 @@ var rankMemoryCandidates = (items, query, context) => {
12476
12487
  });
12477
12488
  };
12478
12489
 
12479
- // packages/ai/memory/vnext/store.ts
12480
- var enc = (value) => encodeURIComponent(value).replace(/-/g, "%2D");
12481
- var rangeOf = (prefix) => ({ gte: prefix, lte: `${prefix}\uFFFF` });
12482
- var entityKey = (ownerId, id) => `mem2-e-${enc(ownerId)}-${enc(id)}`;
12483
- var entityOwnerPrefix = (ownerId) => `mem2-e-${enc(ownerId)}-`;
12484
- var stateKey = (ownerId, id) => `mem2-s-${enc(ownerId)}-${enc(id)}`;
12485
- var stateEntityIndexKey = (ownerId, entityId, stateId) => `mem2-si-${enc(ownerId)}-${enc(entityId)}-${enc(stateId)}`;
12486
- var stateEntityIndexPrefix = (ownerId, entityId) => `mem2-si-${enc(ownerId)}-${enc(entityId)}-`;
12487
- var evidenceKey = (ownerId, id) => `mem2-v-${enc(ownerId)}-${enc(id)}`;
12488
- var relationKey = (ownerId, id) => `mem2-r-${enc(ownerId)}-${enc(id)}`;
12489
- var relationFromIndexKey = (ownerId, from, relationId) => `mem2-rf-${enc(ownerId)}-${enc(from)}-${enc(relationId)}`;
12490
- var relationToIndexKey = (ownerId, to, relationId) => `mem2-rt-${enc(ownerId)}-${enc(to)}-${enc(relationId)}`;
12491
- var readIndexed = async (db, prefix) => {
12492
- const refs = [];
12493
- for await (const [, value] of db.iterator({ ...rangeOf(prefix), reverse: false })) {
12494
- if (typeof value?.key === "string") refs.push(value.key);
12495
- }
12496
- const rows = await Promise.all(refs.map((key) => db.get(key).catch(() => null)));
12497
- return rows.filter((row) => !!row);
12498
- };
12499
- var getMemoryEntityVNext = async (db, ownerId, entityId) => db.get(entityKey(ownerId, entityId)).catch(() => null);
12500
- var listMemoryEntitiesVNext = async (db, ownerId) => {
12501
- const rows = [];
12502
- for await (const [, value] of db.iterator({
12503
- ...rangeOf(entityOwnerPrefix(ownerId)),
12504
- reverse: false
12505
- })) {
12506
- if (value) rows.push(value);
12507
- }
12508
- return rows;
12509
- };
12510
- var loadMemoryVNextCatalog = async (db, ownerId) => {
12511
- const entities = await listMemoryEntitiesVNext(db, ownerId);
12512
- const states = (await Promise.all(entities.map((entity) => listMemoryStatesForEntityVNext(db, ownerId, entity.id)))).flat();
12513
- return { entities, states };
12514
- };
12515
- var getMemoryStateVNext = async (db, ownerId, stateId) => db.get(stateKey(ownerId, stateId)).catch(() => null);
12516
- var listMemoryStatesForEntityVNext = (db, ownerId, entityId) => readIndexed(db, stateEntityIndexPrefix(ownerId, entityId));
12517
- var putMemoryEvidenceVNext = async (db, evidence) => {
12518
- await db.put(evidenceKey(evidence.ownerId, evidence.id), evidence);
12519
- };
12520
- var getMemoryEvidenceVNext = async (db, ownerId, evidenceId) => db.get(evidenceKey(ownerId, evidenceId)).catch(() => null);
12521
- var getMemoryEvidenceVNextStrict = async (db, ownerId, evidenceId) => {
12522
- try {
12523
- return await db.get(evidenceKey(ownerId, evidenceId));
12524
- } catch (error) {
12525
- if (isLevelNotFoundError(error)) return null;
12526
- throw error;
12527
- }
12528
- };
12529
- var _appendEntityBatch = (batch, entity) => {
12530
- batch.put(entityKey(entity.ownerId, entity.id), entity);
12531
- };
12532
- var _appendEvidenceBatch = (batch, evidence) => {
12533
- batch.put(evidenceKey(evidence.ownerId, evidence.id), evidence);
12534
- };
12535
- var _appendStateBatch = (batch, state2) => {
12536
- const key = stateKey(state2.ownerId, state2.id);
12537
- batch.put(key, state2);
12538
- batch.put(stateEntityIndexKey(state2.ownerId, state2.entityId, state2.id), { key });
12539
- };
12540
- var _appendRetiredStateBatch = (batch, state2) => {
12541
- batch.put(stateKey(state2.ownerId, state2.id), state2);
12542
- };
12543
- var _appendRelationBatch = (batch, relation) => {
12544
- const key = relationKey(relation.ownerId, relation.id);
12545
- batch.put(key, relation);
12546
- batch.put(relationFromIndexKey(relation.ownerId, relation.from, relation.id), { key });
12547
- batch.put(relationToIndexKey(relation.ownerId, relation.to, relation.id), { key });
12548
- };
12549
-
12550
12490
  // packages/ai/memory/vnext/recall.ts
12551
12491
  var MAX_RECALL_REFS = 6;
12552
12492
  var stripFence = (raw) => {
@@ -13697,9 +13637,9 @@ async function resolvePureVNextRuntime(input) {
13697
13637
  });
13698
13638
  const entityById = new Map(catalog.entities.map((e) => [e.id, e]));
13699
13639
  for (const hit of hits) {
13700
- const stateKey2 = `${hit.state.ownerId}\0${hit.state.id}`;
13701
- if (seenStateKeys.has(stateKey2)) continue;
13702
- seenStateKeys.add(stateKey2);
13640
+ const stateKey = `${hit.state.ownerId}\0${hit.state.id}`;
13641
+ if (seenStateKeys.has(stateKey)) continue;
13642
+ seenStateKeys.add(stateKey);
13703
13643
  selectedItems.push(
13704
13644
  buildSynthesizedStateItem(hit.state, entityById.get(hit.state.entityId), owner.ownerType, owner.ownerId)
13705
13645
  );
@@ -1,3 +1,7 @@
1
+ import {
2
+ _appendRetiredStateBatch,
3
+ loadMemoryVNextCatalog
4
+ } from "./chunk-TY3TIUJK.js";
1
5
  import {
2
6
  resolveMachineId
3
7
  } from "./chunk-ESHYE7WU.js";
@@ -39,6 +43,29 @@ import { stdin as input, stdout as output } from "node:process";
39
43
  import { spawn } from "node:child_process";
40
44
 
41
45
  // packages/ai/memory/delete.ts
46
+ var VNEXT_STATE_ID_PREFIX = "vnext-state-";
47
+ var toVNextMemoryItem = (state, owner) => ({
48
+ id: `${VNEXT_STATE_ID_PREFIX}${state.id}`,
49
+ ownerType: owner.ownerType,
50
+ ownerId: owner.ownerId,
51
+ visibility: "private",
52
+ subjectType: "user",
53
+ subjectId: owner.ownerId,
54
+ kind: "semantic",
55
+ content: state.text.trim(),
56
+ createdAt: state.createdAt,
57
+ lastActivatedAt: state.createdAt,
58
+ activationCount: 1,
59
+ importance: 0.9,
60
+ confidence: 0.9,
61
+ resident: state.facet === "preference" || state.facet === "style"
62
+ });
63
+ var matchesVNextFilters = (state, idSet, contentSub) => {
64
+ if (!idSet && !contentSub) return false;
65
+ if (idSet && !idSet.has(`${VNEXT_STATE_ID_PREFIX}${state.id}`)) return false;
66
+ if (contentSub && !state.text.toLowerCase().includes(contentSub)) return false;
67
+ return true;
68
+ };
42
69
  function hasExplicitDeleteFilters(filters) {
43
70
  return Boolean(
44
71
  filters.ids && filters.ids.length > 0 || typeof filters.contentSubstring === "string" && filters.contentSubstring.trim().length > 0 || filters.tags && filters.tags.length > 0 || typeof filters.sourceDialogId === "string" && filters.sourceDialogId.trim().length > 0 || typeof filters.patternKeyPrefix === "string" && filters.patternKeyPrefix.trim().length > 0 || filters.facets && filters.facets.length > 0 || typeof filters.subjectId === "string" && filters.subjectId.trim().length > 0
@@ -127,8 +154,32 @@ var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
127
154
  matchedItems.push(item);
128
155
  if (matchedItems.length >= limit) break;
129
156
  }
157
+ const idSet = normalizeSet(filters.ids);
158
+ const contentSub = asTrimmedString(filters.contentSubstring).toLowerCase();
159
+ const vnextStateIdsToRetire = [];
160
+ const vnextStatesToRetire = [];
161
+ const vnextMatchedItems = [];
162
+ let vnextPrincipalId = null;
163
+ const hasScopingFilters = Boolean(
164
+ normalizeSet(filters.kinds) || normalizeSet(filters.facets) || normalizeSet(filters.tags) || asTrimmedString(filters.subjectType) || asTrimmedString(filters.subjectId) || asTrimmedString(filters.patternKeyPrefix) || asTrimmedString(filters.sourceDialogId)
165
+ );
166
+ const canMatchVNext = !hasScopingFilters && (contentSub.length > 0 || idSet !== null && [...idSet].some((id) => id.startsWith(VNEXT_STATE_ID_PREFIX)));
167
+ if (canMatchVNext) {
168
+ vnextPrincipalId = `${owner.ownerType}:${encodeURIComponent(owner.ownerId)}`;
169
+ const catalog = await loadMemoryVNextCatalog(db, vnextPrincipalId);
170
+ for (const state of catalog.states) {
171
+ if (matchedItems.length >= limit) break;
172
+ if (state.retiredAt) continue;
173
+ if (!matchesVNextFilters(state, idSet, contentSub)) continue;
174
+ vnextStateIdsToRetire.push(state.id);
175
+ vnextStatesToRetire.push(state);
176
+ const projected = toVNextMemoryItem(state, owner);
177
+ vnextMatchedItems.push(projected);
178
+ matchedItems.push(projected);
179
+ }
180
+ }
130
181
  if (matchedItems.length === 0) {
131
- return { deletedCount: 0, deletedIds: [], matchedItems: [] };
182
+ return { deletedCount: 0, deletedIds: [], retiredIds: [], matchedItems: [] };
132
183
  }
133
184
  const token = generateMemoryDeletionToken(
134
185
  owner.ownerId,
@@ -138,6 +189,7 @@ var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
138
189
  return {
139
190
  deletedCount: 0,
140
191
  deletedIds: [],
192
+ retiredIds: [],
141
193
  matchedItems,
142
194
  deletionToken: token
143
195
  };
@@ -147,14 +199,28 @@ var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
147
199
  "deletionToken mismatch: memory dataset changed since preview; please rerun dry-run preview before confirming."
148
200
  );
149
201
  }
150
- const batch = db.batch();
151
- for (const item of matchedItems) {
152
- deleteMemoryItemWithIndexesInBatch(batch, item);
202
+ const vnextMatchedIdSet = new Set(
203
+ vnextStateIdsToRetire.map((stateId) => `${VNEXT_STATE_ID_PREFIX}${stateId}`)
204
+ );
205
+ const legacyItems = matchedItems.filter((item) => !vnextMatchedIdSet.has(item.id));
206
+ const shouldRetireVNext = vnextStatesToRetire.length > 0;
207
+ if (legacyItems.length > 0 || shouldRetireVNext) {
208
+ const batch = db.batch();
209
+ for (const item of legacyItems) {
210
+ deleteMemoryItemWithIndexesInBatch(batch, item);
211
+ }
212
+ if (shouldRetireVNext) {
213
+ const nowIso = (/* @__PURE__ */ new Date()).toISOString();
214
+ for (const state of vnextStatesToRetire) {
215
+ _appendRetiredStateBatch(batch, { ...state, retiredAt: nowIso });
216
+ }
217
+ }
218
+ await batch.write();
153
219
  }
154
- await batch.write();
155
220
  return {
156
221
  deletedCount: matchedItems.length,
157
222
  deletedIds: matchedItems.map((item) => item.id),
223
+ retiredIds: vnextMatchedItems.map((item) => item.id),
158
224
  matchedItems,
159
225
  deletionToken: token
160
226
  };
@@ -523,7 +523,7 @@ async function buildCreatedAgentRecord(args) {
523
523
  const resolvedAgentInput = resolveCliAgentKeyInput(args.parsed.agentInput);
524
524
  const agentKey = resolvedAgentInput.startsWith("agent-") ? resolvedAgentInput : createAgentKey.private(userId || "local", resolvedAgentInput);
525
525
  if (args.parsed.presetId) {
526
- const { resolveProviderPresetFields } = await import("./providerPresetApply-DD6NGWW6.js");
526
+ const { resolveProviderPresetFields } = await import("./providerPresetApply-76AVU3HD.js");
527
527
  const fields = resolveProviderPresetFields(args.parsed.presetId);
528
528
  if (fields.kind === "manual") {
529
529
  throw new Error(
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
3
  summarizeEndpoint
4
- } from "./chunk-RE3CDVRX.js";
4
+ } from "./chunk-JQ3LMOON.js";
5
5
  import {
6
6
  clipMultilineText
7
- } from "./chunk-7VJHIB2S.js";
7
+ } from "./chunk-ZB74UNQO.js";
8
8
  import {
9
9
  runLocalAgentTurn
10
10
  } from "./chunk-6IHBIRPK.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readDbRecord,
3
3
  writeAgentRecord
4
- } from "./chunk-M3LRSBOX.js";
4
+ } from "./chunk-QXWGM7NK.js";
5
5
  import {
6
6
  buildSkillSummaryMarker
7
7
  } from "./chunk-VF4K2QE6.js";
@@ -7,7 +7,7 @@ import {
7
7
  listUserRecordsFromServers,
8
8
  readDbRecordFromServers,
9
9
  readLiveDbRecordAfterTombstoneMerge
10
- } from "./chunk-LVITW736.js";
10
+ } from "./chunk-45LEXXBA.js";
11
11
  import {
12
12
  isLevelLockError
13
13
  } from "./chunk-URMS4XY2.js";
@@ -0,0 +1,89 @@
1
+ import {
2
+ isLevelNotFoundError
3
+ } from "./chunk-OW765XBU.js";
4
+
5
+ // packages/ai/memory/vnext/store.ts
6
+ var enc = (value) => encodeURIComponent(value).replace(/-/g, "%2D");
7
+ var rangeOf = (prefix) => ({ gte: prefix, lte: `${prefix}\uFFFF` });
8
+ var entityKey = (ownerId, id) => `mem2-e-${enc(ownerId)}-${enc(id)}`;
9
+ var entityOwnerPrefix = (ownerId) => `mem2-e-${enc(ownerId)}-`;
10
+ var stateKey = (ownerId, id) => `mem2-s-${enc(ownerId)}-${enc(id)}`;
11
+ var stateEntityIndexKey = (ownerId, entityId, stateId) => `mem2-si-${enc(ownerId)}-${enc(entityId)}-${enc(stateId)}`;
12
+ var stateEntityIndexPrefix = (ownerId, entityId) => `mem2-si-${enc(ownerId)}-${enc(entityId)}-`;
13
+ var evidenceKey = (ownerId, id) => `mem2-v-${enc(ownerId)}-${enc(id)}`;
14
+ var relationKey = (ownerId, id) => `mem2-r-${enc(ownerId)}-${enc(id)}`;
15
+ var relationFromIndexKey = (ownerId, from, relationId) => `mem2-rf-${enc(ownerId)}-${enc(from)}-${enc(relationId)}`;
16
+ var relationToIndexKey = (ownerId, to, relationId) => `mem2-rt-${enc(ownerId)}-${enc(to)}-${enc(relationId)}`;
17
+ var readIndexed = async (db, prefix) => {
18
+ const refs = [];
19
+ for await (const [, value] of db.iterator({ ...rangeOf(prefix), reverse: false })) {
20
+ if (typeof value?.key === "string") refs.push(value.key);
21
+ }
22
+ const rows = await Promise.all(refs.map((key) => db.get(key).catch(() => null)));
23
+ return rows.filter((row) => !!row);
24
+ };
25
+ var getMemoryEntityVNext = async (db, ownerId, entityId) => db.get(entityKey(ownerId, entityId)).catch(() => null);
26
+ var listMemoryEntitiesVNext = async (db, ownerId) => {
27
+ const rows = [];
28
+ for await (const [, value] of db.iterator({
29
+ ...rangeOf(entityOwnerPrefix(ownerId)),
30
+ reverse: false
31
+ })) {
32
+ if (value) rows.push(value);
33
+ }
34
+ return rows;
35
+ };
36
+ var loadMemoryVNextCatalog = async (db, ownerId) => {
37
+ const entities = await listMemoryEntitiesVNext(db, ownerId);
38
+ const states = (await Promise.all(entities.map((entity) => listMemoryStatesForEntityVNext(db, ownerId, entity.id)))).flat();
39
+ return { entities, states };
40
+ };
41
+ var getMemoryStateVNext = async (db, ownerId, stateId) => db.get(stateKey(ownerId, stateId)).catch(() => null);
42
+ var listMemoryStatesForEntityVNext = (db, ownerId, entityId) => readIndexed(db, stateEntityIndexPrefix(ownerId, entityId));
43
+ var putMemoryEvidenceVNext = async (db, evidence) => {
44
+ await db.put(evidenceKey(evidence.ownerId, evidence.id), evidence);
45
+ };
46
+ var getMemoryEvidenceVNext = async (db, ownerId, evidenceId) => db.get(evidenceKey(ownerId, evidenceId)).catch(() => null);
47
+ var getMemoryEvidenceVNextStrict = async (db, ownerId, evidenceId) => {
48
+ try {
49
+ return await db.get(evidenceKey(ownerId, evidenceId));
50
+ } catch (error) {
51
+ if (isLevelNotFoundError(error)) return null;
52
+ throw error;
53
+ }
54
+ };
55
+ var _appendEntityBatch = (batch, entity) => {
56
+ batch.put(entityKey(entity.ownerId, entity.id), entity);
57
+ };
58
+ var _appendEvidenceBatch = (batch, evidence) => {
59
+ batch.put(evidenceKey(evidence.ownerId, evidence.id), evidence);
60
+ };
61
+ var _appendStateBatch = (batch, state) => {
62
+ const key = stateKey(state.ownerId, state.id);
63
+ batch.put(key, state);
64
+ batch.put(stateEntityIndexKey(state.ownerId, state.entityId, state.id), { key });
65
+ };
66
+ var _appendRetiredStateBatch = (batch, state) => {
67
+ batch.put(stateKey(state.ownerId, state.id), state);
68
+ };
69
+ var _appendRelationBatch = (batch, relation) => {
70
+ const key = relationKey(relation.ownerId, relation.id);
71
+ batch.put(key, relation);
72
+ batch.put(relationFromIndexKey(relation.ownerId, relation.from, relation.id), { key });
73
+ batch.put(relationToIndexKey(relation.ownerId, relation.to, relation.id), { key });
74
+ };
75
+
76
+ export {
77
+ getMemoryEntityVNext,
78
+ loadMemoryVNextCatalog,
79
+ getMemoryStateVNext,
80
+ listMemoryStatesForEntityVNext,
81
+ putMemoryEvidenceVNext,
82
+ getMemoryEvidenceVNext,
83
+ getMemoryEvidenceVNextStrict,
84
+ _appendEntityBatch,
85
+ _appendEvidenceBatch,
86
+ _appendStateBatch,
87
+ _appendRetiredStateBatch,
88
+ _appendRelationBatch
89
+ };
@@ -304,7 +304,7 @@ var slice = createSliceWithThunks({
304
304
  const overrides = {};
305
305
  if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
306
306
  if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
307
- const { _executeModel } = await import("./_executeModel-4NTXSCYT.js");
307
+ const { _executeModel } = await import("./_executeModel-FHVKWYM6.js");
308
308
  return _executeModel(
309
309
  {
310
310
  isStreaming: args.isStreaming ?? false,
@@ -325,7 +325,7 @@ var slice = createSliceWithThunks({
325
325
  * - 循环直到无工具调用或触发其他运行时停止条件
326
326
  */
327
327
  runAgent: create.asyncThunk(async (args, thunkApi) => {
328
- const { runAgentClientLoop } = await import("./runAgentClientLoop-RVB5K6R2.js");
328
+ const { runAgentClientLoop } = await import("./runAgentClientLoop-AWNTP65H.js");
329
329
  const { content: loopContent, toolCallCount } = await runAgentClientLoop(
330
330
  {
331
331
  agentKey: args.agentKey,
@@ -341,7 +341,7 @@ var slice = createSliceWithThunks({
341
341
  * 聊天轮次流式 Agent 调用
342
342
  */
343
343
  streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
344
- const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-HV3FSRHN.js");
344
+ const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-2ESML36B.js");
345
345
  return streamAgentChatTurnHandler(args, thunkApi);
346
346
  }),
347
347
  /**