@braidhq/server 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/LICENSE +21 -0
- package/README.md +134 -106
- package/dist/app.d.ts +7 -15
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +74 -45
- package/dist/app.js.map +1 -1
- package/dist/authMode.d.ts +39 -0
- package/dist/authMode.d.ts.map +1 -0
- package/dist/authMode.js +50 -0
- package/dist/authMode.js.map +1 -0
- package/dist/composeApp.d.ts +80 -0
- package/dist/composeApp.d.ts.map +1 -0
- package/dist/composeApp.js +137 -0
- package/dist/composeApp.js.map +1 -0
- package/dist/composeFsApp.d.ts +27 -0
- package/dist/composeFsApp.d.ts.map +1 -0
- package/dist/{composeFs.js → composeFsApp.js} +127 -126
- package/dist/composeFsApp.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/_shared/env.d.ts +10 -0
- package/dist/infrastructure/_shared/env.d.ts.map +1 -0
- package/dist/infrastructure/{env.js → _shared/env.js} +5 -6
- package/dist/infrastructure/_shared/env.js.map +1 -0
- package/dist/infrastructure/_shared/frontmatter.d.ts +13 -0
- package/dist/infrastructure/_shared/frontmatter.d.ts.map +1 -0
- package/dist/infrastructure/{fs → _shared}/frontmatter.js +5 -5
- package/dist/infrastructure/_shared/frontmatter.js.map +1 -0
- package/dist/infrastructure/_shared/jsonFileStore.d.ts.map +1 -0
- package/dist/infrastructure/_shared/jsonFileStore.js.map +1 -0
- package/dist/infrastructure/{fs → _shared}/paths.d.ts +17 -10
- package/dist/infrastructure/_shared/paths.d.ts.map +1 -0
- package/dist/infrastructure/{fs → _shared}/paths.js +27 -20
- package/dist/infrastructure/_shared/paths.js.map +1 -0
- package/dist/infrastructure/auth/AccessPolicy.d.ts +33 -58
- package/dist/infrastructure/auth/AccessPolicy.d.ts.map +1 -1
- package/dist/infrastructure/auth/AccessPolicy.js +35 -42
- package/dist/infrastructure/auth/AccessPolicy.js.map +1 -1
- package/dist/infrastructure/auth/SessionStore.d.ts +22 -12
- package/dist/infrastructure/auth/SessionStore.d.ts.map +1 -1
- package/dist/infrastructure/auth/SessionStore.js +20 -20
- package/dist/infrastructure/auth/SessionStore.js.map +1 -1
- package/dist/infrastructure/batch/FsBatchPlanRepository.d.ts +14 -0
- package/dist/infrastructure/batch/FsBatchPlanRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs → batch}/FsBatchPlanRepository.js +9 -7
- package/dist/infrastructure/batch/FsBatchPlanRepository.js.map +1 -0
- package/dist/infrastructure/history/GitWorkspaceHistory.d.ts.map +1 -0
- package/dist/infrastructure/{git → history}/GitWorkspaceHistory.js +31 -24
- package/dist/infrastructure/history/GitWorkspaceHistory.js.map +1 -0
- package/dist/infrastructure/history/commitMessage.d.ts.map +1 -0
- package/dist/infrastructure/history/commitMessage.js +90 -0
- package/dist/infrastructure/history/commitMessage.js.map +1 -0
- package/dist/infrastructure/hitl/FsClarificationRepository.d.ts +13 -0
- package/dist/infrastructure/hitl/FsClarificationRepository.d.ts.map +1 -0
- package/dist/infrastructure/hitl/FsClarificationRepository.js +40 -0
- package/dist/infrastructure/hitl/FsClarificationRepository.js.map +1 -0
- package/dist/infrastructure/hitl/FsProposalRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs → hitl}/FsProposalRepository.js +8 -8
- package/dist/infrastructure/hitl/FsProposalRepository.js.map +1 -0
- package/dist/infrastructure/hitl/StatusedJsonStore.d.ts +30 -0
- package/dist/infrastructure/hitl/StatusedJsonStore.d.ts.map +1 -0
- package/dist/infrastructure/{fs/FsStatusedJsonRepository.js → hitl/StatusedJsonStore.js} +3 -3
- package/dist/infrastructure/hitl/StatusedJsonStore.js.map +1 -0
- package/dist/infrastructure/model/FsModelSerializer.d.ts +94 -0
- package/dist/infrastructure/model/FsModelSerializer.d.ts.map +1 -0
- package/dist/infrastructure/{fs/FsGraphSerializer.js → model/FsModelSerializer.js} +11 -11
- package/dist/infrastructure/model/FsModelSerializer.js.map +1 -0
- package/dist/infrastructure/oauth/GoogleOAuth.d.ts +20 -38
- package/dist/infrastructure/oauth/GoogleOAuth.d.ts.map +1 -1
- package/dist/infrastructure/oauth/GoogleOAuth.js +21 -22
- package/dist/infrastructure/oauth/GoogleOAuth.js.map +1 -1
- package/dist/infrastructure/reactor/FsReactorCycleRepository.d.ts +29 -0
- package/dist/infrastructure/reactor/FsReactorCycleRepository.d.ts.map +1 -0
- package/dist/infrastructure/reactor/FsReactorCycleRepository.js +94 -0
- package/dist/infrastructure/reactor/FsReactorCycleRepository.js.map +1 -0
- package/dist/infrastructure/secrets/SecretStore.d.ts +11 -14
- package/dist/infrastructure/secrets/SecretStore.d.ts.map +1 -1
- package/dist/infrastructure/secrets/SecretStore.js +4 -4
- package/dist/infrastructure/secrets/SecretStore.js.map +1 -1
- package/dist/infrastructure/{fs → skill}/FsRunRepository.d.ts +5 -3
- package/dist/infrastructure/skill/FsRunRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs → skill}/FsRunRepository.js +11 -9
- package/dist/infrastructure/skill/FsRunRepository.js.map +1 -0
- package/dist/infrastructure/{fs → skill}/FsSkillRegistry.d.ts +4 -13
- package/dist/infrastructure/skill/FsSkillRegistry.d.ts.map +1 -0
- package/dist/infrastructure/{fs → skill}/FsSkillRegistry.js +28 -20
- package/dist/infrastructure/skill/FsSkillRegistry.js.map +1 -0
- package/dist/infrastructure/skill/SubprocessSkillRunner.d.ts +52 -0
- package/dist/infrastructure/skill/SubprocessSkillRunner.d.ts.map +1 -0
- package/dist/infrastructure/{agent → skill}/SubprocessSkillRunner.js +107 -55
- package/dist/infrastructure/skill/SubprocessSkillRunner.js.map +1 -0
- package/dist/infrastructure/skill/asyncQueue.d.ts +20 -0
- package/dist/infrastructure/skill/asyncQueue.d.ts.map +1 -0
- package/dist/infrastructure/{agent → skill}/asyncQueue.js +2 -3
- package/dist/infrastructure/{agent → skill}/asyncQueue.js.map +1 -1
- package/dist/infrastructure/skill/lineBuffer.d.ts +15 -0
- package/dist/infrastructure/skill/lineBuffer.d.ts.map +1 -0
- package/dist/infrastructure/{agent/streamJsonParser.js → skill/lineBuffer.js} +5 -17
- package/dist/infrastructure/skill/lineBuffer.js.map +1 -0
- package/dist/infrastructure/skill/orphanReaper.d.ts +20 -0
- package/dist/infrastructure/skill/orphanReaper.d.ts.map +1 -0
- package/dist/infrastructure/{orphanReaper.js → skill/orphanReaper.js} +7 -5
- package/dist/infrastructure/skill/orphanReaper.js.map +1 -0
- package/dist/infrastructure/skill/subprocessEventStream.d.ts +16 -0
- package/dist/infrastructure/skill/subprocessEventStream.d.ts.map +1 -0
- package/dist/infrastructure/skill/subprocessEventStream.js +29 -0
- package/dist/infrastructure/skill/subprocessEventStream.js.map +1 -0
- package/dist/infrastructure/source/FsSourceUnitDigest.d.ts +19 -0
- package/dist/infrastructure/source/FsSourceUnitDigest.d.ts.map +1 -0
- package/dist/infrastructure/{fs → source}/FsSourceUnitDigest.js +9 -9
- package/dist/infrastructure/source/FsSourceUnitDigest.js.map +1 -0
- package/dist/infrastructure/source/FsSourceUnitObservationRepository.d.ts +31 -0
- package/dist/infrastructure/source/FsSourceUnitObservationRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs/FsSourceUnitStateRepository.js → source/FsSourceUnitObservationRepository.js} +18 -17
- package/dist/infrastructure/source/FsSourceUnitObservationRepository.js.map +1 -0
- package/dist/infrastructure/source/unitScan.d.ts +11 -0
- package/dist/infrastructure/source/unitScan.d.ts.map +1 -0
- package/dist/infrastructure/{fs/intentScan.js → source/unitScan.js} +36 -27
- package/dist/infrastructure/source/unitScan.js.map +1 -0
- package/dist/infrastructure/users/UserDirectoryFromRegistry.d.ts +2 -2
- package/dist/infrastructure/users/UserDirectoryFromRegistry.d.ts.map +1 -1
- package/dist/infrastructure/users/UserDirectoryFromRegistry.js +3 -2
- package/dist/infrastructure/users/UserDirectoryFromRegistry.js.map +1 -1
- package/dist/infrastructure/users/UserRegistryFile.d.ts +4 -5
- package/dist/infrastructure/users/UserRegistryFile.d.ts.map +1 -1
- package/dist/infrastructure/users/UserRegistryFile.js +6 -8
- package/dist/infrastructure/users/UserRegistryFile.js.map +1 -1
- package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts +9 -6
- package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts.map +1 -1
- package/dist/infrastructure/users/ensureWorkspaceOwners.js +10 -7
- package/dist/infrastructure/users/ensureWorkspaceOwners.js.map +1 -1
- package/dist/infrastructure/workspace/FsWorkspaceRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs → workspace}/FsWorkspaceRepository.js +7 -6
- package/dist/infrastructure/workspace/FsWorkspaceRepository.js.map +1 -0
- package/dist/infrastructure/workspace/WorkspaceDiscovery.d.ts +18 -0
- package/dist/infrastructure/workspace/WorkspaceDiscovery.d.ts.map +1 -0
- package/dist/infrastructure/{fs → workspace}/WorkspaceDiscovery.js +15 -11
- package/dist/infrastructure/workspace/WorkspaceDiscovery.js.map +1 -0
- package/dist/infrastructure/{fs → workspace}/WorkspaceRegistryFile.d.ts +10 -9
- package/dist/infrastructure/workspace/WorkspaceRegistryFile.d.ts.map +1 -0
- package/dist/infrastructure/{fs → workspace}/WorkspaceRegistryFile.js +15 -17
- package/dist/infrastructure/workspace/WorkspaceRegistryFile.js.map +1 -0
- package/dist/infrastructure/workspace/productManifestWriter.d.ts +24 -0
- package/dist/infrastructure/workspace/productManifestWriter.d.ts.map +1 -0
- package/dist/infrastructure/{fs → workspace}/productManifestWriter.js +14 -26
- package/dist/infrastructure/workspace/productManifestWriter.js.map +1 -0
- package/dist/middleware/auth.d.ts +27 -17
- package/dist/middleware/auth.d.ts.map +1 -1
- package/dist/middleware/auth.js +69 -53
- package/dist/middleware/auth.js.map +1 -1
- package/dist/middleware/cors.d.ts.map +1 -1
- package/dist/middleware/cors.js +4 -1
- package/dist/middleware/cors.js.map +1 -1
- package/dist/middleware/error.d.ts.map +1 -1
- package/dist/middleware/error.js +15 -13
- package/dist/middleware/error.js.map +1 -1
- package/dist/middleware/workspaceAccess.d.ts +23 -19
- package/dist/middleware/workspaceAccess.d.ts.map +1 -1
- package/dist/middleware/workspaceAccess.js +31 -26
- package/dist/middleware/workspaceAccess.js.map +1 -1
- package/dist/policy/CapabilityCheck.d.ts +5 -5
- package/dist/policy/PermissionRegistry.d.ts +11 -9
- package/dist/policy/PermissionRegistry.d.ts.map +1 -1
- package/dist/policy/PermissionRegistry.js +10 -8
- package/dist/policy/PermissionRegistry.js.map +1 -1
- package/dist/policy/ViewerContext.d.ts +13 -11
- package/dist/policy/ViewerContext.d.ts.map +1 -1
- package/dist/policy/checks.d.ts +9 -9
- package/dist/policy/checks.d.ts.map +1 -1
- package/dist/policy/checks.js +14 -11
- package/dist/policy/checks.js.map +1 -1
- package/dist/policy/defaultRegistry.d.ts +3 -4
- package/dist/policy/defaultRegistry.d.ts.map +1 -1
- package/dist/policy/defaultRegistry.js +3 -4
- package/dist/policy/defaultRegistry.js.map +1 -1
- package/dist/policy/index.d.ts +2 -2
- package/dist/policy/index.d.ts.map +1 -1
- package/dist/policy/index.js +1 -1
- package/dist/policy/index.js.map +1 -1
- package/dist/policy/resolveViewer.d.ts +9 -9
- package/dist/policy/resolveViewer.js +9 -9
- package/dist/routes/_shared.d.ts +93 -153
- package/dist/routes/_shared.d.ts.map +1 -1
- package/dist/routes/_shared.js +9 -5
- package/dist/routes/_shared.js.map +1 -1
- package/dist/routes/admin.d.ts +1 -1
- package/dist/routes/admin.d.ts.map +1 -1
- package/dist/routes/admin.js +13 -12
- package/dist/routes/admin.js.map +1 -1
- package/dist/routes/auth.d.ts +12 -10
- package/dist/routes/auth.d.ts.map +1 -1
- package/dist/routes/auth.js +32 -34
- package/dist/routes/auth.js.map +1 -1
- package/dist/routes/clarifications.d.ts +8 -0
- package/dist/routes/clarifications.d.ts.map +1 -0
- package/dist/routes/clarifications.js +246 -0
- package/dist/routes/clarifications.js.map +1 -0
- package/dist/routes/edges.d.ts.map +1 -1
- package/dist/routes/edges.js +2 -6
- package/dist/routes/edges.js.map +1 -1
- package/dist/routes/history.d.ts.map +1 -1
- package/dist/routes/history.js +12 -10
- package/dist/routes/history.js.map +1 -1
- package/dist/routes/nodes.d.ts.map +1 -1
- package/dist/routes/nodes.js +4 -8
- package/dist/routes/nodes.js.map +1 -1
- package/dist/routes/oauth.d.ts +6 -7
- package/dist/routes/oauth.d.ts.map +1 -1
- package/dist/routes/oauth.js +6 -7
- package/dist/routes/oauth.js.map +1 -1
- package/dist/routes/ontologies.d.ts +7 -0
- package/dist/routes/ontologies.d.ts.map +1 -0
- package/dist/routes/ontologies.js +29 -0
- package/dist/routes/ontologies.js.map +1 -0
- package/dist/routes/ontology.d.ts.map +1 -1
- package/dist/routes/ontology.js +2 -1
- package/dist/routes/ontology.js.map +1 -1
- package/dist/routes/proposals.d.ts +2 -2
- package/dist/routes/proposals.d.ts.map +1 -1
- package/dist/routes/proposals.js +35 -30
- package/dist/routes/proposals.js.map +1 -1
- package/dist/routes/reactorCycles.d.ts +7 -0
- package/dist/routes/reactorCycles.d.ts.map +1 -0
- package/dist/routes/reactorCycles.js +60 -0
- package/dist/routes/reactorCycles.js.map +1 -0
- package/dist/routes/runs.d.ts.map +1 -1
- package/dist/routes/runs.js +22 -19
- package/dist/routes/runs.js.map +1 -1
- package/dist/routes/skillInputOptions.d.ts +2 -2
- package/dist/routes/skillInputOptions.d.ts.map +1 -1
- package/dist/routes/skillInputOptions.js +53 -53
- package/dist/routes/skillInputOptions.js.map +1 -1
- package/dist/routes/skills.d.ts +19 -1
- package/dist/routes/skills.d.ts.map +1 -1
- package/dist/routes/skills.js +141 -7
- package/dist/routes/skills.js.map +1 -1
- package/dist/routes/sourceLoaders.d.ts.map +1 -1
- package/dist/routes/sourceLoaders.js +1 -0
- package/dist/routes/sourceLoaders.js.map +1 -1
- package/dist/routes/sourceUnitObservations.d.ts +20 -0
- package/dist/routes/sourceUnitObservations.d.ts.map +1 -0
- package/dist/routes/sourceUnitObservations.js +80 -0
- package/dist/routes/sourceUnitObservations.js.map +1 -0
- package/dist/routes/sourceWebhooks.d.ts +26 -0
- package/dist/routes/sourceWebhooks.d.ts.map +1 -0
- package/dist/routes/sourceWebhooks.js +301 -0
- package/dist/routes/sourceWebhooks.js.map +1 -0
- package/dist/routes/users.d.ts +0 -2
- package/dist/routes/users.d.ts.map +1 -1
- package/dist/routes/users.js +15 -33
- package/dist/routes/users.js.map +1 -1
- package/dist/routes/workspaceEvents.d.ts +5 -4
- package/dist/routes/workspaceEvents.d.ts.map +1 -1
- package/dist/routes/workspaceEvents.js +7 -6
- package/dist/routes/workspaceEvents.js.map +1 -1
- package/dist/routes/workspaceMembers.d.ts +1 -1
- package/dist/routes/workspaceMembers.d.ts.map +1 -1
- package/dist/routes/workspaceMembers.js +2 -2
- package/dist/routes/workspaceMembers.js.map +1 -1
- package/dist/routes/workspaces.d.ts +21 -10
- package/dist/routes/workspaces.d.ts.map +1 -1
- package/dist/routes/workspaces.js +95 -69
- package/dist/routes/workspaces.js.map +1 -1
- package/dist/server.js +6 -70
- package/dist/server.js.map +1 -1
- package/dist/serviceAccounts.d.ts +13 -0
- package/dist/serviceAccounts.d.ts.map +1 -0
- package/dist/serviceAccounts.js +26 -0
- package/dist/serviceAccounts.js.map +1 -0
- package/dist/startServer.d.ts +17 -0
- package/dist/startServer.d.ts.map +1 -0
- package/dist/startServer.js +81 -0
- package/dist/startServer.js.map +1 -0
- package/dist/startup.d.ts +28 -0
- package/dist/startup.d.ts.map +1 -0
- package/dist/startup.js +94 -0
- package/dist/startup.js.map +1 -0
- package/package.json +35 -40
- package/dist/composeFs.d.ts +0 -55
- package/dist/composeFs.d.ts.map +0 -1
- package/dist/composeFs.js.map +0 -1
- package/dist/composition.d.ts +0 -133
- package/dist/composition.d.ts.map +0 -1
- package/dist/composition.js +0 -113
- package/dist/composition.js.map +0 -1
- package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts +0 -75
- package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts.map +0 -1
- package/dist/infrastructure/agent/SubprocessSkillRunner.js.map +0 -1
- package/dist/infrastructure/agent/asyncQueue.d.ts +0 -22
- package/dist/infrastructure/agent/asyncQueue.d.ts.map +0 -1
- package/dist/infrastructure/agent/mcpConfig.d.ts +0 -38
- package/dist/infrastructure/agent/mcpConfig.d.ts.map +0 -1
- package/dist/infrastructure/agent/mcpConfig.js +0 -55
- package/dist/infrastructure/agent/mcpConfig.js.map +0 -1
- package/dist/infrastructure/agent/streamJsonParser.d.ts +0 -20
- package/dist/infrastructure/agent/streamJsonParser.d.ts.map +0 -1
- package/dist/infrastructure/agent/streamJsonParser.js.map +0 -1
- package/dist/infrastructure/agent/subprocessEventStream.d.ts +0 -26
- package/dist/infrastructure/agent/subprocessEventStream.d.ts.map +0 -1
- package/dist/infrastructure/agent/subprocessEventStream.js +0 -112
- package/dist/infrastructure/agent/subprocessEventStream.js.map +0 -1
- package/dist/infrastructure/auth/ensureApprovedEmails.d.ts +0 -16
- package/dist/infrastructure/auth/ensureApprovedEmails.d.ts.map +0 -1
- package/dist/infrastructure/auth/ensureApprovedEmails.js +0 -20
- package/dist/infrastructure/auth/ensureApprovedEmails.js.map +0 -1
- package/dist/infrastructure/env.d.ts +0 -11
- package/dist/infrastructure/env.d.ts.map +0 -1
- package/dist/infrastructure/env.js.map +0 -1
- package/dist/infrastructure/fs/FsBatchPlanRepository.d.ts +0 -300
- package/dist/infrastructure/fs/FsBatchPlanRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsBatchPlanRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts +0 -13
- package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsClarifyTicketRepository.js +0 -39
- package/dist/infrastructure/fs/FsClarifyTicketRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsDecisionRepository.d.ts +0 -13
- package/dist/infrastructure/fs/FsDecisionRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsDecisionRepository.js +0 -56
- package/dist/infrastructure/fs/FsDecisionRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsGraphSerializer.d.ts +0 -629
- package/dist/infrastructure/fs/FsGraphSerializer.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsGraphSerializer.js.map +0 -1
- package/dist/infrastructure/fs/FsProposalRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsProposalRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsRunRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsRunRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsSkillRegistry.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsSkillRegistry.js.map +0 -1
- package/dist/infrastructure/fs/FsSourceUnitDigest.d.ts +0 -19
- package/dist/infrastructure/fs/FsSourceUnitDigest.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsSourceUnitDigest.js.map +0 -1
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.d.ts +0 -30
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsStatusedJsonRepository.d.ts +0 -35
- package/dist/infrastructure/fs/FsStatusedJsonRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsStatusedJsonRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsWorkspaceRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsWorkspaceRepository.js.map +0 -1
- package/dist/infrastructure/fs/WorkspaceDiscovery.d.ts +0 -15
- package/dist/infrastructure/fs/WorkspaceDiscovery.d.ts.map +0 -1
- package/dist/infrastructure/fs/WorkspaceDiscovery.js.map +0 -1
- package/dist/infrastructure/fs/WorkspaceRegistryFile.d.ts.map +0 -1
- package/dist/infrastructure/fs/WorkspaceRegistryFile.js.map +0 -1
- package/dist/infrastructure/fs/frontmatter.d.ts +0 -13
- package/dist/infrastructure/fs/frontmatter.d.ts.map +0 -1
- package/dist/infrastructure/fs/frontmatter.js.map +0 -1
- package/dist/infrastructure/fs/intentScan.d.ts +0 -9
- package/dist/infrastructure/fs/intentScan.d.ts.map +0 -1
- package/dist/infrastructure/fs/intentScan.js.map +0 -1
- package/dist/infrastructure/fs/jsonFileStore.d.ts.map +0 -1
- package/dist/infrastructure/fs/jsonFileStore.js.map +0 -1
- package/dist/infrastructure/fs/paths.d.ts.map +0 -1
- package/dist/infrastructure/fs/paths.js.map +0 -1
- package/dist/infrastructure/fs/productManifestWriter.d.ts +0 -22
- package/dist/infrastructure/fs/productManifestWriter.d.ts.map +0 -1
- package/dist/infrastructure/fs/productManifestWriter.js.map +0 -1
- package/dist/infrastructure/git/GitWorkspaceHistory.d.ts.map +0 -1
- package/dist/infrastructure/git/GitWorkspaceHistory.js.map +0 -1
- package/dist/infrastructure/git/commitMessage.d.ts.map +0 -1
- package/dist/infrastructure/git/commitMessage.js +0 -71
- package/dist/infrastructure/git/commitMessage.js.map +0 -1
- package/dist/infrastructure/orphanReaper.d.ts +0 -18
- package/dist/infrastructure/orphanReaper.d.ts.map +0 -1
- package/dist/infrastructure/orphanReaper.js.map +0 -1
- package/dist/infrastructure/users/ensureLocalUser.d.ts +0 -15
- package/dist/infrastructure/users/ensureLocalUser.d.ts.map +0 -1
- package/dist/infrastructure/users/ensureLocalUser.js +0 -38
- package/dist/infrastructure/users/ensureLocalUser.js.map +0 -1
- package/dist/middleware/requireAdmin.d.ts +0 -10
- package/dist/middleware/requireAdmin.d.ts.map +0 -1
- package/dist/middleware/requireAdmin.js +0 -24
- package/dist/middleware/requireAdmin.js.map +0 -1
- package/dist/middleware/userId.d.ts +0 -16
- package/dist/middleware/userId.d.ts.map +0 -1
- package/dist/middleware/userId.js +0 -27
- package/dist/middleware/userId.js.map +0 -1
- package/dist/policy/Capability.d.ts +0 -12
- package/dist/policy/Capability.d.ts.map +0 -1
- package/dist/policy/Capability.js +0 -31
- package/dist/policy/Capability.js.map +0 -1
- package/dist/routes/clarify.d.ts +0 -9
- package/dist/routes/clarify.d.ts.map +0 -1
- package/dist/routes/clarify.js +0 -274
- package/dist/routes/clarify.js.map +0 -1
- package/dist/routes/decisions.d.ts +0 -7
- package/dist/routes/decisions.d.ts.map +0 -1
- package/dist/routes/decisions.js +0 -68
- package/dist/routes/decisions.js.map +0 -1
- package/dist/routes/sourceUnitStates.d.ts +0 -7
- package/dist/routes/sourceUnitStates.d.ts.map +0 -1
- package/dist/routes/sourceUnitStates.js +0 -45
- package/dist/routes/sourceUnitStates.js.map +0 -1
- /package/dist/infrastructure/{fs → _shared}/jsonFileStore.d.ts +0 -0
- /package/dist/infrastructure/{fs → _shared}/jsonFileStore.js +0 -0
- /package/dist/infrastructure/{git → history}/GitWorkspaceHistory.d.ts +0 -0
- /package/dist/infrastructure/{git → history}/commitMessage.d.ts +0 -0
- /package/dist/infrastructure/{fs → hitl}/FsProposalRepository.d.ts +0 -0
- /package/dist/infrastructure/{fs → workspace}/FsWorkspaceRepository.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subprocessEventStream.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/skill/subprocessEventStream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAItD;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,UAAU,EAAE,CAAA;AAEpE;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,EACpC,GAAG,EAAE,MAAM,MAAM,GAChB;IAAE,KAAK,EAAE,MAAM,IAAI,CAAA;CAAE,CAsBvB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SkillEvent as SkillEventSchema } from '@braidhq/schema';
|
|
2
|
+
import { LineBuffer } from './lineBuffer.js';
|
|
3
|
+
/**
|
|
4
|
+
* Wires a child's stdout and stderr to a single SkillEvent callback.
|
|
5
|
+
* `parseLine` comes from the agent binding, so this stays format-agnostic.
|
|
6
|
+
* Returns `flush` so callers can drain the final un-terminated line on `close`.
|
|
7
|
+
*/
|
|
8
|
+
export function attachOutputBuffers(child, parseLine, onEvent, now) {
|
|
9
|
+
const stdout = new LineBuffer((line) => {
|
|
10
|
+
for (const event of parseLine(line, now()))
|
|
11
|
+
onEvent(event);
|
|
12
|
+
});
|
|
13
|
+
// stderr is wrapped verbatim into a `[stderr]` message event,
|
|
14
|
+
// so it shows up in the transcript alongside model output.
|
|
15
|
+
const stderr = new LineBuffer((line) => {
|
|
16
|
+
onEvent(SkillEventSchema.parse({ type: 'message', text: `[stderr] ${line}` }));
|
|
17
|
+
});
|
|
18
|
+
child.stdout?.setEncoding('utf-8');
|
|
19
|
+
child.stdout?.on('data', (chunk) => stdout.append(chunk));
|
|
20
|
+
child.stderr?.setEncoding('utf-8');
|
|
21
|
+
child.stderr?.on('data', (chunk) => stderr.append(chunk));
|
|
22
|
+
return {
|
|
23
|
+
flush: () => {
|
|
24
|
+
stdout.flush();
|
|
25
|
+
stderr.flush();
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=subprocessEventStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subprocessEventStream.js","sourceRoot":"","sources":["../../../src/infrastructure/skill/subprocessEventStream.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CA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filesystem-backed `SourceUnitDigest`. Resolves the unit's relative path,
|
|
5
|
+
* under its filesystem source root, then hashes.
|
|
6
|
+
*
|
|
7
|
+
* - regular file: the sha256 of the file bytes.
|
|
8
|
+
* - directory: a recursive walk hashes each file by content,
|
|
9
|
+
* assembles a deterministic `<relpath>:<filehash>\n` manifest,
|
|
10
|
+
* sorted by relpath, then returns the sha256 of that manifest.
|
|
11
|
+
* Dot-prefixed entries are skipped, per the intent scanner's convention.
|
|
12
|
+
*
|
|
13
|
+
* The intent scanner's trailing-slash convention is accepted,
|
|
14
|
+
* so a file reads as `foo.md` and a folder as `foo/`.
|
|
15
|
+
*/
|
|
16
|
+
export declare class FsSourceUnitDigest implements SourceUnitDigest {
|
|
17
|
+
computeSha(workspace: Workspace, sourceId: SourceId, path: string): Promise<SourceUnitSha>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=FsSourceUnitDigest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FsSourceUnitDigest.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/source/FsSourceUnitDigest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAK9D;;;;;;;;;;;;GAYG;AACH,qBAAa,kBAAmB,YAAW,gBAAgB;IACnD,UAAU,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAejG"}
|
|
@@ -2,17 +2,17 @@ import { createHash } from 'node:crypto';
|
|
|
2
2
|
import { readdir, readFile, stat } from 'node:fs/promises';
|
|
3
3
|
import { isAbsolute, join, relative } from 'node:path';
|
|
4
4
|
/**
|
|
5
|
-
* Filesystem-backed `SourceUnitDigest`. Resolves the unit's relative
|
|
6
|
-
*
|
|
5
|
+
* Filesystem-backed `SourceUnitDigest`. Resolves the unit's relative path,
|
|
6
|
+
* under its filesystem source root, then hashes.
|
|
7
7
|
*
|
|
8
|
-
* - regular file: sha256 of file bytes
|
|
9
|
-
* - directory: recursive walk
|
|
10
|
-
* deterministic `<relpath>:<filehash>\n` manifest
|
|
11
|
-
*
|
|
12
|
-
* intent scanner's convention
|
|
8
|
+
* - regular file: the sha256 of the file bytes.
|
|
9
|
+
* - directory: a recursive walk hashes each file by content,
|
|
10
|
+
* assembles a deterministic `<relpath>:<filehash>\n` manifest,
|
|
11
|
+
* sorted by relpath, then returns the sha256 of that manifest.
|
|
12
|
+
* Dot-prefixed entries are skipped, per the intent scanner's convention.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* The intent scanner's trailing-slash convention is accepted,
|
|
15
|
+
* so a file reads as `foo.md` and a folder as `foo/`.
|
|
16
16
|
*/
|
|
17
17
|
export class FsSourceUnitDigest {
|
|
18
18
|
async computeSha(workspace, sourceId, path) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FsSourceUnitDigest.js","sourceRoot":"","sources":["../../../src/infrastructure/source/FsSourceUnitDigest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEtD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,kBAAkB;IAC7B,KAAK,CAAC,UAAU,CAAC,SAAoB,EAAE,QAAkB,EAAE,IAAY;QACrE,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAA;QAC7D,IAAI,C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import type { SourceUnitObservationRepository } from '@braidhq/core';
|
|
2
|
+
import type { AbsolutePath, SourceId, SourceUnitObservation, WorkspaceId } from '@braidhq/schema';
|
|
3
|
+
export interface FsSourceUnitObservationRepositoryOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Lookup of `workspaceId` to `workspaceRoot`, shared by the repos,
|
|
6
|
+
* so this one takes no `WorkspaceService` dependency of its own.
|
|
7
|
+
* `composeFs.ts` builds the closure once, then hands the same one,
|
|
8
|
+
* to every fs repo.
|
|
9
|
+
*/
|
|
10
|
+
readonly workspaceRoots: () => Promise<ReadonlyMap<WorkspaceId, AbsolutePath>>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Filesystem-backed `SourceUnitObservationRepository`. Each entity maps to,
|
|
14
|
+
* `artifacts/source-unit-state/<sourceId>/<encoded-path>.json`, one file each,
|
|
15
|
+
* matching the file-per-entity pattern used by proposals / clarifications.
|
|
16
|
+
*
|
|
17
|
+
* The file body is exactly the `SourceUnitObservation` shape,
|
|
18
|
+
* with no wrapper or envelope.
|
|
19
|
+
* In a future SQLite or Postgres store,
|
|
20
|
+
* each file becomes one row keyed by `(workspaceId, sourceId, path)`.
|
|
21
|
+
*/
|
|
22
|
+
export declare class FsSourceUnitObservationRepository implements SourceUnitObservationRepository {
|
|
23
|
+
private readonly options;
|
|
24
|
+
constructor(options: FsSourceUnitObservationRepositoryOptions);
|
|
25
|
+
find(workspaceId: WorkspaceId, sourceId: SourceId, path: string): Promise<SourceUnitObservation | null>;
|
|
26
|
+
save(state: SourceUnitObservation): Promise<void>;
|
|
27
|
+
listByWorkspace(workspaceId: WorkspaceId): Promise<readonly SourceUnitObservation[]>;
|
|
28
|
+
listBySource(workspaceId: WorkspaceId, sourceId: SourceId): Promise<readonly SourceUnitObservation[]>;
|
|
29
|
+
private resolveRoot;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=FsSourceUnitObservationRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FsSourceUnitObservationRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/source/FsSourceUnitObservationRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AASjG,MAAM,WAAW,wCAAwC;IACvD;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAA;CAC/E;AAED;;;;;;;;;GASG;AACH,qBAAa,iCAAkC,YAAW,+BAA+B;IAC3E,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,wCAAwC;IAExE,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;IAcvG,IAAI,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IASjD,eAAe,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,qBAAqB,EAAE,CAAC;IAapF,YAAY,CAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,qBAAqB,EAAE,CAAC;YAK7F,WAAW;CAO1B"}
|
|
@@ -2,28 +2,29 @@ import { mkdir, readdir, readFile, rename, writeFile } from 'node:fs/promises';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import process from 'node:process';
|
|
4
4
|
import { NotFoundError } from '@braidhq/core';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { SourceUnitObservation as SourceUnitObservationSchema } from '@braidhq/schema';
|
|
6
|
+
import { sourceUnitObservationDir, sourceUnitObservationFilePath, sourceUnitObservationSourceDir } from '../_shared/paths.js';
|
|
7
7
|
/**
|
|
8
|
-
* Filesystem-backed `
|
|
9
|
-
*
|
|
10
|
-
* matching the file-per-entity pattern used by proposals /
|
|
8
|
+
* Filesystem-backed `SourceUnitObservationRepository`. Each entity maps to,
|
|
9
|
+
* `artifacts/source-unit-state/<sourceId>/<encoded-path>.json`, one file each,
|
|
10
|
+
* matching the file-per-entity pattern used by proposals / clarifications.
|
|
11
11
|
*
|
|
12
|
-
* The file body is exactly the `
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* The file body is exactly the `SourceUnitObservation` shape,
|
|
13
|
+
* with no wrapper or envelope.
|
|
14
|
+
* In a future SQLite or Postgres store,
|
|
15
|
+
* each file becomes one row keyed by `(workspaceId, sourceId, path)`.
|
|
15
16
|
*/
|
|
16
|
-
export class
|
|
17
|
+
export class FsSourceUnitObservationRepository {
|
|
17
18
|
options;
|
|
18
19
|
constructor(options) {
|
|
19
20
|
this.options = options;
|
|
20
21
|
}
|
|
21
22
|
async find(workspaceId, sourceId, path) {
|
|
22
23
|
const root = await this.resolveRoot(workspaceId);
|
|
23
|
-
const file =
|
|
24
|
+
const file = sourceUnitObservationFilePath(root, sourceId, path);
|
|
24
25
|
try {
|
|
25
26
|
const raw = await readFile(file, 'utf-8');
|
|
26
|
-
return
|
|
27
|
+
return SourceUnitObservationSchema.parse(JSON.parse(raw));
|
|
27
28
|
}
|
|
28
29
|
catch (error) {
|
|
29
30
|
if (error.code === 'ENOENT')
|
|
@@ -33,15 +34,15 @@ export class FsSourceUnitStateRepository {
|
|
|
33
34
|
}
|
|
34
35
|
async save(state) {
|
|
35
36
|
const root = await this.resolveRoot(state.workspaceId);
|
|
36
|
-
const file =
|
|
37
|
-
await mkdir(
|
|
37
|
+
const file = sourceUnitObservationFilePath(root, state.sourceId, state.path);
|
|
38
|
+
await mkdir(sourceUnitObservationSourceDir(root, state.sourceId), { recursive: true });
|
|
38
39
|
const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
|
|
39
40
|
await writeFile(tmp, `${JSON.stringify(state, null, 2)}\n`, 'utf-8');
|
|
40
41
|
await rename(tmp, file);
|
|
41
42
|
}
|
|
42
43
|
async listByWorkspace(workspaceId) {
|
|
43
44
|
const root = await this.resolveRoot(workspaceId);
|
|
44
|
-
const baseDir =
|
|
45
|
+
const baseDir = sourceUnitObservationDir(root);
|
|
45
46
|
const sourceDirs = await safeReaddir(baseDir);
|
|
46
47
|
const all = [];
|
|
47
48
|
for (const sourceDir of sourceDirs) {
|
|
@@ -53,7 +54,7 @@ export class FsSourceUnitStateRepository {
|
|
|
53
54
|
}
|
|
54
55
|
async listBySource(workspaceId, sourceId) {
|
|
55
56
|
const root = await this.resolveRoot(workspaceId);
|
|
56
|
-
return readEntriesIn(
|
|
57
|
+
return readEntriesIn(sourceUnitObservationSourceDir(root, sourceId));
|
|
57
58
|
}
|
|
58
59
|
async resolveRoot(workspaceId) {
|
|
59
60
|
const roots = await this.options.workspaceRoots();
|
|
@@ -80,8 +81,8 @@ async function readEntriesIn(dir) {
|
|
|
80
81
|
if (!entry.isFile() || !entry.name.endsWith('.json'))
|
|
81
82
|
continue;
|
|
82
83
|
const raw = await readFile(join(dir, entry.name), 'utf-8');
|
|
83
|
-
results.push(
|
|
84
|
+
results.push(SourceUnitObservationSchema.parse(JSON.parse(raw)));
|
|
84
85
|
}
|
|
85
86
|
return results;
|
|
86
87
|
}
|
|
87
|
-
//# sourceMappingURL=
|
|
88
|
+
//# sourceMappingURL=FsSourceUnitObservationRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FsSourceUnitObservationRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/source/FsSourceUnitObservationRepository.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC9E,OAAO,EAAE,IAAI,EAAE,MAA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AAG,CAAC,WAAW,CAAC,CAAA;QACnC,IAAI,CAAC,IAAI;YACP,MAAM,IAAI,aAAa,CAAC,cAAc,WAAW,+BAA+B,CAAC,CAAA;QACnF,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAED,KAAK,UAAU,WAAW,CAAC,GAAW;IACpC,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;IACpD,CAAC;IACD,OAAO,KAAK,EAAE,CAAC;QACb,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YACpD,OAAO,EAAE,CAAA;QACX,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC;AAED,KAAK,UAAU,aAAa,CAAC,GAAW;IACtC,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,CAAA;IACtC,MAAM,OAAO,GAA4B,EAAE,CAAA;IAC3C,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;YAClD,SAAQ;QACV,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAA;QAC1D,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAClE,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PluginRegistry, SourceUnitItem, Workspace } from '@braidhq/core';
|
|
2
|
+
import type { SourceRole } from '@braidhq/schema';
|
|
3
|
+
/** The unit-bearing role ids the workspace's active ontology declares. */
|
|
4
|
+
export declare function unitBearingRolesOf(registry: PluginRegistry, workspace: Workspace): readonly SourceRole[];
|
|
5
|
+
/**
|
|
6
|
+
* Shared by the Studio source picker and BatchService,
|
|
7
|
+
* so both see the same per-doc granularity.
|
|
8
|
+
* Walks sources whose role is in `roles`, the ontology's unit-bearing roles.
|
|
9
|
+
*/
|
|
10
|
+
export declare function listUnitItems(workspace: Workspace, roles: readonly SourceRole[]): Promise<SourceUnitItem[]>;
|
|
11
|
+
//# sourceMappingURL=unitScan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unitScan.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/source/unitScan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAOjD,0EAA0E;AAC1E,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,GAAG,SAAS,UAAU,EAAE,CAGxG;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAcjH"}
|
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
import { readdir } from 'node:fs/promises';
|
|
2
2
|
import { isAbsolute, join } from 'node:path';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { unitBearingRoleIds } from '@braidhq/core';
|
|
4
|
+
const UNIT_FILE_EXTENSIONS = new Set(['.md', '.mdx', '.markdown', '.txt', '.rst']);
|
|
5
|
+
/** The unit-bearing role ids the workspace's active ontology declares. */
|
|
6
|
+
export function unitBearingRolesOf(registry, workspace) {
|
|
7
|
+
const ontology = registry.findOntology(workspace.productManifest.ontologyId);
|
|
8
|
+
return ontology ? unitBearingRoleIds(ontology) : [];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Shared by the Studio source picker and BatchService,
|
|
12
|
+
* so both see the same per-doc granularity.
|
|
13
|
+
* Walks sources whose role is in `roles`, the ontology's unit-bearing roles.
|
|
14
|
+
*/
|
|
15
|
+
export async function listUnitItems(workspace, roles) {
|
|
6
16
|
const items = [];
|
|
7
17
|
for (const source of workspace.sources) {
|
|
8
|
-
if (source.role
|
|
18
|
+
if (!roles.includes(source.role))
|
|
9
19
|
continue;
|
|
10
20
|
if (source.kind !== 'filesystem')
|
|
11
|
-
// MCP
|
|
21
|
+
// MCP sources aren't directory-listable, future enhancement.
|
|
12
22
|
continue;
|
|
13
23
|
const absoluteRoot = isAbsolute(source.path)
|
|
14
24
|
? source.path
|
|
15
25
|
: join(workspace.rootPath, source.path);
|
|
16
|
-
items.push(...await
|
|
26
|
+
items.push(...await listUnitEntries(absoluteRoot, source.id, source.name));
|
|
17
27
|
}
|
|
18
28
|
return items;
|
|
19
29
|
}
|
|
20
|
-
async function
|
|
30
|
+
async function listUnitEntries(root, sourceId, sourceName) {
|
|
21
31
|
const items = [];
|
|
22
32
|
let topEntries;
|
|
23
33
|
try {
|
|
@@ -31,11 +41,12 @@ async function listIntentEntries(root, sourceId, sourceName) {
|
|
|
31
41
|
continue;
|
|
32
42
|
if (entry.isDirectory()) {
|
|
33
43
|
const folder = join(root, entry.name);
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
//
|
|
44
|
+
// A flat directory of loose markdown files gives one unit per file,
|
|
45
|
+
// so downstream skills run per-document rather than over the bag all at once.
|
|
46
|
+
// Such layouts include a github loader's issues tree,
|
|
47
|
+
// or a hand-curated prd folder of onboarding docs.
|
|
48
|
+
// A directory with its own sub-structure stays a single unit,
|
|
49
|
+
// since that structure is the unit's own organisation.
|
|
39
50
|
const flatFiles = await listFlatDocumentFiles(folder);
|
|
40
51
|
if (flatFiles) {
|
|
41
52
|
for (const name of flatFiles) {
|
|
@@ -58,7 +69,7 @@ async function listIntentEntries(root, sourceId, sourceName) {
|
|
|
58
69
|
}
|
|
59
70
|
continue;
|
|
60
71
|
}
|
|
61
|
-
if (entry.isFile() &&
|
|
72
|
+
if (entry.isFile() && isUnitDocument(entry.name)) {
|
|
62
73
|
items.push({
|
|
63
74
|
value: entry.name,
|
|
64
75
|
label: stripExtension(entry.name),
|
|
@@ -69,15 +80,13 @@ async function listIntentEntries(root, sourceId, sourceName) {
|
|
|
69
80
|
}
|
|
70
81
|
return items.sort((a, b) => a.label.localeCompare(b.label));
|
|
71
82
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
* `.braid-github-cursor.json` does not disqualify a directory.
|
|
80
|
-
*/
|
|
83
|
+
// A flat document directory has every visible entry a markdown file,
|
|
84
|
+
// with no subdirectories.
|
|
85
|
+
// For one, returns the sorted list of filenames.
|
|
86
|
+
// Returns `undefined` otherwise, so the caller falls back to treating,
|
|
87
|
+
// the directory as a single unit.
|
|
88
|
+
// "Visible" here excludes dotfiles,
|
|
89
|
+
// so sync state like `.braid-github-cursor.json` doesn't disqualify it.
|
|
81
90
|
async function listFlatDocumentFiles(dir) {
|
|
82
91
|
let entries;
|
|
83
92
|
try {
|
|
@@ -94,7 +103,7 @@ async function listFlatDocumentFiles(dir) {
|
|
|
94
103
|
return undefined;
|
|
95
104
|
if (!entry.isFile())
|
|
96
105
|
continue;
|
|
97
|
-
if (!
|
|
106
|
+
if (!isUnitDocument(entry.name))
|
|
98
107
|
return undefined;
|
|
99
108
|
docs.push(entry.name);
|
|
100
109
|
}
|
|
@@ -115,21 +124,21 @@ async function containsDocument(dir, maxDepth) {
|
|
|
115
124
|
for (const entry of entries) {
|
|
116
125
|
if (entry.name.startsWith('.'))
|
|
117
126
|
continue;
|
|
118
|
-
if (entry.isFile() &&
|
|
127
|
+
if (entry.isFile() && isUnitDocument(entry.name))
|
|
119
128
|
return true;
|
|
120
129
|
if (entry.isDirectory() && await containsDocument(join(dir, entry.name), maxDepth - 1))
|
|
121
130
|
return true;
|
|
122
131
|
}
|
|
123
132
|
return false;
|
|
124
133
|
}
|
|
125
|
-
function
|
|
134
|
+
function isUnitDocument(filename) {
|
|
126
135
|
const dot = filename.lastIndexOf('.');
|
|
127
136
|
if (dot < 0)
|
|
128
137
|
return false;
|
|
129
|
-
return
|
|
138
|
+
return UNIT_FILE_EXTENSIONS.has(filename.slice(dot).toLowerCase());
|
|
130
139
|
}
|
|
131
140
|
function stripExtension(filename) {
|
|
132
141
|
const dot = filename.lastIndexOf('.');
|
|
133
142
|
return dot < 0 ? filename : filename.slice(0, dot);
|
|
134
143
|
}
|
|
135
|
-
//# sourceMappingURL=
|
|
144
|
+
//# sourceMappingURL=unitScan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unitScan.js","sourceRoot":"","sources":["../../../src/infrastructure/source/unitScan.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAElD,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAElF,0EAA0E;AAC1E,MAAM,UAAU,kBAAkB,CAAC,QAAwB,EAAE,SAAoB;IAC/E,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,eAAe,CAAC,UAAU,CAAC,CAAA;IAC5E,OAAO,QAAQ,CAAC,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AACrD,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,SAAoB,EAAE,K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AAG,CAAC;YAC5B,SAAQ;QACV,IAAI,KAAK,CAAC,MAAM,EAAE,IAAI,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC;YAC9C,OAAO,IAAI,CAAA;QACb,IAAI,KAAK,CAAC,WAAW,EAAE,IAAI,MAAM,gBAAgB,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC;YACpF,OAAO,IAAI,CAAA;IACf,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,cAAc,CAAC,QAAgB;IACtC,MAAM,GAAG,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;IACrC,IAAI,GAAG,GAAG,CAAC;QACT,OAAO,KAAK,CAAA;IACd,OAAO,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,CAAA;AACpE,CAAC;AAED,SAAS,cAAc,CAAC,QAAgB;IACtC,MAAM,GAAG,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;IACrC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;AACpD,CAAC"}
|
|
@@ -3,8 +3,8 @@ import type { UserId } from '@braidhq/schema';
|
|
|
3
3
|
import type { UserRegistryFile } from './UserRegistryFile.js';
|
|
4
4
|
/**
|
|
5
5
|
* Adapt the file-backed user roster to the core `UserDirectory` port.
|
|
6
|
-
* Returns `null` for unknown ids (bootstrap
|
|
7
|
-
* the git layer falls back to its synthetic author for those rows.
|
|
6
|
+
* Returns `null` for unknown ids (such as bootstrap or `braid-skill`),
|
|
7
|
+
* so the git layer falls back to its synthetic author for those rows.
|
|
8
8
|
*/
|
|
9
9
|
export declare class UserDirectoryFromRegistry implements UserDirectory {
|
|
10
10
|
private readonly registry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserDirectoryFromRegistry.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/users/UserDirectoryFromRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D;;;;GAIG;AACH,qBAAa,yBAA0B,YAAW,aAAa;IACjD,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,gBAAgB;IAEjD,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"UserDirectoryFromRegistry.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/users/UserDirectoryFromRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D;;;;GAIG;AACH,qBAAa,yBAA0B,YAAW,aAAa;IACjD,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,gBAAgB;IAEjD,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;CAU1D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Adapt the file-backed user roster to the core `UserDirectory` port.
|
|
3
|
-
* Returns `null` for unknown ids (bootstrap
|
|
4
|
-
* the git layer falls back to its synthetic author for those rows.
|
|
3
|
+
* Returns `null` for unknown ids (such as bootstrap or `braid-skill`),
|
|
4
|
+
* so the git layer falls back to its synthetic author for those rows.
|
|
5
5
|
*/
|
|
6
6
|
export class UserDirectoryFromRegistry {
|
|
7
7
|
registry;
|
|
@@ -15,6 +15,7 @@ export class UserDirectoryFromRegistry {
|
|
|
15
15
|
return {
|
|
16
16
|
displayName: user.displayName,
|
|
17
17
|
...(user.email ? { email: user.email } : {}),
|
|
18
|
+
...(user.kind ? { kind: user.kind } : {}),
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserDirectoryFromRegistry.js","sourceRoot":"","sources":["../../../src/infrastructure/users/UserDirectoryFromRegistry.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,OAAO,yBAAyB;IACP;IAA7B,YAA6B,QAA0B;QAA1B,aAAQ,GAAR,QAAQ,CAAkB;IAAG,CAAC;IAE3D,KAAK,CAAC,OAAO,CAAC,MAAc;QAC1B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QAC5C,IAAI,CAAC,IAAI;YACP,OAAO,IAAI,CAAA;QACb,OAAO;YACL,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"UserDirectoryFromRegistry.js","sourceRoot":"","sources":["../../../src/infrastructure/users/UserDirectoryFromRegistry.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,OAAO,yBAAyB;IACP;IAA7B,YAA6B,QAA0B;QAA1B,aAAQ,GAAR,QAAQ,CAAkB;IAAG,CAAC;IAE3D,KAAK,CAAC,OAAO,CAAC,MAAc;QAC1B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QAC5C,IAAI,CAAC,IAAI;YACP,OAAO,IAAI,CAAA;QACb,OAAO;YACL,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5C,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1C,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { UserId as UserIdType,
|
|
1
|
+
import type { UserId as UserIdType, UserUpdate as UserPatchType, User as UserType } from '@braidhq/schema';
|
|
2
2
|
/**
|
|
3
3
|
* Persists the user registry to a JSON file at `${BRAID_HOME}/users.json`.
|
|
4
|
-
* Source of truth across server restarts
|
|
4
|
+
* Source of truth across server restarts, in-memory data is a derivation.
|
|
5
5
|
*
|
|
6
|
-
* Auth and ACL are server-side concerns
|
|
7
|
-
*
|
|
8
|
-
* workspace directory.
|
|
6
|
+
* Auth and ACL are server-side concerns, never part of a workspace's git history.
|
|
7
|
+
* Keep this file under `~/.braid/`, not inside any workspace dir.
|
|
9
8
|
*/
|
|
10
9
|
export declare class UserRegistryFile {
|
|
11
10
|
private readonly filePath;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserRegistryFile.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/users/UserRegistryFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"UserRegistryFile.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/users/UserRegistryFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,UAAU,IAAI,aAAa,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAa1G;;;;;;GAMG;AACH,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,MAAM;IAEvC,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAK3B,GAAG,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;IAKlD,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;IAK1D,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;IAMxD,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAWzC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC;IAkB/D,MAAM,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;YAQ7B,IAAI;YAeJ,KAAK;CAIpB"}
|
|
@@ -8,11 +8,10 @@ const RegistryContent = z.object({
|
|
|
8
8
|
});
|
|
9
9
|
/**
|
|
10
10
|
* Persists the user registry to a JSON file at `${BRAID_HOME}/users.json`.
|
|
11
|
-
* Source of truth across server restarts
|
|
11
|
+
* Source of truth across server restarts, in-memory data is a derivation.
|
|
12
12
|
*
|
|
13
|
-
* Auth and ACL are server-side concerns
|
|
14
|
-
*
|
|
15
|
-
* workspace directory.
|
|
13
|
+
* Auth and ACL are server-side concerns, never part of a workspace's git history.
|
|
14
|
+
* Keep this file under `~/.braid/`, not inside any workspace dir.
|
|
16
15
|
*/
|
|
17
16
|
export class UserRegistryFile {
|
|
18
17
|
filePath;
|
|
@@ -52,10 +51,9 @@ export class UserRegistryFile {
|
|
|
52
51
|
if (idx < 0)
|
|
53
52
|
throw new NotFoundError(`User "${id}" not found`);
|
|
54
53
|
const current = content.users[idx];
|
|
55
|
-
// Drop undefined keys so `{ displayName: undefined }` doesn't blow
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
// the non-optional fields to be present.
|
|
54
|
+
// Drop undefined keys, so `{ displayName: undefined }` doesn't blow away the existing displayName.
|
|
55
|
+
// Zod's `.partial()` widens every field to optional,
|
|
56
|
+
// but the persisted User schema still requires the non-optional fields.
|
|
59
57
|
const defined = Object.fromEntries(Object.entries(patch).filter(([, v]) => v !== undefined));
|
|
60
58
|
const merged = { ...current, ...defined };
|
|
61
59
|
content.users[idx] = merged;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserRegistryFile.js","sourceRoot":"","sources":["../../../src/infrastructure/users/UserRegistryFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CACjC,CAAC,CAAA;AAIF
|
|
1
|
+
{"version":3,"file":"UserRegistryFile.js","sourceRoot":"","sources":["../../../src/infrastructure/users/UserRegistryFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;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AM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,KAAK,CAAC,OAAwB;QAC1C,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QACxD,MAAM,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAClF,CAAC;CACF"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { UserId } from '@braidhq/schema';
|
|
2
|
+
import type { WorkspaceRegistryFile } from '../workspace/WorkspaceRegistryFile.js';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Give every ownerless workspace a default owner.
|
|
5
|
+
* A workspace registered before the member model has an empty `members[]`.
|
|
6
|
+
* Single-tenant seeds `defaultOwner` so the install keeps working untouched.
|
|
7
|
+
* Multi-tenant passes null, where an ownerless workspace is a fault,
|
|
8
|
+
* every workspace there is created with an explicit owner, so this throws.
|
|
9
|
+
* Idempotent, workspaces that already have members are left alone.
|
|
7
10
|
*/
|
|
8
|
-
export declare function ensureWorkspaceOwners(registry: WorkspaceRegistryFile): Promise<void>;
|
|
11
|
+
export declare function ensureWorkspaceOwners(registry: WorkspaceRegistryFile, defaultOwner: UserId | null): Promise<void>;
|
|
9
12
|
//# sourceMappingURL=ensureWorkspaceOwners.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureWorkspaceOwners.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/users/ensureWorkspaceOwners.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ensureWorkspaceOwners.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/users/ensureWorkspaceOwners.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAElF;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,qBAAqB,EAC/B,YAAY,EAAE,MAAM,GAAG,IAAI,GAC1B,OAAO,CAAC,IAAI,CAAC,CAef"}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { LOCAL_USER_ID } from './ensureLocalUser.js';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* Give every ownerless workspace a default owner.
|
|
3
|
+
* A workspace registered before the member model has an empty `members[]`.
|
|
4
|
+
* Single-tenant seeds `defaultOwner` so the install keeps working untouched.
|
|
5
|
+
* Multi-tenant passes null, where an ownerless workspace is a fault,
|
|
6
|
+
* every workspace there is created with an explicit owner, so this throws.
|
|
7
|
+
* Idempotent, workspaces that already have members are left alone.
|
|
7
8
|
*/
|
|
8
|
-
export async function ensureWorkspaceOwners(registry) {
|
|
9
|
+
export async function ensureWorkspaceOwners(registry, defaultOwner) {
|
|
9
10
|
const rootPaths = await registry.list();
|
|
10
11
|
const now = new Date().toISOString();
|
|
11
12
|
for (const rootPath of rootPaths) {
|
|
12
13
|
const members = await registry.listMembers(rootPath);
|
|
13
14
|
if (members.length > 0)
|
|
14
15
|
continue;
|
|
16
|
+
if (defaultOwner === null)
|
|
17
|
+
throw new Error(`Workspace at ${rootPath} has no owner, a multi-tenant server requires an explicit owner.`);
|
|
15
18
|
await registry.addMember(rootPath, {
|
|
16
|
-
userId:
|
|
19
|
+
userId: defaultOwner,
|
|
17
20
|
role: 'owner',
|
|
18
21
|
joinedAt: now,
|
|
19
22
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureWorkspaceOwners.js","sourceRoot":"","sources":["../../../src/infrastructure/users/ensureWorkspaceOwners.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ensureWorkspaceOwners.js","sourceRoot":"","sources":["../../../src/infrastructure/users/ensureWorkspaceOwners.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,QAA+B,EAC/B,YAA2B;IAE3B,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;IACvC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAe,CAAA;IACjD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;QACpD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;YACpB,SAAQ;QACV,IAAI,YAAY,KAAK,IAAI;YACvB,MAAM,IAAI,KAAK,CAAC,gBAAgB,QAAQ,kEAAkE,CAAC,CAAA;QAC7G,MAAM,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE;YACjC,MAAM,EAAE,YAAY;YACpB,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,GAAG;SACd,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FsWorkspaceRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/workspace/FsWorkspaceRepository.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAGvE,OAAO,EAAgD,SAAS,EAAE,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACjH,OAAO,EAAE,YAAY,EAAgC,MAAM,iBAAiB,CAAA;AAM5E,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAA;CACzC;AAED,qBAAa,qBAAsB,YAAW,mBAAmB;IAGnD,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqC;gBAE9B,IAAI,EAAE,yBAAyB;IAOtD,IAAI,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAc5B,IAAI,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC;IAShD,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzC,MAAM,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnD,UAAU,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;YAI1B,YAAY;YAcZ,qBAAqB;YAerB,YAAY;IAY1B,OAAO,CAAC,aAAa;CAOtB"}
|
|
@@ -2,8 +2,8 @@ import { readFile, stat } from 'node:fs/promises';
|
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
3
|
import { createLogger, NotFoundError, ValidationError, Workspace } from '@braidhq/core';
|
|
4
4
|
import { AbsolutePath, ProductManifest, WorkspaceId } from '@braidhq/schema';
|
|
5
|
-
import { parseMarkdownFrontmatter } from '
|
|
6
|
-
import { workspaceProductManifestPath } from '
|
|
5
|
+
import { parseMarkdownFrontmatter } from '../_shared/frontmatter.js';
|
|
6
|
+
import { workspaceProductManifestPath } from '../_shared/paths.js';
|
|
7
7
|
const log = createLogger('server').child({ mod: 'workspace-repo' });
|
|
8
8
|
export class FsWorkspaceRepository {
|
|
9
9
|
deps;
|
|
@@ -11,10 +11,11 @@ export class FsWorkspaceRepository {
|
|
|
11
11
|
constructor(deps) {
|
|
12
12
|
this.deps = deps;
|
|
13
13
|
}
|
|
14
|
-
// One unreadable rootPath
|
|
15
|
-
// must not starve the rest.
|
|
16
|
-
//
|
|
17
|
-
//
|
|
14
|
+
// One unreadable rootPath, a deleted dir or a broken PRODUCT.md,
|
|
15
|
+
// must not starve the rest.
|
|
16
|
+
// The asymmetry with `load()` is deliberate.
|
|
17
|
+
// Aggregate views recover,
|
|
18
|
+
// whereas a single-entity lookup must tell present apart from absent.
|
|
18
19
|
async list() {
|
|
19
20
|
const rootPaths = await this.deps.registry.list();
|
|
20
21
|
const workspaces = [];
|