@neuralis/brain-core 0.1.0 → 0.2.1
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 +26 -35
- package/app/README.md +1 -1
- package/app/cards/DiffView.tsx +9 -7
- package/app/cards/README.md +1 -1
- package/app/cards/diffLine.tsx +2 -4
- package/app/filesystem/README.md +4 -4
- package/app/filesystem/api/README.md +3 -3
- package/app/filesystem/api/index.ts +137 -123
- package/app/filesystem/domain/types.ts +36 -5
- package/app/filesystem/hooks/README.md +5 -5
- package/app/filesystem/hooks/useDiscoverableSources.ts +4 -2
- package/app/filesystem/hooks/useFilesystemSSE.ts +31 -23
- package/app/filesystem/hooks/useGitChangesInventory.ts +4 -2
- package/app/filesystem/host/README.md +3 -2
- package/app/filesystem/host/installFilesystemHostComponents.tsx +22 -9
- package/app/filesystem/store/README.md +11 -7
- package/app/filesystem/store/filesystemStore.ts +454 -162
- package/app/filesystem/store/gitSlice.ts +6 -6
- package/app/filesystem/store/listSlice.ts +10 -6
- package/app/filesystem/store/searchSlice.ts +27 -4
- package/app/filesystem/ui/FileEditor.tsx +48 -35
- package/app/filesystem/ui/FileTree.tsx +10 -9
- package/app/filesystem/ui/FileTreeSearch.tsx +29 -2
- package/app/filesystem/ui/GitCommitChangesView.tsx +5 -3
- package/app/filesystem/ui/GitCommitGraph.tsx +6 -5
- package/app/filesystem/ui/GitControlPanel.tsx +14 -13
- package/app/filesystem/ui/GitDiffView.tsx +2 -1
- package/app/filesystem/ui/GitFileDiff.tsx +7 -6
- package/app/filesystem/ui/PendingChangesPanel.tsx +88 -28
- package/app/filesystem/ui/PendingReviewDialog.tsx +52 -24
- package/app/filesystem/ui/README.md +8 -7
- package/app/filesystem/ui/ReembedDialog.tsx +22 -9
- package/app/filesystem/ui/SourceDeleteConfirm.tsx +1 -1
- package/app/filesystem/ui/SourcesPanel.tsx +135 -42
- package/app/filesystem/ui/VectorHealthPanel.tsx +20 -4
- package/app/filesystem/ui/pendingChangesModel.ts +9 -5
- package/dist/app/chunks/{astro-LRAFGXNX.js → astro-B2J4AS2D.js} +1 -1
- package/dist/app/chunks/bash-KY6SAQTH.js +1 -0
- package/dist/app/chunks/c-OBOPYVZ7.js +1 -0
- package/dist/app/chunks/{chunk-5H7ZCOD3.js → chunk-2X3GNKJ3.js} +1 -1
- package/dist/app/chunks/{chunk-XIFGTNRM.js → chunk-JPJIVRFI.js} +1 -1
- package/dist/app/chunks/{chunk-RH3QY5LF.js → chunk-LEFIFWND.js} +1 -1
- package/dist/app/chunks/{chunk-G4RZ3UNX.js → chunk-N6RXX3PH.js} +1 -1
- package/dist/app/chunks/{chunk-QXXJ73P5.js → chunk-PZAW4HPB.js} +1 -1
- package/dist/app/chunks/{chunk-3QLE7Y4L.js → chunk-ZBYWWTO6.js} +1 -1
- package/dist/app/chunks/cpp-TVWVOTEQ.js +1 -0
- package/dist/app/chunks/css-MANZBYA4.js +1 -0
- package/dist/app/chunks/{elixir-M36XROA6.js → elixir-S725Z7EH.js} +1 -1
- package/dist/app/chunks/{elm-7BG6QAIK.js → elm-5WUUSTNB.js} +1 -1
- package/dist/app/chunks/graphql-UGOPR3WU.js +1 -0
- package/dist/app/chunks/html-F6FWTBSG.js +1 -0
- package/dist/app/chunks/java-ANIVV5H5.js +1 -0
- package/dist/app/chunks/javascript-IH374YWG.js +1 -0
- package/dist/app/chunks/json-WGGVVXSB.js +1 -0
- package/dist/app/chunks/jsx-OTXJQD32.js +1 -0
- package/dist/app/chunks/{latex-ZWK7SXB6.js → latex-QCZNITGN.js} +1 -1
- package/dist/app/chunks/lua-4CRZ64PU.js +1 -0
- package/dist/app/chunks/{nginx-2L6VRV3A.js → nginx-V4CYS7WR.js} +1 -1
- package/dist/app/chunks/{perl-PBUAXXK6.js → perl-BHTX7F5B.js} +1 -1
- package/dist/app/chunks/{php-QJX57PA6.js → php-AYGJ5WYZ.js} +1 -1
- package/dist/app/chunks/r-4YFCFA4B.js +1 -0
- package/dist/app/chunks/{ruby-RLOWMVPO.js → ruby-42NMJWAL.js} +1 -1
- package/dist/app/chunks/{scss-B5CAI3HR.js → scss-XD7VU2CU.js} +1 -1
- package/dist/app/chunks/sql-B55MH6JJ.js +1 -0
- package/dist/app/chunks/{svelte-GT3D4C44.js → svelte-WR3QPIJU.js} +1 -1
- package/dist/app/chunks/tsx-S73GAE2L.js +1 -0
- package/dist/app/chunks/typescript-NEWOAB5Z.js +1 -0
- package/dist/app/chunks/{vue-JOW62MHD.js → vue-CCDS4VZK.js} +1 -1
- package/dist/app/chunks/xml-UXKAGLDR.js +1 -0
- package/dist/app/chunks/yaml-UMWKDTK7.js +1 -0
- package/dist/app/host.js +46 -46
- package/dist/scripts/embeddingLockV3.d.ts +30 -0
- package/dist/scripts/embeddingLockV3.d.ts.map +1 -0
- package/dist/scripts/embeddingLockV3.js +100 -0
- package/dist/scripts/embeddingLockV3.js.map +1 -0
- package/dist/scripts/vectorProofV1.d.ts +90 -0
- package/dist/scripts/vectorProofV1.d.ts.map +1 -0
- package/dist/scripts/vectorProofV1.js +220 -0
- package/dist/scripts/vectorProofV1.js.map +1 -0
- package/dist/src/config/env.d.ts +21 -0
- package/dist/src/config/env.d.ts.map +1 -1
- package/dist/src/config/env.js +55 -0
- package/dist/src/config/env.js.map +1 -1
- package/dist/src/connectors/AppSourceConfigStore.d.ts +12 -2
- package/dist/src/connectors/AppSourceConfigStore.d.ts.map +1 -1
- package/dist/src/connectors/AppSourceConfigStore.js +48 -40
- package/dist/src/connectors/AppSourceConfigStore.js.map +1 -1
- package/dist/src/connectors/LocalDiskConnector.d.ts +11 -14
- package/dist/src/connectors/LocalDiskConnector.d.ts.map +1 -1
- package/dist/src/connectors/LocalDiskConnector.js +87 -107
- package/dist/src/connectors/LocalDiskConnector.js.map +1 -1
- package/dist/src/connectors/sourceConfigMutation.d.ts +11 -1
- package/dist/src/connectors/sourceConfigMutation.d.ts.map +1 -1
- package/dist/src/connectors/sourceConfigMutation.js +36 -3
- package/dist/src/connectors/sourceConfigMutation.js.map +1 -1
- package/dist/src/domain/chunker.js +8 -3
- package/dist/src/domain/chunker.js.map +1 -1
- package/dist/src/domain/healthTypes.d.ts +11 -0
- package/dist/src/domain/healthTypes.d.ts.map +1 -1
- package/dist/src/domain/mime.d.ts +1 -0
- package/dist/src/domain/mime.d.ts.map +1 -1
- package/dist/src/domain/mime.js +48 -0
- package/dist/src/domain/mime.js.map +1 -1
- package/dist/src/domain/pendingChange.d.ts +7 -0
- package/dist/src/domain/pendingChange.d.ts.map +1 -1
- package/dist/src/domain/pendingChange.js +11 -0
- package/dist/src/domain/pendingChange.js.map +1 -1
- package/dist/src/domain/sourceConfig.d.ts +7 -14
- package/dist/src/domain/sourceConfig.d.ts.map +1 -1
- package/dist/src/domain/sourceConfig.js +1 -13
- package/dist/src/domain/sourceConfig.js.map +1 -1
- package/dist/src/domain/sourcePackages.d.ts +11 -2
- package/dist/src/domain/sourcePackages.d.ts.map +1 -1
- package/dist/src/domain/syncTrigger.d.ts +2 -3
- package/dist/src/domain/syncTrigger.d.ts.map +1 -1
- package/dist/src/domain/syncTrigger.js +2 -3
- package/dist/src/domain/syncTrigger.js.map +1 -1
- package/dist/src/domain/syncTypes.d.ts +21 -4
- package/dist/src/domain/syncTypes.d.ts.map +1 -1
- package/dist/src/domain/syncTypes.js.map +1 -1
- package/dist/src/domain/text.d.ts +3 -0
- package/dist/src/domain/text.d.ts.map +1 -1
- package/dist/src/domain/text.js +5 -0
- package/dist/src/domain/text.js.map +1 -1
- package/dist/src/domain/types.d.ts +9 -0
- package/dist/src/domain/types.d.ts.map +1 -1
- package/dist/src/embeddings/clients/GeminiEmbedder.d.ts.map +1 -1
- package/dist/src/embeddings/clients/GeminiEmbedder.js +11 -5
- package/dist/src/embeddings/clients/GeminiEmbedder.js.map +1 -1
- package/dist/src/embeddings/clients/OllamaEmbedder.d.ts.map +1 -1
- package/dist/src/embeddings/clients/OllamaEmbedder.js +13 -6
- package/dist/src/embeddings/clients/OllamaEmbedder.js.map +1 -1
- package/dist/src/embeddings/clients/OpenAIEmbedder.d.ts.map +1 -1
- package/dist/src/embeddings/clients/OpenAIEmbedder.js +12 -9
- package/dist/src/embeddings/clients/OpenAIEmbedder.js.map +1 -1
- package/dist/src/embeddings/clients/QwenEmbedder.d.ts.map +1 -1
- package/dist/src/embeddings/clients/QwenEmbedder.js +12 -5
- package/dist/src/embeddings/clients/QwenEmbedder.js.map +1 -1
- package/dist/src/embeddings/clients/VoyageEmbedder.d.ts.map +1 -1
- package/dist/src/embeddings/clients/VoyageEmbedder.js +12 -5
- package/dist/src/embeddings/clients/VoyageEmbedder.js.map +1 -1
- package/dist/src/embeddings/factory.d.ts +2 -0
- package/dist/src/embeddings/factory.d.ts.map +1 -1
- package/dist/src/embeddings/factory.js +23 -3
- package/dist/src/embeddings/factory.js.map +1 -1
- package/dist/src/embeddings/lock.d.ts +22 -11
- package/dist/src/embeddings/lock.d.ts.map +1 -1
- package/dist/src/embeddings/lock.js +47 -29
- package/dist/src/embeddings/lock.js.map +1 -1
- package/dist/src/embeddings/retry.d.ts +5 -0
- package/dist/src/embeddings/retry.d.ts.map +1 -1
- package/dist/src/embeddings/retry.js +35 -0
- package/dist/src/embeddings/retry.js.map +1 -1
- package/dist/src/events/pending.d.ts +56 -0
- package/dist/src/events/pending.d.ts.map +1 -0
- package/dist/src/events/pending.js +108 -0
- package/dist/src/events/pending.js.map +1 -0
- package/dist/src/events/source.d.ts +60 -14
- package/dist/src/events/source.d.ts.map +1 -1
- package/dist/src/events/source.js +149 -31
- package/dist/src/events/source.js.map +1 -1
- package/dist/src/events/vector.d.ts +33 -0
- package/dist/src/events/vector.d.ts.map +1 -0
- package/dist/src/events/vector.js +57 -0
- package/dist/src/events/vector.js.map +1 -0
- package/dist/src/git/GitRunner.d.ts.map +1 -1
- package/dist/src/git/GitRunner.js +11 -8
- package/dist/src/git/GitRunner.js.map +1 -1
- package/dist/src/git/sourceGitControl.d.ts.map +1 -1
- package/dist/src/git/sourceGitControl.js +2 -1
- package/dist/src/git/sourceGitControl.js.map +1 -1
- package/dist/src/index.d.ts +5 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/lifecycle.d.ts +20 -4
- package/dist/src/lifecycle.d.ts.map +1 -1
- package/dist/src/lifecycle.js +5 -1
- package/dist/src/lifecycle.js.map +1 -1
- package/dist/src/routes/health.js +6 -1
- package/dist/src/routes/health.js.map +1 -1
- package/dist/src/routes/pending.d.ts.map +1 -1
- package/dist/src/routes/pending.js +2 -1
- package/dist/src/routes/pending.js.map +1 -1
- package/dist/src/routes/sources.d.ts.map +1 -1
- package/dist/src/routes/sources.js +60 -11
- package/dist/src/routes/sources.js.map +1 -1
- package/dist/src/services/BridgeService.d.ts +2 -2
- package/dist/src/services/BridgeService.d.ts.map +1 -1
- package/dist/src/services/BridgeService.js +11 -2
- package/dist/src/services/BridgeService.js.map +1 -1
- package/dist/src/services/FilesystemService.d.ts +3 -1
- package/dist/src/services/FilesystemService.d.ts.map +1 -1
- package/dist/src/services/FilesystemService.js +3 -1
- package/dist/src/services/FilesystemService.js.map +1 -1
- package/dist/src/services/FilesystemUiService.js +1 -1
- package/dist/src/services/FilesystemUiService.js.map +1 -1
- package/dist/src/services/SyncScheduler.d.ts.map +1 -1
- package/dist/src/services/SyncScheduler.js +0 -14
- package/dist/src/services/SyncScheduler.js.map +1 -1
- package/dist/src/services/VectorHealthService.d.ts.map +1 -1
- package/dist/src/services/VectorHealthService.js +2 -46
- package/dist/src/services/VectorHealthService.js.map +1 -1
- package/dist/src/services/baselineRepair.d.ts +2 -2
- package/dist/src/services/baselineRepair.js +2 -2
- package/dist/src/services/declaredSources.d.ts +8 -1
- package/dist/src/services/declaredSources.d.ts.map +1 -1
- package/dist/src/services/declaredSources.js +19 -19
- package/dist/src/services/declaredSources.js.map +1 -1
- package/dist/src/store/dataFormats.d.ts +14 -3
- package/dist/src/store/dataFormats.d.ts.map +1 -1
- package/dist/src/store/dataFormats.js +15 -5
- 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 +78 -243
- package/dist/src/sync/DeltaSyncRunner.js.map +1 -1
- package/dist/src/sync/SyncJobQueue.d.ts +33 -4
- package/dist/src/sync/SyncJobQueue.d.ts.map +1 -1
- package/dist/src/sync/SyncJobQueue.js +179 -19
- package/dist/src/sync/SyncJobQueue.js.map +1 -1
- package/dist/src/sync/moveDetector.d.ts +2 -1
- package/dist/src/sync/moveDetector.d.ts.map +1 -1
- package/dist/src/sync/moveDetector.js +2 -1
- package/dist/src/sync/moveDetector.js.map +1 -1
- package/dist/src/tools/fs_search.d.ts.map +1 -1
- package/dist/src/tools/fs_search.js +8 -0
- package/dist/src/tools/fs_search.js.map +1 -1
- package/dist/src/tools/fs_write.js +3 -1
- package/dist/src/tools/fs_write.js.map +1 -1
- package/dist/src/usecases/chunkUpsert.d.ts +4 -0
- package/dist/src/usecases/chunkUpsert.d.ts.map +1 -1
- package/dist/src/usecases/chunkUpsert.js +103 -60
- package/dist/src/usecases/chunkUpsert.js.map +1 -1
- package/dist/src/usecases/embeddingBacklog.d.ts +31 -0
- package/dist/src/usecases/embeddingBacklog.d.ts.map +1 -0
- package/dist/src/usecases/embeddingBacklog.js +244 -0
- package/dist/src/usecases/embeddingBacklog.js.map +1 -0
- package/dist/src/usecases/listSourcePackages.js +17 -1
- package/dist/src/usecases/listSourcePackages.js.map +1 -1
- package/dist/src/usecases/mediaLane.d.ts +11 -4
- package/dist/src/usecases/mediaLane.d.ts.map +1 -1
- package/dist/src/usecases/mediaLane.js +67 -30
- package/dist/src/usecases/mediaLane.js.map +1 -1
- package/dist/src/usecases/pendingReview.d.ts.map +1 -1
- package/dist/src/usecases/pendingReview.js +24 -7
- package/dist/src/usecases/pendingReview.js.map +1 -1
- package/dist/src/usecases/purgeExcludedPoints.d.ts +2 -0
- 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 +33 -6
- package/dist/src/usecases/readFiles.js.map +1 -1
- package/dist/src/usecases/reconcileSourcePackageRoots.d.ts +31 -0
- package/dist/src/usecases/reconcileSourcePackageRoots.d.ts.map +1 -0
- package/dist/src/usecases/reconcileSourcePackageRoots.js +114 -0
- package/dist/src/usecases/reconcileSourcePackageRoots.js.map +1 -0
- package/dist/src/usecases/searchFiles.d.ts.map +1 -1
- package/dist/src/usecases/searchFiles.js +62 -64
- package/dist/src/usecases/searchFiles.js.map +1 -1
- package/dist/src/usecases/syncIndexedFile.d.ts +42 -0
- package/dist/src/usecases/syncIndexedFile.d.ts.map +1 -0
- package/dist/src/usecases/syncIndexedFile.js +242 -0
- package/dist/src/usecases/syncIndexedFile.js.map +1 -0
- package/dist/src/usecases/syncPointWrites.d.ts +5 -0
- package/dist/src/usecases/syncPointWrites.d.ts.map +1 -1
- package/dist/src/usecases/syncPointWrites.js +32 -5
- package/dist/src/usecases/syncPointWrites.js.map +1 -1
- package/dist/src/usecases/uploadBinary.d.ts.map +1 -1
- package/dist/src/usecases/uploadBinary.js +36 -49
- package/dist/src/usecases/uploadBinary.js.map +1 -1
- package/dist/src/usecases/vector/endpointGuard.js +2 -1
- package/dist/src/usecases/vector/endpointGuard.js.map +1 -1
- package/dist/src/usecases/vector/estimate.d.ts +7 -4
- package/dist/src/usecases/vector/estimate.d.ts.map +1 -1
- package/dist/src/usecases/vector/estimate.js +8 -5
- package/dist/src/usecases/vector/estimate.js.map +1 -1
- package/dist/src/usecases/vector/rebuildGeneration.d.ts +29 -5
- package/dist/src/usecases/vector/rebuildGeneration.d.ts.map +1 -1
- package/dist/src/usecases/vector/rebuildGeneration.js +224 -82
- package/dist/src/usecases/vector/rebuildGeneration.js.map +1 -1
- package/dist/src/usecases/vectorMaintenance.d.ts +46 -4
- package/dist/src/usecases/vectorMaintenance.d.ts.map +1 -1
- package/dist/src/usecases/vectorMaintenance.js +190 -11
- package/dist/src/usecases/vectorMaintenance.js.map +1 -1
- package/dist/src/usecases/write/commit.d.ts +6 -8
- package/dist/src/usecases/write/commit.d.ts.map +1 -1
- package/dist/src/usecases/write/commit.js +96 -112
- package/dist/src/usecases/write/commit.js.map +1 -1
- package/dist/src/usecases/write/content.js +1 -2
- package/dist/src/usecases/write/content.js.map +1 -1
- package/dist/src/usecases/write/ports.d.ts +1 -0
- package/dist/src/usecases/write/ports.d.ts.map +1 -1
- package/dist/src/vector/FilesystemVectorIndex.d.ts +34 -3
- package/dist/src/vector/FilesystemVectorIndex.d.ts.map +1 -1
- package/dist/src/vector/FilesystemVectorIndex.js +254 -20
- package/dist/src/vector/FilesystemVectorIndex.js.map +1 -1
- package/dist/src/vector/InMemoryVectorIndex.d.ts +9 -2
- package/dist/src/vector/InMemoryVectorIndex.d.ts.map +1 -1
- package/dist/src/vector/InMemoryVectorIndex.js +25 -6
- package/dist/src/vector/InMemoryVectorIndex.js.map +1 -1
- package/dist/src/vector/QdrantVectorIndex.d.ts +35 -9
- package/dist/src/vector/QdrantVectorIndex.d.ts.map +1 -1
- package/dist/src/vector/QdrantVectorIndex.js +209 -90
- package/dist/src/vector/QdrantVectorIndex.js.map +1 -1
- package/dist/src/vector/qdrantFilter.d.ts +3 -1
- package/dist/src/vector/qdrantFilter.d.ts.map +1 -1
- package/dist/src/vector/qdrantFilter.js +2 -0
- package/dist/src/vector/qdrantFilter.js.map +1 -1
- package/dist/src/vector/types.d.ts +81 -0
- package/dist/src/vector/types.d.ts.map +1 -1
- package/dist/src/vector/types.js +2 -0
- package/dist/src/vector/types.js.map +1 -1
- package/dist/src/wiring.d.ts +6 -0
- package/dist/src/wiring.d.ts.map +1 -1
- package/dist/src/wiring.js +62 -3
- package/dist/src/wiring.js.map +1 -1
- package/dist/tools/fs_search.json +2 -2
- package/docs/drive-overview.md +2 -2
- package/instructions/brain-model.md +1 -1
- package/package.json +1000 -11
- package/rules/brain-rules.md +1 -1
- package/skills/connect-business-data/SKILL.md +6 -4
- package/skills/create-package/SKILL.md +14 -12
- package/skills/create-package/references/config-and-credentials.md +3 -3
- package/skills/create-package/references/connectors-and-uri-policies.md +5 -3
- package/skills/create-package/references/manifest-and-discovery.md +5 -4
- package/skills/create-package/references/runtime-and-build.md +9 -9
- package/skills/create-package/references/skills-and-context.md +3 -3
- package/skills/create-package/references/surfaces-and-design.md +9 -6
- package/skills/create-package/references/team-and-workflows.md +2 -2
- package/skills/create-package/references/test-and-ship.md +15 -15
- package/skills/create-package/references/tools-and-schemas.md +1 -1
- package/skills/create-package/scripts/check-package.sh +50 -4
- package/skills/create-package/scripts/verify-loaded.sh +16 -16
- package/skills/manage-files/SKILL.md +2 -2
- package/skills/manage-sources/SKILL.md +16 -15
- package/skills/manage-sources/scripts/reembed.sh +9 -3
- package/skills/sync/SKILL.md +4 -4
- package/tools/fs_search.json +2 -2
- package/app/filesystem/hooks/useContainerWidth.ts +0 -39
- package/dist/app/chunks/bash-M45GHPBQ.js +0 -1
- package/dist/app/chunks/c-X3REOAWD.js +0 -1
- package/dist/app/chunks/cpp-VOWI743W.js +0 -1
- package/dist/app/chunks/css-2ZVPHE25.js +0 -1
- package/dist/app/chunks/graphql-7V2NP54C.js +0 -1
- package/dist/app/chunks/html-UF3LFLNA.js +0 -1
- package/dist/app/chunks/java-PNTAU4L3.js +0 -1
- package/dist/app/chunks/javascript-4JJTQGEL.js +0 -1
- package/dist/app/chunks/json-VLQ6D3JH.js +0 -1
- package/dist/app/chunks/jsx-KQKSLAAH.js +0 -1
- package/dist/app/chunks/lua-UFPYUJ2O.js +0 -1
- package/dist/app/chunks/r-QEZB45SR.js +0 -1
- package/dist/app/chunks/sql-DTZHNUZP.js +0 -1
- package/dist/app/chunks/tsx-WPR2WRZD.js +0 -1
- package/dist/app/chunks/typescript-LWO362OA.js +0 -1
- package/dist/app/chunks/xml-A5H72RTS.js +0 -1
- package/dist/app/chunks/yaml-MXHSIJCI.js +0 -1
- package/dist/src/services/purgePendingNodes.d.ts +0 -32
- package/dist/src/services/purgePendingNodes.d.ts.map +0 -1
- package/dist/src/services/purgePendingNodes.js +0 -61
- package/dist/src/services/purgePendingNodes.js.map +0 -1
- /package/dist/app/chunks/{chunk-737Y24HS.js → chunk-3JASFUPF.js} +0 -0
- /package/dist/app/chunks/{chunk-DKD2L57N.js → chunk-6EYLOQ4F.js} +0 -0
- /package/dist/app/chunks/{chunk-KYH5EHHY.js → chunk-7YRZ5LOQ.js} +0 -0
- /package/dist/app/chunks/{chunk-6TC3DVWV.js → chunk-C7LU4RID.js} +0 -0
- /package/dist/app/chunks/{chunk-TY33BMKR.js → chunk-CD52YDZP.js} +0 -0
- /package/dist/app/chunks/{chunk-OLEIKJ3X.js → chunk-DCJKTCJ5.js} +0 -0
- /package/dist/app/chunks/{chunk-QLBZ4JR2.js → chunk-EXIU2KBV.js} +0 -0
- /package/dist/app/chunks/{chunk-SFUNBBEA.js → chunk-FDP4LO4P.js} +0 -0
- /package/dist/app/chunks/{chunk-BGRVFATT.js → chunk-HNETUS7U.js} +0 -0
- /package/dist/app/chunks/{chunk-4QNMHAIR.js → chunk-LBFZJEDR.js} +0 -0
- /package/dist/app/chunks/{chunk-TRRUHDPN.js → chunk-ULRXL5VM.js} +0 -0
- /package/dist/app/chunks/{chunk-S6B4WWIF.js → chunk-XJK47SMJ.js} +0 -0
- /package/dist/app/chunks/{chunk-DZ5C5FKI.js → chunk-YYAAIAU2.js} +0 -0
- /package/dist/app/chunks/{clojure-OC6KPSJO.js → clojure-4QCN4GHG.js} +0 -0
- /package/dist/app/chunks/{core-KGE7TQJ3.js → core-ZHTX3P2Q.js} +0 -0
- /package/dist/app/chunks/{csharp-E7VIFITL.js → csharp-HQWR4N52.js} +0 -0
- /package/dist/app/chunks/{dark-plus-BOSCZXE4.js → dark-plus-GYPKKZES.js} +0 -0
- /package/dist/app/chunks/{dart-6Y3X27SZ.js → dart-FO4TTVO2.js} +0 -0
- /package/dist/app/chunks/{diff-TR2NPA64.js → diff-SHANV4YC.js} +0 -0
- /package/dist/app/chunks/{dist-T32U2VVR.js → dist-WSDF34DM.js} +0 -0
- /package/dist/app/chunks/{docker-N33HOW54.js → docker-VX55HTDS.js} +0 -0
- /package/dist/app/chunks/{go-6DGG5UTP.js → go-5UCPEC6S.js} +0 -0
- /package/dist/app/chunks/{haskell-KK36PMMM.js → haskell-25PJ3OSG.js} +0 -0
- /package/dist/app/chunks/{ini-VHVQ5TPB.js → ini-BJIVD5MK.js} +0 -0
- /package/dist/app/chunks/{kotlin-44WS3JHE.js → kotlin-MNR6XOEQ.js} +0 -0
- /package/dist/app/chunks/{less-5WZ3KLAK.js → less-KA5JURX6.js} +0 -0
- /package/dist/app/chunks/{light-plus-HGGBC43G.js → light-plus-QXH2UUWZ.js} +0 -0
- /package/dist/app/chunks/{make-X7RXMVW7.js → make-LPD5KOCO.js} +0 -0
- /package/dist/app/chunks/{markdown-46IKUAIB.js → markdown-LMWF6MQR.js} +0 -0
- /package/dist/app/chunks/{mdx-DGLHDAO7.js → mdx-WPMNN5BS.js} +0 -0
- /package/dist/app/chunks/{nix-Q6FYQZLX.js → nix-QGWLUUMZ.js} +0 -0
- /package/dist/app/chunks/{powershell-L4KJJ6DK.js → powershell-7GSBBEFF.js} +0 -0
- /package/dist/app/chunks/{prisma-IKS4LVH2.js → prisma-FPMPQISO.js} +0 -0
- /package/dist/app/chunks/{proto-AYCDOTJO.js → proto-7KDX5Z2U.js} +0 -0
- /package/dist/app/chunks/{python-KXMCSAFQ.js → python-CFG4FTQW.js} +0 -0
- /package/dist/app/chunks/{rust-J3BC3P6V.js → rust-X7A37WU3.js} +0 -0
- /package/dist/app/chunks/{scala-AYIIHBJK.js → scala-OYHJSUG2.js} +0 -0
- /package/dist/app/chunks/{swift-QPHHCQD3.js → swift-PE7VNYW5.js} +0 -0
- /package/dist/app/chunks/{toml-UV7JK7K7.js → toml-ETQRDILP.js} +0 -0
|
@@ -1,24 +1,70 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `source` event subject — events about one SOURCE
|
|
3
|
-
* `source.sync.failed`.
|
|
2
|
+
* The `source` event subject — events about one SOURCE's sync lifecycle.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* SUBJECT = one FAMILY of jobs of one source: `v1:<mode>:<force>:<slug>`
|
|
5
|
+
* (`mode` ∈ full|targeted|embedding, `force` ∈ 0|1). A family is its own
|
|
6
|
+
* notification row, so a watcher-driven targeted success can never resolve a
|
|
7
|
+
* full sync's failure, and a forced re-embed is told apart from a plain sync.
|
|
8
|
+
* Embedding health has its own family, `v1:embedding:0:<slug>`. A slug has no
|
|
9
|
+
* `:`, so the form parses back unambiguously and stays under the kernel's
|
|
10
|
+
* 256-character coordinate cap (≤ 215 at a 200-character slug). Rows written
|
|
11
|
+
* before the families existed carry the BARE slug; they still parse (and stay
|
|
12
|
+
* visible), and only a deletion resolves them.
|
|
10
13
|
*
|
|
11
|
-
* `
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* `visible` asks the source-access question the `filesystem` channel's
|
|
15
|
+
* source-scoped branch asks (`BridgeService` → `canAccessScope`) AND the
|
|
16
|
+
* source ROOT's uri-policy READ (`canReadUri`), for the ONE source the
|
|
17
|
+
* subject names, re-asked on every event — so a revoked or read-denied source
|
|
18
|
+
* stops delivering at once. A session without a role, outside the event's
|
|
19
|
+
* project or without access is denied.
|
|
20
|
+
*
|
|
21
|
+
* `bridge` observes the ONE sync queue's terminal jobs and publishes SIGNALS:
|
|
22
|
+
* the slug, a fixed mode/failure code and the Files Sources-panel `nav` —
|
|
23
|
+
* never the job's error text (it carries host paths and per-path names and
|
|
24
|
+
* stays on the actor-only `sync:failed` bus event). Transitions come from the
|
|
25
|
+
* queue (`SyncJobFinished.transition`, read against the state its completion
|
|
26
|
+
* writer saw), never from a level, so a healthy source publishes no
|
|
27
|
+
* "recovered" on every run. Clear matrix (`notify.clears`, same subject): a
|
|
28
|
+
* family's recovery resolves that family's failure; a FORCED full recovery
|
|
29
|
+
* also resolves the plain full family (a superset pass); embedding recovery
|
|
30
|
+
* resolves embedding degradation. Addressed to the user the job ran for, or
|
|
31
|
+
* the source's creator when it ran under a system scope. A purge job publishes
|
|
32
|
+
* nothing; the DELETION does: `source.deleted` (default off, no row of its own)
|
|
33
|
+
* goes once per subject the source could hold rows under — the bare slug and
|
|
34
|
+
* every family — and `notify.clears` every other source type there, so no
|
|
35
|
+
* unread row outlives its source (a gone source fails `visible`, so the row
|
|
36
|
+
* would stay hidden yet counted). Its own `visible` is AUDIENCE-bound at
|
|
37
|
+
* delivery — the deleting actor and the source's creator, who knew the slug —
|
|
38
|
+
* never the access check a gone source can no longer answer; the list's
|
|
39
|
+
* re-judge of a delivered row (no audience on it) answers by project.
|
|
17
40
|
*/
|
|
18
|
-
import { type EventBridge, type EventVisibilityPredicate } from '@neuralis/package-system/contracts';
|
|
41
|
+
import { type EventBridge, type EventVisibilityPredicate, type NeuralisEventInput } from '@neuralis/package-system/contracts';
|
|
42
|
+
import type { SyncJobFinished } from '../sync/SyncJobQueue.js';
|
|
19
43
|
export declare const subject = "source";
|
|
20
44
|
/** The only failure class in v1 — a fixed code, never a message. */
|
|
21
45
|
export declare const SOURCE_SYNC_FAILURE_CLASS = "sync_failed";
|
|
46
|
+
export type SourceEventFamily = {
|
|
47
|
+
mode: 'full' | 'targeted' | 'embedding';
|
|
48
|
+
force: boolean;
|
|
49
|
+
};
|
|
50
|
+
/** `v1:<mode>:<force>:<slug>` — one notification row per family of one source. */
|
|
51
|
+
export declare function sourceSubjectId(slug: string, family: SourceEventFamily): string;
|
|
52
|
+
/** The slug (and family) a subject names — a historical bare slug included; `null` for a malformed one. */
|
|
53
|
+
export declare function parseSourceSubjectId(subjectId: string): {
|
|
54
|
+
slug: string;
|
|
55
|
+
family?: SourceEventFamily;
|
|
56
|
+
} | null;
|
|
57
|
+
/** Every family subject a source can hold rows under, the historical bare slug first. */
|
|
58
|
+
export declare function sourceSubjectsOf(slug: string): string[];
|
|
59
|
+
export type SourceDeletion = {
|
|
60
|
+
projectId: string;
|
|
61
|
+
slug: string;
|
|
62
|
+
actor: string;
|
|
63
|
+
creator?: string;
|
|
64
|
+
};
|
|
65
|
+
export type SourceDeletionPublish = (deletion: SourceDeletion) => void;
|
|
22
66
|
export declare const visible: EventVisibilityPredicate;
|
|
67
|
+
/** What one terminal job announces — family events, in publish order. */
|
|
68
|
+
export declare function sourceEventsFor(job: SyncJobFinished): Array<Omit<NeuralisEventInput, 'projectId' | 'audience'>>;
|
|
23
69
|
export declare const bridge: EventBridge;
|
|
24
70
|
//# sourceMappingURL=source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../src/events/source.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../src/events/source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACxB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,eAAO,MAAM,OAAO,WAAW,CAAC;AAEhC,oEAAoE;AACpE,eAAO,MAAM,yBAAyB,gBAAgB,CAAC;AAEvD,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAI5F,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAE/E;AAED,2GAA2G;AAC3G,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,iBAAiB,CAAA;CAAE,GAAG,IAAI,CAK3G;AAED,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAGvD;AAKD,MAAM,MAAM,cAAc,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAClG,MAAM,MAAM,qBAAqB,GAAG,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;AAEvE,eAAO,MAAM,OAAO,EAAE,wBA2BrB,CAAC;AAOF,yEAAyE;AACzE,wBAAgB,eAAe,CAAC,GAAG,EAAE,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,UAAU,CAAC,CAAC,CA6B/G;AAED,eAAO,MAAM,MAAM,EAAE,WAmDpB,CAAC"}
|
|
@@ -1,46 +1,154 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `source` event subject — events about one SOURCE
|
|
3
|
-
* `source.sync.failed`.
|
|
2
|
+
* The `source` event subject — events about one SOURCE's sync lifecycle.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* SUBJECT = one FAMILY of jobs of one source: `v1:<mode>:<force>:<slug>`
|
|
5
|
+
* (`mode` ∈ full|targeted|embedding, `force` ∈ 0|1). A family is its own
|
|
6
|
+
* notification row, so a watcher-driven targeted success can never resolve a
|
|
7
|
+
* full sync's failure, and a forced re-embed is told apart from a plain sync.
|
|
8
|
+
* Embedding health has its own family, `v1:embedding:0:<slug>`. A slug has no
|
|
9
|
+
* `:`, so the form parses back unambiguously and stays under the kernel's
|
|
10
|
+
* 256-character coordinate cap (≤ 215 at a 200-character slug). Rows written
|
|
11
|
+
* before the families existed carry the BARE slug; they still parse (and stay
|
|
12
|
+
* visible), and only a deletion resolves them.
|
|
10
13
|
*
|
|
11
|
-
* `
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* `visible` asks the source-access question the `filesystem` channel's
|
|
15
|
+
* source-scoped branch asks (`BridgeService` → `canAccessScope`) AND the
|
|
16
|
+
* source ROOT's uri-policy READ (`canReadUri`), for the ONE source the
|
|
17
|
+
* subject names, re-asked on every event — so a revoked or read-denied source
|
|
18
|
+
* stops delivering at once. A session without a role, outside the event's
|
|
19
|
+
* project or without access is denied.
|
|
20
|
+
*
|
|
21
|
+
* `bridge` observes the ONE sync queue's terminal jobs and publishes SIGNALS:
|
|
22
|
+
* the slug, a fixed mode/failure code and the Files Sources-panel `nav` —
|
|
23
|
+
* never the job's error text (it carries host paths and per-path names and
|
|
24
|
+
* stays on the actor-only `sync:failed` bus event). Transitions come from the
|
|
25
|
+
* queue (`SyncJobFinished.transition`, read against the state its completion
|
|
26
|
+
* writer saw), never from a level, so a healthy source publishes no
|
|
27
|
+
* "recovered" on every run. Clear matrix (`notify.clears`, same subject): a
|
|
28
|
+
* family's recovery resolves that family's failure; a FORCED full recovery
|
|
29
|
+
* also resolves the plain full family (a superset pass); embedding recovery
|
|
30
|
+
* resolves embedding degradation. Addressed to the user the job ran for, or
|
|
31
|
+
* the source's creator when it ran under a system scope. A purge job publishes
|
|
32
|
+
* nothing; the DELETION does: `source.deleted` (default off, no row of its own)
|
|
33
|
+
* goes once per subject the source could hold rows under — the bare slug and
|
|
34
|
+
* every family — and `notify.clears` every other source type there, so no
|
|
35
|
+
* unread row outlives its source (a gone source fails `visible`, so the row
|
|
36
|
+
* would stay hidden yet counted). Its own `visible` is AUDIENCE-bound at
|
|
37
|
+
* delivery — the deleting actor and the source's creator, who knew the slug —
|
|
38
|
+
* never the access check a gone source can no longer answer; the list's
|
|
39
|
+
* re-judge of a delivered row (no audience on it) answers by project.
|
|
17
40
|
*/
|
|
18
41
|
import { isSentinelId, } from '@neuralis/package-system/contracts';
|
|
19
42
|
import { getServices } from '../routes/helpers.js';
|
|
43
|
+
import { canReadUri } from '../domain/access/uriReadable.js';
|
|
20
44
|
export const subject = 'source';
|
|
21
45
|
/** The only failure class in v1 — a fixed code, never a message. */
|
|
22
46
|
export const SOURCE_SYNC_FAILURE_CLASS = 'sync_failed';
|
|
47
|
+
const FAMILY_MODES = new Set(['full', 'targeted', 'embedding']);
|
|
48
|
+
/** `v1:<mode>:<force>:<slug>` — one notification row per family of one source. */
|
|
49
|
+
export function sourceSubjectId(slug, family) {
|
|
50
|
+
return `v1:${family.mode}:${family.force ? 1 : 0}:${slug}`;
|
|
51
|
+
}
|
|
52
|
+
/** The slug (and family) a subject names — a historical bare slug included; `null` for a malformed one. */
|
|
53
|
+
export function parseSourceSubjectId(subjectId) {
|
|
54
|
+
if (!subjectId.startsWith('v1:'))
|
|
55
|
+
return subjectId && !subjectId.includes(':') ? { slug: subjectId } : null;
|
|
56
|
+
const [, mode, force, slug, ...rest] = subjectId.split(':');
|
|
57
|
+
if (rest.length > 0 || !slug || !FAMILY_MODES.has(mode) || (force !== '0' && force !== '1'))
|
|
58
|
+
return null;
|
|
59
|
+
return { slug, family: { mode: mode, force: force === '1' } };
|
|
60
|
+
}
|
|
61
|
+
/** Every family subject a source can hold rows under, the historical bare slug first. */
|
|
62
|
+
export function sourceSubjectsOf(slug) {
|
|
63
|
+
const families = ['full', 'targeted', 'embedding'].flatMap((mode) => [false, true].map((force) => ({ mode, force })));
|
|
64
|
+
return [slug, ...families.map((family) => sourceSubjectId(slug, family))];
|
|
65
|
+
}
|
|
66
|
+
/** The deletion event — it resolves every other source type, on every subject the source may have. */
|
|
67
|
+
const SOURCE_DELETED = 'source.deleted';
|
|
23
68
|
export const visible = async (event, session, state) => {
|
|
24
69
|
if (!session.role || !session.projectId || event.projectId !== session.projectId)
|
|
25
70
|
return false;
|
|
71
|
+
if (event.type.endsWith(`.${SOURCE_DELETED}`)) {
|
|
72
|
+
// Materialization carries the audience: only it learns the slug. A list re-judge carries none — the
|
|
73
|
+
// row exists only for an addressee, and the host already checked membership and `requires`.
|
|
74
|
+
return event.audience ? event.audience.userIds.includes(session.userId) : true;
|
|
75
|
+
}
|
|
76
|
+
const parsed = parseSourceSubjectId(event.subjectId);
|
|
77
|
+
if (!parsed)
|
|
78
|
+
return false;
|
|
26
79
|
const services = await getServices(state, session.projectId);
|
|
27
|
-
const config = await services.bridge.getSourceConfig({ userId: session.userId, projectId: session.projectId },
|
|
80
|
+
const config = await services.bridge.getSourceConfig({ userId: session.userId, projectId: session.projectId }, parsed.slug, {
|
|
28
81
|
agentId: session.agentId ?? '',
|
|
29
82
|
role: session.role,
|
|
30
83
|
grantedFeatures: session.grantedFeatures ?? [],
|
|
31
84
|
});
|
|
32
|
-
|
|
85
|
+
if (config === null)
|
|
86
|
+
return false;
|
|
87
|
+
return canReadUri(services.infra, {
|
|
88
|
+
userId: session.userId,
|
|
89
|
+
projectId: session.projectId,
|
|
90
|
+
agentId: session.agentId ?? '',
|
|
91
|
+
role: session.role,
|
|
92
|
+
grantedFeatures: session.grantedFeatures ?? [],
|
|
93
|
+
}, `${parsed.slug}://`);
|
|
33
94
|
};
|
|
95
|
+
/** The Files widget's Sources panel, opened on this source. */
|
|
96
|
+
function sourcesNav(slug) {
|
|
97
|
+
return { widgetType: 'filesystem', initialState: { nav: { kind: 'filesystem', action: 'open-sources', source: slug } } };
|
|
98
|
+
}
|
|
99
|
+
/** What one terminal job announces — family events, in publish order. */
|
|
100
|
+
export function sourceEventsFor(job) {
|
|
101
|
+
if (job.mode === 'purge')
|
|
102
|
+
return [];
|
|
103
|
+
const slug = job.source;
|
|
104
|
+
const family = { mode: job.mode, force: job.force };
|
|
105
|
+
const at = (fam) => sourceSubjectId(slug, fam);
|
|
106
|
+
const base = { sourceSlug: slug, title: slug, nav: sourcesNav(slug) };
|
|
107
|
+
const out = [];
|
|
108
|
+
if (job.status === 'failed') {
|
|
109
|
+
out.push({ event: 'source.sync.failed', subjectId: at(family),
|
|
110
|
+
data: { ...base, mode: job.mode, failureClass: SOURCE_SYNC_FAILURE_CLASS } });
|
|
111
|
+
}
|
|
112
|
+
else if (job.status === 'cancelled') {
|
|
113
|
+
out.push({ event: 'source.sync.cancelled', subjectId: at(family), data: { ...base, mode: job.mode } });
|
|
114
|
+
}
|
|
115
|
+
else if (job.status === 'completed') {
|
|
116
|
+
if (job.transition.recovered) {
|
|
117
|
+
out.push({ event: 'source.sync.recovered', subjectId: at(family), data: { ...base, mode: job.mode } });
|
|
118
|
+
// A forced full pass is a superset of the plain one: it resolves that family too.
|
|
119
|
+
if (job.mode === 'full' && job.force) {
|
|
120
|
+
out.push({ event: 'source.sync.recovered', subjectId: at({ mode: 'full', force: false }), data: { ...base, mode: job.mode } });
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (job.mode !== 'embedding') {
|
|
124
|
+
if (job.force)
|
|
125
|
+
out.push({ event: 'source.reindex.completed', subjectId: at(family), data: { ...base, mode: job.mode } });
|
|
126
|
+
else if (job.mode === 'full')
|
|
127
|
+
out.push({ event: 'source.sync.completed', subjectId: at(family), data: { ...base, mode: job.mode } });
|
|
128
|
+
}
|
|
129
|
+
const embedding = at({ mode: 'embedding', force: false });
|
|
130
|
+
if (job.transition.embeddingDegraded)
|
|
131
|
+
out.push({ event: 'source.embedding.degraded', subjectId: embedding, data: base });
|
|
132
|
+
if (job.transition.embeddingRecovered)
|
|
133
|
+
out.push({ event: 'source.embedding.recovered', subjectId: embedding, data: base });
|
|
134
|
+
}
|
|
135
|
+
return out;
|
|
136
|
+
}
|
|
34
137
|
export const bridge = (publish, state) => {
|
|
35
138
|
const brain = state;
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
139
|
+
const publishAll = (job, recipient) => {
|
|
140
|
+
for (const input of sourceEventsFor(job)) {
|
|
141
|
+
try {
|
|
142
|
+
publish({
|
|
143
|
+
...input,
|
|
144
|
+
projectId: job.scope.projectId,
|
|
145
|
+
...(recipient && !isSentinelId(recipient) ? { audience: { userIds: [recipient] } } : {}),
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
warn(job, err);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
44
152
|
};
|
|
45
153
|
const warn = (job, err) => {
|
|
46
154
|
brain.syncLogger.warn('source.event.publish_failed', {
|
|
@@ -49,24 +157,34 @@ export const bridge = (publish, state) => {
|
|
|
49
157
|
error: err instanceof Error ? err.message : String(err),
|
|
50
158
|
});
|
|
51
159
|
};
|
|
52
|
-
|
|
53
|
-
|
|
160
|
+
brain.sourceDeletions = (deletion) => {
|
|
161
|
+
const userIds = [...new Set([deletion.actor, deletion.creator ?? ''])].filter((id) => id && !isSentinelId(id));
|
|
162
|
+
if (isSentinelId(deletion.projectId))
|
|
54
163
|
return;
|
|
55
|
-
|
|
56
|
-
return;
|
|
57
|
-
if (!isSentinelId(job.scope.userId)) {
|
|
164
|
+
for (const subjectId of sourceSubjectsOf(deletion.slug)) {
|
|
58
165
|
try {
|
|
59
|
-
|
|
166
|
+
publish({ event: SOURCE_DELETED, subjectId, projectId: deletion.projectId,
|
|
167
|
+
data: { sourceSlug: deletion.slug, title: deletion.slug }, ...(userIds.length ? { audience: { userIds } } : {}) });
|
|
60
168
|
}
|
|
61
169
|
catch (err) {
|
|
62
|
-
warn(
|
|
170
|
+
brain.syncLogger.warn('source.event.publish_failed', { source: deletion.slug, error: err instanceof Error ? err.message : String(err) });
|
|
63
171
|
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const stopJobs = brain.syncQueue.onJobFinished((job) => {
|
|
175
|
+
if (job.mode === 'purge' || job.status === 'paused')
|
|
176
|
+
return;
|
|
177
|
+
if (isSentinelId(job.scope.projectId))
|
|
178
|
+
return;
|
|
179
|
+
if (!isSentinelId(job.scope.userId)) {
|
|
180
|
+
publishAll(job, job.scope.userId);
|
|
64
181
|
return;
|
|
65
182
|
}
|
|
66
183
|
brain.globalSourceConfigs
|
|
67
184
|
.get(job.scope, job.source)
|
|
68
|
-
.then((config) =>
|
|
185
|
+
.then((config) => publishAll(job, config?.createdBy))
|
|
69
186
|
.catch((err) => warn(job, err));
|
|
70
187
|
});
|
|
188
|
+
return () => { stopJobs(); brain.sourceDeletions = undefined; };
|
|
71
189
|
};
|
|
72
190
|
//# sourceMappingURL=source.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../../src/events/source.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../../src/events/source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EACL,YAAY,GAIb,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,oEAAoE;AACpE,MAAM,CAAC,MAAM,yBAAyB,GAAG,aAAa,CAAC;AAIvD,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;AAErF,kFAAkF;AAClF,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,MAAyB;IACrE,OAAO,MAAM,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,CA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AE,CAAC,CAAC,KAAK,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `vector` event subject — the outcome of an operator's collection action:
|
|
3
|
+
* a rebuild to the target embedding model that finished or paused, and a
|
|
4
|
+
* maintenance action (`dense-clear`, index migration, tuning, quantization,
|
|
5
|
+
* text ranking) that completed or failed. One row per ACTION (the subject id),
|
|
6
|
+
* addressed to the operator who started it, in the project they started it
|
|
7
|
+
* from; a completion resolves that action's failure (`notify.clears`).
|
|
8
|
+
*
|
|
9
|
+
* The outcome is known only to the process that ran the request: a rebuild
|
|
10
|
+
* RESUMED after a restart has nobody to address and publishes nothing — its
|
|
11
|
+
* state stays on the Vector Health panel and in the log. A full store reset
|
|
12
|
+
* runs from the admin package and is not reported here.
|
|
13
|
+
*
|
|
14
|
+
* `visible`: a role-holding member of the event's project holding
|
|
15
|
+
* `platform.vector.maintain` (the collection route's own escalation) — the
|
|
16
|
+
* collection is platform-wide, the row is the operator's project-scoped
|
|
17
|
+
* signal; decided from the subject and the session alone (a re-judge sees no
|
|
18
|
+
* data).
|
|
19
|
+
*/
|
|
20
|
+
import { type EventBridge, type EventVisibilityPredicate } from '@neuralis/package-system/contracts';
|
|
21
|
+
export declare const subject = "vector";
|
|
22
|
+
export type VectorActionOutcome = {
|
|
23
|
+
action: string;
|
|
24
|
+
outcome: 'completed' | 'failed' | 'paused';
|
|
25
|
+
projectId: string;
|
|
26
|
+
principal: string;
|
|
27
|
+
};
|
|
28
|
+
export type VectorOutcomePublish = (outcome: VectorActionOutcome) => void;
|
|
29
|
+
export declare const visible: EventVisibilityPredicate;
|
|
30
|
+
/** The declaration an outcome publishes, or `null` for one that is no notification (a rebuild "failed" is a pause). */
|
|
31
|
+
export declare function vectorEventFor(outcome: VectorActionOutcome): string | null;
|
|
32
|
+
export declare const bridge: EventBridge;
|
|
33
|
+
//# sourceMappingURL=vector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/events/vector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,wBAAwB,EAC9B,MAAM,oCAAoC,CAAC;AAG5C,eAAO,MAAM,OAAO,WAAW,CAAC;AAEhC,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;AAI1E,eAAO,MAAM,OAAO,EAAE,wBAE8B,CAAC;AAErD,uHAAuH;AACvH,wBAAgB,cAAc,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,GAAG,IAAI,CAK1E;AAED,eAAO,MAAM,MAAM,EAAE,WAqBpB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `vector` event subject — the outcome of an operator's collection action:
|
|
3
|
+
* a rebuild to the target embedding model that finished or paused, and a
|
|
4
|
+
* maintenance action (`dense-clear`, index migration, tuning, quantization,
|
|
5
|
+
* text ranking) that completed or failed. One row per ACTION (the subject id),
|
|
6
|
+
* addressed to the operator who started it, in the project they started it
|
|
7
|
+
* from; a completion resolves that action's failure (`notify.clears`).
|
|
8
|
+
*
|
|
9
|
+
* The outcome is known only to the process that ran the request: a rebuild
|
|
10
|
+
* RESUMED after a restart has nobody to address and publishes nothing — its
|
|
11
|
+
* state stays on the Vector Health panel and in the log. A full store reset
|
|
12
|
+
* runs from the admin package and is not reported here.
|
|
13
|
+
*
|
|
14
|
+
* `visible`: a role-holding member of the event's project holding
|
|
15
|
+
* `platform.vector.maintain` (the collection route's own escalation) — the
|
|
16
|
+
* collection is platform-wide, the row is the operator's project-scoped
|
|
17
|
+
* signal; decided from the subject and the session alone (a re-judge sees no
|
|
18
|
+
* data).
|
|
19
|
+
*/
|
|
20
|
+
import { hasFeature } from '@neuralis/package-system/access';
|
|
21
|
+
import { isSentinelId, } from '@neuralis/package-system/contracts';
|
|
22
|
+
export const subject = 'vector';
|
|
23
|
+
const FILES_VECTOR_NAV = { widgetType: 'filesystem', initialState: { nav: { kind: 'filesystem', action: 'open-vector-health' } } };
|
|
24
|
+
export const visible = (event, session) => Boolean(session.role) && Boolean(session.projectId) && event.projectId === session.projectId
|
|
25
|
+
&& hasFeature(session, 'platform.vector.maintain');
|
|
26
|
+
/** The declaration an outcome publishes, or `null` for one that is no notification (a rebuild "failed" is a pause). */
|
|
27
|
+
export function vectorEventFor(outcome) {
|
|
28
|
+
if (outcome.action === 'rebuild-generation') {
|
|
29
|
+
return outcome.outcome === 'completed' ? 'vector.rebuild.completed' : outcome.outcome === 'paused' ? 'vector.rebuild.paused' : null;
|
|
30
|
+
}
|
|
31
|
+
return outcome.outcome === 'completed' ? 'vector.maintenance.completed' : outcome.outcome === 'failed' ? 'vector.maintenance.failed' : null;
|
|
32
|
+
}
|
|
33
|
+
export const bridge = (publish, state) => {
|
|
34
|
+
const brain = state;
|
|
35
|
+
brain.vectorOutcomes = (outcome) => {
|
|
36
|
+
const event = vectorEventFor(outcome);
|
|
37
|
+
if (!event || isSentinelId(outcome.projectId))
|
|
38
|
+
return;
|
|
39
|
+
try {
|
|
40
|
+
publish({
|
|
41
|
+
event,
|
|
42
|
+
subjectId: outcome.action,
|
|
43
|
+
projectId: outcome.projectId,
|
|
44
|
+
data: { action: outcome.action, title: outcome.action, nav: FILES_VECTOR_NAV },
|
|
45
|
+
...(outcome.principal && !isSentinelId(outcome.principal) ? { audience: { userIds: [outcome.principal] } } : {}),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
brain.vectorLogger.warn('vector.event.publish_failed', {
|
|
50
|
+
action: outcome.action,
|
|
51
|
+
error: err instanceof Error ? err.message : String(err),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return () => { brain.vectorOutcomes = undefined; };
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=vector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector.js","sourceRoot":"","sources":["../../../src/events/vector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EACL,YAAY,GAGb,MAAM,oCAAoC,CAAC;AAG5C,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAWhC,MAAM,gBAAgB,GAAG,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,oBAAoB,EAAE,EAAE,EAAE,CAAC;AAEnI,MAAM,CAAC,MAAM,OAAO,GAA6B,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAClE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC,SAAS;OACzF,UAAU,CAAC,OAAO,EAAE,0BAA0B,CAAC,CAAC;AAErD,uHAAuH;AACvH,MAAM,UAAU,cAAc,CAAC,OAA4B;IACzD,IAAI,OAAO,CAAC,MAAM,KAAK,oBAAoB,EAAE,CAAC;QAC5C,OAAO,OAAO,CAAC,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI,CAAC;I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CAK/D;AAKD,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAsB/D"}
|
|
@@ -283,14 +283,10 @@ const GIT_MAX_OUTPUT_BYTES = 4 * 1024 * 1024;
|
|
|
283
283
|
const GIT_LOG_FS = '\x1f';
|
|
284
284
|
/**
|
|
285
285
|
* Env names OUTSIDE the `GIT_*` namespace that still drive git command
|
|
286
|
-
* execution (git falls back to them when the GIT_ form is absent).
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
* processes, which made EVERY simple-git task throw `Use of "EDITOR" is not
|
|
291
|
-
* permitted` under `npx vitest` (and would do the same to a production host
|
|
292
|
-
* started from a shell exporting `EDITOR`). Stripped alongside the GIT_*
|
|
293
|
-
* sweep — a non-interactive hardened runner never needs any of them.
|
|
286
|
+
* execution (git falls back to them when the GIT_ form is absent). These
|
|
287
|
+
* command-bearing variables are stripped alongside the GIT_* sweep, never
|
|
288
|
+
* allowed through simple-git's environment guard: a non-interactive hardened
|
|
289
|
+
* runner needs none of them, even when its parent exports an editor command.
|
|
294
290
|
*/
|
|
295
291
|
const UNSAFE_PLAIN_ENV = new Set(['EDITOR', 'VISUAL', 'PAGER', 'PREFIX', 'SSH_ASKPASS']);
|
|
296
292
|
function sanitizedGitEnv() {
|
|
@@ -376,6 +372,13 @@ export class GitRunner {
|
|
|
376
372
|
? { timeout: { block: options.timeoutMs } }
|
|
377
373
|
: {}),
|
|
378
374
|
config: HARDENING_CONFIG,
|
|
375
|
+
// Only the sanitizer's four defensive Git overrides may cross v4's gate.
|
|
376
|
+
allowEnvironment: [
|
|
377
|
+
'GIT_CONFIG_GLOBAL',
|
|
378
|
+
'GIT_CONFIG_SYSTEM',
|
|
379
|
+
'GIT_TERMINAL_PROMPT',
|
|
380
|
+
'GIT_OPTIONAL_LOCKS',
|
|
381
|
+
],
|
|
379
382
|
// simple-git blocks `-c core.hooksPath|fsmonitor|pager` because those are
|
|
380
383
|
// the exact keys an ATTACKER-supplied arg would abuse. Here the values are
|
|
381
384
|
// HARDCODED safe constants (HARDENING_CONFIG) set DEFENSIVELY, never
|