@askexenow/exe-os 0.9.77 → 0.9.78

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 (72) hide show
  1. package/dist/bin/agentic-ontology-backfill.js +2 -2
  2. package/dist/bin/agentic-reflection-backfill.js +2 -2
  3. package/dist/bin/agentic-semantic-label.js +2 -2
  4. package/dist/bin/backfill-conversations.js +2 -2
  5. package/dist/bin/backfill-responses.js +2 -2
  6. package/dist/bin/backfill-vectors.js +2 -2
  7. package/dist/bin/bulk-sync-postgres.js +2 -2
  8. package/dist/bin/cleanup-stale-review-tasks.js +2 -2
  9. package/dist/bin/cli.js +759 -524
  10. package/dist/bin/customer-readiness.js +19 -0
  11. package/dist/bin/exe-agent.js +2 -2
  12. package/dist/bin/exe-assign.js +2 -2
  13. package/dist/bin/exe-boot.js +2 -2
  14. package/dist/bin/exe-call.js +2 -2
  15. package/dist/bin/exe-cloud.js +2 -2
  16. package/dist/bin/exe-dispatch.js +2 -2
  17. package/dist/bin/exe-doctor.js +2 -2
  18. package/dist/bin/exe-export-behaviors.js +2 -2
  19. package/dist/bin/exe-forget.js +2 -2
  20. package/dist/bin/exe-gateway.js +158 -16
  21. package/dist/bin/exe-heartbeat.js +2 -2
  22. package/dist/bin/exe-kill.js +2 -2
  23. package/dist/bin/exe-launch-agent.js +2 -2
  24. package/dist/bin/exe-new-employee.js +2 -2
  25. package/dist/bin/exe-pending-messages.js +2 -2
  26. package/dist/bin/exe-pending-notifications.js +2 -2
  27. package/dist/bin/exe-pending-reviews.js +2 -2
  28. package/dist/bin/exe-rename.js +2 -2
  29. package/dist/bin/exe-review.js +2 -2
  30. package/dist/bin/exe-search.js +2 -2
  31. package/dist/bin/exe-session-cleanup.js +2 -2
  32. package/dist/bin/exe-start-codex.js +2 -2
  33. package/dist/bin/exe-start-opencode.js +2 -2
  34. package/dist/bin/exe-status.js +2 -2
  35. package/dist/bin/exe-support.js +461 -0
  36. package/dist/bin/exe-team.js +2 -2
  37. package/dist/bin/git-sweep.js +2 -2
  38. package/dist/bin/graph-backfill.js +2 -2
  39. package/dist/bin/graph-export.js +2 -2
  40. package/dist/bin/intercom-check.js +2 -2
  41. package/dist/bin/scan-tasks.js +2 -2
  42. package/dist/bin/setup.js +3 -2
  43. package/dist/bin/shard-migrate.js +2 -2
  44. package/dist/bin/update.js +9 -0
  45. package/dist/gateway/index.js +2 -2
  46. package/dist/hooks/bug-report-worker.js +2 -2
  47. package/dist/hooks/codex-stop-task-finalizer.js +2 -2
  48. package/dist/hooks/commit-complete.js +2 -2
  49. package/dist/hooks/error-recall.js +2 -2
  50. package/dist/hooks/ingest.js +2 -2
  51. package/dist/hooks/instructions-loaded.js +2 -2
  52. package/dist/hooks/notification.js +2 -2
  53. package/dist/hooks/post-compact.js +2 -2
  54. package/dist/hooks/post-tool-combined.js +2 -2
  55. package/dist/hooks/pre-compact.js +2 -2
  56. package/dist/hooks/pre-tool-use.js +2 -2
  57. package/dist/hooks/prompt-submit.js +2 -2
  58. package/dist/hooks/session-end.js +2 -2
  59. package/dist/hooks/session-start.js +2 -2
  60. package/dist/hooks/stop.js +2 -2
  61. package/dist/hooks/subagent-stop.js +2 -2
  62. package/dist/hooks/summary-worker.js +2 -2
  63. package/dist/index.js +2 -2
  64. package/dist/lib/employee-templates.js +2 -2
  65. package/dist/lib/exe-daemon.js +28 -16
  66. package/dist/lib/hybrid-search.js +2 -2
  67. package/dist/lib/schedules.js +2 -2
  68. package/dist/lib/store.js +2 -2
  69. package/dist/mcp/server.js +27 -15
  70. package/dist/runtime/index.js +2 -2
  71. package/dist/tui/App.js +2 -2
  72. package/package.json +1 -1
