@rubytech/create-maxy 1.0.496 → 1.0.498

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.498",
4
4
  "description": "Install Maxy — AI for Productive People",
5
5
  "bin": {
6
6
  "create-maxy": "./dist/index.js"
@@ -220,6 +220,95 @@ if [ -f "$ACCOUNT_DIR/account.json" ] && ! grep -q '"defaultAgent"' "$ACCOUNT_DI
220
220
  fi
221
221
  fi
222
222
 
223
+ # ------------------------------------------------------------------
224
+ # Seed enabledPlugins from brand.json plugins.defaultEnabled
225
+ # ------------------------------------------------------------------
226
+ # Fresh accounts: replaces the template's empty [] with defaultEnabled.
227
+ # Existing accounts: additive merge — adds missing defaultEnabled entries,
228
+ # never removes plugins the user enabled manually.
229
+ # Dependency validation: skips any defaultEnabled plugin whose PLUGIN.md
230
+ # `requires:` dependencies are not satisfied by core or defaultEnabled.
231
+ BRAND_JSON="$PROJECT_DIR/config/brand.json"
232
+ if [ -f "$BRAND_JSON" ] && [ -f "$ACCOUNT_DIR/account.json" ]; then
233
+ python3 -c "
234
+ import json, os, sys
235
+
236
+ brand_path = '$BRAND_JSON'
237
+ account_path = '$ACCOUNT_DIR/account.json'
238
+ plugins_dir = '$PROJECT_DIR/plugins'
239
+
240
+ with open(brand_path) as f:
241
+ brand = json.load(f)
242
+
243
+ plugins_cfg = brand.get('plugins', {})
244
+ default_enabled = plugins_cfg.get('defaultEnabled', [])
245
+ core = set(plugins_cfg.get('core', []))
246
+
247
+ if not default_enabled:
248
+ print(' [seed] no defaultEnabled plugins in brand.json — skipping')
249
+ sys.exit(0)
250
+
251
+ # Dependency validation: check each plugin's PLUGIN.md requires field.
252
+ # A dependency is satisfied if it appears in core or in defaultEnabled.
253
+ satisfied = core | set(default_enabled)
254
+ validated = []
255
+ for plugin in default_enabled:
256
+ plugin_md = os.path.join(plugins_dir, plugin, 'PLUGIN.md')
257
+ requires = []
258
+ if os.path.isfile(plugin_md):
259
+ in_frontmatter = False
260
+ in_requires = False
261
+ with open(plugin_md) as f:
262
+ for line in f:
263
+ stripped = line.rstrip()
264
+ if stripped == '---':
265
+ if in_frontmatter:
266
+ break
267
+ in_frontmatter = True
268
+ continue
269
+ if not in_frontmatter:
270
+ continue
271
+ if stripped.startswith('requires:'):
272
+ # Handle inline list: requires: [a, b]
273
+ inline = stripped.split(':', 1)[1].strip()
274
+ if inline.startswith('['):
275
+ requires = [x.strip().strip('\"').strip(\"'\") for x in inline.strip('[]').split(',') if x.strip()]
276
+ in_requires = False
277
+ else:
278
+ in_requires = True
279
+ continue
280
+ if in_requires:
281
+ if stripped.startswith(' - '):
282
+ requires.append(stripped.lstrip(' -').strip())
283
+ else:
284
+ in_requires = False
285
+ unmet = [r for r in requires if r not in satisfied]
286
+ if unmet:
287
+ print(f' [seed] WARNING: skipping defaultEnabled plugin \"{plugin}\" — unmet requires: {unmet}')
288
+ else:
289
+ validated.append(plugin)
290
+
291
+ with open(account_path) as f:
292
+ account = json.load(f)
293
+
294
+ existing = account.get('enabledPlugins', [])
295
+ existing_set = set(existing)
296
+ added = [p for p in validated if p not in existing_set]
297
+ account['enabledPlugins'] = existing + added
298
+
299
+ with open(account_path, 'w') as f:
300
+ json.dump(account, f, indent=2)
301
+ f.write('\n')
302
+
303
+ if not existing:
304
+ print(f' [seed] seeded enabledPlugins: {validated}')
305
+ elif added:
306
+ print(f' [seed] merged into enabledPlugins: +{added} (existing: {existing})')
307
+ else:
308
+ print(f' [seed] enabledPlugins already contains all defaultEnabled entries')
309
+ "
310
+ fi
311
+
223
312
  echo " Account $ACCOUNT_ID at $ACCOUNT_DIR"
224
313
 
225
314
  # ------------------------------------------------------------------
@@ -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
 
@@ -3,7 +3,7 @@ name: real-agency-business
3
3
  description: "Business growth, operations, personal branding, and partnership models for estate agency owners and team leaders."
4
4
  tools: []
5
5
  always: false
6
- metadata: {"taskmaster":{"optional":true,"embed":["admin"]}}
6
+ metadata: {"platform":{"optional":true,"embed":["admin"]}}
7
7
  ---
8
8
 
9
9
  # Real Agency — Business
@@ -3,7 +3,7 @@ name: real-agency-buyers
3
3
  description: "Full buyer lifecycle — enquiry handling, qualification, viewing management, feedback collection, and educational guides for buyers and sellers."
4
4
  tools: []
5
5
  always: false
6
- metadata: {"taskmaster":{"optional":true,"embed":["public","admin"]}}
6
+ metadata: {"platform":{"optional":true,"embed":["public","admin"]}}
7
7
  ---
8
8
 
9
9
  # Real Agency — Buyer Management
@@ -3,7 +3,7 @@ name: real-agency-coaching
3
3
  description: "Coaching, training, and performance management for estate agency teams — personalised feedback, goal-setting frameworks, and sales methodology training."
4
4
  tools: []
5
5
  always: false
6
- metadata: {"taskmaster":{"optional":true,"embed":["public","admin"]}}
6
+ metadata: {"platform":{"optional":true,"embed":["public","admin"]}}
7
7
  ---
8
8
 
9
9
  # Real Agency — Coaching & Development
@@ -3,7 +3,7 @@ name: real-agency-leads
3
3
  description: "Lead generation and pipeline building — systematic nurturing, database reactivation, and proactive prospecting for UK estate agents."
4
4
  tools: []
5
5
  always: false
6
- metadata: {"taskmaster":{"optional":true,"embed":["admin"]}}
6
+ metadata: {"platform":{"optional":true,"embed":["admin"]}}
7
7
  ---
8
8
 
9
9
  # Real Agency — Lead Generation
@@ -3,7 +3,7 @@ name: real-agency-listings
3
3
  description: "Listing presentations, property marketing campaigns, and home preparation guidance for UK estate agents."
4
4
  tools: []
5
5
  always: false
6
- metadata: {"taskmaster":{"optional":true,"embed":["admin"]}}
6
+ metadata: {"platform":{"optional":true,"embed":["admin"]}}
7
7
  ---
8
8
 
9
9
  # Real Agency — Listings & Marketing
@@ -11,7 +11,7 @@ tools:
11
11
  - loop-feedback-list
12
12
  - loop-team-info
13
13
  always: false
14
- metadata: {"taskmaster":{"optional":true,"embed":["admin"]}}
14
+ metadata: {"platform":{"optional":true,"embed":["admin"]}}
15
15
  ---
16
16
 
17
17
  # Real Agency — Loop CRM
@@ -3,7 +3,7 @@ name: real-agency-onboarding
3
3
  description: "First-run member onboarding — career stage assessment, profile capture, and starting content recommendation."
4
4
  tools: []
5
5
  always: false
6
- metadata: {"taskmaster":{"optional":true,"embed":["public","admin"]}}
6
+ metadata: {"platform":{"optional":true,"embed":["public","admin"]}}
7
7
  ---
8
8
 
9
9
  # Real Agency — Onboarding
@@ -3,7 +3,7 @@ name: real-agency-sales
3
3
  description: "Estate agency sales cycle — prospect qualification, closing techniques, negotiation frameworks, and sales progression tracking."
4
4
  tools: []
5
5
  always: false
6
- metadata: {"taskmaster":{"optional":true,"embed":["public","admin"]}}
6
+ metadata: {"platform":{"optional":true,"embed":["public","admin"]}}
7
7
  ---
8
8
 
9
9
  # Real Agency — Sales
@@ -3,7 +3,7 @@ name: real-agency-teaching
3
3
  description: "Structured education module browsing and delivery — curriculum navigation, module teaching, and learning progress tracking."
4
4
  tools: []
5
5
  always: false
6
- metadata: {"taskmaster":{"optional":true,"embed":["public","admin"]}}
6
+ metadata: {"platform":{"optional":true,"embed":["public","admin"]}}
7
7
  ---
8
8
 
9
9
  # Real Agency — Teaching & Content
@@ -3,7 +3,7 @@ name: real-agency-vendors
3
3
  description: "Active vendor lifecycle management — communication, updates, valuation booking, and offer negotiation for UK estate agents."
4
4
  tools: []
5
5
  always: false
6
- metadata: {"taskmaster":{"optional":true,"embed":["admin"]}}
6
+ metadata: {"platform":{"optional":true,"embed":["admin"]}}
7
7
  ---
8
8
 
9
9
  # Real Agency — Vendor Management
@@ -4,7 +4,7 @@ description: "Interactive tutoring, lesson planning, and study pack generation.
4
4
  icon: 🎓
5
5
  tools: []
6
6
  always: false
7
- metadata: {"taskmaster":{"optional":true,"pluginKey":"teaching","embed":["public","admin"]}}
7
+ metadata: {"platform":{"optional":true,"pluginKey":"teaching","embed":["public","admin"]}}
8
8
  ---
9
9
 
10
10
  # Teaching
@@ -4,7 +4,7 @@ description: "Manuscript review and writing craft tools grounded in neuroscience
4
4
  icon: ✍️
5
5
  tools: []
6
6
  always: false
7
- metadata: {"taskmaster":{"optional":true,"pluginKey":"writer-craft","embed":["admin"]}}
7
+ metadata: {"platform":{"optional":true,"pluginKey":"writer-craft","embed":["admin"]}}
8
8
  ---
9
9
 
10
10
  # Writer Craft
@@ -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({