nolo-cli 0.8.0-alpha.13 → 0.8.0-alpha.15

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 (55) hide show
  1. package/{_executeModel-EBU7YBDV.js → _executeModel-KUP2WVMT.js} +14 -14
  2. package/{action-SQGI5JY5.js → action-ZJWE3Y5S.js} +3 -3
  3. package/{addContentAction-ZX2PUS3X.js → addContentAction-TVDBNJM5.js} +2 -2
  4. package/{addDialogAgentAction-ULADQX2Q.js → addDialogAgentAction-EKH774VT.js} +1 -1
  5. package/{agentEmailCommands-IC52LATA.js → agentEmailCommands-VSPS3MZT.js} +14 -14
  6. package/{agentMachineCommands-SFWC6KN4.js → agentMachineCommands-7EK7IKEV.js} +1 -1
  7. package/{agentRecordCommands-VLMLWLCM.js → agentRecordCommands-GYLQ5OA6.js} +14 -14
  8. package/{agentRunCommand-D2PVHUGR.js → agentRunCommand-KL2A7CGA.js} +17 -15
  9. package/{agentSlice-IIC7AISR.js → agentSlice-OEHVCG26.js} +2 -2
  10. package/{authCommand-WXMD3IPR.js → authCommand-PXFX6JDT.js} +8 -1
  11. package/{authCommands-X74AFDTC.js → authCommands-356AYWEK.js} +10 -1
  12. package/chunk-3TZDXYSF.js +71 -0
  13. package/{chunk-7XN726FS.js → chunk-4P3XCCG2.js} +26 -14
  14. package/{chunk-QO4YO77G.js → chunk-63SLEOLK.js} +1 -1
  15. package/{chunk-6XKX2N2E.js → chunk-6GANEXVO.js} +1 -1
  16. package/{chunk-IBJC3GOP.js → chunk-AURGW6TR.js} +1 -1
  17. package/{chunk-7U4TQSWU.js → chunk-AWCQ2SK4.js} +3 -3
  18. package/{chunk-DAB7DRXD.js → chunk-BZMZUAFJ.js} +4 -4
  19. package/{chunk-V2AISYMA.js → chunk-COMXDWNM.js} +1 -1
  20. package/{chunk-YDESHYQC.js → chunk-E7LCFMW5.js} +410 -4
  21. package/{chunk-OF5H3QWS.js → chunk-EXTIQUCI.js} +182 -0
  22. package/{chunk-FE2TZO7Z.js → chunk-FY3KVW36.js} +1 -1
  23. package/{chunk-ZRS4MX3R.js → chunk-HBY2MXIN.js} +20 -18
  24. package/{chunk-6A3LI5TZ.js → chunk-KTVVPRJS.js} +2 -2
  25. package/{chunk-XOH46MRF.js → chunk-M2GJTPUU.js} +4 -4
  26. package/{chunk-ZDXZSXYQ.js → chunk-MGOJ5R6J.js} +1 -1
  27. package/{chunk-3N55DSXH.js → chunk-MTAJCUIC.js} +4 -4
  28. package/{chunk-KH4OXCBK.js → chunk-N5Z5DMDD.js} +2 -2
  29. package/{chunk-Q3K5K4KS.js → chunk-NGXGGF4K.js} +1 -1
  30. package/{chunk-HLM6MG7F.js → chunk-PA23IU5W.js} +7 -7
  31. package/{chunk-CM54RSSA.js → chunk-SL35K7AH.js} +21 -1
  32. package/{chunk-6CBN7GGH.js → chunk-TSS3XJY4.js} +3 -3
  33. package/{chunk-7EPLXPTM.js → chunk-ZJDUYY3D.js} +12 -2
  34. package/{createAgentAutomationAction-GNRYFKTT.js → createAgentAutomationAction-KY7OQ4YJ.js} +6 -6
  35. package/{createDialogAction-Q4ISCARO.js → createDialogAction-CWPWISDF.js} +7 -7
  36. package/{createPageAction-7YCAZPK3.js → createPageAction-GDQVH2DC.js} +6 -6
  37. package/{dbSlice-TO2TSMWM.js → dbSlice-PR44QPXY.js} +1 -1
  38. package/{dialogSlice-5KZA46HM.js → dialogSlice-2EX2IPKM.js} +6 -6
  39. package/{docStore-M7K7QFVS.js → docStore-BDZODEOU.js} +7 -7
  40. package/{handleSendMessageAction-SEV4YIPL.js → handleSendMessageAction-3ZTXMDDU.js} +6 -6
  41. package/index.js +24 -24
  42. package/{machineCommands-T4DN3MOU.js → machineCommands-7PL6UCMC.js} +14 -14
  43. package/{machineWsRunDispatch-QRIIT2AK.js → machineWsRunDispatch-Q6XZLVQE.js} +14 -14
  44. package/package.json +1 -1
  45. package/{readlineWorkspace-DXOTOVHL.js → readlineWorkspace-6S37COYT.js} +17 -15
  46. package/{removeDialogAgentAction-3MUQGFZX.js → removeDialogAgentAction-GJQJNDW6.js} +3 -3
  47. package/{runAgentClientLoop-UEQEP3XG.js → runAgentClientLoop-Y2LTIWEU.js} +12 -12
  48. package/{setDialogExtraReferencesAction-MXHX2HPK.js → setDialogExtraReferencesAction-M7OQG54N.js} +1 -1
  49. package/{setPrimaryDialogAgentAction-7DLDZHDT.js → setPrimaryDialogAgentAction-46UNFJDL.js} +3 -3
  50. package/{settingSlice-PNLASZGI.js → settingSlice-FVUUH4JA.js} +2 -2
  51. package/{spaceSlice-HOMW64JA.js → spaceSlice-ULWMVNFC.js} +6 -6
  52. package/{streamAgentChatTurn-REWDBIL3.js → streamAgentChatTurn-J4YW33EM.js} +15 -15
  53. package/{tools-L4UQS5VW.js → tools-753HRGSD.js} +10 -10
  54. package/{understanding-YH4X3XU6.js → understanding-GQKNDDWM.js} +5 -53
  55. package/{updateDialogTitleAction-CKLNP73H.js → updateDialogTitleAction-PXLE3P4E.js} +6 -6
