@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/routes/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/routes/list.ts"],"names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3C,OAAO;gBACL,MAAM,EAAE,GAAG;gBACX,IAAI,EAAE;oBACJ,EAAE,EAAE,IAAI;oBACR,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,QAAQ;oBAC5B,OAAO,EAAE,CAAC;4BACR,QAAQ,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK;4BAC1C,WAAW,EAAE,gBAAgB;4BAC7B,UAAU,EAAE,SAAS;yBACtB,CAAC;oBACF,OAAO,EAAE,EAAE;oBACX,KAAK,EAAE,EAAE;oBACT,SAAS,EAAE,CAAC;oBACZ,OAAO,EAAE;wBACP,IAAI,EAAE,KAAK,CAAC,IAAI;wBAChB,OAAO,EAAE,SAAS;qBACnB;iBACF;aACF,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,GAAG,GAAiB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,IAAI,GAAiB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* `pending` route (adaptive-growing-lynx) — the REAL project-wide list of
|
|
3
3
|
* revertible pending changes within the Files widget "Changes" tab.
|
|
4
4
|
*
|
|
5
|
-
* Gate: `
|
|
5
|
+
* Gate: `files.read` (every drive user — members who write/edit files need to
|
|
6
6
|
* see their own pending changes). The per-record visibility floor lives in
|
|
7
7
|
* `FilesystemService.listPendingChanges` (owner isolation + uri-policy `read`)
|
|
8
8
|
* because the raw journal read AND the vector scroll both bypass uri-policy.
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
* vector point) WITHOUT a connector, so it clears ORPHANED records that
|
|
41
41
|
* revert/approve choke on. Dismiss is the connector-free clear for a still-LIVE
|
|
42
42
|
* source (orphaned non-delete rows are redirected to discard). The route file
|
|
43
|
-
* stays `
|
|
44
|
-
* adds a `
|
|
43
|
+
* stays `files.read` so GET/list/scan remain member-visible; every MUTATING verb
|
|
44
|
+
* adds a `files.write` gate BEFORE any ctx/service/record lookup, then retains
|
|
45
45
|
* the per-record WRITE floor (synthesized owner-scope).
|
|
46
46
|
*/
|
|
47
47
|
import type { RouteHandler } from '@neuralis/package-system/contracts';
|
|
48
48
|
export declare const pattern = "pending";
|
|
49
|
-
export declare const feature = "
|
|
49
|
+
export declare const feature = "files.read";
|
|
50
50
|
export declare const escalations: string[];
|
|
51
51
|
export declare const GET: RouteHandler;
|
|
52
52
|
export declare const POST: RouteHandler;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* `pending` route (adaptive-growing-lynx) — the REAL project-wide list of
|
|
3
3
|
* revertible pending changes within the Files widget "Changes" tab.
|
|
4
4
|
*
|
|
5
|
-
* Gate: `
|
|
5
|
+
* Gate: `files.read` (every drive user — members who write/edit files need to
|
|
6
6
|
* see their own pending changes). The per-record visibility floor lives in
|
|
7
7
|
* `FilesystemService.listPendingChanges` (owner isolation + uri-policy `read`)
|
|
8
8
|
* because the raw journal read AND the vector scroll both bypass uri-policy.
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
* vector point) WITHOUT a connector, so it clears ORPHANED records that
|
|
41
41
|
* revert/approve choke on. Dismiss is the connector-free clear for a still-LIVE
|
|
42
42
|
* source (orphaned non-delete rows are redirected to discard). The route file
|
|
43
|
-
* stays `
|
|
44
|
-
* adds a `
|
|
43
|
+
* stays `files.read` so GET/list/scan remain member-visible; every MUTATING verb
|
|
44
|
+
* adds a `files.write` gate BEFORE any ctx/service/record lookup, then retains
|
|
45
45
|
* the per-record WRITE floor (synthesized owner-scope).
|
|
46
46
|
*/
|
|
47
47
|
import { hasFeature } from '@neuralis/package-system/access';
|
|
@@ -49,10 +49,10 @@ import { SourcePermissionDeniedError } from '../domain/sourceConfig.js';
|
|
|
49
49
|
import { extractCtx, ensureAccess, getServices, httpError } from './helpers.js';
|
|
50
50
|
import { parsePendingReviewIntent } from '../usecases/pendingReview.js';
|
|
51
51
|
export const pattern = 'pending';
|
|
52
|
-
export const feature = '
|
|
52
|
+
export const feature = 'files.read';
|
|
53
53
|
// Every mutating verb (revert / discard / dismiss / discard-orphans) escalates
|
|
54
54
|
// in-handler; the module gate keeps GET/list/scan member-visible.
|
|
55
|
-
export const escalations = ['
|
|
55
|
+
export const escalations = ['files.write'];
|
|
56
56
|
function parseFilter(body, query) {
|
|
57
57
|
const pick = (key) => {
|
|
58
58
|
const fromBody = body?.[key];
|
|
@@ -142,15 +142,15 @@ export const POST = async (req, raw) => {
|
|
|
142
142
|
|| action === 'discard'
|
|
143
143
|
|| action === 'dismiss'
|
|
144
144
|
|| action === 'discard-orphans';
|
|
145
|
-
// The route file stays `
|
|
145
|
+
// The route file stays `files.read` so GET/list/scan remain member-visible;
|
|
146
146
|
// every mutation adds the stronger gate BEFORE ctx/service/record lookup.
|
|
147
|
-
if (mutates && !hasFeature(req.session, '
|
|
147
|
+
if (mutates && !hasFeature(req.session, 'files.write')) {
|
|
148
148
|
return {
|
|
149
149
|
status: 403,
|
|
150
150
|
body: {
|
|
151
|
-
error: "Forbidden: missing feature '
|
|
151
|
+
error: "Forbidden: missing feature 'files.write'",
|
|
152
152
|
code: 'feature_denied',
|
|
153
|
-
feature: '
|
|
153
|
+
feature: 'files.write',
|
|
154
154
|
},
|
|
155
155
|
};
|
|
156
156
|
}
|
|
@@ -25,23 +25,25 @@
|
|
|
25
25
|
* payload.
|
|
26
26
|
*
|
|
27
27
|
* TWO ARMS, TWO GATES — and no role-name check on either. The module feature
|
|
28
|
-
* (`feature` below) is `
|
|
28
|
+
* (`feature` below) is `files.read`, which every built-in role holds down to
|
|
29
29
|
* `viewer`, so READING an effective policy is a member-tier operation. WRITING
|
|
30
|
-
* escalates in-handler to `
|
|
31
|
-
* caller without it with 403 `Missing feature:
|
|
30
|
+
* escalates in-handler to `sources.policy` (`escalations` below) and answers a
|
|
31
|
+
* caller without it with 403 `Missing feature: sources.policy (URI policy
|
|
32
32
|
* editing)`. That id has no grant below the `admin` tier (enumerated for
|
|
33
33
|
* `admin`, `'*'` for `owner`) and is grantable to any custom role, so a custom
|
|
34
34
|
* role holding it patches policies exactly like the built-in `admin` does.
|
|
35
35
|
*
|
|
36
36
|
* Both arms then clear the SCOPE axis, which is orthogonal to the feature axis:
|
|
37
|
-
* `getSourceConfig` already requires scope `read`, and POST
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
37
|
+
* `getSourceConfig` already requires scope `read`, and POST judges the edit
|
|
38
|
+
* through the SAME ladder as `PATCH /sources` (`sourceEditRefusal`): scope
|
|
39
|
+
* `write` (403 `Forbidden for source scope`), the immutable floors (409), a
|
|
40
|
+
* device folder is its owner's alone and a protected-zone root needs its
|
|
41
|
+
* feature (403, PATCH's text) — then the native `local` fence. Every rung
|
|
42
|
+
* decides on grants and the stored connection, never a role name.
|
|
41
43
|
*/
|
|
42
44
|
import type { RouteHandler } from '@neuralis/package-system/contracts';
|
|
43
45
|
export declare const pattern = "policies/*";
|
|
44
|
-
export declare const feature = "
|
|
46
|
+
export declare const feature = "files.read";
|
|
45
47
|
export declare const escalations: string[];
|
|
46
48
|
export declare const GET: RouteHandler;
|
|
47
49
|
export declare const POST: RouteHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../../../src/routes/policies.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../../../src/routes/policies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,oCAAoC,CAAC;AAa5C,eAAO,MAAM,OAAO,eAAe,CAAC;AACpC,eAAO,MAAM,OAAO,eAAe,CAAC;AAEpC,eAAO,MAAM,WAAW,UAAqB,CAAC;AAE9C,eAAO,MAAM,GAAG,EAAE,YAsBjB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,YAuFlB,CAAC"}
|
|
@@ -25,29 +25,32 @@
|
|
|
25
25
|
* payload.
|
|
26
26
|
*
|
|
27
27
|
* TWO ARMS, TWO GATES — and no role-name check on either. The module feature
|
|
28
|
-
* (`feature` below) is `
|
|
28
|
+
* (`feature` below) is `files.read`, which every built-in role holds down to
|
|
29
29
|
* `viewer`, so READING an effective policy is a member-tier operation. WRITING
|
|
30
|
-
* escalates in-handler to `
|
|
31
|
-
* caller without it with 403 `Missing feature:
|
|
30
|
+
* escalates in-handler to `sources.policy` (`escalations` below) and answers a
|
|
31
|
+
* caller without it with 403 `Missing feature: sources.policy (URI policy
|
|
32
32
|
* editing)`. That id has no grant below the `admin` tier (enumerated for
|
|
33
33
|
* `admin`, `'*'` for `owner`) and is grantable to any custom role, so a custom
|
|
34
34
|
* role holding it patches policies exactly like the built-in `admin` does.
|
|
35
35
|
*
|
|
36
36
|
* Both arms then clear the SCOPE axis, which is orthogonal to the feature axis:
|
|
37
|
-
* `getSourceConfig` already requires scope `read`, and POST
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
37
|
+
* `getSourceConfig` already requires scope `read`, and POST judges the edit
|
|
38
|
+
* through the SAME ladder as `PATCH /sources` (`sourceEditRefusal`): scope
|
|
39
|
+
* `write` (403 `Forbidden for source scope`), the immutable floors (409), a
|
|
40
|
+
* device folder is its owner's alone and a protected-zone root needs its
|
|
41
|
+
* feature (403, PATCH's text) — then the native `local` fence. Every rung
|
|
42
|
+
* decides on grants and the stored connection, never a role name.
|
|
41
43
|
*/
|
|
42
|
-
import { extractCtx, ensureAccess, getServices, httpError, toScopeAccessCtx } from './helpers.js';
|
|
44
|
+
import { extractCtx, ensureAccess, getServices, httpError, normalizePermissions, toScopeAccessCtx } from './helpers.js';
|
|
43
45
|
import { hasFeature } from '@neuralis/package-system/access';
|
|
44
|
-
import { canAccessScope } from '@neuralis/package-system/contracts';
|
|
45
46
|
import { containsPolicyFloorMarker, ImmutablePolicyFloorError, } from '@neuralis/package-system/policies';
|
|
46
47
|
import { normalizeSource } from '../domain/source.js';
|
|
48
|
+
import { NATIVE_LOCAL_EDIT_REFUSAL, fencedEditWidens } from '../domain/access/nativeLocalFence.js';
|
|
49
|
+
import { nativeFenceRefusal, sourceEditRefusal } from './sources.js';
|
|
47
50
|
export const pattern = 'policies/*';
|
|
48
|
-
export const feature = '
|
|
49
|
-
// C9 — POST escalates to `
|
|
50
|
-
export const escalations = ['
|
|
51
|
+
export const feature = 'files.read';
|
|
52
|
+
// C9 — POST escalates to `sources.policy` in-handler (read tier is files.read).
|
|
53
|
+
export const escalations = ['sources.policy'];
|
|
51
54
|
export const GET = async (req, raw) => {
|
|
52
55
|
const state = raw;
|
|
53
56
|
const [sub, sub2] = req.path;
|
|
@@ -75,11 +78,11 @@ export const POST = async (req, raw) => {
|
|
|
75
78
|
if (sub !== 'uri')
|
|
76
79
|
return { status: 404, body: { error: 'Unknown policies sub-resource' } };
|
|
77
80
|
const ctx = extractCtx(req);
|
|
78
|
-
// C8 — uri-policy editing escalates to the `
|
|
81
|
+
// C8 — uri-policy editing escalates to the `sources.policy` feature: no grant
|
|
79
82
|
// below the `admin` tier (enumerated for `admin`, `'*'` for `owner`),
|
|
80
83
|
// grantable to any custom role. Replaces the hardcoded role-name check.
|
|
81
|
-
if (!hasFeature({ grantedFeatures: ctx.grantedFeatures }, '
|
|
82
|
-
return { status: 403, body: { error: 'Missing feature:
|
|
84
|
+
if (!hasFeature({ grantedFeatures: ctx.grantedFeatures }, 'sources.policy')) {
|
|
85
|
+
return { status: 403, body: { error: 'Missing feature: sources.policy (URI policy editing)' } };
|
|
83
86
|
}
|
|
84
87
|
await ensureAccess(ctx, state);
|
|
85
88
|
const body = (req.body ?? {});
|
|
@@ -105,14 +108,6 @@ export const POST = async (req, raw) => {
|
|
|
105
108
|
const existing = await bridge.getSourceConfig(scope, source, toScopeAccessCtx(ctx));
|
|
106
109
|
if (!existing)
|
|
107
110
|
return { status: 404, body: { error: `Source "${source}" not found` } };
|
|
108
|
-
// Mirror the sibling mutations in `sources.ts` (PATCH/enabled/DELETE): editing
|
|
109
|
-
// a cross-user/cross-agent source's uri-policy paths[] is a WRITE on that
|
|
110
|
-
// scope, not just a read. `getSourceConfig` already requires scope `read`
|
|
111
|
-
// (observeScoped); without this an `observeScoped`-but-not-`modifyScoped`
|
|
112
|
-
// holder of `drive.policy` could rewrite a scoped source's paths[].
|
|
113
|
-
if (!canAccessScope(existing.scope, toScopeAccessCtx(ctx), 'write')) {
|
|
114
|
-
return { status: 403, body: { error: 'Forbidden for source scope' } };
|
|
115
|
-
}
|
|
116
111
|
const immutablePatterns = new Set((existing.permissions.paths ?? [])
|
|
117
112
|
.filter((rule) => rule.floor === true)
|
|
118
113
|
.map((rule) => rule.pattern));
|
|
@@ -130,10 +125,21 @@ export const POST = async (req, raw) => {
|
|
|
130
125
|
const nextPaths = (existing.permissions.paths ?? [])
|
|
131
126
|
.filter((p) => !remove.has(p.pattern))
|
|
132
127
|
.concat(addPaths);
|
|
133
|
-
const nextPermissions = {
|
|
128
|
+
const nextPermissions = normalizePermissions({
|
|
134
129
|
...existing.permissions,
|
|
135
130
|
paths: nextPaths,
|
|
136
|
-
};
|
|
131
|
+
}, { rolePriorities: ctx.rolePriorities, existing: existing.permissions });
|
|
132
|
+
// A path rule is a source edit: the PATCH ladder, rung for rung (a cross-scope
|
|
133
|
+
// write needs `files.writeOthers`; another user's device folder is refused).
|
|
134
|
+
const refused = await sourceEditRefusal(state, ctx, existing, nextPermissions);
|
|
135
|
+
if (refused)
|
|
136
|
+
return refused;
|
|
137
|
+
// The native `local` fence: a source rooted outside the project zone (it
|
|
138
|
+
// predates the fence) may be narrowed here, never widened — as PATCH /sources.
|
|
139
|
+
if (await nativeFenceRefusal(state, ctx.projectId, source, existing.connection)
|
|
140
|
+
&& fencedEditWidens(existing, { permissions: nextPermissions })) {
|
|
141
|
+
return { status: 403, body: NATIVE_LOCAL_EDIT_REFUSAL };
|
|
142
|
+
}
|
|
137
143
|
try {
|
|
138
144
|
const updated = await bridge.updateSourceConfig(scope, {
|
|
139
145
|
agentId: ctx.agentId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.js","sourceRoot":"","sources":["../../../src/routes/policies.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"policies.js","sourceRoot":"","sources":["../../../src/routes/policies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAQH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACxH,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EACL,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACnG,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC;AACpC,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC;AACpC,gFAAgF;AAChF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAE9C,MAAM,CAAC,MAAM,GAAG,GAAiB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IAClD,MAAM,KAAK,GAAG,GAAqB,CAAC;IACpC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC;IA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AC;IAC1D,CAAC;IAED,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE;YACrD,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,MAAM;YACN,WAAW,EAAE,eAAe;SAC7B,CAAC,CAAC;QACH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;IAC7F,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,yBAAyB,EAAE,CAAC;YAC7C,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;QACvE,CAAC;QACD,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjE,MAAM,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAChC,CAAC;AACH,CAAC,CAAC"}
|
package/dist/src/routes/raw.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RouteHandler } from '@neuralis/package-system/contracts';
|
|
2
2
|
export declare const pattern = "raw";
|
|
3
|
-
export declare const feature = "
|
|
3
|
+
export declare const feature = "files.read";
|
|
4
4
|
export declare const GET: RouteHandler;
|
|
5
5
|
//# sourceMappingURL=raw.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raw.d.ts","sourceRoot":"","sources":["../../../src/routes/raw.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"raw.d.ts","sourceRoot":"","sources":["../../../src/routes/raw.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAavE,eAAO,MAAM,OAAO,QAAQ,CAAC;AAC7B,eAAO,MAAM,OAAO,eAAe,CAAC;AAEpC,eAAO,MAAM,GAAG,EAAE,YA8EjB,CAAC"}
|
package/dist/src/routes/raw.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { extractCtx, ensureAccess, getServices } from './helpers.js';
|
|
2
2
|
import { assertUriCapability, uriPolicyDeniedResponse, UriPolicyDeniedError, } from './helpers/uriGuard.js';
|
|
3
3
|
import { buildRawResponseHeaders } from '../domain/mime.js';
|
|
4
|
+
import { parseByteRange } from '../domain/byteRange.js';
|
|
5
|
+
import { sourceFromUri } from '../domain/uri.js';
|
|
6
|
+
import { HostConnector } from '../connectors/HostConnector.js';
|
|
4
7
|
export const pattern = 'raw';
|
|
5
|
-
export const feature = '
|
|
8
|
+
export const feature = 'files.read';
|
|
6
9
|
export const GET = async (req, raw) => {
|
|
7
10
|
const state = raw;
|
|
8
11
|
const ctx = extractCtx(req);
|
|
@@ -23,17 +26,68 @@ export const GET = async (req, raw) => {
|
|
|
23
26
|
return uriPolicyDeniedResponse(error);
|
|
24
27
|
throw error;
|
|
25
28
|
}
|
|
26
|
-
const
|
|
29
|
+
const rangeHeader = req.rawRequest?.headers?.get?.('range') ?? null;
|
|
30
|
+
let result;
|
|
31
|
+
try {
|
|
32
|
+
result = rangeHeader ? await helpers.loadRawBytes(ctx, uri, { range: rangeHeader }) : await helpers.loadRawBytes(ctx, uri);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
// Over the byte budget the answer is this fixed refusal naming the cap —
|
|
36
|
+
// never the connector's message, which carries the uri.
|
|
37
|
+
const e = error;
|
|
38
|
+
if (e?.code === 'raw_read_too_large') {
|
|
39
|
+
return {
|
|
40
|
+
status: 413,
|
|
41
|
+
body: { error: 'raw_too_large', reason: e.planeLimit !== undefined ? 'source_file_ceiling' : 'bytes', limit: e.planeLimit ?? e.limit },
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
// A device folder that could not serve the read answers by name, never a
|
|
45
|
+
// 500: its plane down — the listing's own `live_reason`, from the same
|
|
46
|
+
// probe — or the device's refusal code. Never the broker's text.
|
|
47
|
+
const connector = uri.includes('://') ? infra?.connectors?.resolveBySource?.(sourceFromUri(uri)) : undefined;
|
|
48
|
+
const unavailable = connector instanceof HostConnector ? await connector.unavailable(error) : undefined;
|
|
49
|
+
if (unavailable && 'live' in unavailable) {
|
|
50
|
+
return { status: 503, body: { error: 'source_unavailable', reason: unavailable.reason, ...(unavailable.notReady ? { not_ready: unavailable.notReady } : {}) } };
|
|
51
|
+
}
|
|
52
|
+
if (unavailable)
|
|
53
|
+
return { status: 403, body: { error: 'device_refused', reason: unavailable.refused } };
|
|
54
|
+
// A readable path that is not there (the uri-policy gate already ran, so a
|
|
55
|
+
// denied path never reaches this answer).
|
|
56
|
+
if (error?.code === 'ENOENT')
|
|
57
|
+
return { status: 404, body: { error: 'not_found' } };
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
27
60
|
// The response headers are built by the ONE policy owner (`domain/mime.ts`),
|
|
28
|
-
// never assembled here
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
61
|
+
// never assembled here: an echoed type with `inline` made every
|
|
62
|
+
// member-writable path a stored-XSS primitive. A Range only cuts the body —
|
|
63
|
+
// the class (inline vs attachment) is the builder's, whatever the range.
|
|
64
|
+
const headers = { ...buildRawResponseHeaders(result), 'accept-ranges': 'bytes' };
|
|
65
|
+
const body = Buffer.from(result.bytes.buffer, result.bytes.byteOffset, result.bytes.byteLength);
|
|
66
|
+
// The connector already read ONLY the asked range (a folder source): the body
|
|
67
|
+
// is that slice of a `result.size`-byte file — nothing whole was buffered.
|
|
68
|
+
if (result.range === 'unsatisfiable') {
|
|
69
|
+
return { status: 416, body: Buffer.alloc(0), headers: { ...headers, 'content-length': '0', 'content-range': `bytes */${result.size}` } };
|
|
70
|
+
}
|
|
71
|
+
if (result.range) {
|
|
72
|
+
const [start, end] = result.range;
|
|
73
|
+
return {
|
|
74
|
+
status: 206,
|
|
75
|
+
body,
|
|
76
|
+
headers: { ...headers, 'content-length': String(end - start + 1), 'content-range': `bytes ${start}-${end}/${result.size}` },
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const range = parseByteRange(rangeHeader, body.length);
|
|
80
|
+
if (range === 'unsatisfiable') {
|
|
81
|
+
return { status: 416, body: Buffer.alloc(0), headers: { ...headers, 'content-length': '0', 'content-range': `bytes */${body.length}` } };
|
|
82
|
+
}
|
|
83
|
+
if (range) {
|
|
84
|
+
const [start, end] = range;
|
|
85
|
+
return {
|
|
86
|
+
status: 206,
|
|
87
|
+
body: body.subarray(start, end + 1),
|
|
88
|
+
headers: { ...headers, 'content-length': String(end - start + 1), 'content-range': `bytes ${start}-${end}/${body.length}` },
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return { status: 200, body, headers };
|
|
38
92
|
};
|
|
39
93
|
//# sourceMappingURL=raw.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raw.js","sourceRoot":"","sources":["../../../src/routes/raw.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"raw.js","sourceRoot":"","sources":["../../../src/routes/raw.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,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AM,EAAE,EAAE;SAC5H,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACxC,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RouteHandler } from '@neuralis/package-system/contracts';
|
|
2
2
|
export declare const pattern = "read";
|
|
3
|
-
export declare const feature = "
|
|
3
|
+
export declare const feature = "files.read";
|
|
4
4
|
export declare const POST: RouteHandler;
|
|
5
5
|
//# sourceMappingURL=read.d.ts.map
|
package/dist/src/routes/read.js
CHANGED
|
@@ -2,7 +2,7 @@ import { extractCtx, ensureAccess, getServices } from './helpers.js';
|
|
|
2
2
|
import { assertUriCapability, uriPolicyDeniedResponse, UriPolicyDeniedError, } from './helpers/uriGuard.js';
|
|
3
3
|
import { SourceDisabledError } from '../domain/sourceConfig.js';
|
|
4
4
|
export const pattern = 'read';
|
|
5
|
-
export const feature = '
|
|
5
|
+
export const feature = 'files.read';
|
|
6
6
|
/**
|
|
7
7
|
* Normalize ONE `files[]` entry to the internal reference shape, taking an
|
|
8
8
|
* EXPLICIT field allowlist off the object form (this route is not AJV-gated,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RouteHandler } from '@neuralis/package-system/contracts';
|
|
2
2
|
export declare const pattern = "search";
|
|
3
|
-
export declare const feature = "
|
|
3
|
+
export declare const feature = "files.search";
|
|
4
4
|
export declare const POST: RouteHandler;
|
|
5
5
|
//# sourceMappingURL=search.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { extractCtx, ensureAccess, getServices } from './helpers.js';
|
|
|
2
2
|
import { assertUriCapability, uriPolicyDeniedResponse, UriPolicyDeniedError, } from './helpers/uriGuard.js';
|
|
3
3
|
import { SourceDisabledError } from '../domain/sourceConfig.js';
|
|
4
4
|
export const pattern = 'search';
|
|
5
|
-
export const feature = '
|
|
5
|
+
export const feature = 'files.search';
|
|
6
6
|
/**
|
|
7
7
|
* SECONDARY search surface (skill-script `curl` to `/brain-core/search`). The
|
|
8
8
|
* PRIMARY model-facing path is the `fs_search` TOOL (`tools/fs_search.ts`),
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* GET /sources/:slug — get single source config
|
|
7
7
|
* GET /sources/kinds — list registered source kinds (+ trust, package attribution)
|
|
8
8
|
* GET /sources/kinds/:kind/schema — JSON Schema for admin source form
|
|
9
|
-
* GET /sources/discoverable — well-known unattached source roots (W3E;
|
|
9
|
+
* GET /sources/discoverable — well-known unattached source roots (W3E; sources.mount)
|
|
10
10
|
* POST /sources — create source
|
|
11
11
|
* POST /sources/preflight — validate/authorize create without writing
|
|
12
12
|
* PATCH /sources — update source
|
|
@@ -18,9 +18,13 @@
|
|
|
18
18
|
* POST /sources/reset — reset sync state (cancels active job)
|
|
19
19
|
* GET /sources/sync-status — job status (?source= single, else all visible)
|
|
20
20
|
* POST /sources/enabled — light enable/disable toggle (W3K)
|
|
21
|
-
* GET /sources/browse —
|
|
22
|
-
* protected zones + the
|
|
23
|
-
*
|
|
21
|
+
* GET /sources/browse — one level of folders: on this server
|
|
22
|
+
* (sources.mount; protected zones + the
|
|
23
|
+
* fs root need sources.privileged; in
|
|
24
|
+
* Docker under /mounts), or with
|
|
25
|
+
* ?device= on the caller's OWN device
|
|
26
|
+
* (device.own; empty path = the
|
|
27
|
+
* folders it allows this host)
|
|
24
28
|
* GET /sources/health — get sources health
|
|
25
29
|
*
|
|
26
30
|
* Sync-shaped POSTs return 202 + a SyncQueueJobSnapshot: the run executes on
|
|
@@ -29,8 +33,12 @@
|
|
|
29
33
|
*/
|
|
30
34
|
import type { RouteHandler } from '@neuralis/package-system/contracts';
|
|
31
35
|
import { type RuntimeStackInfo } from '@neuralis/package-system/paths';
|
|
36
|
+
import type { BrainCoreState } from '../lifecycle.js';
|
|
37
|
+
import type { SourceConfig } from '../domain/sourceConfig.js';
|
|
38
|
+
import type { SourceEditFence } from '../services/declaredSources.js';
|
|
39
|
+
import { NATIVE_LOCAL_REFUSAL } from '../domain/access/nativeLocalFence.js';
|
|
32
40
|
export declare const pattern = "sources/*";
|
|
33
|
-
export declare const feature = "
|
|
41
|
+
export declare const feature = "files.read";
|
|
34
42
|
export declare const escalations: string[];
|
|
35
43
|
export declare const GET: RouteHandler;
|
|
36
44
|
export declare const POST: RouteHandler;
|
|
@@ -57,7 +65,7 @@ type ProtectedRoot = {
|
|
|
57
65
|
/**
|
|
58
66
|
* Build the filter-free protected-root table from the runtime stack. App Zone,
|
|
59
67
|
* the Neuralis source tree, and the whole host (`/`) all require
|
|
60
|
-
* `
|
|
68
|
+
* `sources.privileged`. `/` is ALWAYS included (both Docker and native) so
|
|
61
69
|
* the ADD gate catches a raw `config.root:'/'` attach that has no discoverable
|
|
62
70
|
* suggestion under Docker.
|
|
63
71
|
*/
|
|
@@ -68,5 +76,54 @@ export declare function buildProtectedRoots(stack: RuntimeStackInfo | null | und
|
|
|
68
76
|
* Empty ⇒ unrestricted (the import-floor: undeclared = current behavior).
|
|
69
77
|
*/
|
|
70
78
|
export declare function requiredFeaturesForRoot(root: string, protectedRoots: ProtectedRoot[], kind: 'see' | 'add', mode?: RootMatchMode): string[];
|
|
79
|
+
/** agent-core's answer for a device-plane source's device: does the caller own it, and may they attach there? */
|
|
80
|
+
type DeviceAttachVerdict = {
|
|
81
|
+
allowed: boolean;
|
|
82
|
+
owner: boolean;
|
|
83
|
+
};
|
|
84
|
+
/** Who edits a source: the identity and grants the edit gates read. */
|
|
85
|
+
type SourceEditor = {
|
|
86
|
+
userId: string;
|
|
87
|
+
projectId: string;
|
|
88
|
+
agentId?: string;
|
|
89
|
+
grantedFeatures: readonly string[];
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* The edit gates of a source PATCH, in order — ONE ladder for every
|
|
93
|
+
* source-config writer (the route PATCH, `POST policies/uri`, a widening
|
|
94
|
+
* `POST sources/enabled`, and the cross-package writer `sourceEditFence`), so
|
|
95
|
+
* none can skip a rung:
|
|
96
|
+
* the source's scope (another member's user/agent source needs
|
|
97
|
+
* `files.writeOthers`), the immutable `floor:true` rows (409 when dropped or
|
|
98
|
+
* altered), and what attaching it needs (`missingAttachFeature`: a device folder
|
|
99
|
+
* is its owner's alone, a protected-zone root needs `sources.privileged`).
|
|
100
|
+
* The refusal the caller answers, or null.
|
|
101
|
+
*/
|
|
102
|
+
export declare function sourceEditRefusal(state: BrainCoreState, editor: SourceEditor, existing: SourceConfig, nextPermissions: unknown, ownDevice?: DeviceAttachVerdict): Promise<{
|
|
103
|
+
status: 400 | 403 | 409;
|
|
104
|
+
body: {
|
|
105
|
+
error: string;
|
|
106
|
+
code?: string;
|
|
107
|
+
};
|
|
108
|
+
} | null>;
|
|
109
|
+
/**
|
|
110
|
+
* The native folder fence for an attach or an edit (`domain/access/nativeLocalFence.ts`):
|
|
111
|
+
* the 403 a fenced root answers, or null. Judged on the root as the connector
|
|
112
|
+
* resolves it; a device folder or another kind ⇒ never this gate's.
|
|
113
|
+
*/
|
|
114
|
+
export declare function nativeFenceRefusal(state: BrainCoreState, projectId: string, source: string, connection: {
|
|
115
|
+
kind: string;
|
|
116
|
+
config?: unknown;
|
|
117
|
+
}): Promise<{
|
|
118
|
+
status: 403;
|
|
119
|
+
body: typeof NATIVE_LOCAL_REFUSAL;
|
|
120
|
+
} | null>;
|
|
121
|
+
/**
|
|
122
|
+
* The route PATCH's edit gates on the cross-package write (`upsertSourceConfig`):
|
|
123
|
+
* the SAME `sourceEditRefusal` ladder (scope, immutable floors, device owner,
|
|
124
|
+
* protected zone) with the route's codes and texts, then the native fence, which
|
|
125
|
+
* refuses only an edit that widens a fenced source; an unjudgeable shape is refused.
|
|
126
|
+
*/
|
|
127
|
+
export declare function sourceEditFence(state: BrainCoreState): SourceEditFence;
|
|
71
128
|
export {};
|
|
72
129
|
//# sourceMappingURL=sources.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../../src/routes/sources.ts"],"names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