@rubytech/create-maxy 1.0.496 → 1.0.497

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubytech/create-maxy",
3
- "version": "1.0.496",
3
+ "version": "1.0.497",
4
4
  "description": "Install Maxy — AI for Productive People",
5
5
  "bin": {
6
6
  "create-maxy": "./dist/index.js"
@@ -98,7 +98,9 @@ When the user asks about WhatsApp settings, config, policies, or operational lim
98
98
 
99
99
  ## Session Reset
100
100
 
101
- When the user asks to start a new session, clear the conversation, or start fresh, call `session-reset`. This compacts the current conversation to memory and clears the chat. Do not ask for confirmation. After calling the tool, do not say anything further — the UI clears and returns to idle.
101
+ When the user asks to start a new session, clear the conversation, or start fresh, call `session-reset`. Do not ask for confirmation. After calling the tool, do not say anything further — the UI clears and returns to idle.
102
+
103
+ When you are about to suggest a reset — after a plugin activation, when context has drifted, or for any other reason — first persist every actionable finding from the current conversation to its durable store (graph nodes, tasks, profile updates). The compaction saves a session summary, but summaries are lossy: decisions, working state, and unfinished threads must be captured explicitly before the context window is cleared. Then tell the user what will carry into the new session (summary and open tasks via previous-context) and suggest the reset.
102
104
 
103
105
  ## Session Continuation
104
106
 
@@ -5162,6 +5162,17 @@ function registerResumedSession(sessionKey, accountId, agentName, conversationId
5162
5162
  messageHistory
5163
5163
  });
5164
5164
  }
5165
+ function seedSessionHistory(sessionKey, messages) {
5166
+ const session = sessionStore.get(sessionKey);
5167
+ if (!session) return 0;
5168
+ if (messages.length === 0) return 0;
5169
+ session.messageHistory = messages.map((m) => ({
5170
+ role: m.role,
5171
+ content: m.content,
5172
+ timestamp: m.createdAt ? new Date(m.createdAt).getTime() || Date.now() : Date.now()
5173
+ }));
5174
+ return session.messageHistory.length;
5175
+ }
5165
5176
  function getSessionMessages(sessionKey) {
5166
5177
  return sessionStore.get(sessionKey)?.messageHistory;
5167
5178
  }
@@ -26332,8 +26343,18 @@ async function createAdminSession(accountId, thinkingView, userId, userName) {
26332
26343
  } catch {
26333
26344
  }
26334
26345
  let conversationId = null;
26346
+ let loadedMessages = 0;
26347
+ let estimatedTokens = 0;
26335
26348
  if (userId) {
26336
26349
  conversationId = await findOrResumeAdminConversation(userId, accountId, sessionKey);
26350
+ if (conversationId) {
26351
+ const messages = await getRecentMessages(conversationId);
26352
+ if (messages.length > 0) {
26353
+ loadedMessages = seedSessionHistory(sessionKey, messages);
26354
+ estimatedTokens = messages.reduce((sum, m) => sum + Math.ceil(m.content.length / 4), 0);
26355
+ }
26356
+ console.log(`[managed-resume] ${(/* @__PURE__ */ new Date()).toISOString()} conversationId=${conversationId.slice(0, 8)}\u2026 loaded=${loadedMessages} messages (${estimatedTokens} estimated tokens)`);
26357
+ }
26337
26358
  }
26338
26359
  console.log(`[session] ${(/* @__PURE__ */ new Date()).toISOString()} admin session created: userId=${userId ?? "\u2013"} userName=${userName ?? "\u2013"} accountId=${accountId} conversationId=${conversationId?.slice(0, 8) ?? "\u2013"}`);
26339
26360
  return Response.json({