@@ -1,3 +1,6 @@
1
+ import {
2
+ resolveMachineId
3
+ } from "./chunk-6HYVJV7B.js";
1
4
  import {
2
5
  buildCliRuntimeEnv,
3
6
  clearProfileAuthToken,
@@ -12,6 +15,21 @@ import {
12
15
  import {
13
16
  DEFAULT_NOLO_SERVER_URL
14
17
  } from "./chunk-OLZBQWZU.js";
18
+ import {
19
+ getDefaultCliLocalRuntimeDb
20
+ } from "./chunk-H33743XH.js";
21
+ import {
22
+ createMemoryKey,
23
+ createMemoryOwnerIndexKey,
24
+ createMemorySubjectKindIndexKey,
25
+ memoryOwnerRange
26
+ } from "./chunk-SH2CFQOH.js";
27
+ import {
28
+ asTrimmedNonEmptyStringArray
29
+ } from "./chunk-I42VC5KR.js";
30
+ import {
31
+ asTrimmedString
32
+ } from "./chunk-3EUW3WEO.js";
15
33
  import {
16
34
  normalizeServerOrigin
17
35
  } from "./chunk-CF7PE763.js";
@@ -20,6 +38,151 @@ import {
20
38
  import { createInterface } from "node:readline/promises";
21
39
  import { stdin as input, stdout as output } from "node:process";
22
40
  import { spawn } from "node:child_process";
41
+
42
+ // packages/ai/memory/delete.ts
43
+ var normalizeSet = (values) => {
44
+ if (!Array.isArray(values) || values.length === 0) return null;
45
+ const normalized = asTrimmedNonEmptyStringArray(values);
46
+ return normalized.length > 0 ? new Set(normalized) : null;
47
+ };
48
+ var matchesFilters = (item, filters) => {
49
+ const idSet = normalizeSet(filters.ids);
50
+ if (idSet && !idSet.has(item.id)) return false;
51
+ const kindSet = normalizeSet(filters.kinds);
52
+ if (kindSet && !kindSet.has(item.kind)) return false;
53
+ const facetSet = normalizeSet(filters.facets);
54
+ if (facetSet && (!item.facet || !facetSet.has(item.facet))) return false;
55
+ if (filters.subjectType && item.subjectType !== filters.subjectType) return false;
56
+ if (filters.subjectId && item.subjectId !== filters.subjectId) return false;
57
+ const prefix = asTrimmedString(filters.patternKeyPrefix);
58
+ if (prefix && !(item.patternKey ?? "").startsWith(prefix)) return false;
59
+ if (filters.sourceDialogId && item.sourceDialogId !== filters.sourceDialogId) {
60
+ return false;
61
+ }
62
+ const tagSet = normalizeSet(filters.tags);
63
+ if (tagSet) {
64
+ const itemTags = new Set(asTrimmedNonEmptyStringArray(item.tags));
65
+ for (const tag of tagSet) {
66
+ if (!itemTags.has(tag)) return false;
67
+ }
68
+ }
69
+ return true;
70
+ };
71
+ var deleteMemoryItemWithIndexesInBatch = (batch, item) => {
72
+ batch.del(createMemoryKey(item.ownerType, item.ownerId, item.id));
73
+ batch.del(
74
+ createMemoryOwnerIndexKey(
75
+ item.ownerType,
76
+ item.ownerId,
77
+ item.createdAt,
78
+ item.id
79
+ )
80
+ );
81
+ batch.del(
82
+ createMemorySubjectKindIndexKey(
83
+ item.subjectType,
84
+ item.subjectId,
85
+ item.kind,
86
+ item.createdAt,
87
+ item.id
88
+ )
89
+ );
90
+ };
91
+ var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
92
+ const range = memoryOwnerRange(owner.ownerType, owner.ownerId);
93
+ const matchedItems = [];
94
+ const limit = typeof filters.limit === "number" && filters.limit > 0 ? filters.limit : Number.POSITIVE_INFINITY;
95
+ for await (const [, value] of db.iterator({
96
+ gte: range.start,
97
+ lte: range.end,
98
+ reverse: true
99
+ })) {
100
+ const memoryId = typeof value?.memoryId === "string" ? value.memoryId : "";
101
+ if (!memoryId) continue;
102
+ const item = await db.get(createMemoryKey(owner.ownerType, owner.ownerId, memoryId)).catch(() => null);
103
+ if (!item) continue;
104
+ if (!matchesFilters(item, filters)) continue;
105
+ matchedItems.push(item);
106
+ if (matchedItems.length >= limit) break;
107
+ }
108
+ if (matchedItems.length === 0) {
109
+ return { deletedCount: 0, deletedIds: [], matchedItems: [] };
110
+ }
111
+ const batch = db.batch();
112
+ for (const item of matchedItems) {
113
+ deleteMemoryItemWithIndexesInBatch(batch, item);
114
+ }
115
+ await batch.write();
116
+ return {
117
+ deletedCount: matchedItems.length,
118
+ deletedIds: matchedItems.map((item) => item.id),
119
+ matchedItems
120
+ };
121
+ };
122
+
123
+ // packages/cli/client/memoryRekey.ts
124
+ async function scanLocalMemoryItems(localDb, machineId) {
125
+ const range = memoryOwnerRange("user", machineId);
126
+ const refs = [];
127
+ for await (const [, value] of localDb.iterator({
128
+ gte: range.start,
129
+ lte: range.end,
130
+ reverse: true
131
+ })) {
132
+ refs.push(value ?? {});
133
+ }
134
+ const items = await Promise.all(
135
+ refs.map(
136
+ (ref) => typeof ref?.memoryId === "string" ? localDb.get(createMemoryKey("user", machineId, ref.memoryId)).catch(() => null) : Promise.resolve(null)
137
+ )
138
+ );
139
+ return items.filter((item) => !!item);
140
+ }
141
+ async function performLocalMemoryRekey(args) {
142
+ const { localDb, authToken, serverUrl, machineId } = args;
143
+ const fetchImpl = args.fetchImpl ?? fetch;
144
+ const items = await scanLocalMemoryItems(localDb, machineId);
145
+ if (items.length === 0) {
146
+ return { migrated: 0, merged: 0 };
147
+ }
148
+ const snapshotIds = items.map((item) => item.id);
149
+ const response = await fetchImpl(`${serverUrl}/api/memory/rekey`, {
150
+ method: "POST",
151
+ headers: {
152
+ Authorization: `Bearer ${authToken}`,
153
+ "Content-Type": "application/json"
154
+ },
155
+ body: JSON.stringify({ items }),
156
+ signal: AbortSignal?.timeout?.(3e4)
157
+ }).catch((e) => {
158
+ if (e?.name === "TimeoutError" || e?.name === "AbortError") {
159
+ throw new Error("memory rekey upload timed out (30s)");
160
+ }
161
+ throw e;
162
+ });
163
+ if (!response.ok) {
164
+ let detail = "";
165
+ try {
166
+ const body2 = await response.json();
167
+ detail = body2?.error?.message ?? "";
168
+ } catch {
169
+ }
170
+ throw new Error(
171
+ `memory rekey upload failed (HTTP ${response.status})${detail ? `: ${detail}` : ""}`
172
+ );
173
+ }
174
+ const body = await response.json().catch(() => ({}));
175
+ const migrated = typeof body?.migratedCount === "number" ? body.migratedCount : 0;
176
+ const merged = typeof body?.mergedCount === "number" ? body.mergedCount : 0;
177
+ await deleteMemoriesForOwnerFromDb(
178
+ localDb,
179
+ { ownerType: "user", ownerId: machineId },
180
+ { ids: snapshotIds }
181
+ );
182
+ return { migrated, merged };
183
+ }
184
+
185
+ // packages/cli/authCommands.ts
23
186
  var LOGIN_HELP_TEXT = `Log in to Nolo and save a local profile.
24
187
 
25
188
  Usage:
@@ -106,6 +269,25 @@ async function saveTokenLogin(args) {
106
269
  authToken: args.authToken.trim()
107
270
  });
108
271
  args.output.log(`Saved profile default -> ${args.serverUrl}`);
272
+ try {
273
+ const localDb = await getDefaultCliLocalRuntimeDb();
274
+ const machineId = resolveMachineId();
275
+ const result = await performLocalMemoryRekey({
276
+ localDb,
277
+ authToken: args.authToken.trim(),
278
+ serverUrl: args.serverUrl,
279
+ machineId
280
+ });
281
+ if (result.migrated > 0 || result.merged > 0) {
282
+ args.output.log(
283
+ `[nolo] Migrated ${result.migrated} local memor${result.migrated === 1 ? "y" : "ies"} to your account` + (result.merged > 0 ? ` (${result.merged} merged with existing)` : "") + "."
284
+ );
285
+ }
286
+ } catch (error) {
287
+ args.error.error(
288
+ `[nolo] Local memory migration skipped: ${error instanceof Error ? error.message : String(error)}`
289
+ );
290
+ }
109
291
  return 0;
110
292
  }
111
293
  async function runWebLogin(args) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  i18n_default,
3
3
  toolRegistry
4
- } from "./chunk-7XN726FS.js";
4
+ } from "./chunk-4P3XCCG2.js";
5
5
  import {
6
6
  canonicalizeToolNames
7
7
  } from "./chunk-DG7AAAR3.js";
@@ -15,10 +15,10 @@ import {
15
15
  import {
16
16
  deleteServerSyncedCredential,
17
17
  runLlm
18
- } from "./chunk-DAB7DRXD.js";
18
+ } from "./chunk-BZMZUAFJ.js";
19
19
  import {
20
20
  cleanupCliSessionForDialog
21
- } from "./chunk-6A3LI5TZ.js";
21
+ } from "./chunk-KTVVPRJS.js";
22
22
  import {
23
23
  getDialogAgentIds,
24
24
  getPrimaryDialogAgentId
@@ -34,7 +34,7 @@ import {
34
34
  addContentAction,
35
35
  checkSpaceMembership,
36
36
  localSpaceAuthorityPatchStamp
37
- } from "./chunk-ZDXZSXYQ.js";
37
+ } from "./chunk-MGOJ5R6J.js";
38
38
  import {
39
39
  createSpaceKey,
40
40
  normalizeSpaceId
@@ -80,7 +80,7 @@ import {
80
80
  selectRemoteServer,
81
81
  selectRemoteServers,
82
82
  selectRemoteSyncServers
83
- } from "./chunk-6CBN7GGH.js";
83
+ } from "./chunk-TSS3XJY4.js";
84
84
  import {
85
85
  patch,
86
86
  read,
@@ -93,7 +93,7 @@ import {
93
93
  uploadFileAction,
94
94
  upsertSSREntity,
95
95
  write
96
- } from "./chunk-V2AISYMA.js";
96
+ } from "./chunk-COMXDWNM.js";
97
97
  import {
98
98
  resolveFileCategory
99
99
  } from "./chunk-AZPCASRE.js";
@@ -11967,6 +11967,8 @@ function add(message, type, options) {
11967
11967
  title: message,
11968
11968
  type,
11969
11969
  icon: options?.icon,
11970
+ description: options?.description,
11971
+ action: options?.action,
11970
11972
  // loading toasts stay until explicitly replaced/closed (timeout=0)
11971
11973
  timeout: type === "loading" ? timeout ?? 0 : timeout ?? DEFAULT_TIMEOUT
11972
11974
  });
@@ -14034,7 +14036,7 @@ async function captureUnderstandingFromCompletedUiTurn(input) {
14034
14036
  if (!input.agentKey) return;
14035
14037
  const latestUserInput = getLatestUserInputFromMessages(input.messages);
14036
14038
  if (!latestUserInput) return;
14037
- const { captureUnderstandingMemoryFromDialog } = await import("./understanding-YH4X3XU6.js");
14039
+ const { captureUnderstandingMemoryFromDialog } = await import("./understanding-GQKNDDWM.js");
14038
14040
  await captureUnderstandingMemoryFromDialog({
14039
14041
  db: input.db,
14040
14042
  userId: selectIdentityUserId(input.state),
@@ -14959,7 +14961,7 @@ var messageSlice = createSliceWithThunks({
14959
14961
  runtimeOptions: args.runtimeOptions
14960
14962
  });
14961
14963
  if (agentKeyToUse) {
14962
- const { streamAgentChatTurn } = await import("./agentSlice-IIC7AISR.js");
14964
+ const { streamAgentChatTurn } = await import("./agentSlice-OEHVCG26.js");
14963
14965
  await dispatch(
14964
14966
  streamAgentChatTurn({
14965
14967
  agentKey: agentKeyToUse,
@@ -17567,7 +17569,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
17567
17569
  }
17568
17570
  if (isCurrentDialog) {
17569
17571
  await thunkApi.dispatch(resetMsgs());
17570
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-5KZA46HM.js");
17572
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-2EX2IPKM.js");
17571
17573
  dispatch(clearPendingAttachments2());
17572
17574
  clearWorkflow();
17573
17575
  }
@@ -17576,35 +17578,35 @@ var deleteDialogThunk = async (payload, thunkApi) => {
17576
17578
 
17577
17579
  // packages/chat/dialog/dialogSlice.ts
17578
17580
  var runCreateDialogAction = async (args, thunkApi) => {
17579
- const { createDialogAction } = await import("./createDialogAction-Q4ISCARO.js");
17581
+ const { createDialogAction } = await import("./createDialogAction-CWPWISDF.js");
17580
17582
  return createDialogAction(args, thunkApi);
17581
17583
  };
17582
17584
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
17583
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-GNRYFKTT.js");
17585
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-KY7OQ4YJ.js");
17584
17586
  return createAgentAutomationAction(args, thunkApi);
17585
17587
  };
17586
17588
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
17587
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-CKLNP73H.js");
17589
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-PXLE3P4E.js");
17588
17590
  return updateDialogTitleAction(args, thunkApi);
17589
17591
  };
17590
17592
  var runAddDialogAgentAction = async (args, thunkApi) => {
17591
- const { addDialogAgentAction } = await import("./addDialogAgentAction-ULADQX2Q.js");
17593
+ const { addDialogAgentAction } = await import("./addDialogAgentAction-EKH774VT.js");
17592
17594
  return addDialogAgentAction(args, thunkApi);
17593
17595
  };
17594
17596
  var runRemoveDialogAgentAction = async (args, thunkApi) => {
17595
- const { removeDialogAgentAction } = await import("./removeDialogAgentAction-3MUQGFZX.js");
17597
+ const { removeDialogAgentAction } = await import("./removeDialogAgentAction-GJQJNDW6.js");
17596
17598
  return removeDialogAgentAction(args, thunkApi);
17597
17599
  };
17598
17600
  var runSetPrimaryDialogAgentAction = async (args, thunkApi) => {
17599
- const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-7DLDZHDT.js");
17601
+ const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-46UNFJDL.js");
17600
17602
  return setPrimaryDialogAgentAction(args, thunkApi);
17601
17603
  };
17602
17604
  var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
17603
- const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-MXHX2HPK.js");
17605
+ const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-M7OQG54N.js");
17604
17606
  return setDialogExtraReferencesAction(args, thunkApi);
17605
17607
  };
17606
17608
  var runHandleSendMessageAction = async (args, thunkApi) => {
17607
- const { handleSendMessageAction } = await import("./handleSendMessageAction-SEV4YIPL.js");
17609
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-3ZTXMDDU.js");
17608
17610
  return handleSendMessageAction(args, thunkApi);
17609
17611
  };
17610
17612
  function clearDialogState() {
@@ -17617,7 +17619,7 @@ var createPageAndAddReference = createAsyncThunk(
17617
17619
  async (payload, { dispatch, getState, rejectWithValue }) => {
17618
17620
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
17619
17621
  try {
17620
- const { createDocState } = await import("./docStore-M7K7QFVS.js");
17622
+ const { createDocState } = await import("./docStore-BDZODEOU.js");
17621
17623
  const pageKey = await createDocState(
17622
17624
  { slateData, title },
17623
17625
  { dispatch, getState }
@@ -23757,7 +23759,7 @@ var fetchSpaceAction = async (input, thunkAPI) => {
23757
23759
  const spaceKey = createSpaceKey.space(spaceId);
23758
23760
  const readSpace = async (dbKey) => {
23759
23761
  try {
23760
- const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-TO2TSMWM.js");
23762
+ const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-PR44QPXY.js");
23761
23763
  if (fresh) {
23762
23764
  return await dispatch(readAndWait2(dbKey)).unwrap();
23763
23765
  }
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  selectCurrentServer
3
- } from "./chunk-6CBN7GGH.js";
3
+ } from "./chunk-TSS3XJY4.js";
4
4
  import {
5
5
  patch
6
- } from "./chunk-V2AISYMA.js";
6
+ } from "./chunk-COMXDWNM.js";
7
7
  import {
8
8
  selectIdentityToken
9
9
  } from "./chunk-EYEEHCU4.js";
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  clipMultilineText,
11
11
  fetchAndSerializeTable
12
- } from "./chunk-7XN726FS.js";
12
+ } from "./chunk-4P3XCCG2.js";
13
13
  import {
14
14
  normalizeNonNegativeMs,
15
15
  parseRetryAfterHeaderMs
@@ -26,10 +26,10 @@ import {
26
26
  import {
27
27
  estimateTokenCount,
28
28
  fetchAndCacheMessages
29
- } from "./chunk-ZRS4MX3R.js";
29
+ } from "./chunk-HBY2MXIN.js";
30
30
  import {
31
31
  fetchServerSyncedCredential
32
- } from "./chunk-DAB7DRXD.js";
32
+ } from "./chunk-BZMZUAFJ.js";
33
33
  import {
34
34
  createSpaceKey
35
35
  } from "./chunk-UAD2WT54.js";
@@ -63,7 +63,7 @@ import {
63
63
  } from "./chunk-HNMXYYJR.js";
64
64
  import {
65
65
  read
66
- } from "./chunk-V2AISYMA.js";
66
+ } from "./chunk-COMXDWNM.js";
67
67
  import {
68
68
  asNonEmptyStringArray
69
69
  } from "./chunk-I42VC5KR.js";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  patch,
6
6
  read
7
- } from "./chunk-V2AISYMA.js";
7
+ } from "./chunk-COMXDWNM.js";
8
8
  import {
9
9
  DEVICE_LOCAL_OWNER_ID,
10
10
  isDeviceLocalSpaceBody,
@@ -17,7 +17,7 @@ import {
17
17
  } from "./chunk-VHBWHNVT.js";
18
18
  import {
19
19
  inferCaptureIntent
20
- } from "./chunk-6XKX2N2E.js";
20
+ } from "./chunk-6GANEXVO.js";
21
21
  import {
22
22
  CliProviderQuotaError,
23
23
  executeCli
@@ -27,7 +27,7 @@ import {
27
27
  } from "./chunk-ATNTHIZI.js";
28
28
  import {
29
29
  prepareTools
30
- } from "./chunk-FE2TZO7Z.js";
30
+ } from "./chunk-FY3KVW36.js";
31
31
  import {
32
32
  getAntigravityUserAgent,
33
33
  isAntigravityOAuthAgent,
@@ -43,7 +43,7 @@ import {
43
43
  readXPostFunctionSchema,
44
44
  readXhsProfileFunc,
45
45
  readXhsProfileFunctionSchema
46
- } from "./chunk-7XN726FS.js";
46
+ } from "./chunk-4P3XCCG2.js";
47
47
  import {
48
48
  normalizeDialogTitle
49
49
  } from "./chunk-OWOHNGCN.js";
@@ -52,7 +52,7 @@ import {
52
52
  } from "./chunk-4ZDM73SD.js";
53
53
  import {
54
54
  fetchServerSyncedCredential
55
- } from "./chunk-DAB7DRXD.js";
55
+ } from "./chunk-BZMZUAFJ.js";
56
56
  import {
57
57
  isCompiledBinary,
58
58
  parseUserIdFromAuthToken
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
3
  summarizeEndpoint
4
- } from "./chunk-3N55DSXH.js";
4
+ } from "./chunk-MTAJCUIC.js";
5
5
  import {
6
6
  clipMultilineText
7
- } from "./chunk-7XN726FS.js";
7
+ } from "./chunk-4P3XCCG2.js";
8
8
  import {
9
9
  readPipeText,
10
10
  spawnProcess
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-XOH46MRF.js";
4
+ } from "./chunk-M2GJTPUU.js";
5
5
 
6
6
  // packages/ai/agent/fetchAgentContexts.ts
7
7
  async function fetchAgentContexts(references, dispatch) {
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk-JEXVIMYZ.js";
4
4
  import {
5
5
  prepareTools
6
- } from "./chunk-FE2TZO7Z.js";
6
+ } from "./chunk-FY3KVW36.js";
7
7
  import {
8
8
  getPublicImageAgentMode
9
9
  } from "./chunk-VIDPVFP3.js";
10
10
  import {
11
11
  performFetchRequest
12
- } from "./chunk-XOH46MRF.js";
12
+ } from "./chunk-M2GJTPUU.js";
13
13
  import {
14
14
  createSSEParser,
15
15
  createToolRunId,
@@ -20,7 +20,7 @@ import {
20
20
  toolRunSetPending,
21
21
  toolRunStarted,
22
22
  toolRunSucceeded
23
- } from "./chunk-7XN726FS.js";
23
+ } from "./chunk-4P3XCCG2.js";
24
24
  import {
25
25
  addToolMessage,
26
26
  getModelInfo,
@@ -28,10 +28,10 @@ import {
28
28
  messageStreaming,
29
29
  selectCurrentSpaceId,
30
30
  updateToolMessage
31
- } from "./chunk-ZRS4MX3R.js";
31
+ } from "./chunk-HBY2MXIN.js";
32
32
  import {
33
33
  streamAgentChatTurn
34
- } from "./chunk-DAB7DRXD.js";
34
+ } from "./chunk-BZMZUAFJ.js";
35
35
  import {
36
36
  EMPTY_ASSISTANT_REPAIR_PROMPT
37
37
  } from "./chunk-MXLQWBVM.js";
@@ -59,10 +59,10 @@ import {
59
59
  } from "./chunk-HNMXYYJR.js";
60
60
  import {
61
61
  selectCurrentServer
62
- } from "./chunk-6CBN7GGH.js";
62
+ } from "./chunk-TSS3XJY4.js";
63
63
  import {
64
64
  write
65
- } from "./chunk-V2AISYMA.js";
65
+ } from "./chunk-COMXDWNM.js";
66
66
  import {
67
67
  createDialogMessageKeyAndId,
68
68
  dialogMessageKey,
@@ -1,3 +1,7 @@
1
+ import {
2
+ MEMORY_USE_GUIDANCE
3
+ } from "./chunk-KKY4B2Q2.js";
4
+
1
5
  // packages/agent-runtime/modelLayerOverride.ts
2
6
  var MODEL_LAYER_KEYS = [
3
7
  "provider",
@@ -196,11 +200,27 @@ var buildLinkedSpacesSection = async (args) => {
196
200
  "\u63D0\u793A\uFF1A\u5982\u9700\u67E5\u8BE2\u8FD9\u4E9B\u7A7A\u95F4\u7684\u8BE6\u7EC6\u5185\u5BB9\uFF0C\u53EF\u4F7F\u7528 read \u5DE5\u5177\u914D\u5408\u5BF9\u5E94\u7684 dbKey\u3002"
197
201
  ].join("\n");
198
202
  };
203
+ var buildMemoryOverlayLayer = (args) => {
204
+ const promptBlock = asTrimmed(args.promptBlock);
205
+ if (!promptBlock) return null;
206
+ return makeLayer("memory-overlay", promptBlock);
207
+ };
208
+ var buildMemoryUseGuidanceLayer = (args) => {
209
+ const promptBlock = asTrimmed(args.promptBlock);
210
+ if (!promptBlock) return null;
211
+ return makeLayer(
212
+ "memory-use-guidance",
213
+ MEMORY_USE_GUIDANCE,
214
+ "session"
215
+ );
216
+ };
199
217
 
200
218
  export {
201
219
  buildModelLayerOverride,
202
220
  applyModelLayerOverride,
203
221
  buildSpaceContextLayer,
204
222
  buildSkillDiscoveryLayer,
205
- buildLinkedSpacesSection
223
+ buildLinkedSpacesSection,
224
+ buildMemoryOverlayLayer,
225
+ buildMemoryUseGuidanceLayer
206
226
  };
@@ -7,7 +7,7 @@ import {
7
7
  toTimestampMs,
8
8
  upsert,
9
9
  write
10
- } from "./chunk-V2AISYMA.js";
10
+ } from "./chunk-COMXDWNM.js";
11
11
  import {
12
12
  asRecordOrEmpty
13
13
  } from "./chunk-KX6YBIHG.js";
@@ -919,8 +919,8 @@ var initialState = {
919
919
  editorTabSize: 2,
920
920
  editorFontFamily: "SF Mono, Monaco, Cascadia Code, Roboto Mono, monospace",
921
921
  enableReadCurrentSpace: true,
922
- globalPrompt: "\u4EE5\u4E0B\u662F\u5173\u4E8E\u6211\u7684\u901A\u7528\u8BF4\u660E\uFF0C\u8BF7\u5728\u4EFB\u610F\u573A\u666F\u4E0B\u90FD\u4EE5\u6B64\u6765\u7406\u89E3\u548C\u670D\u52A1\u6211\uFF1A\n1. \u6211\u5E0C\u671B\u4F60\u7528\u6E05\u6670\u3001\u7B80\u6D01\u7684\u65B9\u5F0F\u56DE\u7B54\u95EE\u9898\uFF0C\u5E76\u5728\u5FC5\u8981\u65F6\u7ED9\u51FA\u793A\u4F8B\u3002\n2. \u5982\u679C\u6709\u591A\u79CD\u89E3\u51B3\u65B9\u6848\uFF0C\u8BF7\u5148\u7ED9\u51FA\u63A8\u8350\u65B9\u6848\uFF0C\u518D\u7B80\u8981\u8BF4\u660E\u5176\u4ED6\u65B9\u6848\u7684\u4F18\u7F3A\u70B9\u3002\n3. \u5F53\u4F60\u4E0D\u786E\u5B9A\u7B54\u6848\u65F6\uFF0C\u8BF7\u660E\u786E\u8BF4\u660E\u4E0D\u786E\u5B9A\uFF0C\u5E76\u63A8\u6D4B\u53EF\u80FD\u7684\u65B9\u5411\uFF0C\u800C\u4E0D\u662F\u7F16\u9020\u4E8B\u5B9E\u3002\n4. \u5982\u679C\u6D89\u53CA\u4EE3\u7801\uFF0C\u8BF7\u4F18\u5148\u4F7F\u7528\u73B0\u4EE3\u3001\u901A\u7528\u7684\u6700\u4F73\u5B9E\u8DF5\u3002",
923
- userTonePreset: DEFAULT_USER_PREFERENCE_PROFILE.tone?.preset ?? "default",
922
+ globalPrompt: "",
923
+ userTonePreset: "",
924
924
  knowledgeCaptureLevel: DEFAULT_USER_PREFERENCE_PROFILE.knowledgeCaptureLevel,
925
925
  spaceContextLevel: DEFAULT_USER_PREFERENCE_PROFILE.spaceContextLevel,
926
926
  autoApproveSelfUpdateFields: [...DEFAULT_AUTO_APPROVED_SELF_UPDATE_FIELDS],
@@ -7,7 +7,7 @@ import {
7
7
  prepareAndPersistMessage,
8
8
  uiAskChoiceFunc,
9
9
  uiAskChoiceFunctionSchema
10
- } from "./chunk-ZRS4MX3R.js";
10
+ } from "./chunk-HBY2MXIN.js";
11
11
  import {
12
12
  require_date_fns
13
13
  } from "./chunk-M76ECQRD.js";
@@ -27,7 +27,7 @@ import {
27
27
  removeCachedEntity,
28
28
  upsertSSREntity,
29
29
  write
30
- } from "./chunk-V2AISYMA.js";
30
+ } from "./chunk-COMXDWNM.js";
31
31
  import {
32
32
  createAgentKey,
33
33
  createDialogKey,
@@ -270,6 +270,14 @@ function resolveAgentMemoryPolicy(input) {
270
270
  allowDynamicGreetingMemory: true
271
271
  };
272
272
  }
273
+ function buildMemorySubjectsForAgent(input) {
274
+ const policy = input.policy ?? resolveAgentMemoryPolicy({ agentKey: input.agentKey });
275
+ return [
276
+ { subjectType: "agent", subjectId: input.agentKey },
277
+ policy.includeUserSubject && input.userId ? { subjectType: "user", subjectId: input.userId } : null,
278
+ input.spaceId ? { subjectType: "space", subjectId: input.spaceId } : null
279
+ ].filter(Boolean);
280
+ }
273
281
 
274
282
  // packages/ai/memory/recentRelationshipRecap.ts
275
283
  var MIN_RECAP_LENGTH = 12;
@@ -924,6 +932,8 @@ var createDialogAction = async (args, thunkApi) => {
924
932
  };
925
933
 
926
934
  export {
935
+ resolveAgentMemoryPolicy,
936
+ buildMemorySubjectsForAgent,
927
937
  isLocalOwnerDialogAgents,
928
938
  createDialogAction
929
939
  };
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  addContentToSpace
3
- } from "./chunk-ZRS4MX3R.js";
3
+ } from "./chunk-HBY2MXIN.js";
4
4
  import "./chunk-4ZDM73SD.js";
5
5
  import "./chunk-MRC4Q34M.js";
6
6
  import "./chunk-PCWC3JTN.js";
7
7
  import "./chunk-CWMSB67P.js";
8
- import "./chunk-DAB7DRXD.js";
9
- import "./chunk-6A3LI5TZ.js";
8
+ import "./chunk-BZMZUAFJ.js";
9
+ import "./chunk-KTVVPRJS.js";
10
10
  import "./chunk-Z4NR32XR.js";
11
11
  import "./chunk-M76ECQRD.js";
12
12
  import "./chunk-YYUCRDOK.js";
13
- import "./chunk-ZDXZSXYQ.js";
13
+ import "./chunk-MGOJ5R6J.js";
14
14
  import "./chunk-UAD2WT54.js";
15
15
  import "./chunk-USZMK5UT.js";
16
16
  import "./chunk-5MMAK75Q.js";
@@ -22,11 +22,11 @@ import "./chunk-DFFIZ25G.js";
22
22
  import "./chunk-3ASDTTEI.js";
23
23
  import "./chunk-DWLEOOGR.js";
24
24
  import "./chunk-HNMXYYJR.js";
25
- import "./chunk-6CBN7GGH.js";
25
+ import "./chunk-TSS3XJY4.js";
26
26
  import "./chunk-Y5GCAMGP.js";
27
27
  import {
28
28
  write
29
- } from "./chunk-V2AISYMA.js";
29
+ } from "./chunk-COMXDWNM.js";
30
30
  import "./chunk-AZPCASRE.js";
31
31
  import "./chunk-2EISRLRC.js";
32
32
  import "./chunk-KX6YBIHG.js";