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

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 (41) hide show
  1. package/{_executeModel-EBU7YBDV.js → _executeModel-KBMAUV6G.js} +9 -9
  2. package/{agentEmailCommands-IC52LATA.js → agentEmailCommands-QETL62SU.js} +8 -8
  3. package/{agentMachineCommands-SFWC6KN4.js → agentMachineCommands-LDHJBWQO.js} +1 -1
  4. package/{agentRecordCommands-VLMLWLCM.js → agentRecordCommands-UW76EZ25.js} +8 -8
  5. package/{agentRunCommand-D2PVHUGR.js → agentRunCommand-UFBOW4ZF.js} +11 -9
  6. package/{agentSlice-IIC7AISR.js → agentSlice-2IBSFH4O.js} +1 -1
  7. package/{authCommand-WXMD3IPR.js → authCommand-PXFX6JDT.js} +8 -1
  8. package/{authCommands-X74AFDTC.js → authCommands-356AYWEK.js} +10 -1
  9. package/{chunk-YDESHYQC.js → chunk-2IRF4LEX.js} +410 -4
  10. package/chunk-3TZDXYSF.js +71 -0
  11. package/{chunk-IBJC3GOP.js → chunk-B6DFDN4R.js} +1 -1
  12. package/{chunk-3N55DSXH.js → chunk-EQHI2AR3.js} +3 -3
  13. package/{chunk-OF5H3QWS.js → chunk-EXTIQUCI.js} +182 -0
  14. package/{chunk-7XN726FS.js → chunk-I6DI7SGU.js} +8 -8
  15. package/{chunk-FE2TZO7Z.js → chunk-JRPR5M4O.js} +1 -1
  16. package/{chunk-Q3K5K4KS.js → chunk-JW43YCM5.js} +1 -1
  17. package/{chunk-7U4TQSWU.js → chunk-MMRAIO5Y.js} +2 -2
  18. package/{chunk-HLM6MG7F.js → chunk-PFUCDPUH.js} +5 -5
  19. package/{chunk-DAB7DRXD.js → chunk-QKRUUZCL.js} +3 -3
  20. package/{chunk-XOH46MRF.js → chunk-QTFSBLCF.js} +3 -3
  21. package/{chunk-KH4OXCBK.js → chunk-RTZFUR3V.js} +2 -2
  22. package/{chunk-CM54RSSA.js → chunk-SL35K7AH.js} +21 -1
  23. package/{chunk-ZRS4MX3R.js → chunk-SRLZ7IVA.js} +9 -9
  24. package/{chunk-7EPLXPTM.js → chunk-VH4YK6KZ.js} +11 -1
  25. package/{createAgentAutomationAction-GNRYFKTT.js → createAgentAutomationAction-CSWOQOY5.js} +2 -2
  26. package/{createDialogAction-Q4ISCARO.js → createDialogAction-6VWL2TDI.js} +3 -3
  27. package/{createPageAction-7YCAZPK3.js → createPageAction-INRC4MH2.js} +2 -2
  28. package/{dialogSlice-5KZA46HM.js → dialogSlice-CELFVS3F.js} +2 -2
  29. package/{docStore-M7K7QFVS.js → docStore-Q5AFYT6G.js} +3 -3
  30. package/{handleSendMessageAction-SEV4YIPL.js → handleSendMessageAction-PPIGKCBQ.js} +2 -2
  31. package/index.js +24 -24
  32. package/{machineCommands-T4DN3MOU.js → machineCommands-3D7JMHUP.js} +8 -8
  33. package/{machineWsRunDispatch-QRIIT2AK.js → machineWsRunDispatch-PA5BR4AX.js} +8 -8
  34. package/package.json +1 -1
  35. package/{readlineWorkspace-DXOTOVHL.js → readlineWorkspace-7WPA5OUS.js} +11 -9
  36. package/{runAgentClientLoop-UEQEP3XG.js → runAgentClientLoop-DRAXPP6R.js} +7 -7
  37. package/{spaceSlice-HOMW64JA.js → spaceSlice-5F2CDP2O.js} +2 -2
  38. package/{streamAgentChatTurn-REWDBIL3.js → streamAgentChatTurn-ROOB5RLM.js} +9 -9
  39. package/{tools-L4UQS5VW.js → tools-BAWXW4F6.js} +5 -5
  40. package/{understanding-YH4X3XU6.js → understanding-GQKNDDWM.js} +5 -53
  41. package/{updateDialogTitleAction-CKLNP73H.js → updateDialogTitleAction-KJM65IGF.js} +2 -2
