@rubytech/create-maxy-code 0.1.33 → 0.1.34
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/dist/__tests__/account-id-env.test.js +1 -1
- package/dist/__tests__/apt-resolve.test.js +7 -7
- package/dist/__tests__/brew-install.test.js +1 -1
- package/dist/__tests__/brew-resolve.test.js +1 -1
- package/dist/__tests__/cdp-port-no-silent-fallback.test.js +4 -4
- package/dist/__tests__/init-logging.test.js +1 -1
- package/dist/__tests__/launchd-plist.test.js +1 -1
- package/dist/__tests__/macos-version.test.js +1 -1
- package/dist/__tests__/peer-brand-detect.test.js +1 -1
- package/dist/__tests__/platform-detect.test.js +2 -2
- package/dist/__tests__/port-canonicalisation.test.js +1 -1
- package/dist/__tests__/preflight-port-classifier.test.js +6 -6
- package/dist/__tests__/samba-provision.test.js +1 -1
- package/dist/__tests__/snap-chromium.test.js +1 -1
- package/dist/apt-resolve.js +5 -5
- package/dist/brew-install.js +1 -1
- package/dist/brew-resolve.js +3 -3
- package/dist/index.js +146 -122
- package/dist/init-logging.js +1 -1
- package/dist/launchd-plist.js +1 -1
- package/dist/macos-version.js +2 -2
- package/dist/peer-brand-detect.js +1 -1
- package/dist/pinned-binaries.js +1 -1
- package/dist/platform-detect.js +1 -1
- package/dist/port-resolution.js +2 -2
- package/dist/preflight-port-classifier.js +3 -3
- package/dist/samba-provision.js +1 -1
- package/dist/snap-chromium.js +3 -3
- package/dist/uninstall.js +28 -28
- package/package.json +1 -1
- package/payload/platform/lib/account-enumeration/dist/__tests__/validate-env.test.js +1 -1
- package/payload/platform/lib/account-enumeration/dist/__tests__/validate-env.test.js.map +1 -1
- package/payload/platform/lib/account-enumeration/dist/index.d.ts +1 -1
- package/payload/platform/lib/account-enumeration/src/__tests__/validate-env.test.ts +1 -1
- package/payload/platform/lib/account-enumeration/src/index.ts +1 -1
- package/payload/platform/lib/admins-write/dist/index.js +3 -3
- package/payload/platform/lib/admins-write/dist/index.js.map +1 -1
- package/payload/platform/lib/admins-write/src/index.ts +4 -4
- package/payload/platform/lib/entitlement/dist/index.d.ts +1 -1
- package/payload/platform/lib/entitlement/dist/index.js +2 -2
- package/payload/platform/lib/entitlement/dist/index.js.map +1 -1
- package/payload/platform/lib/graph-mcp/dist/__tests__/warnings-envelope.test.js +1 -1
- package/payload/platform/lib/graph-mcp/dist/__tests__/warnings-envelope.test.js.map +1 -1
- package/payload/platform/lib/graph-mcp/dist/cypher-rewrite-stamp.d.ts +3 -3
- package/payload/platform/lib/graph-mcp/dist/cypher-rewrite-stamp.js +3 -3
- package/payload/platform/lib/graph-mcp/dist/cypher-shim-read.d.ts +1 -1
- package/payload/platform/lib/graph-mcp/dist/cypher-shim-read.js +1 -1
- package/payload/platform/lib/graph-mcp/dist/cypher-shim-write.d.ts +1 -1
- package/payload/platform/lib/graph-mcp/dist/cypher-shim-write.js +1 -1
- package/payload/platform/lib/graph-mcp/dist/cypher-validate.d.ts +1 -1
- package/payload/platform/lib/graph-mcp/dist/cypher-validate.js +1 -1
- package/payload/platform/lib/graph-mcp/dist/index.d.ts +1 -1
- package/payload/platform/lib/graph-mcp/dist/index.js +24 -24
- package/payload/platform/lib/graph-mcp/dist/index.js.map +1 -1
- package/payload/platform/lib/graph-mcp/dist/schema-cache.d.ts +1 -1
- package/payload/platform/lib/graph-mcp/dist/schema-cache.js +2 -2
- package/payload/platform/lib/graph-mcp/dist/schema-cypher-parser.d.ts +3 -3
- package/payload/platform/lib/graph-mcp/dist/schema-cypher-parser.js +3 -3
- package/payload/platform/lib/graph-mcp/src/__tests__/warnings-envelope.test.ts +1 -1
- package/payload/platform/lib/graph-mcp/src/cypher-rewrite-stamp.ts +3 -3
- package/payload/platform/lib/graph-mcp/src/cypher-shim-read.ts +1 -1
- package/payload/platform/lib/graph-mcp/src/cypher-shim-write.ts +1 -1
- package/payload/platform/lib/graph-mcp/src/cypher-validate.ts +1 -1
- package/payload/platform/lib/graph-mcp/src/index.ts +29 -29
- package/payload/platform/lib/graph-mcp/src/schema-cache.ts +2 -2
- package/payload/platform/lib/graph-mcp/src/schema-cypher-parser.ts +3 -3
- package/payload/platform/lib/graph-search/dist/index.d.ts +12 -12
- package/payload/platform/lib/graph-search/dist/index.js +11 -11
- package/payload/platform/lib/graph-search/dist/index.js.map +1 -1
- package/payload/platform/lib/graph-search/src/__tests__/bm25-label-gate.test.ts +2 -2
- package/payload/platform/lib/graph-search/src/__tests__/bm25-strong-bypass-threshold.test.ts +2 -2
- package/payload/platform/lib/graph-search/src/__tests__/brochure-threshold.test.ts +3 -3
- package/payload/platform/lib/graph-search/src/__tests__/expand-batch.test.ts +2 -2
- package/payload/platform/lib/graph-search/src/__tests__/fulltext-coverage.test.ts +6 -6
- package/payload/platform/lib/graph-search/src/__tests__/hybrid.test.ts +5 -5
- package/payload/platform/lib/graph-search/src/__tests__/vector-threshold.test.ts +2 -2
- package/payload/platform/lib/graph-search/src/index.ts +18 -18
- package/payload/platform/lib/graph-trash/dist/index.d.ts +3 -3
- package/payload/platform/lib/graph-trash/dist/index.js +3 -3
- package/payload/platform/lib/graph-trash/src/index.ts +3 -3
- package/payload/platform/lib/graph-write/dist/__tests__/action-provenance-gate.test.js +4 -4
- package/payload/platform/lib/graph-write/dist/__tests__/action-provenance-gate.test.js.map +1 -1
- package/payload/platform/lib/graph-write/dist/audit.d.ts +2 -2
- package/payload/platform/lib/graph-write/dist/audit.js +2 -2
- package/payload/platform/lib/graph-write/dist/conversation-provenance.js +1 -1
- package/payload/platform/lib/graph-write/dist/conversation-provenance.js.map +1 -1
- package/payload/platform/lib/graph-write/dist/index.d.ts +5 -5
- package/payload/platform/lib/graph-write/dist/index.js +12 -12
- package/payload/platform/lib/graph-write/dist/index.js.map +1 -1
- package/payload/platform/lib/graph-write/src/__tests__/action-provenance-gate.test.ts +4 -4
- package/payload/platform/lib/graph-write/src/audit.ts +2 -2
- package/payload/platform/lib/graph-write/src/conversation-provenance.ts +1 -1
- package/payload/platform/lib/graph-write/src/index.ts +13 -13
- package/payload/platform/lib/mcp-eager/dist/index.d.ts +2 -2
- package/payload/platform/lib/mcp-eager/dist/index.js +2 -2
- package/payload/platform/lib/mcp-eager/src/index.ts +2 -2
- package/payload/platform/lib/mcp-spawn-tee/dist/index.d.ts +2 -2
- package/payload/platform/lib/mcp-spawn-tee/dist/index.js +2 -2
- package/payload/platform/lib/mcp-spawn-tee/src/index.ts +2 -2
- package/payload/platform/lib/mcp-stderr-tee/dist/index.d.ts +1 -1
- package/payload/platform/lib/mcp-stderr-tee/dist/index.js +4 -4
- package/payload/platform/lib/mcp-stderr-tee/dist/index.js.map +1 -1
- package/payload/platform/lib/mcp-stderr-tee/src/index.ts +4 -4
- package/payload/platform/lib/oauth-llm/dist/index.d.ts +4 -4
- package/payload/platform/lib/oauth-llm/dist/index.js +3 -3
- package/payload/platform/lib/oauth-llm/dist/index.js.map +1 -1
- package/payload/platform/lib/oauth-llm/src/index.ts +6 -6
- package/payload/platform/lib/persistent-components/dist/index.d.ts +1 -1
- package/payload/platform/lib/persistent-components/dist/index.js +1 -1
- package/payload/platform/lib/persistent-components/src/index.ts +1 -1
- package/payload/platform/lib/task-secrets/dist/index.js +1 -1
- package/payload/platform/lib/task-secrets/dist/index.js.map +1 -1
- package/payload/platform/lib/task-secrets/src/__tests__/redact-secrets.test.ts +1 -1
- package/payload/platform/lib/task-secrets/src/index.ts +1 -1
- package/payload/platform/neo4j/edge-annotations.json +9 -9
- package/payload/platform/neo4j/schema.cypher +32 -33
- package/payload/platform/package.json +2 -2
- package/payload/platform/plugins/admin/PLUGIN.md +0 -2
- package/payload/platform/plugins/admin/hooks/__tests__/archive-ingest-surface-gate.test.sh +4 -4
- package/payload/platform/plugins/admin/hooks/__tests__/playwright-file-guard.test.sh +1 -1
- package/payload/platform/plugins/admin/hooks/__tests__/pre-tool-use-base64-guard.test.sh +1 -1
- package/payload/platform/plugins/admin/hooks/archive-ingest-surface-gate.sh +13 -13
- package/payload/platform/plugins/admin/hooks/pre-tool-use.sh +7 -7
- package/payload/platform/plugins/admin/mcp/dist/__tests__/plugin-read-skill-resolution.test.js +2 -2
- package/payload/platform/plugins/admin/mcp/dist/__tests__/plugin-read-skill-resolution.test.js.map +1 -1
- package/payload/platform/plugins/admin/mcp/dist/__tests__/public-hostname.test.js +1 -1
- package/payload/platform/plugins/admin/mcp/dist/__tests__/public-hostname.test.js.map +1 -1
- package/payload/platform/plugins/admin/mcp/dist/__tests__/skill-load-required-inputs.test.js +2 -2
- package/payload/platform/plugins/admin/mcp/dist/__tests__/skill-load-required-inputs.test.js.map +1 -1
- package/payload/platform/plugins/admin/mcp/dist/__tests__/skill-load.test.js +1 -1
- package/payload/platform/plugins/admin/mcp/dist/__tests__/skill-load.test.js.map +1 -1
- package/payload/platform/plugins/admin/mcp/dist/index.js +38 -65
- package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/admin/mcp/dist/lib/neo4j.js +2 -2
- package/payload/platform/plugins/admin/mcp/dist/lib/neo4j.js.map +1 -1
- package/payload/platform/plugins/admin/mcp/dist/lib/public-hostname.js +2 -2
- package/payload/platform/plugins/admin/mcp/dist/lib/public-hostname.js.map +1 -1
- package/payload/platform/plugins/admin/mcp/dist/skill-resolution.js +5 -5
- package/payload/platform/plugins/admin/mcp/dist/skill-resolution.js.map +1 -1
- package/payload/platform/plugins/admin/skills/plugin-management/SKILL.md +1 -1
- package/payload/platform/plugins/admin/skills/public-agent-manager/SKILL.md +0 -1
- package/payload/platform/plugins/admin/skills/publish-site/SKILL.md +1 -1
- package/payload/platform/plugins/admin/skills/unzip-attachment/SKILL.md +2 -2
- package/payload/platform/plugins/cloudflare/mcp/dist/index.js +1 -1
- package/payload/platform/plugins/cloudflare/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.d.ts +1 -1
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.js +6 -6
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.js.map +1 -1
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/setup-orchestrator.d.ts +2 -2
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/setup-orchestrator.js +2 -2
- package/payload/platform/plugins/cloudflare/references/dashboard-guide.md +1 -1
- package/payload/platform/plugins/cloudflare/references/manual-setup.md +4 -4
- package/payload/platform/plugins/cloudflare/scripts/__tests__/tunnel-ingress.test.ts +1 -1
- package/payload/platform/plugins/cloudflare/scripts/_stream-log.sh +8 -8
- package/payload/platform/plugins/cloudflare/scripts/list-cf-domains.sh +2 -2
- package/payload/platform/plugins/cloudflare/scripts/list-cf-domains.ts +16 -16
- package/payload/platform/plugins/cloudflare/scripts/reset-tunnel.sh +1 -1
- package/payload/platform/plugins/cloudflare/scripts/setup-tunnel.sh +28 -28
- package/payload/platform/plugins/cloudflare/scripts/tunnel-ingress.ts +5 -5
- package/payload/platform/plugins/cloudflare/skills/setup-tunnel/SKILL.md +3 -3
- package/payload/platform/plugins/contacts/mcp/dist/lib/neo4j.js +2 -2
- package/payload/platform/plugins/contacts/mcp/dist/lib/neo4j.js.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/lib/resolve-person.d.ts +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/lib/resolve-person.js +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-create.js +2 -2
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-create.js.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/group-create.js +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/group-create.js.map +1 -1
- package/payload/platform/plugins/docs/references/deployment.md +30 -1
- package/payload/platform/plugins/docs/references/plugins-guide.md +2 -5
- package/payload/platform/plugins/docs/references/troubleshooting.md +3 -3
- package/payload/platform/plugins/email/mcp/dist/index.js +1 -1
- package/payload/platform/plugins/email/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/claude-bridge.js +2 -2
- package/payload/platform/plugins/email/mcp/dist/lib/claude-bridge.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/credentials.d.ts +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/credentials.js +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/neo4j.js +2 -2
- package/payload/platform/plugins/email/mcp/dist/lib/neo4j.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/screening.d.ts +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/screening.js +1 -1
- package/payload/platform/plugins/email/mcp/dist/scripts/email-auto-respond.js +6 -6
- package/payload/platform/plugins/email/mcp/dist/scripts/email-auto-respond.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.d.ts +1 -1
- package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.js +2 -2
- package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.js.map +1 -1
- package/payload/platform/plugins/email/references/email-reference.md +2 -2
- package/payload/platform/plugins/loop/mcp/dist/lib/neo4j.js +3 -3
- package/payload/platform/plugins/loop/mcp/dist/lib/neo4j.js.map +1 -1
- package/payload/platform/plugins/loop/mcp/src/lib/neo4j.ts +3 -3
- package/payload/platform/plugins/memory/bin/conversation-archive-ingest.mjs +24 -24
- package/payload/platform/plugins/memory/bin/conversation-archive-ingest.sh +6 -6
- package/payload/platform/plugins/memory/mcp/dist/index.js +8 -8
- package/payload/platform/plugins/memory/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/llm-classifier.test.js +33 -33
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/llm-classifier.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-loader.test.js +12 -12
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-loader.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-validator.test.js +3 -3
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-validator.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/types.js +2 -2
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/types.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/whatsapp-text.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/whatsapp-text.js +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/whatsapp-text.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/derive-keys.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/derive-keys.js +1 -2
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/derive-keys.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/sender-bind.js +2 -2
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/sender-bind.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/to-turn-text.js +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/to-turn-text.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/document-chunker.d.ts +2 -2
- package/payload/platform/plugins/memory/mcp/dist/lib/document-chunker.js +2 -2
- package/payload/platform/plugins/memory/mcp/dist/lib/document-hierarchy.js +6 -6
- package/payload/platform/plugins/memory/mcp/dist/lib/document-hierarchy.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/graph-prune.d.ts +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/graph-prune.js +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/graph-write-gate.d.ts +2 -2
- package/payload/platform/plugins/memory/mcp/dist/lib/graph-write-gate.js +7 -7
- package/payload/platform/plugins/memory/mcp/dist/lib/graph-write-gate.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/live-schema-source.d.ts +2 -2
- package/payload/platform/plugins/memory/mcp/dist/lib/live-schema-source.js +2 -2
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.d.ts +9 -9
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.js +25 -25
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-ranker.d.ts +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-ranker.js +5 -5
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-ranker.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/neo4j.js +2 -2
- package/payload/platform/plugins/memory/mcp/dist/lib/neo4j.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/schema-loader.d.ts +4 -4
- package/payload/platform/plugins/memory/mcp/dist/lib/schema-loader.js +3 -3
- package/payload/platform/plugins/memory/mcp/dist/lib/schema-loader.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/schema-validator.d.ts +3 -3
- package/payload/platform/plugins/memory/mcp/dist/lib/schema-validator.js +5 -5
- package/payload/platform/plugins/memory/mcp/dist/lib/schema-validator.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/uuid.js +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/uuid.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-derive-insights.test.js +5 -5
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-derive-insights.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-enrich-rejection.test.js +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-enrich-rejection.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-normalisers-source-agnosticism.test.js +2 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-normalisers-source-agnosticism.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-normalisers-whatsapp-text.test.js +4 -4
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-normalisers-whatsapp-text.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-write.test.js +6 -6
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-write.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest.test.js +7 -7
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-not-applicable.test.js +2 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-not-applicable.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-personfields-open.test.js +3 -3
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-personfields-open.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.d.ts +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.js +3 -3
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-enrich-rejection.d.ts +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-enrich-rejection.js +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-archive-write.js +2 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-archive-write.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-classify.d.ts +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-classify.js +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-delete.d.ts +2 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-delete.js +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-delete.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-find-candidates.d.ts +3 -3
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest-extract.js +2 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest-extract.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.d.ts +9 -9
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.js +10 -11
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-list-attachments.js +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-list-attachments.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-search.js +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-search.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.js +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.d.ts +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.js +3 -3
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/profile-read.js +9 -9
- package/payload/platform/plugins/memory/mcp/dist/tools/profile-read.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/profile-update.d.ts +5 -5
- package/payload/platform/plugins/memory/mcp/dist/tools/profile-update.js +9 -9
- package/payload/platform/plugins/memory/mcp/dist/tools/profile-update.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/scripts/boot-smoke.sh +1 -1
- package/payload/platform/plugins/memory/mcp/scripts/graph/fixture.cypher +1 -1
- package/payload/platform/plugins/memory/mcp/vitest.config.ts +2 -2
- package/payload/platform/plugins/outlook/mcp/dist/lib/graph-client.js +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/graph-client.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/scripts/verify-doc-impl.sh +1 -1
- package/payload/platform/plugins/scheduling/PLUGIN.md +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/__tests__/time-resolve-description.test.js +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/__tests__/time-resolve-description.test.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/index.js +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/getUserTimezone.test.js +3 -3
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/getUserTimezone.test.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/neo4j.d.ts +2 -2
- package/payload/platform/plugins/scheduling/mcp/dist/lib/neo4j.js +5 -5
- package/payload/platform/plugins/scheduling/mcp/dist/lib/neo4j.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.d.ts +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js +6 -6
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.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/tasks/mcp/dist/index.js +1 -1
- package/payload/platform/plugins/tasks/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/tasks/mcp/dist/lib/neo4j.js +2 -2
- package/payload/platform/plugins/tasks/mcp/dist/lib/neo4j.js.map +1 -1
- package/payload/platform/plugins/tasks/mcp/dist/tools/project-create.js +2 -2
- package/payload/platform/plugins/tasks/mcp/dist/tools/project-create.js.map +1 -1
- package/payload/platform/plugins/tasks/mcp/dist/tools/session-name.d.ts +1 -1
- package/payload/platform/plugins/tasks/mcp/dist/tools/session-name.d.ts.map +1 -1
- package/payload/platform/plugins/tasks/mcp/dist/tools/task-create.d.ts +5 -5
- package/payload/platform/plugins/tasks/mcp/dist/tools/task-create.js +3 -3
- package/payload/platform/plugins/tasks/mcp/dist/tools/task-create.js.map +1 -1
- package/payload/platform/plugins/tasks/mcp/dist/tools/task-update.d.ts +4 -4
- package/payload/platform/plugins/tasks/mcp/dist/tools/task-update.js +2 -2
- package/payload/platform/plugins/tasks/mcp/dist/tools/task-update.js.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/tools/message-history.js +2 -2
- package/payload/platform/plugins/telegram/mcp/dist/tools/message-history.js.map +1 -1
- package/payload/platform/plugins/waitlist/mcp/dist/lib/neo4j.js +2 -2
- package/payload/platform/plugins/waitlist/mcp/dist/lib/neo4j.js.map +1 -1
- package/payload/platform/plugins/waitlist/mcp/dist/tools/__tests__/waitlist-persist.test.js +3 -3
- package/payload/platform/plugins/waitlist/mcp/dist/tools/__tests__/waitlist-persist.test.js.map +1 -1
- package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-persist.d.ts +1 -1
- package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-persist.js +3 -3
- package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-persist.js.map +1 -1
- package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-setup.js +5 -5
- package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-setup.js.map +1 -1
- package/payload/platform/plugins/whatsapp/mcp/dist/call-api.d.ts +1 -1
- package/payload/platform/plugins/whatsapp/mcp/dist/call-api.js +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/index.js +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/lib/active-runs.d.ts +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/lib/active-runs.js +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/lib/llm-call.d.ts +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/lib/neo4j.js +2 -2
- package/payload/platform/plugins/workflows/mcp/dist/lib/neo4j.js.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.js +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.js.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.js +4 -4
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.js.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-update.js +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-update.js.map +1 -1
- package/payload/platform/plugins/workflows/mcp/test-workflows.sh +2 -2
- package/payload/platform/scripts/__tests__/first-token-creates-stream-log.test.sh +1 -1
- package/payload/platform/scripts/__tests__/logs-read-prefix.sh +6 -6
- package/payload/platform/scripts/admin-conversation-recover.mjs +5 -5
- package/payload/platform/scripts/admin-persist-audit.ts +4 -4
- package/payload/platform/scripts/check-no-conversation-id-leaks.mjs +1 -1
- package/payload/platform/scripts/check-no-direct-clipboard.mjs +1 -1
- package/payload/platform/scripts/check-no-task-id-leaks.mjs +2 -2
- package/payload/platform/scripts/check-skill-load-coverage.mjs +1 -1
- package/payload/platform/scripts/component-knowledgedoc-backfill.ts +1 -1
- package/payload/platform/scripts/dedupe-userprofile-ghosts.sh +2 -2
- package/payload/platform/scripts/generate-entitlement-fixture.mjs +1 -1
- package/payload/platform/scripts/installer-device-verify.sh +6 -6
- package/payload/platform/scripts/lib/resolve-account-dir.sh +6 -6
- package/payload/platform/scripts/log-adherence-check.sh +3 -3
- package/payload/platform/scripts/logs-read.sh +13 -13
- package/payload/platform/scripts/logs-read.test.sh +1 -1
- package/payload/platform/scripts/migrate-import.sh +4 -4
- package/payload/platform/scripts/redact-install-logs.sh +1 -1
- package/payload/platform/scripts/seed-neo4j.sh +26 -32
- package/payload/platform/scripts/test-laptop-vnc-boot.sh +3 -3
- package/payload/platform/scripts/verify-skill-tool-surface.sh +17 -2
- package/payload/platform/scripts/vnc.sh +9 -9
- package/payload/platform/services/claude-session-manager/dist/config.d.ts +7 -2
- package/payload/platform/services/claude-session-manager/dist/config.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/config.js +3 -1
- package/payload/platform/services/claude-session-manager/dist/config.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.d.ts +2 -2
- 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 +133 -90
- package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/index.js +17 -4
- package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-enumerator.d.ts +2 -2
- package/payload/platform/services/claude-session-manager/dist/jsonl-enumerator.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-enumerator.js +4 -4
- package/payload/platform/services/claude-session-manager/dist/jsonl-enumerator.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-observer.js +1 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-observer.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-path.js +2 -2
- package/payload/platform/services/claude-session-manager/dist/jsonl-path.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +37 -18
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +101 -44
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/public-tool-audit.js +1 -1
- package/payload/platform/services/claude-session-manager/dist/public-tool-audit.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/session-store.d.ts +36 -11
- package/payload/platform/services/claude-session-manager/dist/session-store.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/session-store.js +53 -2
- package/payload/platform/services/claude-session-manager/dist/session-store.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/spawn-rate-limiter.js +2 -2
- package/payload/platform/services/claude-session-manager/dist/spawn-rate-limiter.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/system-prompt.d.ts +46 -1
- package/payload/platform/services/claude-session-manager/dist/system-prompt.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/system-prompt.js +131 -24
- package/payload/platform/services/claude-session-manager/dist/system-prompt.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/tool-surface.js +1 -1
- package/payload/platform/services/claude-session-manager/dist/tool-surface.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/types.d.ts +8 -1
- package/payload/platform/services/claude-session-manager/dist/types.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/url-capture.js +1 -1
- package/payload/platform/services/claude-session-manager/dist/url-capture.js.map +1 -1
- package/payload/platform/templates/agents/admin/IDENTITY.md +14 -0
- package/payload/platform/templates/agents/admin/SOUL.md +1 -3
- package/payload/platform/templates/specialists/agents/personal-assistant.md +1 -3
- package/payload/platform/templates/specialists/agents/project-manager.md +1 -1
- package/payload/platform/templates/systemd/edge.service.template +3 -3
- package/payload/premium-plugins/real-agent/BUNDLE.md +2 -4
- package/payload/premium-plugins/real-agent/plugins/.claude-plugin/marketplace.json +0 -5
- package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/lib/neo4j.js +3 -3
- package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/lib/neo4j.js.map +1 -1
- package/payload/premium-plugins/real-agent/plugins/loop/mcp/src/lib/neo4j.ts +3 -3
- package/payload/server/{chunk-ZGJ6CUU2.js → chunk-3G6JMV7N.js} +1 -1
- package/payload/server/{chunk-KVGTWNKQ.js → chunk-NNHHGQJL.js} +314 -5
- package/payload/server/{chunk-RZQMYJVY.js → chunk-QC5LHYPH.js} +3 -3
- package/payload/server/{cloudflare-task-tracker-4PKOLE4H.js → cloudflare-task-tracker-NEB3X6O2.js} +2 -2
- package/payload/server/maxy-edge.js +2 -2
- package/payload/server/public/assets/{admin-Cuu1QdAA.js → admin-CF2ZQvXu.js} +1 -1
- package/payload/server/public/index.html +1 -1
- package/payload/server/server.js +274 -396
- package/payload/platform/plugins/anthropic/.claude-plugin/plugin.json +0 -8
- package/payload/platform/plugins/anthropic/PLUGIN.md +0 -40
- package/payload/platform/plugins/anthropic/references/console-api.md +0 -186
- package/payload/platform/plugins/anthropic/references/setup-guide.md +0 -36
- package/payload/platform/plugins/anthropic/skills/get-api-key/SKILL.md +0 -136
- package/payload/platform/plugins/estate-onboarding/.claude-plugin/plugin.json +0 -8
- package/payload/platform/plugins/estate-onboarding/PLUGIN.md +0 -30
- package/payload/platform/plugins/estate-onboarding/skills/bootstrap/SKILL.md +0 -26
- package/payload/platform/plugins/estate-onboarding/skills/bootstrap/references/onboarding-flow.md +0 -63
- package/payload/premium-plugins/real-agent/plugins/estate-onboarding/.claude-plugin/plugin.json +0 -8
- package/payload/premium-plugins/real-agent/plugins/estate-onboarding/PLUGIN.md +0 -30
- package/payload/premium-plugins/real-agent/plugins/estate-onboarding/skills/bootstrap/SKILL.md +0 -26
- package/payload/premium-plugins/real-agent/plugins/estate-onboarding/skills/bootstrap/references/onboarding-flow.md +0 -63
package/payload/server/server.js
CHANGED
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
vncLog,
|
|
61
61
|
waitForExit,
|
|
62
62
|
walkPremiumBundles
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-3G6JMV7N.js";
|
|
64
64
|
import {
|
|
65
65
|
CLOUDFLARE_TASK_DIAGNOSTICS,
|
|
66
66
|
appendCloudflareSteps,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
openCloudflareTask,
|
|
70
70
|
readTunnelState,
|
|
71
71
|
resolveUnitGoneVerdict
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-QC5LHYPH.js";
|
|
73
73
|
import {
|
|
74
74
|
GREETING_DIRECTIVE,
|
|
75
75
|
HAIKU_MODEL,
|
|
@@ -85,6 +85,7 @@ import {
|
|
|
85
85
|
getUserTimezone,
|
|
86
86
|
listAdminSessions,
|
|
87
87
|
loadAdminUserName,
|
|
88
|
+
loadUserProfile,
|
|
88
89
|
persistMessage,
|
|
89
90
|
projectAgent,
|
|
90
91
|
renameConversation,
|
|
@@ -92,35 +93,14 @@ import {
|
|
|
92
93
|
verifyAndGetConversationUpdatedAt,
|
|
93
94
|
verifyConversationOwnership,
|
|
94
95
|
writeAdminUserAndPerson
|
|
95
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-NNHHGQJL.js";
|
|
96
97
|
import {
|
|
97
98
|
__commonJS,
|
|
98
99
|
__toESM
|
|
99
100
|
} from "./chunk-JSBRDJBE.js";
|
|
100
101
|
|
|
101
|
-
// ../lib/models/dist/index.js
|
|
102
|
-
var require_dist = __commonJS({
|
|
103
|
-
"../lib/models/dist/index.js"(exports) {
|
|
104
|
-
"use strict";
|
|
105
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
106
|
-
exports.MODEL_CONTEXT_WINDOW = exports.HAIKU_MODEL = exports.SONNET_MODEL = exports.OPUS_MODEL = void 0;
|
|
107
|
-
exports.contextWindow = contextWindow;
|
|
108
|
-
exports.OPUS_MODEL = "claude-opus-4-7";
|
|
109
|
-
exports.SONNET_MODEL = "claude-sonnet-4-6";
|
|
110
|
-
exports.HAIKU_MODEL = "claude-haiku-4-5";
|
|
111
|
-
exports.MODEL_CONTEXT_WINDOW = {
|
|
112
|
-
[exports.OPUS_MODEL]: 2e5,
|
|
113
|
-
[exports.SONNET_MODEL]: 2e5,
|
|
114
|
-
[exports.HAIKU_MODEL]: 2e5
|
|
115
|
-
};
|
|
116
|
-
function contextWindow(model) {
|
|
117
|
-
return exports.MODEL_CONTEXT_WINDOW[model] ?? 2e5;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
|
|
122
102
|
// ../lib/graph-trash/dist/index.js
|
|
123
|
-
var
|
|
103
|
+
var require_dist = __commonJS({
|
|
124
104
|
"../lib/graph-trash/dist/index.js"(exports) {
|
|
125
105
|
"use strict";
|
|
126
106
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -616,14 +596,14 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
616
596
|
|
|
617
597
|
// server/index.ts
|
|
618
598
|
import { readFileSync as readFileSync19, existsSync as existsSync22, watchFile } from "fs";
|
|
619
|
-
import { resolve as resolve22, join as
|
|
620
|
-
import { homedir as
|
|
599
|
+
import { resolve as resolve22, join as join12, basename as basename5 } from "path";
|
|
600
|
+
import { homedir as homedir4 } from "os";
|
|
621
601
|
|
|
622
602
|
// app/lib/agent-slug-pattern.ts
|
|
623
603
|
var AGENT_SLUG_PATTERN = /^\/([a-z][a-z0-9-]{2,49})$/;
|
|
624
604
|
|
|
625
605
|
// server/routes/health.ts
|
|
626
|
-
import { existsSync as
|
|
606
|
+
import { existsSync as existsSync3, readFileSync as readFileSync5 } from "fs";
|
|
627
607
|
import { createConnection as createConnection2 } from "net";
|
|
628
608
|
|
|
629
609
|
// app/lib/claude-auth.ts
|
|
@@ -820,168 +800,6 @@ function getLanIp() {
|
|
|
820
800
|
return fallback;
|
|
821
801
|
}
|
|
822
802
|
|
|
823
|
-
// ../lib/anthropic-key/src/index.ts
|
|
824
|
-
var import_dist = __toESM(require_dist());
|
|
825
|
-
import {
|
|
826
|
-
existsSync as existsSync2,
|
|
827
|
-
mkdirSync,
|
|
828
|
-
readFileSync as readFileSync2,
|
|
829
|
-
unlinkSync,
|
|
830
|
-
writeFileSync as writeFileSync2
|
|
831
|
-
} from "fs";
|
|
832
|
-
import { resolve, join as join2, dirname } from "path";
|
|
833
|
-
import { homedir } from "os";
|
|
834
|
-
var cachedKeyFilePath = null;
|
|
835
|
-
function resolveKeyFilePath() {
|
|
836
|
-
if (cachedKeyFilePath) return cachedKeyFilePath;
|
|
837
|
-
let configDirName = ".maxy";
|
|
838
|
-
const platformRoot = process.env.PLATFORM_ROOT ?? process.env.MAXY_PLATFORM_ROOT;
|
|
839
|
-
if (platformRoot) {
|
|
840
|
-
const brandPath = join2(platformRoot, "config", "brand.json");
|
|
841
|
-
if (!existsSync2(brandPath)) {
|
|
842
|
-
throw new Error(
|
|
843
|
-
`brand.json not found at ${brandPath} \u2014 platform not properly installed`
|
|
844
|
-
);
|
|
845
|
-
}
|
|
846
|
-
try {
|
|
847
|
-
const brand = JSON.parse(readFileSync2(brandPath, "utf-8"));
|
|
848
|
-
if (!brand.configDir) {
|
|
849
|
-
throw new Error(
|
|
850
|
-
`brand.json at ${brandPath} is missing the configDir field`
|
|
851
|
-
);
|
|
852
|
-
}
|
|
853
|
-
configDirName = brand.configDir;
|
|
854
|
-
} catch (err) {
|
|
855
|
-
if (err instanceof SyntaxError) {
|
|
856
|
-
throw new Error(
|
|
857
|
-
`brand.json at ${brandPath} is not valid JSON: ${err.message}`
|
|
858
|
-
);
|
|
859
|
-
}
|
|
860
|
-
throw err;
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
cachedKeyFilePath = resolve(homedir(), configDirName, ".anthropic-api-key");
|
|
864
|
-
return cachedKeyFilePath;
|
|
865
|
-
}
|
|
866
|
-
function readKey() {
|
|
867
|
-
const envKey = process.env.ANTHROPIC_API_KEY;
|
|
868
|
-
if (envKey && envKey.trim()) {
|
|
869
|
-
return envKey.trim();
|
|
870
|
-
}
|
|
871
|
-
let keyFilePath2;
|
|
872
|
-
try {
|
|
873
|
-
keyFilePath2 = resolveKeyFilePath();
|
|
874
|
-
} catch (err) {
|
|
875
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
876
|
-
console.error(`[anthropic-key] path resolution failed: ${msg}`);
|
|
877
|
-
return null;
|
|
878
|
-
}
|
|
879
|
-
if (envKey !== void 0) {
|
|
880
|
-
console.error(
|
|
881
|
-
`[anthropic-key] ANTHROPIC_API_KEY env var is set but empty, falling back to file`
|
|
882
|
-
);
|
|
883
|
-
}
|
|
884
|
-
try {
|
|
885
|
-
const raw = readFileSync2(keyFilePath2, "utf-8").trim();
|
|
886
|
-
if (!raw) {
|
|
887
|
-
console.error(
|
|
888
|
-
`[anthropic-key] key file exists but is empty: ${keyFilePath2}`
|
|
889
|
-
);
|
|
890
|
-
return null;
|
|
891
|
-
}
|
|
892
|
-
return raw;
|
|
893
|
-
} catch (err) {
|
|
894
|
-
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
895
|
-
if (code === "ENOENT") {
|
|
896
|
-
console.error(
|
|
897
|
-
`[anthropic-key] no key available (env var unset, file not found: ${keyFilePath2})`
|
|
898
|
-
);
|
|
899
|
-
} else {
|
|
900
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
901
|
-
console.error(
|
|
902
|
-
`[anthropic-key] failed to read key file ${keyFilePath2}: ${msg}`
|
|
903
|
-
);
|
|
904
|
-
}
|
|
905
|
-
return null;
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
async function validateKey(key) {
|
|
909
|
-
const effectiveKey = key ?? readKey();
|
|
910
|
-
if (!effectiveKey) {
|
|
911
|
-
return {
|
|
912
|
-
status: "missing",
|
|
913
|
-
message: "No API key available (env var unset, file missing or empty)."
|
|
914
|
-
};
|
|
915
|
-
}
|
|
916
|
-
const start = Date.now();
|
|
917
|
-
try {
|
|
918
|
-
const res = await fetch("https://api.anthropic.com/v1/messages", {
|
|
919
|
-
method: "POST",
|
|
920
|
-
headers: {
|
|
921
|
-
"Content-Type": "application/json",
|
|
922
|
-
"x-api-key": effectiveKey,
|
|
923
|
-
"anthropic-version": "2023-06-01"
|
|
924
|
-
},
|
|
925
|
-
body: JSON.stringify({
|
|
926
|
-
model: import_dist.HAIKU_MODEL,
|
|
927
|
-
max_tokens: 1,
|
|
928
|
-
messages: [{ role: "user", content: "hi" }]
|
|
929
|
-
}),
|
|
930
|
-
signal: AbortSignal.timeout(1e4)
|
|
931
|
-
});
|
|
932
|
-
const latency = Date.now() - start;
|
|
933
|
-
if (res.ok || res.status === 429) {
|
|
934
|
-
await res.text();
|
|
935
|
-
console.error(
|
|
936
|
-
`[anthropic-key] validate: valid (${res.status}, ${latency}ms)`
|
|
937
|
-
);
|
|
938
|
-
return {
|
|
939
|
-
status: "valid",
|
|
940
|
-
message: "API key is working. Credits available."
|
|
941
|
-
};
|
|
942
|
-
}
|
|
943
|
-
const body = await res.text();
|
|
944
|
-
if (/credit balance|billing|purchase credits/i.test(body)) {
|
|
945
|
-
console.error(
|
|
946
|
-
`[anthropic-key] validate: billing (${res.status}, ${latency}ms)`
|
|
947
|
-
);
|
|
948
|
-
return {
|
|
949
|
-
status: "billing",
|
|
950
|
-
message: "API key is valid but credit balance is too low. The user must add credits at console.anthropic.com under Plans & Billing, or enable auto-top-up."
|
|
951
|
-
};
|
|
952
|
-
}
|
|
953
|
-
if (res.status === 401 || res.status === 403 || /authentication_error|permission_error/i.test(body)) {
|
|
954
|
-
console.error(
|
|
955
|
-
`[anthropic-key] validate: auth_error (${res.status}, ${latency}ms)`
|
|
956
|
-
);
|
|
957
|
-
return {
|
|
958
|
-
status: "auth_error",
|
|
959
|
-
message: "API key was rejected. It may be invalid, revoked, or expired. The user should create a new key at console.anthropic.com/settings/keys."
|
|
960
|
-
};
|
|
961
|
-
}
|
|
962
|
-
console.error(
|
|
963
|
-
`[anthropic-key] validate: error (${res.status}, ${latency}ms)`
|
|
964
|
-
);
|
|
965
|
-
return {
|
|
966
|
-
status: "error",
|
|
967
|
-
message: `Could not verify API key. Anthropic returned ${res.status}. This may be a temporary outage \u2014 try again later.`
|
|
968
|
-
};
|
|
969
|
-
} catch (err) {
|
|
970
|
-
const latency = Date.now() - start;
|
|
971
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
972
|
-
console.error(
|
|
973
|
-
`[anthropic-key] validate: error (network failure, ${latency}ms): ${msg}`
|
|
974
|
-
);
|
|
975
|
-
return {
|
|
976
|
-
status: "error",
|
|
977
|
-
message: `Could not reach the Anthropic API: ${msg}. Check network connectivity.`
|
|
978
|
-
};
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
function keyFilePath() {
|
|
982
|
-
return resolveKeyFilePath();
|
|
983
|
-
}
|
|
984
|
-
|
|
985
803
|
// app/lib/whatsapp/schema.ts
|
|
986
804
|
import { z } from "zod";
|
|
987
805
|
var DmPolicySchema = z.enum(["open", "allowlist", "disabled"]);
|
|
@@ -1046,20 +864,20 @@ var WhatsAppConfigSchema = z.object({
|
|
|
1046
864
|
});
|
|
1047
865
|
|
|
1048
866
|
// app/lib/whatsapp/config-persist.ts
|
|
1049
|
-
import { readFileSync as
|
|
1050
|
-
import { resolve
|
|
867
|
+
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync2 } from "fs";
|
|
868
|
+
import { resolve, join as join2 } from "path";
|
|
1051
869
|
var TAG = "[whatsapp:config]";
|
|
1052
870
|
function configPath(accountDir) {
|
|
1053
|
-
return
|
|
871
|
+
return resolve(accountDir, "account.json");
|
|
1054
872
|
}
|
|
1055
873
|
function readConfig(accountDir) {
|
|
1056
874
|
const path2 = configPath(accountDir);
|
|
1057
|
-
if (!
|
|
1058
|
-
return JSON.parse(
|
|
875
|
+
if (!existsSync2(path2)) throw new Error(`account.json not found at ${path2}`);
|
|
876
|
+
return JSON.parse(readFileSync2(path2, "utf-8"));
|
|
1059
877
|
}
|
|
1060
878
|
function writeConfig(accountDir, config) {
|
|
1061
879
|
const path2 = configPath(accountDir);
|
|
1062
|
-
|
|
880
|
+
writeFileSync2(path2, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
1063
881
|
}
|
|
1064
882
|
function reloadManagerConfig(accountDir) {
|
|
1065
883
|
try {
|
|
@@ -1229,8 +1047,8 @@ function setPublicAgent(accountDir, slug) {
|
|
|
1229
1047
|
if (!trimmed) {
|
|
1230
1048
|
return { ok: false, error: "Agent slug cannot be empty." };
|
|
1231
1049
|
}
|
|
1232
|
-
const agentConfigPath =
|
|
1233
|
-
if (!
|
|
1050
|
+
const agentConfigPath = join2(accountDir, "agents", trimmed, "config.json");
|
|
1051
|
+
if (!existsSync2(agentConfigPath)) {
|
|
1234
1052
|
return { ok: false, error: `Agent "${trimmed}" not found \u2014 no config.json at ${agentConfigPath}. Check the agent slug and try again.` };
|
|
1235
1053
|
}
|
|
1236
1054
|
try {
|
|
@@ -1293,8 +1111,8 @@ function setGroupPublicAgent(accountDir, accountId, groupJid, slug) {
|
|
|
1293
1111
|
if (!trimmedSlug) return { ok: false, error: "Agent slug cannot be empty." };
|
|
1294
1112
|
if (!trimmedGroup) return { ok: false, error: "Group JID cannot be empty." };
|
|
1295
1113
|
if (!trimmedAccount) return { ok: false, error: "Account ID cannot be empty." };
|
|
1296
|
-
const agentConfigPath =
|
|
1297
|
-
if (!
|
|
1114
|
+
const agentConfigPath = join2(accountDir, "agents", trimmedSlug, "config.json");
|
|
1115
|
+
if (!existsSync2(agentConfigPath)) {
|
|
1298
1116
|
return { ok: false, error: `Agent "${trimmedSlug}" not found \u2014 no config.json at ${agentConfigPath}. Check the agent slug and try again.` };
|
|
1299
1117
|
}
|
|
1300
1118
|
try {
|
|
@@ -2572,8 +2390,8 @@ async function ensureWhatsAppConversation(input) {
|
|
|
2572
2390
|
}
|
|
2573
2391
|
|
|
2574
2392
|
// ../lib/account-enumeration/src/index.ts
|
|
2575
|
-
import { readdirSync, readFileSync as
|
|
2576
|
-
import { resolve as
|
|
2393
|
+
import { readdirSync, readFileSync as readFileSync3 } from "fs";
|
|
2394
|
+
import { resolve as resolve2 } from "path";
|
|
2577
2395
|
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
2578
2396
|
var cache = /* @__PURE__ */ new Map();
|
|
2579
2397
|
function enumerateValidAccountIds(accountsDir) {
|
|
@@ -2592,9 +2410,9 @@ function enumerateValidAccountIds(accountsDir) {
|
|
|
2592
2410
|
const valid = [];
|
|
2593
2411
|
for (const name of names) {
|
|
2594
2412
|
if (!UUID_RE.test(name)) continue;
|
|
2595
|
-
const configPath2 =
|
|
2413
|
+
const configPath2 = resolve2(accountsDir, name, "account.json");
|
|
2596
2414
|
try {
|
|
2597
|
-
JSON.parse(
|
|
2415
|
+
JSON.parse(readFileSync3(configPath2, "utf-8"));
|
|
2598
2416
|
valid.push(name);
|
|
2599
2417
|
} catch (err) {
|
|
2600
2418
|
const code = err.code;
|
|
@@ -2611,7 +2429,7 @@ function getAccountsDirFromEnv() {
|
|
|
2611
2429
|
"[graph-write] MAXY_PLATFORM_ROOT not set \u2014 cannot enforce accountId gate. Set MAXY_PLATFORM_ROOT in the spawning process or pass `accountsDir` explicitly."
|
|
2612
2430
|
);
|
|
2613
2431
|
}
|
|
2614
|
-
return
|
|
2432
|
+
return resolve2(root, "..", "data/accounts");
|
|
2615
2433
|
}
|
|
2616
2434
|
function validateAccountIdEnv(envValue, diskIds) {
|
|
2617
2435
|
if (!envValue) {
|
|
@@ -2650,7 +2468,7 @@ function resolvePlatformAccountId(accountsDir = ACCOUNTS_DIR) {
|
|
|
2650
2468
|
// app/lib/whatsapp/inbound/media.ts
|
|
2651
2469
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
2652
2470
|
import { writeFile, mkdir } from "fs/promises";
|
|
2653
|
-
import { join as
|
|
2471
|
+
import { join as join3 } from "path";
|
|
2654
2472
|
import {
|
|
2655
2473
|
downloadMediaMessage,
|
|
2656
2474
|
downloadContentFromMessage,
|
|
@@ -2736,7 +2554,7 @@ async function downloadInboundMedia(msg, sock, opts) {
|
|
|
2736
2554
|
await mkdir(MEDIA_DIR, { recursive: true });
|
|
2737
2555
|
const ext = mimeToExt(mimetype ?? "application/octet-stream");
|
|
2738
2556
|
const filename = `${randomUUID2()}.${ext}`;
|
|
2739
|
-
const filePath =
|
|
2557
|
+
const filePath = join3(MEDIA_DIR, filename);
|
|
2740
2558
|
await writeFile(filePath, buffer);
|
|
2741
2559
|
const sizeKB = (buffer.length / 1024).toFixed(0);
|
|
2742
2560
|
console.error(`${TAG9} media downloaded type=${mimetype ?? "unknown"} size=${sizeKB}KB path=${filePath}`);
|
|
@@ -3817,10 +3635,10 @@ async function handleInboundMessage(conn, msg) {
|
|
|
3817
3635
|
// app/lib/vnc.ts
|
|
3818
3636
|
import { spawnSync, execFileSync } from "child_process";
|
|
3819
3637
|
import { createConnection } from "net";
|
|
3820
|
-
import { mkdirSync
|
|
3821
|
-
import { resolve as
|
|
3822
|
-
var PLATFORM_ROOT2 = process.env.MAXY_PLATFORM_ROOT ??
|
|
3823
|
-
var VNC_SCRIPT =
|
|
3638
|
+
import { mkdirSync, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
3639
|
+
import { resolve as resolve3 } from "path";
|
|
3640
|
+
var PLATFORM_ROOT2 = process.env.MAXY_PLATFORM_ROOT ?? resolve3(process.cwd(), "..");
|
|
3641
|
+
var VNC_SCRIPT = resolve3(PLATFORM_ROOT2, "scripts/vnc.sh");
|
|
3824
3642
|
var displayMode = process.env.DISPLAY_MODE ?? "virtual";
|
|
3825
3643
|
if (displayMode === "native") {
|
|
3826
3644
|
console.log(`[vnc] DISPLAY_MODE=native \u2014 local requests use desktop display, remote requests use VNC`);
|
|
@@ -3875,7 +3693,7 @@ function discoverNativeDisplay() {
|
|
|
3875
3693
|
const leaderPid = leaderResult.stdout?.trim();
|
|
3876
3694
|
if (leaderPid) {
|
|
3877
3695
|
try {
|
|
3878
|
-
const environ =
|
|
3696
|
+
const environ = readFileSync4(`/proc/${leaderPid}/environ`, "utf8");
|
|
3879
3697
|
const match = environ.split("\0").find((e) => e.startsWith("WAYLAND_DISPLAY="));
|
|
3880
3698
|
if (match) waylandDisplay = match.split("=")[1];
|
|
3881
3699
|
} catch {
|
|
@@ -3930,10 +3748,10 @@ async function waitForPort(port2, timeoutMs = 12e3) {
|
|
|
3930
3748
|
return false;
|
|
3931
3749
|
}
|
|
3932
3750
|
function ensureLogDir() {
|
|
3933
|
-
|
|
3751
|
+
mkdirSync(LOG_DIR, { recursive: true });
|
|
3934
3752
|
}
|
|
3935
3753
|
function logPath(name) {
|
|
3936
|
-
return
|
|
3754
|
+
return resolve3(LOG_DIR, `${name}.log`);
|
|
3937
3755
|
}
|
|
3938
3756
|
async function ensureVnc() {
|
|
3939
3757
|
const up = await waitForPort(RFB_PORT, 1e3);
|
|
@@ -4011,9 +3829,9 @@ function killChromium() {
|
|
|
4011
3829
|
spawnSync("pkill", ["-f", "chromium"], { stdio: "pipe" });
|
|
4012
3830
|
}
|
|
4013
3831
|
function writeChromiumWrapper() {
|
|
4014
|
-
|
|
4015
|
-
const wrapperPath =
|
|
4016
|
-
|
|
3832
|
+
mkdirSync(BIN_DIR, { recursive: true });
|
|
3833
|
+
const wrapperPath = resolve3(BIN_DIR, "chromium");
|
|
3834
|
+
writeFileSync3(wrapperPath, `#!/bin/bash
|
|
4017
3835
|
LOG="${LOG_DIR}/chromium.log"
|
|
4018
3836
|
echo "==== [$(date)] chromium wrapper ====" >> "$LOG"
|
|
4019
3837
|
echo " DISPLAY=$DISPLAY WAYLAND=$WAYLAND_DISPLAY XDG_SESSION_TYPE=$XDG_SESSION_TYPE" >> "$LOG"
|
|
@@ -4027,13 +3845,13 @@ else
|
|
|
4027
3845
|
echo " xdpyinfo ${VNC_DISPLAY} FAILED \u2014 display not ready" >> "$LOG"
|
|
4028
3846
|
fi
|
|
4029
3847
|
|
|
4030
|
-
#
|
|
3848
|
+
# read the install-time-resolved non-snap Chromium binary path.
|
|
4031
3849
|
# The installer (ensureNonSnapChromium + writeChromiumBinaryPathFile) writes
|
|
4032
3850
|
# this file with the absolute path to either /usr/bin/chromium (Pi Bookworm:
|
|
4033
3851
|
# real .deb) or /usr/bin/google-chrome-stable (Ubuntu Noble laptop: snap
|
|
4034
3852
|
# replaced). Refusing the legacy probe loop closes the silent-fallback path
|
|
4035
3853
|
# where /snap/bin/chromium would re-introduce the AppArmor SingletonLock
|
|
4036
|
-
# denial that triggered
|
|
3854
|
+
# denial that triggered.
|
|
4037
3855
|
PATH_FILE="${PLATFORM_ROOT2}/config/chromium-binary.path"
|
|
4038
3856
|
if [ ! -r "$PATH_FILE" ]; then
|
|
4039
3857
|
echo " ERROR: $PATH_FILE missing \u2014 re-run installer" >> "$LOG"
|
|
@@ -4055,7 +3873,7 @@ echo " launching $BIN (realpath=$RESOLVED)" >> "$LOG"
|
|
|
4055
3873
|
|
|
4056
3874
|
# nohup detaches chromium from this wrapper's process group so it outlives
|
|
4057
3875
|
# claude auth login exiting (e.g. on timeout). --user-data-dir is brand-scoped
|
|
4058
|
-
#
|
|
3876
|
+
# so a wrapper-spawned chromium attaches to the same per-brand
|
|
4059
3877
|
# profile that vnc.sh's start_chrome targets \u2014 no shared cookies across brands.
|
|
4060
3878
|
nohup "$BIN" \\
|
|
4061
3879
|
--user-data-dir=${CHROMIUM_PROFILE_DIR} \\
|
|
@@ -4111,19 +3929,6 @@ function buildX11Env(chromiumWrapperPath, transport = "vnc") {
|
|
|
4111
3929
|
}
|
|
4112
3930
|
|
|
4113
3931
|
// server/routes/health.ts
|
|
4114
|
-
var cachedApiKeyStatus = null;
|
|
4115
|
-
var API_KEY_CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
4116
|
-
async function probeApiKey() {
|
|
4117
|
-
if (cachedApiKeyStatus) {
|
|
4118
|
-
const ttl = cachedApiKeyStatus.status === "valid" ? API_KEY_CACHE_TTL_MS : 3e4;
|
|
4119
|
-
if (Date.now() - cachedApiKeyStatus.checkedAt < ttl) {
|
|
4120
|
-
return cachedApiKeyStatus.status;
|
|
4121
|
-
}
|
|
4122
|
-
}
|
|
4123
|
-
const result = await validateKey();
|
|
4124
|
-
cachedApiKeyStatus = { status: result.status, checkedAt: Date.now() };
|
|
4125
|
-
return result.status;
|
|
4126
|
-
}
|
|
4127
3932
|
function checkPort(port2, timeoutMs = 500) {
|
|
4128
3933
|
return new Promise((resolve23) => {
|
|
4129
3934
|
const socket = createConnection2(port2, "127.0.0.1");
|
|
@@ -4147,8 +3952,8 @@ app.get("/", async (c) => {
|
|
|
4147
3952
|
const browserTransport = resolveBrowserTransport(c.req.raw, c.env?.incoming?.socket?.remoteAddress);
|
|
4148
3953
|
let pinConfigured = false;
|
|
4149
3954
|
try {
|
|
4150
|
-
if (
|
|
4151
|
-
const raw =
|
|
3955
|
+
if (existsSync3(USERS_FILE)) {
|
|
3956
|
+
const raw = readFileSync5(USERS_FILE, "utf-8").trim();
|
|
4152
3957
|
if (raw) {
|
|
4153
3958
|
const users = JSON.parse(raw);
|
|
4154
3959
|
pinConfigured = Array.isArray(users) && users.length > 0;
|
|
@@ -4165,19 +3970,6 @@ app.get("/", async (c) => {
|
|
|
4165
3970
|
}
|
|
4166
3971
|
const claudeAuthenticated = authHealth.status === "ok" || authHealth.status === "expiring";
|
|
4167
3972
|
const vncRunning = await checkPort(WEBSOCKIFY_PORT);
|
|
4168
|
-
let apiKeyConfigured = false;
|
|
4169
|
-
try {
|
|
4170
|
-
apiKeyConfigured = existsSync4(keyFilePath());
|
|
4171
|
-
} catch {
|
|
4172
|
-
}
|
|
4173
|
-
let apiKeyStatus = "missing";
|
|
4174
|
-
if (apiKeyConfigured) {
|
|
4175
|
-
try {
|
|
4176
|
-
apiKeyStatus = await probeApiKey();
|
|
4177
|
-
} catch {
|
|
4178
|
-
apiKeyStatus = "error";
|
|
4179
|
-
}
|
|
4180
|
-
}
|
|
4181
3973
|
let whatsappAccounts = [];
|
|
4182
3974
|
try {
|
|
4183
3975
|
whatsappAccounts = getStatus().map((a) => ({
|
|
@@ -4203,8 +3995,6 @@ app.get("/", async (c) => {
|
|
|
4203
3995
|
browser_transport: browserTransport,
|
|
4204
3996
|
auth_status: authHealth.status,
|
|
4205
3997
|
auth_expires_at: authHealth.expiresAt ?? null,
|
|
4206
|
-
api_key_configured: apiKeyConfigured,
|
|
4207
|
-
api_key_status: apiKeyStatus,
|
|
4208
3998
|
server_ip: getLanIp(),
|
|
4209
3999
|
missingPlugins,
|
|
4210
4000
|
whatsapp: {
|
|
@@ -4220,9 +4010,9 @@ var health_default = app;
|
|
|
4220
4010
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
4221
4011
|
import { mkdir as mkdir2, readFile, stat as stat2, writeFile as writeFile2 } from "fs/promises";
|
|
4222
4012
|
import { realpathSync } from "fs";
|
|
4223
|
-
import { resolve as
|
|
4224
|
-
var PLATFORM_ROOT3 = process.env.MAXY_PLATFORM_ROOT ??
|
|
4225
|
-
var ATTACHMENTS_ROOT =
|
|
4013
|
+
import { resolve as resolve4, extname, basename } from "path";
|
|
4014
|
+
var PLATFORM_ROOT3 = process.env.MAXY_PLATFORM_ROOT ?? resolve4(process.cwd(), "../platform");
|
|
4015
|
+
var ATTACHMENTS_ROOT = resolve4(PLATFORM_ROOT3, "..", "data/uploads");
|
|
4226
4016
|
var SUPPORTED_MIME_TYPES = /* @__PURE__ */ new Set([
|
|
4227
4017
|
"image/jpeg",
|
|
4228
4018
|
"image/png",
|
|
@@ -4249,11 +4039,11 @@ function assertSupportedMime(mimeType) {
|
|
|
4249
4039
|
}
|
|
4250
4040
|
async function writeAttachment(scope, filename, mimeType, sizeBytes, buffer) {
|
|
4251
4041
|
const attachmentId = randomUUID3();
|
|
4252
|
-
const dir =
|
|
4042
|
+
const dir = resolve4(ATTACHMENTS_ROOT, scope, attachmentId);
|
|
4253
4043
|
await mkdir2(dir, { recursive: true });
|
|
4254
4044
|
const ext = extname(filename) || "";
|
|
4255
|
-
const storagePath =
|
|
4256
|
-
const metaPath =
|
|
4045
|
+
const storagePath = resolve4(dir, `${attachmentId}${ext}`);
|
|
4046
|
+
const metaPath = resolve4(dir, `${attachmentId}.meta.json`);
|
|
4257
4047
|
const meta = {
|
|
4258
4048
|
attachmentId,
|
|
4259
4049
|
scope,
|
|
@@ -4329,11 +4119,11 @@ async function storeComponentArtefact(accountId, attachmentId, mimeType, content
|
|
|
4329
4119
|
`Component artefact exceeds the 50 MB limit (${(buffer.byteLength / 1024 / 1024).toFixed(1)} MB).`
|
|
4330
4120
|
);
|
|
4331
4121
|
}
|
|
4332
|
-
const dir =
|
|
4122
|
+
const dir = resolve4(ATTACHMENTS_ROOT, accountId, attachmentId);
|
|
4333
4123
|
await mkdir2(dir, { recursive: true });
|
|
4334
4124
|
const ext = extname(filename) || (mimeType === "text/html" ? ".html" : ".md");
|
|
4335
|
-
const storagePath =
|
|
4336
|
-
const metaPath =
|
|
4125
|
+
const storagePath = resolve4(dir, `${attachmentId}${ext}`);
|
|
4126
|
+
const metaPath = resolve4(dir, `${attachmentId}.meta.json`);
|
|
4337
4127
|
const meta = {
|
|
4338
4128
|
attachmentId,
|
|
4339
4129
|
scope: accountId,
|
|
@@ -4350,7 +4140,7 @@ async function storeComponentArtefact(accountId, attachmentId, mimeType, content
|
|
|
4350
4140
|
// app/lib/stt/voice-note.ts
|
|
4351
4141
|
import { writeFile as writeFile3, mkdtemp, rm } from "fs/promises";
|
|
4352
4142
|
import { tmpdir } from "os";
|
|
4353
|
-
import { join as
|
|
4143
|
+
import { join as join4 } from "path";
|
|
4354
4144
|
var TAG14 = "[voice]";
|
|
4355
4145
|
var AUDIO_MIME_TYPES = /* @__PURE__ */ new Set([
|
|
4356
4146
|
"audio/ogg",
|
|
@@ -4394,9 +4184,9 @@ async function transcribeVoiceNote(file, source) {
|
|
|
4394
4184
|
let tempDir;
|
|
4395
4185
|
let tempPath;
|
|
4396
4186
|
try {
|
|
4397
|
-
tempDir = await mkdtemp(
|
|
4187
|
+
tempDir = await mkdtemp(join4(tmpdir(), "voice-"));
|
|
4398
4188
|
const ext = audioExtension(mimeType);
|
|
4399
|
-
tempPath =
|
|
4189
|
+
tempPath = join4(tempDir, `recording${ext}`);
|
|
4400
4190
|
const buffer = Buffer.from(await file.arrayBuffer());
|
|
4401
4191
|
await writeFile3(tempPath, buffer);
|
|
4402
4192
|
} catch (err) {
|
|
@@ -4437,10 +4227,10 @@ async function transcribeVoiceNote(file, source) {
|
|
|
4437
4227
|
}
|
|
4438
4228
|
|
|
4439
4229
|
// ../lib/oauth-llm/src/index.ts
|
|
4440
|
-
import { readFileSync as
|
|
4441
|
-
import { resolve as
|
|
4442
|
-
import { homedir
|
|
4443
|
-
var CREDENTIALS_FILE = process.env.CLAUDE_CONFIG_DIR ?
|
|
4230
|
+
import { readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
|
|
4231
|
+
import { resolve as resolve5 } from "path";
|
|
4232
|
+
import { homedir } from "os";
|
|
4233
|
+
var CREDENTIALS_FILE = process.env.CLAUDE_CONFIG_DIR ? resolve5(process.env.CLAUDE_CONFIG_DIR, ".credentials.json") : resolve5(homedir(), ".claude", ".credentials.json");
|
|
4444
4234
|
var TOKEN_ENDPOINT2 = "https://platform.claude.com/v1/oauth/token";
|
|
4445
4235
|
var ANTHROPIC_MESSAGES_ENDPOINT = "https://api.anthropic.com/v1/messages";
|
|
4446
4236
|
var ANTHROPIC_VERSION = "2023-06-01";
|
|
@@ -4459,7 +4249,7 @@ function isInputTooLargeBody(body) {
|
|
|
4459
4249
|
function readCredentials2() {
|
|
4460
4250
|
let raw;
|
|
4461
4251
|
try {
|
|
4462
|
-
raw =
|
|
4252
|
+
raw = readFileSync6(CREDENTIALS_FILE, "utf-8");
|
|
4463
4253
|
} catch {
|
|
4464
4254
|
return null;
|
|
4465
4255
|
}
|
|
@@ -4488,7 +4278,7 @@ function writeCredentials(tokens) {
|
|
|
4488
4278
|
const newExpiresAt = typeof tokens.expiresIn === "number" && tokens.expiresIn > 0 ? Date.now() + tokens.expiresIn * 1e3 : Date.now() + 3600 * 1e3;
|
|
4489
4279
|
let fileData = {};
|
|
4490
4280
|
try {
|
|
4491
|
-
fileData = JSON.parse(
|
|
4281
|
+
fileData = JSON.parse(readFileSync6(CREDENTIALS_FILE, "utf-8"));
|
|
4492
4282
|
} catch {
|
|
4493
4283
|
}
|
|
4494
4284
|
const existing = fileData.claudeAiOauth;
|
|
@@ -4498,7 +4288,7 @@ function writeCredentials(tokens) {
|
|
|
4498
4288
|
...tokens.refreshToken != null ? { refreshToken: tokens.refreshToken } : {},
|
|
4499
4289
|
expiresAt: newExpiresAt
|
|
4500
4290
|
};
|
|
4501
|
-
|
|
4291
|
+
writeFileSync4(CREDENTIALS_FILE, JSON.stringify(fileData, null, 2), "utf-8");
|
|
4502
4292
|
return newExpiresAt;
|
|
4503
4293
|
}
|
|
4504
4294
|
var refreshLock2 = null;
|
|
@@ -4972,7 +4762,7 @@ async function processInbound(rawText, channel) {
|
|
|
4972
4762
|
}
|
|
4973
4763
|
|
|
4974
4764
|
// app/lib/channel-pty-bridge/bridge.ts
|
|
4975
|
-
import { resolve as
|
|
4765
|
+
import { resolve as resolve6 } from "path";
|
|
4976
4766
|
|
|
4977
4767
|
// app/lib/channel-pty-bridge/manager-client.ts
|
|
4978
4768
|
function managerBase() {
|
|
@@ -4988,7 +4778,9 @@ async function managerSpawn(opts) {
|
|
|
4988
4778
|
role: opts.role,
|
|
4989
4779
|
channel: opts.channel,
|
|
4990
4780
|
accountId: opts.accountId,
|
|
4991
|
-
attachmentDir: opts.attachmentDir
|
|
4781
|
+
attachmentDir: opts.attachmentDir,
|
|
4782
|
+
aboutOwner: opts.aboutOwner,
|
|
4783
|
+
dormantPlugins: opts.dormantPlugins
|
|
4992
4784
|
})
|
|
4993
4785
|
}).catch((err) => ({ __throw: err instanceof Error ? err.message : String(err) }));
|
|
4994
4786
|
if ("__throw" in res) {
|
|
@@ -5130,7 +4922,7 @@ async function ensureEntry(input) {
|
|
|
5130
4922
|
}
|
|
5131
4923
|
return existing;
|
|
5132
4924
|
}
|
|
5133
|
-
const attachmentDir = input.role === "public" ?
|
|
4925
|
+
const attachmentDir = input.role === "public" ? resolve6(ATTACHMENTS_ROOT, "public", input.senderId) : void 0;
|
|
5134
4926
|
const spawned = await managerSpawn({
|
|
5135
4927
|
senderId: input.senderId,
|
|
5136
4928
|
role: input.role,
|
|
@@ -5487,9 +5279,9 @@ ${lines}]`;
|
|
|
5487
5279
|
var chat_default = app2;
|
|
5488
5280
|
|
|
5489
5281
|
// server/routes/whatsapp.ts
|
|
5490
|
-
import { join as
|
|
5282
|
+
import { join as join5, resolve as resolve7, basename as basename2 } from "path";
|
|
5491
5283
|
import { readFile as readFile2, stat as stat3 } from "fs/promises";
|
|
5492
|
-
import { realpathSync as realpathSync2, readdirSync as readdirSync2, readFileSync as
|
|
5284
|
+
import { realpathSync as realpathSync2, readdirSync as readdirSync2, readFileSync as readFileSync7, existsSync as existsSync4 } from "fs";
|
|
5493
5285
|
|
|
5494
5286
|
// app/lib/whatsapp/login.ts
|
|
5495
5287
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
@@ -5830,7 +5622,7 @@ app3.post("/login/start", async (c) => {
|
|
|
5830
5622
|
const body = await c.req.json().catch(() => ({}));
|
|
5831
5623
|
const accountId = validateAccountId(body.accountId);
|
|
5832
5624
|
const force = body.force ?? false;
|
|
5833
|
-
const authDir =
|
|
5625
|
+
const authDir = join5(MAXY_DIR, "credentials", "whatsapp", accountId);
|
|
5834
5626
|
const result = await startLogin({ accountId, authDir, force });
|
|
5835
5627
|
console.error(`${TAG17} login/start result account=${accountId} hasQr=${!!result.qrRaw}${result.selfPhone ? ` phone=${result.selfPhone}` : ""}`);
|
|
5836
5628
|
return c.json(result);
|
|
@@ -5990,17 +5782,17 @@ app3.post("/config", async (c) => {
|
|
|
5990
5782
|
return c.json(result, result.ok ? 200 : 400);
|
|
5991
5783
|
}
|
|
5992
5784
|
case "list-public-agents": {
|
|
5993
|
-
const agentsDir =
|
|
5785
|
+
const agentsDir = resolve7(account.accountDir, "agents");
|
|
5994
5786
|
const agents = [];
|
|
5995
|
-
if (
|
|
5787
|
+
if (existsSync4(agentsDir)) {
|
|
5996
5788
|
try {
|
|
5997
5789
|
const entries = readdirSync2(agentsDir, { withFileTypes: true });
|
|
5998
5790
|
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
5999
5791
|
if (!entry.isDirectory() || entry.name === "admin") continue;
|
|
6000
|
-
const configPath2 =
|
|
6001
|
-
if (!
|
|
5792
|
+
const configPath2 = resolve7(agentsDir, entry.name, "config.json");
|
|
5793
|
+
if (!existsSync4(configPath2)) continue;
|
|
6002
5794
|
try {
|
|
6003
|
-
const config = JSON.parse(
|
|
5795
|
+
const config = JSON.parse(readFileSync7(configPath2, "utf-8"));
|
|
6004
5796
|
agents.push({ slug: entry.name, displayName: config.displayName ?? entry.name });
|
|
6005
5797
|
} catch {
|
|
6006
5798
|
console.error(`${TAG17} config action=list-public-agents error="failed to parse config.json for agent ${entry.name}" \u2014 skipping`);
|
|
@@ -6075,7 +5867,7 @@ app3.post("/send-document", async (c) => {
|
|
|
6075
5867
|
if (!maxyAccountId || !PLATFORM_ROOT4) {
|
|
6076
5868
|
return c.json({ error: "Cannot validate file path: missing account or platform context" }, 400);
|
|
6077
5869
|
}
|
|
6078
|
-
const accountDir =
|
|
5870
|
+
const accountDir = resolve7(PLATFORM_ROOT4, "..", "data/accounts", maxyAccountId);
|
|
6079
5871
|
let resolvedPath;
|
|
6080
5872
|
try {
|
|
6081
5873
|
resolvedPath = realpathSync2(filePath);
|
|
@@ -6306,12 +6098,12 @@ var whatsapp_default = app3;
|
|
|
6306
6098
|
|
|
6307
6099
|
// server/routes/onboarding.ts
|
|
6308
6100
|
import { spawn, spawnSync as spawnSync2, execFileSync as execFileSync2 } from "child_process";
|
|
6309
|
-
import { openSync, closeSync, writeFileSync as
|
|
6101
|
+
import { openSync, closeSync, writeFileSync as writeFileSync6, writeSync, existsSync as existsSync6, readFileSync as readFileSync9, unlinkSync } from "fs";
|
|
6310
6102
|
import { createHash, randomUUID as randomUUID5 } from "crypto";
|
|
6311
6103
|
|
|
6312
6104
|
// ../lib/admins-write/src/index.ts
|
|
6313
|
-
import { existsSync as
|
|
6314
|
-
import { dirname
|
|
6105
|
+
import { existsSync as existsSync5, readFileSync as readFileSync8, writeFileSync as writeFileSync5, renameSync, mkdirSync as mkdirSync2, readdirSync as readdirSync3, statSync as statSync2 } from "fs";
|
|
6106
|
+
import { dirname, join as join6 } from "path";
|
|
6315
6107
|
function logLine(input, result) {
|
|
6316
6108
|
const userIdShort = input.userId.slice(0, 8);
|
|
6317
6109
|
console.error(
|
|
@@ -6319,17 +6111,17 @@ function logLine(input, result) {
|
|
|
6319
6111
|
);
|
|
6320
6112
|
}
|
|
6321
6113
|
function writeFileAtomic(filePath, contents, mode) {
|
|
6322
|
-
|
|
6114
|
+
mkdirSync2(dirname(filePath), { recursive: true });
|
|
6323
6115
|
const tempPath = `${filePath}.tmp-${process.pid}-${Date.now()}`;
|
|
6324
|
-
|
|
6116
|
+
writeFileSync5(tempPath, contents, mode !== void 0 ? { mode } : void 0);
|
|
6325
6117
|
renameSync(tempPath, filePath);
|
|
6326
6118
|
}
|
|
6327
6119
|
function writeAdminEntry(input) {
|
|
6328
6120
|
const result = { usersJsonResult: "noop", accountJsonResult: "noop" };
|
|
6329
6121
|
try {
|
|
6330
6122
|
let users = [];
|
|
6331
|
-
if (
|
|
6332
|
-
const raw =
|
|
6123
|
+
if (existsSync5(input.usersFile)) {
|
|
6124
|
+
const raw = readFileSync8(input.usersFile, "utf-8").trim();
|
|
6333
6125
|
if (raw) {
|
|
6334
6126
|
const parsed = JSON.parse(raw);
|
|
6335
6127
|
if (!Array.isArray(parsed)) {
|
|
@@ -6355,11 +6147,11 @@ function writeAdminEntry(input) {
|
|
|
6355
6147
|
return result;
|
|
6356
6148
|
}
|
|
6357
6149
|
try {
|
|
6358
|
-
const accountJsonPath =
|
|
6359
|
-
if (!
|
|
6150
|
+
const accountJsonPath = join6(input.accountDir, "account.json");
|
|
6151
|
+
if (!existsSync5(accountJsonPath)) {
|
|
6360
6152
|
throw new Error(`account.json not found at ${accountJsonPath}`);
|
|
6361
6153
|
}
|
|
6362
|
-
const config = JSON.parse(
|
|
6154
|
+
const config = JSON.parse(readFileSync8(accountJsonPath, "utf-8"));
|
|
6363
6155
|
const admins = config.admins ?? [];
|
|
6364
6156
|
if (admins.some((a) => a.userId === input.userId)) {
|
|
6365
6157
|
result.accountJsonResult = "noop";
|
|
@@ -6383,9 +6175,9 @@ function checkAdminAuthInvariant(input) {
|
|
|
6383
6175
|
usersWithoutAccount: []
|
|
6384
6176
|
};
|
|
6385
6177
|
const usersUserIds = /* @__PURE__ */ new Set();
|
|
6386
|
-
if (
|
|
6178
|
+
if (existsSync5(input.usersFile)) {
|
|
6387
6179
|
try {
|
|
6388
|
-
const raw =
|
|
6180
|
+
const raw = readFileSync8(input.usersFile, "utf-8").trim();
|
|
6389
6181
|
if (raw) {
|
|
6390
6182
|
const users = JSON.parse(raw);
|
|
6391
6183
|
for (const u of users) {
|
|
@@ -6398,7 +6190,7 @@ function checkAdminAuthInvariant(input) {
|
|
|
6398
6190
|
}
|
|
6399
6191
|
}
|
|
6400
6192
|
const accountUserIds = /* @__PURE__ */ new Set();
|
|
6401
|
-
if (
|
|
6193
|
+
if (existsSync5(input.accountsDir)) {
|
|
6402
6194
|
let entries;
|
|
6403
6195
|
try {
|
|
6404
6196
|
entries = readdirSync3(input.accountsDir);
|
|
@@ -6410,17 +6202,17 @@ function checkAdminAuthInvariant(input) {
|
|
|
6410
6202
|
}
|
|
6411
6203
|
for (const entry of entries) {
|
|
6412
6204
|
if (entry.startsWith(".")) continue;
|
|
6413
|
-
const accountDir =
|
|
6205
|
+
const accountDir = join6(input.accountsDir, entry);
|
|
6414
6206
|
try {
|
|
6415
6207
|
if (!statSync2(accountDir).isDirectory()) continue;
|
|
6416
6208
|
} catch {
|
|
6417
6209
|
continue;
|
|
6418
6210
|
}
|
|
6419
|
-
const accountJsonPath =
|
|
6420
|
-
if (!
|
|
6211
|
+
const accountJsonPath = join6(accountDir, "account.json");
|
|
6212
|
+
if (!existsSync5(accountJsonPath)) continue;
|
|
6421
6213
|
let admins = [];
|
|
6422
6214
|
try {
|
|
6423
|
-
const config = JSON.parse(
|
|
6215
|
+
const config = JSON.parse(readFileSync8(accountJsonPath, "utf-8"));
|
|
6424
6216
|
admins = config.admins ?? [];
|
|
6425
6217
|
} catch (err) {
|
|
6426
6218
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -6460,8 +6252,8 @@ function hashPin(pin) {
|
|
|
6460
6252
|
return createHash("sha256").update(pin).digest("hex");
|
|
6461
6253
|
}
|
|
6462
6254
|
function readUsersFile() {
|
|
6463
|
-
if (!
|
|
6464
|
-
const raw =
|
|
6255
|
+
if (!existsSync6(USERS_FILE)) return null;
|
|
6256
|
+
const raw = readFileSync9(USERS_FILE, "utf-8").trim();
|
|
6465
6257
|
if (!raw) return [];
|
|
6466
6258
|
return JSON.parse(raw);
|
|
6467
6259
|
}
|
|
@@ -6527,7 +6319,7 @@ app4.post("/claude-auth", async (c) => {
|
|
|
6527
6319
|
if (!vncReady) return c.json({ error: "VNC display failed to start" }, 500);
|
|
6528
6320
|
}
|
|
6529
6321
|
await ensureCdp(transport);
|
|
6530
|
-
|
|
6322
|
+
writeFileSync6(logPath("claude-auth"), "");
|
|
6531
6323
|
const chromiumWrapper = writeChromiumWrapper();
|
|
6532
6324
|
const x11Env = buildX11Env(chromiumWrapper, transport);
|
|
6533
6325
|
vncLog("claude-auth", { action: "start", transport });
|
|
@@ -6659,10 +6451,10 @@ app4.delete("/set-pin", async (c) => {
|
|
|
6659
6451
|
}
|
|
6660
6452
|
const remaining = users.filter((u) => u.userId !== matchedUser.userId);
|
|
6661
6453
|
if (remaining.length === 0) {
|
|
6662
|
-
|
|
6454
|
+
unlinkSync(USERS_FILE);
|
|
6663
6455
|
console.log(`[set-pin] cleared users.json (last entry removed): userId=${matchedUser.userId.slice(0, 8)}\u2026`);
|
|
6664
6456
|
} else {
|
|
6665
|
-
|
|
6457
|
+
writeFileSync6(USERS_FILE, JSON.stringify(remaining), { mode: 384 });
|
|
6666
6458
|
console.log(`[set-pin] removed entry from users.json: userId=${matchedUser.userId.slice(0, 8)}\u2026 remaining=${remaining.length}`);
|
|
6667
6459
|
}
|
|
6668
6460
|
return c.json({ ok: true });
|
|
@@ -6670,9 +6462,9 @@ app4.delete("/set-pin", async (c) => {
|
|
|
6670
6462
|
var onboarding_default = app4;
|
|
6671
6463
|
|
|
6672
6464
|
// server/routes/client-error.ts
|
|
6673
|
-
import { appendFileSync, existsSync as
|
|
6674
|
-
import { join as
|
|
6675
|
-
var CLIENT_ERRORS_LOG =
|
|
6465
|
+
import { appendFileSync, existsSync as existsSync7, renameSync as renameSync2, statSync as statSync3 } from "fs";
|
|
6466
|
+
import { join as join7 } from "path";
|
|
6467
|
+
var CLIENT_ERRORS_LOG = join7(LOG_DIR, "client-errors.log");
|
|
6676
6468
|
var MAX_LOG_SIZE = 10 * 1024 * 1024;
|
|
6677
6469
|
var MAX_BODY_SIZE = 8 * 1024;
|
|
6678
6470
|
var MAX_STACK_LEN = 2e3;
|
|
@@ -6715,7 +6507,7 @@ function stackHead(stack) {
|
|
|
6715
6507
|
}
|
|
6716
6508
|
function rotateIfNeeded() {
|
|
6717
6509
|
try {
|
|
6718
|
-
if (!
|
|
6510
|
+
if (!existsSync7(CLIENT_ERRORS_LOG)) return;
|
|
6719
6511
|
const stats = statSync3(CLIENT_ERRORS_LOG);
|
|
6720
6512
|
if (stats.size < MAX_LOG_SIZE) return;
|
|
6721
6513
|
renameSync2(CLIENT_ERRORS_LOG, CLIENT_ERRORS_LOG + ".1");
|
|
@@ -6829,8 +6621,8 @@ app5.post("/", async (c) => {
|
|
|
6829
6621
|
var client_error_default = app5;
|
|
6830
6622
|
|
|
6831
6623
|
// server/routes/admin/session.ts
|
|
6832
|
-
import { readFileSync as
|
|
6833
|
-
import { join as
|
|
6624
|
+
import { readFileSync as readFileSync10, readdirSync as readdirSync4, statSync as statSync4, writeFileSync as writeFileSync7, existsSync as existsSync8 } from "fs";
|
|
6625
|
+
import { join as join8 } from "path";
|
|
6834
6626
|
import { createHash as createHash2 } from "crypto";
|
|
6835
6627
|
import { randomUUID as randomUUID6 } from "crypto";
|
|
6836
6628
|
var deprecationLogged = /* @__PURE__ */ new Set();
|
|
@@ -6838,15 +6630,15 @@ function hashPin2(pin) {
|
|
|
6838
6630
|
return createHash2("sha256").update(pin).digest("hex");
|
|
6839
6631
|
}
|
|
6840
6632
|
function readUsersFile2() {
|
|
6841
|
-
if (!
|
|
6842
|
-
const raw =
|
|
6633
|
+
if (!existsSync8(USERS_FILE)) return null;
|
|
6634
|
+
const raw = readFileSync10(USERS_FILE, "utf-8").trim();
|
|
6843
6635
|
if (!raw) return [];
|
|
6844
6636
|
return JSON.parse(raw);
|
|
6845
6637
|
}
|
|
6846
6638
|
function scanForOrphanedAccountAdmins(users) {
|
|
6847
6639
|
const usersUserIds = new Set(users.map((u) => u.userId));
|
|
6848
6640
|
const orphans = [];
|
|
6849
|
-
if (!
|
|
6641
|
+
if (!existsSync8(ACCOUNTS_DIR)) return orphans;
|
|
6850
6642
|
let entries;
|
|
6851
6643
|
try {
|
|
6852
6644
|
entries = readdirSync4(ACCOUNTS_DIR);
|
|
@@ -6855,16 +6647,16 @@ function scanForOrphanedAccountAdmins(users) {
|
|
|
6855
6647
|
}
|
|
6856
6648
|
for (const entry of entries) {
|
|
6857
6649
|
if (entry.startsWith(".")) continue;
|
|
6858
|
-
const accountDir =
|
|
6650
|
+
const accountDir = join8(ACCOUNTS_DIR, entry);
|
|
6859
6651
|
try {
|
|
6860
6652
|
if (!statSync4(accountDir).isDirectory()) continue;
|
|
6861
6653
|
} catch {
|
|
6862
6654
|
continue;
|
|
6863
6655
|
}
|
|
6864
|
-
const accountJsonPath =
|
|
6865
|
-
if (!
|
|
6656
|
+
const accountJsonPath = join8(accountDir, "account.json");
|
|
6657
|
+
if (!existsSync8(accountJsonPath)) continue;
|
|
6866
6658
|
try {
|
|
6867
|
-
const config = JSON.parse(
|
|
6659
|
+
const config = JSON.parse(readFileSync10(accountJsonPath, "utf-8"));
|
|
6868
6660
|
const admins = config.admins ?? [];
|
|
6869
6661
|
for (const a of admins) {
|
|
6870
6662
|
if (typeof a.userId === "string" && !usersUserIds.has(a.userId)) {
|
|
@@ -6890,7 +6682,7 @@ function stripLegacyNameField(users) {
|
|
|
6890
6682
|
}
|
|
6891
6683
|
}
|
|
6892
6684
|
try {
|
|
6893
|
-
|
|
6685
|
+
writeFileSync7(USERS_FILE, JSON.stringify(users), { mode: 384 });
|
|
6894
6686
|
} catch (err) {
|
|
6895
6687
|
console.error(`[admin-identity] users-json strip failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
6896
6688
|
}
|
|
@@ -7185,18 +6977,18 @@ app9.post("/", requireAdminSession, async (c) => {
|
|
|
7185
6977
|
var failure_report_default = app9;
|
|
7186
6978
|
|
|
7187
6979
|
// server/routes/admin/logs.ts
|
|
7188
|
-
import { existsSync as
|
|
7189
|
-
import { resolve as
|
|
6980
|
+
import { existsSync as existsSync10, readdirSync as readdirSync5, readFileSync as readFileSync11, statSync as statSync5 } from "fs";
|
|
6981
|
+
import { resolve as resolve8, basename as basename3 } from "path";
|
|
7190
6982
|
|
|
7191
6983
|
// app/lib/logs-read-resolve.ts
|
|
7192
|
-
import { existsSync as
|
|
7193
|
-
import { join as
|
|
6984
|
+
import { existsSync as existsSync9 } from "fs";
|
|
6985
|
+
import { join as join9 } from "path";
|
|
7194
6986
|
function resolveSessionLogPaths(filename, logDirs) {
|
|
7195
6987
|
const tried = [filename];
|
|
7196
6988
|
const hits = [];
|
|
7197
6989
|
for (const dir of logDirs) {
|
|
7198
|
-
const fullPath =
|
|
7199
|
-
if (
|
|
6990
|
+
const fullPath = join9(dir, filename);
|
|
6991
|
+
if (existsSync9(fullPath)) {
|
|
7200
6992
|
hits.push({ path: fullPath, dir });
|
|
7201
6993
|
}
|
|
7202
6994
|
}
|
|
@@ -7213,7 +7005,7 @@ app10.get("/", async (c) => {
|
|
|
7213
7005
|
const cacheKeyParam = c.req.query("cacheKey");
|
|
7214
7006
|
const download = c.req.query("download") === "1";
|
|
7215
7007
|
const account = resolveAccount();
|
|
7216
|
-
const accountLogDir = account ?
|
|
7008
|
+
const accountLogDir = account ? resolve8(account.accountDir, "logs") : null;
|
|
7217
7009
|
const logDirs = [];
|
|
7218
7010
|
if (accountLogDir) logDirs.push(accountLogDir);
|
|
7219
7011
|
logDirs.push(LOG_DIR);
|
|
@@ -7221,10 +7013,10 @@ app10.get("/", async (c) => {
|
|
|
7221
7013
|
const safe = basename3(fileParam);
|
|
7222
7014
|
const searched = [];
|
|
7223
7015
|
for (const dir of logDirs) {
|
|
7224
|
-
const filePath =
|
|
7016
|
+
const filePath = resolve8(dir, safe);
|
|
7225
7017
|
searched.push(filePath);
|
|
7226
7018
|
try {
|
|
7227
|
-
const buffer =
|
|
7019
|
+
const buffer = readFileSync11(filePath);
|
|
7228
7020
|
const onDiskBytes = statSync5(filePath).size;
|
|
7229
7021
|
const headers = {
|
|
7230
7022
|
"Content-Type": "text/plain; charset=utf-8",
|
|
@@ -7289,7 +7081,7 @@ app10.get("/", async (c) => {
|
|
|
7289
7081
|
console.info(`[admin/logs] resolved cacheKey=${cacheKeySlice} conversationId=${conversationIdSlice} via=${primaryId === cacheKey ? "cacheKey" : primaryId === sessionKeyFromConv ? "reverse-lookup" : "conversationId-fallback"}`);
|
|
7290
7082
|
try {
|
|
7291
7083
|
const filename = basename3(hit.path);
|
|
7292
|
-
const buffer =
|
|
7084
|
+
const buffer = readFileSync11(hit.path);
|
|
7293
7085
|
const onDiskBytes = statSync5(hit.path).size;
|
|
7294
7086
|
const headers = {
|
|
7295
7087
|
"Content-Type": "text/plain; charset=utf-8",
|
|
@@ -7324,7 +7116,7 @@ app10.get("/", async (c) => {
|
|
|
7324
7116
|
const seen = /* @__PURE__ */ new Set();
|
|
7325
7117
|
const logs = {};
|
|
7326
7118
|
for (const dir of logDirs) {
|
|
7327
|
-
if (!
|
|
7119
|
+
if (!existsSync10(dir)) continue;
|
|
7328
7120
|
let files;
|
|
7329
7121
|
try {
|
|
7330
7122
|
files = readdirSync5(dir).filter((f) => f.endsWith(".log"));
|
|
@@ -7333,10 +7125,10 @@ app10.get("/", async (c) => {
|
|
|
7333
7125
|
console.warn(`[admin/logs] readdir-fail dir=${dir} reason=${reason}`);
|
|
7334
7126
|
continue;
|
|
7335
7127
|
}
|
|
7336
|
-
files.filter((f) => !seen.has(f)).map((f) => ({ name: f, mtime: statSync5(
|
|
7128
|
+
files.filter((f) => !seen.has(f)).map((f) => ({ name: f, mtime: statSync5(resolve8(dir, f)).mtimeMs })).sort((a, b) => b.mtime - a.mtime).forEach(({ name }) => {
|
|
7337
7129
|
seen.add(name);
|
|
7338
7130
|
try {
|
|
7339
|
-
const content =
|
|
7131
|
+
const content = readFileSync11(resolve8(dir, name));
|
|
7340
7132
|
const tail = content.length > TAIL_BYTES ? content.subarray(content.length - TAIL_BYTES).toString("utf-8") : content.toString("utf-8");
|
|
7341
7133
|
logs[name] = tail.trim() || "(empty)";
|
|
7342
7134
|
} catch (err) {
|
|
@@ -7375,8 +7167,8 @@ var claude_info_default = app11;
|
|
|
7375
7167
|
|
|
7376
7168
|
// server/routes/admin/attachment.ts
|
|
7377
7169
|
import { readFile as readFile3, readdir } from "fs/promises";
|
|
7378
|
-
import { existsSync as
|
|
7379
|
-
import { resolve as
|
|
7170
|
+
import { existsSync as existsSync11 } from "fs";
|
|
7171
|
+
import { resolve as resolve9 } from "path";
|
|
7380
7172
|
var app12 = new Hono();
|
|
7381
7173
|
app12.get("/:attachmentId", requireAdminSession, async (c) => {
|
|
7382
7174
|
const attachmentId = c.req.param("attachmentId");
|
|
@@ -7388,12 +7180,12 @@ app12.get("/:attachmentId", requireAdminSession, async (c) => {
|
|
|
7388
7180
|
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(attachmentId)) {
|
|
7389
7181
|
return new Response("Not found", { status: 404 });
|
|
7390
7182
|
}
|
|
7391
|
-
const dir =
|
|
7392
|
-
if (!
|
|
7183
|
+
const dir = resolve9(ATTACHMENTS_ROOT, accountId, attachmentId);
|
|
7184
|
+
if (!existsSync11(dir)) {
|
|
7393
7185
|
return new Response("Not found", { status: 404 });
|
|
7394
7186
|
}
|
|
7395
|
-
const metaPath =
|
|
7396
|
-
if (!
|
|
7187
|
+
const metaPath = resolve9(dir, `${attachmentId}.meta.json`);
|
|
7188
|
+
if (!existsSync11(metaPath)) {
|
|
7397
7189
|
return new Response("Not found", { status: 404 });
|
|
7398
7190
|
}
|
|
7399
7191
|
let meta;
|
|
@@ -7407,7 +7199,7 @@ app12.get("/:attachmentId", requireAdminSession, async (c) => {
|
|
|
7407
7199
|
if (!dataFile) {
|
|
7408
7200
|
return new Response("Not found", { status: 404 });
|
|
7409
7201
|
}
|
|
7410
|
-
const filePath =
|
|
7202
|
+
const filePath = resolve9(dir, dataFile);
|
|
7411
7203
|
const buffer = await readFile3(filePath);
|
|
7412
7204
|
return new Response(new Uint8Array(buffer), {
|
|
7413
7205
|
headers: {
|
|
@@ -7420,24 +7212,24 @@ app12.get("/:attachmentId", requireAdminSession, async (c) => {
|
|
|
7420
7212
|
var attachment_default = app12;
|
|
7421
7213
|
|
|
7422
7214
|
// server/routes/admin/agents.ts
|
|
7423
|
-
import { resolve as
|
|
7424
|
-
import { readdirSync as readdirSync6, readFileSync as
|
|
7215
|
+
import { resolve as resolve10 } from "path";
|
|
7216
|
+
import { readdirSync as readdirSync6, readFileSync as readFileSync12, existsSync as existsSync12, rmSync } from "fs";
|
|
7425
7217
|
var app13 = new Hono();
|
|
7426
7218
|
app13.get("/", (c) => {
|
|
7427
7219
|
const account = resolveAccount();
|
|
7428
7220
|
if (!account) return c.json({ agents: [] });
|
|
7429
|
-
const agentsDir =
|
|
7430
|
-
if (!
|
|
7221
|
+
const agentsDir = resolve10(account.accountDir, "agents");
|
|
7222
|
+
if (!existsSync12(agentsDir)) return c.json({ agents: [] });
|
|
7431
7223
|
const agents = [];
|
|
7432
7224
|
try {
|
|
7433
7225
|
const entries = readdirSync6(agentsDir, { withFileTypes: true });
|
|
7434
7226
|
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
7435
7227
|
if (!entry.isDirectory()) continue;
|
|
7436
7228
|
if (entry.name === "admin") continue;
|
|
7437
|
-
const configPath2 =
|
|
7438
|
-
if (!
|
|
7229
|
+
const configPath2 = resolve10(agentsDir, entry.name, "config.json");
|
|
7230
|
+
if (!existsSync12(configPath2)) continue;
|
|
7439
7231
|
try {
|
|
7440
|
-
const config = JSON.parse(
|
|
7232
|
+
const config = JSON.parse(readFileSync12(configPath2, "utf-8"));
|
|
7441
7233
|
agents.push({
|
|
7442
7234
|
slug: entry.name,
|
|
7443
7235
|
displayName: config.displayName ?? entry.name,
|
|
@@ -7463,8 +7255,8 @@ app13.delete("/:slug", async (c) => {
|
|
|
7463
7255
|
if (slug.includes("/") || slug.includes("..") || slug.includes("\\")) {
|
|
7464
7256
|
return c.json({ error: "Invalid agent slug" }, 400);
|
|
7465
7257
|
}
|
|
7466
|
-
const agentDir =
|
|
7467
|
-
if (!
|
|
7258
|
+
const agentDir = resolve10(account.accountDir, "agents", slug);
|
|
7259
|
+
if (!existsSync12(agentDir)) {
|
|
7468
7260
|
return c.json({ error: "Agent not found" }, 404);
|
|
7469
7261
|
}
|
|
7470
7262
|
try {
|
|
@@ -7493,8 +7285,8 @@ app13.post("/:slug/project", async (c) => {
|
|
|
7493
7285
|
if (slug.includes("/") || slug.includes("..") || slug.includes("\\")) {
|
|
7494
7286
|
return c.json({ error: "Invalid agent slug" }, 400);
|
|
7495
7287
|
}
|
|
7496
|
-
const agentDir =
|
|
7497
|
-
if (!
|
|
7288
|
+
const agentDir = resolve10(account.accountDir, "agents", slug);
|
|
7289
|
+
if (!existsSync12(agentDir)) {
|
|
7498
7290
|
return c.json({ error: "Agent not found on disk" }, 404);
|
|
7499
7291
|
}
|
|
7500
7292
|
try {
|
|
@@ -7510,7 +7302,7 @@ var agents_default = app13;
|
|
|
7510
7302
|
// server/routes/admin/sessions.ts
|
|
7511
7303
|
import crypto from "crypto";
|
|
7512
7304
|
import { resolve as resolvePath } from "path";
|
|
7513
|
-
import { existsSync as
|
|
7305
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync3, createWriteStream } from "fs";
|
|
7514
7306
|
|
|
7515
7307
|
// app/lib/synthetic-marker.ts
|
|
7516
7308
|
var CLOUDFLARE_MARKER_PREFIX = "Cloudflare setup completed (actionId: ";
|
|
@@ -7527,7 +7319,7 @@ var replayJsonl = (..._args) => null;
|
|
|
7527
7319
|
var resolveJsonlPath = (..._args) => null;
|
|
7528
7320
|
|
|
7529
7321
|
// server/routes/admin/sessions.ts
|
|
7530
|
-
import { homedir as
|
|
7322
|
+
import { homedir as homedir2 } from "os";
|
|
7531
7323
|
|
|
7532
7324
|
// app/lib/claude-agent/component-attachment.ts
|
|
7533
7325
|
var pickComponentBytes = (..._args) => null;
|
|
@@ -7536,7 +7328,7 @@ var pickComponentBytes = (..._args) => null;
|
|
|
7536
7328
|
function openResumeStreamLog(accountId, conversationId) {
|
|
7537
7329
|
const dir = resolvePath(ACCOUNTS_DIR, accountId, "resume-logs");
|
|
7538
7330
|
try {
|
|
7539
|
-
|
|
7331
|
+
mkdirSync3(dir, { recursive: true });
|
|
7540
7332
|
} catch {
|
|
7541
7333
|
}
|
|
7542
7334
|
return createWriteStream(resolvePath(dir, `${conversationId}.log`), { flags: "a" });
|
|
@@ -7567,7 +7359,7 @@ function validateAndShapeAttachments(raws, conversationAccountId, conversationId
|
|
|
7567
7359
|
let reason = null;
|
|
7568
7360
|
if (!a.attachmentId || !a.filename || !a.mimeType || !a.storagePath) reason = "schema-fail";
|
|
7569
7361
|
else if (a.accountId !== conversationAccountId) reason = "account-mismatch";
|
|
7570
|
-
else if (!
|
|
7362
|
+
else if (!existsSync13(a.storagePath)) reason = "missing-file";
|
|
7571
7363
|
if (reason) {
|
|
7572
7364
|
invalid++;
|
|
7573
7365
|
try {
|
|
@@ -7830,7 +7622,7 @@ app14.post("/:id/resume", async (c) => {
|
|
|
7830
7622
|
return c.json({ error: "Failed to load conversation messages" }, 500);
|
|
7831
7623
|
}
|
|
7832
7624
|
if (persistedAgentSessionId) {
|
|
7833
|
-
const jsonlPath = resolveJsonlPath(
|
|
7625
|
+
const jsonlPath = resolveJsonlPath(homedir2(), resolvePath(ACCOUNTS_DIR, accountId), persistedAgentSessionId);
|
|
7834
7626
|
const replay = replayJsonl(jsonlPath);
|
|
7835
7627
|
jsonlMissing = replay.jsonlMissing;
|
|
7836
7628
|
jsonlMalformedLines = replay.malformedLines;
|
|
@@ -7884,7 +7676,7 @@ app14.post("/:id/resume", async (c) => {
|
|
|
7884
7676
|
ordinal: c2.ordinal,
|
|
7885
7677
|
textOffset: c2.textOffset,
|
|
7886
7678
|
submitted: false,
|
|
7887
|
-
//
|
|
7679
|
+
// JSONL has artefactAttachmentId for persistent components.
|
|
7888
7680
|
...c2.artefactAttachmentId ? { attachmentId: c2.artefactAttachmentId } : {}
|
|
7889
7681
|
})),
|
|
7890
7682
|
attachments: []
|
|
@@ -8093,6 +7885,77 @@ app14.put("/:id/label", requireAdminSession, async (c) => {
|
|
|
8093
7885
|
});
|
|
8094
7886
|
var sessions_default = app14;
|
|
8095
7887
|
|
|
7888
|
+
// app/lib/claude-agent/spawn-context.ts
|
|
7889
|
+
import { existsSync as existsSync14, readFileSync as readFileSync13, readdirSync as readdirSync7 } from "fs";
|
|
7890
|
+
import { resolve as resolve11 } from "path";
|
|
7891
|
+
async function resolveOwnerProfileBlock(accountId, userId) {
|
|
7892
|
+
if (!userId) return { ok: false, reason: "missing-user-id" };
|
|
7893
|
+
try {
|
|
7894
|
+
const body = await loadUserProfile(accountId, userId);
|
|
7895
|
+
if (body === null) return { ok: false, reason: "profile-not-found" };
|
|
7896
|
+
return { ok: true, body };
|
|
7897
|
+
} catch (err) {
|
|
7898
|
+
console.error(
|
|
7899
|
+
`[spawn-context] neo4j-unreachable: ${err instanceof Error ? err.message : String(err)}`
|
|
7900
|
+
);
|
|
7901
|
+
return { ok: false, reason: "neo4j-unreachable" };
|
|
7902
|
+
}
|
|
7903
|
+
}
|
|
7904
|
+
function frontmatterField(manifest, field) {
|
|
7905
|
+
const fm = manifest.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
7906
|
+
if (!fm) return null;
|
|
7907
|
+
const re = new RegExp(`^${field}:\\s*(.*?)\\r?$`, "m");
|
|
7908
|
+
const m = fm[1].match(re);
|
|
7909
|
+
if (!m) return null;
|
|
7910
|
+
let value = m[1].trim();
|
|
7911
|
+
if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
|
|
7912
|
+
value = value.slice(1, -1);
|
|
7913
|
+
}
|
|
7914
|
+
return value || null;
|
|
7915
|
+
}
|
|
7916
|
+
function computeDormantPlugins(accountId) {
|
|
7917
|
+
const accountFile = resolve11(PLATFORM_ROOT, "..", "data/accounts", accountId, "account.json");
|
|
7918
|
+
if (!existsSync14(accountFile)) return [];
|
|
7919
|
+
let enabled;
|
|
7920
|
+
try {
|
|
7921
|
+
const raw = readFileSync13(accountFile, "utf-8");
|
|
7922
|
+
const parsed = JSON.parse(raw);
|
|
7923
|
+
enabled = new Set(
|
|
7924
|
+
Array.isArray(parsed.enabledPlugins) ? parsed.enabledPlugins.filter((p) => typeof p === "string") : []
|
|
7925
|
+
);
|
|
7926
|
+
} catch (err) {
|
|
7927
|
+
console.error(
|
|
7928
|
+
`[spawn-context] account.json read failed for ${accountId.slice(0, 8)}\u2026: ${err instanceof Error ? err.message : String(err)}`
|
|
7929
|
+
);
|
|
7930
|
+
return [];
|
|
7931
|
+
}
|
|
7932
|
+
const pluginsDir = resolve11(PLATFORM_ROOT, "plugins");
|
|
7933
|
+
if (!existsSync14(pluginsDir)) return [];
|
|
7934
|
+
let entries;
|
|
7935
|
+
try {
|
|
7936
|
+
entries = readdirSync7(pluginsDir);
|
|
7937
|
+
} catch {
|
|
7938
|
+
return [];
|
|
7939
|
+
}
|
|
7940
|
+
const out = [];
|
|
7941
|
+
for (const name of entries) {
|
|
7942
|
+
if (enabled.has(name)) continue;
|
|
7943
|
+
const manifestPath = resolve11(pluginsDir, name, "PLUGIN.md");
|
|
7944
|
+
if (!existsSync14(manifestPath)) continue;
|
|
7945
|
+
let manifest;
|
|
7946
|
+
try {
|
|
7947
|
+
manifest = readFileSync13(manifestPath, "utf-8");
|
|
7948
|
+
} catch {
|
|
7949
|
+
continue;
|
|
7950
|
+
}
|
|
7951
|
+
const description = frontmatterField(manifest, "description");
|
|
7952
|
+
if (!description) continue;
|
|
7953
|
+
out.push({ name, description });
|
|
7954
|
+
}
|
|
7955
|
+
out.sort((a, b) => a.name.localeCompare(b.name));
|
|
7956
|
+
return out;
|
|
7957
|
+
}
|
|
7958
|
+
|
|
8096
7959
|
// server/routes/admin/claude-sessions.ts
|
|
8097
7960
|
var TAG18 = "[claude-session-manager:wrapper]";
|
|
8098
7961
|
function managerBase2() {
|
|
@@ -8108,6 +7971,7 @@ app15.post("/", async (c) => {
|
|
|
8108
7971
|
console.error(`${TAG18} reject reason=no-account-id`);
|
|
8109
7972
|
return c.json({ error: "admin-account-not-resolved" }, 500);
|
|
8110
7973
|
}
|
|
7974
|
+
const userId = getUserIdForSession(cacheKey);
|
|
8111
7975
|
let body = {};
|
|
8112
7976
|
try {
|
|
8113
7977
|
body = await c.req.json();
|
|
@@ -8116,10 +7980,19 @@ app15.post("/", async (c) => {
|
|
|
8116
7980
|
const channel = typeof body.channel === "string" ? body.channel : "browser";
|
|
8117
7981
|
const initialMessage = typeof body.initialMessage === "string" && body.initialMessage.trim() ? body.initialMessage : null;
|
|
8118
7982
|
const permissionMode = typeof body.permissionMode === "string" ? body.permissionMode : void 0;
|
|
7983
|
+
const aboutOwner = await resolveOwnerProfileBlock(senderId, userId);
|
|
7984
|
+
const dormantPlugins = computeDormantPlugins(senderId);
|
|
8119
7985
|
const upstream = await fetch(`${managerBase2()}/spawn`, {
|
|
8120
7986
|
method: "POST",
|
|
8121
7987
|
headers: { "content-type": "application/json" },
|
|
8122
|
-
body: JSON.stringify({
|
|
7988
|
+
body: JSON.stringify({
|
|
7989
|
+
senderId,
|
|
7990
|
+
role: "admin",
|
|
7991
|
+
channel,
|
|
7992
|
+
permissionMode,
|
|
7993
|
+
aboutOwner,
|
|
7994
|
+
dormantPlugins
|
|
7995
|
+
})
|
|
8123
7996
|
}).catch((err) => {
|
|
8124
7997
|
console.error(`${TAG18} fetch-failed op=spawn message=${err instanceof Error ? err.message : String(err)}`);
|
|
8125
7998
|
return null;
|
|
@@ -8160,6 +8033,7 @@ app15.post("/resume", async (c) => {
|
|
|
8160
8033
|
const cacheKey = c.get("cacheKey") ?? "";
|
|
8161
8034
|
const senderId = getAccountIdForSession(cacheKey) ?? "";
|
|
8162
8035
|
if (!senderId) return c.json({ error: "admin-account-not-resolved" }, 500);
|
|
8036
|
+
const userId = getUserIdForSession(cacheKey);
|
|
8163
8037
|
let body = {};
|
|
8164
8038
|
try {
|
|
8165
8039
|
body = await c.req.json();
|
|
@@ -8170,6 +8044,8 @@ app15.post("/resume", async (c) => {
|
|
|
8170
8044
|
return c.json({ error: "claudeSessionId-required" }, 400);
|
|
8171
8045
|
}
|
|
8172
8046
|
const channel = typeof body.channel === "string" ? body.channel : "browser";
|
|
8047
|
+
const aboutOwner = await resolveOwnerProfileBlock(senderId, userId);
|
|
8048
|
+
const dormantPlugins = computeDormantPlugins(senderId);
|
|
8173
8049
|
const upstream = await fetch(`${managerBase2()}/resume`, {
|
|
8174
8050
|
method: "POST",
|
|
8175
8051
|
headers: { "content-type": "application/json" },
|
|
@@ -8177,7 +8053,9 @@ app15.post("/resume", async (c) => {
|
|
|
8177
8053
|
senderId,
|
|
8178
8054
|
role: "admin",
|
|
8179
8055
|
channel,
|
|
8180
|
-
claudeSessionId: body.claudeSessionId
|
|
8056
|
+
claudeSessionId: body.claudeSessionId,
|
|
8057
|
+
aboutOwner,
|
|
8058
|
+
dormantPlugins
|
|
8181
8059
|
})
|
|
8182
8060
|
}).catch((err) => {
|
|
8183
8061
|
console.error(`${TAG18} fetch-failed op=resume message=${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -8513,7 +8391,7 @@ app19.post("/", async (c) => {
|
|
|
8513
8391
|
var events_default = app19;
|
|
8514
8392
|
|
|
8515
8393
|
// server/routes/admin/cloudflare.ts
|
|
8516
|
-
import { homedir as
|
|
8394
|
+
import { homedir as homedir3 } from "os";
|
|
8517
8395
|
import { resolve as resolve13 } from "path";
|
|
8518
8396
|
import { readFileSync as readFileSync15 } from "fs";
|
|
8519
8397
|
|
|
@@ -8531,8 +8409,8 @@ function isValidDomain(value) {
|
|
|
8531
8409
|
}
|
|
8532
8410
|
|
|
8533
8411
|
// app/lib/alias-domains.ts
|
|
8534
|
-
import { existsSync as existsSync15, mkdirSync as
|
|
8535
|
-
import { dirname as
|
|
8412
|
+
import { existsSync as existsSync15, mkdirSync as mkdirSync4, readFileSync as readFileSync14, writeFileSync as writeFileSync8 } from "fs";
|
|
8413
|
+
import { dirname as dirname2 } from "path";
|
|
8536
8414
|
import { resolve as resolve12 } from "path";
|
|
8537
8415
|
var ALIAS_DOMAINS_PATH = resolve12(MAXY_DIR, "alias-domains.json");
|
|
8538
8416
|
function readExisting() {
|
|
@@ -8549,14 +8427,14 @@ function addAliasDomain(hostname2) {
|
|
|
8549
8427
|
const existing = readExisting();
|
|
8550
8428
|
if (existing.has(hostname2)) return;
|
|
8551
8429
|
existing.add(hostname2);
|
|
8552
|
-
|
|
8553
|
-
|
|
8430
|
+
mkdirSync4(dirname2(ALIAS_DOMAINS_PATH), { recursive: true });
|
|
8431
|
+
writeFileSync8(ALIAS_DOMAINS_PATH, JSON.stringify([...existing], null, 2) + "\n", "utf-8");
|
|
8554
8432
|
}
|
|
8555
8433
|
|
|
8556
8434
|
// app/lib/script-stream-tailer.ts
|
|
8557
8435
|
import * as childProcess from "child_process";
|
|
8558
|
-
import { appendFileSync as appendFileSync2, createReadStream as createReadStream2, mkdirSync as
|
|
8559
|
-
import { dirname as
|
|
8436
|
+
import { appendFileSync as appendFileSync2, createReadStream as createReadStream2, mkdirSync as mkdirSync5, statSync as statSync6 } from "fs";
|
|
8437
|
+
import { dirname as dirname3 } from "path";
|
|
8560
8438
|
import { StringDecoder } from "string_decoder";
|
|
8561
8439
|
var SCRIPT_STREAM_RE = /^\[([^\]]+)\] \[script:([a-z][a-z0-9-]*)((?::[a-z0-9:_-]+)?)\] (.*)$/;
|
|
8562
8440
|
function parseLine(line) {
|
|
@@ -8665,7 +8543,7 @@ function writeRouteMilestone(streamLogPath, scope, line) {
|
|
|
8665
8543
|
}
|
|
8666
8544
|
const ts = (/* @__PURE__ */ new Date()).toISOString();
|
|
8667
8545
|
try {
|
|
8668
|
-
|
|
8546
|
+
mkdirSync5(dirname3(streamLogPath), { recursive: true });
|
|
8669
8547
|
appendFileSync2(streamLogPath, `[${ts}] [script:${scope}] ${line}
|
|
8670
8548
|
`);
|
|
8671
8549
|
} catch (err) {
|
|
@@ -8966,7 +8844,7 @@ app20.get("/domains", requireAdminSession, async (c) => {
|
|
|
8966
8844
|
streamLogPath = cloudflareStreamLogPath(accountId, correlationId);
|
|
8967
8845
|
log(`phase=stream-log-resolved path=${streamLogPath}`);
|
|
8968
8846
|
const brand = loadBrandInfo();
|
|
8969
|
-
const scriptPath = resolve13(
|
|
8847
|
+
const scriptPath = resolve13(homedir3(), "list-cf-domains.sh");
|
|
8970
8848
|
const result = await runFormSpawn({
|
|
8971
8849
|
scriptPath,
|
|
8972
8850
|
args: [brand.hostname],
|
|
@@ -9057,7 +8935,7 @@ app20.get("/tunnels", requireAdminSession, async (c) => {
|
|
|
9057
8935
|
if (!accountId) return err("session", "No account bound to session \u2014 refresh chat.");
|
|
9058
8936
|
if (!correlationId) return err("session", "No active conversation for session \u2014 refresh chat.");
|
|
9059
8937
|
streamLogPath = cloudflareStreamLogPath(accountId, correlationId);
|
|
9060
|
-
const certPath = resolve13(
|
|
8938
|
+
const certPath = resolve13(homedir3(), brand.configDir, "cloudflared", "cert.pem");
|
|
9061
8939
|
const { existsSync: existsSync23 } = await import("fs");
|
|
9062
8940
|
if (!existsSync23(certPath)) {
|
|
9063
8941
|
return err("cert", `Cloudflare origin certificate is not on disk yet (${certPath}). Complete the Cloudflare login first by submitting the form once \u2014 the OAuth flow writes cert.pem.`);
|
|
@@ -9383,7 +9261,7 @@ var cloudflare_default = app20;
|
|
|
9383
9261
|
import { createReadStream as createReadStream3 } from "fs";
|
|
9384
9262
|
import { readdir as readdir2, readFile as readFile4, stat as stat4, mkdir as mkdir3, writeFile as writeFile4, unlink as unlink2 } from "fs/promises";
|
|
9385
9263
|
import { realpathSync as realpathSync4 } from "fs";
|
|
9386
|
-
import { basename as basename4, dirname as
|
|
9264
|
+
import { basename as basename4, dirname as dirname4, join as join10, resolve as resolve15, sep as sep3 } from "path";
|
|
9387
9265
|
import { Readable as Readable2 } from "stream";
|
|
9388
9266
|
|
|
9389
9267
|
// app/lib/data-path.ts
|
|
@@ -9740,7 +9618,7 @@ async function cascadeDeleteDocument(params) {
|
|
|
9740
9618
|
var UUID_RE4 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
9741
9619
|
async function readMeta(absDir, baseName) {
|
|
9742
9620
|
try {
|
|
9743
|
-
const raw = await readFile4(
|
|
9621
|
+
const raw = await readFile4(join10(absDir, `${baseName}.meta.json`), "utf8");
|
|
9744
9622
|
const parsed = JSON.parse(raw);
|
|
9745
9623
|
if (typeof parsed?.filename === "string") {
|
|
9746
9624
|
return { filename: parsed.filename, mimeType: typeof parsed.mimeType === "string" ? parsed.mimeType : void 0 };
|
|
@@ -9778,7 +9656,7 @@ async function readAccountNames() {
|
|
|
9778
9656
|
}
|
|
9779
9657
|
async function enrich(absolute, entry, accountNames) {
|
|
9780
9658
|
if (entry.kind === "directory" && UUID_RE4.test(entry.name)) {
|
|
9781
|
-
const meta = await readMeta(
|
|
9659
|
+
const meta = await readMeta(join10(absolute, entry.name), entry.name);
|
|
9782
9660
|
if (meta?.filename) {
|
|
9783
9661
|
entry.displayName = meta.filename;
|
|
9784
9662
|
entry.mimeType = meta.mimeType;
|
|
@@ -9837,7 +9715,7 @@ app21.get("/", requireAdminSession, async (c) => {
|
|
|
9837
9715
|
continue;
|
|
9838
9716
|
}
|
|
9839
9717
|
try {
|
|
9840
|
-
const entryPath =
|
|
9718
|
+
const entryPath = join10(absolute, name);
|
|
9841
9719
|
const s = await stat4(entryPath);
|
|
9842
9720
|
entries.push({
|
|
9843
9721
|
name,
|
|
@@ -10010,7 +9888,7 @@ app21.delete("/", requireAdminSession, async (c) => {
|
|
|
10010
9888
|
}
|
|
10011
9889
|
const dot = base.lastIndexOf(".");
|
|
10012
9890
|
const stem = dot === -1 ? base : base.slice(0, dot);
|
|
10013
|
-
const sidecarPath = UUID_RE4.test(stem) && base !== `${stem}.meta.json` ?
|
|
9891
|
+
const sidecarPath = UUID_RE4.test(stem) && base !== `${stem}.meta.json` ? join10(dirname4(absolute), `${stem}.meta.json`) : null;
|
|
10014
9892
|
await unlink2(absolute);
|
|
10015
9893
|
if (sidecarPath) {
|
|
10016
9894
|
try {
|
|
@@ -10047,7 +9925,7 @@ app21.delete("/", requireAdminSession, async (c) => {
|
|
|
10047
9925
|
var files_default = app21;
|
|
10048
9926
|
|
|
10049
9927
|
// ../lib/graph-search/src/index.ts
|
|
10050
|
-
var
|
|
9928
|
+
var import_dist = __toESM(require_dist());
|
|
10051
9929
|
import { int } from "neo4j-driver";
|
|
10052
9930
|
var VECTOR_WEIGHT = 0.7;
|
|
10053
9931
|
var BM25_WEIGHT = 0.3;
|
|
@@ -10102,7 +9980,7 @@ async function bm25Only(session, params) {
|
|
|
10102
9980
|
${scopeClause}
|
|
10103
9981
|
${agentClause}
|
|
10104
9982
|
${labelClause}
|
|
10105
|
-
AND ${(0,
|
|
9983
|
+
AND ${(0, import_dist.notTrashed)("node")}
|
|
10106
9984
|
${kwClause}
|
|
10107
9985
|
RETURN node, score, labels(node) AS nodeLabels, elementId(node) AS nodeId
|
|
10108
9986
|
ORDER BY score DESC
|
|
@@ -10209,7 +10087,7 @@ async function hybrid(session, embed2, params) {
|
|
|
10209
10087
|
WHERE node.accountId = $accountId
|
|
10210
10088
|
${scopeClause}
|
|
10211
10089
|
${agentClause}
|
|
10212
|
-
AND ${(0,
|
|
10090
|
+
AND ${(0, import_dist.notTrashed)("node")}
|
|
10213
10091
|
${keywordClause}
|
|
10214
10092
|
RETURN node, score, labels(node) AS nodeLabels, elementId(node) AS nodeId
|
|
10215
10093
|
ORDER BY score DESC
|
|
@@ -10271,7 +10149,7 @@ async function hybrid(session, embed2, params) {
|
|
|
10271
10149
|
const propResult = await session.run(
|
|
10272
10150
|
`MATCH (node)
|
|
10273
10151
|
WHERE node.accountId = $accountId
|
|
10274
|
-
AND ${(0,
|
|
10152
|
+
AND ${(0, import_dist.notTrashed)("node")}
|
|
10275
10153
|
AND node.keywords IS NOT NULL
|
|
10276
10154
|
AND ANY(kw IN $kwSubs WHERE ANY(nk IN node.keywords WHERE toLower(nk) = kw))
|
|
10277
10155
|
${propScopeClause}
|
|
@@ -10329,7 +10207,7 @@ async function hybrid(session, embed2, params) {
|
|
|
10329
10207
|
labels: node.labels,
|
|
10330
10208
|
properties: node.properties,
|
|
10331
10209
|
score: node.combinedScore,
|
|
10332
|
-
//
|
|
10210
|
+
// carry the per-half components so the /data UI can render
|
|
10333
10211
|
// a per-row breakdown. These are already computed on `ScoredNode` from
|
|
10334
10212
|
// the vector half (raw cosine) and the bm25 half (post-merge normalised
|
|
10335
10213
|
// value, NOT raw Lucene). Memory MCP ignores both; admin route forwards
|
|
@@ -10347,7 +10225,7 @@ async function hybrid(session, embed2, params) {
|
|
|
10347
10225
|
`UNWIND $nodeIds AS nid
|
|
10348
10226
|
MATCH (n)-[r]-(related)
|
|
10349
10227
|
WHERE elementId(n) = nid
|
|
10350
|
-
AND ${(0,
|
|
10228
|
+
AND ${(0, import_dist.notTrashed)("related")}
|
|
10351
10229
|
${expandScopeClause}
|
|
10352
10230
|
${expandAgentClause}
|
|
10353
10231
|
WITH nid, n, r, related
|
|
@@ -10537,7 +10415,7 @@ app22.get("/", requireAdminSession, async (c) => {
|
|
|
10537
10415
|
mode: res.mode,
|
|
10538
10416
|
embedError: res.embedError,
|
|
10539
10417
|
elapsedMs: total,
|
|
10540
|
-
//
|
|
10418
|
+
// UI surfaces ("N suppressed — show all" affordance on
|
|
10541
10419
|
// /graph and /data). `suppressed` is the count of rows the lib
|
|
10542
10420
|
// dropped via the vector-cosine floor; `threshold` echoes the value
|
|
10543
10421
|
// applied (null when no filter ran). `bm25Bypass` is operator-only
|
|
@@ -10581,7 +10459,7 @@ var GRAPH_LABEL_COLOURS = {
|
|
|
10581
10459
|
AccessGrant: "#66381F",
|
|
10582
10460
|
// Knowledge — moss family (organic)
|
|
10583
10461
|
KnowledgeDocument: "#6E8A5A",
|
|
10584
|
-
//
|
|
10462
|
+
// chunked WhatsApp/messaging archive parent. Sits in the
|
|
10585
10463
|
// knowledge moss family because it's structurally a document parent
|
|
10586
10464
|
// (HAS_SECTION → :Section:Conversation chunks); the conversational
|
|
10587
10465
|
// plum family is reserved for the live Conversation/Message labels.
|
|
@@ -10597,7 +10475,7 @@ var GRAPH_LABEL_COLOURS = {
|
|
|
10597
10475
|
ImageObject: "#A0BB8C",
|
|
10598
10476
|
// Conversational — muted plum/lavender family
|
|
10599
10477
|
//
|
|
10600
|
-
// Pairwise-distinctness invariants (carried forward
|
|
10478
|
+
// Pairwise-distinctness invariants (carried forward
|
|
10601
10479
|
// palette):
|
|
10602
10480
|
// - Four sublabelled conversation/message labels (AdminConversation,
|
|
10603
10481
|
// PublicConversation, UserMessage, AssistantMessage) are pairwise
|
|
@@ -10632,7 +10510,7 @@ var GRAPH_LABEL_COLOURS = {
|
|
|
10632
10510
|
// confusion doesn't apply, but kept distinguishable for the legend)
|
|
10633
10511
|
Email: "#6F7F4A",
|
|
10634
10512
|
EmailAccount: "#91A063",
|
|
10635
|
-
// Public-agent projection
|
|
10513
|
+
// Public-agent projection — burnished bronze sits between
|
|
10636
10514
|
// people-terracotta and email-moss but shares neither hue, signalling
|
|
10637
10515
|
// "operator-defined persona that traverses to KnowledgeDocuments,
|
|
10638
10516
|
// Conversations, and other entities" without colliding with any existing
|
|
@@ -10884,7 +10762,7 @@ async function handleNeighbourhood(c, accountId) {
|
|
|
10884
10762
|
// bare JS `number` works on Pi 4 today but errors on driver versions
|
|
10885
10763
|
// that strictly type-check LIMIT clauses against Long.
|
|
10886
10764
|
neighbourhoodLimit: neo4j.int(NEIGHBOURHOOD_LIMIT),
|
|
10887
|
-
//
|
|
10765
|
+
// same Long-int discipline for the cluster-expand cap.
|
|
10888
10766
|
// Used by NEIGHBOURHOOD_CYPHER's `siblingMessages[0..$clusterMessagesCap]`
|
|
10889
10767
|
// slice. The search-intersect variant ignores it (cluster-expand
|
|
10890
10768
|
// does not apply when search is narrowing the canvas).
|
|
@@ -11620,7 +11498,7 @@ function validateBody2(body) {
|
|
|
11620
11498
|
ok: false,
|
|
11621
11499
|
code: "not-eligible-chip",
|
|
11622
11500
|
label: lbl,
|
|
11623
|
-
reason: `label "${lbl}" is not eligible for default view \u2014 outside the chip allowlist (FILTER_TOP_LEVEL_LABELS
|
|
11501
|
+
reason: `label "${lbl}" is not eligible for default view \u2014 outside the chip allowlist (FILTER_TOP_LEVEL_LABELS)`
|
|
11624
11502
|
};
|
|
11625
11503
|
}
|
|
11626
11504
|
seen.add(lbl);
|
|
@@ -12057,10 +11935,10 @@ var sidebar_artefact_content_default = app31;
|
|
|
12057
11935
|
|
|
12058
11936
|
// server/routes/admin/health.ts
|
|
12059
11937
|
import { existsSync as existsSync19, readFileSync as readFileSync16 } from "fs";
|
|
12060
|
-
import { resolve as resolve19, join as
|
|
11938
|
+
import { resolve as resolve19, join as join11 } from "path";
|
|
12061
11939
|
var PLATFORM_ROOT6 = process.env.MAXY_PLATFORM_ROOT ?? resolve19(process.cwd(), "..");
|
|
12062
11940
|
var brandHostname = "maxy";
|
|
12063
|
-
var brandJsonPath =
|
|
11941
|
+
var brandJsonPath = join11(PLATFORM_ROOT6, "config", "brand.json");
|
|
12064
11942
|
if (existsSync19(brandJsonPath)) {
|
|
12065
11943
|
try {
|
|
12066
11944
|
const brand = JSON.parse(readFileSync16(brandJsonPath, "utf-8"));
|
|
@@ -12644,7 +12522,7 @@ function clientFrom(c) {
|
|
|
12644
12522
|
);
|
|
12645
12523
|
}
|
|
12646
12524
|
var PLATFORM_ROOT7 = process.env.MAXY_PLATFORM_ROOT || "";
|
|
12647
|
-
var BRAND_JSON_PATH = PLATFORM_ROOT7 ?
|
|
12525
|
+
var BRAND_JSON_PATH = PLATFORM_ROOT7 ? join12(PLATFORM_ROOT7, "config", "brand.json") : "";
|
|
12648
12526
|
var BRAND = { productName: "Maxy", hostname: "maxy", configDir: ".maxy", domain: "getmaxy.com" };
|
|
12649
12527
|
if (BRAND_JSON_PATH && !existsSync22(BRAND_JSON_PATH)) {
|
|
12650
12528
|
console.error(`[brand] WARNING: brand.json not found at ${BRAND_JSON_PATH} \u2014 using Maxy defaults`);
|
|
@@ -12670,7 +12548,7 @@ var brandLoginOpts = {
|
|
|
12670
12548
|
bodyFont: BRAND.defaultFonts?.body,
|
|
12671
12549
|
logoContainsName: !!BRAND.logoContainsName
|
|
12672
12550
|
};
|
|
12673
|
-
var ALIAS_DOMAINS_PATH2 =
|
|
12551
|
+
var ALIAS_DOMAINS_PATH2 = join12(homedir4(), BRAND.configDir, "alias-domains.json");
|
|
12674
12552
|
function loadAliasDomains() {
|
|
12675
12553
|
try {
|
|
12676
12554
|
if (!existsSync22(ALIAS_DOMAINS_PATH2)) return null;
|
|
@@ -13116,7 +12994,7 @@ var brandScript = `<script>window.__BRAND__=${JSON.stringify({
|
|
|
13116
12994
|
function readInstalledVersion() {
|
|
13117
12995
|
try {
|
|
13118
12996
|
if (!PLATFORM_ROOT7) return "unknown";
|
|
13119
|
-
const versionFile =
|
|
12997
|
+
const versionFile = join12(PLATFORM_ROOT7, "config", `.${BRAND.hostname}-version`);
|
|
13120
12998
|
if (!existsSync22(versionFile)) return "unknown";
|
|
13121
12999
|
const content = readFileSync19(versionFile, "utf-8").trim();
|
|
13122
13000
|
return content || "unknown";
|
|
@@ -13175,14 +13053,14 @@ ${clientErrorReporterScript}
|
|
|
13175
13053
|
}
|
|
13176
13054
|
var brandedHtmlCache = /* @__PURE__ */ new Map();
|
|
13177
13055
|
function loadBrandingCache(agentSlug) {
|
|
13178
|
-
const configDir2 =
|
|
13056
|
+
const configDir2 = join12(homedir4(), BRAND.configDir);
|
|
13179
13057
|
try {
|
|
13180
|
-
const accountJsonPath =
|
|
13058
|
+
const accountJsonPath = join12(configDir2, "account.json");
|
|
13181
13059
|
if (!existsSync22(accountJsonPath)) return null;
|
|
13182
13060
|
const account = JSON.parse(readFileSync19(accountJsonPath, "utf-8"));
|
|
13183
13061
|
const accountId = account.accountId;
|
|
13184
13062
|
if (!accountId) return null;
|
|
13185
|
-
const cachePath =
|
|
13063
|
+
const cachePath = join12(configDir2, "branding-cache", accountId, `${agentSlug}.json`);
|
|
13186
13064
|
if (!existsSync22(cachePath)) return null;
|
|
13187
13065
|
return JSON.parse(readFileSync19(cachePath, "utf-8"));
|
|
13188
13066
|
} catch {
|
|
@@ -13191,8 +13069,8 @@ function loadBrandingCache(agentSlug) {
|
|
|
13191
13069
|
}
|
|
13192
13070
|
function resolveDefaultSlug() {
|
|
13193
13071
|
try {
|
|
13194
|
-
const configDir2 =
|
|
13195
|
-
const accountJsonPath =
|
|
13072
|
+
const configDir2 = join12(homedir4(), BRAND.configDir);
|
|
13073
|
+
const accountJsonPath = join12(configDir2, "account.json");
|
|
13196
13074
|
if (!existsSync22(accountJsonPath)) return null;
|
|
13197
13075
|
const account = JSON.parse(readFileSync19(accountJsonPath, "utf-8"));
|
|
13198
13076
|
return account.defaultAgent || null;
|
|
@@ -13454,11 +13332,11 @@ reconcileEnabledPlugins(bootAccount?.accountDir, bootAccount?.config);
|
|
|
13454
13332
|
(async () => {
|
|
13455
13333
|
if (!bootAccount) return;
|
|
13456
13334
|
try {
|
|
13457
|
-
const { recoverRunningCloudflareTasks } = await import("./cloudflare-task-tracker-
|
|
13335
|
+
const { recoverRunningCloudflareTasks } = await import("./cloudflare-task-tracker-NEB3X6O2.js");
|
|
13458
13336
|
const result = await recoverRunningCloudflareTasks(
|
|
13459
13337
|
bootAccount.accountId,
|
|
13460
13338
|
configDirForWhatsApp,
|
|
13461
|
-
//
|
|
13339
|
+
// no conversationId at boot. The reconciler operates on
|
|
13462
13340
|
// Tasks whose Conversation is already linked via RAISED_DURING; the
|
|
13463
13341
|
// tracker resolves the conversationId off that edge when present.
|
|
13464
13342
|
// Pass null and let the recovery path pick it up.
|
|
@@ -13514,7 +13392,7 @@ if (bootAccountConfig?.whatsapp) {
|
|
|
13514
13392
|
}
|
|
13515
13393
|
init({
|
|
13516
13394
|
configDir: configDirForWhatsApp,
|
|
13517
|
-
platformRoot: resolve22(process.env.MAXY_PLATFORM_ROOT ??
|
|
13395
|
+
platformRoot: resolve22(process.env.MAXY_PLATFORM_ROOT ?? join12(__dirname, "..")),
|
|
13518
13396
|
accountConfig: bootAccountConfig,
|
|
13519
13397
|
onMessage: async (msg) => {
|
|
13520
13398
|
if (process.env.WHATSAPP_PTY_BRIDGE_ENABLED === "true" && msg.text && !msg.isOwnerMirror) {
|