@rubytech/create-maxy 1.0.434 → 1.0.436

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 (28) hide show
  1. package/dist/index.js +22 -1
  2. package/dist/uninstall.js +44 -26
  3. package/package.json +1 -1
  4. package/payload/maxy/server.js +204 -76
  5. package/payload/platform/plugins/admin/mcp/dist/index.js +379 -10
  6. package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
  7. package/payload/platform/plugins/admin/skills/onboarding/skill.md +1 -1
  8. package/payload/platform/plugins/admin/skills/plugin-management/skill.md +16 -58
  9. package/payload/platform/plugins/admin/skills/public-agent-manager/skill.md +20 -3
  10. package/payload/platform/plugins/anthropic/PLUGIN.md +2 -2
  11. package/payload/platform/plugins/cloudflare/mcp/dist/index.js +22 -12
  12. package/payload/platform/plugins/cloudflare/mcp/dist/index.js.map +1 -1
  13. package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.d.ts +9 -5
  14. package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.d.ts.map +1 -1
  15. package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.js +82 -31
  16. package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.js.map +1 -1
  17. package/payload/platform/plugins/email/mcp/dist/scripts/email-auto-respond.d.ts +1 -1
  18. package/payload/platform/plugins/email/mcp/dist/scripts/email-auto-respond.js +30 -4
  19. package/payload/platform/plugins/email/mcp/dist/scripts/email-auto-respond.js.map +1 -1
  20. package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.js +31 -3
  21. package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.js.map +1 -1
  22. package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.d.ts +1 -1
  23. package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js +30 -2
  24. package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js.map +1 -1
  25. package/payload/platform/scripts/resume-tunnel.sh +14 -1
  26. package/payload/platform/scripts/vnc.sh +14 -1
  27. package/payload/platform/templates/agents/admin/IDENTITY.md +1 -1
  28. package/payload/premium-plugins/real-agency/plugins/real-agency-teaching/PLUGIN.md +1 -2
@@ -27,15 +27,11 @@ Built-in plugins under `$PLATFORM_ROOT/plugins/`:
27
27
 
28
28
  ## Premium Plugins
29
29
 
30
- Premium plugins are purchased separately and delivered from a staging area to the active plugin directory. They live in `premium-plugins/` (staging) until delivered, then appear in `$PLATFORM_ROOT/plugins/` alongside core plugins.
31
-
32
- ### Validation
33
-
34
- All premium plugin operations require name validation first. Plugin names must match `[a-z0-9-]` only — reject any name containing other characters (prevents path traversal). If the staging directory (`$PLATFORM_ROOT/../premium-plugins/`) does not exist, report that premium plugins will be available after the next platform update.
30
+ Premium plugins are purchased separately and delivered from a staging area to the active plugin directory. Two MCP tools handle all premium plugin operations deterministically no filesystem commands are delegated to the agent.
35
31
 
36
32
  ### Browsing available premium plugins
37
33
 
38
- When the user asks what premium plugins are available, list the contents of the staging directory (`$PLATFORM_ROOT/../premium-plugins/`). For each subdirectory, check whether it contains a `BUNDLE.md` (bundle) or `PLUGIN.md` (standalone plugin). For standalone plugins, read `PLUGIN.md` frontmatter to extract `name` and `description`. For bundles, read `BUNDLE.md` frontmatter to extract `name`, `description`, and `plugins` list present the bundle as a single product with its sub-plugin count. Read `account.json` via `account-manage` to check `purchasedPlugins` and `enabledPlugins` status. Present the results using `render-component` with the `card` type — show each product's name, description, and status (available / purchased / delivered / enabled).
34
+ Call `premium-list`. It returns structured data for every plugin in the staging area: name, type (standalone/bundle), description, purchase status, and delivery status (per sub-plugin for bundles). Present the results using `render-component` with the `card` type.
39
35
 
40
36
  ### Plugin info before purchase
41
37
 