@@ -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) {
@@ -25,10 +25,10 @@ import {
25
25
  } from "./chunk-63W5N6P3.js";
26
26
  import {
27
27
  createDocState
28
- } from "./chunk-7U4TQSWU.js";
28
+ } from "./chunk-MMRAIO5Y.js";
29
29
  import {
30
30
  createDialogAction
31
- } from "./chunk-7EPLXPTM.js";
31
+ } from "./chunk-VH4YK6KZ.js";
32
32
  import {
33
33
  buildSkillDocMarkdown,
34
34
  normalizeSkillBudgetTier,
@@ -68,13 +68,13 @@ import {
68
68
  updateContentCategory,
69
69
  updateContentTitle,
70
70
  updateStep
71
- } from "./chunk-ZRS4MX3R.js";
71
+ } from "./chunk-SRLZ7IVA.js";
72
72
  import {
73
73
  createAgent,
74
74
  runLlm,
75
75
  streamAgentChatTurn,
76
76
  updateAgent
77
- } from "./chunk-DAB7DRXD.js";
77
+ } from "./chunk-QKRUUZCL.js";
78
78
  import {
79
79
  addContentAction
80
80
  } from "./chunk-ZDXZSXYQ.js";
@@ -13562,7 +13562,7 @@ async function deleteDialogsFunc(args, thunkApi) {
13562
13562
  const deletedDialogIds = [];
13563
13563
  const deletedDialogKeys = [];
13564
13564
  const failures = [];
13565
- const { deleteDialog } = await import("./dialogSlice-5KZA46HM.js");
13565
+ const { deleteDialog } = await import("./dialogSlice-CELFVS3F.js");
13566
13566
  for (const target of targets) {
13567
13567
  try {
13568
13568
  await thunkApi.dispatch(deleteDialog(target.dbKey)).unwrap();
@@ -22508,7 +22508,7 @@ var executeToolRun = createAsyncThunk(
22508
22508
  if (!executionInput) {
22509
22509
  throw new Error(`ToolRun ${id} has no input to execute with.`);
22510
22510
  }
22511
- const { findToolExecutor: findToolExecutor2 } = await import("./tools-L4UQS5VW.js");
22511
+ const { findToolExecutor: findToolExecutor2 } = await import("./tools-BAWXW4F6.js");
22512
22512
  const { executor } = findToolExecutor2(run.toolName);
22513
22513
  toolRunStarted({
22514
22514
  id: run.id,
@@ -22532,7 +22532,7 @@ var executeToolRun = createAsyncThunk(
22532
22532
  const latestState = thunkApi.getState();
22533
22533
  const userId = latestState.auth?.currentUser?.userId;
22534
22534
  if (userId) {
22535
- const { fetchUserSpaceMemberships } = await import("./spaceSlice-HOMW64JA.js");
22535
+ const { fetchUserSpaceMemberships } = await import("./spaceSlice-5F2CDP2O.js");
22536
22536
  await thunkApi.dispatch(fetchUserSpaceMemberships(userId));
22537
22537
  }
22538
22538
  }
@@ -24935,7 +24935,7 @@ async function updateDocFunc(args, thunkApi) {
24935
24935
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
24936
24936
  };
24937
24937
  await dispatch(write({ data: updatedPageData, customKey: id })).unwrap();
24938
- const { getDocState, applyExternalDocUpdate } = await import("./docStore-M7K7QFVS.js");
24938
+ const { getDocState, applyExternalDocUpdate } = await import("./docStore-Q5AFYT6G.js");
24939
24939
  if (getDocState().pageKey === id) {
24940
24940
  applyExternalDocUpdate({
24941
24941
  slateData: finalSlateData,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  i18n_default,
3
3
  toolRegistry
4
- } from "./chunk-7XN726FS.js";
4
+ } from "./chunk-I6DI7SGU.js";
5
5
  import {
6
6
  canonicalizeToolNames
7
7
  } from "./chunk-DG7AAAR3.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-XOH46MRF.js";
4
+ } from "./chunk-QTFSBLCF.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
  updateContentTitle
3
- } from "./chunk-ZRS4MX3R.js";
3
+ } from "./chunk-SRLZ7IVA.js";
4
4
  import {
5
5
  require_date_fns
6
6
  } from "./chunk-M76ECQRD.js";
@@ -367,7 +367,7 @@ async function saveDocState(arg, { dispatch, getState }) {
367
367
  }
368
368
  }
369
369
  async function createDocState(args, thunkApi) {
370
- const { createPageAction } = await import("./createPageAction-7YCAZPK3.js");
370
+ const { createPageAction } = await import("./createPageAction-INRC4MH2.js");
371
371
  return createPageAction(args, thunkApi);
372
372
  }
373
373
  function subscribe(listener) {
@@ -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-JRPR5M4O.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-QTFSBLCF.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-I6DI7SGU.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-SRLZ7IVA.js";
32
32
  import {
33
33
  streamAgentChatTurn
34
- } from "./chunk-DAB7DRXD.js";
34
+ } from "./chunk-QKRUUZCL.js";
35
35
  import {
36
36
  EMPTY_ASSISTANT_REPAIR_PROMPT
37
37
  } from "./chunk-MXLQWBVM.js";
@@ -289,7 +289,7 @@ var slice = createSliceWithThunks({
289
289
  const overrides = {};
290
290
  if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
291
291
  if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
292
- const { _executeModel } = await import("./_executeModel-EBU7YBDV.js");
292
+ const { _executeModel } = await import("./_executeModel-KBMAUV6G.js");
293
293
  return _executeModel(
294
294
  {
295
295
  isStreaming: args.isStreaming ?? false,
@@ -310,7 +310,7 @@ var slice = createSliceWithThunks({
310
310
  * - 循环直到无工具调用或触发其他运行时停止条件
311
311
  */
312
312
  runAgent: create.asyncThunk(async (args, thunkApi) => {
313
- const { runAgentClientLoop } = await import("./runAgentClientLoop-UEQEP3XG.js");
313
+ const { runAgentClientLoop } = await import("./runAgentClientLoop-DRAXPP6R.js");
314
314
  const { content: loopContent, toolCallCount } = await runAgentClientLoop(
315
315
  {
316
316
  agentKey: args.agentKey,
@@ -326,7 +326,7 @@ var slice = createSliceWithThunks({
326
326
  * 聊天轮次流式 Agent 调用
327
327
  */
328
328
  streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
329
- const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-REWDBIL3.js");
329
+ const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-ROOB5RLM.js");
330
330
  return streamAgentChatTurnHandler(args, thunkApi);
331
331
  }),
332
332
  /**
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  clipMultilineText,
11
11
  fetchAndSerializeTable
12
- } from "./chunk-7XN726FS.js";
12
+ } from "./chunk-I6DI7SGU.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-SRLZ7IVA.js";
30
30
  import {
31
31
  fetchServerSyncedCredential
32
- } from "./chunk-DAB7DRXD.js";
32
+ } from "./chunk-QKRUUZCL.js";
33
33
  import {
34
34
  createSpaceKey
35
35
  } from "./chunk-UAD2WT54.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
3
  summarizeEndpoint
4
- } from "./chunk-3N55DSXH.js";
4
+ } from "./chunk-EQHI2AR3.js";
5
5
  import {
6
6
  clipMultilineText
7
- } from "./chunk-7XN726FS.js";
7
+ } from "./chunk-I6DI7SGU.js";
8
8
  import {
9
9
  readPipeText,
10
10
  spawnProcess
@@ -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
  };
@@ -15,7 +15,7 @@ import {
15
15
  import {
16
16
  deleteServerSyncedCredential,
17
17
  runLlm
18
- } from "./chunk-DAB7DRXD.js";
18
+ } from "./chunk-QKRUUZCL.js";
19
19
  import {
20
20
  cleanupCliSessionForDialog
21
21
  } from "./chunk-6A3LI5TZ.js";
@@ -14034,7 +14034,7 @@ async function captureUnderstandingFromCompletedUiTurn(input) {
14034
14034
  if (!input.agentKey) return;
14035
14035
  const latestUserInput = getLatestUserInputFromMessages(input.messages);
14036
14036
  if (!latestUserInput) return;
14037
- const { captureUnderstandingMemoryFromDialog } = await import("./understanding-YH4X3XU6.js");
14037
+ const { captureUnderstandingMemoryFromDialog } = await import("./understanding-GQKNDDWM.js");
14038
14038
  await captureUnderstandingMemoryFromDialog({
14039
14039
  db: input.db,
14040
14040
  userId: selectIdentityUserId(input.state),
@@ -14959,7 +14959,7 @@ var messageSlice = createSliceWithThunks({
14959
14959
  runtimeOptions: args.runtimeOptions
14960
14960
  });
14961
14961
  if (agentKeyToUse) {
14962
- const { streamAgentChatTurn } = await import("./agentSlice-IIC7AISR.js");
14962
+ const { streamAgentChatTurn } = await import("./agentSlice-2IBSFH4O.js");
14963
14963
  await dispatch(
14964
14964
  streamAgentChatTurn({
14965
14965
  agentKey: agentKeyToUse,
@@ -17567,7 +17567,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
17567
17567
  }
17568
17568
  if (isCurrentDialog) {
17569
17569
  await thunkApi.dispatch(resetMsgs());
17570
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-5KZA46HM.js");
17570
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-CELFVS3F.js");
17571
17571
  dispatch(clearPendingAttachments2());
17572
17572
  clearWorkflow();
17573
17573
  }
@@ -17576,15 +17576,15 @@ var deleteDialogThunk = async (payload, thunkApi) => {
17576
17576
 
17577
17577
  // packages/chat/dialog/dialogSlice.ts
17578
17578
  var runCreateDialogAction = async (args, thunkApi) => {
17579
- const { createDialogAction } = await import("./createDialogAction-Q4ISCARO.js");
17579
+ const { createDialogAction } = await import("./createDialogAction-6VWL2TDI.js");
17580
17580
  return createDialogAction(args, thunkApi);
17581
17581
  };
17582
17582
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
17583
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-GNRYFKTT.js");
17583
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-CSWOQOY5.js");
17584
17584
  return createAgentAutomationAction(args, thunkApi);
17585
17585
  };
17586
17586
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
17587
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-CKLNP73H.js");
17587
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-KJM65IGF.js");
17588
17588
  return updateDialogTitleAction(args, thunkApi);
17589
17589
  };
17590
17590
  var runAddDialogAgentAction = async (args, thunkApi) => {
@@ -17604,7 +17604,7 @@ var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
17604
17604
  return setDialogExtraReferencesAction(args, thunkApi);
17605
17605
  };
17606
17606
  var runHandleSendMessageAction = async (args, thunkApi) => {
17607
- const { handleSendMessageAction } = await import("./handleSendMessageAction-SEV4YIPL.js");
17607
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-PPIGKCBQ.js");
17608
17608
  return handleSendMessageAction(args, thunkApi);
17609
17609
  };
17610
17610
  function clearDialogState() {
@@ -17617,7 +17617,7 @@ var createPageAndAddReference = createAsyncThunk(
17617
17617
  async (payload, { dispatch, getState, rejectWithValue }) => {
17618
17618
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
17619
17619
  try {
17620
- const { createDocState } = await import("./docStore-M7K7QFVS.js");
17620
+ const { createDocState } = await import("./docStore-Q5AFYT6G.js");
17621
17621
  const pageKey = await createDocState(
17622
17622
  { slateData, title },
17623
17623
  { dispatch, getState }
@@ -7,7 +7,7 @@ import {
7
7
  prepareAndPersistMessage,
8
8
  uiAskChoiceFunc,
9
9
  uiAskChoiceFunctionSchema
10
- } from "./chunk-ZRS4MX3R.js";
10
+ } from "./chunk-SRLZ7IVA.js";
11
11
  import {
12
12
  require_date_fns
13
13
  } from "./chunk-M76ECQRD.js";
@@ -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,11 +1,11 @@
1
1
  import {
2
2
  addContentToSpace
3
- } from "./chunk-ZRS4MX3R.js";
3
+ } from "./chunk-SRLZ7IVA.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";
8
+ import "./chunk-QKRUUZCL.js";
9
9
  import "./chunk-6A3LI5TZ.js";
10
10
  import "./chunk-Z4NR32XR.js";
11
11
  import "./chunk-M76ECQRD.js";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  createDialogAction,
3
3
  isLocalOwnerDialogAgents
4
- } from "./chunk-7EPLXPTM.js";
4
+ } from "./chunk-VH4YK6KZ.js";
5
5
  import "./chunk-ZQ2UM4KG.js";
6
6
  import "./chunk-Q2YZULBH.js";
7
- import "./chunk-ZRS4MX3R.js";
7
+ import "./chunk-SRLZ7IVA.js";
8
8
  import "./chunk-4ZDM73SD.js";
9
9
  import "./chunk-MRC4Q34M.js";
10
10
  import "./chunk-PCWC3JTN.js";
11
11
  import "./chunk-CWMSB67P.js";
12
- import "./chunk-DAB7DRXD.js";
12
+ import "./chunk-QKRUUZCL.js";
13
13
  import "./chunk-6A3LI5TZ.js";
14
14
  import "./chunk-Z4NR32XR.js";
15
15
  import "./chunk-M76ECQRD.js";
@@ -18,12 +18,12 @@ import {
18
18
  addContentToSpace,
19
19
  client_default,
20
20
  selectCurrentSpaceId
21
- } from "./chunk-ZRS4MX3R.js";
21
+ } from "./chunk-SRLZ7IVA.js";
22
22
  import "./chunk-4ZDM73SD.js";
23
23
  import "./chunk-MRC4Q34M.js";
24
24
  import "./chunk-PCWC3JTN.js";
25
25
  import "./chunk-CWMSB67P.js";
26
- import "./chunk-DAB7DRXD.js";
26
+ import "./chunk-QKRUUZCL.js";
27
27
  import "./chunk-6A3LI5TZ.js";
28
28
  import "./chunk-Z4NR32XR.js";
29
29
  import "./chunk-M76ECQRD.js";
@@ -19,12 +19,12 @@ import {
19
19
  setPrimaryDialogAgent,
20
20
  updateDialogTitle,
21
21
  updateTokens
22
- } from "./chunk-ZRS4MX3R.js";
22
+ } from "./chunk-SRLZ7IVA.js";
23
23
  import "./chunk-4ZDM73SD.js";
24
24
  import "./chunk-MRC4Q34M.js";
25
25
  import "./chunk-PCWC3JTN.js";
26
26
  import "./chunk-CWMSB67P.js";
27
- import "./chunk-DAB7DRXD.js";
27
+ import "./chunk-QKRUUZCL.js";
28
28
  import "./chunk-6A3LI5TZ.js";
29
29
  import "./chunk-Z4NR32XR.js";
30
30
  import "./chunk-M76ECQRD.js";
@@ -24,13 +24,13 @@ import {
24
24
  updateTitleDoc,
25
25
  useDocField,
26
26
  useDocState
27
- } from "./chunk-7U4TQSWU.js";
28
- import "./chunk-ZRS4MX3R.js";
27
+ } from "./chunk-MMRAIO5Y.js";
28
+ import "./chunk-SRLZ7IVA.js";
29
29
  import "./chunk-4ZDM73SD.js";
30
30
  import "./chunk-MRC4Q34M.js";
31
31
  import "./chunk-PCWC3JTN.js";
32
32
  import "./chunk-CWMSB67P.js";
33
- import "./chunk-DAB7DRXD.js";
33
+ import "./chunk-QKRUUZCL.js";
34
34
  import "./chunk-6A3LI5TZ.js";
35
35
  import "./chunk-Z4NR32XR.js";
36
36
  import "./chunk-M76ECQRD.js";
@@ -2,14 +2,14 @@ import {
2
2
  messageStreamEnd,
3
3
  prepareAndPersistUserMessage,
4
4
  resolveHandleSendMessageContext
5
- } from "./chunk-ZRS4MX3R.js";
5
+ } from "./chunk-SRLZ7IVA.js";
6
6
  import "./chunk-4ZDM73SD.js";
7
7
  import "./chunk-MRC4Q34M.js";
8
8
  import "./chunk-PCWC3JTN.js";
9
9
  import "./chunk-CWMSB67P.js";
10
10
  import {
11
11
  streamAgentChatTurn
12
- } from "./chunk-DAB7DRXD.js";
12
+ } from "./chunk-QKRUUZCL.js";
13
13
  import "./chunk-6A3LI5TZ.js";
14
14
  import "./chunk-Z4NR32XR.js";
15
15
  import "./chunk-M76ECQRD.js";