gnosys 5.9.5 → 5.11.0
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/README.md +91 -771
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +403 -141
- package/dist/index.d.ts +3 -1
- package/dist/index.js +427 -348
- package/dist/lib/archive.d.ts +3 -4
- package/dist/lib/archive.js +0 -1
- package/dist/lib/ask.d.ts +3 -4
- package/dist/lib/ask.js +0 -1
- package/dist/lib/atomicWrite.d.ts +7 -0
- package/dist/lib/atomicWrite.js +46 -0
- package/dist/lib/attachments.d.ts +0 -1
- package/dist/lib/attachments.js +0 -1
- package/dist/lib/audioExtract.d.ts +0 -1
- package/dist/lib/audioExtract.js +0 -1
- package/dist/lib/audit.d.ts +0 -1
- package/dist/lib/audit.js +0 -1
- package/dist/lib/bootstrap.d.ts +1 -2
- package/dist/lib/bootstrap.js +0 -1
- package/dist/lib/centralize.d.ts +20 -0
- package/dist/lib/centralize.js +34 -0
- package/dist/lib/chat/SlashPalette.d.ts +2 -3
- package/dist/lib/chat/SlashPalette.js +0 -1
- package/dist/lib/chat/boot-splash.d.ts +1 -2
- package/dist/lib/chat/boot-splash.js +0 -1
- package/dist/lib/chat/choose.d.ts +0 -1
- package/dist/lib/chat/choose.js +0 -2
- package/dist/lib/chat/commands.d.ts +1 -2
- package/dist/lib/chat/commands.js +0 -1
- package/dist/lib/chat/components/CitationText.d.ts +1 -2
- package/dist/lib/chat/components/CitationText.js +0 -1
- package/dist/lib/chat/components/MarkdownRenderer.d.ts +0 -1
- package/dist/lib/chat/components/MarkdownRenderer.js +0 -1
- package/dist/lib/chat/components/ToolCallCard.d.ts +1 -2
- package/dist/lib/chat/components/ToolCallCard.js +0 -1
- package/dist/lib/chat/focus.d.ts +3 -3
- package/dist/lib/chat/focus.js +0 -1
- package/dist/lib/chat/index.d.ts +3 -4
- package/dist/lib/chat/index.js +2 -2
- package/dist/lib/chat/intent.d.ts +1 -17
- package/dist/lib/chat/intent.js +2 -3
- package/dist/lib/chat/llmTurn.d.ts +5 -6
- package/dist/lib/chat/llmTurn.js +0 -1
- package/dist/lib/chat/recall.d.ts +2 -3
- package/dist/lib/chat/recall.js +1 -2
- package/dist/lib/chat/render.d.ts +2 -3
- package/dist/lib/chat/render.js +0 -1
- package/dist/lib/chat/session.d.ts +0 -1
- package/dist/lib/chat/session.js +0 -1
- package/dist/lib/chat/theme.d.ts +0 -1
- package/dist/lib/chat/theme.js +0 -1
- package/dist/lib/chat/toolFence.d.ts +2 -2
- package/dist/lib/chat/toolFence.js +0 -1
- package/dist/lib/chat/tools.d.ts +0 -1
- package/dist/lib/chat/tools.js +0 -1
- package/dist/lib/chat/types.d.ts +0 -1
- package/dist/lib/chat/types.js +0 -1
- package/dist/lib/chat/write.d.ts +5 -5
- package/dist/lib/chat/write.js +0 -1
- package/dist/lib/chunkSplitter.d.ts +0 -1
- package/dist/lib/chunkSplitter.js +0 -1
- package/dist/lib/cleanup.d.ts +0 -1
- package/dist/lib/cleanup.js +0 -1
- package/dist/lib/config.d.ts +0 -1
- package/dist/lib/config.js +3 -3
- package/dist/lib/dashboard.d.ts +3 -4
- package/dist/lib/dashboard.js +5 -2
- package/dist/lib/db.d.ts +24 -1
- package/dist/lib/db.js +162 -16
- package/dist/lib/dbSearch.d.ts +3 -4
- package/dist/lib/dbSearch.js +0 -1
- package/dist/lib/dbWrite.d.ts +2 -3
- package/dist/lib/dbWrite.js +0 -1
- package/dist/lib/desktopNotify.d.ts +0 -1
- package/dist/lib/desktopNotify.js +0 -1
- package/dist/lib/docxExtract.d.ts +0 -1
- package/dist/lib/docxExtract.js +22 -1
- package/dist/lib/dream.d.ts +2 -3
- package/dist/lib/dream.js +2 -2
- package/dist/lib/embeddings.d.ts +0 -3
- package/dist/lib/embeddings.js +7 -3
- package/dist/lib/export.d.ts +6 -2
- package/dist/lib/export.js +24 -2
- package/dist/lib/exportProject.d.ts +4 -3
- package/dist/lib/exportProject.js +3 -1
- package/dist/lib/federated.d.ts +3 -3
- package/dist/lib/federated.js +6 -4
- package/dist/lib/fileDetect.d.ts +0 -1
- package/dist/lib/fileDetect.js +0 -1
- package/dist/lib/graph.d.ts +4 -4
- package/dist/lib/graph.js +0 -1
- package/dist/lib/heartbeat.d.ts +0 -13
- package/dist/lib/heartbeat.js +1 -2
- package/dist/lib/hybridSearch.d.ts +5 -21
- package/dist/lib/hybridSearch.js +0 -1
- package/dist/lib/idFormat.d.ts +0 -2
- package/dist/lib/idFormat.js +1 -2
- package/dist/lib/imageExtract.d.ts +0 -1
- package/dist/lib/imageExtract.js +0 -1
- package/dist/lib/import.d.ts +6 -5
- package/dist/lib/import.js +3 -33
- package/dist/lib/importProject.d.ts +4 -4
- package/dist/lib/importProject.js +1 -2
- package/dist/lib/ingest.d.ts +3 -4
- package/dist/lib/ingest.js +0 -1
- package/dist/lib/lensing.d.ts +1 -2
- package/dist/lib/lensing.js +0 -1
- package/dist/lib/llm.d.ts +6 -45
- package/dist/lib/llm.js +27 -9
- package/dist/lib/lock.d.ts +0 -1
- package/dist/lib/lock.js +0 -1
- package/dist/lib/log.d.ts +4 -0
- package/dist/lib/log.js +85 -0
- package/dist/lib/machineConfig.d.ts +86 -0
- package/dist/lib/machineConfig.js +157 -0
- package/dist/lib/machineMigrate.d.ts +38 -0
- package/dist/lib/machineMigrate.js +102 -0
- package/dist/lib/maintenance.d.ts +4 -5
- package/dist/lib/maintenance.js +0 -1
- package/dist/lib/mcpClientConfig.d.ts +20 -0
- package/dist/lib/mcpClientConfig.js +62 -0
- package/dist/lib/mcpHttp.d.ts +52 -0
- package/dist/lib/mcpHttp.js +227 -0
- package/dist/lib/migrate.d.ts +1 -2
- package/dist/lib/migrate.js +1 -1
- package/dist/lib/modelValidation.d.ts +0 -1
- package/dist/lib/modelValidation.js +0 -1
- package/dist/lib/multimodalIngest.d.ts +1 -2
- package/dist/lib/multimodalIngest.js +0 -1
- package/dist/lib/packageManager.d.ts +5 -0
- package/dist/lib/packageManager.js +30 -0
- package/dist/lib/paths.d.ts +11 -7
- package/dist/lib/paths.js +14 -2
- package/dist/lib/pdfExtract.d.ts +0 -1
- package/dist/lib/pdfExtract.js +0 -1
- package/dist/lib/portfolio.d.ts +1 -2
- package/dist/lib/portfolio.js +10 -3
- package/dist/lib/portfolioHtml.d.ts +1 -2
- package/dist/lib/portfolioHtml.js +0 -1
- package/dist/lib/preferences.d.ts +6 -2
- package/dist/lib/preferences.js +19 -1
- package/dist/lib/progress.d.ts +2 -2
- package/dist/lib/progress.js +0 -1
- package/dist/lib/projectIdentity.d.ts +1 -2
- package/dist/lib/projectIdentity.js +5 -5
- package/dist/lib/projectPaths.d.ts +60 -0
- package/dist/lib/projectPaths.js +99 -0
- package/dist/lib/projectScan.d.ts +40 -0
- package/dist/lib/projectScan.js +96 -0
- package/dist/lib/recall.d.ts +6 -6
- package/dist/lib/recall.js +0 -1
- package/dist/lib/remote.d.ts +3 -20
- package/dist/lib/remote.js +44 -2
- package/dist/lib/remoteWizard.d.ts +2 -3
- package/dist/lib/remoteWizard.js +0 -1
- package/dist/lib/resolver.d.ts +1 -2
- package/dist/lib/resolver.js +2 -3
- package/dist/lib/retry.d.ts +0 -1
- package/dist/lib/retry.js +1 -2
- package/dist/lib/rulesGen.d.ts +2 -8
- package/dist/lib/rulesGen.js +1 -2
- package/dist/lib/search.d.ts +1 -2
- package/dist/lib/search.js +1 -1
- package/dist/lib/searchTypes.d.ts +18 -0
- package/dist/lib/searchTypes.js +2 -0
- package/dist/lib/setup/coldStart.d.ts +0 -1
- package/dist/lib/setup/coldStart.js +0 -1
- package/dist/lib/setup/configSetRender.d.ts +0 -1
- package/dist/lib/setup/configSetRender.js +0 -1
- package/dist/lib/setup/dreamRender.d.ts +0 -1
- package/dist/lib/setup/dreamRender.js +0 -1
- package/dist/lib/setup/dreamState.d.ts +2 -2
- package/dist/lib/setup/dreamState.js +0 -1
- package/dist/lib/setup/modelsRender.d.ts +0 -1
- package/dist/lib/setup/modelsRender.js +0 -1
- package/dist/lib/setup/remoteRender.d.ts +0 -1
- package/dist/lib/setup/remoteRender.js +0 -1
- package/dist/lib/setup/routingRender.d.ts +0 -1
- package/dist/lib/setup/routingRender.js +0 -1
- package/dist/lib/setup/sections/ides.d.ts +1 -2
- package/dist/lib/setup/sections/ides.js +3 -2
- package/dist/lib/setup/sections/preferences.d.ts +1 -2
- package/dist/lib/setup/sections/preferences.js +3 -2
- package/dist/lib/setup/sections/routing.d.ts +1 -2
- package/dist/lib/setup/sections/routing.js +0 -1
- package/dist/lib/setup/storePath.d.ts +0 -1
- package/dist/lib/setup/storePath.js +0 -1
- package/dist/lib/setup/summary.d.ts +1 -2
- package/dist/lib/setup/summary.js +0 -1
- package/dist/lib/setup/syncProjectsRender.d.ts +0 -1
- package/dist/lib/setup/syncProjectsRender.js +0 -1
- package/dist/lib/setup/ui/diff.d.ts +0 -1
- package/dist/lib/setup/ui/diff.js +0 -1
- package/dist/lib/setup/ui/footer.d.ts +0 -1
- package/dist/lib/setup/ui/footer.js +0 -1
- package/dist/lib/setup/ui/header.d.ts +0 -1
- package/dist/lib/setup/ui/header.js +0 -1
- package/dist/lib/setup/ui/index.d.ts +0 -1
- package/dist/lib/setup/ui/index.js +0 -1
- package/dist/lib/setup/ui/menu.d.ts +0 -1
- package/dist/lib/setup/ui/menu.js +0 -1
- package/dist/lib/setup/ui/panel.d.ts +0 -1
- package/dist/lib/setup/ui/panel.js +0 -1
- package/dist/lib/setup/ui/prompt.d.ts +0 -1
- package/dist/lib/setup/ui/prompt.js +0 -1
- package/dist/lib/setup/ui/safePrompt.d.ts +0 -1
- package/dist/lib/setup/ui/safePrompt.js +0 -1
- package/dist/lib/setup/ui/spinner.d.ts +0 -1
- package/dist/lib/setup/ui/spinner.js +0 -1
- package/dist/lib/setup/ui/status.d.ts +0 -1
- package/dist/lib/setup/ui/status.js +0 -1
- package/dist/lib/setup/ui/table.d.ts +0 -1
- package/dist/lib/setup/ui/table.js +0 -1
- package/dist/lib/setup/ui/title.d.ts +0 -1
- package/dist/lib/setup/ui/title.js +0 -1
- package/dist/lib/setup/ui/tokens.d.ts +0 -1
- package/dist/lib/setup/ui/tokens.js +0 -1
- package/dist/lib/setup.d.ts +2 -31
- package/dist/lib/setup.js +13 -9
- package/dist/lib/staticSearch.d.ts +0 -1
- package/dist/lib/staticSearch.js +0 -1
- package/dist/lib/store.d.ts +0 -1
- package/dist/lib/store.js +0 -1
- package/dist/lib/structuredIngest.d.ts +0 -1
- package/dist/lib/structuredIngest.js +0 -1
- package/dist/lib/tags.d.ts +0 -1
- package/dist/lib/tags.js +0 -1
- package/dist/lib/timeline.d.ts +2 -3
- package/dist/lib/timeline.js +3 -4
- package/dist/lib/trace.d.ts +1 -16
- package/dist/lib/trace.js +0 -1
- package/dist/lib/upgrade.d.ts +0 -1
- package/dist/lib/upgrade.js +0 -1
- package/dist/lib/videoExtract.d.ts +0 -1
- package/dist/lib/videoExtract.js +0 -1
- package/dist/lib/webIndex.d.ts +1 -3
- package/dist/lib/webIndex.js +0 -1
- package/dist/lib/webIngest.d.ts +13 -1
- package/dist/lib/webIngest.js +98 -24
- package/dist/lib/wikilinks.d.ts +3 -3
- package/dist/lib/wikilinks.js +0 -1
- package/dist/postinstall.d.ts +0 -1
- package/dist/postinstall.js +0 -1
- package/dist/sandbox/client.d.ts +0 -1
- package/dist/sandbox/client.js +0 -1
- package/dist/sandbox/helper-template.d.ts +0 -1
- package/dist/sandbox/helper-template.js +0 -1
- package/dist/sandbox/manager.d.ts +0 -9
- package/dist/sandbox/manager.js +2 -3
- package/dist/sandbox/server.d.ts +2 -3
- package/dist/sandbox/server.js +7 -7
- package/docs/logo.svg +25 -0
- package/package.json +18 -6
- package/prompts/synthesize.md +2 -0
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/archive.d.ts.map +0 -1
- package/dist/lib/archive.js.map +0 -1
- package/dist/lib/ask.d.ts.map +0 -1
- package/dist/lib/ask.js.map +0 -1
- package/dist/lib/attachments.d.ts.map +0 -1
- package/dist/lib/attachments.js.map +0 -1
- package/dist/lib/audioExtract.d.ts.map +0 -1
- package/dist/lib/audioExtract.js.map +0 -1
- package/dist/lib/audit.d.ts.map +0 -1
- package/dist/lib/audit.js.map +0 -1
- package/dist/lib/bootstrap.d.ts.map +0 -1
- package/dist/lib/bootstrap.js.map +0 -1
- package/dist/lib/chat/SlashPalette.d.ts.map +0 -1
- package/dist/lib/chat/SlashPalette.js.map +0 -1
- package/dist/lib/chat/boot-splash.d.ts.map +0 -1
- package/dist/lib/chat/boot-splash.js.map +0 -1
- package/dist/lib/chat/choose.d.ts.map +0 -1
- package/dist/lib/chat/choose.js.map +0 -1
- package/dist/lib/chat/commands.d.ts.map +0 -1
- package/dist/lib/chat/commands.js.map +0 -1
- package/dist/lib/chat/components/CitationText.d.ts.map +0 -1
- package/dist/lib/chat/components/CitationText.js.map +0 -1
- package/dist/lib/chat/components/MarkdownRenderer.d.ts.map +0 -1
- package/dist/lib/chat/components/MarkdownRenderer.js.map +0 -1
- package/dist/lib/chat/components/ToolCallCard.d.ts.map +0 -1
- package/dist/lib/chat/components/ToolCallCard.js.map +0 -1
- package/dist/lib/chat/focus.d.ts.map +0 -1
- package/dist/lib/chat/focus.js.map +0 -1
- package/dist/lib/chat/index.d.ts.map +0 -1
- package/dist/lib/chat/index.js.map +0 -1
- package/dist/lib/chat/intent.d.ts.map +0 -1
- package/dist/lib/chat/intent.js.map +0 -1
- package/dist/lib/chat/llmTurn.d.ts.map +0 -1
- package/dist/lib/chat/llmTurn.js.map +0 -1
- package/dist/lib/chat/recall.d.ts.map +0 -1
- package/dist/lib/chat/recall.js.map +0 -1
- package/dist/lib/chat/render.d.ts.map +0 -1
- package/dist/lib/chat/render.js.map +0 -1
- package/dist/lib/chat/session.d.ts.map +0 -1
- package/dist/lib/chat/session.js.map +0 -1
- package/dist/lib/chat/theme.d.ts.map +0 -1
- package/dist/lib/chat/theme.js.map +0 -1
- package/dist/lib/chat/toolFence.d.ts.map +0 -1
- package/dist/lib/chat/toolFence.js.map +0 -1
- package/dist/lib/chat/tools.d.ts.map +0 -1
- package/dist/lib/chat/tools.js.map +0 -1
- package/dist/lib/chat/types.d.ts.map +0 -1
- package/dist/lib/chat/types.js.map +0 -1
- package/dist/lib/chat/write.d.ts.map +0 -1
- package/dist/lib/chat/write.js.map +0 -1
- package/dist/lib/chunkSplitter.d.ts.map +0 -1
- package/dist/lib/chunkSplitter.js.map +0 -1
- package/dist/lib/cleanup.d.ts.map +0 -1
- package/dist/lib/cleanup.js.map +0 -1
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/dashboard.d.ts.map +0 -1
- package/dist/lib/dashboard.js.map +0 -1
- package/dist/lib/db.d.ts.map +0 -1
- package/dist/lib/db.js.map +0 -1
- package/dist/lib/dbSearch.d.ts.map +0 -1
- package/dist/lib/dbSearch.js.map +0 -1
- package/dist/lib/dbWrite.d.ts.map +0 -1
- package/dist/lib/dbWrite.js.map +0 -1
- package/dist/lib/desktopNotify.d.ts.map +0 -1
- package/dist/lib/desktopNotify.js.map +0 -1
- package/dist/lib/docxExtract.d.ts.map +0 -1
- package/dist/lib/docxExtract.js.map +0 -1
- package/dist/lib/dream.d.ts.map +0 -1
- package/dist/lib/dream.js.map +0 -1
- package/dist/lib/embeddings.d.ts.map +0 -1
- package/dist/lib/embeddings.js.map +0 -1
- package/dist/lib/export.d.ts.map +0 -1
- package/dist/lib/export.js.map +0 -1
- package/dist/lib/exportProject.d.ts.map +0 -1
- package/dist/lib/exportProject.js.map +0 -1
- package/dist/lib/federated.d.ts.map +0 -1
- package/dist/lib/federated.js.map +0 -1
- package/dist/lib/fileDetect.d.ts.map +0 -1
- package/dist/lib/fileDetect.js.map +0 -1
- package/dist/lib/graph.d.ts.map +0 -1
- package/dist/lib/graph.js.map +0 -1
- package/dist/lib/heartbeat.d.ts.map +0 -1
- package/dist/lib/heartbeat.js.map +0 -1
- package/dist/lib/history.d.ts +0 -39
- package/dist/lib/history.d.ts.map +0 -1
- package/dist/lib/history.js +0 -112
- package/dist/lib/history.js.map +0 -1
- package/dist/lib/hybridSearch.d.ts.map +0 -1
- package/dist/lib/hybridSearch.js.map +0 -1
- package/dist/lib/idFormat.d.ts.map +0 -1
- package/dist/lib/idFormat.js.map +0 -1
- package/dist/lib/imageExtract.d.ts.map +0 -1
- package/dist/lib/imageExtract.js.map +0 -1
- package/dist/lib/import.d.ts.map +0 -1
- package/dist/lib/import.js.map +0 -1
- package/dist/lib/importProject.d.ts.map +0 -1
- package/dist/lib/importProject.js.map +0 -1
- package/dist/lib/ingest.d.ts.map +0 -1
- package/dist/lib/ingest.js.map +0 -1
- package/dist/lib/lensing.d.ts.map +0 -1
- package/dist/lib/lensing.js.map +0 -1
- package/dist/lib/llm.d.ts.map +0 -1
- package/dist/lib/llm.js.map +0 -1
- package/dist/lib/lock.d.ts.map +0 -1
- package/dist/lib/lock.js.map +0 -1
- package/dist/lib/maintenance.d.ts.map +0 -1
- package/dist/lib/maintenance.js.map +0 -1
- package/dist/lib/migrate.d.ts.map +0 -1
- package/dist/lib/migrate.js.map +0 -1
- package/dist/lib/modelValidation.d.ts.map +0 -1
- package/dist/lib/modelValidation.js.map +0 -1
- package/dist/lib/multimodalIngest.d.ts.map +0 -1
- package/dist/lib/multimodalIngest.js.map +0 -1
- package/dist/lib/paths.d.ts.map +0 -1
- package/dist/lib/paths.js.map +0 -1
- package/dist/lib/pdfExtract.d.ts.map +0 -1
- package/dist/lib/pdfExtract.js.map +0 -1
- package/dist/lib/portfolio.d.ts.map +0 -1
- package/dist/lib/portfolio.js.map +0 -1
- package/dist/lib/portfolioHtml.d.ts.map +0 -1
- package/dist/lib/portfolioHtml.js.map +0 -1
- package/dist/lib/preferences.d.ts.map +0 -1
- package/dist/lib/preferences.js.map +0 -1
- package/dist/lib/progress.d.ts.map +0 -1
- package/dist/lib/progress.js.map +0 -1
- package/dist/lib/projectIdentity.d.ts.map +0 -1
- package/dist/lib/projectIdentity.js.map +0 -1
- package/dist/lib/recall.d.ts.map +0 -1
- package/dist/lib/recall.js.map +0 -1
- package/dist/lib/remote.d.ts.map +0 -1
- package/dist/lib/remote.js.map +0 -1
- package/dist/lib/remoteWizard.d.ts.map +0 -1
- package/dist/lib/remoteWizard.js.map +0 -1
- package/dist/lib/resolver.d.ts.map +0 -1
- package/dist/lib/resolver.js.map +0 -1
- package/dist/lib/retry.d.ts.map +0 -1
- package/dist/lib/retry.js.map +0 -1
- package/dist/lib/rulesGen.d.ts.map +0 -1
- package/dist/lib/rulesGen.js.map +0 -1
- package/dist/lib/search.d.ts.map +0 -1
- package/dist/lib/search.js.map +0 -1
- package/dist/lib/setup/coldStart.d.ts.map +0 -1
- package/dist/lib/setup/coldStart.js.map +0 -1
- package/dist/lib/setup/configSetRender.d.ts.map +0 -1
- package/dist/lib/setup/configSetRender.js.map +0 -1
- package/dist/lib/setup/dreamRender.d.ts.map +0 -1
- package/dist/lib/setup/dreamRender.js.map +0 -1
- package/dist/lib/setup/dreamState.d.ts.map +0 -1
- package/dist/lib/setup/dreamState.js.map +0 -1
- package/dist/lib/setup/modelsRender.d.ts.map +0 -1
- package/dist/lib/setup/modelsRender.js.map +0 -1
- package/dist/lib/setup/remoteRender.d.ts.map +0 -1
- package/dist/lib/setup/remoteRender.js.map +0 -1
- package/dist/lib/setup/routingRender.d.ts.map +0 -1
- package/dist/lib/setup/routingRender.js.map +0 -1
- package/dist/lib/setup/sections/ides.d.ts.map +0 -1
- package/dist/lib/setup/sections/ides.js.map +0 -1
- package/dist/lib/setup/sections/preferences.d.ts.map +0 -1
- package/dist/lib/setup/sections/preferences.js.map +0 -1
- package/dist/lib/setup/sections/routing.d.ts.map +0 -1
- package/dist/lib/setup/sections/routing.js.map +0 -1
- package/dist/lib/setup/storePath.d.ts.map +0 -1
- package/dist/lib/setup/storePath.js.map +0 -1
- package/dist/lib/setup/summary.d.ts.map +0 -1
- package/dist/lib/setup/summary.js.map +0 -1
- package/dist/lib/setup/syncProjectsRender.d.ts.map +0 -1
- package/dist/lib/setup/syncProjectsRender.js.map +0 -1
- package/dist/lib/setup/ui/diff.d.ts.map +0 -1
- package/dist/lib/setup/ui/diff.js.map +0 -1
- package/dist/lib/setup/ui/footer.d.ts.map +0 -1
- package/dist/lib/setup/ui/footer.js.map +0 -1
- package/dist/lib/setup/ui/header.d.ts.map +0 -1
- package/dist/lib/setup/ui/header.js.map +0 -1
- package/dist/lib/setup/ui/index.d.ts.map +0 -1
- package/dist/lib/setup/ui/index.js.map +0 -1
- package/dist/lib/setup/ui/menu.d.ts.map +0 -1
- package/dist/lib/setup/ui/menu.js.map +0 -1
- package/dist/lib/setup/ui/panel.d.ts.map +0 -1
- package/dist/lib/setup/ui/panel.js.map +0 -1
- package/dist/lib/setup/ui/prompt.d.ts.map +0 -1
- package/dist/lib/setup/ui/prompt.js.map +0 -1
- package/dist/lib/setup/ui/safePrompt.d.ts.map +0 -1
- package/dist/lib/setup/ui/safePrompt.js.map +0 -1
- package/dist/lib/setup/ui/spinner.d.ts.map +0 -1
- package/dist/lib/setup/ui/spinner.js.map +0 -1
- package/dist/lib/setup/ui/status.d.ts.map +0 -1
- package/dist/lib/setup/ui/status.js.map +0 -1
- package/dist/lib/setup/ui/table.d.ts.map +0 -1
- package/dist/lib/setup/ui/table.js.map +0 -1
- package/dist/lib/setup/ui/title.d.ts.map +0 -1
- package/dist/lib/setup/ui/title.js.map +0 -1
- package/dist/lib/setup/ui/tokens.d.ts.map +0 -1
- package/dist/lib/setup/ui/tokens.js.map +0 -1
- package/dist/lib/setup.d.ts.map +0 -1
- package/dist/lib/setup.js.map +0 -1
- package/dist/lib/staticSearch.d.ts.map +0 -1
- package/dist/lib/staticSearch.js.map +0 -1
- package/dist/lib/store.d.ts.map +0 -1
- package/dist/lib/store.js.map +0 -1
- package/dist/lib/structuredIngest.d.ts.map +0 -1
- package/dist/lib/structuredIngest.js.map +0 -1
- package/dist/lib/tags.d.ts.map +0 -1
- package/dist/lib/tags.js.map +0 -1
- package/dist/lib/timeline.d.ts.map +0 -1
- package/dist/lib/timeline.js.map +0 -1
- package/dist/lib/trace.d.ts.map +0 -1
- package/dist/lib/trace.js.map +0 -1
- package/dist/lib/upgrade.d.ts.map +0 -1
- package/dist/lib/upgrade.js.map +0 -1
- package/dist/lib/videoExtract.d.ts.map +0 -1
- package/dist/lib/videoExtract.js.map +0 -1
- package/dist/lib/webIndex.d.ts.map +0 -1
- package/dist/lib/webIndex.js.map +0 -1
- package/dist/lib/webIngest.d.ts.map +0 -1
- package/dist/lib/webIngest.js.map +0 -1
- package/dist/lib/wikilinks.d.ts.map +0 -1
- package/dist/lib/wikilinks.js.map +0 -1
- package/dist/postinstall.d.ts.map +0 -1
- package/dist/postinstall.js.map +0 -1
- package/dist/sandbox/client.d.ts.map +0 -1
- package/dist/sandbox/client.js.map +0 -1
- package/dist/sandbox/helper-template.d.ts.map +0 -1
- package/dist/sandbox/helper-template.js.map +0 -1
- package/dist/sandbox/index.d.ts +0 -10
- package/dist/sandbox/index.d.ts.map +0 -1
- package/dist/sandbox/index.js +0 -10
- package/dist/sandbox/index.js.map +0 -1
- package/dist/sandbox/manager.d.ts.map +0 -1
- package/dist/sandbox/manager.js.map +0 -1
- package/dist/sandbox/server.d.ts.map +0 -1
- package/dist/sandbox/server.js.map +0 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v5.11 one-time migration to machine-portable project paths.
|
|
3
|
+
*
|
|
4
|
+
* Run once per machine. It:
|
|
5
|
+
* 1. Ensures machine.json exists (machineId, hostname).
|
|
6
|
+
* 2. Adopts machine-LOCAL values that were wrongly living in the SYNCED
|
|
7
|
+
* gnosys_meta — `machine_id` (for continuity) and `remote_path` — into
|
|
8
|
+
* machine.json, then deletes them from meta so they stop syncing and
|
|
9
|
+
* clobbering other machines.
|
|
10
|
+
* 3. Sets the `dev` root (explicit --root, else derived from the registry).
|
|
11
|
+
* 4. Scans to backfill machine-independent root_id/rel_path on projects.
|
|
12
|
+
*
|
|
13
|
+
* It operates on the LOCAL DB (GnosysDB.openLocal), never a remote, because it
|
|
14
|
+
* moves machine-local state out of the shared store.
|
|
15
|
+
*/
|
|
16
|
+
import fs from "fs";
|
|
17
|
+
import path from "path";
|
|
18
|
+
import { ensureMachineConfig, writeMachineConfig } from "./machineConfig.js";
|
|
19
|
+
import { getProjectRegistryPath } from "./paths.js";
|
|
20
|
+
import { scanProjects } from "./projectScan.js";
|
|
21
|
+
export async function migrateMachine(localDb, opts = {}) {
|
|
22
|
+
const ens = ensureMachineConfig();
|
|
23
|
+
const machine = ens.config;
|
|
24
|
+
// 1. Adopt machine_id from synced meta (continuity), then remove it so the
|
|
25
|
+
// synced DB stops carrying a per-machine identity.
|
|
26
|
+
let adoptedMachineId = false;
|
|
27
|
+
const metaMachineId = localDb.getMeta("machine_id");
|
|
28
|
+
if (metaMachineId && !/^unknown-/.test(metaMachineId)) {
|
|
29
|
+
machine.machineId = metaMachineId;
|
|
30
|
+
adoptedMachineId = true;
|
|
31
|
+
}
|
|
32
|
+
localDb.deleteMeta("machine_id");
|
|
33
|
+
// 2. Adopt remote_path from synced meta, then remove it.
|
|
34
|
+
let adoptedRemotePath = false;
|
|
35
|
+
const metaRemote = localDb.getMeta("remote_path");
|
|
36
|
+
if (metaRemote && !machine.remote.path) {
|
|
37
|
+
machine.remote = { enabled: true, path: metaRemote };
|
|
38
|
+
adoptedRemotePath = true;
|
|
39
|
+
}
|
|
40
|
+
localDb.deleteMeta("remote_path");
|
|
41
|
+
// 3. Set the dev root.
|
|
42
|
+
const rootName = opts.rootName || "dev";
|
|
43
|
+
if (opts.root) {
|
|
44
|
+
machine.roots[rootName] = path.resolve(opts.root);
|
|
45
|
+
}
|
|
46
|
+
else if (!machine.roots[rootName]) {
|
|
47
|
+
const derived = deriveCommonRoot();
|
|
48
|
+
if (derived)
|
|
49
|
+
machine.roots[rootName] = derived;
|
|
50
|
+
}
|
|
51
|
+
writeMachineConfig(machine);
|
|
52
|
+
// 4. Scan (default on) to backfill machine-portable locations.
|
|
53
|
+
let scan;
|
|
54
|
+
if (opts.scan !== false && Object.keys(machine.roots).length > 0) {
|
|
55
|
+
scan = await scanProjects(localDb, machine);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
machineId: machine.machineId,
|
|
59
|
+
hostname: machine.hostname,
|
|
60
|
+
rootsConfigured: machine.roots,
|
|
61
|
+
adoptedMachineId,
|
|
62
|
+
adoptedRemotePath,
|
|
63
|
+
regeneratedMachineId: ens.regenerated,
|
|
64
|
+
scan,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Derive the most likely `dev` root: the directory that is the parent of the
|
|
69
|
+
* most registered projects. Picking the most-common parent (rather than the
|
|
70
|
+
* global common prefix) avoids collapsing to `/Users/<name>` when a few
|
|
71
|
+
* outlier projects live elsewhere.
|
|
72
|
+
*/
|
|
73
|
+
export function deriveCommonRoot() {
|
|
74
|
+
let paths;
|
|
75
|
+
try {
|
|
76
|
+
const raw = fs.readFileSync(getProjectRegistryPath(), "utf-8");
|
|
77
|
+
paths = JSON.parse(raw).filter((p) => typeof p === "string" &&
|
|
78
|
+
p.startsWith("/") &&
|
|
79
|
+
!p.startsWith("/tmp/") &&
|
|
80
|
+
!p.startsWith("/private/tmp/") &&
|
|
81
|
+
!p.startsWith("/var/folders/"));
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
if (paths.length === 0)
|
|
87
|
+
return null;
|
|
88
|
+
const counts = new Map();
|
|
89
|
+
for (const p of paths) {
|
|
90
|
+
const parent = path.dirname(p);
|
|
91
|
+
counts.set(parent, (counts.get(parent) ?? 0) + 1);
|
|
92
|
+
}
|
|
93
|
+
let best = null;
|
|
94
|
+
let bestN = 0;
|
|
95
|
+
for (const [dir, n] of counts) {
|
|
96
|
+
if (n > bestN) {
|
|
97
|
+
best = dir;
|
|
98
|
+
bestN = n;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return best;
|
|
102
|
+
}
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
*
|
|
10
10
|
* All operations produce safe Git commits with rollback on failure.
|
|
11
11
|
*/
|
|
12
|
-
import { GnosysStore, Memory } from "./store.js";
|
|
13
|
-
import { GnosysConfig } from "./config.js";
|
|
14
|
-
import { GnosysResolver } from "./resolver.js";
|
|
15
|
-
import { GnosysDB } from "./db.js";
|
|
12
|
+
import type { GnosysStore, Memory } from "./store.js";
|
|
13
|
+
import { type GnosysConfig } from "./config.js";
|
|
14
|
+
import type { GnosysResolver } from "./resolver.js";
|
|
15
|
+
import type { GnosysDB } from "./db.js";
|
|
16
16
|
export interface MaintenanceOptions {
|
|
17
17
|
/** Show what would change without modifying anything */
|
|
18
18
|
dryRun?: boolean;
|
|
@@ -123,4 +123,3 @@ export declare class GnosysMaintenanceEngine {
|
|
|
123
123
|
* Format a maintenance report as a human-readable string.
|
|
124
124
|
*/
|
|
125
125
|
export declare function formatMaintenanceReport(report: MaintenanceReport): string;
|
|
126
|
-
//# sourceMappingURL=maintenance.d.ts.map
|
package/dist/lib/maintenance.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Point an IDE at a REMOTE gnosys server (v5.12 Phase B).
|
|
3
|
+
*
|
|
4
|
+
* In the central-server topology, a client machine doesn't spawn a local
|
|
5
|
+
* `gnosys serve` — its IDE connects to the host's URL. This writes the URL-based
|
|
6
|
+
* MCP entry into the IDE config (instead of the `{ command, args }` stdio form
|
|
7
|
+
* the local setup writes).
|
|
8
|
+
*/
|
|
9
|
+
export interface RemoteOpts {
|
|
10
|
+
url: string;
|
|
11
|
+
token?: string;
|
|
12
|
+
}
|
|
13
|
+
/** The MCP server entry for a remote (HTTP/URL) gnosys server. */
|
|
14
|
+
export declare function remoteMcpEntry(opts: RemoteOpts): Record<string, unknown>;
|
|
15
|
+
/** Merge a `gnosys` entry into a JSON file's `mcpServers` map (create if absent). */
|
|
16
|
+
export declare function mergeJsonMcpServer(file: string, entry: Record<string, unknown>): Promise<void>;
|
|
17
|
+
/** Write the remote entry into a project's `.cursor/mcp.json`. Returns the path. */
|
|
18
|
+
export declare function writeCursorRemote(projectDir: string, opts: RemoteOpts): Promise<string>;
|
|
19
|
+
export type RemoteIde = "cursor" | "claude-desktop";
|
|
20
|
+
export declare function writeRemoteClientConfig(ide: RemoteIde, projectDir: string, opts: RemoteOpts): Promise<string>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Point an IDE at a REMOTE gnosys server (v5.12 Phase B).
|
|
3
|
+
*
|
|
4
|
+
* In the central-server topology, a client machine doesn't spawn a local
|
|
5
|
+
* `gnosys serve` — its IDE connects to the host's URL. This writes the URL-based
|
|
6
|
+
* MCP entry into the IDE config (instead of the `{ command, args }` stdio form
|
|
7
|
+
* the local setup writes).
|
|
8
|
+
*/
|
|
9
|
+
import fs from "fs/promises";
|
|
10
|
+
import path from "path";
|
|
11
|
+
import os from "os";
|
|
12
|
+
/** The MCP server entry for a remote (HTTP/URL) gnosys server. */
|
|
13
|
+
export function remoteMcpEntry(opts) {
|
|
14
|
+
return {
|
|
15
|
+
url: opts.url,
|
|
16
|
+
...(opts.token ? { headers: { Authorization: `Bearer ${opts.token}` } } : {}),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** Platform-specific Claude Desktop config path (mirrors setup.ts). */
|
|
20
|
+
function claudeDesktopConfigPath() {
|
|
21
|
+
const home = os.homedir();
|
|
22
|
+
if (process.platform === "darwin") {
|
|
23
|
+
return path.join(home, "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
24
|
+
}
|
|
25
|
+
if (process.platform === "win32") {
|
|
26
|
+
const appData = process.env.APPDATA || path.join(home, "AppData", "Roaming");
|
|
27
|
+
return path.join(appData, "Claude", "claude_desktop_config.json");
|
|
28
|
+
}
|
|
29
|
+
return path.join(home, ".config", "Claude", "claude_desktop_config.json");
|
|
30
|
+
}
|
|
31
|
+
/** Merge a `gnosys` entry into a JSON file's `mcpServers` map (create if absent). */
|
|
32
|
+
export async function mergeJsonMcpServer(file, entry) {
|
|
33
|
+
let config = {};
|
|
34
|
+
try {
|
|
35
|
+
config = JSON.parse(await fs.readFile(file, "utf-8"));
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// missing or invalid — start fresh
|
|
39
|
+
}
|
|
40
|
+
const servers = (config.mcpServers ?? {});
|
|
41
|
+
servers.gnosys = entry;
|
|
42
|
+
config.mcpServers = servers;
|
|
43
|
+
await fs.mkdir(path.dirname(file), { recursive: true });
|
|
44
|
+
await fs.writeFile(file, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
45
|
+
}
|
|
46
|
+
/** Write the remote entry into a project's `.cursor/mcp.json`. Returns the path. */
|
|
47
|
+
export async function writeCursorRemote(projectDir, opts) {
|
|
48
|
+
const file = path.join(projectDir, ".cursor", "mcp.json");
|
|
49
|
+
await mergeJsonMcpServer(file, remoteMcpEntry(opts));
|
|
50
|
+
return file;
|
|
51
|
+
}
|
|
52
|
+
/** Write the remote entry into the Claude Desktop config. Returns the path. */
|
|
53
|
+
async function writeClaudeDesktopRemote(opts) {
|
|
54
|
+
const file = claudeDesktopConfigPath();
|
|
55
|
+
await mergeJsonMcpServer(file, remoteMcpEntry(opts));
|
|
56
|
+
return file;
|
|
57
|
+
}
|
|
58
|
+
export async function writeRemoteClientConfig(ide, projectDir, opts) {
|
|
59
|
+
return ide === "claude-desktop"
|
|
60
|
+
? writeClaudeDesktopRemote(opts)
|
|
61
|
+
: writeCursorRemote(projectDir, opts);
|
|
62
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Streamable HTTP transport for the Gnosys MCP server (v5.12 Phase A).
|
|
3
|
+
*
|
|
4
|
+
* Lets clients connect to a long-running gnosys server over HTTP instead of
|
|
5
|
+
* spawning a local stdio process — the basis for the "central server" topology
|
|
6
|
+
* (one host owns the brain; other machines point their IDE at the URL).
|
|
7
|
+
*
|
|
8
|
+
* Stateful sessions: each `initialize` mints a session id and gets its OWN
|
|
9
|
+
* McpServer (built by `makeServer`), so concurrent clients don't share MCP
|
|
10
|
+
* protocol state. The servers all reference the same module-global brain/search,
|
|
11
|
+
* so there's no per-session data — only a fresh capability registration.
|
|
12
|
+
*
|
|
13
|
+
* Uses Node's built-in http (no express). The SDK's StreamableHTTPServerTransport
|
|
14
|
+
* accepts a pre-parsed body, so we read+parse POST bodies ourselves.
|
|
15
|
+
*/
|
|
16
|
+
import http from "node:http";
|
|
17
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
18
|
+
export interface McpHttpOptions {
|
|
19
|
+
host: string;
|
|
20
|
+
port: number;
|
|
21
|
+
/** MCP endpoint path. Default "/mcp". */
|
|
22
|
+
path?: string;
|
|
23
|
+
/** Build a fully-registered McpServer for a new session. */
|
|
24
|
+
makeServer: () => Promise<McpServer> | McpServer;
|
|
25
|
+
/** Phase C: require `Authorization: Bearer <token>` when set. */
|
|
26
|
+
authToken?: string;
|
|
27
|
+
log?: (msg: string) => void;
|
|
28
|
+
/** Reap sessions idle longer than this (ms). Default 30 min. */
|
|
29
|
+
sessionIdleMs?: number;
|
|
30
|
+
/** Sweep cadence (ms). Default 60s. */
|
|
31
|
+
sweepIntervalMs?: number;
|
|
32
|
+
/** Browser origins explicitly allowed to call the endpoint. Default: none. */
|
|
33
|
+
allowedOrigins?: string[];
|
|
34
|
+
/** Max request body bytes. Default 4 MiB. */
|
|
35
|
+
maxBodyBytes?: number;
|
|
36
|
+
/** Max ms to fully receive a request body. Default 30s. */
|
|
37
|
+
bodyTimeoutMs?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface McpHttpHandle {
|
|
40
|
+
server: http.Server;
|
|
41
|
+
/** Active session count (for tests/observability). */
|
|
42
|
+
sessionCount: () => number;
|
|
43
|
+
/** Close+remove sessions idle beyond sessionIdleMs. Returns count reaped. */
|
|
44
|
+
reapIdleSessions: (now?: number) => number;
|
|
45
|
+
close: () => Promise<void>;
|
|
46
|
+
}
|
|
47
|
+
/** True when the bind host is loopback-only (token optional). */
|
|
48
|
+
export declare function isLoopbackHost(host: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Start the MCP Streamable HTTP server. Resolves once it is listening.
|
|
51
|
+
*/
|
|
52
|
+
export declare function startMcpHttpServer(opts: McpHttpOptions): Promise<McpHttpHandle>;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Streamable HTTP transport for the Gnosys MCP server (v5.12 Phase A).
|
|
3
|
+
*
|
|
4
|
+
* Lets clients connect to a long-running gnosys server over HTTP instead of
|
|
5
|
+
* spawning a local stdio process — the basis for the "central server" topology
|
|
6
|
+
* (one host owns the brain; other machines point their IDE at the URL).
|
|
7
|
+
*
|
|
8
|
+
* Stateful sessions: each `initialize` mints a session id and gets its OWN
|
|
9
|
+
* McpServer (built by `makeServer`), so concurrent clients don't share MCP
|
|
10
|
+
* protocol state. The servers all reference the same module-global brain/search,
|
|
11
|
+
* so there's no per-session data — only a fresh capability registration.
|
|
12
|
+
*
|
|
13
|
+
* Uses Node's built-in http (no express). The SDK's StreamableHTTPServerTransport
|
|
14
|
+
* accepts a pre-parsed body, so we read+parse POST bodies ourselves.
|
|
15
|
+
*/
|
|
16
|
+
import http from "node:http";
|
|
17
|
+
import { randomUUID } from "node:crypto";
|
|
18
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
19
|
+
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
|
|
20
|
+
/** True when the bind host is loopback-only (token optional). */
|
|
21
|
+
export function isLoopbackHost(host) {
|
|
22
|
+
const h = (host || "").trim().toLowerCase();
|
|
23
|
+
if (h === "localhost" || h === "::1" || h === "[::1]")
|
|
24
|
+
return true;
|
|
25
|
+
if (/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(h))
|
|
26
|
+
return true;
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
class HttpBodyError extends Error {
|
|
30
|
+
statusCode;
|
|
31
|
+
constructor(statusCode, message) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.statusCode = statusCode;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function readBody(req, maxBytes, timeoutMs) {
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
const chunks = [];
|
|
39
|
+
let total = 0;
|
|
40
|
+
let settled = false;
|
|
41
|
+
const done = (fn) => {
|
|
42
|
+
if (settled)
|
|
43
|
+
return;
|
|
44
|
+
settled = true;
|
|
45
|
+
clearTimeout(timer);
|
|
46
|
+
fn();
|
|
47
|
+
};
|
|
48
|
+
const timer = setTimeout(() => done(() => {
|
|
49
|
+
reject(new HttpBodyError(408, "Request body timeout"));
|
|
50
|
+
}), timeoutMs);
|
|
51
|
+
if (typeof timer.unref === "function")
|
|
52
|
+
timer.unref();
|
|
53
|
+
req.on("data", (c) => {
|
|
54
|
+
total += c.length;
|
|
55
|
+
if (total > maxBytes) {
|
|
56
|
+
done(() => {
|
|
57
|
+
reject(new HttpBodyError(413, "Payload too large"));
|
|
58
|
+
});
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
chunks.push(c);
|
|
62
|
+
});
|
|
63
|
+
req.on("end", () => done(() => {
|
|
64
|
+
const raw = Buffer.concat(chunks).toString("utf-8");
|
|
65
|
+
if (!raw)
|
|
66
|
+
return resolve(undefined);
|
|
67
|
+
try {
|
|
68
|
+
resolve(JSON.parse(raw));
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
reject(e);
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
req.on("error", (e) => done(() => reject(e)));
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function jsonRpcError(res, status, code, message) {
|
|
78
|
+
res.writeHead(status, { "content-type": "application/json" });
|
|
79
|
+
res.end(JSON.stringify({ jsonrpc: "2.0", error: { code, message }, id: null }));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Start the MCP Streamable HTTP server. Resolves once it is listening.
|
|
83
|
+
*/
|
|
84
|
+
export function startMcpHttpServer(opts) {
|
|
85
|
+
if (!isLoopbackHost(opts.host) && !opts.authToken) {
|
|
86
|
+
return Promise.reject(new Error(`Refusing to start: HTTP transport is binding to a non-loopback address ` +
|
|
87
|
+
`(${opts.host}) without an auth token. Anyone who can reach this address ` +
|
|
88
|
+
`would get unauthenticated access to your memory. Set --token <token> ` +
|
|
89
|
+
`(or GNOSYS_SERVE_TOKEN), or bind to 127.0.0.1.`));
|
|
90
|
+
}
|
|
91
|
+
const mcpPath = opts.path ?? "/mcp";
|
|
92
|
+
const log = opts.log ?? (() => { });
|
|
93
|
+
const transports = new Map();
|
|
94
|
+
const lastSeen = new Map();
|
|
95
|
+
const idleMs = opts.sessionIdleMs ?? 30 * 60 * 1000;
|
|
96
|
+
const sweepMs = opts.sweepIntervalMs ?? 60 * 1000;
|
|
97
|
+
const maxBodyBytes = opts.maxBodyBytes ?? 4 * 1024 * 1024;
|
|
98
|
+
const bodyTimeoutMs = opts.bodyTimeoutMs ?? 30_000;
|
|
99
|
+
const touch = (sid) => lastSeen.set(sid, Date.now());
|
|
100
|
+
function reapIdle(now = Date.now()) {
|
|
101
|
+
let reaped = 0;
|
|
102
|
+
for (const [sid, t] of transports) {
|
|
103
|
+
if (now - (lastSeen.get(sid) ?? now) > idleMs) {
|
|
104
|
+
void t.close();
|
|
105
|
+
lastSeen.delete(sid);
|
|
106
|
+
reaped++;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return reaped;
|
|
110
|
+
}
|
|
111
|
+
const httpServer = http.createServer((req, res) => {
|
|
112
|
+
void handle(req, res).catch((e) => {
|
|
113
|
+
log(`request error: ${e instanceof Error ? e.message : String(e)}`);
|
|
114
|
+
if (!res.headersSent)
|
|
115
|
+
jsonRpcError(res, 500, -32603, "Internal error");
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
httpServer.headersTimeout = 15_000;
|
|
119
|
+
httpServer.requestTimeout = 60_000;
|
|
120
|
+
async function handle(req, res) {
|
|
121
|
+
const url = new URL(req.url ?? "/", `http://${req.headers.host ?? "localhost"}`);
|
|
122
|
+
// Liveness probe — unauthenticated, no MCP involvement.
|
|
123
|
+
if (url.pathname === "/health") {
|
|
124
|
+
res.writeHead(200, { "content-type": "application/json" });
|
|
125
|
+
res.end(JSON.stringify({ status: "ok", sessions: transports.size }));
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (url.pathname !== mcpPath) {
|
|
129
|
+
res.writeHead(404, { "content-type": "text/plain" });
|
|
130
|
+
res.end("Not found");
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
// CORS default-deny: browsers send Origin on cross-origin calls; IDE/CLI clients do not.
|
|
134
|
+
const origin = req.headers["origin"];
|
|
135
|
+
if (origin && !(opts.allowedOrigins ?? []).includes(origin)) {
|
|
136
|
+
jsonRpcError(res, 403, -32001, "Origin not allowed");
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
// Phase C: bearer auth (only enforced when a token is configured).
|
|
140
|
+
if (opts.authToken) {
|
|
141
|
+
if (req.headers["authorization"] !== `Bearer ${opts.authToken}`) {
|
|
142
|
+
jsonRpcError(res, 401, -32001, "Unauthorized");
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const sessionId = req.headers["mcp-session-id"];
|
|
147
|
+
if (req.method === "POST") {
|
|
148
|
+
let body;
|
|
149
|
+
try {
|
|
150
|
+
body = await readBody(req, maxBodyBytes, bodyTimeoutMs);
|
|
151
|
+
}
|
|
152
|
+
catch (e) {
|
|
153
|
+
if (e instanceof HttpBodyError) {
|
|
154
|
+
jsonRpcError(res, e.statusCode, -32000, e.message);
|
|
155
|
+
req.destroy();
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
jsonRpcError(res, 400, -32700, "Parse error");
|
|
159
|
+
req.destroy();
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
let transport = sessionId ? transports.get(sessionId) : undefined;
|
|
163
|
+
if (!transport) {
|
|
164
|
+
if (!isInitializeRequest(body)) {
|
|
165
|
+
jsonRpcError(res, 400, -32000, "No valid session; send an initialize request first");
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
// New session: fresh server + transport.
|
|
169
|
+
const server = await opts.makeServer();
|
|
170
|
+
transport = new StreamableHTTPServerTransport({
|
|
171
|
+
sessionIdGenerator: () => randomUUID(),
|
|
172
|
+
onsessioninitialized: (sid) => {
|
|
173
|
+
transports.set(sid, transport);
|
|
174
|
+
touch(sid);
|
|
175
|
+
log(`session initialized: ${sid} (${transports.size} active)`);
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
transport.onclose = () => {
|
|
179
|
+
const sid = transport.sessionId;
|
|
180
|
+
if (sid)
|
|
181
|
+
lastSeen.delete(sid);
|
|
182
|
+
if (sid && transports.delete(sid))
|
|
183
|
+
log(`session closed: ${sid} (${transports.size} active)`);
|
|
184
|
+
};
|
|
185
|
+
await server.connect(transport);
|
|
186
|
+
}
|
|
187
|
+
else if (sessionId) {
|
|
188
|
+
touch(sessionId);
|
|
189
|
+
}
|
|
190
|
+
await transport.handleRequest(req, res, body);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (req.method === "GET" || req.method === "DELETE") {
|
|
194
|
+
const transport = sessionId ? transports.get(sessionId) : undefined;
|
|
195
|
+
if (!transport) {
|
|
196
|
+
jsonRpcError(res, 400, -32000, "Missing or unknown session id");
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (sessionId)
|
|
200
|
+
touch(sessionId);
|
|
201
|
+
await transport.handleRequest(req, res);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
res.writeHead(405, { "content-type": "text/plain" });
|
|
205
|
+
res.end("Method not allowed");
|
|
206
|
+
}
|
|
207
|
+
return new Promise((resolve) => {
|
|
208
|
+
httpServer.listen(opts.port, opts.host, () => {
|
|
209
|
+
log(`listening on http://${opts.host}:${opts.port}${mcpPath}`);
|
|
210
|
+
const sweep = setInterval(() => reapIdle(), sweepMs);
|
|
211
|
+
sweep.unref();
|
|
212
|
+
resolve({
|
|
213
|
+
server: httpServer,
|
|
214
|
+
sessionCount: () => transports.size,
|
|
215
|
+
reapIdleSessions: (now) => reapIdle(now),
|
|
216
|
+
close: () => new Promise((r) => {
|
|
217
|
+
clearInterval(sweep);
|
|
218
|
+
for (const t of transports.values())
|
|
219
|
+
void t.close();
|
|
220
|
+
transports.clear();
|
|
221
|
+
lastSeen.clear();
|
|
222
|
+
httpServer.close(() => r());
|
|
223
|
+
}),
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
}
|
package/dist/lib/migrate.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Safe: original .md files and old DBs are untouched.
|
|
6
6
|
* Reversible: delete gnosys.db to revert.
|
|
7
7
|
*/
|
|
8
|
-
import { MigrationStats } from "./db.js";
|
|
8
|
+
import { type MigrationStats } from "./db.js";
|
|
9
9
|
/**
|
|
10
10
|
* Migrate all data from v1.x format into gnosys.db.
|
|
11
11
|
*/
|
|
@@ -16,4 +16,3 @@ export declare function migrate(storePath: string, options?: {
|
|
|
16
16
|
* Format migration results for CLI output.
|
|
17
17
|
*/
|
|
18
18
|
export declare function formatMigrationReport(stats: MigrationStats): string;
|
|
19
|
-
//# sourceMappingURL=migrate.d.ts.map
|
package/dist/lib/migrate.js
CHANGED
|
@@ -169,6 +169,7 @@ export async function migrate(storePath, options) {
|
|
|
169
169
|
const embPath = path.join(storePath, ".config", "embeddings.db");
|
|
170
170
|
if (Database) {
|
|
171
171
|
const embDb = new Database(embPath, { readonly: true });
|
|
172
|
+
embDb.pragma("busy_timeout = 5000");
|
|
172
173
|
const rows = embDb.prepare("SELECT file_path, embedding FROM embeddings").all();
|
|
173
174
|
let embCount = 0;
|
|
174
175
|
for (const row of rows) {
|
|
@@ -257,4 +258,3 @@ export function formatMigrationReport(stats) {
|
|
|
257
258
|
];
|
|
258
259
|
return lines.join("\n");
|
|
259
260
|
}
|
|
260
|
-
//# sourceMappingURL=migrate.js.map
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Supports PDF and DOCX in Phase 2. Image, audio, and video ingestion
|
|
6
6
|
* will be added in Phase 3/4.
|
|
7
7
|
*/
|
|
8
|
-
import { FileType } from "./fileDetect.js";
|
|
8
|
+
import { type FileType } from "./fileDetect.js";
|
|
9
9
|
import { type AttachmentRecord } from "./attachments.js";
|
|
10
10
|
export interface MultimodalIngestOptions {
|
|
11
11
|
/** Absolute path to the file to ingest */
|
|
@@ -65,4 +65,3 @@ export interface MultimodalIngestResult {
|
|
|
65
65
|
* 7. Link each memory back to the attachment
|
|
66
66
|
*/
|
|
67
67
|
export declare function ingestFile(options: MultimodalIngestOptions): Promise<MultimodalIngestResult>;
|
|
68
|
-
//# sourceMappingURL=multimodalIngest.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type PkgManager = "npm" | "pnpm" | "yarn" | "npx";
|
|
2
|
+
/** Detect how the running global gnosys was installed, from its path + env. */
|
|
3
|
+
export declare function detectPackageManager(execPath?: string, env?: NodeJS.ProcessEnv): PkgManager;
|
|
4
|
+
/** The upgrade command for a manager, or null when there's nothing to install (npx). */
|
|
5
|
+
export declare function upgradeCommand(pm: PkgManager): string | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Detect how the running global gnosys was installed, from its path + env. */
|
|
2
|
+
export function detectPackageManager(execPath = process.argv[1] || "", env = process.env) {
|
|
3
|
+
const p = execPath.replace(/\\/g, "/").toLowerCase();
|
|
4
|
+
if (p.includes("/_npx/") || p.includes("/.npm/_npx/"))
|
|
5
|
+
return "npx";
|
|
6
|
+
if (p.includes("/pnpm/") || (env.PNPM_HOME && p.startsWith(env.PNPM_HOME.replace(/\\/g, "/").toLowerCase()))) {
|
|
7
|
+
return "pnpm";
|
|
8
|
+
}
|
|
9
|
+
if (p.includes("/.yarn/") || p.includes("/yarn/global/") || p.includes("/.config/yarn/"))
|
|
10
|
+
return "yarn";
|
|
11
|
+
const ua = (env.npm_config_user_agent || "").toLowerCase();
|
|
12
|
+
if (ua.startsWith("pnpm"))
|
|
13
|
+
return "pnpm";
|
|
14
|
+
if (ua.startsWith("yarn"))
|
|
15
|
+
return "yarn";
|
|
16
|
+
return "npm";
|
|
17
|
+
}
|
|
18
|
+
/** The upgrade command for a manager, or null when there's nothing to install (npx). */
|
|
19
|
+
export function upgradeCommand(pm) {
|
|
20
|
+
switch (pm) {
|
|
21
|
+
case "pnpm":
|
|
22
|
+
return "pnpm add -g gnosys@latest";
|
|
23
|
+
case "yarn":
|
|
24
|
+
return "yarn global add gnosys@latest";
|
|
25
|
+
case "npx":
|
|
26
|
+
return null;
|
|
27
|
+
default:
|
|
28
|
+
return "npm install -g gnosys@latest";
|
|
29
|
+
}
|
|
30
|
+
}
|
package/dist/lib/paths.d.ts
CHANGED
|
@@ -27,12 +27,16 @@ export declare function getGnosysHome(): string;
|
|
|
27
27
|
export declare function getCentralDbPath(): string;
|
|
28
28
|
/** Path to the sandbox runtime directory (socket + helper template live here). */
|
|
29
29
|
export declare function getSandboxDir(): string;
|
|
30
|
-
/**
|
|
31
|
-
* Path to the user-level config directory: `~/.config/gnosys/`. Holds
|
|
32
|
-
* the project registry, .env, and other per-user CLI metadata that
|
|
33
|
-
* lives OUTSIDE the central data store at `~/.gnosys/`.
|
|
34
|
-
*/
|
|
35
|
-
export declare function getConfigDir(): string;
|
|
36
30
|
/** Path to the project registry file (~/.config/gnosys/projects.json). */
|
|
37
31
|
export declare function getProjectRegistryPath(): string;
|
|
38
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Path to the machine-local config file (~/.config/gnosys/machine.json).
|
|
34
|
+
*
|
|
35
|
+
* This file holds everything that is specific to THIS physical machine and
|
|
36
|
+
* must NEVER be synced to the shared brain or other machines: the stable
|
|
37
|
+
* machineId, the named project roots (whose absolute paths differ per
|
|
38
|
+
* machine), and the per-machine remote-sync connection. The central DB at
|
|
39
|
+
* ~/.gnosys/gnosys.db is the synced source of truth; machine.json is its
|
|
40
|
+
* machine-local counterpart. See machineConfig.ts.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getMachineConfigPath(): string;
|
package/dist/lib/paths.js
CHANGED
|
@@ -42,7 +42,7 @@ export function getSandboxDir() {
|
|
|
42
42
|
* the project registry, .env, and other per-user CLI metadata that
|
|
43
43
|
* lives OUTSIDE the central data store at `~/.gnosys/`.
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
function getConfigDir() {
|
|
46
46
|
if (process.env.GNOSYS_CONFIG_DIR)
|
|
47
47
|
return process.env.GNOSYS_CONFIG_DIR;
|
|
48
48
|
const home = process.env.HOME || process.env.USERPROFILE || "/tmp";
|
|
@@ -52,4 +52,16 @@ export function getConfigDir() {
|
|
|
52
52
|
export function getProjectRegistryPath() {
|
|
53
53
|
return path.join(getConfigDir(), "projects.json");
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Path to the machine-local config file (~/.config/gnosys/machine.json).
|
|
57
|
+
*
|
|
58
|
+
* This file holds everything that is specific to THIS physical machine and
|
|
59
|
+
* must NEVER be synced to the shared brain or other machines: the stable
|
|
60
|
+
* machineId, the named project roots (whose absolute paths differ per
|
|
61
|
+
* machine), and the per-machine remote-sync connection. The central DB at
|
|
62
|
+
* ~/.gnosys/gnosys.db is the synced source of truth; machine.json is its
|
|
63
|
+
* machine-local counterpart. See machineConfig.ts.
|
|
64
|
+
*/
|
|
65
|
+
export function getMachineConfigPath() {
|
|
66
|
+
return path.join(getConfigDir(), "machine.json");
|
|
67
|
+
}
|
package/dist/lib/pdfExtract.d.ts
CHANGED
package/dist/lib/pdfExtract.js
CHANGED