@neuralis/brain-core 0.3.1 → 0.4.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 +88 -1417
- package/app/README.md +4 -4
- package/app/cards/FilesystemCardShell.tsx +42 -4
- package/app/cards/FilesystemChangeCard.tsx +34 -11
- package/app/cards/README.md +6 -5
- package/app/cards/diffUtils.ts +99 -1
- package/app/filesystem/FilesystemHost.tsx +24 -2
- package/app/filesystem/README.md +1 -1
- package/app/filesystem/api/README.md +3 -3
- package/app/filesystem/api/index.ts +38 -14
- package/app/filesystem/api/projectPackages.ts +13 -102
- package/app/filesystem/domain/types.ts +30 -10
- package/app/filesystem/hooks/README.md +4 -4
- package/app/filesystem/hooks/useDiscoverableSources.ts +19 -30
- package/app/filesystem/hooks/useFilesystemSSE.ts +42 -2
- package/app/filesystem/host/README.md +6 -4
- package/app/filesystem/host/buildFilesystemHostValue.ts +28 -2
- package/app/filesystem/host/installFilesystemHostComponents.tsx +1 -1
- package/app/filesystem/lib/sourceKindForm.ts +210 -27
- package/app/filesystem/lib/treeVisualState.tsx +98 -4
- package/app/filesystem/store/README.md +1 -0
- package/app/filesystem/store/filesystemStore.ts +99 -8
- package/app/filesystem/store/gitSlice.ts +5 -0
- package/app/filesystem/store/helpers.ts +17 -0
- package/app/filesystem/store/listSlice.ts +8 -0
- package/app/filesystem/ui/CodeEditor.tsx +18 -3
- package/app/filesystem/ui/DiscoverDock.tsx +5 -1
- package/app/filesystem/ui/FileEditor.tsx +15 -10
- package/app/filesystem/ui/FileTree.tsx +75 -24
- package/app/filesystem/ui/FilesystemWidget.tsx +10 -2
- package/app/filesystem/ui/FolderPicker.tsx +251 -0
- package/app/filesystem/ui/GitControlPanel.tsx +7 -2
- package/app/filesystem/ui/PackagesPanel.tsx +52 -374
- package/app/filesystem/ui/PendingChangesPanel.tsx +1 -1
- package/app/filesystem/ui/PolicyEditor.tsx +109 -24
- package/app/filesystem/ui/README.md +30 -23
- package/app/filesystem/ui/RawMediaPreview.tsx +58 -0
- package/app/filesystem/ui/SourceBranchHeader.tsx +4 -4
- package/app/filesystem/ui/SourcesPanel.tsx +502 -342
- package/app/filesystem/ui/Toolbar.tsx +1 -2
- package/app/filesystem/ui/VectorHealthPanel.tsx +2 -2
- package/app/shared/filesystem.png +0 -0
- package/dist/app/host.js +58 -46
- package/dist/scripts/sourceRootPairV1.d.ts +47 -0
- package/dist/scripts/sourceRootPairV1.d.ts.map +1 -0
- package/dist/scripts/sourceRootPairV1.js +147 -0
- package/dist/scripts/sourceRootPairV1.js.map +1 -0
- package/dist/scripts/sourceToFolderV1.d.ts +56 -0
- package/dist/scripts/sourceToFolderV1.d.ts.map +1 -0
- package/dist/scripts/sourceToFolderV1.js +152 -0
- package/dist/scripts/sourceToFolderV1.js.map +1 -0
- package/dist/scripts/sourceToHostV1.d.ts +56 -0
- package/dist/scripts/sourceToHostV1.d.ts.map +1 -0
- package/dist/scripts/sourceToHostV1.js +132 -0
- package/dist/scripts/sourceToHostV1.js.map +1 -0
- package/dist/src/channels/filesystem.d.ts +1 -1
- package/dist/src/channels/filesystem.js +1 -1
- package/dist/src/connectors/AppSourceConfigStore.d.ts +17 -3
- package/dist/src/connectors/AppSourceConfigStore.d.ts.map +1 -1
- package/dist/src/connectors/AppSourceConfigStore.js +46 -6
- package/dist/src/connectors/AppSourceConfigStore.js.map +1 -1
- package/dist/src/connectors/HostConnector.d.ts +201 -0
- package/dist/src/connectors/HostConnector.d.ts.map +1 -0
- package/dist/src/connectors/HostConnector.js +903 -0
- package/dist/src/connectors/HostConnector.js.map +1 -0
- package/dist/src/connectors/inProcessTransport.d.ts +131 -0
- package/dist/src/connectors/inProcessTransport.d.ts.map +1 -0
- package/dist/src/connectors/inProcessTransport.js +447 -0
- package/dist/src/connectors/inProcessTransport.js.map +1 -0
- package/dist/src/domain/access/callerPermissions.d.ts +29 -0
- package/dist/src/domain/access/callerPermissions.d.ts.map +1 -1
- package/dist/src/domain/access/callerPermissions.js +85 -5
- package/dist/src/domain/access/callerPermissions.js.map +1 -1
- package/dist/src/domain/access/nativeLocalFence.d.ts +65 -0
- package/dist/src/domain/access/nativeLocalFence.d.ts.map +1 -0
- package/dist/src/domain/access/nativeLocalFence.js +171 -0
- package/dist/src/domain/access/nativeLocalFence.js.map +1 -0
- package/dist/src/domain/access/uriPermission.js +3 -3
- package/dist/src/domain/access/uriPermission.js.map +1 -1
- package/dist/src/domain/byteRange.d.ts +15 -0
- package/dist/src/domain/byteRange.d.ts.map +1 -0
- package/dist/src/domain/byteRange.js +30 -0
- package/dist/src/domain/byteRange.js.map +1 -0
- package/dist/src/domain/defaultPermissions.d.ts.map +1 -1
- package/dist/src/domain/defaultPermissions.js +29 -0
- package/dist/src/domain/defaultPermissions.js.map +1 -1
- package/dist/src/domain/mime.d.ts +11 -19
- package/dist/src/domain/mime.d.ts.map +1 -1
- package/dist/src/domain/mime.js +13 -102
- package/dist/src/domain/mime.js.map +1 -1
- package/dist/src/domain/paths.d.ts.map +1 -1
- package/dist/src/domain/paths.js +5 -3
- package/dist/src/domain/paths.js.map +1 -1
- package/dist/src/domain/scopeAccessCtx.d.ts +2 -2
- package/dist/src/domain/scopeAccessCtx.js +2 -2
- package/dist/src/domain/sourceConfig.d.ts +52 -19
- package/dist/src/domain/sourceConfig.d.ts.map +1 -1
- package/dist/src/domain/sourceConfig.js +103 -19
- package/dist/src/domain/sourceConfig.js.map +1 -1
- package/dist/src/domain/sourcePackages.d.ts +8 -8
- package/dist/src/domain/sourcePackages.d.ts.map +1 -1
- package/dist/src/domain/sourceRootPair.d.ts +88 -0
- package/dist/src/domain/sourceRootPair.d.ts.map +1 -0
- package/dist/src/domain/sourceRootPair.js +108 -0
- package/dist/src/domain/sourceRootPair.js.map +1 -0
- package/dist/src/domain/syncTypes.d.ts +8 -1
- package/dist/src/domain/syncTypes.d.ts.map +1 -1
- package/dist/src/domain/syncTypes.js +1 -0
- package/dist/src/domain/syncTypes.js.map +1 -1
- package/dist/src/domain/types.d.ts +32 -2
- package/dist/src/domain/types.d.ts.map +1 -1
- package/dist/src/domain/uri.d.ts.map +1 -1
- package/dist/src/domain/uri.js +3 -2
- package/dist/src/domain/uri.js.map +1 -1
- package/dist/src/embeddings/clients/GeminiEmbedder.d.ts.map +1 -1
- package/dist/src/embeddings/clients/GeminiEmbedder.js +2 -5
- package/dist/src/embeddings/clients/GeminiEmbedder.js.map +1 -1
- package/dist/src/embeddings/clients/OpenAIEmbedder.d.ts.map +1 -1
- package/dist/src/embeddings/clients/OpenAIEmbedder.js +2 -3
- package/dist/src/embeddings/clients/OpenAIEmbedder.js.map +1 -1
- package/dist/src/embeddings/clients/QwenEmbedder.d.ts +2 -0
- package/dist/src/embeddings/clients/QwenEmbedder.d.ts.map +1 -1
- package/dist/src/embeddings/clients/QwenEmbedder.js +10 -2
- package/dist/src/embeddings/clients/QwenEmbedder.js.map +1 -1
- package/dist/src/embeddings/clients/VoyageEmbedder.d.ts +2 -0
- package/dist/src/embeddings/clients/VoyageEmbedder.d.ts.map +1 -1
- package/dist/src/embeddings/clients/VoyageEmbedder.js +8 -1
- package/dist/src/embeddings/clients/VoyageEmbedder.js.map +1 -1
- package/dist/src/embeddings/factory.d.ts +5 -3
- package/dist/src/embeddings/factory.d.ts.map +1 -1
- package/dist/src/embeddings/factory.js +7 -3
- package/dist/src/embeddings/factory.js.map +1 -1
- package/dist/src/embeddings/models.d.ts +1 -1
- package/dist/src/embeddings/models.d.ts.map +1 -1
- package/dist/src/embeddings/retry.js +1 -1
- package/dist/src/embeddings/retry.js.map +1 -1
- package/dist/src/embeddings/types.d.ts +6 -0
- package/dist/src/embeddings/types.d.ts.map +1 -1
- package/dist/src/embeddings/types.js +11 -0
- package/dist/src/embeddings/types.js.map +1 -1
- package/dist/src/events/pending.d.ts +1 -1
- package/dist/src/events/pending.js +1 -1
- package/dist/src/git/GitRunner.d.ts +110 -30
- package/dist/src/git/GitRunner.d.ts.map +1 -1
- package/dist/src/git/GitRunner.js +511 -199
- package/dist/src/git/GitRunner.js.map +1 -1
- package/dist/src/git/GitWatchRegistry.d.ts +41 -35
- package/dist/src/git/GitWatchRegistry.d.ts.map +1 -1
- package/dist/src/git/GitWatchRegistry.js +61 -79
- package/dist/src/git/GitWatchRegistry.js.map +1 -1
- package/dist/src/git/gitPlace.d.ts +61 -0
- package/dist/src/git/gitPlace.d.ts.map +1 -0
- package/dist/src/git/gitPlace.js +74 -0
- package/dist/src/git/gitPlace.js.map +1 -0
- package/dist/src/git/sourceGitControl.d.ts +33 -21
- package/dist/src/git/sourceGitControl.d.ts.map +1 -1
- package/dist/src/git/sourceGitControl.js +211 -95
- package/dist/src/git/sourceGitControl.js.map +1 -1
- package/dist/src/git/sourceGitStatus.js +1 -1
- package/dist/src/git/sourceGitStatus.js.map +1 -1
- package/dist/src/git/untrackedStats.js +1 -1
- package/dist/src/git/untrackedStats.js.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/lifecycle.d.ts +9 -12
- package/dist/src/lifecycle.d.ts.map +1 -1
- package/dist/src/lifecycle.js +2 -1
- package/dist/src/lifecycle.js.map +1 -1
- package/dist/src/routes/approve.d.ts +1 -1
- package/dist/src/routes/approve.js +1 -1
- package/dist/src/routes/events.d.ts +1 -1
- package/dist/src/routes/events.js +1 -1
- package/dist/src/routes/git.d.ts +7 -7
- package/dist/src/routes/git.d.ts.map +1 -1
- package/dist/src/routes/git.js +201 -72
- package/dist/src/routes/git.js.map +1 -1
- package/dist/src/routes/health.d.ts +6 -6
- package/dist/src/routes/health.js +12 -12
- package/dist/src/routes/helpers/sourceNotConfigured.d.ts +1 -1
- package/dist/src/routes/helpers/sourceNotConfigured.js +1 -1
- package/dist/src/routes/helpers/uriGuard.d.ts +1 -1
- package/dist/src/routes/helpers/uriGuard.d.ts.map +1 -1
- package/dist/src/routes/helpers/uriGuard.js +3 -2
- package/dist/src/routes/helpers/uriGuard.js.map +1 -1
- package/dist/src/routes/helpers.d.ts +11 -4
- package/dist/src/routes/helpers.d.ts.map +1 -1
- package/dist/src/routes/helpers.js +13 -6
- package/dist/src/routes/helpers.js.map +1 -1
- package/dist/src/routes/list.d.ts +1 -1
- package/dist/src/routes/list.d.ts.map +1 -1
- package/dist/src/routes/list.js +3 -4
- package/dist/src/routes/list.js.map +1 -1
- package/dist/src/routes/pending.d.ts +4 -4
- package/dist/src/routes/pending.js +9 -9
- package/dist/src/routes/policies.d.ts +10 -8
- package/dist/src/routes/policies.d.ts.map +1 -1
- package/dist/src/routes/policies.js +31 -25
- package/dist/src/routes/policies.js.map +1 -1
- package/dist/src/routes/raw.d.ts +1 -1
- package/dist/src/routes/raw.d.ts.map +1 -1
- package/dist/src/routes/raw.js +66 -12
- package/dist/src/routes/raw.js.map +1 -1
- package/dist/src/routes/read.d.ts +1 -1
- package/dist/src/routes/read.js +1 -1
- package/dist/src/routes/search.d.ts +1 -1
- package/dist/src/routes/search.js +1 -1
- package/dist/src/routes/sources.d.ts +63 -6
- package/dist/src/routes/sources.d.ts.map +1 -1
- package/dist/src/routes/sources.js +494 -382
- package/dist/src/routes/sources.js.map +1 -1
- package/dist/src/routes/upload.d.ts +1 -1
- package/dist/src/routes/upload.js +1 -1
- package/dist/src/routes/write.d.ts +2 -2
- package/dist/src/routes/write.js +2 -2
- package/dist/src/services/BridgeService.d.ts +21 -35
- package/dist/src/services/BridgeService.d.ts.map +1 -1
- package/dist/src/services/BridgeService.js +42 -88
- package/dist/src/services/BridgeService.js.map +1 -1
- package/dist/src/services/FilesystemService.d.ts +4 -3
- package/dist/src/services/FilesystemService.d.ts.map +1 -1
- package/dist/src/services/FilesystemService.js +112 -34
- package/dist/src/services/FilesystemService.js.map +1 -1
- package/dist/src/services/FilesystemUiService.d.ts +4 -1
- package/dist/src/services/FilesystemUiService.d.ts.map +1 -1
- package/dist/src/services/FilesystemUiService.js +66 -25
- package/dist/src/services/FilesystemUiService.js.map +1 -1
- package/dist/src/services/SyncScheduler.d.ts +12 -4
- package/dist/src/services/SyncScheduler.d.ts.map +1 -1
- package/dist/src/services/SyncScheduler.js +37 -8
- package/dist/src/services/SyncScheduler.js.map +1 -1
- package/dist/src/services/baselineRepair.d.ts +13 -3
- package/dist/src/services/baselineRepair.d.ts.map +1 -1
- package/dist/src/services/baselineRepair.js +13 -3
- package/dist/src/services/baselineRepair.js.map +1 -1
- package/dist/src/services/declaredSources.d.ts +132 -43
- package/dist/src/services/declaredSources.d.ts.map +1 -1
- package/dist/src/services/declaredSources.js +118 -45
- package/dist/src/services/declaredSources.js.map +1 -1
- package/dist/src/store/dataFormats.d.ts +17 -2
- package/dist/src/store/dataFormats.d.ts.map +1 -1
- package/dist/src/store/dataFormats.js +18 -3
- package/dist/src/store/dataFormats.js.map +1 -1
- package/dist/src/sync/DeltaSyncRunner.d.ts.map +1 -1
- package/dist/src/sync/DeltaSyncRunner.js +144 -4
- package/dist/src/sync/DeltaSyncRunner.js.map +1 -1
- package/dist/src/sync/SyncJobQueue.d.ts +7 -2
- package/dist/src/sync/SyncJobQueue.d.ts.map +1 -1
- package/dist/src/sync/SyncJobQueue.js +16 -10
- package/dist/src/sync/SyncJobQueue.js.map +1 -1
- package/dist/src/sync/SyncWatchService.d.ts +21 -4
- package/dist/src/sync/SyncWatchService.d.ts.map +1 -1
- package/dist/src/sync/SyncWatchService.js +115 -10
- package/dist/src/sync/SyncWatchService.js.map +1 -1
- package/dist/src/sync/categoryInference.d.ts +1 -1
- package/dist/src/sync/categoryInference.js +1 -1
- package/dist/src/tools/execCtx.d.ts +2 -2
- package/dist/src/tools/execCtx.js +2 -2
- package/dist/src/tools/fs_read.d.ts.map +1 -1
- package/dist/src/tools/fs_read.js +5 -0
- package/dist/src/tools/fs_read.js.map +1 -1
- package/dist/src/usecases/admitSourceRoot.d.ts +65 -0
- package/dist/src/usecases/admitSourceRoot.d.ts.map +1 -0
- package/dist/src/usecases/admitSourceRoot.js +85 -0
- package/dist/src/usecases/admitSourceRoot.js.map +1 -0
- package/dist/src/usecases/browseSourceFolders.d.ts +85 -0
- package/dist/src/usecases/browseSourceFolders.d.ts.map +1 -0
- package/dist/src/usecases/browseSourceFolders.js +210 -0
- package/dist/src/usecases/browseSourceFolders.js.map +1 -0
- package/dist/src/usecases/createDeclaredSources.d.ts +13 -2
- package/dist/src/usecases/createDeclaredSources.d.ts.map +1 -1
- package/dist/src/usecases/createDeclaredSources.js +39 -0
- package/dist/src/usecases/createDeclaredSources.js.map +1 -1
- package/dist/src/usecases/embeddingBacklog.js +1 -1
- package/dist/src/usecases/embeddingBacklog.js.map +1 -1
- package/dist/src/usecases/list.d.ts.map +1 -1
- package/dist/src/usecases/list.js +83 -26
- package/dist/src/usecases/list.js.map +1 -1
- package/dist/src/usecases/listAttachableDevices.d.ts +13 -0
- package/dist/src/usecases/listAttachableDevices.d.ts.map +1 -0
- package/dist/src/usecases/listAttachableDevices.js +10 -0
- package/dist/src/usecases/listAttachableDevices.js.map +1 -0
- package/dist/src/usecases/listSourcePackages.d.ts.map +1 -1
- package/dist/src/usecases/listSourcePackages.js +2 -5
- package/dist/src/usecases/listSourcePackages.js.map +1 -1
- package/dist/src/usecases/purgeExcludedPoints.d.ts.map +1 -1
- package/dist/src/usecases/purgeExcludedPoints.js +3 -2
- package/dist/src/usecases/purgeExcludedPoints.js.map +1 -1
- package/dist/src/usecases/readFiles.d.ts.map +1 -1
- package/dist/src/usecases/readFiles.js +99 -1
- package/dist/src/usecases/readFiles.js.map +1 -1
- package/dist/src/usecases/reconcileSourcePackageRoots.d.ts +1 -1
- package/dist/src/usecases/reconcileSourcePackageRoots.d.ts.map +1 -1
- package/dist/src/usecases/reconcileSourcePackageRoots.js +2 -1
- package/dist/src/usecases/reconcileSourcePackageRoots.js.map +1 -1
- package/dist/src/usecases/revokePrincipal.d.ts +7 -5
- package/dist/src/usecases/revokePrincipal.d.ts.map +1 -1
- package/dist/src/usecases/revokePrincipal.js +29 -7
- package/dist/src/usecases/revokePrincipal.js.map +1 -1
- package/dist/src/usecases/scheduleSourceSync.d.ts +7 -0
- package/dist/src/usecases/scheduleSourceSync.d.ts.map +1 -1
- package/dist/src/usecases/scheduleSourceSync.js +6 -5
- package/dist/src/usecases/scheduleSourceSync.js.map +1 -1
- package/dist/src/usecases/syncPointWrites.d.ts +2 -0
- package/dist/src/usecases/syncPointWrites.d.ts.map +1 -1
- package/dist/src/usecases/syncPointWrites.js +5 -1
- package/dist/src/usecases/syncPointWrites.js.map +1 -1
- package/dist/src/usecases/triggerSourceSync.d.ts +46 -0
- package/dist/src/usecases/triggerSourceSync.d.ts.map +1 -0
- package/dist/src/usecases/triggerSourceSync.js +75 -0
- package/dist/src/usecases/triggerSourceSync.js.map +1 -0
- package/dist/src/usecases/uploadBinary.d.ts +2 -1
- package/dist/src/usecases/uploadBinary.d.ts.map +1 -1
- package/dist/src/usecases/uploadBinary.js +2 -2
- package/dist/src/usecases/uploadBinary.js.map +1 -1
- package/dist/src/usecases/vector/endpointGuard.d.ts +1 -1
- package/dist/src/usecases/vector/endpointGuard.js +1 -1
- package/dist/src/usecases/vectorMaintenance.js +1 -1
- package/dist/src/usecases/vectorMaintenance.js.map +1 -1
- package/dist/src/usecases/write/content.js +1 -1
- package/dist/src/vector/qdrantClient.d.ts +1 -1
- package/dist/src/vector/qdrantClient.js +1 -1
- package/dist/src/wiring.d.ts +3 -0
- package/dist/src/wiring.d.ts.map +1 -1
- package/dist/src/wiring.js +72 -6
- package/dist/src/wiring.js.map +1 -1
- package/dist/tools/fs_list.json +1 -1
- package/dist/tools/fs_read.json +1 -1
- package/dist/tools/fs_search.json +1 -1
- package/dist/tools/fs_write.json +1 -1
- package/instructions/brain-model.md +1 -1
- package/package.json +212 -114
- package/rules/brain-rules.md +2 -2
- package/skills/brain-start/SKILL.md +1 -1
- package/skills/connect-business-data/SKILL.md +3 -3
- package/skills/create-package/SKILL.md +26 -26
- package/skills/create-package/references/config-and-credentials.md +16 -13
- package/skills/create-package/references/connectors-and-uri-policies.md +39 -25
- package/skills/create-package/references/manifest-and-discovery.md +12 -12
- package/skills/create-package/references/runtime-and-build.md +19 -19
- package/skills/create-package/references/skills-and-context.md +36 -20
- package/skills/create-package/references/surfaces-and-design.md +16 -16
- package/skills/create-package/references/team-and-workflows.md +2 -2
- package/skills/create-package/references/test-and-ship.md +21 -21
- package/skills/create-package/references/tools-and-schemas.md +5 -5
- package/skills/create-package/scripts/{check-package.sh → check-package.mjs} +79 -65
- package/skills/create-package/scripts/{verify-loaded.sh → verify-loaded.mjs} +156 -162
- package/skills/git/SKILL.md +53 -51
- package/skills/manage-files/SKILL.md +22 -25
- package/skills/manage-sources/SKILL.md +128 -87
- package/skills/manage-uri-policy/SKILL.md +18 -15
- package/skills/organize/SKILL.md +1 -1
- package/skills/sync/SKILL.md +3 -3
- package/tools/fs_list.json +1 -1
- package/tools/fs_read.json +1 -1
- package/tools/fs_search.json +1 -1
- package/tools/fs_write.json +1 -1
- package/workflows/sources-digest.json +1 -1
- package/dist/src/connectors/LocalDiskConnector.d.ts +0 -171
- package/dist/src/connectors/LocalDiskConnector.d.ts.map +0 -1
- package/dist/src/connectors/LocalDiskConnector.js +0 -1233
- package/dist/src/connectors/LocalDiskConnector.js.map +0 -1
- package/docs/drive-overview.md +0 -59
- package/skills/manage-files/scripts/copy.sh +0 -7
- package/skills/manage-files/scripts/create.sh +0 -7
- package/skills/manage-files/scripts/mkdir.sh +0 -7
- package/skills/manage-files/scripts/modify.sh +0 -7
- package/skills/manage-files/scripts/upload.sh +0 -16
- package/skills/manage-files/scripts/write.sh +0 -29
- package/skills/manage-sources/scripts/reembed.sh +0 -23
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type RuntimeStackInfo } from '@neuralis/package-system/paths';
|
|
2
|
+
import { type HierarchicalPermissions, type SourceConfig, type SourceEnabledState, type SyncConfig } from '../sourceConfig.js';
|
|
3
|
+
/** Where a canonical path sits relative to what a native `local` source may root at. */
|
|
4
|
+
export type NativeLocalPlacement =
|
|
5
|
+
/** IS or UNDER the caller's project zone — attachable with `sources.mount`. */
|
|
6
|
+
'project'
|
|
7
|
+
/** IS or UNDER a privileged row (a filesystem root exactly) — attachable with `sources.privileged`. */
|
|
8
|
+
| 'privileged'
|
|
9
|
+
/** A strict ANCESTOR of the project zone — browsable on the way down, never attachable. */
|
|
10
|
+
| 'ancestor' | 'outside';
|
|
11
|
+
/** The stable refusal every fenced consumer answers with. */
|
|
12
|
+
export declare const NATIVE_LOCAL_REFUSAL: {
|
|
13
|
+
readonly code: 'native_local_root_outside_project';
|
|
14
|
+
readonly error: "On a native install a folder outside this project's own zone is reached through your own paired device: pair this computer (`neuralis device pair`), allow the folder, and add it as a folder on that device.";
|
|
15
|
+
};
|
|
16
|
+
/** An EDIT of an existing outside-rooted source: it may only narrow (`fencedEditWidens`). */
|
|
17
|
+
export declare const NATIVE_LOCAL_EDIT_REFUSAL: {
|
|
18
|
+
readonly code: "native_local_root_outside_project";
|
|
19
|
+
readonly error: "This source is rooted outside this project's own zone, which a native install reaches only through your own paired device: it can still be disabled, narrowed, described or deleted, never widened.";
|
|
20
|
+
};
|
|
21
|
+
/** The fence applies unless the stack says, explicitly, that this is Docker. */
|
|
22
|
+
export declare function nativeLocalFenceApplies(stack: Pick<RuntimeStackInfo, 'isDocker'> | null | undefined): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Classify a canonical absolute path. `projectRoot` empty ⇒ no project zone
|
|
25
|
+
* (nothing is `project` or `ancestor`); `privilegedRoots` are the privileged
|
|
26
|
+
* table's zone paths.
|
|
27
|
+
*/
|
|
28
|
+
export declare function nativeLocalPlacement(path: string, projectRoot: string, privilegedRoots: readonly string[]): NativeLocalPlacement;
|
|
29
|
+
/** Attachable as a native `local` root (the privileged rows still need their feature). */
|
|
30
|
+
export declare function attachableNatively(placement: NativeLocalPlacement): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Does the fence refuse an in-process folder rooted at `resolvedRoot` (already
|
|
33
|
+
* resolved the way the connector resolves it)? Judged on the lexical path and
|
|
34
|
+
* again on the REAL path when it exists — a symlink inside the project zone that
|
|
35
|
+
* points elsewhere is refused like its target. Any other plane (a device folder,
|
|
36
|
+
* a connector kind), or a Docker stack, is not the fence's to judge (`false`).
|
|
37
|
+
*/
|
|
38
|
+
export declare function nativeLocalRootRefused(input: {
|
|
39
|
+
stack: Pick<RuntimeStackInfo, 'isDocker'> | null | undefined;
|
|
40
|
+
connection: {
|
|
41
|
+
kind: string;
|
|
42
|
+
config?: unknown;
|
|
43
|
+
};
|
|
44
|
+
resolvedRoot: string;
|
|
45
|
+
projectRoot: string;
|
|
46
|
+
privilegedRoots: readonly string[];
|
|
47
|
+
}): Promise<boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* Would this edit of a fenced in-process folder keep or create reach WIDER than
|
|
50
|
+
* it has? Reach = who may read/write/exec under the root (`permissions`), whether
|
|
51
|
+
* the source is live (`enabled`), whether it loads code (a `packageFolders`
|
|
52
|
+
* entry it did not carry)
|
|
53
|
+
* and which of its files the indexer reads (sync created, an exclude dropped, a
|
|
54
|
+
* wider include). Cadence, scan cap, media lanes and the description are not
|
|
55
|
+
* reach. `byRole` resolves by role PRIORITY, so its key set is reach too: a key
|
|
56
|
+
* may only be added denying all three bits, never removed.
|
|
57
|
+
*/
|
|
58
|
+
export declare function fencedEditWidens(existing: Pick<SourceConfig, 'permissions' | 'enabled' | 'sync' | 'packageFolders'>, patch: {
|
|
59
|
+
permissions?: HierarchicalPermissions;
|
|
60
|
+
enabled?: SourceEnabledState;
|
|
61
|
+
sync?: Pick<SyncConfig, 'exclude' | 'include'>;
|
|
62
|
+
clearSync?: boolean;
|
|
63
|
+
packageFolders?: readonly string[];
|
|
64
|
+
}): boolean;
|
|
65
|
+
//# sourceMappingURL=nativeLocalFence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeLocalFence.d.ts","sourceRoot":"","sources":["../../../../src/domain/access/nativeLocalFence.ts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AAE,CAAC;CACpC,GAAG,OAAO,CAAC,OAAO,CAAC,CAWnB;AA8CD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,aAAa,GAAG,SAAS,GAAG,MAAM,GAAG,gBAAgB,CAAC,EACnF,KAAK,EAAE;IACL,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,IAAI,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC;IAC/C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC,GACA,OAAO,CAoBT"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The native folder fence — where an IN-PROCESS folder (the `host` kind with
|
|
3
|
+
* no `device`, the kernel's `sourcePlane` = `local`) may be rooted when the
|
|
4
|
+
* platform runs WITHOUT a container (`stack.isDocker === false`).
|
|
5
|
+
*
|
|
6
|
+
* In Docker the container is the boundary: an in-process root names only what
|
|
7
|
+
* the operator mounted. On a native host there is none, so an in-process root is
|
|
8
|
+
* the host OS user's whole reach — a manager (`sources.mount` is a manager
|
|
9
|
+
* default) could otherwise attach `~/.ssh`. On a native host such a root is
|
|
10
|
+
* accepted only inside the caller's own project zone (`<home>/projects/<projectId>`),
|
|
11
|
+
* or IS / is UNDER one of the privileged rows (the App Zone, the Neuralis tree,
|
|
12
|
+
* the whole host — `/` or a drive root — exactly) — which still cost
|
|
13
|
+
* `sources.privileged` through the privileged-root table. Every other folder is
|
|
14
|
+
* a folder on the user's own paired device (the same kind, `device` set).
|
|
15
|
+
*
|
|
16
|
+
* The signal is the kernel's ONE `stack.isDocker`, and it fails CLOSED: only an
|
|
17
|
+
* explicit `true` opens the Docker arm. Scope: the folder kind's in-process
|
|
18
|
+
* transport only — the privileged-root gate's other root-bearing kinds are not
|
|
19
|
+
* covered here, and a device folder is the device owner's ceiling's to bound.
|
|
20
|
+
*/
|
|
21
|
+
import { realpath } from 'node:fs/promises';
|
|
22
|
+
import { resolve } from 'node:path';
|
|
23
|
+
import { hostPathFlavour, isFilesystemRoot, isPathInside } from '@neuralis/package-system/paths';
|
|
24
|
+
import { sourcePlane } from '@neuralis/package-system/contracts';
|
|
25
|
+
import { resolveEnabledState } from '../sourceConfig.js';
|
|
26
|
+
/** The stable refusal every fenced consumer answers with. */
|
|
27
|
+
export const NATIVE_LOCAL_REFUSAL = {
|
|
28
|
+
code: 'native_local_root_outside_project',
|
|
29
|
+
error: "On a native install a folder outside this project's own zone is reached through your own paired device: pair this computer (`neuralis device pair`), allow the folder, and add it as a folder on that device.",
|
|
30
|
+
};
|
|
31
|
+
/** An EDIT of an existing outside-rooted source: it may only narrow (`fencedEditWidens`). */
|
|
32
|
+
export const NATIVE_LOCAL_EDIT_REFUSAL = {
|
|
33
|
+
code: NATIVE_LOCAL_REFUSAL.code,
|
|
34
|
+
error: "This source is rooted outside this project's own zone, which a native install reaches only through your own paired device: it can still be disabled, narrowed, described or deleted, never widened.",
|
|
35
|
+
};
|
|
36
|
+
/** The fence applies unless the stack says, explicitly, that this is Docker. */
|
|
37
|
+
export function nativeLocalFenceApplies(stack) {
|
|
38
|
+
return stack?.isDocker !== true;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Classify a canonical absolute path. `projectRoot` empty ⇒ no project zone
|
|
42
|
+
* (nothing is `project` or `ancestor`); `privilegedRoots` are the privileged
|
|
43
|
+
* table's zone paths.
|
|
44
|
+
*/
|
|
45
|
+
export function nativeLocalPlacement(path, projectRoot, privilegedRoots) {
|
|
46
|
+
if (projectRoot && isPathInside(projectRoot, path))
|
|
47
|
+
return 'project';
|
|
48
|
+
for (const root of privilegedRoots) {
|
|
49
|
+
// A filesystem root covers only itself — under it is everything, which is no zone.
|
|
50
|
+
if ((!isFilesystemRoot(root) || isFilesystemRoot(path)) && isPathInside(root, path, hostPathFlavour(root)))
|
|
51
|
+
return 'privileged';
|
|
52
|
+
}
|
|
53
|
+
if (projectRoot && isPathInside(path, projectRoot))
|
|
54
|
+
return 'ancestor';
|
|
55
|
+
return 'outside';
|
|
56
|
+
}
|
|
57
|
+
/** Attachable as a native `local` root (the privileged rows still need their feature). */
|
|
58
|
+
export function attachableNatively(placement) {
|
|
59
|
+
return placement === 'project' || placement === 'privileged';
|
|
60
|
+
}
|
|
61
|
+
async function realOrSelf(path) {
|
|
62
|
+
try {
|
|
63
|
+
return await realpath(path);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return path;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Does the fence refuse an in-process folder rooted at `resolvedRoot` (already
|
|
71
|
+
* resolved the way the connector resolves it)? Judged on the lexical path and
|
|
72
|
+
* again on the REAL path when it exists — a symlink inside the project zone that
|
|
73
|
+
* points elsewhere is refused like its target. Any other plane (a device folder,
|
|
74
|
+
* a connector kind), or a Docker stack, is not the fence's to judge (`false`).
|
|
75
|
+
*/
|
|
76
|
+
export async function nativeLocalRootRefused(input) {
|
|
77
|
+
const config = (input.connection.config ?? {});
|
|
78
|
+
if (sourcePlane(input.connection.kind, config) !== 'local' || !nativeLocalFenceApplies(input.stack))
|
|
79
|
+
return false;
|
|
80
|
+
const projectRoot = input.projectRoot ? resolve(input.projectRoot) : '';
|
|
81
|
+
const lexical = resolve(input.resolvedRoot);
|
|
82
|
+
if (!attachableNatively(nativeLocalPlacement(lexical, projectRoot, input.privilegedRoots)))
|
|
83
|
+
return true;
|
|
84
|
+
const real = await realOrSelf(lexical);
|
|
85
|
+
if (real === lexical)
|
|
86
|
+
return false;
|
|
87
|
+
const realProject = projectRoot ? await realOrSelf(projectRoot) : '';
|
|
88
|
+
const realPrivileged = await Promise.all(input.privilegedRoots.map((root) => (isFilesystemRoot(root) ? root : realOrSelf(root))));
|
|
89
|
+
return !attachableNatively(nativeLocalPlacement(real, realProject, realPrivileged));
|
|
90
|
+
}
|
|
91
|
+
const CAPS = ['read', 'write', 'exec'];
|
|
92
|
+
/** A bit narrows when it never gains reach: unchanged, true→false, true→unset, unset→false. */
|
|
93
|
+
const bitsNarrow = (old, next) => CAPS.every((c) => old[c] === next[c] || old[c] === true || next[c] === false);
|
|
94
|
+
const grantsNothing = (b) => CAPS.every((c) => b[c] !== true);
|
|
95
|
+
const deniesNothing = (b) => CAPS.every((c) => b[c] !== false);
|
|
96
|
+
const deniesAll = (b) => CAPS.every((c) => b[c] === false);
|
|
97
|
+
function entriesNarrow(old = {}, next = {}, added, removed) {
|
|
98
|
+
const has = Object.hasOwn;
|
|
99
|
+
return [...new Set([...Object.keys(old), ...Object.keys(next)])].every((k) => (has(old, k) && has(next, k) ? bitsNarrow(old[k], next[k])
|
|
100
|
+
: has(next, k) ? added(next[k]) : removed(old[k])));
|
|
101
|
+
}
|
|
102
|
+
const sameList = (a, b) => (a ?? []).join('\0') === (b ?? []).join('\0');
|
|
103
|
+
const sameRule = (a, b) => a.pattern === b.pattern && a.override === b.override
|
|
104
|
+
&& a.floor === b.floor && a.priority === b.priority && sameList(a.roles, b.roles) && sameList(a.agents, b.agents) && sameList(a.users, b.users);
|
|
105
|
+
/**
|
|
106
|
+
* Path rows apply IN ORDER (an `override` row overwrites what came before), so
|
|
107
|
+
* the new list must derive from the old one through steps that each narrow: a
|
|
108
|
+
* row kept with the same pattern and conditions and narrowed bits, a removed row
|
|
109
|
+
* that denied nothing, an inserted row that grants nothing. Conservative — an
|
|
110
|
+
* alignment the walk misses is refused, never admitted.
|
|
111
|
+
*/
|
|
112
|
+
function pathsNarrow(old = [], next = []) {
|
|
113
|
+
let i = 0;
|
|
114
|
+
let j = 0;
|
|
115
|
+
while (i < old.length || j < next.length) {
|
|
116
|
+
if (i < old.length && j < next.length && sameRule(old[i], next[j]) && bitsNarrow(old[i].permissions, next[j].permissions)) {
|
|
117
|
+
i++;
|
|
118
|
+
j++;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
if (j < next.length && !next[j].floor && grantsNothing(next[j].permissions)) {
|
|
122
|
+
j++;
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (i < old.length && !old[i].floor && deniesNothing(old[i].permissions)) {
|
|
126
|
+
i++;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
const ENABLED_RANK = { false: 0, auto: 1, true: 2 };
|
|
134
|
+
/**
|
|
135
|
+
* Would this edit of a fenced in-process folder keep or create reach WIDER than
|
|
136
|
+
* it has? Reach = who may read/write/exec under the root (`permissions`), whether
|
|
137
|
+
* the source is live (`enabled`), whether it loads code (a `packageFolders`
|
|
138
|
+
* entry it did not carry)
|
|
139
|
+
* and which of its files the indexer reads (sync created, an exclude dropped, a
|
|
140
|
+
* wider include). Cadence, scan cap, media lanes and the description are not
|
|
141
|
+
* reach. `byRole` resolves by role PRIORITY, so its key set is reach too: a key
|
|
142
|
+
* may only be added denying all three bits, never removed.
|
|
143
|
+
*/
|
|
144
|
+
export function fencedEditWidens(existing, patch) {
|
|
145
|
+
if (patch.enabled !== undefined && ENABLED_RANK[`${patch.enabled}`] > ENABLED_RANK[`${resolveEnabledState(existing)}`])
|
|
146
|
+
return true;
|
|
147
|
+
if (patch.packageFolders && !patch.packageFolders.every((folder) => (existing.packageFolders ?? []).includes(folder)))
|
|
148
|
+
return true;
|
|
149
|
+
const sync = patch.clearSync ? undefined : patch.sync;
|
|
150
|
+
if (sync) {
|
|
151
|
+
const old = existing.sync;
|
|
152
|
+
if (!old)
|
|
153
|
+
return true;
|
|
154
|
+
if (!old.exclude.every((p) => sync.exclude.includes(p)))
|
|
155
|
+
return true;
|
|
156
|
+
const oldIn = old.include ?? [];
|
|
157
|
+
const nextIn = sync.include ?? [];
|
|
158
|
+
if (oldIn.length > 0 && (nextIn.length === 0 || !nextIn.every((p) => oldIn.includes(p))))
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
const o = existing.permissions;
|
|
162
|
+
const n = patch.permissions;
|
|
163
|
+
if (!n)
|
|
164
|
+
return false;
|
|
165
|
+
return !(bitsNarrow(o.default, n.default)
|
|
166
|
+
&& entriesNarrow(o.byRole, n.byRole, deniesAll, () => false)
|
|
167
|
+
&& entriesNarrow(o.byUser, n.byUser, grantsNothing, deniesNothing)
|
|
168
|
+
&& entriesNarrow(o.byAgent, n.byAgent, grantsNothing, deniesNothing)
|
|
169
|
+
&& pathsNarrow(o.paths, n.paths));
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=nativeLocalFence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeLocalFence.js","sourceRoot":"","sources":["../../../../src/domain/access/nativeLocalFence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,YAAY,EAAyB,MAAM,gCAAgC,CAAC;AACxH,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAkH,MAAM,oBAAoB,CAAC;AAYzK,6DAA6D;AAC7D,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,mCAAmC;IACzC,KAAK,EAAE,+MAA+M;CAC9M,CAAC;AAEX,6FAA6F;AAC7F,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE,oBAAoB,CAAC,IAAI;IAC/B,KAAK,EAAE,qMAAqM;CACpM,CAAC;AAEX,gFAAgF;AAChF,MAAM,UAAU,uBAAuB,CAAC,KAA4D;IAClG,OAAO,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC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|
|
|
3
3
|
import { deriveSourceKind } from '../source.js';
|
|
4
4
|
import { sourceFromUri } from '../uri.js';
|
|
5
5
|
import { resolveCallerPermissions } from './callerPermissions.js';
|
|
6
|
-
import { SourceNotConfiguredError, SourcePermissionDeniedError } from '../sourceConfig.js';
|
|
6
|
+
import { SourceNotConfiguredError, SourcePermissionDeniedError, sourceScopeOrigin } from '../sourceConfig.js';
|
|
7
7
|
import { assertSourceEnabled } from './sourceEnabled.js';
|
|
8
8
|
/**
|
|
9
9
|
* The THROWING per-uri gate every write (and every single-result read) passes.
|
|
@@ -65,11 +65,11 @@ export async function checkUriPermission(deps, ctx, uri, operation, configCache)
|
|
|
65
65
|
throw new SourceNotConfiguredError(source);
|
|
66
66
|
}
|
|
67
67
|
const scopeCtx = scopeAccessCtxFromExecution(ctx);
|
|
68
|
-
if (!canAccessScope(config.scope, scopeCtx, 'read')) {
|
|
68
|
+
if (!canAccessScope(config.scope, scopeCtx, 'read', sourceScopeOrigin(config.connection))) {
|
|
69
69
|
throw new SourceNotConfiguredError(source);
|
|
70
70
|
}
|
|
71
71
|
await assertSourceEnabled(deps, ctx.projectId, source, config);
|
|
72
|
-
if (operation !== 'read' && !canAccessScope(config.scope, scopeCtx, 'write')) {
|
|
72
|
+
if (operation !== 'read' && !canAccessScope(config.scope, scopeCtx, 'write', sourceScopeOrigin(config.connection))) {
|
|
73
73
|
throw new SourcePermissionDeniedError(source, operation);
|
|
74
74
|
}
|
|
75
75
|
const resolved = await resolveCallerPermissions(config, uri, ctx, source);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uriPermission.js","sourceRoot":"","sources":["../../../../src/domain/access/uriPermission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,aAAa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ACP,CAAC;QACF,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC;IACD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,IAAI,gBAAgB,CAAC,MAAM,CAAC,KAAK,OAAO;YAAE,OAAO;QACjD,MAAM,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IACD,MAAM,QAAQ,GAAG,2BAA2B,CAAC,GAAG,CAAC,CAAC;IAClD,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QAC1F,MAAM,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IACD,MAAM,mBAAmB,CAAC,IAAI,EAAE,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/D,IAAI,SAAS,KAAK,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QACnH,MAAM,IAAI,2BAA2B,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC3D,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,wBAAwB,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;IAC1E,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,2BAA2B,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One `bytes=` range against a body of `size` bytes: `[start, end]` inclusive,
|
|
3
|
+
* `'unsatisfiable'` (416), or `null` when the header is absent, malformed or
|
|
4
|
+
* names several ranges — those get the whole body (RFC 9110 §14.2 lets a
|
|
5
|
+
* server ignore a Range it does not support).
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseByteRange(header: string | null | undefined, size: number): [number, number] | 'unsatisfiable' | null;
|
|
8
|
+
/**
|
|
9
|
+
* The most bytes ONE ranged answer carries (8 MiB). A range wider than this —
|
|
10
|
+
* a player's open-ended `bytes=0-` — is answered with its first 8 MiB and a
|
|
11
|
+
* `Content-Range` saying so; the client asks for the rest. This is what keeps a
|
|
12
|
+
* 206 memory-bounded however large the file is.
|
|
13
|
+
*/
|
|
14
|
+
export declare const RAW_RANGE_MAX_BYTES: number;
|
|
15
|
+
//# sourceMappingURL=byteRange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"byteRange.d.ts","sourceRoot":"","sources":["../../../src/domain/byteRange.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,eAAe,GAAG,IAAI,CAYzH;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,QAAkB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One `bytes=` range against a body of `size` bytes: `[start, end]` inclusive,
|
|
3
|
+
* `'unsatisfiable'` (416), or `null` when the header is absent, malformed or
|
|
4
|
+
* names several ranges — those get the whole body (RFC 9110 §14.2 lets a
|
|
5
|
+
* server ignore a Range it does not support).
|
|
6
|
+
*/
|
|
7
|
+
export function parseByteRange(header, size) {
|
|
8
|
+
const match = /^bytes=(\d*)-(\d*)$/.exec(String(header ?? '').trim());
|
|
9
|
+
if (!match || (match[1] === '' && match[2] === ''))
|
|
10
|
+
return null;
|
|
11
|
+
if (match[1] === '') {
|
|
12
|
+
const suffix = Number(match[2]);
|
|
13
|
+
if (suffix === 0 || size === 0)
|
|
14
|
+
return 'unsatisfiable';
|
|
15
|
+
return [Math.max(0, size - suffix), size - 1];
|
|
16
|
+
}
|
|
17
|
+
const start = Number(match[1]);
|
|
18
|
+
if (start >= size)
|
|
19
|
+
return 'unsatisfiable';
|
|
20
|
+
const end = match[2] === '' ? size - 1 : Math.min(Number(match[2]), size - 1);
|
|
21
|
+
return end < start ? null : [start, end];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The most bytes ONE ranged answer carries (8 MiB). A range wider than this —
|
|
25
|
+
* a player's open-ended `bytes=0-` — is answered with its first 8 MiB and a
|
|
26
|
+
* `Content-Range` saying so; the client asks for the rest. This is what keeps a
|
|
27
|
+
* 206 memory-bounded however large the file is.
|
|
28
|
+
*/
|
|
29
|
+
export const RAW_RANGE_MAX_BYTES = 8 * 1024 * 1024;
|
|
30
|
+
//# sourceMappingURL=byteRange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"byteRange.js","sourceRoot":"","sources":["../../../src/domain/byteRange.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAiC,EAAE,IAAY;IAC5E,MAAM,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACtE,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QAAE,OAAO,IAAI,CAAC;IAChE,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAChC,IAAI,MAAM,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC;YAAE,OAAO,eAAe,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC;IAChD,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,eAAe,CAAC;IAC1C,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC;IAC9E,OAAO,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultPermissions.d.ts","sourceRoot":"","sources":["../../../src/domain/defaultPermissions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,
|
|
1
|
+
{"version":3,"file":"defaultPermissions.d.ts","sourceRoot":"","sources":["../../../src/domain/defaultPermissions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,UAqIxC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,EAAE,uBAGtC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,EAAE,uBAG1C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,uBAMvC,CAAC"}
|
|
@@ -118,6 +118,35 @@ export const DEFAULT_QDRANT_SYNC_EXCLUDES = [
|
|
|
118
118
|
'**/.config/chromium/**',
|
|
119
119
|
'**/.config/google-chrome/**',
|
|
120
120
|
'**/.mozilla/**',
|
|
121
|
+
// A Neuralis device's own credentials: the CLI sign-in (Linux, macOS,
|
|
122
|
+
// Windows) and the device folder — every host's link secret — and the
|
|
123
|
+
// Neuralis host's own data in the same home, for a source that covers it
|
|
124
|
+
// (a whole-host or drive-root source): keys, users and platform config,
|
|
125
|
+
// each project's conversations and notifications, the backups. Named
|
|
126
|
+
// folder by folder: a project's own files and a device's scratch live
|
|
127
|
+
// under `.neuralis` too, never exclude it whole.
|
|
128
|
+
'**/.config/neuralis/**',
|
|
129
|
+
'**/Library/Application Support/neuralis/**',
|
|
130
|
+
'**/AppData/Roaming/neuralis/**',
|
|
131
|
+
'**/.neuralis/device/**',
|
|
132
|
+
'**/.local/share/neuralis/device/**',
|
|
133
|
+
'**/.neuralis/app/**',
|
|
134
|
+
'**/.local/share/neuralis/app/**',
|
|
135
|
+
'**/.neuralis/projects/*/data/**',
|
|
136
|
+
'**/.local/share/neuralis/projects/*/data/**',
|
|
137
|
+
'**/.neuralis/projects/*/notifications/**',
|
|
138
|
+
'**/.local/share/neuralis/projects/*/notifications/**',
|
|
139
|
+
'**/.neuralis/checkpoints/**',
|
|
140
|
+
'**/.local/share/neuralis/checkpoints/**',
|
|
141
|
+
'**/.neuralis/qdrant-backups/**',
|
|
142
|
+
'**/.local/share/neuralis/qdrant-backups/**',
|
|
143
|
+
'**/.neuralis/build/**',
|
|
144
|
+
'**/.local/share/neuralis/build/**',
|
|
145
|
+
'**/.neuralis/qdrant-version.json',
|
|
146
|
+
'**/.local/share/neuralis/qdrant-version.json',
|
|
147
|
+
// The pending OAuth sign-in store under the App Zone: a PKCE code verifier,
|
|
148
|
+
// the OAuth state and the captured sink for each sign-in in flight.
|
|
149
|
+
'**/oauth-flows/**',
|
|
121
150
|
];
|
|
122
151
|
/**
|
|
123
152
|
* data — generic frame applied at source creation. Every per-package
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultPermissions.js","sourceRoot":"","sources":["../../../src/domain/defaultPermissions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,iBAAiB;IACjB,oBAAoB;IACpB,2EAA2E;IAC3E,0EAA0E;IAC1E,6DAA6D;IAC7D,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,mBAAmB;IACnB,SAAS;IACT,YAAY;IACZ,iBAAiB;IACjB,oBAAoB;IACpB,gBAAgB;IAChB,mBAAmB;IACnB,UAAU;IACV,aAAa;IACb,SAAS;IACT,YAAY;IACZ,UAAU;IACV,aAAa;IACb,QAAQ;IACR,WAAW;IACX,eAAe;IACf,kBAAkB;IAClB,QAAQ;IACR,WAAW;IACX,MAAM;IACN,SAAS;IACT,QAAQ;IACR,WAAW;IACX,OAAO;IACP,UAAU;IACV,OAAO;IACP,UAAU;IACV,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,eAAe;IACf,gBAAgB;IAChB,mBAAmB;IACnB,WAAW;IACX,cAAc;IACd,4EAA4E;IAC5E,4EAA4E;IAC5E,2EAA2E;IAC3E,0EAA0E;IAC1E,6EAA6E;IAC7E,4EAA4E;IAC5E,6DAA6D;IAC7D,SAAS;IACT,YAAY;IACZ,YAAY;IACZ,4EAA4E;IAC5E,0EAA0E;IAC1E,0BAA0B;IAC1B,4EAA4E;IAC5E,4EAA4E;IAC5E,2EAA2E;IAC3E,sEAAsE;IACtE,6DAA6D;IAC7D,wBAAwB;IACxB,2BAA2B;IAC3B,yEAAyE;IACzE,2EAA2E;IAC3E,4EAA4E;IAC5E,yEAAyE;IACzE,uEAAuE;IACvE,wEAAwE;IACxE,4EAA4E;IAC5E,uEAAuE;IACvE,yEAAyE;IACzE,kEAAkE;IAClE,0EAA0E;IAC1E,YAAY;IACZ,cAAc;IACd,yEAAyE;IACzE,kEAAkE;IAClE,0EAA0E;IAC1E,qEAAqE;IACrE,uEAAuE;IACvE,2EAA2E;IAC3E,4DAA4D;IAC5D,YAAY;IACZ,wBAAwB;IACxB,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,aAAa;IACb,eAAe;IACf,6BAA6B;IAC7B,sBAAsB;IACtB,kBAAkB;IAClB,sBAAsB;IACtB,WAAW;IACX,qBAAqB;IACrB,WAAW;IACX,YAAY;IACZ,6EAA6E;IAC7E,4BAA4B;IAC5B,wBAAwB;IACxB,6BAA6B;IAC7B,gBAAgB;
|
|
1
|
+
{"version":3,"file":"defaultPermissions.js","sourceRoot":"","sources":["../../../src/domain/defaultPermissions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,iBAAiB;IACjB,oBAAoB;IACpB,2EAA2E;IAC3E,0EAA0E;IAC1E,6DAA6D;IAC7D,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,mBAAmB;IACnB,SAAS;IACT,YAAY;IACZ,iBAAiB;IACjB,oBAAoB;IACpB,gBAAgB;IAChB,mBAAmB;IACnB,UAAU;IACV,aAAa;IACb,SAAS;IACT,YAAY;IACZ,UAAU;IACV,aAAa;IACb,QAAQ;IACR,WAAW;IACX,eAAe;IACf,kBAAkB;IAClB,QAAQ;IACR,WAAW;IACX,MAAM;IACN,SAAS;IACT,QAAQ;IACR,WAAW;IACX,OAAO;IACP,UAAU;IACV,OAAO;IACP,UAAU;IACV,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,eAAe;IACf,gBAAgB;IAChB,mBAAmB;IACnB,WAAW;IACX,cAAc;IACd,4EAA4E;IAC5E,4EAA4E;IAC5E,2EAA2E;IAC3E,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pB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAA4B;IAC/D,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE;IACjD,KAAK,EAAE,EAAE;CACV,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAA4B;IACnE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE;IACjD,KAAK,EAAE,EAAE;CACV,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAA4B;IAChE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE;IACjD,MAAM,EAAE;QACN,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;KACzB;IACD,KAAK,EAAE,EAAE;CACV,CAAC"}
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Two jobs live here, and they are deliberately different layers:
|
|
5
5
|
*
|
|
6
6
|
* 1. **Resolution** (`inferMimeTypeFromFilename`, `looksTextByMime`) — what a
|
|
7
|
-
* file's type honestly IS
|
|
8
|
-
*
|
|
7
|
+
* file's type honestly IS, so the serve path and the store path answer from
|
|
8
|
+
* the same table. The extension tables themselves are the kernel's
|
|
9
|
+
* (`@neuralis/package-system/web-common`), re-exported below.
|
|
9
10
|
* 2. **Response policy** (`classifyResponseMime`, `buildRawResponseHeaders`) —
|
|
10
11
|
* what the byte lane is allowed to tell a BROWSER to do with those bytes.
|
|
11
12
|
*
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
*
|
|
17
18
|
* ## The rule the policy encodes
|
|
18
19
|
*
|
|
19
|
-
* A member with `
|
|
20
|
+
* A member with `files.write` can put arbitrary bytes at a URI another member
|
|
20
21
|
* can read. If the byte lane then serves those bytes as a DOCUMENT on the app
|
|
21
22
|
* origin (`content-type: image/svg+xml` + `content-disposition: inline`), the
|
|
22
23
|
* document's script runs with the READER's session. That is a stored-XSS
|
|
@@ -67,7 +68,7 @@
|
|
|
67
68
|
* multipart part type), by the write engine's create lane (the caller's
|
|
68
69
|
* `fields.metadata`), and by its `fields` verb (a metadata PATCH — historically
|
|
69
70
|
* the least guarded of the three, because the deleted `modify` route excluded
|
|
70
|
-
* `set_fields` from the uri-policy check). All three are `
|
|
71
|
+
* `set_fields` from the uri-policy check). All three are `files.write`. `normalizeStoredMimeType` and
|
|
71
72
|
* `normalizeNodeMetadataMime` below close all three; each one left open keeps
|
|
72
73
|
* the classification input caller-controlled. The first round of this fix closed
|
|
73
74
|
* only ONE, the architect's review found the second, and the live run found the
|
|
@@ -79,17 +80,8 @@
|
|
|
79
80
|
* `FilesystemUiService` excludes the active-document class at that one site for
|
|
80
81
|
* exactly this reason — the body is JSON and the wire should say so.
|
|
81
82
|
*/
|
|
83
|
+
export { binaryMimeTypeForPath, inferMimeTypeFromFilename } from '@neuralis/package-system/web-common';
|
|
82
84
|
export declare function looksTextByMime(mimeType: string | undefined): boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Extension → mime, for files whose stored metadata carries no type.
|
|
85
|
-
*
|
|
86
|
-
* The five document extensions at the end are NOT decoration: they make the
|
|
87
|
-
* extension agree with `classifyResponseMime`'s active-document set, so an
|
|
88
|
-
* `.html` or `.xml` file reports what it is instead of `application/octet-stream`
|
|
89
|
-
* and is classified on its merits. Both land on `attachment` either way — this
|
|
90
|
-
* only removes a lie from the wire.
|
|
91
|
-
*/
|
|
92
|
-
export declare function inferMimeTypeFromFilename(filename: string): string;
|
|
93
85
|
/**
|
|
94
86
|
* Lowercase `type/subtype`, parameters dropped, syntactically validated.
|
|
95
87
|
* Returns `null` for anything absent, over-long or not token-shaped — the
|
|
@@ -141,9 +133,10 @@ export declare function buildRawResponseHeaders(input: RawResponseHeaderInput):
|
|
|
141
133
|
*
|
|
142
134
|
* **SCOPE, measured live — the magic-byte check governs the STORED value, and
|
|
143
135
|
* on a non-brain source it does NOT reach the wire.** `loadRawBytes` returns
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
136
|
+
* the connector's type for `sourceKind !== 'brain'` whenever the connector can
|
|
137
|
+
* tell (anything but `application/octet-stream`, the contract's "cannot
|
|
138
|
+
* tell"), so the local connector's own extension-derived type wins over the
|
|
139
|
+
* persisted metadata at serve time. HTML bytes stored as `application/octet-stream` under the name
|
|
147
140
|
* `x.png` are therefore SERVED `image/png`. That is bounded and not a hole: the
|
|
148
141
|
* classification still runs on the extension, so `.svg`/`.html`/`.xml` stay
|
|
149
142
|
* `attachment`, and a mislabelled raster is inert under the globally-present
|
|
@@ -159,7 +152,7 @@ export declare function normalizeStoredMimeType(declared: string | undefined, fi
|
|
|
159
152
|
*
|
|
160
153
|
* `metadata.mimeType` has THREE writers — the byte lane (the multipart part
|
|
161
154
|
* type), the write engine's create lane and its `fields` verb. All are
|
|
162
|
-
* `
|
|
155
|
+
* `files.write`, a MEMBER default on the seeded `data` source, and the field is
|
|
163
156
|
* the FIRST thing `loadRawBytes` reads — i.e. the input the byte lane's
|
|
164
157
|
* classifier rules on. Normalizing only one writer leaves that input
|
|
165
158
|
* caller-controlled, so all three go through here. The `fields` verb
|
|
@@ -171,5 +164,4 @@ export declare function normalizeStoredMimeType(declared: string | undefined, fi
|
|
|
171
164
|
* for every other reader of that request.
|
|
172
165
|
*/
|
|
173
166
|
export declare function normalizeNodeMetadataMime(metadata: unknown, filename: string): Record<string, unknown> | undefined;
|
|
174
|
-
export declare function binaryMimeTypeForPath(filePath: string): string | undefined;
|
|
175
167
|
//# sourceMappingURL=mime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mime.d.ts","sourceRoot":"","sources":["../../../src/domain/mime.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mime.d.ts","sour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