@@ -149,6 +149,25 @@ test("Providers \u2014 active code imports lib/providers, not gateway/providers"
149
149
  if (hits.length > 0) return `Deprecated provider imports: ${hits.slice(0, 3).join("; ")}`;
150
150
  return true;
151
151
  });
152
+ test("Support intake \u2014 customer CLI smoke test is routed", () => {
153
+ const cli = readSrc("src/bin/cli.ts");
154
+ const support = readSrc("src/bin/exe-support.ts");
155
+ const tsup = readSrc("tsup.config.ts");
156
+ if (!cli.includes('args[0] === "support"')) return "exe-os support route missing";
157
+ if (!support.includes("support health") || !support.includes("support test")) return "support CLI missing health/test commands";
158
+ if (!tsup.includes('"bin/exe-support"')) return "exe-support missing from build entries";
159
+ return true;
160
+ });
161
+ test("Support intake \u2014 API health route and cloud-sync license fallback exist", () => {
162
+ const api = readSrc("api-router/src/index.ts");
163
+ const supportRoutes = readSrc("api-router/src/support-routes.ts");
164
+ const wrangler = readSrc("api-router/wrangler.toml");
165
+ if (!api.includes("/v1/support/health")) return "support health route missing";
166
+ if (!supportRoutes.includes("handleSupportHealth")) return "handleSupportHealth missing";
167
+ if (!supportRoutes.includes("env.CLOUD_SYNC.fetch")) return "cloud-sync service binding fallback missing";
168
+ if (!wrangler.includes('binding = "CLOUD_SYNC"')) return "CLOUD_SYNC service binding missing";
169
+ return true;
170
+ });
152
171
  console.log(`
153
172
  \x1B[1m${pass + fail} tests: ${pass} passed, ${fail} failed\x1B[0m
154
173
  `);
@@ -1375,7 +1375,7 @@ var PLATFORM_PROCEDURES = [
1375
1375
  title: "Customer patch triage \u2014 upstream bug vs customization",
1376
1376
  domain: "support",
1377
1377
  priority: "p0",
1378
- content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
1378
+ content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, run `exe-os support test` and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
1379
1379
  },
1380
1380
  // --- Operations ---
