@braidhq/server 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +134 -106
- package/dist/app.d.ts +7 -15
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +72 -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 +79 -0
- package/dist/composeApp.d.ts.map +1 -0
- package/dist/composeApp.js +136 -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} +118 -125
- 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 +15 -18
- package/dist/infrastructure/auth/SessionStore.js.map +1 -1
- package/dist/infrastructure/batch/FsBatchPlanRepository.d.ts +79 -0
- package/dist/infrastructure/batch/FsBatchPlanRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs → batch}/FsBatchPlanRepository.js +1 -1
- 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/{fs/FsClarifyTicketRepository.js → hitl/FsClarificationRepository.js} +15 -15
- 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 +7 -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 +96 -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/{fs → source}/intentScan.d.ts +4 -0
- package/dist/infrastructure/source/intentScan.d.ts.map +1 -0
- package/dist/infrastructure/{fs → source}/intentScan.js +18 -16
- package/dist/infrastructure/source/intentScan.js.map +1 -0
- package/dist/infrastructure/users/UserDirectoryFromRegistry.d.ts +2 -2
- package/dist/infrastructure/users/UserDirectoryFromRegistry.js +2 -2
- 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 +59 -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 +243 -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/proposals.d.ts +2 -2
- package/dist/routes/proposals.d.ts.map +1 -1
- package/dist/routes/proposals.js +30 -28
- 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 +43 -45
- 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 +139 -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 +97 -69
- package/dist/routes/workspaces.js.map +1 -1
- package/dist/server.js +6 -70
- package/dist/server.js.map +1 -1
- 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 +9 -9
- 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.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.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,16 @@
|
|
|
1
|
+
import type { SkillEvent } from '@braidhq/schema';
|
|
2
|
+
import type { ChildProcess } from 'node:child_process';
|
|
3
|
+
/**
|
|
4
|
+
* Maps one stdout line to zero or more SkillEvents.
|
|
5
|
+
* The agent binding owns this, since the line format is the agent's own.
|
|
6
|
+
*/
|
|
7
|
+
export type LineParser = (line: string, now: string) => SkillEvent[];
|
|
8
|
+
/**
|
|
9
|
+
* Wires a child's stdout and stderr to a single SkillEvent callback.
|
|
10
|
+
* `parseLine` comes from the agent binding, so this stays format-agnostic.
|
|
11
|
+
* Returns `flush` so callers can drain the final un-terminated line on `close`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function attachOutputBuffers(child: ChildProcess, parseLine: LineParser, onEvent: (event: SkillEvent) => void, now: () => string): {
|
|
14
|
+
flush: () => void;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=subprocessEventStream.d.ts.map
|
|
@@ -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":"A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type { SourceUnitDigest, Workspace } from '@braidhq/core';
|
|
2
|
+
import type { SourceId, SourceUnitSha } from '@braidhq/schema';
|
|
3
|
+
/**
|
|
4
|
+
* 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,C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AM,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACnE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
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,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|
|
8
|
+
/**
|
|
9
|
+
* Shared by the Studio source picker and BatchService,
|
|
10
|
+
* so both see the same per-doc granularity.
|
|
11
|
+
*/
|
|
8
12
|
export declare function listIntentItems(workspace: Workspace): Promise<IntentItem[]>;
|
|
9
13
|
//# sourceMappingURL=intentScan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intentScan.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/source/intentScan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAM9C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAcjF"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { readdir } from 'node:fs/promises';
|
|
2
2
|
import { isAbsolute, join } from 'node:path';
|
|
3
3
|
const INTENT_FILE_EXTENSIONS = new Set(['.md', '.mdx', '.markdown', '.txt', '.rst']);
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Shared by the Studio source picker and BatchService,
|
|
6
|
+
* so both see the same per-doc granularity.
|
|
7
|
+
*/
|
|
5
8
|
export async function listIntentItems(workspace) {
|
|
6
9
|
const items = [];
|
|
7
10
|
for (const source of workspace.sources) {
|
|
8
11
|
if (source.role !== 'intent')
|
|
9
12
|
continue;
|
|
10
13
|
if (source.kind !== 'filesystem')
|
|
11
|
-
// MCP intent sources aren't directory-listable
|
|
14
|
+
// MCP intent sources aren't directory-listable, future enhancement.
|
|
12
15
|
continue;
|
|
13
16
|
const absoluteRoot = isAbsolute(source.path)
|
|
14
17
|
? source.path
|
|
@@ -31,11 +34,12 @@ async function listIntentEntries(root, sourceId, sourceName) {
|
|
|
31
34
|
continue;
|
|
32
35
|
if (entry.isDirectory()) {
|
|
33
36
|
const folder = join(root, entry.name);
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
//
|
|
37
|
+
// A flat directory of loose markdown files gives one unit per file,
|
|
38
|
+
// so downstream skills run per-document rather than over the bag all at once.
|
|
39
|
+
// Such layouts include a github loader's issues tree,
|
|
40
|
+
// or a hand-curated prd folder of onboarding docs.
|
|
41
|
+
// A directory with its own sub-structure stays a single unit,
|
|
42
|
+
// since that structure is the unit's own organisation.
|
|
39
43
|
const flatFiles = await listFlatDocumentFiles(folder);
|
|
40
44
|
if (flatFiles) {
|
|
41
45
|
for (const name of flatFiles) {
|
|
@@ -69,15 +73,13 @@ async function listIntentEntries(root, sourceId, sourceName) {
|
|
|
69
73
|
}
|
|
70
74
|
return items.sort((a, b) => a.label.localeCompare(b.label));
|
|
71
75
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
* `.braid-github-cursor.json` does not disqualify a directory.
|
|
80
|
-
*/
|
|
76
|
+
// A flat document directory has every visible entry a markdown file,
|
|
77
|
+
// with no subdirectories.
|
|
78
|
+
// For one, returns the sorted list of filenames.
|
|
79
|
+
// Returns `undefined` otherwise, so the caller falls back to treating,
|
|
80
|
+
// the directory as a single unit.
|
|
81
|
+
// "Visible" here excludes dotfiles,
|
|
82
|
+
// so sync state like `.braid-github-cursor.json` doesn't disqualify it.
|
|
81
83
|
async function listFlatDocumentFiles(dir) {
|
|
82
84
|
let entries;
|
|
83
85
|
try {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intentScan.js","sourceRoot":"","sources":["../../../src/infrastructure/source/intentScan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE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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,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;
|
|
@@ -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":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,CAAA;YACnG,OAAO,MAAM,CAAC,IAAI,CAAA;QACpB,CAAC;QACD,OAAO,KAAK,EAAE,CAAC;YACb,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;gBACpD,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;YACtB,MAAM,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 = [];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FsWorkspaceRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/workspace/FsWorkspaceRepository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,EAA4B,MAAM,eAAe,CAAA;AACjH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAA;AAElE,MAAM,GAAG,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,gBAAgB,EAAE,CAAC,CAAA;AAMnE,MAAM,OAAO,qBAAqB;IAGH;IAFZ,KAAK,GAAG,IAAI,GAAG,EAA2B,CAAA;IAE3D,YAA6B,IAA+B;QAA/B,SAAI,GAAJ,IAAI,CAA2B;IAAG,CAAC;IAEhE,iEAAiE;IACjE,4BAA4B;IAC5B,6CAA6C;IAC7C,2BAA2B;IAC3B,sEAAsE;IACtE,KAAK,CAAC,IAAI;QACR,MAAM,SAAS,GAAG,MAAM,IAAI,CAA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AAC,YAAY,EAAE,OAAO,CAAC,CAAA;QAC9C,CAAC;QACD,OAAO,KAAK,EAAE,CAAC;YACb,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACvD,MAAM,IAAI,aAAa,CAAC,4BAA4B,YAAY,GAAG,CAAC,CAAA;YACtE,CAAC;YACD,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;IAEO,aAAa,CAAC,GAAY,EAAE,YAAoB;QACtD,MAAM,MAAM,GAAG,eAAe,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;QAC7C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,eAAe,CAAC,0BAA0B,YAAY,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QAC/F,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAA;IACpB,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { WorkspaceService } from '@braidhq/core';
|
|
2
|
+
import type { AbsolutePath } from '@braidhq/schema';
|
|
3
|
+
/**
|
|
4
|
+
* Walk `<workspacesRoot>/*` and register with the WorkspaceService,
|
|
5
|
+
* every subdirectory that owns a `PRODUCT.md`.
|
|
6
|
+
* It is idempotent,
|
|
7
|
+
* an already-registered workspace is a no-op against the FS registry.
|
|
8
|
+
* We run it on server boot,
|
|
9
|
+
* so CLI-created or hand-copied workspaces surface in Studio,
|
|
10
|
+
* without any explicit `register` step.
|
|
11
|
+
*
|
|
12
|
+
* A per-entry error, a corrupt PRODUCT.md or bad permissions,
|
|
13
|
+
* is logged and skipped.
|
|
14
|
+
* The server must still come up,
|
|
15
|
+
* so the user can fix the outlier and re-boot.
|
|
16
|
+
*/
|
|
17
|
+
export declare function discoverCanonicalWorkspaces(workspacesRoot: AbsolutePath, workspaceService: WorkspaceService): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=WorkspaceDiscovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkspaceDiscovery.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/workspace/WorkspaceDiscovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAKnD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,2BAA2B,CAC/C,cAAc,EAAE,YAAY,EAC5B,gBAAgB,EAAE,gBAAgB,GACjC,OAAO,CAAC,IAAI,CAAC,CAgCf"}
|