@rubytech/create-maxy-code 0.1.470 → 0.1.471
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/payload/platform/config/brand.json +1 -1
- package/payload/platform/docs/superpowers/plans/2026-07-18-graph-native-ledger.md +807 -0
- package/payload/platform/docs/superpowers/specs/2026-07-18-graph-native-ledger-design.md +241 -0
- package/payload/platform/lib/ledger-core/dist/ageing.d.ts +14 -0
- package/payload/platform/lib/ledger-core/dist/ageing.d.ts.map +1 -0
- package/payload/platform/lib/ledger-core/dist/ageing.js +38 -0
- package/payload/platform/lib/ledger-core/dist/ageing.js.map +1 -0
- package/payload/platform/lib/ledger-core/dist/balance.d.ts +25 -0
- package/payload/platform/lib/ledger-core/dist/balance.d.ts.map +1 -0
- package/payload/platform/lib/ledger-core/dist/balance.js +38 -0
- package/payload/platform/lib/ledger-core/dist/balance.js.map +1 -0
- package/payload/platform/lib/ledger-core/dist/index.d.ts +5 -0
- package/payload/platform/lib/ledger-core/dist/index.d.ts.map +1 -0
- package/payload/platform/lib/ledger-core/dist/index.js +5 -0
- package/payload/platform/lib/ledger-core/dist/index.js.map +1 -0
- package/payload/platform/lib/ledger-core/dist/money.d.ts +12 -0
- package/payload/platform/lib/ledger-core/dist/money.d.ts.map +1 -0
- package/payload/platform/lib/ledger-core/dist/money.js +16 -0
- package/payload/platform/lib/ledger-core/dist/money.js.map +1 -0
- package/payload/platform/lib/ledger-core/dist/reconcile.d.ts +51 -0
- package/payload/platform/lib/ledger-core/dist/reconcile.d.ts.map +1 -0
- package/payload/platform/lib/ledger-core/dist/reconcile.js +77 -0
- package/payload/platform/lib/ledger-core/dist/reconcile.js.map +1 -0
- package/payload/platform/lib/ledger-core/package.json +16 -0
- package/payload/platform/lib/ledger-core/src/__tests__/ageing.test.ts +42 -0
- package/payload/platform/lib/ledger-core/src/__tests__/balance.test.ts +48 -0
- package/payload/platform/lib/ledger-core/src/__tests__/reconcile.test.ts +87 -0
- package/payload/platform/lib/ledger-core/src/ageing.ts +51 -0
- package/payload/platform/lib/ledger-core/src/balance.ts +52 -0
- package/payload/platform/lib/ledger-core/src/index.ts +4 -0
- package/payload/platform/lib/ledger-core/src/money.ts +17 -0
- package/payload/platform/lib/ledger-core/src/reconcile.ts +109 -0
- package/payload/platform/lib/ledger-core/tsconfig.json +6 -0
- package/payload/platform/neo4j/schema.cypher +16 -0
- package/payload/platform/package.json +2 -2
- package/payload/platform/plugins/.claude-plugin/marketplace.json +5 -0
- package/payload/platform/plugins/admin/hooks/lib/maxy-mcp-plugins.txt +1 -0
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +98 -2
- package/payload/platform/plugins/cloudflare/bin/__tests__/portal-brand-css.test.sh +139 -0
- package/payload/platform/plugins/cloudflare/bin/portal-brand-css.mjs +128 -0
- package/payload/platform/plugins/cloudflare/mcp/__tests__/portal-enrol.test.ts +1 -1
- package/payload/platform/plugins/cloudflare/mcp/__tests__/skill-contract.test.ts +25 -0
- package/payload/platform/plugins/cloudflare/mcp/__tests__/template-config.test.ts +55 -3
- package/payload/platform/plugins/cloudflare/skills/data-portal/SKILL.md +38 -3
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/{public/portal.css → portal.css} +13 -2
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/wrangler.toml +1 -1
- package/payload/platform/plugins/docs/references/admin-ui.md +48 -0
- package/payload/platform/plugins/docs/references/internals.md +1 -1
- package/payload/platform/plugins/docs/references/ledger.md +43 -0
- package/payload/platform/plugins/email/PLUGIN.md +4 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/display-truncation.test.d.ts +2 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/display-truncation.test.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/display-truncation.test.js +196 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/display-truncation.test.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/source-fetch-efficiency.test.js +10 -8
- package/payload/platform/plugins/email/mcp/dist/__tests__/source-fetch-efficiency.test.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/__tests__/truncation-tool-output.test.d.ts +2 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/truncation-tool-output.test.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/truncation-tool-output.test.js +110 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/truncation-tool-output.test.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/lib/imap.d.ts +22 -0
- package/payload/platform/plugins/email/mcp/dist/lib/imap.d.ts.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/imap.js +90 -36
- package/payload/platform/plugins/email/mcp/dist/lib/imap.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-read.d.ts.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-read.js +6 -2
- package/payload/platform/plugins/email/mcp/dist/tools/email-read.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-search.d.ts.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-search.js +6 -2
- package/payload/platform/plugins/email/mcp/dist/tools/email-search.js.map +1 -1
- package/payload/platform/plugins/email/skills/email-ingest/SKILL.md +4 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/account-register.test.d.ts +2 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/account-register.test.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/account-register.test.js +60 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/account-register.test.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/calendar-tools.test.d.ts +2 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/calendar-tools.test.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/calendar-tools.test.js +48 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/calendar-tools.test.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/google-client.test.d.ts +2 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/google-client.test.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/google-client.test.js +25 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/google-client.test.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/index-registration.test.d.ts +2 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/index-registration.test.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/index-registration.test.js +40 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/index-registration.test.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/pending-store.test.d.ts +2 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/pending-store.test.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/pending-store.test.js +35 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/pending-store.test.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/token-store.test.d.ts +2 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/token-store.test.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/token-store.test.js +85 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/token-store.test.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/auth/pending-store.d.ts +25 -0
- package/payload/platform/plugins/google/mcp/dist/auth/pending-store.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/auth/pending-store.js +87 -0
- package/payload/platform/plugins/google/mcp/dist/auth/pending-store.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/auth/token-store.d.ts +46 -0
- package/payload/platform/plugins/google/mcp/dist/auth/token-store.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/auth/token-store.js +138 -0
- package/payload/platform/plugins/google/mcp/dist/auth/token-store.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/index.d.ts +25 -0
- package/payload/platform/plugins/google/mcp/dist/index.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/index.js +300 -0
- package/payload/platform/plugins/google/mcp/dist/index.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/lib/google-client.d.ts +28 -0
- package/payload/platform/plugins/google/mcp/dist/lib/google-client.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/lib/google-client.js +102 -0
- package/payload/platform/plugins/google/mcp/dist/lib/google-client.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/lib/log.d.ts +3 -0
- package/payload/platform/plugins/google/mcp/dist/lib/log.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/lib/log.js +16 -0
- package/payload/platform/plugins/google/mcp/dist/lib/log.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/account-info.d.ts +12 -0
- package/payload/platform/plugins/google/mcp/dist/tools/account-info.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/account-info.js +23 -0
- package/payload/platform/plugins/google/mcp/dist/tools/account-info.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/account-list.d.ts +12 -0
- package/payload/platform/plugins/google/mcp/dist/tools/account-list.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/account-list.js +9 -0
- package/payload/platform/plugins/google/mcp/dist/tools/account-list.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/account-register.d.ts +42 -0
- package/payload/platform/plugins/google/mcp/dist/tools/account-register.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/account-register.js +102 -0
- package/payload/platform/plugins/google/mcp/dist/tools/account-register.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-cancel.d.ts +10 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-cancel.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-cancel.js +9 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-cancel.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-create.d.ts +20 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-create.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-create.js +25 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-create.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-event.d.ts +6 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-event.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-event.js +7 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-event.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-freebusy.d.ts +14 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-freebusy.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-freebusy.js +16 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-freebusy.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-list.d.ts +44 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-list.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-list.js +36 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-list.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-respond.d.ts +16 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-respond.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-respond.js +29 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-respond.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-update.d.ts +16 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-update.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-update.js +32 -0
- package/payload/platform/plugins/google/mcp/dist/tools/calendar-update.js.map +1 -0
- package/payload/platform/plugins/google/references/auth.md +35 -0
- package/payload/platform/plugins/ledger/.claude-plugin/plugin.json +21 -0
- package/payload/platform/plugins/ledger/PLUGIN.md +82 -0
- package/payload/platform/plugins/ledger/lib/mcp-spawn-tee/index.js +193 -0
- package/payload/platform/plugins/ledger/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/platform/plugins/ledger/mcp/dist/index.d.ts +2 -0
- package/payload/platform/plugins/ledger/mcp/dist/index.d.ts.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/index.js +168 -0
- package/payload/platform/plugins/ledger/mcp/dist/index.js.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/lib/ids.d.ts +4 -0
- package/payload/platform/plugins/ledger/mcp/dist/lib/ids.d.ts.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/lib/ids.js +0 -0
- package/payload/platform/plugins/ledger/mcp/dist/lib/ids.js.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/lib/neo4j.d.ts +5 -0
- package/payload/platform/plugins/ledger/mcp/dist/lib/neo4j.d.ts.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/lib/neo4j.js +40 -0
- package/payload/platform/plugins/ledger/mcp/dist/lib/neo4j.js.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/lib/read.d.ts +29 -0
- package/payload/platform/plugins/ledger/mcp/dist/lib/read.d.ts.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/lib/read.js +138 -0
- package/payload/platform/plugins/ledger/mcp/dist/lib/read.js.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/lib/types.d.ts +47 -0
- package/payload/platform/plugins/ledger/mcp/dist/lib/types.d.ts.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/lib/types.js +14 -0
- package/payload/platform/plugins/ledger/mcp/dist/lib/types.js.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/balance.d.ts +18 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/balance.d.ts.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/balance.js +23 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/balance.js.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/cash-record.d.ts +26 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/cash-record.d.ts.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/cash-record.js +33 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/cash-record.js.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/invoice-record.d.ts +27 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/invoice-record.d.ts.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/invoice-record.js +40 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/invoice-record.js.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/payment-record.d.ts +46 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/payment-record.d.ts.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/payment-record.js +68 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/payment-record.js.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/reconcile.d.ts +20 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/reconcile.d.ts.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/reconcile.js +30 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/reconcile.js.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/statement.d.ts +26 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/statement.d.ts.map +1 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/statement.js +35 -0
- package/payload/platform/plugins/ledger/mcp/dist/tools/statement.js.map +1 -0
- package/payload/platform/plugins/ledger/mcp/package.json +21 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/ledger-vertical-coverage.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/ledger-vertical-coverage.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/ledger-vertical-coverage.test.js +81 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/ledger-vertical-coverage.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/schema-loader.d.ts +9 -7
- package/payload/platform/plugins/memory/mcp/dist/lib/schema-loader.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/schema-loader.js +10 -8
- package/payload/platform/plugins/memory/mcp/dist/lib/schema-loader.js.map +1 -1
- package/payload/platform/plugins/memory/references/schema-base.md +22 -0
- package/payload/platform/plugins/memory/references/schema-construction.md +0 -18
- package/payload/platform/plugins/scheduling/PLUGIN.md +20 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/meeting-write.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/meeting-write.js +11 -2
- package/payload/platform/plugins/scheduling/mcp/dist/lib/meeting-write.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-event.js +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-event.js.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.js +3 -3
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/activity-rows.d.ts +138 -0
- package/payload/platform/services/claude-session-manager/dist/activity-rows.d.ts.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/activity-rows.js +268 -0
- package/payload/platform/services/claude-session-manager/dist/activity-rows.js.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js +8 -0
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.d.ts +6 -0
- package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.js +42 -0
- package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/index.js +10 -1
- package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-census.d.ts +80 -6
- package/payload/platform/services/claude-session-manager/dist/pty-census.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-census.js +96 -20
- package/payload/platform/services/claude-session-manager/dist/pty-census.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/slice-memory-policy.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/slice-memory-policy.js +5 -1
- package/payload/platform/services/claude-session-manager/dist/slice-memory-policy.js.map +1 -1
- package/payload/platform/templates/specialists/agents/database-operator.md +1 -1
- package/payload/platform/templates/specialists/agents/project-manager.md +1 -1
- package/payload/server/{chunk-JRIBGO45.js → chunk-BSTIQX52.js} +44 -0
- package/payload/server/maxy-edge.js +1 -1
- package/payload/server/public/activity.html +17 -0
- package/payload/server/public/assets/AdminLoginScreens-Rf94VD9w.js +1 -0
- package/payload/server/public/assets/AdminShell-CyGKg7MG.js +2 -0
- package/payload/server/public/assets/Checkbox-B0jmI2y2.js +1 -0
- package/payload/server/public/assets/HeaderMenu-BnTYGNaB.js +9 -0
- package/payload/server/public/assets/{useSubAccountSwitcher-pu0jjLCz.css → HeaderMenu-DtIEBHOU.css} +1 -1
- package/payload/server/public/assets/activity-BOBTWFr-.js +1 -0
- package/payload/server/public/assets/admin-HDLzwbLl.js +1 -0
- package/payload/server/public/assets/{arc-qKfXIt8v.js → arc-CFMJyMm-.js} +1 -1
- package/payload/server/public/assets/architecture-YZFGNWBL-Cypt5qHL.js +1 -0
- package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-DkVrGn7G.js → architectureDiagram-Q4EWVU46-CmOpXLsH.js} +1 -1
- package/payload/server/public/assets/{blockDiagram-DXYQGD6D-DqavswGH.js → blockDiagram-DXYQGD6D-CmS8f9YF.js} +1 -1
- package/payload/server/public/assets/browser-D4_XLSSm.js +1 -0
- package/payload/server/public/assets/{c4Diagram-AHTNJAMY-B7fyKiXe.js → c4Diagram-AHTNJAMY-BXIjMl6A.js} +1 -1
- package/payload/server/public/assets/calendar-s5V_gbI7.js +1 -0
- package/payload/server/public/assets/channel-DhrFAm7m.js +1 -0
- package/payload/server/public/assets/chat-40WyKzGb.js +1 -0
- package/payload/server/public/assets/chevron-left-C35qGP5f.js +1 -0
- package/payload/server/public/assets/{chunk-2KRD3SAO-DsgMtGkv.js → chunk-2KRD3SAO-D4fktAwW.js} +1 -1
- package/payload/server/public/assets/{chunk-336JU56O-CkdISfNt.js → chunk-336JU56O-C2MKnRTj.js} +2 -2
- package/payload/server/public/assets/chunk-426QAEUC-BhU7-TyS.js +1 -0
- package/payload/server/public/assets/{chunk-4BX2VUAB-CYpiF2bl.js → chunk-4BX2VUAB-C13Wz3zS.js} +1 -1
- package/payload/server/public/assets/{chunk-4TB4RGXK-CWyc_F7v.js → chunk-4TB4RGXK-CalYahTR.js} +1 -1
- package/payload/server/public/assets/{chunk-55IACEB6-BbzKMw2Z.js → chunk-55IACEB6-TmOKdy8a.js} +1 -1
- package/payload/server/public/assets/{chunk-5FUZZQ4R-u19Nai9e.js → chunk-5FUZZQ4R-C-i0BVag.js} +1 -1
- package/payload/server/public/assets/{chunk-5PVQY5BW-Ba8by6Uy.js → chunk-5PVQY5BW-D6bJMLnf.js} +1 -1
- package/payload/server/public/assets/{chunk-67CJDMHE-BwUuxtyb.js → chunk-67CJDMHE-Cif9Uu5C.js} +1 -1
- package/payload/server/public/assets/{chunk-7N4EOEYR-BRH9iM9L.js → chunk-7N4EOEYR-WjTHCXnd.js} +1 -1
- package/payload/server/public/assets/{chunk-AA7GKIK3-BGoztgLL.js → chunk-AA7GKIK3-CwCfdQmb.js} +1 -1
- package/payload/server/public/assets/{chunk-BSJP7CBP-C5GDAZTl.js → chunk-BSJP7CBP-9A67yXwT.js} +1 -1
- package/payload/server/public/assets/{chunk-CIAEETIT-ChY32VPS.js → chunk-CIAEETIT-DPMiWSBi.js} +1 -1
- package/payload/server/public/assets/{chunk-EDXVE4YY-CPSD3p6p.js → chunk-EDXVE4YY-B9PBdwiT.js} +1 -1
- package/payload/server/public/assets/{chunk-ENJZ2VHE-D1oL-iUr.js → chunk-ENJZ2VHE-CM5OqcQ5.js} +1 -1
- package/payload/server/public/assets/{chunk-FMBD7UC4-CPvYEr54.js → chunk-FMBD7UC4-Bmt_ZRlV.js} +1 -1
- package/payload/server/public/assets/{chunk-FOC6F5B3-9Yyj7Vbz.js → chunk-FOC6F5B3-DfGJGxpX.js} +1 -1
- package/payload/server/public/assets/{chunk-ICPOFSXX-BaYgh8FR.js → chunk-ICPOFSXX-D6M89DA0.js} +2 -2
- package/payload/server/public/assets/{chunk-K5T4RW27-5ucpeRvm.js → chunk-K5T4RW27-DMpoaqw2.js} +1 -1
- package/payload/server/public/assets/{chunk-KGLVRYIC-DW-FHk7T.js → chunk-KGLVRYIC-DYUFgri2.js} +1 -1
- package/payload/server/public/assets/{chunk-LIHQZDEY-CGGVfAyG.js → chunk-LIHQZDEY-x3LmeKmx.js} +1 -1
- package/payload/server/public/assets/{chunk-ORNJ4GCN-Bv8EUa5d.js → chunk-ORNJ4GCN-BeuNAWkW.js} +1 -1
- package/payload/server/public/assets/{chunk-OYMX7WX6-C1mXJnyw.js → chunk-OYMX7WX6-Bv6gisQ6.js} +1 -1
- package/payload/server/public/assets/chunk-QZHKN3VN-7_kS3RBy.js +1 -0
- package/payload/server/public/assets/{chunk-U2HBQHQK-PwSQz6EP.js → chunk-U2HBQHQK-C2iT9Av2.js} +1 -1
- package/payload/server/public/assets/{chunk-X2U36JSP--NPHTBlU.js → chunk-X2U36JSP-Bd6bv87A.js} +1 -1
- package/payload/server/public/assets/{chunk-XPW4576I-Bbc7Da32.js → chunk-XPW4576I-ByFnN4JO.js} +1 -1
- package/payload/server/public/assets/{chunk-YZCP3GAM-D-9v8e--.js → chunk-YZCP3GAM-Bt8I6ZDb.js} +1 -1
- package/payload/server/public/assets/{chunk-ZZ45TVLE-CMPg670Q.js → chunk-ZZ45TVLE-DBMPgZ_A.js} +1 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-BrWqm88p.js +1 -0
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-D0wzG5Fd.js +1 -0
- package/payload/server/public/assets/clone-DQA-nNrl.js +1 -0
- package/payload/server/public/assets/{cose-bilkent-S5V4N54A-NVSb1Bhy.js → cose-bilkent-S5V4N54A-DgLEaApT.js} +1 -1
- package/payload/server/public/assets/{dagre-KV5264BT-V2Ai1DFl.js → dagre-KV5264BT-kWVPgmmL.js} +1 -1
- package/payload/server/public/assets/{dagre-QfLcO-1j.js → dagre-mSazqXgG.js} +1 -1
- package/payload/server/public/assets/data-Bq0vU3qJ.js +1 -0
- package/payload/server/public/assets/{diagram-5BDNPKRD-Caw21693.js → diagram-5BDNPKRD-BHe_omJD.js} +1 -1
- package/payload/server/public/assets/{diagram-G4DWMVQ6-CgwVkT2q.js → diagram-G4DWMVQ6-fUFsmM3x.js} +1 -1
- package/payload/server/public/assets/{diagram-MMDJMWI5-DFUrLZhs.js → diagram-MMDJMWI5-DmujPLlM.js} +1 -1
- package/payload/server/public/assets/{diagram-TYMM5635-CEEiEuZJ.js → diagram-TYMM5635-B7Aoas89.js} +1 -1
- package/payload/server/public/assets/{dist-Cvgxm7qv.js → dist-C9D_xz81.js} +1 -1
- package/payload/server/public/assets/{erDiagram-SMLLAGMA-CG10NrT3.js → erDiagram-SMLLAGMA-6hS1rGiO.js} +1 -1
- package/payload/server/public/assets/{flatten-DAO0sfCM.js → flatten-BXzaHgtL.js} +1 -1
- package/payload/server/public/assets/{flowDiagram-DWJPFMVM-BqkV9Okv.js → flowDiagram-DWJPFMVM-Bqhr_r5b.js} +1 -1
- package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-DRiCDQF6.js → ganttDiagram-T4ZO3ILL-B8kjyN4o.js} +1 -1
- package/payload/server/public/assets/gitGraph-7Q5UKJZL-C_-XjxLd.js +1 -0
- package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-BZV2voyy.js → gitGraphDiagram-UUTBAWPF--TTRq4ir.js} +1 -1
- package/payload/server/public/assets/{graph-BZiudUGr.js → graph-C252ZHjp.js} +3 -3
- package/payload/server/public/assets/graph-labels-DzPbbhLc.js +1 -0
- package/payload/server/public/assets/{graphlib-DGPThX8M.js → graphlib-CWkjawc5.js} +1 -1
- package/payload/server/public/assets/info-OMHHGYJF-BH8yDCfL.js +1 -0
- package/payload/server/public/assets/infoDiagram-42DDH7IO-D8U4M0pK.js +2 -0
- package/payload/server/public/assets/{isEmpty-Cb_U81C6.js → isEmpty-uB1dEu_Z.js} +1 -1
- package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-BKsAxSvp.js → ishikawaDiagram-UXIWVN3A-CR8B7VzM.js} +1 -1
- package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-CmliuOd-.js → journeyDiagram-VCZTEJTY-45lWAvtq.js} +1 -1
- package/payload/server/public/assets/{kanban-definition-6JOO6SKY-DAlElMb-.js → kanban-definition-6JOO6SKY-DkrPXLVb.js} +1 -1
- package/payload/server/public/assets/{line-DKZqLKAC.js → line-Db0H446a.js} +1 -1
- package/payload/server/public/assets/{linear-CbSGdh1x.js → linear-X3O7lwK3.js} +1 -1
- package/payload/server/public/assets/maximize-2-CEbXFpQT.js +1 -0
- package/payload/server/public/assets/{mermaid-parser.core-DFvbao9C.js → mermaid-parser.core-CixBHOya.js} +2 -2
- package/payload/server/public/assets/{mermaid.core-C0vEBxDm.js → mermaid.core-BGQq98L7.js} +3 -3
- package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-CShASUKd.js → mindmap-definition-QFDTVHPH-v9cJl1mj.js} +1 -1
- package/payload/server/public/assets/operator-zKk4HMdX.js +1 -0
- package/payload/server/public/assets/{ordinal-H0tVmBDP.js → ordinal-CZY9laxg.js} +1 -1
- package/payload/server/public/assets/packet-4T2RLAQJ-Bajcns4r.js +1 -0
- package/payload/server/public/assets/page-BrmN_vzV.js +1 -0
- package/payload/server/public/assets/page-Cts-ESBe.js +32 -0
- package/payload/server/public/assets/{pdf-render-jAQU0nXt.js → pdf-render-7HZBTZ0_.js} +1 -1
- package/payload/server/public/assets/pie-ZZUOXDRM-D7hjM5w1.js +1 -0
- package/payload/server/public/assets/{pieDiagram-DEJITSTG-CBZHpDAJ.js → pieDiagram-DEJITSTG-DQ0b6edX.js} +1 -1
- package/payload/server/public/assets/public-BItzHBc0.js +1 -0
- package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-n3bB3K91.js → quadrantDiagram-34T5L4WZ-B64mj7Ei.js} +1 -1
- package/payload/server/public/assets/radar-PYXPWWZC-B46d5x7a.js +1 -0
- package/payload/server/public/assets/{reduce-DAvwat-a.js → reduce-BGQzAenn.js} +1 -1
- package/payload/server/public/assets/{requirementDiagram-MS252O5E-DiDvQK3c.js → requirementDiagram-MS252O5E-CE2JIEWo.js} +1 -1
- package/payload/server/public/assets/rotate-ccw-B0EYGhGx.js +1 -0
- package/payload/server/public/assets/{sankeyDiagram-XADWPNL6-DWDQQZmd.js → sankeyDiagram-XADWPNL6-Cmt5cfCz.js} +1 -1
- package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-DmAqRlBT.js → sequenceDiagram-FGHM5R23-B5vVn_sw.js} +1 -1
- package/payload/server/public/assets/{src-DV4LKv2E.js → src-BTKk8KAG.js} +1 -1
- package/payload/server/public/assets/{stateDiagram-FHFEXIEX-D4R-n6bZ.js → stateDiagram-FHFEXIEX-DiUEJ-RZ.js} +1 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-DIm3XuAD.js +1 -0
- package/payload/server/public/assets/tasks-ClE8-be8.js +1 -0
- package/payload/server/public/assets/time-entry-format-BwjGLnXu.js +1 -0
- package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-CjiHGP4l.js → timeline-definition-GMOUNBTQ-C9jprDVw.js} +1 -1
- package/payload/server/public/assets/treeView-SZITEDCU-3XQh5xQ1.js +1 -0
- package/payload/server/public/assets/treemap-W4RFUUIX-DwR-_l5z.js +1 -0
- package/payload/server/public/assets/triangle-alert-DejWYn1x.js +1 -0
- package/payload/server/public/assets/useCopyFeedback-CpSgOavK.js +1 -0
- package/payload/server/public/assets/useSelectionMode-ZQZQUgze.js +1 -0
- package/payload/server/public/assets/useSubAccountSwitcher-DuRLvCfO.js +1 -0
- package/payload/server/public/assets/useVoiceRecorder-BTYYeUJW.js +2 -0
- package/payload/server/public/assets/{vennDiagram-DHZGUBPP-CBdDQ7c-.js → vennDiagram-DHZGUBPP-DWqQJ9X0.js} +1 -1
- package/payload/server/public/assets/wardley-RL74JXVD-DZp9oCGv.js +1 -0
- package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-BlIQPKLb.js → wardleyDiagram-NUSXRM2D-Dg6c2Voh.js} +1 -1
- package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-CslKgh9B.js → xychartDiagram-5P7HB3ND-EhN-zeDj.js} +1 -1
- package/payload/server/public/browser.html +7 -6
- package/payload/server/public/calendar.html +8 -7
- package/payload/server/public/chat.html +15 -14
- package/payload/server/public/data.html +14 -12
- package/payload/server/public/graph.html +13 -12
- package/payload/server/public/index.html +17 -15
- package/payload/server/public/operator.html +17 -16
- package/payload/server/public/public.html +15 -14
- package/payload/server/public/tasks.html +7 -6
- package/payload/server/server.js +525 -244
- package/payload/server/public/assets/AdminLoginScreens-Bed8SDxY.js +0 -1
- package/payload/server/public/assets/AdminShell-BLh9O6dn.js +0 -2
- package/payload/server/public/assets/Checkbox-BC_KSbpS.js +0 -1
- package/payload/server/public/assets/admin-DfWgJVI3.js +0 -1
- package/payload/server/public/assets/architecture-YZFGNWBL-FPHT7s-C.js +0 -1
- package/payload/server/public/assets/browser-C0vkv-hH.js +0 -1
- package/payload/server/public/assets/calendar-_pfHw0Hp.js +0 -1
- package/payload/server/public/assets/channel-j70eMvcL.js +0 -1
- package/payload/server/public/assets/chat-DYT5H81o.js +0 -1
- package/payload/server/public/assets/chevron-left-BnpVBu51.js +0 -1
- package/payload/server/public/assets/chunk-426QAEUC-D-NcAlTW.js +0 -1
- package/payload/server/public/assets/chunk-QZHKN3VN-CAwbQBtf.js +0 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-Ct6Rn0vt.js +0 -1
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-B_2XCIFv.js +0 -1
- package/payload/server/public/assets/clone-DjPWA_NH.js +0 -1
- package/payload/server/public/assets/data-CR-fbPWr.js +0 -1
- package/payload/server/public/assets/gitGraph-7Q5UKJZL-B8Hx7f-D.js +0 -1
- package/payload/server/public/assets/graph-labels-BzmmJwCR.js +0 -1
- package/payload/server/public/assets/info-OMHHGYJF-BicCJTqU.js +0 -1
- package/payload/server/public/assets/infoDiagram-42DDH7IO-tf-8rOez.js +0 -2
- package/payload/server/public/assets/maximize-2-Bhdsv0U-.js +0 -1
- package/payload/server/public/assets/operator-gm2eP4r6.js +0 -1
- package/payload/server/public/assets/packet-4T2RLAQJ-Ckn_5hq0.js +0 -1
- package/payload/server/public/assets/page-8AB3jUa_.js +0 -1
- package/payload/server/public/assets/page-BoPorLg-.js +0 -32
- package/payload/server/public/assets/pie-ZZUOXDRM-DzlGQW3J.js +0 -1
- package/payload/server/public/assets/public-DqJk6qgW.js +0 -1
- package/payload/server/public/assets/radar-PYXPWWZC-BHo2YD8b.js +0 -1
- package/payload/server/public/assets/rotate-ccw-D_5cETGt.js +0 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-BcFRbGRu.js +0 -1
- package/payload/server/public/assets/tasks-EyKLXINi.js +0 -1
- package/payload/server/public/assets/time-entry-format-DAwmmR3i.js +0 -1
- package/payload/server/public/assets/treeView-SZITEDCU-BtRr5vXp.js +0 -1
- package/payload/server/public/assets/treemap-W4RFUUIX-D8p0sbyo.js +0 -1
- package/payload/server/public/assets/useCopyFeedback-rOWd_lzl.js +0 -1
- package/payload/server/public/assets/useSelectionMode-DDmLmPph.js +0 -1
- package/payload/server/public/assets/useSubAccountSwitcher-CU-lOxTd.js +0 -9
- package/payload/server/public/assets/useVoiceRecorder-azG8zSUI.js +0 -2
- package/payload/server/public/assets/wardley-RL74JXVD-DgMn-9ZJ.js +0 -1
- /package/payload/platform/plugins/cloudflare/skills/data-portal/{template/schema.sql → schema.sql} +0 -0
- /package/payload/platform/plugins/cloudflare/skills/data-portal/template/{public/index.html → index.html} +0 -0
- /package/payload/platform/plugins/cloudflare/skills/data-portal/template/{public/portal.js → portal.js} +0 -0
- /package/payload/server/public/assets/{_baseFor-D3BqAOBr.js → _baseFor-CMWvz0uA.js} +0 -0
- /package/payload/server/public/assets/{array-iYP9fzJp.js → array-Cny_NT6T.js} +0 -0
- /package/payload/server/public/assets/{chunk-Ck5AOu5v.js → chunk-TPjIAO9U.js} +0 -0
- /package/payload/server/public/assets/{cytoscape.esm-BQSBzPsB.js → cytoscape.esm-De0CCmB2.js} +0 -0
- /package/payload/server/public/assets/{defaultLocale-BrdA1gDi.js → defaultLocale-BahRht8U.js} +0 -0
- /package/payload/server/public/assets/{init-Bx0S6pkp.js → init-DoIvjoJ_.js} +0 -0
- /package/payload/server/public/assets/{katex-BsiH_a6d.js → katex-Bfn1OZEl.js} +0 -0
- /package/payload/server/public/assets/{path-BLSgTy3w.js → path-CTezU8L5.js} +0 -0
- /package/payload/server/public/assets/{preload-helper-ClBMtM1g.js → preload-helper-CT1Z6Pdu.js} +0 -0
- /package/payload/server/public/assets/{rough.esm-BMOtDaaS.js → rough.esm-BJo4pvXu.js} +0 -0
package/payload/server/server.js
CHANGED
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
embed,
|
|
43
43
|
emitMissingOnResolve,
|
|
44
44
|
ensureConversation,
|
|
45
|
+
ensureSessionConversation,
|
|
45
46
|
fetchAccountName,
|
|
46
47
|
fetchBranding,
|
|
47
48
|
findMissingPlugins,
|
|
@@ -111,7 +112,7 @@ import {
|
|
|
111
112
|
vncLog,
|
|
112
113
|
walkPremiumBundles,
|
|
113
114
|
writeAdminUserAndPerson
|
|
114
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-BSTIQX52.js";
|
|
115
116
|
import {
|
|
116
117
|
D1_MAX_SQL_STATEMENT_BYTES,
|
|
117
118
|
D1_QUERY_MAX_BODY_BYTES,
|
|
@@ -1533,7 +1534,7 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
1533
1534
|
};
|
|
1534
1535
|
|
|
1535
1536
|
// server/index.ts
|
|
1536
|
-
import { readFileSync as readFileSync39, existsSync as existsSync37, watchFile, readdirSync as
|
|
1537
|
+
import { readFileSync as readFileSync39, existsSync as existsSync37, watchFile, readdirSync as readdirSync23, statSync as statSync14 } from "fs";
|
|
1537
1538
|
import { spawn as spawn3 } from "child_process";
|
|
1538
1539
|
import { createHash as createHash7 } from "crypto";
|
|
1539
1540
|
import { resolve as resolve36, join as join39, basename as basename12 } from "path";
|
|
@@ -6675,8 +6676,8 @@ function webchatTurnTimeoutMs() {
|
|
|
6675
6676
|
return Number(process.env.WEBCHAT_TURN_TIMEOUT_MS ?? String(2 * 6e4));
|
|
6676
6677
|
}
|
|
6677
6678
|
function createChatRoutes(deps) {
|
|
6678
|
-
const
|
|
6679
|
-
|
|
6679
|
+
const app64 = new Hono();
|
|
6680
|
+
app64.post("/", async (c) => {
|
|
6680
6681
|
console.log(`[chat-route] entered route=public method=POST`);
|
|
6681
6682
|
const contentType = c.req.header("content-type") ?? "";
|
|
6682
6683
|
const account = resolveAccount();
|
|
@@ -6940,7 +6941,7 @@ ${result.result.text}` : result.result.text;
|
|
|
6940
6941
|
}
|
|
6941
6942
|
});
|
|
6942
6943
|
});
|
|
6943
|
-
return
|
|
6944
|
+
return app64;
|
|
6944
6945
|
}
|
|
6945
6946
|
|
|
6946
6947
|
// app/lib/channel-pty-bridge/admin-session-id.ts
|
|
@@ -6974,8 +6975,8 @@ function isLoopbackAddr(addr) {
|
|
|
6974
6975
|
return addr === "127.0.0.1" || addr === "::1" || addr === "::ffff:127.0.0.1";
|
|
6975
6976
|
}
|
|
6976
6977
|
function createScheduleInjectRoutes(deps) {
|
|
6977
|
-
const
|
|
6978
|
-
|
|
6978
|
+
const app64 = new Hono();
|
|
6979
|
+
app64.post("/", async (c) => {
|
|
6979
6980
|
const env = c.env;
|
|
6980
6981
|
const remoteAddr = env?.incoming?.socket?.remoteAddress ?? "";
|
|
6981
6982
|
if (!isLoopbackAddr(remoteAddr)) {
|
|
@@ -7076,11 +7077,11 @@ function createScheduleInjectRoutes(deps) {
|
|
|
7076
7077
|
console.error(`${TAG17} op=inject-spawn eventId=${eventId} sessionId=${sessionId} result=ok status=-`);
|
|
7077
7078
|
return c.json({ ok: true }, 200);
|
|
7078
7079
|
});
|
|
7079
|
-
return
|
|
7080
|
+
return app64;
|
|
7080
7081
|
}
|
|
7081
7082
|
|
|
7082
7083
|
// server/index.ts
|
|
7083
|
-
var
|
|
7084
|
+
var import_dist10 = __toESM(require_dist(), 1);
|
|
7084
7085
|
|
|
7085
7086
|
// app/lib/whatsapp/socket-resolution-error.ts
|
|
7086
7087
|
function formatPresentKeys(presentKeys) {
|
|
@@ -12012,8 +12013,8 @@ async function reapplyLeversViaManager() {
|
|
|
12012
12013
|
var WEBCHAT_SEND_TURN_WINDOW_MS = Number(process.env.WEBCHAT_SEND_TURN_WINDOW_MS ?? String(15e3));
|
|
12013
12014
|
var sendSeq = 0;
|
|
12014
12015
|
function createWebchatRoutes(deps) {
|
|
12015
|
-
const
|
|
12016
|
-
|
|
12016
|
+
const app64 = new Hono();
|
|
12017
|
+
app64.post("/send", requireAdminSession, async (c) => {
|
|
12017
12018
|
let accountId;
|
|
12018
12019
|
try {
|
|
12019
12020
|
accountId = resolvePlatformAccountId();
|
|
@@ -12225,7 +12226,7 @@ ${note}` : note;
|
|
|
12225
12226
|
if (turnTimer.unref) turnTimer.unref();
|
|
12226
12227
|
return c.json({ ok: true });
|
|
12227
12228
|
});
|
|
12228
|
-
|
|
12229
|
+
app64.post("/interrupt", requireAdminSession, async (c) => {
|
|
12229
12230
|
const cacheKey = c.get("cacheKey");
|
|
12230
12231
|
const requesterUserId = (cacheKey ? getUserIdForSession(cacheKey) : void 0) ?? null;
|
|
12231
12232
|
const primaryUserId = resolvePrimaryAdminUserId();
|
|
@@ -12253,7 +12254,7 @@ ${note}` : note;
|
|
|
12253
12254
|
}
|
|
12254
12255
|
return c.json({ ok: true, stopped: outcome.stopped, intId: outcome.intId, deadChild: outcome.deadChild }, 200);
|
|
12255
12256
|
});
|
|
12256
|
-
|
|
12257
|
+
app64.post("/settings", requireAdminSession, async (c) => {
|
|
12257
12258
|
const body = await c.req.json().catch(() => null);
|
|
12258
12259
|
const op = body?.op;
|
|
12259
12260
|
const value = body?.value;
|
|
@@ -12293,7 +12294,7 @@ ${note}` : note;
|
|
|
12293
12294
|
console.log(`[webchat:settings] op=${op} outcome=accepted value=${value} settingsApplied=${settingsApplied}`);
|
|
12294
12295
|
return c.json({ ok: true, settingsApplied });
|
|
12295
12296
|
});
|
|
12296
|
-
|
|
12297
|
+
app64.get("/session", requireAdminSession, async (c) => {
|
|
12297
12298
|
let accountId;
|
|
12298
12299
|
try {
|
|
12299
12300
|
accountId = resolvePlatformAccountId();
|
|
@@ -12371,7 +12372,7 @@ ${note}` : note;
|
|
|
12371
12372
|
const indicators = await fetchComposerIndicators(sessionId);
|
|
12372
12373
|
return c.json({ sessionId, projectDir, source, sizeBytes: jsonlSizeBytes(projectDir, sessionId), pendingPermissionPrompt: deps.pendingPromptFor?.(`session:${sessionId}`) ?? null, deliveryFailure: deps.deliveryFailureFor?.(`session:${sessionId}`) ?? null, ...indicators, ...readLevers(account) });
|
|
12373
12374
|
});
|
|
12374
|
-
|
|
12375
|
+
app64.post("/permission-verdict", requireAdminSession, async (c) => {
|
|
12375
12376
|
const body = await c.req.json().catch(() => null);
|
|
12376
12377
|
const sessionId = body?.sessionId;
|
|
12377
12378
|
const requestId = body?.request_id;
|
|
@@ -12388,7 +12389,7 @@ ${note}` : note;
|
|
|
12388
12389
|
const ok = deps.resolvePermissionVerdict?.(`session:${sessionId}`, requestId, behavior) ?? false;
|
|
12389
12390
|
return c.json({ ok });
|
|
12390
12391
|
});
|
|
12391
|
-
return
|
|
12392
|
+
return app64;
|
|
12392
12393
|
}
|
|
12393
12394
|
|
|
12394
12395
|
// server/routes/webchat-greeting.ts
|
|
@@ -15679,18 +15680,18 @@ var ALLOWED_EVENTS = /* @__PURE__ */ new Set([
|
|
|
15679
15680
|
]);
|
|
15680
15681
|
var app21 = new Hono();
|
|
15681
15682
|
app21.post("/", async (c) => {
|
|
15682
|
-
const
|
|
15683
|
+
const TAG51 = "[admin:events]";
|
|
15683
15684
|
let body;
|
|
15684
15685
|
try {
|
|
15685
15686
|
body = await c.req.json();
|
|
15686
15687
|
} catch (err) {
|
|
15687
15688
|
const detail = err instanceof Error ? err.message : String(err);
|
|
15688
|
-
console.error(`${
|
|
15689
|
+
console.error(`${TAG51} reject reason=body-not-json detail=${detail}`);
|
|
15689
15690
|
return c.json({ ok: false, detail: "Request body was not valid JSON" }, 400);
|
|
15690
15691
|
}
|
|
15691
15692
|
const event = typeof body.event === "string" ? body.event : "";
|
|
15692
15693
|
if (!ALLOWED_EVENTS.has(event)) {
|
|
15693
|
-
console.error(`${
|
|
15694
|
+
console.error(`${TAG51} reject reason=event-not-allowed event=${JSON.stringify(event)}`);
|
|
15694
15695
|
return c.json({ ok: false, detail: `Event "${event}" is not allowed` }, 400);
|
|
15695
15696
|
}
|
|
15696
15697
|
const rawFields = body.fields && typeof body.fields === "object" ? body.fields : {};
|
|
@@ -22149,57 +22150,150 @@ app51.post("/", requireAdminSession, async (c) => {
|
|
|
22149
22150
|
});
|
|
22150
22151
|
var task_time_adjust_default = app51;
|
|
22151
22152
|
|
|
22152
|
-
// server/routes/admin/
|
|
22153
|
+
// server/routes/admin/activity.ts
|
|
22154
|
+
import { readdirSync as readdirSync22 } from "fs";
|
|
22153
22155
|
var app52 = new Hono();
|
|
22154
|
-
|
|
22155
|
-
|
|
22156
|
-
|
|
22157
|
-
|
|
22158
|
-
|
|
22159
|
-
|
|
22160
|
-
|
|
22161
|
-
|
|
22162
|
-
|
|
22163
|
-
|
|
22164
|
-
|
|
22165
|
-
|
|
22166
|
-
|
|
22167
|
-
|
|
22168
|
-
|
|
22169
|
-
|
|
22170
|
-
|
|
22171
|
-
|
|
22172
|
-
|
|
22173
|
-
|
|
22174
|
-
|
|
22175
|
-
app52.
|
|
22176
|
-
|
|
22177
|
-
|
|
22178
|
-
|
|
22179
|
-
|
|
22180
|
-
|
|
22181
|
-
|
|
22182
|
-
|
|
22183
|
-
|
|
22184
|
-
|
|
22185
|
-
|
|
22186
|
-
|
|
22187
|
-
|
|
22188
|
-
|
|
22189
|
-
|
|
22190
|
-
|
|
22191
|
-
|
|
22192
|
-
|
|
22193
|
-
|
|
22194
|
-
|
|
22195
|
-
|
|
22156
|
+
var TAG40 = "[activity]";
|
|
22157
|
+
function resolveHouseAccountId(accounts) {
|
|
22158
|
+
const houses = accounts.filter((a) => a.config.role === "house");
|
|
22159
|
+
if (houses.length === 1) return { accountId: houses[0].accountId, reason: "house" };
|
|
22160
|
+
if (houses.length > 1) return { accountId: null, reason: "multiple-houses" };
|
|
22161
|
+
if (accounts.length === 1) return { accountId: accounts[0].accountId, reason: "sole-account" };
|
|
22162
|
+
return { accountId: null, reason: "no-house" };
|
|
22163
|
+
}
|
|
22164
|
+
function requestToken() {
|
|
22165
|
+
return Math.random().toString(16).slice(2, 10);
|
|
22166
|
+
}
|
|
22167
|
+
var short = (id) => id ? id.slice(0, 8) : "unset";
|
|
22168
|
+
function countAccountDirsOnDisk() {
|
|
22169
|
+
try {
|
|
22170
|
+
return readdirSync22(ACCOUNTS_DIR, { withFileTypes: true }).filter(
|
|
22171
|
+
(e) => e.isDirectory() && !e.name.startsWith(".")
|
|
22172
|
+
).length;
|
|
22173
|
+
} catch {
|
|
22174
|
+
return null;
|
|
22175
|
+
}
|
|
22176
|
+
}
|
|
22177
|
+
app52.get("/", requireAdminSession, async (c) => {
|
|
22178
|
+
const req = requestToken();
|
|
22179
|
+
const cacheKey = c.var.cacheKey;
|
|
22180
|
+
const caller2 = getAccountIdForSession(cacheKey) ?? null;
|
|
22181
|
+
const valid = listValidAccounts();
|
|
22182
|
+
const house = resolveHouseAccountId(valid);
|
|
22183
|
+
const isHouse = caller2 !== null && house.accountId !== null && caller2 === house.accountId;
|
|
22184
|
+
console.log(
|
|
22185
|
+
`${TAG40} op=request req=${req} caller=${short(caller2)} house=${isHouse} houseVia=${house.reason}`
|
|
22186
|
+
);
|
|
22187
|
+
if (!isHouse) {
|
|
22188
|
+
const reason = house.accountId === null ? house.reason : "not-house";
|
|
22189
|
+
console.error(
|
|
22190
|
+
`${TAG40} op=gate req=${req} decision=deny reason=${reason} caller=${short(caller2)} houseAcct=${short(house.accountId)} accounts=${valid.length}`
|
|
22191
|
+
);
|
|
22192
|
+
return c.json({ error: "house-only" }, 403);
|
|
22193
|
+
}
|
|
22194
|
+
console.log(`${TAG40} op=gate req=${req} decision=allow caller=${short(caller2)} via=${house.reason}`);
|
|
22195
|
+
const onDisk = countAccountDirsOnDisk();
|
|
22196
|
+
console.log(
|
|
22197
|
+
`${TAG40} op=accounts req=${req} onDisk=${onDisk ?? "unknown"} valid=${valid.length} ids=${valid.map((a) => short(a.accountId)).join(",")}`
|
|
22198
|
+
);
|
|
22199
|
+
const start = Date.now();
|
|
22200
|
+
let res;
|
|
22201
|
+
try {
|
|
22202
|
+
res = await fetch(`${managerBase("activity:wrapper")}/activity`, {
|
|
22203
|
+
signal: AbortSignal.timeout(3e4)
|
|
22204
|
+
});
|
|
22205
|
+
} catch (err) {
|
|
22206
|
+
console.error(
|
|
22207
|
+
`${TAG40} op=manager-fail req=${req} reason=unreachable err=${err instanceof Error ? err.message : String(err)}`
|
|
22208
|
+
);
|
|
22209
|
+
return c.json({ error: "manager-unreachable" }, 502);
|
|
22210
|
+
}
|
|
22211
|
+
if (res.status !== 200) {
|
|
22212
|
+
console.error(`${TAG40} op=manager-fail req=${req} reason=status status=${res.status}`);
|
|
22213
|
+
return c.json({ error: `manager-status-${res.status}` }, 502);
|
|
22214
|
+
}
|
|
22215
|
+
const body = await res.json().catch(() => null);
|
|
22216
|
+
if (!body || !Array.isArray(body.rows)) {
|
|
22217
|
+
console.error(`${TAG40} op=manager-fail req=${req} reason=bad-json`);
|
|
22218
|
+
return c.json({ error: "manager-bad-json" }, 502);
|
|
22219
|
+
}
|
|
22220
|
+
const rows = body.rows;
|
|
22221
|
+
const census = body.census ?? null;
|
|
22222
|
+
const untaggedCount = rows.filter((r) => r.accountId === null).length;
|
|
22223
|
+
const meteringFailed = rows.filter((r) => r.meteringError !== null).length;
|
|
22224
|
+
const censusAgeMs = census ? Date.now() - census.sampleAtMs : null;
|
|
22225
|
+
console.log(
|
|
22226
|
+
`${TAG40} op=census req=${req} ageMs=${censusAgeMs ?? "none"} live=${census?.live ?? "none"} cpuNull=${census?.cpuNull ?? "none"}`
|
|
22227
|
+
);
|
|
22228
|
+
console.log(
|
|
22229
|
+
`${TAG40} op=response req=${req} rows=${rows.length} accounts=${valid.length} untagged=${untaggedCount} meteringFailed=${meteringFailed} ms=${Date.now() - start}`
|
|
22230
|
+
);
|
|
22231
|
+
return c.json({
|
|
22232
|
+
rows,
|
|
22233
|
+
census,
|
|
22234
|
+
censusAgeMs,
|
|
22235
|
+
accounts: {
|
|
22236
|
+
onDisk,
|
|
22237
|
+
valid: valid.length,
|
|
22238
|
+
ids: valid.map((a) => a.accountId),
|
|
22239
|
+
untaggedCount
|
|
22240
|
+
}
|
|
22241
|
+
});
|
|
22242
|
+
});
|
|
22243
|
+
var activity_default = app52;
|
|
22244
|
+
|
|
22245
|
+
// server/routes/admin/index.ts
|
|
22246
|
+
var app53 = new Hono();
|
|
22247
|
+
app53.route("/session", session_default);
|
|
22248
|
+
app53.route("/accounts", accounts_default);
|
|
22249
|
+
app53.route("/logs", logs_default);
|
|
22250
|
+
app53.route("/claude-info", claude_info_default);
|
|
22251
|
+
app53.route("/attachment", attachment_default);
|
|
22252
|
+
app53.route("/agents", agents_default);
|
|
22253
|
+
app53.route("/sessions", sessions_default);
|
|
22254
|
+
app53.route("/claude-sessions", claude_sessions_default);
|
|
22255
|
+
app53.route("/log-ingest", log_ingest_default);
|
|
22256
|
+
app53.route("/events", events_default);
|
|
22257
|
+
app53.route("/files", files_default);
|
|
22258
|
+
app53.route("/graph-search", graph_search_default);
|
|
22259
|
+
app53.route("/graph-subgraph", graph_subgraph_default);
|
|
22260
|
+
app53.route("/graph-delete", graph_delete_default);
|
|
22261
|
+
app53.route("/graph-restore", graph_restore_default);
|
|
22262
|
+
app53.route("/graph-labels-in-graph", graph_labels_in_graph_default);
|
|
22263
|
+
app53.route("/graph-default-view", graph_default_view_default);
|
|
22264
|
+
app53.route("/sidebar-artefacts", sidebar_artefacts_default);
|
|
22265
|
+
app53.route("/sidebar-sessions", sidebar_sessions_default);
|
|
22266
|
+
app53.route("/session-delete", session_delete_default);
|
|
22267
|
+
app53.route("/session-stop", session_stop_default);
|
|
22268
|
+
app53.route("/session-archive", session_archive_default);
|
|
22269
|
+
app53.route("/session-rename", session_rename_default);
|
|
22270
|
+
app53.route("/session-usage", session_usage_default);
|
|
22271
|
+
app53.route("/browser", browser_default);
|
|
22272
|
+
app53.route("/session-rc-spawn", session_rc_spawn_default);
|
|
22273
|
+
app53.route("/session-reseat", session_reseat_default);
|
|
22274
|
+
app53.route("/system-stats", system_stats_default);
|
|
22275
|
+
app53.route("/health-brand", health_default2);
|
|
22276
|
+
app53.route("/linkedin-ingest", linkedin_ingest_default);
|
|
22277
|
+
app53.route("/post-turn-context", post_turn_context_default);
|
|
22278
|
+
app53.route("/public-session-context", public_session_context_default);
|
|
22279
|
+
app53.route("/public-session-exit", public_session_exit_default);
|
|
22280
|
+
app53.route("/access-session-evict", access_session_evict_default);
|
|
22281
|
+
app53.route("/enrol-person", enrol_person_default);
|
|
22282
|
+
app53.route("/calendar", calendar_default);
|
|
22283
|
+
app53.route("/tasks-list", tasks_list_default);
|
|
22284
|
+
app53.route("/task-timer-start", task_timer_start_default);
|
|
22285
|
+
app53.route("/task-timer-stop", task_timer_stop_default);
|
|
22286
|
+
app53.route("/task-complete", task_complete_default);
|
|
22287
|
+
app53.route("/task-time-adjust", task_time_adjust_default);
|
|
22288
|
+
app53.route("/activity", activity_default);
|
|
22289
|
+
var admin_default = app53;
|
|
22196
22290
|
|
|
22197
22291
|
// server/routes/access/verify-token.ts
|
|
22198
|
-
var
|
|
22292
|
+
var TAG41 = "[access-verify]";
|
|
22199
22293
|
var MINT_TAG = "[access-session-mint]";
|
|
22200
22294
|
var COOKIE_NAME = "__access_session";
|
|
22201
|
-
var
|
|
22202
|
-
|
|
22295
|
+
var app54 = new Hono();
|
|
22296
|
+
app54.post("/", async (c) => {
|
|
22203
22297
|
const ip = c.var.clientIp || "unknown";
|
|
22204
22298
|
let body;
|
|
22205
22299
|
try {
|
|
@@ -22214,39 +22308,39 @@ app53.post("/", async (c) => {
|
|
|
22214
22308
|
}
|
|
22215
22309
|
const rateMsg = checkAccessRateLimit(ip, agentSlug);
|
|
22216
22310
|
if (rateMsg) {
|
|
22217
|
-
console.error(`${
|
|
22311
|
+
console.error(`${TAG41} grantId=- agentSlug=${agentSlug} result=rate-limited ip=${ip}`);
|
|
22218
22312
|
return c.json({ error: rateMsg }, 429);
|
|
22219
22313
|
}
|
|
22220
22314
|
const grant = await findGrantByMagicToken(token);
|
|
22221
22315
|
if (!grant) {
|
|
22222
22316
|
recordAccessFailedAttempt(ip, agentSlug);
|
|
22223
|
-
console.error(`${
|
|
22317
|
+
console.error(`${TAG41} grantId=- agentSlug=${agentSlug} result=notfound ip=${ip}`);
|
|
22224
22318
|
return c.json({ error: "invalid-or-expired-link" }, 401);
|
|
22225
22319
|
}
|
|
22226
22320
|
if (grant.agentSlug !== agentSlug) {
|
|
22227
22321
|
recordAccessFailedAttempt(ip, agentSlug);
|
|
22228
22322
|
console.error(
|
|
22229
|
-
`${
|
|
22323
|
+
`${TAG41} grantId=${grant.grantId} agentSlug=${agentSlug} result=agent-mismatch grantAgent=${grant.agentSlug} ip=${ip}`
|
|
22230
22324
|
);
|
|
22231
22325
|
return c.json({ error: "invalid-or-expired-link" }, 401);
|
|
22232
22326
|
}
|
|
22233
22327
|
if (grant.status === "expired" || grant.status === "revoked") {
|
|
22234
22328
|
recordAccessFailedAttempt(ip, agentSlug);
|
|
22235
22329
|
console.error(
|
|
22236
|
-
`${
|
|
22330
|
+
`${TAG41} grantId=${grant.grantId} agentSlug=${agentSlug} result=expired status=${grant.status} ip=${ip}`
|
|
22237
22331
|
);
|
|
22238
22332
|
return c.json({ error: "access-no-longer-valid" }, 401);
|
|
22239
22333
|
}
|
|
22240
22334
|
if (grant.expiresAt !== null && grant.expiresAt < Date.now()) {
|
|
22241
22335
|
recordAccessFailedAttempt(ip, agentSlug);
|
|
22242
22336
|
console.error(
|
|
22243
|
-
`${
|
|
22337
|
+
`${TAG41} grantId=${grant.grantId} agentSlug=${agentSlug} result=expired reason=expiresAt-past ip=${ip}`
|
|
22244
22338
|
);
|
|
22245
22339
|
return c.json({ error: "access-no-longer-valid" }, 401);
|
|
22246
22340
|
}
|
|
22247
22341
|
if (!grant.sliceToken) {
|
|
22248
22342
|
console.error(
|
|
22249
|
-
`${
|
|
22343
|
+
`${TAG41} grantId=${grant.grantId} agentSlug=${agentSlug} result=no-slice-token reason=schema-violation`
|
|
22250
22344
|
);
|
|
22251
22345
|
return c.json({ error: "grant-misconfigured" }, 500);
|
|
22252
22346
|
}
|
|
@@ -22262,12 +22356,12 @@ app53.post("/", async (c) => {
|
|
|
22262
22356
|
await consumeMagicTokenAndActivate(grant.grantId);
|
|
22263
22357
|
} catch (err) {
|
|
22264
22358
|
console.error(
|
|
22265
|
-
`${
|
|
22359
|
+
`${TAG41} grantId=${grant.grantId} agentSlug=${agentSlug} result=consume-failed err="${err instanceof Error ? err.message : String(err)}"`
|
|
22266
22360
|
);
|
|
22267
22361
|
return c.json({ error: "verification-failed" }, 500);
|
|
22268
22362
|
}
|
|
22269
22363
|
clearAccessRateLimit(ip, agentSlug);
|
|
22270
|
-
console.log(`${
|
|
22364
|
+
console.log(`${TAG41} grantId=${grant.grantId} agentSlug=${agentSlug} result=ok ip=${ip}`);
|
|
22271
22365
|
console.log(
|
|
22272
22366
|
`${MINT_TAG} grantId=${grant.grantId} sliceToken=${grant.sliceToken.slice(0, 8)} agentSlug=${agentSlug} personId=${grant.personId ?? "none"}`
|
|
22273
22367
|
);
|
|
@@ -22281,7 +22375,7 @@ app53.post("/", async (c) => {
|
|
|
22281
22375
|
displayName: grant.displayName
|
|
22282
22376
|
});
|
|
22283
22377
|
});
|
|
22284
|
-
var verify_token_default =
|
|
22378
|
+
var verify_token_default = app54;
|
|
22285
22379
|
|
|
22286
22380
|
// app/lib/access-email.ts
|
|
22287
22381
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -22343,10 +22437,10 @@ async function sendMagicLinkEmail(payload) {
|
|
|
22343
22437
|
}
|
|
22344
22438
|
|
|
22345
22439
|
// server/routes/access/request-magic-link.ts
|
|
22346
|
-
var
|
|
22347
|
-
var
|
|
22440
|
+
var TAG42 = "[access-request-link]";
|
|
22441
|
+
var app55 = new Hono();
|
|
22348
22442
|
var VISITOR_MESSAGE = "If that email is on the invite list, a fresh link is on the way.";
|
|
22349
|
-
|
|
22443
|
+
app55.post("/", async (c) => {
|
|
22350
22444
|
let body;
|
|
22351
22445
|
try {
|
|
22352
22446
|
body = await c.req.json();
|
|
@@ -22360,18 +22454,18 @@ app54.post("/", async (c) => {
|
|
|
22360
22454
|
}
|
|
22361
22455
|
const rateMsg = checkRequestLinkRateLimit(contactValue);
|
|
22362
22456
|
if (rateMsg) {
|
|
22363
|
-
console.error(`${
|
|
22457
|
+
console.error(`${TAG42} contactValue=${maskContact(contactValue)} result=rate-limited`);
|
|
22364
22458
|
return c.json({ error: rateMsg }, 429);
|
|
22365
22459
|
}
|
|
22366
22460
|
recordRequestLinkAttempt(contactValue);
|
|
22367
22461
|
const accountId = process.env.ACCOUNT_ID ?? "";
|
|
22368
22462
|
if (!accountId) {
|
|
22369
|
-
console.error(`${
|
|
22463
|
+
console.error(`${TAG42} contactValue=${maskContact(contactValue)} result=no-account-id`);
|
|
22370
22464
|
return c.json({ message: VISITOR_MESSAGE }, 200);
|
|
22371
22465
|
}
|
|
22372
22466
|
const grant = await findActiveGrantByContact(contactValue, agentSlug, accountId);
|
|
22373
22467
|
if (!grant) {
|
|
22374
|
-
console.log(`${
|
|
22468
|
+
console.log(`${TAG42} contactValue=${maskContact(contactValue)} result=notfound`);
|
|
22375
22469
|
return c.json({ message: VISITOR_MESSAGE }, 200);
|
|
22376
22470
|
}
|
|
22377
22471
|
let token;
|
|
@@ -22379,7 +22473,7 @@ app54.post("/", async (c) => {
|
|
|
22379
22473
|
token = await generateNewMagicToken(grant.grantId);
|
|
22380
22474
|
} catch (err) {
|
|
22381
22475
|
console.error(
|
|
22382
|
-
`${
|
|
22476
|
+
`${TAG42} contactValue=${maskContact(contactValue)} result=mint-failed err="${err instanceof Error ? err.message : String(err)}"`
|
|
22383
22477
|
);
|
|
22384
22478
|
return c.json({ message: VISITOR_MESSAGE }, 200);
|
|
22385
22479
|
}
|
|
@@ -22411,22 +22505,22 @@ app54.post("/", async (c) => {
|
|
|
22411
22505
|
});
|
|
22412
22506
|
if (!sendResult.ok) {
|
|
22413
22507
|
console.error(
|
|
22414
|
-
`${
|
|
22508
|
+
`${TAG42} contactValue=${maskContact(contactValue)} result=send-failed err="${sendResult.error}"`
|
|
22415
22509
|
);
|
|
22416
22510
|
return c.json({ message: VISITOR_MESSAGE }, 200);
|
|
22417
22511
|
}
|
|
22418
22512
|
console.log(
|
|
22419
|
-
`${
|
|
22513
|
+
`${TAG42} contactValue=${maskContact(contactValue)} result=ok messageId=${sendResult.messageId}`
|
|
22420
22514
|
);
|
|
22421
22515
|
return c.json({ message: VISITOR_MESSAGE }, 200);
|
|
22422
22516
|
});
|
|
22423
|
-
var request_magic_link_default =
|
|
22517
|
+
var request_magic_link_default = app55;
|
|
22424
22518
|
|
|
22425
22519
|
// server/routes/access/index.ts
|
|
22426
|
-
var
|
|
22427
|
-
|
|
22428
|
-
|
|
22429
|
-
var access_default =
|
|
22520
|
+
var app56 = new Hono();
|
|
22521
|
+
app56.route("/verify-token", verify_token_default);
|
|
22522
|
+
app56.route("/request-magic-link", request_magic_link_default);
|
|
22523
|
+
var access_default = app56;
|
|
22430
22524
|
|
|
22431
22525
|
// server/routes/sites.ts
|
|
22432
22526
|
import { existsSync as existsSync32, readFileSync as readFileSync35, realpathSync as realpathSync7, statSync as statSync12 } from "fs";
|
|
@@ -22461,8 +22555,8 @@ function getExt(p) {
|
|
|
22461
22555
|
if (idx < p.lastIndexOf("/")) return "";
|
|
22462
22556
|
return p.slice(idx).toLowerCase();
|
|
22463
22557
|
}
|
|
22464
|
-
var
|
|
22465
|
-
|
|
22558
|
+
var app57 = new Hono();
|
|
22559
|
+
app57.get("/:rel{.*}", (c) => {
|
|
22466
22560
|
const reqPath = c.req.path;
|
|
22467
22561
|
const rawRel = c.req.param("rel") ?? "";
|
|
22468
22562
|
const trimmed = rawRel.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
@@ -22565,7 +22659,7 @@ app56.get("/:rel{.*}", (c) => {
|
|
|
22565
22659
|
"X-Content-Type-Options": "nosniff"
|
|
22566
22660
|
});
|
|
22567
22661
|
});
|
|
22568
|
-
var sites_default =
|
|
22662
|
+
var sites_default = app57;
|
|
22569
22663
|
|
|
22570
22664
|
// app/lib/visitor-token.ts
|
|
22571
22665
|
import { createHmac, randomBytes as randomBytes2, timingSafeEqual } from "crypto";
|
|
@@ -22665,7 +22759,7 @@ function readBrandConfig() {
|
|
|
22665
22759
|
}
|
|
22666
22760
|
|
|
22667
22761
|
// server/routes/visitor-consent.ts
|
|
22668
|
-
var
|
|
22762
|
+
var app58 = new Hono();
|
|
22669
22763
|
var CONSENT_COOKIE_NAME = "mxy_consent";
|
|
22670
22764
|
var CONSENT_COOKIE_MAX_AGE_SECONDS = 60 * 60 * 24 * 365;
|
|
22671
22765
|
var DEFAULT_CONSENT_COPY = {
|
|
@@ -22710,17 +22804,17 @@ function siteSlugFromReferer(referer) {
|
|
|
22710
22804
|
return "";
|
|
22711
22805
|
}
|
|
22712
22806
|
}
|
|
22713
|
-
|
|
22807
|
+
app58.options("/consent", (c) => {
|
|
22714
22808
|
const origin = getOrigin(c);
|
|
22715
22809
|
setCorsHeaders(c, origin);
|
|
22716
22810
|
return c.body(null, 204);
|
|
22717
22811
|
});
|
|
22718
|
-
|
|
22812
|
+
app58.options("/brand-config", (c) => {
|
|
22719
22813
|
const origin = getOrigin(c);
|
|
22720
22814
|
setCorsHeaders(c, origin);
|
|
22721
22815
|
return c.body(null, 204);
|
|
22722
22816
|
});
|
|
22723
|
-
|
|
22817
|
+
app58.post("/consent", async (c) => {
|
|
22724
22818
|
const origin = getOrigin(c);
|
|
22725
22819
|
setCorsHeaders(c, origin);
|
|
22726
22820
|
let raw;
|
|
@@ -22760,7 +22854,7 @@ app57.post("/consent", async (c) => {
|
|
|
22760
22854
|
console.log(`[consent] ${parsed.decision} site=${site} brand=${brandName} tokenBound=${tokenBound}`);
|
|
22761
22855
|
return c.body(null, 204);
|
|
22762
22856
|
});
|
|
22763
|
-
|
|
22857
|
+
app58.get("/brand-config", (c) => {
|
|
22764
22858
|
const origin = getOrigin(c);
|
|
22765
22859
|
setCorsHeaders(c, origin);
|
|
22766
22860
|
const brand = readBrandConfig();
|
|
@@ -22770,7 +22864,7 @@ app57.get("/brand-config", (c) => {
|
|
|
22770
22864
|
c.header("Cache-Control", "public, max-age=300");
|
|
22771
22865
|
return c.json({ consent: { copy, palette } });
|
|
22772
22866
|
});
|
|
22773
|
-
var visitor_consent_default =
|
|
22867
|
+
var visitor_consent_default = app58;
|
|
22774
22868
|
|
|
22775
22869
|
// server/routes/listings.ts
|
|
22776
22870
|
function getCookie(headerValue, name) {
|
|
@@ -22797,8 +22891,8 @@ function appendConsentParams(pageUrl, token) {
|
|
|
22797
22891
|
}
|
|
22798
22892
|
var SAFE_SLUG_RE = /^[a-z0-9](?:[a-z0-9-]{0,118}[a-z0-9])?$/;
|
|
22799
22893
|
var CHAT_SESSION_KEY_RE = /^[A-Za-z0-9][A-Za-z0-9_-]{7,127}$/;
|
|
22800
|
-
var
|
|
22801
|
-
|
|
22894
|
+
var app59 = new Hono();
|
|
22895
|
+
app59.get("/:slug/click", async (c) => {
|
|
22802
22896
|
const slug = c.req.param("slug") ?? "";
|
|
22803
22897
|
const rawSession = c.req.query("session") ?? "";
|
|
22804
22898
|
const sessionKey = CHAT_SESSION_KEY_RE.test(rawSession) ? rawSession : "invalid";
|
|
@@ -22862,10 +22956,10 @@ app58.get("/:slug/click", async (c) => {
|
|
|
22862
22956
|
console.log(`[property-card-click] sessionKey=${sessionKey} listingSlug=${slug} consent=${consentCookie ?? "absent"} ts=${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
22863
22957
|
return c.redirect(redirectUrl, 302);
|
|
22864
22958
|
});
|
|
22865
|
-
var listings_default =
|
|
22959
|
+
var listings_default = app59;
|
|
22866
22960
|
|
|
22867
22961
|
// server/routes/visitor-event.ts
|
|
22868
|
-
var
|
|
22962
|
+
var app60 = new Hono();
|
|
22869
22963
|
var BOT_UA_RE = /\b(bot|crawl|spider|slurp|headlesschrome|phantomjs|googlebot|bingbot|yandex|baiduspider|ahrefsbot|semrushbot|mj12bot|dotbot|petalbot)\b/i;
|
|
22870
22964
|
var buckets = /* @__PURE__ */ new Map();
|
|
22871
22965
|
var RATE_LIMIT = 60;
|
|
@@ -22932,12 +23026,12 @@ function originAllowed(origin, allowlist) {
|
|
|
22932
23026
|
return false;
|
|
22933
23027
|
}
|
|
22934
23028
|
}
|
|
22935
|
-
|
|
23029
|
+
app60.options("/event", (c) => {
|
|
22936
23030
|
const origin = getOrigin2(c);
|
|
22937
23031
|
setCorsHeaders2(c, origin);
|
|
22938
23032
|
return c.body(null, 204);
|
|
22939
23033
|
});
|
|
22940
|
-
|
|
23034
|
+
app60.post("/event", async (c) => {
|
|
22941
23035
|
const origin = getOrigin2(c);
|
|
22942
23036
|
setCorsHeaders2(c, origin);
|
|
22943
23037
|
const ua = c.req.header("user-agent") ?? "";
|
|
@@ -23142,7 +23236,7 @@ async function writeEvent(opts) {
|
|
|
23142
23236
|
);
|
|
23143
23237
|
}
|
|
23144
23238
|
}
|
|
23145
|
-
var visitor_event_default =
|
|
23239
|
+
var visitor_event_default = app60;
|
|
23146
23240
|
|
|
23147
23241
|
// server/routes/session.ts
|
|
23148
23242
|
import { resolve as resolve29 } from "path";
|
|
@@ -23188,8 +23282,8 @@ function withVisitorCookie(response, visitorId) {
|
|
|
23188
23282
|
headers
|
|
23189
23283
|
});
|
|
23190
23284
|
}
|
|
23191
|
-
var
|
|
23192
|
-
|
|
23285
|
+
var app61 = new Hono();
|
|
23286
|
+
app61.post("/", async (c) => {
|
|
23193
23287
|
let body;
|
|
23194
23288
|
try {
|
|
23195
23289
|
body = await c.req.json();
|
|
@@ -23336,7 +23430,7 @@ app60.post("/", async (c) => {
|
|
|
23336
23430
|
newVisitorId
|
|
23337
23431
|
);
|
|
23338
23432
|
});
|
|
23339
|
-
var session_default2 =
|
|
23433
|
+
var session_default2 = app61;
|
|
23340
23434
|
|
|
23341
23435
|
// server/lib/calendar-slots.ts
|
|
23342
23436
|
var WEEKDAYS = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
|
|
@@ -23419,17 +23513,17 @@ function computeOpenSlots(config, busy, fromISO, toISO) {
|
|
|
23419
23513
|
}
|
|
23420
23514
|
|
|
23421
23515
|
// server/routes/calendar-public.ts
|
|
23422
|
-
var
|
|
23516
|
+
var app62 = new Hono();
|
|
23423
23517
|
function setCors(c) {
|
|
23424
23518
|
c.header("Access-Control-Allow-Origin", "*");
|
|
23425
23519
|
c.header("Access-Control-Allow-Methods", "GET, OPTIONS");
|
|
23426
23520
|
c.header("Access-Control-Allow-Headers", "content-type");
|
|
23427
23521
|
}
|
|
23428
|
-
|
|
23522
|
+
app62.options("/free-busy", (c) => {
|
|
23429
23523
|
setCors(c);
|
|
23430
23524
|
return c.body(null, 204);
|
|
23431
23525
|
});
|
|
23432
|
-
|
|
23526
|
+
app62.get("/free-busy", async (c) => {
|
|
23433
23527
|
setCors(c);
|
|
23434
23528
|
const from = c.req.query("from");
|
|
23435
23529
|
const to = c.req.query("to");
|
|
@@ -23475,10 +23569,10 @@ app61.get("/free-busy", async (c) => {
|
|
|
23475
23569
|
await session.close();
|
|
23476
23570
|
}
|
|
23477
23571
|
});
|
|
23478
|
-
var calendar_public_default =
|
|
23572
|
+
var calendar_public_default = app62;
|
|
23479
23573
|
|
|
23480
23574
|
// app/lib/timeentry-census.ts
|
|
23481
|
-
var
|
|
23575
|
+
var TAG43 = "[timeentry-census]";
|
|
23482
23576
|
function reconcileTimeEntries(rows, now, horizonMs) {
|
|
23483
23577
|
const openEntries = rows.openEntries.length;
|
|
23484
23578
|
let oldestOpenAgeMs = 0;
|
|
@@ -23518,12 +23612,12 @@ async function runTimeEntryCensusOnce(session, now, horizonMs) {
|
|
|
23518
23612
|
sumAdjustments: toNum(r.get("sumAdjustments"))
|
|
23519
23613
|
}));
|
|
23520
23614
|
const finding = reconcileTimeEntries({ openEntries, taskSums }, now, horizonMs);
|
|
23521
|
-
const line = `${
|
|
23615
|
+
const line = `${TAG43} openEntries=${finding.openEntries} oldestOpenAgeMin=${finding.oldestOpenAgeMin} maxOpenPerAccount=${finding.maxOpenPerAccount} driftTasks=${finding.driftTasks}`;
|
|
23522
23616
|
if (finding.alarm) console.error(`${line} alarm=true`);
|
|
23523
23617
|
else console.log(line);
|
|
23524
23618
|
return finding;
|
|
23525
23619
|
} catch (err) {
|
|
23526
|
-
console.error(`${
|
|
23620
|
+
console.error(`${TAG43} error="${err instanceof Error ? err.message : String(err)}"`);
|
|
23527
23621
|
return null;
|
|
23528
23622
|
}
|
|
23529
23623
|
}
|
|
@@ -23537,13 +23631,13 @@ function startTimeEntryCensus(openSession, opts = {}) {
|
|
|
23537
23631
|
try {
|
|
23538
23632
|
session = openSession();
|
|
23539
23633
|
} catch (err) {
|
|
23540
|
-
console.error(`${
|
|
23634
|
+
console.error(`${TAG43} open-session-failed error="${err instanceof Error ? err.message : String(err)}"`);
|
|
23541
23635
|
return;
|
|
23542
23636
|
}
|
|
23543
23637
|
try {
|
|
23544
23638
|
await runTimeEntryCensusOnce(session, Date.now(), horizonMs);
|
|
23545
23639
|
} catch (err) {
|
|
23546
|
-
console.error(`${
|
|
23640
|
+
console.error(`${TAG43} tick-failed error="${err instanceof Error ? err.message : String(err)}"`);
|
|
23547
23641
|
} finally {
|
|
23548
23642
|
try {
|
|
23549
23643
|
await session.close();
|
|
@@ -23561,8 +23655,181 @@ function startTimeEntryCensus(openSession, opts = {}) {
|
|
|
23561
23655
|
return () => clearInterval(id);
|
|
23562
23656
|
}
|
|
23563
23657
|
|
|
23658
|
+
// ../lib/ledger-core/dist/reconcile.js
|
|
23659
|
+
var LEDGER_INDEX_NAMES = [
|
|
23660
|
+
"invoice_account_confirmation_unique",
|
|
23661
|
+
"cash_entry_account_entryid_unique",
|
|
23662
|
+
"cash_entry_account",
|
|
23663
|
+
"invoice_line_account",
|
|
23664
|
+
"invoice_payment_account",
|
|
23665
|
+
"credit_account"
|
|
23666
|
+
];
|
|
23667
|
+
function countSuspectDuplicates(keys) {
|
|
23668
|
+
const groups = /* @__PURE__ */ new Map();
|
|
23669
|
+
for (const k of keys) {
|
|
23670
|
+
const composite = `${k.invoiceId}|${k.amount}|${k.date}`;
|
|
23671
|
+
const ids = groups.get(composite) ?? /* @__PURE__ */ new Set();
|
|
23672
|
+
ids.add(k.paymentId);
|
|
23673
|
+
groups.set(composite, ids);
|
|
23674
|
+
}
|
|
23675
|
+
let total = 0;
|
|
23676
|
+
for (const ids of groups.values())
|
|
23677
|
+
total += Math.max(0, ids.size - 1);
|
|
23678
|
+
return total;
|
|
23679
|
+
}
|
|
23680
|
+
function reconcileLedger(rows, _now) {
|
|
23681
|
+
const suspectDuplicates = countSuspectDuplicates(rows.paymentKeys);
|
|
23682
|
+
const alarm = rows.orphanPayments > 0 || rows.storedBalanceProps > 0 || suspectDuplicates > 0 || rows.declaredNotLive.length > 0;
|
|
23683
|
+
return {
|
|
23684
|
+
invoices: rows.invoices,
|
|
23685
|
+
payments: rows.payments,
|
|
23686
|
+
orphanPayments: rows.orphanPayments,
|
|
23687
|
+
storedBalanceProps: rows.storedBalanceProps,
|
|
23688
|
+
suspectDuplicates,
|
|
23689
|
+
declaredNotLive: rows.declaredNotLive,
|
|
23690
|
+
alarm
|
|
23691
|
+
};
|
|
23692
|
+
}
|
|
23693
|
+
function formatCensusLine(f) {
|
|
23694
|
+
return `[ledger-census] invoices=${f.invoices} payments=${f.payments} orphanPayments=${f.orphanPayments} storedBalanceProps=${f.storedBalanceProps} suspectDuplicates=${f.suspectDuplicates} declaredNotLive=${f.declaredNotLive.length === 0 ? "none" : f.declaredNotLive.join(",")}`;
|
|
23695
|
+
}
|
|
23696
|
+
|
|
23697
|
+
// app/lib/ledger-census.ts
|
|
23698
|
+
var TAG44 = "[ledger-census]";
|
|
23699
|
+
function toNum2(v) {
|
|
23700
|
+
if (typeof v === "number") return v;
|
|
23701
|
+
if (v && typeof v === "object" && "toNumber" in v) {
|
|
23702
|
+
return v.toNumber();
|
|
23703
|
+
}
|
|
23704
|
+
return 0;
|
|
23705
|
+
}
|
|
23706
|
+
async function runLedgerCensusOnce(session, now) {
|
|
23707
|
+
try {
|
|
23708
|
+
const counts = await session.run(
|
|
23709
|
+
`MATCH (i:Invoice|InboundInvoice) WITH count(i) AS invoices
|
|
23710
|
+
OPTIONAL MATCH (p:InvoicePayment)
|
|
23711
|
+
RETURN invoices, count(p) AS payments`
|
|
23712
|
+
);
|
|
23713
|
+
const orphans = await session.run(
|
|
23714
|
+
`MATCH (p:InvoicePayment)
|
|
23715
|
+
WHERE NOT ( (:Invoice|InboundInvoice)-[:HAS_PAYMENT]->(p) )
|
|
23716
|
+
RETURN count(p) AS orphanPayments`
|
|
23717
|
+
);
|
|
23718
|
+
const stored = await session.run(
|
|
23719
|
+
`MATCH (i:Invoice|InboundInvoice)
|
|
23720
|
+
WHERE i.outstanding IS NOT NULL OR i.balance IS NOT NULL OR i.amountPaid IS NOT NULL
|
|
23721
|
+
RETURN count(i) AS storedBalanceProps`
|
|
23722
|
+
);
|
|
23723
|
+
const keys = await session.run(
|
|
23724
|
+
`MATCH (i:Invoice|InboundInvoice)-[:HAS_PAYMENT]->(p:InvoicePayment)
|
|
23725
|
+
RETURN i.confirmationNumber AS invoiceId, p.paymentId AS paymentId,
|
|
23726
|
+
p.amount AS amount, p.date AS date`
|
|
23727
|
+
);
|
|
23728
|
+
const indexes = await session.run(`SHOW INDEXES YIELD name RETURN collect(name) AS names`);
|
|
23729
|
+
const live = new Set(indexes.records[0]?.get("names") ?? []);
|
|
23730
|
+
const finding = reconcileLedger(
|
|
23731
|
+
{
|
|
23732
|
+
invoices: toNum2(counts.records[0]?.get("invoices")),
|
|
23733
|
+
payments: toNum2(counts.records[0]?.get("payments")),
|
|
23734
|
+
orphanPayments: toNum2(orphans.records[0]?.get("orphanPayments")),
|
|
23735
|
+
storedBalanceProps: toNum2(stored.records[0]?.get("storedBalanceProps")),
|
|
23736
|
+
paymentKeys: keys.records.map((r) => ({
|
|
23737
|
+
invoiceId: r.get("invoiceId") ?? "",
|
|
23738
|
+
paymentId: r.get("paymentId") ?? "",
|
|
23739
|
+
amount: toNum2(r.get("amount")),
|
|
23740
|
+
date: r.get("date") ?? ""
|
|
23741
|
+
})),
|
|
23742
|
+
declaredNotLive: LEDGER_INDEX_NAMES.filter((n) => !live.has(n))
|
|
23743
|
+
},
|
|
23744
|
+
now
|
|
23745
|
+
);
|
|
23746
|
+
const line = formatCensusLine(finding);
|
|
23747
|
+
if (finding.alarm) console.error(`${line} alarm=true`);
|
|
23748
|
+
else console.log(line);
|
|
23749
|
+
return finding;
|
|
23750
|
+
} catch (err) {
|
|
23751
|
+
console.error(`${TAG44} error="${err instanceof Error ? err.message : String(err)}"`);
|
|
23752
|
+
return null;
|
|
23753
|
+
}
|
|
23754
|
+
}
|
|
23755
|
+
var DEFAULT_INTERVAL_MS2 = 15 * 60 * 1e3;
|
|
23756
|
+
function startLedgerCensus(openSession, opts = {}) {
|
|
23757
|
+
const intervalMs = opts.intervalMs ?? DEFAULT_INTERVAL_MS2;
|
|
23758
|
+
const tick = async () => {
|
|
23759
|
+
let session;
|
|
23760
|
+
try {
|
|
23761
|
+
session = openSession();
|
|
23762
|
+
} catch (err) {
|
|
23763
|
+
console.error(
|
|
23764
|
+
`${TAG44} open-session-failed error="${err instanceof Error ? err.message : String(err)}"`
|
|
23765
|
+
);
|
|
23766
|
+
return;
|
|
23767
|
+
}
|
|
23768
|
+
try {
|
|
23769
|
+
await runLedgerCensusOnce(session, Date.now());
|
|
23770
|
+
} catch (err) {
|
|
23771
|
+
console.error(
|
|
23772
|
+
`${TAG44} tick-failed error="${err instanceof Error ? err.message : String(err)}"`
|
|
23773
|
+
);
|
|
23774
|
+
} finally {
|
|
23775
|
+
try {
|
|
23776
|
+
await session.close();
|
|
23777
|
+
} catch {
|
|
23778
|
+
}
|
|
23779
|
+
}
|
|
23780
|
+
};
|
|
23781
|
+
void tick();
|
|
23782
|
+
const id = setInterval(() => {
|
|
23783
|
+
void tick();
|
|
23784
|
+
}, intervalMs);
|
|
23785
|
+
if (typeof id.unref === "function") {
|
|
23786
|
+
;
|
|
23787
|
+
id.unref();
|
|
23788
|
+
}
|
|
23789
|
+
return () => clearInterval(id);
|
|
23790
|
+
}
|
|
23791
|
+
|
|
23792
|
+
// app/lib/conversation-audit.ts
|
|
23793
|
+
var TAG45 = "[conversation-audit]";
|
|
23794
|
+
async function runConversationAudit() {
|
|
23795
|
+
const session = getSession();
|
|
23796
|
+
try {
|
|
23797
|
+
const res = await session.run(
|
|
23798
|
+
`MATCH (a:Conversation {channel: 'whatsapp'})
|
|
23799
|
+
WHERE a.channelAddress =~ '[0-9]+'
|
|
23800
|
+
WITH collect(a.channelAddress) AS anchored
|
|
23801
|
+
MATCH (c:Conversation {channel: 'whatsapp'})
|
|
23802
|
+
WITH anchored,
|
|
23803
|
+
count(*) AS total,
|
|
23804
|
+
sum(CASE WHEN c.channelAddress = 'default' THEN 1 ELSE 0 END) AS unpairable,
|
|
23805
|
+
collect(CASE WHEN c.channelAddress =~ 'default:[0-9]+'
|
|
23806
|
+
THEN substring(c.channelAddress, 8) END) AS forensic
|
|
23807
|
+
RETURN total,
|
|
23808
|
+
unpairable,
|
|
23809
|
+
size([p IN forensic WHERE p IS NOT NULL AND NOT p IN anchored]) AS unreconciled`,
|
|
23810
|
+
{}
|
|
23811
|
+
);
|
|
23812
|
+
const rec = res.records[0];
|
|
23813
|
+
const result = {
|
|
23814
|
+
total: Number(rec?.get("total") ?? 0),
|
|
23815
|
+
unreconciled: Number(rec?.get("unreconciled") ?? 0),
|
|
23816
|
+
unpairable: Number(rec?.get("unpairable") ?? 0)
|
|
23817
|
+
};
|
|
23818
|
+
console.error(
|
|
23819
|
+
`${TAG45} channel=whatsapp total=${result.total} unreconciled=${result.unreconciled} unpairable=${result.unpairable}`
|
|
23820
|
+
);
|
|
23821
|
+
return result;
|
|
23822
|
+
} catch (err) {
|
|
23823
|
+
const reason = err instanceof Error ? `${err.name}:${err.message.slice(0, 200)}` : String(err).slice(0, 200);
|
|
23824
|
+
console.error(`${TAG45} op=failed reason=${reason}`);
|
|
23825
|
+
return null;
|
|
23826
|
+
} finally {
|
|
23827
|
+
await session.close();
|
|
23828
|
+
}
|
|
23829
|
+
}
|
|
23830
|
+
|
|
23564
23831
|
// app/lib/graph-health.ts
|
|
23565
|
-
var
|
|
23832
|
+
var import_dist5 = __toESM(require_dist4(), 1);
|
|
23566
23833
|
var HOUR_MS = 60 * 60 * 1e3;
|
|
23567
23834
|
function renderLabelTop(rows) {
|
|
23568
23835
|
return rows.map((b) => {
|
|
@@ -23607,7 +23874,7 @@ async function runGraphHealthTick() {
|
|
|
23607
23874
|
console.error(
|
|
23608
23875
|
`[graph-health] userprofile-multi accounts=${upAccounts} top=${upTop.length > 0 ? upTop.join(",") : "none"}`
|
|
23609
23876
|
);
|
|
23610
|
-
const indexed = [...
|
|
23877
|
+
const indexed = [...import_dist5.VECTOR_INDEXED_LABELS];
|
|
23611
23878
|
const embCount = await session.run(
|
|
23612
23879
|
`MATCH (n) WHERE n.embedding IS NULL AND any(l IN labels(n) WHERE l IN $indexed)
|
|
23613
23880
|
RETURN count(n) AS total`,
|
|
@@ -24175,7 +24442,7 @@ var InboundHub = class {
|
|
|
24175
24442
|
};
|
|
24176
24443
|
|
|
24177
24444
|
// app/lib/whatsapp/gateway/wa-gateway.ts
|
|
24178
|
-
var
|
|
24445
|
+
var import_dist6 = __toESM(require_dist(), 1);
|
|
24179
24446
|
|
|
24180
24447
|
// node_modules/hono/dist/utils/stream.js
|
|
24181
24448
|
var StreamingApi = class {
|
|
@@ -24328,8 +24595,8 @@ var streamSSE = (c, cb, onError) => {
|
|
|
24328
24595
|
|
|
24329
24596
|
// app/lib/whatsapp/gateway/routes.ts
|
|
24330
24597
|
function createWaChannelRoutes(deps) {
|
|
24331
|
-
const
|
|
24332
|
-
|
|
24598
|
+
const app64 = new Hono();
|
|
24599
|
+
app64.get("/wa-channel/inbound", (c) => {
|
|
24333
24600
|
const senderId = c.req.query("senderId");
|
|
24334
24601
|
if (!senderId) return c.json({ error: "senderId required" }, 400);
|
|
24335
24602
|
return streamSSE(c, async (stream2) => {
|
|
@@ -24347,7 +24614,7 @@ function createWaChannelRoutes(deps) {
|
|
|
24347
24614
|
}
|
|
24348
24615
|
});
|
|
24349
24616
|
});
|
|
24350
|
-
|
|
24617
|
+
app64.post("/wa-channel/reply", async (c) => {
|
|
24351
24618
|
const body = await c.req.json().catch(() => null);
|
|
24352
24619
|
const senderId = body?.senderId;
|
|
24353
24620
|
const text = body?.text;
|
|
@@ -24368,7 +24635,7 @@ function createWaChannelRoutes(deps) {
|
|
|
24368
24635
|
console.error(`[whatsapp-native] op=reply-dispatch senderId=${senderId} bytes=${bytes}`);
|
|
24369
24636
|
return c.json({ ok: true });
|
|
24370
24637
|
});
|
|
24371
|
-
|
|
24638
|
+
app64.post("/wa-channel/reply-document", async (c) => {
|
|
24372
24639
|
const body = await c.req.json().catch(() => null);
|
|
24373
24640
|
const senderId = body?.senderId;
|
|
24374
24641
|
const files = body?.files;
|
|
@@ -24407,7 +24674,7 @@ function createWaChannelRoutes(deps) {
|
|
|
24407
24674
|
}
|
|
24408
24675
|
return c.json({ ok: true, results });
|
|
24409
24676
|
});
|
|
24410
|
-
|
|
24677
|
+
app64.post("/wa-channel/ready", async (c) => {
|
|
24411
24678
|
const body = await c.req.json().catch(() => null);
|
|
24412
24679
|
const senderId = body?.senderId;
|
|
24413
24680
|
if (typeof senderId !== "string") {
|
|
@@ -24416,7 +24683,7 @@ function createWaChannelRoutes(deps) {
|
|
|
24416
24683
|
deps.onReady?.(senderId);
|
|
24417
24684
|
return c.json({ ok: true });
|
|
24418
24685
|
});
|
|
24419
|
-
|
|
24686
|
+
app64.post("/wa-channel/received", async (c) => {
|
|
24420
24687
|
const body = await c.req.json().catch(() => null);
|
|
24421
24688
|
const senderId = body?.senderId;
|
|
24422
24689
|
const waMessageId = body?.waMessageId;
|
|
@@ -24426,7 +24693,7 @@ function createWaChannelRoutes(deps) {
|
|
|
24426
24693
|
deps.onReceived?.(senderId, waMessageId);
|
|
24427
24694
|
return c.json({ ok: true });
|
|
24428
24695
|
});
|
|
24429
|
-
|
|
24696
|
+
app64.post("/wa-channel/turn-end", async (c) => {
|
|
24430
24697
|
const body = await c.req.json().catch(() => null);
|
|
24431
24698
|
const senderId = body?.senderId;
|
|
24432
24699
|
const sessionId = body?.sessionId;
|
|
@@ -24459,7 +24726,7 @@ function createWaChannelRoutes(deps) {
|
|
|
24459
24726
|
console.error(`[whatsapp-native] op=turn-end sessionId=${sid} replied=no delivered=none`);
|
|
24460
24727
|
return c.json({ ok: true, delivered: "none" });
|
|
24461
24728
|
});
|
|
24462
|
-
return
|
|
24729
|
+
return app64;
|
|
24463
24730
|
}
|
|
24464
24731
|
|
|
24465
24732
|
// app/lib/whatsapp/gateway/wa-gateway.ts
|
|
@@ -24561,7 +24828,7 @@ var WaGateway = class {
|
|
|
24561
24828
|
const injected = res.block ? (res.block.match(/^- /gm) ?? []).length : 0;
|
|
24562
24829
|
const owner8 = res.ownerUserId ? res.ownerUserId.slice(0, 8) : "-";
|
|
24563
24830
|
console.error(
|
|
24564
|
-
`[preference-inject] op=inject channel=wa accountId=${input.effectiveAccountId} injected=${injected} owner=${owner8} source=${res.source} capped=${injected >=
|
|
24831
|
+
`[preference-inject] op=inject channel=wa accountId=${input.effectiveAccountId} injected=${injected} owner=${owner8} source=${res.source} capped=${injected >= import_dist6.INJECTION_RULE_CAP}`
|
|
24565
24832
|
);
|
|
24566
24833
|
}
|
|
24567
24834
|
this.hub.deliver(
|
|
@@ -24834,12 +25101,12 @@ var InboundHub2 = class {
|
|
|
24834
25101
|
};
|
|
24835
25102
|
|
|
24836
25103
|
// app/lib/webchat/gateway/webchat-gateway.ts
|
|
24837
|
-
var
|
|
25104
|
+
var import_dist7 = __toESM(require_dist(), 1);
|
|
24838
25105
|
|
|
24839
25106
|
// app/lib/webchat/gateway/routes.ts
|
|
24840
25107
|
function createWebchatChannelRoutes(deps) {
|
|
24841
|
-
const
|
|
24842
|
-
|
|
25108
|
+
const app64 = new Hono();
|
|
25109
|
+
app64.get("/webchat-channel/inbound", (c) => {
|
|
24843
25110
|
const key = c.req.query("key");
|
|
24844
25111
|
if (!key) return c.json({ error: "key required" }, 400);
|
|
24845
25112
|
return streamSSE(c, async (stream2) => {
|
|
@@ -24857,7 +25124,7 @@ function createWebchatChannelRoutes(deps) {
|
|
|
24857
25124
|
}
|
|
24858
25125
|
});
|
|
24859
25126
|
});
|
|
24860
|
-
|
|
25127
|
+
app64.post("/webchat-channel/reply", async (c) => {
|
|
24861
25128
|
const body = await c.req.json().catch(() => null);
|
|
24862
25129
|
const key = body?.key;
|
|
24863
25130
|
const text = body?.text;
|
|
@@ -24867,7 +25134,7 @@ function createWebchatChannelRoutes(deps) {
|
|
|
24867
25134
|
deps.onReply?.(key, text);
|
|
24868
25135
|
return c.json({ ok: true });
|
|
24869
25136
|
});
|
|
24870
|
-
|
|
25137
|
+
app64.post("/webchat-channel/connector-auth", async (c) => {
|
|
24871
25138
|
const body = await c.req.json().catch(() => null);
|
|
24872
25139
|
const key = body?.key;
|
|
24873
25140
|
const sessionId = body?.sessionId;
|
|
@@ -24880,7 +25147,7 @@ function createWebchatChannelRoutes(deps) {
|
|
|
24880
25147
|
const result = await deps.onConnectorAuth({ key, sessionId, name, completed });
|
|
24881
25148
|
return c.json(result);
|
|
24882
25149
|
});
|
|
24883
|
-
|
|
25150
|
+
app64.post("/webchat-channel/ready", async (c) => {
|
|
24884
25151
|
const body = await c.req.json().catch(() => null);
|
|
24885
25152
|
const key = body?.key;
|
|
24886
25153
|
if (typeof key !== "string") {
|
|
@@ -24889,7 +25156,7 @@ function createWebchatChannelRoutes(deps) {
|
|
|
24889
25156
|
deps.onReady?.(key);
|
|
24890
25157
|
return c.json({ ok: true });
|
|
24891
25158
|
});
|
|
24892
|
-
|
|
25159
|
+
app64.post("/webchat-channel/permission-request", async (c) => {
|
|
24893
25160
|
const body = await c.req.json().catch(() => null);
|
|
24894
25161
|
const key = body?.key;
|
|
24895
25162
|
const requestId = body?.request_id;
|
|
@@ -24903,7 +25170,7 @@ function createWebchatChannelRoutes(deps) {
|
|
|
24903
25170
|
const verdict = await deps.awaitPermissionVerdict({ key, requestId, toolName, description, inputPreview });
|
|
24904
25171
|
return c.json(verdict);
|
|
24905
25172
|
});
|
|
24906
|
-
|
|
25173
|
+
app64.post("/webchat-channel/received", async (c) => {
|
|
24907
25174
|
const body = await c.req.json().catch(() => null);
|
|
24908
25175
|
const key = body?.key;
|
|
24909
25176
|
const messageId = body?.messageId;
|
|
@@ -24913,7 +25180,7 @@ function createWebchatChannelRoutes(deps) {
|
|
|
24913
25180
|
deps.onReceived?.(key, messageId);
|
|
24914
25181
|
return c.json({ ok: true });
|
|
24915
25182
|
});
|
|
24916
|
-
|
|
25183
|
+
app64.post("/webchat-channel/turn-end", async (c) => {
|
|
24917
25184
|
const body = await c.req.json().catch(() => null);
|
|
24918
25185
|
const key = body?.key;
|
|
24919
25186
|
const sessionId = body?.sessionId;
|
|
@@ -24936,7 +25203,7 @@ function createWebchatChannelRoutes(deps) {
|
|
|
24936
25203
|
console.error(`[webchat-native] op=turn-end channel=webchat key=${k} sessionId=${sid} replied=no delivered=none`);
|
|
24937
25204
|
return c.json({ ok: true, delivered: "none" });
|
|
24938
25205
|
});
|
|
24939
|
-
return
|
|
25206
|
+
return app64;
|
|
24940
25207
|
}
|
|
24941
25208
|
|
|
24942
25209
|
// app/lib/webchat/gateway/webchat-gateway.ts
|
|
@@ -25282,7 +25549,7 @@ var WebchatGateway = class _WebchatGateway {
|
|
|
25282
25549
|
const injected = res.block ? (res.block.match(/^- /gm) ?? []).length : 0;
|
|
25283
25550
|
const owner8 = res.ownerUserId ? res.ownerUserId.slice(0, 8) : "-";
|
|
25284
25551
|
console.error(
|
|
25285
|
-
`[preference-inject] op=inject channel=web accountId=${input.accountId} injected=${injected} owner=${owner8} source=${res.source} capped=${injected >=
|
|
25552
|
+
`[preference-inject] op=inject channel=web accountId=${input.accountId} injected=${injected} owner=${owner8} source=${res.source} capped=${injected >= import_dist7.INJECTION_RULE_CAP}`
|
|
25286
25553
|
);
|
|
25287
25554
|
}
|
|
25288
25555
|
this.hub.deliver(
|
|
@@ -25651,14 +25918,14 @@ function makeFileDelivery(opts) {
|
|
|
25651
25918
|
}
|
|
25652
25919
|
|
|
25653
25920
|
// app/lib/webchat/file-delivery.ts
|
|
25654
|
-
var
|
|
25921
|
+
var TAG46 = "[webchat-adaptor]";
|
|
25655
25922
|
function platformRoot2() {
|
|
25656
25923
|
return process.env.MAXY_PLATFORM_ROOT || "";
|
|
25657
25924
|
}
|
|
25658
25925
|
function makeWebchatSendFile(entry) {
|
|
25659
25926
|
return async (filePath) => {
|
|
25660
25927
|
if (!entry.accountId) {
|
|
25661
|
-
console.error(`${
|
|
25928
|
+
console.error(`${TAG46} file-delivery reject reason=no-account sender=${entry.senderId}`);
|
|
25662
25929
|
return { ok: false, error: "no-account" };
|
|
25663
25930
|
}
|
|
25664
25931
|
const accountDir = resolve32(platformRoot2(), "..", "data/accounts", entry.accountId);
|
|
@@ -25666,14 +25933,14 @@ function makeWebchatSendFile(entry) {
|
|
|
25666
25933
|
const resolved = realpathSync8(filePath);
|
|
25667
25934
|
const accountResolved = realpathSync8(accountDir);
|
|
25668
25935
|
if (!resolved.startsWith(accountResolved + "/")) {
|
|
25669
|
-
console.error(`${
|
|
25936
|
+
console.error(`${TAG46} file-delivery reject reason=outside_account_directory sender=${entry.senderId}`);
|
|
25670
25937
|
return { ok: false, error: "outside-account" };
|
|
25671
25938
|
}
|
|
25672
25939
|
return { ok: true };
|
|
25673
25940
|
} catch (err) {
|
|
25674
25941
|
const code = err.code;
|
|
25675
25942
|
console.error(
|
|
25676
|
-
`${
|
|
25943
|
+
`${TAG46} file-delivery reject reason=${code === "ENOENT" ? "not-found" : "path-error"} sender=${entry.senderId}`
|
|
25677
25944
|
);
|
|
25678
25945
|
return { ok: false, error: code === "ENOENT" ? "not-found" : "path-error" };
|
|
25679
25946
|
}
|
|
@@ -25682,7 +25949,7 @@ function makeWebchatSendFile(entry) {
|
|
|
25682
25949
|
function makeWebchatFileDelivery(entry) {
|
|
25683
25950
|
return makeFileDelivery({
|
|
25684
25951
|
entry,
|
|
25685
|
-
tag:
|
|
25952
|
+
tag: TAG46,
|
|
25686
25953
|
channel: "webchat",
|
|
25687
25954
|
sendFile: makeWebchatSendFile(entry),
|
|
25688
25955
|
deferUntilVerdict: true
|
|
@@ -25744,7 +26011,7 @@ function buildPublicWebchatSpawnRequest(input) {
|
|
|
25744
26011
|
}
|
|
25745
26012
|
|
|
25746
26013
|
// app/lib/whatsapp/inbound/file-delivery-bridge.ts
|
|
25747
|
-
var
|
|
26014
|
+
var TAG47 = "[whatsapp-adaptor]";
|
|
25748
26015
|
var SEND_USER_FILE2 = "SendUserFile";
|
|
25749
26016
|
var WHATSAPP_SEND_DOCUMENT = "whatsapp-send-document";
|
|
25750
26017
|
function platformRoot3() {
|
|
@@ -25762,7 +26029,7 @@ function makeWhatsAppSendFile(entry, maxyAccountId) {
|
|
|
25762
26029
|
});
|
|
25763
26030
|
if (result.ok) return { ok: true };
|
|
25764
26031
|
console.error(
|
|
25765
|
-
`${
|
|
26032
|
+
`${TAG47} file-delivery reject reason=send-failed sender=${entry.senderId} status=${result.status} message=${result.error}`
|
|
25766
26033
|
);
|
|
25767
26034
|
return { ok: false, error: result.error };
|
|
25768
26035
|
};
|
|
@@ -25770,7 +26037,7 @@ function makeWhatsAppSendFile(entry, maxyAccountId) {
|
|
|
25770
26037
|
function makeWhatsAppFileDelivery(entry, maxyAccountId) {
|
|
25771
26038
|
const shared = makeFileDelivery({
|
|
25772
26039
|
entry,
|
|
25773
|
-
tag:
|
|
26040
|
+
tag: TAG47,
|
|
25774
26041
|
channel: "whatsapp",
|
|
25775
26042
|
sendFile: makeWhatsAppSendFile(entry, maxyAccountId)
|
|
25776
26043
|
});
|
|
@@ -25805,7 +26072,7 @@ function makeWhatsAppFileDelivery(entry, maxyAccountId) {
|
|
|
25805
26072
|
if (!delivered) {
|
|
25806
26073
|
const fileField = call.filePath !== void 0 ? ` file=${call.filePath}` : "";
|
|
25807
26074
|
console.error(
|
|
25808
|
-
`${
|
|
26075
|
+
`${TAG47} file-delivery-unreconciled sender=${entry.senderId} sessionId=${sid} tool=${WHATSAPP_SEND_DOCUMENT}${fileField}`
|
|
25809
26076
|
);
|
|
25810
26077
|
}
|
|
25811
26078
|
}
|
|
@@ -25987,12 +26254,12 @@ var InboundHub3 = class {
|
|
|
25987
26254
|
};
|
|
25988
26255
|
|
|
25989
26256
|
// app/lib/telegram/gateway/telegram-gateway.ts
|
|
25990
|
-
var
|
|
26257
|
+
var import_dist8 = __toESM(require_dist(), 1);
|
|
25991
26258
|
|
|
25992
26259
|
// app/lib/telegram/gateway/routes.ts
|
|
25993
26260
|
function createTelegramChannelRoutes(deps) {
|
|
25994
|
-
const
|
|
25995
|
-
|
|
26261
|
+
const app64 = new Hono();
|
|
26262
|
+
app64.get("/tg-channel/inbound", (c) => {
|
|
25996
26263
|
const key = c.req.query("key");
|
|
25997
26264
|
if (!key) return c.json({ error: "key required" }, 400);
|
|
25998
26265
|
return streamSSE(c, async (stream2) => {
|
|
@@ -26010,7 +26277,7 @@ function createTelegramChannelRoutes(deps) {
|
|
|
26010
26277
|
}
|
|
26011
26278
|
});
|
|
26012
26279
|
});
|
|
26013
|
-
|
|
26280
|
+
app64.post("/tg-channel/reply", async (c) => {
|
|
26014
26281
|
const body = await c.req.json().catch(() => null);
|
|
26015
26282
|
const key = body?.key;
|
|
26016
26283
|
const text = body?.text;
|
|
@@ -26026,7 +26293,7 @@ function createTelegramChannelRoutes(deps) {
|
|
|
26026
26293
|
console.error(`[telegram-native] op=reply key=${key} bytes=${Buffer.byteLength(text, "utf8")}`);
|
|
26027
26294
|
return c.json({ ok: true });
|
|
26028
26295
|
});
|
|
26029
|
-
|
|
26296
|
+
app64.post("/tg-channel/ready", async (c) => {
|
|
26030
26297
|
const body = await c.req.json().catch(() => null);
|
|
26031
26298
|
const key = body?.key;
|
|
26032
26299
|
if (typeof key !== "string") {
|
|
@@ -26035,7 +26302,7 @@ function createTelegramChannelRoutes(deps) {
|
|
|
26035
26302
|
deps.onReady?.(key);
|
|
26036
26303
|
return c.json({ ok: true });
|
|
26037
26304
|
});
|
|
26038
|
-
|
|
26305
|
+
app64.post("/tg-channel/received", async (c) => {
|
|
26039
26306
|
const body = await c.req.json().catch(() => null);
|
|
26040
26307
|
const key = body?.key;
|
|
26041
26308
|
const messageId = body?.messageId;
|
|
@@ -26045,7 +26312,7 @@ function createTelegramChannelRoutes(deps) {
|
|
|
26045
26312
|
deps.onReceived?.(key, messageId);
|
|
26046
26313
|
return c.json({ ok: true });
|
|
26047
26314
|
});
|
|
26048
|
-
|
|
26315
|
+
app64.post("/tg-channel/turn-end", async (c) => {
|
|
26049
26316
|
const body = await c.req.json().catch(() => null);
|
|
26050
26317
|
const key = body?.key;
|
|
26051
26318
|
const sessionId = body?.sessionId;
|
|
@@ -26078,7 +26345,7 @@ function createTelegramChannelRoutes(deps) {
|
|
|
26078
26345
|
console.error(`[telegram-native] op=turn-end key=${key} sessionId=${sid} replied=no delivered=none`);
|
|
26079
26346
|
return c.json({ ok: true, delivered: "none" });
|
|
26080
26347
|
});
|
|
26081
|
-
return
|
|
26348
|
+
return app64;
|
|
26082
26349
|
}
|
|
26083
26350
|
|
|
26084
26351
|
// app/lib/telegram/gateway/telegram-gateway.ts
|
|
@@ -26143,7 +26410,7 @@ var TelegramGateway = class {
|
|
|
26143
26410
|
const injected = res.block ? (res.block.match(/^- /gm) ?? []).length : 0;
|
|
26144
26411
|
const owner8 = res.ownerUserId ? res.ownerUserId.slice(0, 8) : "-";
|
|
26145
26412
|
console.error(
|
|
26146
|
-
`[preference-inject] op=inject channel=tg accountId=${input.accountId} injected=${injected} owner=${owner8} source=${res.source} capped=${injected >=
|
|
26413
|
+
`[preference-inject] op=inject channel=tg accountId=${input.accountId} injected=${injected} owner=${owner8} source=${res.source} capped=${injected >= import_dist8.INJECTION_RULE_CAP}`
|
|
26147
26414
|
);
|
|
26148
26415
|
}
|
|
26149
26416
|
this.hub.deliver(
|
|
@@ -26209,7 +26476,7 @@ function buildTelegramSpawnRequest(input) {
|
|
|
26209
26476
|
import { realpathSync as realpathSync9 } from "fs";
|
|
26210
26477
|
import { readFile as readFile7, stat as stat7 } from "fs/promises";
|
|
26211
26478
|
import { resolve as resolve33, basename as basename11 } from "path";
|
|
26212
|
-
var
|
|
26479
|
+
var TAG48 = "[telegram:outbound]";
|
|
26213
26480
|
var TELEGRAM_DOCUMENT_MAX_BYTES = 50 * 1024 * 1024;
|
|
26214
26481
|
async function sendTelegramDocument(input) {
|
|
26215
26482
|
const { botToken, chatId, filePath, caption, maxyAccountId, platformRoot: platformRoot5 } = input;
|
|
@@ -26225,16 +26492,16 @@ async function sendTelegramDocument(input) {
|
|
|
26225
26492
|
resolvedPath = realpathSync9(filePath);
|
|
26226
26493
|
const accountResolved = realpathSync9(accountDir);
|
|
26227
26494
|
if (!resolvedPath.startsWith(accountResolved + "/")) {
|
|
26228
|
-
console.error(`${
|
|
26495
|
+
console.error(`${TAG48} document REJECTED reason=outside_account_directory maxyAccountId=${maxyAccountId}`);
|
|
26229
26496
|
return { ok: false, status: 403, error: "Access denied: file is outside the account directory" };
|
|
26230
26497
|
}
|
|
26231
26498
|
} catch (err) {
|
|
26232
26499
|
const code = err.code;
|
|
26233
26500
|
if (code === "ENOENT") {
|
|
26234
|
-
console.error(`${
|
|
26501
|
+
console.error(`${TAG48} document ENOENT path=${filePath}`);
|
|
26235
26502
|
return { ok: false, status: 404, error: `File not found: ${filePath}` };
|
|
26236
26503
|
}
|
|
26237
|
-
console.error(`${
|
|
26504
|
+
console.error(`${TAG48} document path error: ${String(err)}`);
|
|
26238
26505
|
return { ok: false, status: 500, error: String(err) };
|
|
26239
26506
|
}
|
|
26240
26507
|
const fileStat = await stat7(resolvedPath);
|
|
@@ -26267,13 +26534,13 @@ async function sendTelegramDocument(input) {
|
|
|
26267
26534
|
error = e instanceof Error ? e.message : String(e);
|
|
26268
26535
|
}
|
|
26269
26536
|
console.error(
|
|
26270
|
-
`${
|
|
26537
|
+
`${TAG48} sent document to=${chatId} file=${filename} bytes=${fileStat.size} ok=${ok}` + (messageId !== void 0 ? ` id=${messageId}` : "")
|
|
26271
26538
|
);
|
|
26272
26539
|
return ok ? { ok: true, messageId } : { ok: false, status: 500, error };
|
|
26273
26540
|
}
|
|
26274
26541
|
|
|
26275
26542
|
// app/lib/telegram/outbound/file-delivery.ts
|
|
26276
|
-
var
|
|
26543
|
+
var TAG49 = "[telegram:outbound]";
|
|
26277
26544
|
function platformRoot4() {
|
|
26278
26545
|
return process.env.MAXY_PLATFORM_ROOT || "";
|
|
26279
26546
|
}
|
|
@@ -26285,11 +26552,11 @@ function makeTelegramSendFile(entry) {
|
|
|
26285
26552
|
botToken = (entry.role === "admin" ? tg?.adminBotToken : tg?.publicBotToken) ?? null;
|
|
26286
26553
|
}
|
|
26287
26554
|
if (!botToken) {
|
|
26288
|
-
console.error(`${
|
|
26555
|
+
console.error(`${TAG49} file-delivery reject reason=no-bot-token sender=${entry.senderId} role=${entry.role}`);
|
|
26289
26556
|
return { ok: false, error: "no-bot-token" };
|
|
26290
26557
|
}
|
|
26291
26558
|
if (entry.replyTarget == null) {
|
|
26292
|
-
console.error(`${
|
|
26559
|
+
console.error(`${TAG49} file-delivery reject reason=no-reply-target sender=${entry.senderId} role=${entry.role}`);
|
|
26293
26560
|
return { ok: false, error: "no-reply-target" };
|
|
26294
26561
|
}
|
|
26295
26562
|
const result = await sendTelegramDocument({
|
|
@@ -26306,7 +26573,7 @@ function makeTelegramSendFile(entry) {
|
|
|
26306
26573
|
function makeTelegramFileDelivery(entry) {
|
|
26307
26574
|
return makeFileDelivery({
|
|
26308
26575
|
entry,
|
|
26309
|
-
tag:
|
|
26576
|
+
tag: TAG49,
|
|
26310
26577
|
channel: "telegram",
|
|
26311
26578
|
sendFile: makeTelegramSendFile(entry)
|
|
26312
26579
|
});
|
|
@@ -26356,7 +26623,7 @@ function telegramServerPath() {
|
|
|
26356
26623
|
|
|
26357
26624
|
// app/lib/channel-pty-bridge/public-session-end-review.ts
|
|
26358
26625
|
import { randomUUID as randomUUID16 } from "crypto";
|
|
26359
|
-
var
|
|
26626
|
+
var TAG50 = "[public-session-review]";
|
|
26360
26627
|
var CONSUMED_CAP = 500;
|
|
26361
26628
|
var consumed = /* @__PURE__ */ new Set();
|
|
26362
26629
|
function consumeOnce(sessionId) {
|
|
@@ -26383,7 +26650,7 @@ async function fetchJsonl(sessionId) {
|
|
|
26383
26650
|
return await res.text();
|
|
26384
26651
|
} catch (err) {
|
|
26385
26652
|
console.error(
|
|
26386
|
-
`${
|
|
26653
|
+
`${TAG50} jsonl-fetch-failed sessionId=${sessionId} err="${err instanceof Error ? err.message : String(err)}"`
|
|
26387
26654
|
);
|
|
26388
26655
|
return null;
|
|
26389
26656
|
}
|
|
@@ -26407,7 +26674,7 @@ async function fetchPriorWrites(sliceToken, accountId) {
|
|
|
26407
26674
|
const res = await fetch(url);
|
|
26408
26675
|
if (!res.ok) {
|
|
26409
26676
|
console.error(
|
|
26410
|
-
`${
|
|
26677
|
+
`${TAG50} prior-writes-fetch-failed sliceToken=${sliceToken.slice(0, 8)} status=${res.status}`
|
|
26411
26678
|
);
|
|
26412
26679
|
return [];
|
|
26413
26680
|
}
|
|
@@ -26415,7 +26682,7 @@ async function fetchPriorWrites(sliceToken, accountId) {
|
|
|
26415
26682
|
return Array.isArray(body.writes) ? body.writes : [];
|
|
26416
26683
|
} catch (err) {
|
|
26417
26684
|
console.error(
|
|
26418
|
-
`${
|
|
26685
|
+
`${TAG50} prior-writes-fetch-threw sliceToken=${sliceToken.slice(0, 8)} err="${err instanceof Error ? err.message : String(err)}"`
|
|
26419
26686
|
);
|
|
26420
26687
|
return [];
|
|
26421
26688
|
}
|
|
@@ -26444,7 +26711,7 @@ function composeInitialMessage(input) {
|
|
|
26444
26711
|
}
|
|
26445
26712
|
async function dispatchReviewer(input, initialMessage) {
|
|
26446
26713
|
const sessionId = randomUUID16();
|
|
26447
|
-
console.log(`${
|
|
26714
|
+
console.log(`${TAG50} route target=rc-spawn sessionId=${sessionId.slice(0, 8)} sourceSession=${input.sessionId.slice(0, 8)}`);
|
|
26448
26715
|
const spawned = await managerRcSpawn({
|
|
26449
26716
|
sessionId,
|
|
26450
26717
|
initialMessage,
|
|
@@ -26464,21 +26731,21 @@ async function firePublicSessionEndReview(input) {
|
|
|
26464
26731
|
const dispatchedAt = Date.now();
|
|
26465
26732
|
if (consumed.has(input.sessionId)) {
|
|
26466
26733
|
console.log(
|
|
26467
|
-
`${
|
|
26734
|
+
`${TAG50} dispatchFor=${input.dispatchFor} sessionId=${input.sessionId} sliceToken=${sliceShort} personId=${personField} result=skipped-already-reviewed`
|
|
26468
26735
|
);
|
|
26469
26736
|
return;
|
|
26470
26737
|
}
|
|
26471
26738
|
const jsonl = await fetchJsonl(input.sessionId);
|
|
26472
26739
|
if (!jsonl) {
|
|
26473
26740
|
console.log(
|
|
26474
|
-
`${
|
|
26741
|
+
`${TAG50} dispatchFor=${input.dispatchFor} sessionId=${input.sessionId} sliceToken=${sliceShort} personId=${personField} result=skipped-jsonl-missing`
|
|
26475
26742
|
);
|
|
26476
26743
|
return;
|
|
26477
26744
|
}
|
|
26478
26745
|
const operatorTurns = countOperatorTurns(jsonl);
|
|
26479
26746
|
if (operatorTurns === 0) {
|
|
26480
26747
|
console.log(
|
|
26481
|
-
`${
|
|
26748
|
+
`${TAG50} dispatchFor=${input.dispatchFor} sessionId=${input.sessionId} sliceToken=${sliceShort} personId=${personField} result=skipped-no-turns`
|
|
26482
26749
|
);
|
|
26483
26750
|
return;
|
|
26484
26751
|
}
|
|
@@ -26492,28 +26759,28 @@ async function firePublicSessionEndReview(input) {
|
|
|
26492
26759
|
});
|
|
26493
26760
|
if (!consumeOnce(input.sessionId)) {
|
|
26494
26761
|
console.log(
|
|
26495
|
-
`${
|
|
26762
|
+
`${TAG50} dispatchFor=${input.dispatchFor} sessionId=${input.sessionId} sliceToken=${sliceShort} personId=${personField} result=skipped-already-reviewed`
|
|
26496
26763
|
);
|
|
26497
26764
|
return;
|
|
26498
26765
|
}
|
|
26499
26766
|
const dispatched = await dispatchReviewer(input, initialMessage);
|
|
26500
26767
|
if (!dispatched.ok) {
|
|
26501
26768
|
console.error(
|
|
26502
|
-
`${
|
|
26769
|
+
`${TAG50} dispatchFor=${input.dispatchFor} sessionId=${input.sessionId} sliceToken=${sliceShort} personId=${personField} result=skipped-spawn-failed reason=${dispatched.reason}`
|
|
26503
26770
|
);
|
|
26504
26771
|
return;
|
|
26505
26772
|
}
|
|
26506
26773
|
console.log(
|
|
26507
|
-
`${
|
|
26774
|
+
`${TAG50} dispatchFor=${input.dispatchFor} sessionId=${input.sessionId} sliceToken=${sliceShort} personId=${personField} result=dispatched managerSessionId=${dispatched.managerSessionId} operatorTurns=${operatorTurns} priorWrites=${priorWrites.length} ms=${Date.now() - dispatchedAt}`
|
|
26508
26775
|
);
|
|
26509
26776
|
}
|
|
26510
26777
|
|
|
26511
26778
|
// app/lib/whatsapp/inbound/resolve-client-graph-owner.ts
|
|
26512
|
-
var
|
|
26779
|
+
var import_dist9 = __toESM(require_dist(), 1);
|
|
26513
26780
|
async function resolveClientOwnerUserId(accountId, deps = {}) {
|
|
26514
26781
|
const listAccounts = deps.listAccounts ?? listValidAccounts;
|
|
26515
26782
|
const getSession4 = deps.getSession ?? getSession;
|
|
26516
|
-
const resolveOwner2 = deps.resolveOwner ??
|
|
26783
|
+
const resolveOwner2 = deps.resolveOwner ?? import_dist9.resolveOwnerUserId;
|
|
26517
26784
|
const role = listAccounts().find((a) => a.accountId === accountId)?.config.role;
|
|
26518
26785
|
if (role !== "client") return null;
|
|
26519
26786
|
const session = getSession4();
|
|
@@ -26944,14 +27211,14 @@ watchFile(ALIAS_DOMAINS_PATH, { interval: 2e3 }, () => {
|
|
|
26944
27211
|
function isPublicHost(host) {
|
|
26945
27212
|
return host.startsWith("public.") || aliasDomains.has(host);
|
|
26946
27213
|
}
|
|
26947
|
-
var
|
|
27214
|
+
var app63 = new Hono();
|
|
26948
27215
|
var nativeFileFollowers = /* @__PURE__ */ new Map();
|
|
26949
27216
|
var webchatFileFollowers = /* @__PURE__ */ new Map();
|
|
26950
27217
|
async function fetchAccountStandingRules(accountId) {
|
|
26951
27218
|
const session = getSession();
|
|
26952
27219
|
try {
|
|
26953
|
-
const res = await (0,
|
|
26954
|
-
return { block: (0,
|
|
27220
|
+
const res = await (0, import_dist10.resolveActiveRules)(session, accountId);
|
|
27221
|
+
return { block: (0, import_dist10.formatStandingRulesBlock)(res.rules), ownerUserId: res.ownerUserId, source: res.source };
|
|
26955
27222
|
} catch (err) {
|
|
26956
27223
|
console.error(
|
|
26957
27224
|
`[preference-inject] op=fetch-failed accountId=${accountId} error=${err instanceof Error ? err.message : String(err)}`
|
|
@@ -27052,6 +27319,13 @@ var waGateway = new WaGateway({
|
|
|
27052
27319
|
console.error(`[whatsapp-native] op=account-manager-route senderId=${senderId} managesAccount=${managesAccount} effectiveAccount=${effectiveAccountId} source=gate`);
|
|
27053
27320
|
}
|
|
27054
27321
|
const req = buildWaSpawnRequest({ accountId: effectiveAccountId, senderId, role, personId, gatewayUrl, serverPath });
|
|
27322
|
+
await ensureSessionConversation({
|
|
27323
|
+
accountId: effectiveAccountId,
|
|
27324
|
+
sessionId: req.sessionId,
|
|
27325
|
+
channel: "whatsapp",
|
|
27326
|
+
channelAddress: senderId,
|
|
27327
|
+
agentType: role === "admin" ? "admin" : "public"
|
|
27328
|
+
});
|
|
27055
27329
|
let userId = role === "admin" ? resolveAdminUserId({ accountId: effectiveAccountId, senderPhone: senderId }) ?? (ownerSelfPhone ? resolveOwnerUserId(effectiveAccountId) ?? void 0 : void 0) : void 0;
|
|
27056
27330
|
let graphOwnerResolved = false;
|
|
27057
27331
|
if (role === "admin" && userId === void 0) {
|
|
@@ -27090,7 +27364,7 @@ var waGateway = new WaGateway({
|
|
|
27090
27364
|
nativeFileFollowers.set(senderId, ac);
|
|
27091
27365
|
}
|
|
27092
27366
|
});
|
|
27093
|
-
|
|
27367
|
+
app63.route("/", waGateway.routes());
|
|
27094
27368
|
waGateway.startSweeper();
|
|
27095
27369
|
function runDuplicateSenderAudit() {
|
|
27096
27370
|
try {
|
|
@@ -27208,7 +27482,7 @@ var webchatGateway = new WebchatGateway({
|
|
|
27208
27482
|
firePublicSessionEndReview: (input) => firePublicSessionEndReview(input)
|
|
27209
27483
|
});
|
|
27210
27484
|
setWebchatGateway(webchatGateway);
|
|
27211
|
-
|
|
27485
|
+
app63.route("/", webchatGateway.routes());
|
|
27212
27486
|
webchatGateway.startSweeper();
|
|
27213
27487
|
webchatGateway.startPublicReaper();
|
|
27214
27488
|
var telegramFileFollowers = /* @__PURE__ */ new Map();
|
|
@@ -27242,7 +27516,7 @@ var telegramGateway = new TelegramGateway({
|
|
|
27242
27516
|
}
|
|
27243
27517
|
});
|
|
27244
27518
|
setTelegramGateway(telegramGateway);
|
|
27245
|
-
|
|
27519
|
+
app63.route("/", telegramGateway.routes());
|
|
27246
27520
|
telegramGateway.startSweeper();
|
|
27247
27521
|
var chatRoutes = createChatRoutes({
|
|
27248
27522
|
handleInbound: (input) => webchatGateway.handleInbound(input),
|
|
@@ -27276,19 +27550,19 @@ var scheduleInjectRoutes = createScheduleInjectRoutes({
|
|
|
27276
27550
|
return managed.account;
|
|
27277
27551
|
}
|
|
27278
27552
|
});
|
|
27279
|
-
|
|
27280
|
-
|
|
27553
|
+
app63.route("/api/channel/schedule-inject", scheduleInjectRoutes);
|
|
27554
|
+
app63.use("*", clientIpMiddleware);
|
|
27281
27555
|
function allowsSameOriginFraming(path3) {
|
|
27282
27556
|
return path3 === "/vnc-viewer.html" || path3.startsWith("/api/admin/attachment/") || path3.startsWith("/api/public-reader/attachment/") || path3 === "/api/admin/files/download";
|
|
27283
27557
|
}
|
|
27284
|
-
|
|
27558
|
+
app63.use("*", async (c, next) => {
|
|
27285
27559
|
await next();
|
|
27286
27560
|
c.header("X-Content-Type-Options", "nosniff");
|
|
27287
27561
|
c.header("Referrer-Policy", "strict-origin-when-cross-origin");
|
|
27288
27562
|
c.header("X-Frame-Options", allowsSameOriginFraming(c.req.path) ? "SAMEORIGIN" : "DENY");
|
|
27289
27563
|
});
|
|
27290
27564
|
var HTTP_LOG_PATHS = /* @__PURE__ */ new Set(["/vnc-viewer.html", "/vnc-popout.html"]);
|
|
27291
|
-
|
|
27565
|
+
app63.use("*", async (c, next) => {
|
|
27292
27566
|
if (!HTTP_LOG_PATHS.has(c.req.path)) {
|
|
27293
27567
|
await next();
|
|
27294
27568
|
return;
|
|
@@ -27306,7 +27580,7 @@ app62.use("*", async (c, next) => {
|
|
|
27306
27580
|
});
|
|
27307
27581
|
}
|
|
27308
27582
|
});
|
|
27309
|
-
|
|
27583
|
+
app63.use("*", async (c, next) => {
|
|
27310
27584
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
27311
27585
|
if (isOperatorHost(host, getOperatorDomains()) || !isPublicHost(host)) {
|
|
27312
27586
|
await next();
|
|
@@ -27344,7 +27618,7 @@ function resolveRemoteAuthOpts(c) {
|
|
|
27344
27618
|
return { ...brandLoginOpts, origin };
|
|
27345
27619
|
}
|
|
27346
27620
|
var MAX_LOGIN_BODY = 8 * 1024;
|
|
27347
|
-
|
|
27621
|
+
app63.post("/__remote-auth/login", async (c) => {
|
|
27348
27622
|
const client = clientFrom(c);
|
|
27349
27623
|
const clientIp = client.ip || "unknown";
|
|
27350
27624
|
if (!requestIsTlsTerminated(c)) {
|
|
@@ -27389,7 +27663,7 @@ app62.post("/__remote-auth/login", async (c) => {
|
|
|
27389
27663
|
}
|
|
27390
27664
|
});
|
|
27391
27665
|
});
|
|
27392
|
-
|
|
27666
|
+
app63.get("/__remote-auth/logout", (c) => {
|
|
27393
27667
|
const client = clientFrom(c);
|
|
27394
27668
|
const clientIp = client.ip || "unknown";
|
|
27395
27669
|
console.error(`[remote-auth] logout ip=${clientIp}`);
|
|
@@ -27402,7 +27676,7 @@ app62.get("/__remote-auth/logout", (c) => {
|
|
|
27402
27676
|
}
|
|
27403
27677
|
});
|
|
27404
27678
|
});
|
|
27405
|
-
|
|
27679
|
+
app63.post("/__remote-auth/change-password", async (c) => {
|
|
27406
27680
|
const client = clientFrom(c);
|
|
27407
27681
|
const clientIp = client.ip || "unknown";
|
|
27408
27682
|
const rateLimited = checkRateLimit(client);
|
|
@@ -27461,13 +27735,13 @@ app62.post("/__remote-auth/change-password", async (c) => {
|
|
|
27461
27735
|
return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(c), mode: "change", changeError: "Failed to save password", redirect }), 200);
|
|
27462
27736
|
}
|
|
27463
27737
|
});
|
|
27464
|
-
|
|
27738
|
+
app63.get("/__remote-auth/setup", (c) => {
|
|
27465
27739
|
if (isRemoteAuthConfigured()) {
|
|
27466
27740
|
return c.redirect("/");
|
|
27467
27741
|
}
|
|
27468
27742
|
return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(c), mode: "setup" }), 200);
|
|
27469
27743
|
});
|
|
27470
|
-
|
|
27744
|
+
app63.post("/__remote-auth/set-initial-password", async (c) => {
|
|
27471
27745
|
if (isRemoteAuthConfigured()) {
|
|
27472
27746
|
return c.redirect("/");
|
|
27473
27747
|
}
|
|
@@ -27505,10 +27779,10 @@ app62.post("/__remote-auth/set-initial-password", async (c) => {
|
|
|
27505
27779
|
return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(c), mode: "setup", setupError: "Failed to save password. Please try again." }), 200);
|
|
27506
27780
|
}
|
|
27507
27781
|
});
|
|
27508
|
-
|
|
27782
|
+
app63.get("/api/remote-auth/status", (c) => {
|
|
27509
27783
|
return c.json({ configured: isRemoteAuthConfigured() });
|
|
27510
27784
|
});
|
|
27511
|
-
|
|
27785
|
+
app63.post("/api/remote-auth/set-password", async (c) => {
|
|
27512
27786
|
let body;
|
|
27513
27787
|
try {
|
|
27514
27788
|
body = await c.req.json();
|
|
@@ -27547,10 +27821,10 @@ app62.post("/api/remote-auth/set-password", async (c) => {
|
|
|
27547
27821
|
return c.json({ error: "Failed to save password" }, 500);
|
|
27548
27822
|
}
|
|
27549
27823
|
});
|
|
27550
|
-
|
|
27824
|
+
app63.route("/api/_client-error", client_error_default);
|
|
27551
27825
|
console.log("[client-error-route] mounted");
|
|
27552
27826
|
var PWA_PUBLIC_PATHS = /* @__PURE__ */ new Set(["/sw.js", ...PWA_SURFACES.map((s) => s.manifestPath)]);
|
|
27553
|
-
|
|
27827
|
+
app63.use("*", async (c, next) => {
|
|
27554
27828
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
27555
27829
|
const path3 = c.req.path;
|
|
27556
27830
|
if (path3 === "/favicon.ico" || path3.startsWith("/assets/") || path3.startsWith("/brand/") || // Public free/busy is read by the booking page (a separate Cloudflare Pages
|
|
@@ -27594,34 +27868,34 @@ app62.use("*", async (c, next) => {
|
|
|
27594
27868
|
}
|
|
27595
27869
|
return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(c), redirect: path3 }), 200);
|
|
27596
27870
|
});
|
|
27597
|
-
|
|
27598
|
-
|
|
27599
|
-
|
|
27600
|
-
|
|
27601
|
-
|
|
27602
|
-
|
|
27603
|
-
|
|
27871
|
+
app63.route("/api/health", health_default);
|
|
27872
|
+
app63.route("/api/chat", chatRoutes);
|
|
27873
|
+
app63.route("/api/whatsapp", whatsapp_default);
|
|
27874
|
+
app63.route("/api/storage", storage_broker_default);
|
|
27875
|
+
app63.route("/api/whatsapp-reader", whatsapp_reader_default);
|
|
27876
|
+
app63.route("/api/public-reader", public_reader_default);
|
|
27877
|
+
app63.route("/api/webchat", createWebchatRoutes({
|
|
27604
27878
|
handleInbound: (input) => webchatGateway.handleInbound(input),
|
|
27605
27879
|
// Task 940 — the permission relay's pointer read + verdict write.
|
|
27606
27880
|
pendingPromptFor: (key) => webchatGateway.pendingPromptFor(key),
|
|
27607
27881
|
deliveryFailureFor: (key) => webchatGateway.deliveryFailureFor(key),
|
|
27608
27882
|
resolvePermissionVerdict: (key, requestId, behavior) => webchatGateway.resolvePermissionVerdict(key, requestId, behavior)
|
|
27609
27883
|
}));
|
|
27610
|
-
|
|
27611
|
-
|
|
27612
|
-
|
|
27613
|
-
|
|
27884
|
+
app63.route("/api/webchat/greeting", webchat_greeting_default);
|
|
27885
|
+
app63.route("/api/telegram", telegram_default);
|
|
27886
|
+
app63.route("/api/quickbooks", quickbooks_default);
|
|
27887
|
+
app63.route(
|
|
27614
27888
|
"/api/google",
|
|
27615
27889
|
createGoogleOAuthRoutes(
|
|
27616
27890
|
resolve36(process.env.MAXY_PLATFORM_ROOT ?? join39(__dirname, "..")),
|
|
27617
27891
|
resolve36(process.env.MAXY_PLATFORM_ROOT ?? join39(__dirname, ".."), "..", "data/accounts")
|
|
27618
27892
|
)
|
|
27619
27893
|
);
|
|
27620
|
-
|
|
27621
|
-
|
|
27622
|
-
|
|
27623
|
-
|
|
27624
|
-
|
|
27894
|
+
app63.route("/api/onboarding", onboarding_default);
|
|
27895
|
+
app63.route("/api/admin", admin_default);
|
|
27896
|
+
app63.route("/api/access", access_default);
|
|
27897
|
+
app63.route("/api/session", session_default2);
|
|
27898
|
+
app63.route("/api/calendar", calendar_public_default);
|
|
27625
27899
|
var SAFE_SLUG_RE2 = /^[a-z][a-z0-9-]{2,49}$/;
|
|
27626
27900
|
var SAFE_FILENAME_RE = /^[a-z0-9_][a-z0-9_.-]{0,99}$/i;
|
|
27627
27901
|
var IMAGE_MIME = {
|
|
@@ -27633,7 +27907,7 @@ var IMAGE_MIME = {
|
|
|
27633
27907
|
".svg": "image/svg+xml",
|
|
27634
27908
|
".ico": "image/x-icon"
|
|
27635
27909
|
};
|
|
27636
|
-
|
|
27910
|
+
app63.get("/agent-assets/:slug/:filename", (c) => {
|
|
27637
27911
|
const slug = c.req.param("slug");
|
|
27638
27912
|
const filename = c.req.param("filename");
|
|
27639
27913
|
if (!SAFE_SLUG_RE2.test(slug)) {
|
|
@@ -27668,7 +27942,7 @@ app62.get("/agent-assets/:slug/:filename", (c) => {
|
|
|
27668
27942
|
"Cache-Control": "public, max-age=3600"
|
|
27669
27943
|
});
|
|
27670
27944
|
});
|
|
27671
|
-
|
|
27945
|
+
app63.get("/generated/:filename", (c) => {
|
|
27672
27946
|
const filename = c.req.param("filename");
|
|
27673
27947
|
if (!SAFE_FILENAME_RE.test(filename) || filename.includes("..")) {
|
|
27674
27948
|
console.error(`[generated] serve file=${filename} status=403`);
|
|
@@ -27698,10 +27972,10 @@ app62.get("/generated/:filename", (c) => {
|
|
|
27698
27972
|
"Cache-Control": "public, max-age=86400"
|
|
27699
27973
|
});
|
|
27700
27974
|
});
|
|
27701
|
-
|
|
27702
|
-
|
|
27703
|
-
|
|
27704
|
-
|
|
27975
|
+
app63.route("/sites", sites_default);
|
|
27976
|
+
app63.route("/listings", listings_default);
|
|
27977
|
+
app63.route("/v", visitor_event_default);
|
|
27978
|
+
app63.route("/v", visitor_consent_default);
|
|
27705
27979
|
var htmlCache = /* @__PURE__ */ new Map();
|
|
27706
27980
|
var brandLogoPath = "/brand/maxy-monochrome.png";
|
|
27707
27981
|
var brandIconPath = "/brand/maxy-monochrome.png";
|
|
@@ -27856,7 +28130,7 @@ function brandedPublicHtml(agentSlug) {
|
|
|
27856
28130
|
function agentUnavailableHtml() {
|
|
27857
28131
|
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>${escapeHtml(BRAND.productName)}</title></head><body style="font-family:system-ui,sans-serif;max-width:32rem;margin:4rem auto;padding:0 1.5rem;color:#222"><h1 style="font-size:1.25rem">Agent unavailable</h1><p>This agent isn't available right now. If you reached this page from a saved link, the agent may have been turned off.</p></body></html>`;
|
|
27858
28132
|
}
|
|
27859
|
-
|
|
28133
|
+
app63.get("/", (c) => {
|
|
27860
28134
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
27861
28135
|
const klass = classifyHost(host, getOperatorDomains(), isPublicHost);
|
|
27862
28136
|
if (klass === "operator") {
|
|
@@ -27878,12 +28152,12 @@ app62.get("/", (c) => {
|
|
|
27878
28152
|
console.log(`[host-class] host=${host} class=admin served=index.html`);
|
|
27879
28153
|
return c.html(cachedHtml("index.html"));
|
|
27880
28154
|
});
|
|
27881
|
-
|
|
28155
|
+
app63.get("/public", (c) => {
|
|
27882
28156
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
27883
28157
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
27884
28158
|
return c.html(cachedHtml("public.html"));
|
|
27885
28159
|
});
|
|
27886
|
-
|
|
28160
|
+
app63.get("/public-chat", (c) => {
|
|
27887
28161
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
27888
28162
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
27889
28163
|
return c.html(cachedHtml("public.html"));
|
|
@@ -27902,9 +28176,9 @@ async function logViewerFetch(c, next) {
|
|
|
27902
28176
|
duration_ms: Date.now() - start
|
|
27903
28177
|
});
|
|
27904
28178
|
}
|
|
27905
|
-
|
|
27906
|
-
|
|
27907
|
-
|
|
28179
|
+
app63.use("/vnc-viewer.html", logViewerFetch);
|
|
28180
|
+
app63.use("/vnc-popout.html", logViewerFetch);
|
|
28181
|
+
app63.get("/vnc-popout.html", (c) => {
|
|
27908
28182
|
let html = htmlCache.get("vnc-popout.html");
|
|
27909
28183
|
if (!html) {
|
|
27910
28184
|
html = readFileSync39(resolve36(process.cwd(), "public", "vnc-popout.html"), "utf-8");
|
|
@@ -27917,7 +28191,7 @@ app62.get("/vnc-popout.html", (c) => {
|
|
|
27917
28191
|
}
|
|
27918
28192
|
return c.html(html);
|
|
27919
28193
|
});
|
|
27920
|
-
|
|
28194
|
+
app63.post("/api/vnc/client-event", async (c) => {
|
|
27921
28195
|
let body;
|
|
27922
28196
|
try {
|
|
27923
28197
|
body = await c.req.json();
|
|
@@ -27938,11 +28212,11 @@ app62.post("/api/vnc/client-event", async (c) => {
|
|
|
27938
28212
|
});
|
|
27939
28213
|
return c.json({ ok: true });
|
|
27940
28214
|
});
|
|
27941
|
-
|
|
28215
|
+
app63.get("/g/:slug", (c) => {
|
|
27942
28216
|
return c.html(brandedPublicHtml(resolveDefaultSlug() ?? void 0));
|
|
27943
28217
|
});
|
|
27944
28218
|
for (const pwa of PWA_SURFACES) {
|
|
27945
|
-
|
|
28219
|
+
app63.get(pwa.manifestPath, (c) => {
|
|
27946
28220
|
const manifest = buildManifest(pwa, {
|
|
27947
28221
|
productName: BRAND.productName,
|
|
27948
28222
|
appIcon192: brandAppIcon192Path,
|
|
@@ -27958,7 +28232,7 @@ for (const pwa of PWA_SURFACES) {
|
|
|
27958
28232
|
return c.body(JSON.stringify(manifest));
|
|
27959
28233
|
});
|
|
27960
28234
|
}
|
|
27961
|
-
|
|
28235
|
+
app63.get("/sw.js", (c) => {
|
|
27962
28236
|
if (SW_SOURCE == null) {
|
|
27963
28237
|
console.error("[pwa] op=sw status=500 reason=sw-source-missing");
|
|
27964
28238
|
return c.text("Service worker unavailable", 500);
|
|
@@ -27967,12 +28241,12 @@ app62.get("/sw.js", (c) => {
|
|
|
27967
28241
|
console.log(`[pwa] op=sw status=200 ct=${SW_CONTENT_TYPE}`);
|
|
27968
28242
|
return c.body(SW_SOURCE);
|
|
27969
28243
|
});
|
|
27970
|
-
|
|
28244
|
+
app63.get("/graph", (c) => {
|
|
27971
28245
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
27972
28246
|
if (isPublicHost(host) || isOperatorHost(host, getOperatorDomains())) return c.text("Not found", 404);
|
|
27973
28247
|
return c.html(cachedHtml("graph.html"));
|
|
27974
28248
|
});
|
|
27975
|
-
|
|
28249
|
+
app63.get("/chat", (c) => {
|
|
27976
28250
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
27977
28251
|
if (isOperatorHost(host, getOperatorDomains())) {
|
|
27978
28252
|
console.log(`[host-class] host=${host} class=operator served=operator.html`);
|
|
@@ -27981,27 +28255,32 @@ app62.get("/chat", (c) => {
|
|
|
27981
28255
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
27982
28256
|
return c.html(cachedHtml("chat.html"));
|
|
27983
28257
|
});
|
|
27984
|
-
|
|
28258
|
+
app63.get("/data", (c) => {
|
|
27985
28259
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
27986
28260
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
27987
28261
|
return c.html(cachedHtml("data.html"));
|
|
27988
28262
|
});
|
|
27989
|
-
|
|
28263
|
+
app63.get("/tasks", (c) => {
|
|
27990
28264
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
27991
28265
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
27992
28266
|
return c.html(cachedHtml("tasks.html"));
|
|
27993
28267
|
});
|
|
27994
|
-
|
|
28268
|
+
app63.get("/activity", (c) => {
|
|
28269
|
+
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
28270
|
+
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
28271
|
+
return c.html(cachedHtml("activity.html"));
|
|
28272
|
+
});
|
|
28273
|
+
app63.get("/calendar", (c) => {
|
|
27995
28274
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
27996
28275
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
27997
28276
|
return c.html(cachedHtml("calendar.html"));
|
|
27998
28277
|
});
|
|
27999
|
-
|
|
28278
|
+
app63.get("/browser", (c) => {
|
|
28000
28279
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
28001
28280
|
if (isPublicHost(host) || isOperatorHost(host, getOperatorDomains())) return c.text("Not found", 404);
|
|
28002
28281
|
return c.html(cachedHtml("browser.html"));
|
|
28003
28282
|
});
|
|
28004
|
-
|
|
28283
|
+
app63.get("/:slug", async (c, next) => {
|
|
28005
28284
|
const slug = c.req.param("slug");
|
|
28006
28285
|
if (AGENT_SLUG_PATTERN.test(`/${slug}`)) {
|
|
28007
28286
|
const account = resolveAccount();
|
|
@@ -28016,13 +28295,13 @@ app62.get("/:slug", async (c, next) => {
|
|
|
28016
28295
|
await next();
|
|
28017
28296
|
});
|
|
28018
28297
|
if (brandFaviconPath !== "/favicon.ico") {
|
|
28019
|
-
|
|
28298
|
+
app63.get("/favicon.ico", (c) => {
|
|
28020
28299
|
c.header("Cache-Control", "public, max-age=300");
|
|
28021
28300
|
return c.redirect(brandFaviconPath, 302);
|
|
28022
28301
|
});
|
|
28023
28302
|
}
|
|
28024
|
-
|
|
28025
|
-
|
|
28303
|
+
app63.use("/*", serveStatic({ root: "./public" }));
|
|
28304
|
+
app63.all("*", (c) => {
|
|
28026
28305
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
28027
28306
|
const path3 = c.req.path;
|
|
28028
28307
|
if (isPublicHost(host)) {
|
|
@@ -28036,7 +28315,7 @@ app62.all("*", (c) => {
|
|
|
28036
28315
|
});
|
|
28037
28316
|
var port = requirePortEnv("MAXY_UI_INTERNAL_PORT", { tag: "ui-server" });
|
|
28038
28317
|
var hostname = process.env.HOSTNAME ?? "127.0.0.1";
|
|
28039
|
-
var httpServer = serve({ fetch:
|
|
28318
|
+
var httpServer = serve({ fetch: app63.fetch, port, hostname });
|
|
28040
28319
|
console.log(`${BRAND.productName} listening on http://${hostname}:${port}`);
|
|
28041
28320
|
{
|
|
28042
28321
|
const reconcilePlatformRoot = process.env.MAXY_PLATFORM_ROOT ?? join39(__dirname, "..");
|
|
@@ -28092,7 +28371,7 @@ console.log(`${BRAND.productName} listening on http://${hostname}:${port}`);
|
|
|
28092
28371
|
try {
|
|
28093
28372
|
if (!existsSync37(strandedAccountsDir)) return;
|
|
28094
28373
|
const now = Date.now();
|
|
28095
|
-
for (const name of
|
|
28374
|
+
for (const name of readdirSync23(strandedAccountsDir)) {
|
|
28096
28375
|
if (!STRANDED_UUID_RE.test(name)) continue;
|
|
28097
28376
|
const pendingPath2 = resolve36(strandedAccountsDir, name, "secrets/outlook/pending-devicecode.enc");
|
|
28098
28377
|
if (!existsSync37(pendingPath2)) continue;
|
|
@@ -28200,6 +28479,7 @@ console.log(`${BRAND.productName} listening on http://${hostname}:${port}`);
|
|
|
28200
28479
|
publishLoop.unref();
|
|
28201
28480
|
}
|
|
28202
28481
|
startTimeEntryCensus(() => getSession());
|
|
28482
|
+
startLedgerCensus(() => getSession());
|
|
28203
28483
|
{
|
|
28204
28484
|
const auditPlatformRoot = process.env.MAXY_PLATFORM_ROOT ?? join39(__dirname, "..");
|
|
28205
28485
|
const auditScript = resolve36(auditPlatformRoot, "plugins/connector/mcp/dist/scripts/audit-connectors.js");
|
|
@@ -28277,7 +28557,7 @@ for (const m of SUBAPP_MANIFEST) {
|
|
|
28277
28557
|
}
|
|
28278
28558
|
try {
|
|
28279
28559
|
const registered = [];
|
|
28280
|
-
for (const r of
|
|
28560
|
+
for (const r of app63.routes ?? []) {
|
|
28281
28561
|
if (typeof r.path !== "string" || r.path.includes(":") || r.path.includes("*")) continue;
|
|
28282
28562
|
if (AGENT_SLUG_PATTERN.test(r.path)) {
|
|
28283
28563
|
registered.push({ method: (r.method ?? "ALL").toUpperCase(), path: r.path });
|
|
@@ -28339,6 +28619,7 @@ async function runAdminUserReconcileTick() {
|
|
|
28339
28619
|
}
|
|
28340
28620
|
await runAdminUserSelfHeal({ userId, accountId: account.accountId });
|
|
28341
28621
|
await runUserProfileReconcile();
|
|
28622
|
+
await runConversationAudit();
|
|
28342
28623
|
} catch (err) {
|
|
28343
28624
|
console.error(`[adminuser-self-heal] rejected: ${err instanceof Error ? err.message : String(err)}`);
|
|
28344
28625
|
}
|