1381
1381
  {
@@ -1457,7 +1457,7 @@ var PLATFORM_PROCEDURES = [
1457
1457
  title: "MCP tools \u2014 identity, behavior, and decisions",
1458
1458
  domain: "tool-use",
1459
1459
  priority: "p1",
1460
- content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only."
1460
+ content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only. If a customer-side agent cannot send upstream, run `exe-os support test` from the terminal to verify local file write, license auth, support endpoint health, and upstream POST."
1461
1461
  },
1462
1462
  {
1463
1463
  title: "MCP tools \u2014 communication and messaging",
@@ -3512,7 +3512,7 @@ var init_platform_procedures = __esm({
3512
3512
  title: "Customer patch triage \u2014 upstream bug vs customization",
3513
3513
  domain: "support",
3514
3514
  priority: "p0",
3515
- content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
3515
+ content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, run `exe-os support test` and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
3516
3516
  },
3517
3517
  // --- Operations ---
3518
3518
  {
@@ -3594,7 +3594,7 @@ var init_platform_procedures = __esm({
3594
3594
  title: "MCP tools \u2014 identity, behavior, and decisions",
3595
3595
  domain: "tool-use",
3596
3596
  priority: "p1",
3597
- content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only."
3597
+ content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only. If a customer-side agent cannot send upstream, run `exe-os support test` from the terminal to verify local file write, license auth, support endpoint health, and upstream POST."
3598
3598
  },
3599
3599
  {
3600
3600
  title: "MCP tools \u2014 communication and messaging",
@@ -3249,7 +3249,7 @@ var init_platform_procedures = __esm({
3249
3249
  title: "Customer patch triage \u2014 upstream bug vs customization",
3250
3250
  domain: "support",
3251
3251
  priority: "p0",
3252
- content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
3252
+ content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, run `exe-os support test` and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
3253
3253
  },
3254
3254
  // --- Operations ---
3255
3255
  {
@@ -3331,7 +3331,7 @@ var init_platform_procedures = __esm({
3331
3331
  title: "MCP tools \u2014 identity, behavior, and decisions",
3332
3332
  domain: "tool-use",
3333
3333
  priority: "p1",
3334
- content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only."
3334
+ content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only. If a customer-side agent cannot send upstream, run `exe-os support test` from the terminal to verify local file write, license auth, support endpoint health, and upstream POST."
3335
3335
  },
3336
3336
  {
3337
3337
  title: "MCP tools \u2014 communication and messaging",
@@ -313,7 +313,7 @@ var init_platform_procedures = __esm({
313
313
  title: "Customer patch triage \u2014 upstream bug vs customization",
314
314
  domain: "support",
315
315
  priority: "p0",
316
- content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
316
+ content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, run `exe-os support test` and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
317
317
  },
318
318
  // --- Operations ---
319
319
  {
@@ -395,7 +395,7 @@ var init_platform_procedures = __esm({
395
395
  title: "MCP tools \u2014 identity, behavior, and decisions",
396
396
  domain: "tool-use",
397
397
  priority: "p1",
398
- content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only."
398
+ content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only. If a customer-side agent cannot send upstream, run `exe-os support test` from the terminal to verify local file write, license auth, support endpoint health, and upstream POST."
399
399
  },
400
400
  {
401
401
  title: "MCP tools \u2014 communication and messaging",
@@ -6518,7 +6518,7 @@ var init_platform_procedures = __esm({
6518
6518
  title: "Customer patch triage \u2014 upstream bug vs customization",
6519
6519
  domain: "support",
6520
6520
  priority: "p0",
6521
- content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
6521
+ content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, run `exe-os support test` and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
6522
6522
  },
6523
6523
  // --- Operations ---
6524
6524
  {
@@ -6600,7 +6600,7 @@ var init_platform_procedures = __esm({
6600
6600
  title: "MCP tools \u2014 identity, behavior, and decisions",
6601
6601
  domain: "tool-use",
6602
6602
  priority: "p1",
6603
- content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only."
6603
+ content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only. If a customer-side agent cannot send upstream, run `exe-os support test` from the terminal to verify local file write, license auth, support endpoint health, and upstream POST."
6604
6604
  },
6605
6605
  {
6606
6606
  title: "MCP tools \u2014 communication and messaging",
@@ -7900,7 +7900,7 @@ var init_platform_procedures = __esm({
7900
7900
  title: "Customer patch triage \u2014 upstream bug vs customization",
7901
7901
  domain: "support",
7902
7902
  priority: "p0",
7903
- content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
7903
+ content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, run `exe-os support test` and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
7904
7904
  },
7905
7905
  // --- Operations ---
7906
7906
  {
@@ -7982,7 +7982,7 @@ var init_platform_procedures = __esm({
7982
7982
  title: "MCP tools \u2014 identity, behavior, and decisions",
7983
7983
  domain: "tool-use",
7984
7984
  priority: "p1",
7985
- content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only."
7985
+ content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only. If a customer-side agent cannot send upstream, run `exe-os support test` from the terminal to verify local file write, license auth, support endpoint health, and upstream POST."
7986
7986
  },
7987
7987
  {
7988
7988
  title: "MCP tools \u2014 communication and messaging",
@@ -4454,7 +4454,7 @@ var init_platform_procedures = __esm({
4454
4454
  title: "Customer patch triage \u2014 upstream bug vs customization",
4455
4455
  domain: "support",
4456
4456
  priority: "p0",
4457
- content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4457
+ content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, run `exe-os support test` and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4458
4458
  },
4459
4459
  // --- Operations ---
4460
4460
  {
@@ -4536,7 +4536,7 @@ var init_platform_procedures = __esm({
4536
4536
  title: "MCP tools \u2014 identity, behavior, and decisions",
4537
4537
  domain: "tool-use",
4538
4538
  priority: "p1",
4539
- content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only."
4539
+ content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only. If a customer-side agent cannot send upstream, run `exe-os support test` from the terminal to verify local file write, license auth, support endpoint health, and upstream POST."
4540
4540
  },
4541
4541
  {
4542
4542
  title: "MCP tools \u2014 communication and messaging",
@@ -4210,7 +4210,7 @@ var init_platform_procedures = __esm({
4210
4210
  title: "Customer patch triage \u2014 upstream bug vs customization",
4211
4211
  domain: "support",
4212
4212
  priority: "p0",
4213
- content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4213
+ content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, run `exe-os support test` and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4214
4214
  },
4215
4215
  // --- Operations ---
4216
4216
  {
@@ -4292,7 +4292,7 @@ var init_platform_procedures = __esm({
4292
4292
  title: "MCP tools \u2014 identity, behavior, and decisions",
4293
4293
  domain: "tool-use",
4294
4294
  priority: "p1",
4295
- content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only."
4295
+ content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only. If a customer-side agent cannot send upstream, run `exe-os support test` from the terminal to verify local file write, license auth, support endpoint health, and upstream POST."
4296
4296
  },
4297
4297
  {
4298
4298
  title: "MCP tools \u2014 communication and messaging",
@@ -4134,7 +4134,7 @@ var init_platform_procedures = __esm({
4134
4134
  title: "Customer patch triage \u2014 upstream bug vs customization",
4135
4135
  domain: "support",
4136
4136
  priority: "p0",
4137
- content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4137
+ content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, run `exe-os support test` and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4138
4138
  },
4139
4139
  // --- Operations ---
4140
4140
  {
@@ -4216,7 +4216,7 @@ var init_platform_procedures = __esm({
4216
4216
  title: "MCP tools \u2014 identity, behavior, and decisions",
4217
4217
  domain: "tool-use",
4218
4218
  priority: "p1",
4219
- content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only."
4219
+ content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only. If a customer-side agent cannot send upstream, run `exe-os support test` from the terminal to verify local file write, license auth, support endpoint health, and upstream POST."
4220
4220
  },
4221
4221
  {
4222
4222
  title: "MCP tools \u2014 communication and messaging",
@@ -4803,7 +4803,7 @@ var init_platform_procedures = __esm({
4803
4803
  title: "Customer patch triage \u2014 upstream bug vs customization",
4804
4804
  domain: "support",
4805
4805
  priority: "p0",
4806
- content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4806
+ content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, run `exe-os support test` and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4807
4807
  },
4808
4808
  // --- Operations ---
4809
4809
  {
@@ -4885,7 +4885,7 @@ var init_platform_procedures = __esm({
4885
4885
  title: "MCP tools \u2014 identity, behavior, and decisions",
4886
4886
  domain: "tool-use",
4887
4887
  priority: "p1",
4888
- content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only."
4888
+ content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only. If a customer-side agent cannot send upstream, run `exe-os support test` from the terminal to verify local file write, license auth, support endpoint health, and upstream POST."
4889
4889
  },
4890
4890
  {
4891
4891
  title: "MCP tools \u2014 communication and messaging",
@@ -13525,8 +13525,8 @@ import { pathToFileURL } from "url";
13525
13525
  var DEFAULT_LIMIT = 20;
13526
13526
  var MAX_LIMIT = 100;
13527
13527
  var DEFAULT_SCOPE = "all";
13528
- var ALL_SCOPES = ["raw", "wiki", "memory", "gateway", "all"];
13529
- var SCOPE_ORDER = ["raw", "memory", "wiki", "gateway"];
13528
+ var ALL_SCOPES = ["raw", "crm", "wiki", "memory", "gateway", "all"];
13529
+ var SCOPE_ORDER = ["raw", "crm", "memory", "wiki", "gateway"];
13530
13530
  var UNKNOWN_TIMESTAMP = (/* @__PURE__ */ new Date(0)).toISOString();
13531
13531
  var prismaPromise = null;
13532
13532
  function loadPrisma() {
@@ -13557,8 +13557,8 @@ var QueryValidationError = class extends Error {
13557
13557
  }
13558
13558
  };
13559
13559
  var QueryHandler = class {
13560
- constructor(getPrisma = loadPrisma) {
13561
- this.getPrisma = getPrisma;
13560
+ constructor(getPrismaFn = loadPrisma) {
13561
+ this.getPrismaFn = getPrismaFn;
13562
13562
  }
13563
13563
  parseParams(input) {
13564
13564
  const url = typeof input === "string" ? new URL(input, "http://localhost") : input;
@@ -13577,22 +13577,60 @@ var QueryHandler = class {
13577
13577
  return { q, scope, source, limit };
13578
13578
  }
13579
13579
  async query(params) {
13580
- const prisma = await this.getPrisma();
13580
+ const prisma = await this.getPrismaFn();
13581
13581
  const scopes = params.scope === "all" ? SCOPE_ORDER : [params.scope];
13582
13582
  const searchTerm = `%${params.q}%`;
13583
- const results = (await Promise.all(
13584
- scopes.map((scope) => this.queryScope(prisma, scope, searchTerm, params))
13585
- )).flat();
13583
+ const settled = await Promise.all(
13584
+ scopes.map(async (scope) => {
13585
+ try {
13586
+ return { scope, results: await this.queryScope(prisma, scope, searchTerm, params) };
13587
+ } catch (err) {
13588
+ return {
13589
+ scope,
13590
+ results: [],
13591
+ warning: { scope, error: err instanceof Error ? err.message : String(err) }
13592
+ };
13593
+ }
13594
+ })
13595
+ );
13596
+ const results = settled.flatMap((entry) => entry.results);
13597
+ const warnings = settled.flatMap((entry) => entry.warning ? [entry.warning] : []);
13586
13598
  return {
13587
13599
  results,
13588
13600
  count: results.length,
13589
- scopes_searched: scopes
13601
+ scopes_searched: scopes,
13602
+ ...warnings.length ? { warnings } : {}
13603
+ };
13604
+ }
13605
+ async listSources() {
13606
+ const prisma = await this.getPrismaFn();
13607
+ const settled = await Promise.all(
13608
+ SCOPE_ORDER.map(async (scope) => {
13609
+ try {
13610
+ return { scope, sources: await this.listSourcesForScope(prisma, scope) };
13611
+ } catch (err) {
13612
+ return {
13613
+ scope,
13614
+ sources: [],
13615
+ warning: { scope, error: err instanceof Error ? err.message : String(err) }
13616
+ };
13617
+ }
13618
+ })
13619
+ );
13620
+ const sources = settled.flatMap((entry) => entry.sources);
13621
+ const warnings = settled.flatMap((entry) => entry.warning ? [entry.warning] : []);
13622
+ return {
13623
+ sources,
13624
+ count: sources.length,
13625
+ ...warnings.length ? { warnings } : {}
13590
13626
  };
13591
13627
  }
13592
13628
  async queryScope(prisma, scope, searchTerm, params) {
13593
13629
  switch (scope) {
13594
13630
  case "raw":
13595
13631
  return this.queryRaw(prisma, searchTerm, params.source, params.limit);
13632
+ case "crm":
13633
+ return this.queryCrm(prisma, searchTerm, params.limit);
13596
13634
  case "memory":
13597
13635
  return this.queryMemory(prisma, searchTerm, params.limit);
13598
13636
  case "wiki":
@@ -13601,6 +13639,46 @@ var QueryHandler = class {
13601
13639
  return this.queryGateway(prisma, searchTerm, params.limit);
13602
13640
  }
13603
13641
  }
13642
+ async listSourcesForScope(prisma, scope) {
13643
+ switch (scope) {
13644
+ case "raw":
13645
+ return (await prisma.$queryRawUnsafe(
13646
+ `SELECT 'raw' as scope, "source", COUNT(*) as count, MAX("timestamp") as latest_timestamp
13647
+ FROM "raw"."raw_events"
13648
+ GROUP BY "source"
13649
+ ORDER BY count DESC`
13650
+ )).map(mapSourceRow);
13651
+ case "crm":
13652
+ return this.listCrmSources(prisma);
13653
+ case "memory":
13654
+ return (await prisma.$queryRawUnsafe(
13655
+ `SELECT 'memory' as scope, COALESCE("project_name", "agent_id", 'unknown') as source,
13656
+ COUNT(*) as count, MAX("timestamp") as latest_timestamp
13657
+ FROM "memory"."memory_records"
13658
+ WHERE "status" = 'active'
13659
+ GROUP BY COALESCE("project_name", "agent_id", 'unknown')
13660
+ ORDER BY count DESC`
13661
+ )).map(mapSourceRow);
13662
+ case "wiki":
13663
+ return (await prisma.$queryRawUnsafe(
13664
+ `SELECT 'wiki' as scope, w."name" as source, COUNT(*) as count, NULL as latest_timestamp
13665
+ FROM "wiki"."workspace_documents" d
13666
+ JOIN "wiki"."workspaces" w ON w."id" = d."workspace_id"
13667
+ GROUP BY w."name"
13668
+ ORDER BY count DESC`
13669
+ )).map(mapSourceRow);
13670
+ case "gateway":
13671
+ return (await prisma.$queryRawUnsafe(
13672
+ `SELECT 'gateway' as scope, COALESCE(c."platform", 'unknown') as source,
13673
+ COUNT(*) as count, MAX(m."timestamp") as latest_timestamp
13674
+ FROM "gateway"."messages" m
13675
+ JOIN "gateway"."threads" t ON t."id" = m."thread_id"
13676
+ JOIN "gateway"."contacts" c ON c."id" = t."contact_id"
13677
+ GROUP BY COALESCE(c."platform", 'unknown')
13678
+ ORDER BY count DESC`
13679
+ )).map(mapSourceRow);
13680
+ }
13681
+ }
13604
13682
  async queryRaw(prisma, searchTerm, source, limit) {
13605
13683
  const rows = await prisma.$queryRawUnsafe(
13606
13684
  `SELECT "id", "source", "event_type", substring("payload"::text, 1, 200) as snippet, "timestamp"
@@ -13648,6 +13726,52 @@ var QueryHandler = class {
13648
13726
  }
13649
13727
  }));
13650
13728
  }
13729
+ async queryCrm(prisma, searchTerm, limit) {
13730
+ const rows = await prisma.$queryRawUnsafe(
13731
+ `WITH crm_rows AS (
13732
+ SELECT 'people' as table_name,
13733
+ to_jsonb(p)->>'id' as id,
13734
+ substring(to_jsonb(p)::text, 1, 200) as snippet,
13735
+ COALESCE((to_jsonb(p)->>'updated_at')::timestamptz, (to_jsonb(p)->>'created_at')::timestamptz) as timestamp
13736
+ FROM "crm"."people" p
13737
+ WHERE to_jsonb(p)::text ILIKE $1
13738
+ UNION ALL
13739
+ SELECT 'companies' as table_name,
13740
+ to_jsonb(c)->>'id' as id,
13741
+ substring(to_jsonb(c)::text, 1, 200) as snippet,
13742
+ COALESCE((to_jsonb(c)->>'updated_at')::timestamptz, (to_jsonb(c)->>'created_at')::timestamptz) as timestamp
13743
+ FROM "crm"."companies" c
13744
+ WHERE to_jsonb(c)::text ILIKE $1
13745
+ )
13746
+ SELECT * FROM crm_rows
13747
+ ORDER BY timestamp DESC NULLS LAST
13748
+ LIMIT $2`,
13749
+ searchTerm,
13750
+ limit
13751
+ );
13752
+ return rows.map((row) => ({
13753
+ scope: "crm",
13754
+ type: "crm_record",
13755
+ snippet: sanitizeSnippet(row.snippet),
13756
+ timestamp: toIsoTimestamp(row.timestamp),
13757
+ metadata: {
13758
+ id: row.id,
13759
+ table: row.table_name
13760
+ }
13761
+ }));
13762
+ }
13763
+ async listCrmSources(prisma) {
13764
+ const rows = await prisma.$queryRawUnsafe(
13765
+ `SELECT 'crm' as scope, 'people' as source, COUNT(*) as count,
13766
+ MAX(COALESCE((to_jsonb(p)->>'updated_at')::timestamptz, (to_jsonb(p)->>'created_at')::timestamptz)) as latest_timestamp
13767
+ FROM "crm"."people" p
13768
+ UNION ALL
13769
+ SELECT 'crm' as scope, 'companies' as source, COUNT(*) as count,
13770
+ MAX(COALESCE((to_jsonb(c)->>'updated_at')::timestamptz, (to_jsonb(c)->>'created_at')::timestamptz)) as latest_timestamp
13771
+ FROM "crm"."companies" c`
13772
+ );
13773
+ return rows.map(mapSourceRow);
13774
+ }
13651
13775
  async queryWiki(prisma, searchTerm, limit) {
13652
13776
  const rows = await prisma.$queryRawUnsafe(
13653
13777
  `SELECT d."doc_id", d."filename", d."docpath", w."name" as workspace_name
@@ -13697,6 +13821,14 @@ var QueryHandler = class {
13697
13821
  }));
13698
13822
  }
13699
13823
  };
13824
+ function mapSourceRow(row) {
13825
+ return {
13826
+ scope: row.scope,
13827
+ source: row.source,
13828
+ count: Number(row.count),
13829
+ ...row.latest_timestamp ? { latest_timestamp: toIsoTimestamp(row.latest_timestamp) } : {}
13830
+ };
13831
+ }
13700
13832
  function sanitizeSnippet(value) {
13701
13833
  return String(value ?? "").slice(0, 200);
13702
13834
  }
@@ -13792,7 +13924,7 @@ var WebhookServer = class {
13792
13924
  });
13793
13925
  }
13794
13926
  async handleQuery(req, res) {
13795
- if (this.config.authToken && !this.verifyAuth(req)) {
13927
+ if ((this.config.authToken || this.config.queryAuthToken) && !this.verifyQueryAuth(req)) {
13796
13928
  sendJson(res, 401, { error: "Unauthorized" });
13797
13929
  return;
13798
13930
  }
@@ -13801,8 +13933,7 @@ var WebhookServer = class {
13801
13933
  req.url ?? "/query",
13802
13934
  `http://${req.headers.host ?? "localhost"}`
13803
13935
  );
13804
- const params = this.queryHandler.parseParams(url);
13805
- const result = await this.queryHandler.query(params);
13936
+ const result = url.pathname === "/query/sources" ? await this.queryHandler.listSources() : await this.queryHandler.query(this.queryHandler.parseParams(url));
13806
13937
  sendJson(res, 200, result);
13807
13938
  } catch (err) {
13808
13939
  if (err instanceof QueryValidationError) {
@@ -13869,8 +14000,19 @@ var WebhookServer = class {
13869
14000
  }
13870
14001
  }
13871
14002
  verifyAuth(req) {
14003
+ return this.verifyToken(req, this.config.authToken);
14004
+ }
14005
+ verifyQueryAuth(req) {
14006
+ return [this.config.queryAuthToken, this.config.authToken].some(
14007
+ (token) => this.verifyToken(req, token)
14008
+ );
14009
+ }
14010
+ verifyToken(req, expectedToken) {
14011
+ if (!expectedToken) return false;
13872
14012
  const authHeader = req.headers.authorization ?? "";
13873
- return authHeader === `Bearer ${this.config.authToken}`;
14013
+ if (authHeader === `Bearer ${expectedToken}`) return true;
14014
+ const url = new URL(req.url ?? "/", `http://${req.headers.host ?? "localhost"}`);
14015
+ return url.searchParams.get("token") === expectedToken;
13874
14016
  }
13875
14017
  };
13876
14018
  function extractPlatform(url) {
@@ -13878,7 +14020,7 @@ function extractPlatform(url) {
13878
14020
  return match?.[1] ?? null;
13879
14021
  }
13880
14022
  function isRoute(url, path25) {
13881
- return url === path25 || url.startsWith(`${path25}?`);
14023
+ return url === path25 || url.startsWith(`${path25}?`) || url.startsWith(`${path25}/`);
13882
14024
  }
13883
14025
  function readBody(req) {
13884
14026
  return new Promise((resolve, reject) => {
@@ -4173,7 +4173,7 @@ var init_platform_procedures = __esm({
4173
4173
  title: "Customer patch triage \u2014 upstream bug vs customization",
4174
4174
  domain: "support",
4175
4175
  priority: "p0",
4176
- content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4176
+ content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, run `exe-os support test` and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4177
4177
  },
4178
4178
  // --- Operations ---
4179
4179
  {
@@ -4255,7 +4255,7 @@ var init_platform_procedures = __esm({
4255
4255
  title: "MCP tools \u2014 identity, behavior, and decisions",
4256
4256
  domain: "tool-use",
4257
4257
  priority: "p1",
4258
- content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only."
4258
+ content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only. If a customer-side agent cannot send upstream, run `exe-os support test` from the terminal to verify local file write, license auth, support endpoint health, and upstream POST."
4259
4259
  },
4260
4260
  {
4261
4261
  title: "MCP tools \u2014 communication and messaging",
@@ -4134,7 +4134,7 @@ var init_platform_procedures = __esm({
4134
4134
  title: "Customer patch triage \u2014 upstream bug vs customization",
4135
4135
  domain: "support",
4136
4136
  priority: "p0",
4137
- content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4137
+ content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, run `exe-os support test` and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4138
4138
  },
4139
4139
  // --- Operations ---
4140
4140
  {
@@ -4216,7 +4216,7 @@ var init_platform_procedures = __esm({
4216
4216
  title: "MCP tools \u2014 identity, behavior, and decisions",
4217
4217
  domain: "tool-use",
4218
4218
  priority: "p1",
4219
- content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only."
4219
+ content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only. If a customer-side agent cannot send upstream, run `exe-os support test` from the terminal to verify local file write, license auth, support endpoint health, and upstream POST."
4220
4220
  },
4221
4221
  {
4222
4222
  title: "MCP tools \u2014 communication and messaging",
@@ -4232,7 +4232,7 @@ var init_platform_procedures = __esm({
4232
4232
  title: "Customer patch triage \u2014 upstream bug vs customization",
4233
4233
  domain: "support",
4234
4234
  priority: "p0",
4235
- content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4235
+ content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, run `exe-os support test` and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4236
4236
  },
4237
4237
  // --- Operations ---
4238
4238
  {
@@ -4314,7 +4314,7 @@ var init_platform_procedures = __esm({
4314
4314
  title: "MCP tools \u2014 identity, behavior, and decisions",
4315
4315
  domain: "tool-use",
4316
4316
  priority: "p1",
4317
- content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only."
4317
+ content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only. If a customer-side agent cannot send upstream, run `exe-os support test` from the terminal to verify local file write, license auth, support endpoint health, and upstream POST."
4318
4318
  },
4319
4319
  {
4320
4320
  title: "MCP tools \u2014 communication and messaging",