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
|
@@ -34,4 +34,3 @@ export interface TableOptions<T> {
|
|
|
34
34
|
export declare function renderTable<T>(rows: T[], columns: TableColumn<T>[], opts?: TableOptions<T>): string[];
|
|
35
35
|
/** Convenience: render + print + trailing newline. */
|
|
36
36
|
export declare function printTable<T>(rows: T[], columns: TableColumn<T>[], opts?: TableOptions<T>): void;
|
|
37
|
-
//# sourceMappingURL=table.d.ts.map
|
package/dist/lib/setup.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Uses Node.js built-in readline/promises — no external dependencies.
|
|
9
9
|
*/
|
|
10
|
-
import { Interface as ReadlineInterface } from "readline/promises";
|
|
10
|
+
import { type Interface as ReadlineInterface } from "readline/promises";
|
|
11
11
|
export interface ModelTier {
|
|
12
12
|
name: string;
|
|
13
13
|
model: string;
|
|
@@ -16,7 +16,7 @@ export interface ModelTier {
|
|
|
16
16
|
recommended: boolean;
|
|
17
17
|
}
|
|
18
18
|
/** Per-task routing override chosen during setup. */
|
|
19
|
-
|
|
19
|
+
interface TaskRouting {
|
|
20
20
|
provider: string;
|
|
21
21
|
model: string;
|
|
22
22
|
}
|
|
@@ -39,15 +39,6 @@ export interface SetupResult {
|
|
|
39
39
|
dreamEnabled?: boolean;
|
|
40
40
|
}
|
|
41
41
|
export declare const PROVIDER_TIERS: Record<string, ModelTier[]>;
|
|
42
|
-
/**
|
|
43
|
-
* Fetch models from OpenRouter, cache for 24 hours, fall back to hardcoded.
|
|
44
|
-
* Returns updated PROVIDER_TIERS for cloud providers only.
|
|
45
|
-
*/
|
|
46
|
-
export declare function fetchDynamicModels(): Promise<Record<string, ModelTier[]>>;
|
|
47
|
-
/**
|
|
48
|
-
* Get model tiers for a provider — tries dynamic first, falls back to hardcoded.
|
|
49
|
-
*/
|
|
50
|
-
export declare function getModelTiers(provider: string): Promise<ModelTier[]>;
|
|
51
42
|
/**
|
|
52
43
|
* Returns the cheapest capable model for structuring tasks.
|
|
53
44
|
* Structuring (keyword extraction, tagging) doesn't need a flagship model.
|
|
@@ -59,12 +50,6 @@ export declare function getStructuringModel(provider: string, chosenModel: strin
|
|
|
59
50
|
* Replaces an existing key line if found, otherwise appends.
|
|
60
51
|
*/
|
|
61
52
|
export declare function writeApiKey(provider: string, key: string): Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
* Write an API key to the macOS Keychain.
|
|
64
|
-
* Uses the -U flag to update if the entry already exists.
|
|
65
|
-
* Returns true on success, false on failure.
|
|
66
|
-
*/
|
|
67
|
-
export declare function writeApiKeyToKeychain(envVar: string, key: string): boolean;
|
|
68
53
|
/**
|
|
69
54
|
* Detect which IDEs are available in the given project directory.
|
|
70
55
|
* Returns an array like ["claude", "cursor", "codex"].
|
|
@@ -130,19 +115,6 @@ export interface ModelsSetupOpts {
|
|
|
130
115
|
* provider, then writes the result to gnosys.json. Skips IDE and remote setup.
|
|
131
116
|
*/
|
|
132
117
|
export declare function runModelsSetup(opts?: ModelsSetupOpts): Promise<void>;
|
|
133
|
-
export interface ModelsCommandOpts {
|
|
134
|
-
list?: boolean;
|
|
135
|
-
refresh?: boolean;
|
|
136
|
-
set?: string;
|
|
137
|
-
directory?: string;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Lightweight model-management command. Supports three operations:
|
|
141
|
-
* --list: print available models for the current provider
|
|
142
|
-
* --refresh: clear the OpenRouter cache and re-fetch
|
|
143
|
-
* --set X: update the default model in gnosys.json (no prompts)
|
|
144
|
-
*/
|
|
145
|
-
export declare function runModelsCommand(opts?: ModelsCommandOpts): Promise<void>;
|
|
146
118
|
export interface DreamSetupOpts {
|
|
147
119
|
directory?: string;
|
|
148
120
|
/** v5.8.4: reuse the caller's readline (e.g. summary wizard) to avoid stdin races. */
|
|
@@ -179,4 +151,3 @@ export declare function runChatSetup(opts?: ChatSetupOpts): Promise<void>;
|
|
|
179
151
|
*/
|
|
180
152
|
export declare function getApiKeyForProvider(provider: string): Promise<string>;
|
|
181
153
|
export {};
|
|
182
|
-
//# sourceMappingURL=setup.d.ts.map
|
package/dist/lib/setup.js
CHANGED
|
@@ -93,7 +93,7 @@ const OPENROUTER_PREFIX_MAP = {
|
|
|
93
93
|
* Fetch models from OpenRouter, cache for 24 hours, fall back to hardcoded.
|
|
94
94
|
* Returns updated PROVIDER_TIERS for cloud providers only.
|
|
95
95
|
*/
|
|
96
|
-
|
|
96
|
+
async function fetchDynamicModels() {
|
|
97
97
|
// Check cache first
|
|
98
98
|
try {
|
|
99
99
|
const stat = await fs.stat(CACHE_FILE);
|
|
@@ -266,7 +266,7 @@ export async function fetchDynamicModels() {
|
|
|
266
266
|
/**
|
|
267
267
|
* Get model tiers for a provider — tries dynamic first, falls back to hardcoded.
|
|
268
268
|
*/
|
|
269
|
-
|
|
269
|
+
async function getModelTiers(provider) {
|
|
270
270
|
const dynamic = await fetchDynamicModels();
|
|
271
271
|
if (dynamic[provider] && dynamic[provider].length > 0) {
|
|
272
272
|
return dynamic[provider];
|
|
@@ -337,7 +337,8 @@ export async function writeApiKey(provider, key) {
|
|
|
337
337
|
if (!envVar)
|
|
338
338
|
return;
|
|
339
339
|
const configDir = path.join(os.homedir(), ".config", "gnosys");
|
|
340
|
-
await fs.mkdir(configDir, { recursive: true });
|
|
340
|
+
await fs.mkdir(configDir, { recursive: true, mode: 0o700 });
|
|
341
|
+
await fs.chmod(configDir, 0o700);
|
|
341
342
|
const envPath = path.join(configDir, ".env");
|
|
342
343
|
let lines = [];
|
|
343
344
|
try {
|
|
@@ -364,13 +365,14 @@ export async function writeApiKey(provider, key) {
|
|
|
364
365
|
lines.push(`${envVar}=${key}`);
|
|
365
366
|
}
|
|
366
367
|
await fs.writeFile(envPath, lines.join("\n") + "\n", "utf-8");
|
|
368
|
+
await fs.chmod(envPath, 0o600);
|
|
367
369
|
}
|
|
368
370
|
/**
|
|
369
371
|
* Write an API key to the macOS Keychain.
|
|
370
372
|
* Uses the -U flag to update if the entry already exists.
|
|
371
373
|
* Returns true on success, false on failure.
|
|
372
374
|
*/
|
|
373
|
-
|
|
375
|
+
function writeApiKeyToKeychain(envVar, key) {
|
|
374
376
|
if (process.platform !== "darwin")
|
|
375
377
|
return false;
|
|
376
378
|
try {
|
|
@@ -700,9 +702,9 @@ export async function setupIDE(ide, projectDir) {
|
|
|
700
702
|
let existing = await fs.readFile(userCodexConfig, "utf-8");
|
|
701
703
|
const before = existing;
|
|
702
704
|
// Old shape (pre-v5.8.4): [gnosys] command/args
|
|
703
|
-
existing = existing.replace(/\n?\[gnosys\][
|
|
705
|
+
existing = existing.replace(/\n?\[gnosys\][^[]*?command\s*=\s*"gnosys"[^[]*?args\s*=\s*\[[^\]]*\]\s*\n?/, "\n");
|
|
704
706
|
// v5.8.4 shape: [mcp.gnosys] type/command
|
|
705
|
-
existing = existing.replace(/\n?\[mcp\.gnosys\][
|
|
707
|
+
existing = existing.replace(/\n?\[mcp\.gnosys\][^[]*?type\s*=\s*"local"[^[]*?command\s*=\s*\[[^\]]*\]\s*\n?/, "\n");
|
|
706
708
|
if (existing !== before) {
|
|
707
709
|
existing = existing.replace(/\n{3,}/g, "\n\n");
|
|
708
710
|
await fs.writeFile(userCodexConfig, existing, "utf-8");
|
|
@@ -1112,6 +1114,7 @@ export async function runSetup(opts) {
|
|
|
1112
1114
|
console.log();
|
|
1113
1115
|
}
|
|
1114
1116
|
if (shouldUpgrade) {
|
|
1117
|
+
// Intentional dynamic import — lazy-load projectIdentity to avoid a static cycle.
|
|
1115
1118
|
const { createProjectIdentity } = await import("./projectIdentity.js");
|
|
1116
1119
|
for (const project of projects) {
|
|
1117
1120
|
// Check directory still exists on disk
|
|
@@ -1223,7 +1226,8 @@ export async function runSetup(opts) {
|
|
|
1223
1226
|
if (baseUrl) {
|
|
1224
1227
|
// Write GNOSYS_LLM_BASE_URL to env file
|
|
1225
1228
|
const configDir = path.join(os.homedir(), ".config", "gnosys");
|
|
1226
|
-
await fs.mkdir(configDir, { recursive: true });
|
|
1229
|
+
await fs.mkdir(configDir, { recursive: true, mode: 0o700 });
|
|
1230
|
+
await fs.chmod(configDir, 0o700);
|
|
1227
1231
|
const envPath = path.join(configDir, ".env");
|
|
1228
1232
|
let lines = [];
|
|
1229
1233
|
try {
|
|
@@ -1248,6 +1252,7 @@ export async function runSetup(opts) {
|
|
|
1248
1252
|
lines.push(`GNOSYS_LLM_BASE_URL=${baseUrl}`);
|
|
1249
1253
|
}
|
|
1250
1254
|
await fs.writeFile(envPath, lines.join("\n") + "\n", "utf-8");
|
|
1255
|
+
await fs.chmod(envPath, 0o600);
|
|
1251
1256
|
}
|
|
1252
1257
|
}
|
|
1253
1258
|
else if (isSkip) {
|
|
@@ -2078,7 +2083,7 @@ export async function runModelsSetup(opts = {}) {
|
|
|
2078
2083
|
* --refresh: clear the OpenRouter cache and re-fetch
|
|
2079
2084
|
* --set X: update the default model in gnosys.json (no prompts)
|
|
2080
2085
|
*/
|
|
2081
|
-
|
|
2086
|
+
async function runModelsCommand(opts = {}) {
|
|
2082
2087
|
const projectDir = opts.directory ? path.resolve(opts.directory) : process.cwd();
|
|
2083
2088
|
const existingConfig = await loadExistingConfig(projectDir);
|
|
2084
2089
|
const currentProvider = existingConfig?.llm.defaultProvider;
|
|
@@ -2484,4 +2489,3 @@ export async function getApiKeyForProvider(provider) {
|
|
|
2484
2489
|
}
|
|
2485
2490
|
return "";
|
|
2486
2491
|
}
|
|
2487
|
-
//# sourceMappingURL=setup.js.map
|
package/dist/lib/staticSearch.js
CHANGED
package/dist/lib/store.d.ts
CHANGED
package/dist/lib/store.js
CHANGED
package/dist/lib/tags.d.ts
CHANGED
package/dist/lib/tags.js
CHANGED
package/dist/lib/timeline.d.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Group memories by time period to see knowledge evolution.
|
|
5
5
|
* Compute summary statistics across the store.
|
|
6
6
|
*/
|
|
7
|
-
import { Memory } from "./store.js";
|
|
8
|
-
import { DbMemory } from "./db.js";
|
|
7
|
+
import type { Memory } from "./store.js";
|
|
8
|
+
import type { DbMemory } from "./db.js";
|
|
9
9
|
export type TimePeriod = "day" | "week" | "month" | "year";
|
|
10
10
|
export interface TimelineEntry {
|
|
11
11
|
period: string;
|
|
@@ -38,4 +38,3 @@ export declare function groupDbByPeriod(memories: DbMemory[], period: TimePeriod
|
|
|
38
38
|
* Compute summary statistics across all memories.
|
|
39
39
|
*/
|
|
40
40
|
export declare function computeStats(memories: Memory[]): MemoryStats;
|
|
41
|
-
//# sourceMappingURL=timeline.d.ts.map
|
package/dist/lib/timeline.js
CHANGED
|
@@ -99,9 +99,9 @@ function toPeriodKey(dateStr, period) {
|
|
|
99
99
|
const parts = dateStr.split("-");
|
|
100
100
|
if (parts.length < 3)
|
|
101
101
|
return null;
|
|
102
|
-
const year = parseInt(parts[0]);
|
|
103
|
-
const month = parseInt(parts[1]);
|
|
104
|
-
const day = parseInt(parts[2]);
|
|
102
|
+
const year = parseInt(parts[0], 10);
|
|
103
|
+
const month = parseInt(parts[1], 10);
|
|
104
|
+
const day = parseInt(parts[2], 10);
|
|
105
105
|
switch (period) {
|
|
106
106
|
case "day":
|
|
107
107
|
return dateStr; // Already YYYY-MM-DD
|
|
@@ -127,4 +127,3 @@ function getISOWeek(d) {
|
|
|
127
127
|
return (1 +
|
|
128
128
|
Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + ((week1.getDay() + 6) % 7)) / 7));
|
|
129
129
|
}
|
|
130
|
-
//# sourceMappingURL=timeline.js.map
|
package/dist/lib/trace.d.ts
CHANGED
|
@@ -9,21 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* No external dependencies beyond Node built-ins and the Gnosys DB.
|
|
11
11
|
*/
|
|
12
|
-
import { GnosysDB } from "./db.js";
|
|
13
|
-
export interface TraceNode {
|
|
14
|
-
name: string;
|
|
15
|
-
file: string;
|
|
16
|
-
kind: "function" | "class" | "method" | "export";
|
|
17
|
-
line: number;
|
|
18
|
-
calls: string[];
|
|
19
|
-
calledBy: string[];
|
|
20
|
-
imports: string[];
|
|
21
|
-
}
|
|
22
|
-
export interface TraceGraph {
|
|
23
|
-
nodes: Map<string, TraceNode>;
|
|
24
|
-
files: string[];
|
|
25
|
-
rootDir: string;
|
|
26
|
-
}
|
|
12
|
+
import type { GnosysDB } from "./db.js";
|
|
27
13
|
export interface TraceResult {
|
|
28
14
|
memoriesCreated: number;
|
|
29
15
|
relationshipsCreated: number;
|
|
@@ -39,4 +25,3 @@ export declare function traceCodebase(db: GnosysDB, rootDir: string, opts?: {
|
|
|
39
25
|
projectId?: string;
|
|
40
26
|
maxFiles?: number;
|
|
41
27
|
}): TraceResult;
|
|
42
|
-
//# sourceMappingURL=trace.d.ts.map
|
package/dist/lib/trace.js
CHANGED
package/dist/lib/upgrade.d.ts
CHANGED
package/dist/lib/upgrade.js
CHANGED
package/dist/lib/videoExtract.js
CHANGED
package/dist/lib/webIndex.d.ts
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* builds a TF-IDF weighted inverted index mapping tokens to documents,
|
|
6
6
|
* and writes the result as a JSON file (gnosys-index.json).
|
|
7
7
|
*/
|
|
8
|
-
import type { GnosysWebIndex
|
|
9
|
-
export type { GnosysWebIndex, DocumentManifest, IndexEntry };
|
|
8
|
+
import type { GnosysWebIndex } from "./staticSearch.js";
|
|
10
9
|
export interface BuildIndexOptions {
|
|
11
10
|
stopWords?: boolean;
|
|
12
11
|
minTokenLength?: number;
|
|
@@ -25,4 +24,3 @@ export declare function buildIndex(knowledgeDir: string, options?: BuildIndexOpt
|
|
|
25
24
|
* Write an index to a JSON file.
|
|
26
25
|
*/
|
|
27
26
|
export declare function writeIndex(index: GnosysWebIndex, outputPath: string): Promise<void>;
|
|
28
|
-
//# sourceMappingURL=webIndex.d.ts.map
|
package/dist/lib/webIndex.js
CHANGED
package/dist/lib/webIngest.d.ts
CHANGED
|
@@ -32,6 +32,19 @@ export interface IngestResult {
|
|
|
32
32
|
}>;
|
|
33
33
|
duration: number;
|
|
34
34
|
}
|
|
35
|
+
export interface SafeUrlOptions {
|
|
36
|
+
/** Allow loopback hosts (127.0.0.1, localhost, ::1). Defaults to false. */
|
|
37
|
+
allowLoopback?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Validate a URL is safe to fetch (blocks SSRF to internal networks).
|
|
41
|
+
* Only allows http/https schemes and rejects private/loopback/metadata targets.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isSafeUrl(urlStr: string, options?: SafeUrlOptions): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Fetch a URL with manual redirect handling; re-validates each hop through isSafeUrl.
|
|
46
|
+
*/
|
|
47
|
+
export declare function safeFetch(startUrl: string, init?: RequestInit, options?: SafeUrlOptions): Promise<Response>;
|
|
35
48
|
/**
|
|
36
49
|
* Ingest a website into a Gnosys knowledge directory.
|
|
37
50
|
*/
|
|
@@ -48,4 +61,3 @@ export declare function ingestDirectory(dir: string, config: WebIngestConfig, gn
|
|
|
48
61
|
* Remove all knowledge files from the output directory.
|
|
49
62
|
*/
|
|
50
63
|
export declare function removeKnowledge(knowledgePath: string): Promise<void>;
|
|
51
|
-
//# sourceMappingURL=webIngest.d.ts.map
|
package/dist/lib/webIngest.js
CHANGED
|
@@ -9,6 +9,7 @@ import fs from "fs/promises";
|
|
|
9
9
|
import { existsSync, readFileSync, mkdirSync } from "fs";
|
|
10
10
|
import path from "path";
|
|
11
11
|
import { createHash } from "crypto";
|
|
12
|
+
import { isIP } from "node:net";
|
|
12
13
|
import matter from "gray-matter";
|
|
13
14
|
import TurndownService from "turndown";
|
|
14
15
|
import { getLLMProvider } from "./llm.js";
|
|
@@ -28,36 +29,52 @@ function createTurndown() {
|
|
|
28
29
|
const MAX_SITEMAP_DEPTH = 3;
|
|
29
30
|
/** Maximum total URLs collected from sitemaps. */
|
|
30
31
|
const MAX_SITEMAP_URLS = 10_000;
|
|
32
|
+
/** Maximum redirect hops when fetching remote URLs. */
|
|
33
|
+
const MAX_FETCH_REDIRECTS = 5;
|
|
31
34
|
/**
|
|
32
35
|
* Validate a URL is safe to fetch (blocks SSRF to internal networks).
|
|
33
|
-
* Only allows http/https schemes and rejects private/loopback
|
|
36
|
+
* Only allows http/https schemes and rejects private/loopback/metadata targets.
|
|
34
37
|
*/
|
|
35
|
-
function isSafeUrl(urlStr) {
|
|
38
|
+
export function isSafeUrl(urlStr, options) {
|
|
36
39
|
try {
|
|
37
40
|
const url = new URL(urlStr);
|
|
38
41
|
// Only allow http/https
|
|
39
42
|
if (url.protocol !== "http:" && url.protocol !== "https:")
|
|
40
43
|
return false;
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname === "[::1]") {
|
|
44
|
-
return true; // Allow localhost for local dev — but block metadata endpoints below
|
|
45
|
-
}
|
|
44
|
+
const allowLoopback = options?.allowLoopback ?? false;
|
|
45
|
+
const hostname = url.hostname.replace(/^\[|\]$/g, "");
|
|
46
46
|
// Block cloud metadata endpoints
|
|
47
47
|
if (hostname === "169.254.169.254" || hostname === "metadata.google.internal")
|
|
48
48
|
return false;
|
|
49
|
-
// Block
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
// Block hex-encoded IP hostnames (e.g. 0x7f000001)
|
|
50
|
+
if (/^0x[0-9a-f]+$/i.test(hostname))
|
|
51
|
+
return false;
|
|
52
|
+
// Block dotted hosts with hex octets (e.g. 0x7f.0.0.1)
|
|
53
|
+
if (hostname.includes(".") && hostname.split(".").some((part) => /^0x[0-9a-f]+$/i.test(part))) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
const ipKind = isIP(hostname);
|
|
57
|
+
if (ipKind === 4) {
|
|
58
|
+
return isSafeIpv4(hostname, allowLoopback);
|
|
59
|
+
}
|
|
60
|
+
if (ipKind === 6) {
|
|
61
|
+
return isSafeIpv6(hostname, allowLoopback);
|
|
62
|
+
}
|
|
63
|
+
// All-numeric hostname (decimal IP encoding, e.g. 2130706433 = 127.0.0.1)
|
|
64
|
+
if (/^\d+$/.test(hostname)) {
|
|
65
|
+
const asInt = Number(hostname);
|
|
66
|
+
if (!Number.isFinite(asInt) || asInt < 0 || asInt > 0xffffffff)
|
|
67
|
+
return false;
|
|
68
|
+
const octets = [
|
|
69
|
+
(asInt >>> 24) & 0xff,
|
|
70
|
+
(asInt >>> 16) & 0xff,
|
|
71
|
+
(asInt >>> 8) & 0xff,
|
|
72
|
+
asInt & 0xff,
|
|
73
|
+
];
|
|
74
|
+
return isSafeIpv4(octets.join("."), allowLoopback);
|
|
75
|
+
}
|
|
76
|
+
if (!allowLoopback && (hostname === "localhost" || hostname.endsWith(".localhost"))) {
|
|
77
|
+
return false;
|
|
61
78
|
}
|
|
62
79
|
return true;
|
|
63
80
|
}
|
|
@@ -65,6 +82,66 @@ function isSafeUrl(urlStr) {
|
|
|
65
82
|
return false;
|
|
66
83
|
}
|
|
67
84
|
}
|
|
85
|
+
function isSafeIpv4(dotted, allowLoopback) {
|
|
86
|
+
const match = dotted.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
|
|
87
|
+
if (!match)
|
|
88
|
+
return false;
|
|
89
|
+
const octets = match.slice(1).map(Number);
|
|
90
|
+
if (octets.some((n) => n > 255))
|
|
91
|
+
return false;
|
|
92
|
+
const [a, b] = octets;
|
|
93
|
+
if (a === 0 && octets.every((n) => n === 0))
|
|
94
|
+
return false; // 0.0.0.0
|
|
95
|
+
if (!allowLoopback && a === 127)
|
|
96
|
+
return false; // 127.0.0.0/8
|
|
97
|
+
if (a === 10)
|
|
98
|
+
return false; // 10.0.0.0/8
|
|
99
|
+
if (a === 172 && b >= 16 && b <= 31)
|
|
100
|
+
return false; // 172.16.0.0/12
|
|
101
|
+
if (a === 192 && b === 168)
|
|
102
|
+
return false; // 192.168.0.0/16
|
|
103
|
+
if (a === 169 && b === 254)
|
|
104
|
+
return false; // 169.254.0.0/16
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
function isSafeIpv6(addr, allowLoopback) {
|
|
108
|
+
const lower = addr.toLowerCase();
|
|
109
|
+
if (!allowLoopback && (lower === "::1" || lower === "0:0:0:0:0:0:0:1"))
|
|
110
|
+
return false;
|
|
111
|
+
// Unique local addresses fc00::/7
|
|
112
|
+
if (/^f[cd]/i.test(lower))
|
|
113
|
+
return false;
|
|
114
|
+
// Link-local fe80::/10
|
|
115
|
+
if (/^fe[89ab]/i.test(lower))
|
|
116
|
+
return false;
|
|
117
|
+
// IPv4-mapped IPv6 (::ffff:x.x.x.x)
|
|
118
|
+
const mapped = lower.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/);
|
|
119
|
+
if (mapped) {
|
|
120
|
+
return isSafeIpv4(mapped[1], allowLoopback);
|
|
121
|
+
}
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Fetch a URL with manual redirect handling; re-validates each hop through isSafeUrl.
|
|
126
|
+
*/
|
|
127
|
+
export async function safeFetch(startUrl, init, options) {
|
|
128
|
+
let url = startUrl;
|
|
129
|
+
for (let hop = 0; hop <= MAX_FETCH_REDIRECTS; hop++) {
|
|
130
|
+
if (!isSafeUrl(url, options)) {
|
|
131
|
+
throw new Error(`Refusing to fetch unsafe URL: ${url}`);
|
|
132
|
+
}
|
|
133
|
+
const response = await fetch(url, { ...init, redirect: "manual" });
|
|
134
|
+
if (response.status >= 300 && response.status < 400) {
|
|
135
|
+
const location = response.headers.get("location");
|
|
136
|
+
if (!location)
|
|
137
|
+
return response;
|
|
138
|
+
url = new URL(location, url).toString();
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
return response;
|
|
142
|
+
}
|
|
143
|
+
throw new Error("Too many redirects");
|
|
144
|
+
}
|
|
68
145
|
// ─── URL utilities ───────────────────────────────────────────────────────
|
|
69
146
|
function matchesExclude(url, patterns) {
|
|
70
147
|
const urlPath = new URL(url, "https://example.com").pathname;
|
|
@@ -122,7 +199,7 @@ async function fetchSitemapUrls(sitemapUrl, depth = 0) {
|
|
|
122
199
|
if (!isSafeUrl(sitemapUrl)) {
|
|
123
200
|
throw new Error(`Refusing to fetch unsafe URL: ${sitemapUrl}`);
|
|
124
201
|
}
|
|
125
|
-
const response = await
|
|
202
|
+
const response = await safeFetch(sitemapUrl);
|
|
126
203
|
if (!response.ok) {
|
|
127
204
|
throw new Error(`Failed to fetch sitemap: ${response.status} ${response.statusText}`);
|
|
128
205
|
}
|
|
@@ -153,7 +230,7 @@ async function fetchPage(url) {
|
|
|
153
230
|
if (!isSafeUrl(url)) {
|
|
154
231
|
throw new Error(`Refusing to fetch unsafe URL: ${url}`);
|
|
155
232
|
}
|
|
156
|
-
const response = await
|
|
233
|
+
const response = await safeFetch(url);
|
|
157
234
|
if (!response.ok) {
|
|
158
235
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
159
236
|
}
|
|
@@ -507,7 +584,6 @@ async function applyTfIdfRelevance(outputDir) {
|
|
|
507
584
|
docs.push({ id, content: parsed.content, path: filePath });
|
|
508
585
|
}
|
|
509
586
|
catch {
|
|
510
|
-
continue;
|
|
511
587
|
}
|
|
512
588
|
}
|
|
513
589
|
if (docs.length === 0)
|
|
@@ -526,8 +602,6 @@ async function applyTfIdfRelevance(outputDir) {
|
|
|
526
602
|
await fs.writeFile(doc.path, updated, "utf-8");
|
|
527
603
|
}
|
|
528
604
|
catch {
|
|
529
|
-
continue;
|
|
530
605
|
}
|
|
531
606
|
}
|
|
532
607
|
}
|
|
533
|
-
//# sourceMappingURL=webIngest.js.map
|
package/dist/lib/wikilinks.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Scans memory content for [[wikilinks]] and builds a link graph.
|
|
5
5
|
* Supports both [[title]] and [[path|display text]] formats.
|
|
6
6
|
*/
|
|
7
|
-
import { Memory } from "./store.js";
|
|
7
|
+
import type { Memory } from "./store.js";
|
|
8
8
|
/** A single link found in a memory. */
|
|
9
9
|
export interface WikiLink {
|
|
10
10
|
/** The raw target inside [[ ]] — could be a title or relative path */
|
|
@@ -17,7 +17,7 @@ export interface WikiLink {
|
|
|
17
17
|
sourceTitle: string;
|
|
18
18
|
}
|
|
19
19
|
/** A node in the link graph with both outgoing and incoming links. */
|
|
20
|
-
|
|
20
|
+
interface LinkNode {
|
|
21
21
|
/** This memory's relative path */
|
|
22
22
|
path: string;
|
|
23
23
|
/** This memory's title */
|
|
@@ -60,4 +60,4 @@ export declare function getOutgoingLinks(memories: Memory[], sourcePath: string)
|
|
|
60
60
|
* Format the link graph as a simple text summary.
|
|
61
61
|
*/
|
|
62
62
|
export declare function formatGraphSummary(graph: LinkGraph): string;
|
|
63
|
-
|
|
63
|
+
export {};
|
package/dist/lib/wikilinks.js
CHANGED
package/dist/postinstall.d.ts
CHANGED
package/dist/postinstall.js
CHANGED
package/dist/sandbox/client.d.ts
CHANGED
package/dist/sandbox/client.js
CHANGED