@@ -45,65 +41,27 @@ When the user asks about a specific premium plugin (e.g., "tell me about the tea
45
41
 
46
42
  When the user states they have purchased a premium plugin, validate the plugin name, then confirm the plugin exists in the staging directory. Read `account.json` via `account-manage`, add the plugin name to the `purchasedPlugins` array (if not already present), and write back via `Edit`. Then proceed to delivery.
47
43
 
48
- ### Delivering a premium plugin (standalone)
49
-
50
- Delivery copies plugin files from staging to the active plugin directory. This section applies to standalone plugins (those with a `PLUGIN.md` at the top level, not a `BUNDLE.md`):
51
-
52
- 1. Validate the plugin name matches `[a-z0-9-]`.
53
- 2. Confirm the plugin is in `purchasedPlugins` — if not, tell the user to record the purchase first.
54
- 3. Check whether `$PLATFORM_ROOT/plugins/{name}/` already exists — if so, the plugin is already delivered. Skip the copy (idempotent).
55
- 4. Copy via Bash: `cp -r $PLATFORM_ROOT/../premium-plugins/{name} $PLATFORM_ROOT/plugins/{name}`. Check the exit code — if the copy fails, report the error and do not proceed.
56
- 5. Verify the delivery: confirm `$PLATFORM_ROOT/plugins/{name}/PLUGIN.md` exists and its frontmatter parses correctly. Scan subdirectories to count skills, references, and agent files.
57
- 6. Add the plugin name to `enabledPlugins` in `account.json` (if not already present) via read-then-Edit.
58
- 7. If the plugin directory contains an `agents/` subdirectory, load the specialist management skill via `plugin-read` from `admin/skills/specialist-management/skill.md` and follow the premium plugin agent activation instructions.
59
- 8. If the plugin's `agents/` directory also contains subdirectories with a `template.json` file, these are public agent templates — follow the template discovery instructions below.
60
- 9. Confirm to the user with detail: "Delivered {name} plugin ({N} skills, {N} references, {N} agents). Active from next session."
61
-
62
- ### Delivering a premium bundle
63
-
64
- A premium bundle is a staging directory that contains `BUNDLE.md` instead of `PLUGIN.md`. The `BUNDLE.md` frontmatter includes a `plugins` array listing the sub-plugin names. Each sub-plugin lives in the bundle's `plugins/` subdirectory and is a standalone plugin with its own `PLUGIN.md`.
65
-
66
- Purchasing a bundle records the bundle name (e.g., `"real-agency"`) in `purchasedPlugins`. Delivery copies each sub-plugin individually:
67
-
68
- 1. Read `$PLATFORM_ROOT/../premium-plugins/{bundle}/BUNDLE.md`. Parse the `plugins` array from the frontmatter. If `BUNDLE.md` is missing or the `plugins` array is empty, report the error and stop.
69
- 2. Confirm the bundle name is in `purchasedPlugins` — if not, tell the user to record the purchase first.
70
- 3. Validate each sub-plugin name in the `plugins` array matches `[a-z0-9-]` — reject any name containing other characters (prevents path traversal).
71
- 4. For each sub-plugin name in the `plugins` array:
72
- a. Check whether `$PLATFORM_ROOT/plugins/{sub-plugin}/` already exists — if so, skip the entire sub-plugin (do not copy, do not add to enabledPlugins). This preserves the user's enable/disable state for already-delivered sub-plugins.
73
- b. Validate the source exists: `$PLATFORM_ROOT/../premium-plugins/{bundle}/plugins/{sub-plugin}/` must contain a `PLUGIN.md`.
74
- c. Copy via Bash: `cp -r $PLATFORM_ROOT/../premium-plugins/{bundle}/plugins/{sub-plugin} $PLATFORM_ROOT/plugins/{sub-plugin}`.
75
- d. Verify the delivery: confirm `PLUGIN.md` exists and parses correctly. Count skills.
76
- 5. After all sub-plugins are copied and verified, add all newly delivered sub-plugin names to `enabledPlugins` in a single `account.json` Edit operation (not already-existing ones — only the ones copied in step 4c).
77
- 6. If the bundle's staging directory contains an `agents/` subdirectory with template subdirectories (directories containing a `template.json`), these are public agent templates — follow the template discovery instructions below.
78
- 7. Report the result: "Delivered {bundle} bundle ({N} sub-plugins, {total} skills). Active from next session." List each sub-plugin by name and skill count.
79
-
80
- Cherry-pick delivery is supported. When the user requests a specific sub-plugin from a bundle (e.g., "enable real-agency-sales"), deliver only that sub-plugin — follow steps 4a-4d for just the requested name, then step 5 for that single name. The bundle name must still be in `purchasedPlugins`. To find the parent bundle for a sub-plugin name, list all staging directories with `BUNDLE.md`, parse each `plugins` array, and find the bundle that contains the requested name.
81
-
82
- When the user says "enable {bundle-name}" (e.g., "enable real-agency") and the name matches a bundle, deliver all sub-plugins. When they say "enable {sub-plugin-name}" (e.g., "enable real-agency-sales"), deliver just that one.
83
-
84
- ### Public agent template discovery
85
-
86
- Premium plugins and bundles can include public agent templates in their `agents/` directory. Templates are subdirectories containing a `template.json` file alongside seed `IDENTITY.md` and `SOUL.md` files. They are distinct from specialist agent `.md` files — specialist files use the `{plugin-name}--{agent-name}.md` naming convention; templates are directories.
87
-
88
- After delivery, scan the `agents/` directory for template subdirectories:
89
- - For standalone plugins: `$PLATFORM_ROOT/plugins/{name}/agents/`
90
- - For bundles: `$PLATFORM_ROOT/../premium-plugins/{bundle}/agents/` (templates remain in staging — they are not copied with sub-plugins)
44
+ ### Delivering a premium plugin
91
45
 
92
- For each subdirectory that contains a `template.json`:
46
+ Call `premium-deliver` with `pluginName` set to the plugin name. The tool handles everything:
93
47
 
94
- 1. Read `template.json`. If the JSON is malformed, warn the user ("Template {dir-name} has invalid configuration, skipping") and continue to the next template.
95
- 2. Verify that both `IDENTITY.md` and `SOUL.md` exist in the template directory. If either is missing, warn the user ("Template {dir-name} is incomplete — missing {file}, skipping") and continue.
96
- 3. Collect valid templates into a list with each template's `displayName` and `description` from `template.json`.
48
+ - Validates the plugin name and checks purchase status
49
+ - Auto-detects standalone vs bundle (BUNDLE.md vs PLUGIN.md)
50
+ - For bundles: copies each sub-plugin from staging to `$PLATFORM_ROOT/plugins/`
51
+ - For standalone plugins: copies the single plugin directory
52
+ - Skips already-delivered sub-plugins (idempotent)
53
+ - Verifies each copy (PLUGIN.md exists and parses)
54
+ - Updates `enabledPlugins` in account.json (only newly delivered names)
55
+ - Scans for public agent templates
56
+ - Returns a structured result with per-sub-plugin status and available templates
97
57
 
98
- If valid templates are found, present them to the user: "This plugin includes {N} pre-built public agent templates:" followed by each template's display name and description. Then ask: "Would you like to create any of these agents now? You can also create them later by asking."
58
+ Report the tool's result to the user. If templates are found, present them and ask whether the user wants to create any now. For template creation, load the public agent management skill via `plugin-read` from `admin/skills/public-agent-manager/skill.md` and follow the "Create from Template" instructions, passing the template directory path from the tool's result.
99
59
 
100
- - If the user wants to create one or more templates: for each selected template, load the public agent management skill via `plugin-read` from `admin/skills/public-agent-manager/skill.md` and follow the "Create from Template" instructions, passing the template directory path as context.
101
- - If the user declines: proceed with the delivery confirmation. No templates are created.
102
- - If the user asks to create templates later: they can request creation at any time by asking (e.g., "create the buyer enquiry agent from real-agency templates").
60
+ If the delivered plugin has specialist agents (files in `agents/` with the `{plugin-name}--{agent-name}.md` naming convention, distinct from template directories), load the specialist management skill and follow the premium plugin agent activation instructions.
103
61
 
104
62
  ### On-demand template listing
105
63
 
106
- When the user asks what agent templates are available from a premium plugin (e.g., "what agents can I create from real-agency?"), scan the plugin's `agents/` directory using the same path resolution as delivery. Present the template list with display names, descriptions, and the suggested slug for each. If the plugin has no templates, report that.
64
+ Call `premium-deliver` for the plugin it re-scans templates without re-copying anything (idempotent). The `templates` array in the result contains each template's display name, description, suggested slug, and directory path. `premium-list` returns purchase and delivery status but does not scan templates.
107
65
 
108
66
  ### Disabling a premium plugin or bundle
109
67
 
@@ -65,9 +65,26 @@ Present as a `select` field within the agent configuration `form` during creatio
65
65
 
66
66
  ### Plugin Selection
67
67
 
68
- Present available plugins (those with `embed: ["public"]` in PLUGIN.md metadata) as a `multi-select` component. Selected plugin names are stored in `config.json`. The platform filters embedded plugins per-agent at runtime.
68
+ Present available plugins as a `multi-select` component. Selected plugin names are stored in `config.json`. The platform filters embedded plugins per-agent at runtime — only plugins whose `metadata.taskmaster.embed` includes `"public"` are actually embedded.
69
69
 
70
- To discover available plugins: list directories under `$PLATFORM_ROOT/plugins/` and check each PLUGIN.md frontmatter for `embed` containing `"public"`.
70
+ Only present plugins from the curated list below. Before presenting, verify each plugin's directory exists under `$PLATFORM_ROOT/plugins/` (premium plugins are only available when delivered). Omit any plugin whose directory is absent.
71
+
72
+ **Core (always available):**
73
+
74
+ | Plugin | Description |
75
+ |--------|-------------|
76
+ | `sales` | Buying signal detection, closing techniques, objection handling |
77
+ | `docs` | User guide and platform documentation |
78
+
79
+ **Premium — Real Agency (only when delivered):**
80
+
81
+ | Plugin | Description |
82
+ |--------|-------------|
83
+ | `real-agency-buyers` | Buyer qualification and property matching |
84
+ | `real-agency-coaching` | Agent coaching and performance development |
85
+ | `real-agency-onboarding` | Client onboarding workflows |
86
+ | `real-agency-sales` | Real estate sales methodology |
87
+ | `real-agency-teaching` | Training and educational content |
71
88
 
72
89
  ## SOUL.md Scope Enforcement
73
90
 
@@ -125,7 +142,7 @@ The following Create steps are modified when a template is provided:
125
142
 
126
143
  - **Step 1** — use `suggestedSlug` from `template.json` as the initial slug. If an agent already exists at that slug, ask the user to choose a different name.
127
144
  - **Step 2** — skip. The agent name and role come from `template.json` `displayName` and `description`.
128
- - **Step 3** — pre-select the plugins listed in `template.json` `plugins` array. Only plugins that appear in the available plugin list (those with `embed: ["public"]` in their PLUGIN.md) can be pre-selected. If any template plugin is not available (not delivered, not enabled, or not marked for public embed), note which ones are missing and let the user adjust the selection.
145
+ - **Step 3** — pre-select the plugins listed in `template.json` `plugins` array. Only plugins that appear in the curated public-eligible list (see Plugin Selection above) can be pre-selected. If any template plugin is not available (not delivered, not enabled, or not marked for public embed), note which ones are missing and let the user adjust the selection.
129
146
  - **Step 5** — present the template's `IDENTITY.md` content via `document-editor` instead of drafting from a role description. The user can edit before approving.
130
147
  - **Step 6** — present the template's `SOUL.md` content via `document-editor` instead of drafting from conversation. The user can edit before approving.
131
148
  - **Step 7** — pre-populate form defaults: `model` from `template.json` (or `claude-haiku-4-5-20251001` if absent), `liveMemory` from `template.json` (or `false`), `knowledgeKeywords` from `template.json` (or empty).
@@ -9,7 +9,7 @@ The public agent runs on the Anthropic API. This plugin handles obtaining, stori
9
9
 
10
10
  ## When to activate
11
11
 
12
- - Prerequisites check detects missing `~/.maxy/.anthropic-api-key`
12
+ - Prerequisites check detects missing Anthropic API key (via `api-key-verify` tool)
13
13
  - User asks how to connect Claude, get an Anthropic key, or set up their AI
14
14
  - BOOTSTRAP detects no working Anthropic API connection
15
15
  - User sees an API authentication error
@@ -24,7 +24,7 @@ The public agent runs on the Anthropic API. This plugin handles obtaining, stori
24
24
 
25
25
  | Task | When to use | Skill |
26
26
  |------|-------------|-------|
27
- | Obtain API key via browser | Missing `~/.maxy/.anthropic-api-key` or user wants to rotate key | `skills/get-api-key/SKILL.md` |
27
+ | Obtain API key via browser | `api-key-verify` returns `missing` or user wants to rotate key | `skills/get-api-key/SKILL.md` |
28
28
 
29
29
  ## References
30
30
 
@@ -2,7 +2,6 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
3
  import { z } from "zod";
4
4
  import * as cloudflared from "./lib/cloudflared.js";
5
- import { BRAND } from "./lib/cloudflared.js";
6
5
  const server = new McpServer({
7
6
  name: "cloudflare",
8
7
  version: "0.2.0",
@@ -10,7 +9,7 @@ const server = new McpServer({
10
9
  // ===================================================================
11
10
  // Token management
12
11
  // ===================================================================
13
- server.tool("cf-set-token", "Fallback auth: manually set a Cloudflare API token. Use tunnel-login as the primary auth method — it handles everything automatically. Only use cf-set-token when tunnel-login cert.pem derivation fails and a manually-created API token is needed. Validates the token, discovers the account ID, and persists both to ~/.cloudflare/api-token. Required scopes: Zone:DNS:Edit, Account:Cloudflare Tunnel:Edit, Zone:Zone:Read.", {
12
+ server.tool("cf-set-token", "Set the Cloudflare API token. Validates the token against the Cloudflare API, discovers the account ID, and persists both to ~/.cloudflare/api-token. Required scopes: Zone:DNS:Edit, Account:Cloudflare Tunnel:Edit, Zone:Zone:Read.", {
14
13
  token: z
15
14
  .string()
16
15
  .describe("The Cloudflare API token to store"),
@@ -294,7 +293,7 @@ server.tool("tunnel-install", "Install the cloudflared binary if not already pre
294
293
  };
295
294
  }
296
295
  });
297
- server.tool("tunnel-create", "Create a Cloudflare Tunnel and route DNS for admin.{domain} and public.{domain}. Uses the Cloudflare SDK — requires a valid API token (set via tunnel-login, or cf-set-token as fallback).", {
296
+ server.tool("tunnel-create", "Create a Cloudflare Tunnel and route DNS for admin.{domain} and public.{domain}. Uses the Cloudflare SDK — requires a valid API token (set via cf-set-token).", {
298
297
  domain: z
299
298
  .string()
300
299
  .describe("The bare domain (e.g. 'maxy.bot'). Subdomains admin. and public. are created automatically."),
@@ -308,7 +307,7 @@ server.tool("tunnel-create", "Create a Cloudflare Tunnel and route DNS for admin
308
307
  content: [
309
308
  {
310
309
  type: "text",
311
- text: "No API token configured. Run tunnel-login to authenticate (primary), or cf-set-token as a fallback if tunnel-login cert.pem derivation fails.",
310
+ text: "No API token configured. Run cf-set-token first.",
312
311
  },
313
312
  ],
314
313
  isError: true,
@@ -319,7 +318,8 @@ server.tool("tunnel-create", "Create a Cloudflare Tunnel and route DNS for admin
319
318
  // Create or reuse tunnel
320
319
  const result = await cloudflared.createTunnel(name);
321
320
  // Configure ingress rules on Cloudflare's edge
322
- await cloudflared.configureTunnel(result.tunnelId, domain, BRAND.port);
321
+ const brand = cloudflared.loadBrand();
322
+ await cloudflared.configureTunnel(result.tunnelId, domain, brand.port);
323
323
  // Create DNS CNAME records
324
324
  const zoneId = await cloudflared.getZoneId(domain);
325
325
  const adminDns = await cloudflared.createDnsRecord(zoneId, `admin.${domain}`, result.tunnelId);
@@ -426,9 +426,10 @@ server.tool("tunnel-enable", "Start the Cloudflare Tunnel process. The tunnel mu
426
426
  isError: true,
427
427
  };
428
428
  }
429
+ const brand = cloudflared.loadBrand();
429
430
  // GATE 2: Remote auth must be configured (verified via live API, not file check)
430
431
  try {
431
- const res = await fetch(`http://127.0.0.1:${BRAND.port}/api/remote-auth/status`, {
432
+ const res = await fetch(`http://127.0.0.1:${brand.port}/api/remote-auth/status`, {
432
433
  signal: AbortSignal.timeout(5000),
433
434
  });
434
435
  const body = await res.json();
@@ -449,7 +450,7 @@ server.tool("tunnel-enable", "Start the Cloudflare Tunnel process. The tunnel mu
449
450
  content: [
450
451
  {
451
452
  type: "text",
452
- text: `REFUSED: Cannot verify remote authentication — the web server at http://127.0.0.1:${BRAND.port} is not reachable. The admin interface cannot be exposed without a running auth gate.\n\nEnsure the ${BRAND.productName} platform is running before enabling the tunnel.`,
453
+ text: `REFUSED: Cannot verify remote authentication — the web server at http://127.0.0.1:${brand.port} is not reachable. The admin interface cannot be exposed without a running auth gate.\n\nEnsure the ${brand.productName} platform is running before enabling the tunnel.`,
453
454
  },
454
455
  ],
455
456
  isError: true,
@@ -461,17 +462,23 @@ server.tool("tunnel-enable", "Start the Cloudflare Tunnel process. The tunnel mu
461
462
  content: [
462
463
  {
463
464
  type: "text",
464
- text: `REFUSED: No API token configured. Run tunnel-login to authenticate (primary), or cf-set-token as a fallback if tunnel-login cert.pem derivation fails.`,
465
+ text: `REFUSED: No API token configured. Run cf-set-token first.`,
465
466
  },
466
467
  ],
467
468
  isError: true,
468
469
  };
469
470
  }
471
+ // GATE 4: Ingress port verification — self-heal if rules point to wrong port
472
+ const ingressFix = await cloudflared.fixIngressPort(tunnelId, brand.port);
473
+ if (ingressFix.corrected) {
474
+ console.error(`[tunnel-enable] ingress port corrected from ${ingressFix.fromPort} to ${brand.port}`);
475
+ }
470
476
  // Fetch connector token from Cloudflare API
471
477
  const connectorToken = await cloudflared.getConnectorToken(tunnelId);
472
478
  // Start the tunnel daemon
473
479
  cloudflared.startTunnel(connectorToken, tunnelId, domain);
474
480
  // Wait up to 5 seconds to verify the process didn't immediately crash
481
+ const logHint = `~/${brand.configDir}/logs/cloudflared.log`;
475
482
  for (let i = 0; i < 10; i++) {
476
483
  await new Promise((r) => setTimeout(r, 500));
477
484
  const status = await cloudflared.getStatus(domain);
@@ -480,7 +487,7 @@ server.tool("tunnel-enable", "Start the Cloudflare Tunnel process. The tunnel mu
480
487
  content: [
481
488
  {
482
489
  type: "text",
483
- text: `Tunnel process exited immediately after starting. Check ~/${BRAND.configDir}/logs/cloudflared.log for details.`,
490
+ text: `Tunnel process exited immediately after starting. Check ${logHint} for details.`,
484
491
  },
485
492
  ],
486
493
  isError: true,
@@ -513,17 +520,20 @@ server.tool("tunnel-enable", "Start the Cloudflare Tunnel process. The tunnel mu
513
520
  content: [
514
521
  {
515
522
  type: "text",
516
- text: `Tunnel process is running (PID ${status.pid}) but https://public.${domain} returned HTTP 530 after 30s of retries. Cloudflare's edge cannot route traffic to this tunnel.\n\nCommon causes:\n 1. Stale DNS CNAME records pointing to a previous tunnel — run tunnel-create again to fix\n 2. UDP buffer too small for QUIC — check ~/${BRAND.configDir}/logs/cloudflared.log\n 3. Firewall blocking outbound QUIC to Cloudflare edge\n\nThe tunnel is NOT working. Do not report success.`,
523
+ text: `Tunnel process is running (PID ${status.pid}) but https://public.${domain} returned HTTP 530 after 30s of retries. Cloudflare's edge cannot route traffic to this tunnel.\n\nCommon causes:\n 1. Stale DNS CNAME records pointing to a previous tunnel — run tunnel-create again to fix\n 2. UDP buffer too small for QUIC — check ${logHint}\n 3. Firewall blocking outbound QUIC to Cloudflare edge\n\nThe tunnel is NOT working. Do not report success.`,
517
524
  },
518
525
  ],
519
526
  isError: true,
520
527
  };
521
528
  }
529
+ const ingressNote = ingressFix.corrected
530
+ ? `\n Ingress: port corrected from ${ingressFix.fromPort} to ${brand.port}`
531
+ : "";
522
532
  return {
523
533
  content: [
524
534
  {
525
535
  type: "text",
526
- text: `Tunnel started and verified.\n\n PID: ${status.pid}\n Admin: https://admin.${domain}\n Public: https://public.${domain}\n\nBoth URLs are reachable through Cloudflare's edge. The tunnel auto-starts on device reboot.`,
536
+ text: `Tunnel started and verified.\n\n PID: ${status.pid}\n Admin: https://admin.${domain}\n Public: https://public.${domain}${ingressNote}\n\nBoth URLs are reachable through Cloudflare's edge. The tunnel auto-starts on device reboot.`,
527
537
  },
528
538
  ],
529
539
  };
@@ -577,7 +587,7 @@ server.tool("tunnel-add-hostname", "Add an alias hostname to an existing Cloudfl
577
587
  content: [
578
588
  {
579
589
  type: "text",
580
- text: "No API token configured. Run tunnel-login to authenticate (primary), or cf-set-token as a fallback if tunnel-login cert.pem derivation fails.",
590
+ text: "No API token configured. Run cf-set-token first.",
581
591
  },
582
592
  ],
583
593
  isError: true,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,M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;QACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,MAAM,IAAI,GAAI,GAA6B,CAAC,IAAI,CAAC;QACjD,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,sBAAsB,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,+IAA+I;iBAC1M;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CACF,CAAC;AAEF,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
@@ -1,11 +1,10 @@
1
1
  import Cloudflare from "cloudflare";
2
- declare let BRAND: {
3
- configDir: string;
2
+ interface BrandConfig {
4
3
  port: number;
4
+ configDir: string;
5
5
  productName: string;
6
- };
7
- /** Brand config for use by the MCP server (index.ts). */
8
- export { BRAND };
6
+ }
7
+ export declare function loadBrand(): BrandConfig;
9
8
  export declare function findBinary(): string | null;
10
9
  export declare function isInstalled(): boolean;
11
10
  export declare function version(): string | null;
@@ -71,6 +70,10 @@ export declare function addHostnameToIngress(tunnelId: string, hostname: string,
71
70
  added: boolean;
72
71
  alreadyPresent: boolean;
73
72
  }>;
73
+ export declare function fixIngressPort(tunnelId: string, expectedPort: number): Promise<{
74
+ corrected: boolean;
75
+ fromPort?: number;
76
+ }>;
74
77
  export declare function loadAliasDomains(): Set<string>;
75
78
  export declare function saveAliasDomain(hostname: string): void;
76
79
  export declare function getConnectorToken(tunnelId: string): Promise<string>;
@@ -104,4 +107,5 @@ export interface TunnelStatus {
104
107
  export declare function getStatus(domain?: string): Promise<TunnelStatus>;
105
108
  export declare function startTunnel(connectorToken: string, tunnelId: string, domain: string): void;
106
109
  export declare function stopTunnel(): void;
110
+ export {};
107
111
  //# sourceMappingURL=cloudflared.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cloudflared.d.ts","sourceRoot":"","sources":["../../src/lib/cloudflared.ts"],"names":[],"mappings":"AAYA,OAAO,UAAU,MAAM,YAAY,CAAC;AAYpC,QAAA,IAAI,KAAK;;;;CAA2D,CAAC;AAiBrE,yDAAyD;AACzD,OAAO,EAAE,KAAK,EAAE,CAAC;AAcjB,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAsB1C;AAED,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAED,wBAAgB,OAAO,IAAI,MAAM,GAAG,IAAI,CAavC;AASD,UAAU,WAAW;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,SAAS,IAAI,WAAW,GAAG,IAAI,CAO9C;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAIpE;AAED,wBAAgB,QAAQ,IAAI,OAAO,CAElC;AAQD,wBAAgB,OAAO,IAAI,OAAO,CAEjC;AAED,UAAU,eAAe;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,eAAe,GAAG,IAAI,CAyBrD;AAMD,wBAAgB,SAAS,IAAI;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAWrE;AAMD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,eAA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B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAsB,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAuBtE;AAED,wBAAgB,WAAW,CACzB,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,IAAI,CAoCN;AAED,wBAAgB,UAAU,IAAI,IAAI,CA0BjC"}
@@ -4,30 +4,26 @@ import { randomBytes } from "node:crypto";
4
4
  import { join } from "node:path";
5
5
  import { homedir } from "node:os";
6
6
  import Cloudflare from "cloudflare";
7
- // ---------------------------------------------------------------------------
8
- // Brand manifest — read at boot from platform/config/brand.json.
9
- // Provides configDir and port for brand-specific paths.
10
- // ---------------------------------------------------------------------------
11
- const PLATFORM_ROOT = process.env.PLATFORM_ROOT || "";
12
- const BRAND_JSON_PATH = PLATFORM_ROOT
13
- ? join(PLATFORM_ROOT, "config", "brand.json")
14
- : "";
15
- let BRAND = { configDir: ".maxy", port: 19200, productName: "Maxy" };
16
- if (BRAND_JSON_PATH && existsSync(BRAND_JSON_PATH)) {
17
- try {
18
- const parsed = JSON.parse(readFileSync(BRAND_JSON_PATH, "utf-8"));
19
- BRAND = { ...BRAND, ...parsed };
20
- }
21
- catch (err) {
22
- console.error(`[cloudflared] Failed to parse brand.json: ${err.message}`);
23
- process.exit(1);
24
- }
25
- }
26
- else if (BRAND_JSON_PATH) {
27
- console.error(`[cloudflared] WARNING: brand.json not found at ${BRAND_JSON_PATH} — using Maxy defaults`);
7
+ let cachedBrand = null;
8
+ export function loadBrand() {
9
+ if (cachedBrand)
10
+ return cachedBrand;
11
+ const platformRoot = process.env.PLATFORM_ROOT;
12
+ if (!platformRoot) {
13
+ throw new Error("PLATFORM_ROOT env var is not set — cannot determine brand configuration");
14
+ }
15
+ const brandPath = join(platformRoot, "config", "brand.json");
16
+ if (!existsSync(brandPath)) {
17
+ throw new Error(`brand.json not found at ${brandPath} — PLATFORM_ROOT may be incorrect`);
18
+ }
19
+ const parsed = JSON.parse(readFileSync(brandPath, "utf-8"));
20
+ cachedBrand = {
21
+ port: parsed.port ?? 19200,
22
+ configDir: parsed.configDir ?? ".maxy",
23
+ productName: parsed.productName ?? "Maxy",
24
+ };
25
+ return cachedBrand;
28
26
  }
29
- /** Brand config for use by the MCP server (index.ts). */
30
- export { BRAND };
31
27
  // ---------------------------------------------------------------------------
32
28
  // Binary detection (unchanged — cloudflared binary still needed for daemon)
33
29
  // ---------------------------------------------------------------------------
@@ -283,7 +279,8 @@ export async function getTunnelIngress(tunnelId) {
283
279
  service: r.service ?? "",
284
280
  }));
285
281
  }
286
- export async function addHostnameToIngress(tunnelId, hostname, port = BRAND.port) {
282
+ export async function addHostnameToIngress(tunnelId, hostname, port) {
283
+ const effectivePort = port ?? loadBrand().port;
287
284
  const rules = await getTunnelIngress(tunnelId);
288
285
  // Idempotent — skip if hostname already has an ingress rule
289
286
  if (rules.some((r) => r.hostname === hostname)) {
@@ -300,7 +297,7 @@ export async function addHostnameToIngress(tunnelId, hostname, port = BRAND.port
300
297
  config: {
301
298
  ingress: [
302
299
  ...namedRules,
303
- { hostname, service: `http://localhost:${port}` },
300
+ { hostname, service: `http://localhost:${effectivePort}` },
304
301
  { hostname: "", service: "http_status:404" },
305
302
  ],
306
303
  },
@@ -308,14 +305,68 @@ export async function addHostnameToIngress(tunnelId, hostname, port = BRAND.port
308
305
  return { added: true, alreadyPresent: false };
309
306
  }
310
307
  // ---------------------------------------------------------------------------
308
+ // Ingress port verification — read-modify-write (preserves all hostnames)
309
+ //
310
+ // Reads current ingress rules, checks if any named rule's service port
311
+ // differs from expectedPort, and rewrites all rules with the correct port.
312
+ // Preserves all hostnames including aliases — unlike configureTunnel()
313
+ // which destructively sets only admin/public.
314
+ // ---------------------------------------------------------------------------
315
+ function extractPort(serviceUrl) {
316
+ try {
317
+ const url = new URL(serviceUrl);
318
+ return url.port ? parseInt(url.port, 10) : null;
319
+ }
320
+ catch {
321
+ return null;
322
+ }
323
+ }
324
+ export async function fixIngressPort(tunnelId, expectedPort) {
325
+ const rules = await getTunnelIngress(tunnelId);
326
+ const namedRules = rules.filter((r) => r.hostname);
327
+ if (namedRules.length === 0) {
328
+ return { corrected: false };
329
+ }
330
+ // Check if any named rule has a mismatched port
331
+ let mismatchPort = null;
332
+ for (const rule of namedRules) {
333
+ const port = extractPort(rule.service);
334
+ if (port !== null && port !== expectedPort) {
335
+ mismatchPort = port;
336
+ break;
337
+ }
338
+ }
339
+ if (mismatchPort === null) {
340
+ return { corrected: false };
341
+ }
342
+ // Rewrite all named rules with the correct port, preserving hostnames
343
+ const correctedRules = namedRules.map((r) => ({
344
+ hostname: r.hostname,
345
+ service: `http://localhost:${expectedPort}`,
346
+ }));
347
+ const { client, accountId } = getClient();
348
+ await client.zeroTrust.tunnels.cloudflared.configurations.update(tunnelId, {
349
+ account_id: accountId,
350
+ config: {
351
+ ingress: [
352
+ ...correctedRules,
353
+ { hostname: "", service: "http_status:404" },
354
+ ],
355
+ },
356
+ });
357
+ return { corrected: true, fromPort: mismatchPort };
358
+ }
359
+ // ---------------------------------------------------------------------------
311
360
  // Alias domain persistence — ~/{configDir}/alias-domains.json
312
361
  // ---------------------------------------------------------------------------
313
- const ALIAS_DOMAINS_FILE = join(homedir(), BRAND.configDir, "alias-domains.json");
362
+ function aliasDomainPath() {
363
+ return join(homedir(), loadBrand().configDir, "alias-domains.json");
364
+ }
314
365
  export function loadAliasDomains() {
315
366
  try {
316
- if (!existsSync(ALIAS_DOMAINS_FILE))
367
+ if (!existsSync(aliasDomainPath()))
317
368
  return new Set();
318
- const raw = readFileSync(ALIAS_DOMAINS_FILE, "utf-8");
369
+ const raw = readFileSync(aliasDomainPath(), "utf-8");
319
370
  const parsed = JSON.parse(raw);
320
371
  if (!Array.isArray(parsed)) {
321
372
  console.error("[alias-domains] malformed alias-domains.json — expected array, treating as empty");
@@ -333,9 +384,9 @@ export function saveAliasDomain(hostname) {
333
384
  if (existing.has(hostname))
334
385
  return; // idempotent
335
386
  existing.add(hostname);
336
- const dir = join(homedir(), BRAND.configDir);
387
+ const dir = join(homedir(), loadBrand().configDir);
337
388
  mkdirSync(dir, { recursive: true });
338
- writeFileSync(ALIAS_DOMAINS_FILE, JSON.stringify([...existing], null, 2), "utf-8");
389
+ writeFileSync(aliasDomainPath(), JSON.stringify([...existing], null, 2), "utf-8");
339
390
  }
340
391
  export async function getConnectorToken(tunnelId) {
341
392
  const { client, accountId } = getClient();
@@ -499,7 +550,7 @@ export function startTunnel(connectorToken, tunnelId, domain) {
499
550
  // UDP buffer sizes for QUIC stability are persisted via /etc/sysctl.d/99-maxy-quic.conf
500
551
  // (written by the installer). No runtime sysctl calls needed.
501
552
  // Log to ~/{configDir}/logs/ so crashes are diagnosable
502
- const logDir = join(homedir(), BRAND.configDir, "logs");
553
+ const logDir = join(homedir(), loadBrand().configDir, "logs");
503
554
  mkdirSync(logDir, { recursive: true });
504
555
  const logPath = join(logDir, "cloudflared.log");
505
556
  const logFd = openSync(logPath, "a");