@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
package/README.md
CHANGED
|
@@ -1,136 +1,164 @@
|
|
|
1
1
|
# @braidhq/server
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
exposed at `GET /openapi.json` for any consumer that wants typed
|
|
5
|
-
access to the graph operations.
|
|
3
|
+
Braid keeps a product's intent and its code aligned in one knowledge graph. `@braidhq/server` is the process that runs it. It wires core's ports to real filesystem, git, and vendor adapters, exposes the graph over HTTP, and drives the agents that fill it.
|
|
6
4
|
|
|
7
|
-
##
|
|
5
|
+
## Role
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
the server through MCP tools, not curl. The wiring runs the gateway
|
|
11
|
-
as a **per-skill stdio child of claude** — no long-running HTTP
|
|
12
|
-
server, gateway lifecycle tracks the skill run automatically.
|
|
7
|
+
Server is the composition root and the presentation layer. It turns the framework into a running application.
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
│ (this package) │ ────── REST ────▶ │ (uvx, stdio child) │
|
|
18
|
-
└──────────────────┘ └─────────────────────┘
|
|
19
|
-
▲ stdin/stdout
|
|
20
|
-
│ MCP
|
|
21
|
-
┌─────────────────────┐
|
|
22
|
-
│ spawned claude │
|
|
23
|
-
│ subprocess (skill) │
|
|
24
|
-
└─────────────────────┘
|
|
25
|
-
```
|
|
9
|
+
- **The Wiring**: The composition root that binds core's ports to concrete adapters, the one place infrastructure is instantiated.
|
|
10
|
+
- **The Adapters**: Filesystem and git implementations of core's repositories and history, plus the subprocess runner that executes skills.
|
|
11
|
+
- **The API**: A REST and SSE surface built on Hono, one router per resource, with authentication, workspace scoping, and an OpenAPI 3 spec at `GET /openapi.json`.
|
|
26
12
|
|
|
27
|
-
|
|
13
|
+
## Positioning: framework kernel and worldview preset
|
|
28
14
|
|
|
29
|
-
|
|
30
|
-
gateway is launched on demand by claude via `uvx` (UV's "run an
|
|
31
|
-
ephemeral package" command), so the only thing you have to install
|
|
32
|
-
locally is the `uv` runtime itself:
|
|
15
|
+
Braid is worldview-agnostic. The intent-graph engine, workspaces, proposals, HITL review, the reactor, and the authorization policy, knows nothing about software. A worldview supplies the rest: an ontology plus the storage, source loaders, and agent that serve it. The software worldview, a DDD ontology whose sources split into `intent` and `code`, is the default, not a built-in.
|
|
33
16
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
17
|
+
Two layers share this package for now.
|
|
18
|
+
|
|
19
|
+
- **Kernel**: `composeApp`, routes, middleware, policy, auth mode, and the generic filesystem infrastructure. Worldview-agnostic. `composeApp` registers no plugin, a caller hands it a `PluginRegistry`. Nothing here imports a concrete ontology, storage, loader, or agent.
|
|
20
|
+
- **Coding preset**: `composeFsApp` assembles the default bundle, Kuzu storage, the DDD ontology, the git, github, and drive loaders, and the claude-code agent, over filesystem persistence. Its default identities live as `DEFAULT_*` constants at the head of the file.
|
|
21
|
+
|
|
22
|
+
A future app, a story world or a research-notes base, reuses the kernel and swaps the preset for its own ontology and adapters. When that second worldview arrives, the coding preset extracts into its own package, `@braidhq/preset-code`, and this package drops its plugin dependencies. Until a second worldview exists that pressure is speculative, so both layers stay here at no cost. The seam is `composeApp`: whatever the kernel reaches without a concrete plugin already belongs to it.
|
|
23
|
+
|
|
24
|
+
## Structure
|
|
39
25
|
|
|
40
|
-
The
|
|
41
|
-
found, you'll see:
|
|
26
|
+
The package layers outward from core. Infrastructure implements core's ports, routes expose them, and composition binds the two.
|
|
42
27
|
|
|
43
28
|
```
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
29
|
+
src/
|
|
30
|
+
├── server.ts process entry, serves the app
|
|
31
|
+
├── app.ts builds the Hono app, mounts middleware and routes
|
|
32
|
+
├── composeApp.ts the worldview-agnostic kernel root
|
|
33
|
+
├── composeFsApp.ts the coding preset, filesystem and vendor adapters
|
|
34
|
+
├── startup.ts blocking per-workspace boot steps
|
|
35
|
+
├── authMode.ts AuthMode strategy, localTrust and authenticated
|
|
36
|
+
├── routes/ one router per resource
|
|
37
|
+
├── middleware/ auth, cors, error mapping, workspace scoping
|
|
38
|
+
├── policy/ authorization rules
|
|
39
|
+
└── infrastructure/ adapters behind core ports, one folder per domain concern
|
|
40
|
+
├── hitl/ proposal and clarification stores
|
|
41
|
+
├── workspace/ workspace repository, registry, discovery, PRODUCT.md writer
|
|
42
|
+
├── skill/ skill registry, run store, subprocess runner and its event stream
|
|
43
|
+
├── source/ source unit observations, digests, intent listing
|
|
44
|
+
├── model/ graph serializer
|
|
45
|
+
├── reactor/ reactor cycle store
|
|
46
|
+
├── batch/ batch plan store
|
|
47
|
+
├── history/ GitWorkspaceHistory, commit messages
|
|
48
|
+
├── users/, auth/, secrets/, oauth/ host services, no core port
|
|
49
|
+
└── _shared/ cross-cutting fs plumbing, paths, json store, frontmatter
|
|
47
50
|
```
|
|
48
51
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
"braid-core": {
|
|
60
|
-
"type": "stdio",
|
|
61
|
-
"command": "uvx",
|
|
62
|
-
"args": [
|
|
63
|
-
"openapi-mcp-gateway",
|
|
64
|
-
"--spec",
|
|
65
|
-
"http://127.0.0.1:4321/openapi.json",
|
|
66
|
-
"--transport",
|
|
67
|
-
"stdio",
|
|
68
|
-
"--name",
|
|
69
|
-
"braid-core"
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
```
|
|
52
|
+
- **composeApp / composeFsApp**: The kernel root and the coding preset. `composeApp` takes a deps object, registers no plugin, and defaults every unset port to an in-memory adapter. `composeFsApp` builds the filesystem, git, and vendor adapters, registers the default plugin bundle, then hands the result to `composeApp`. Production runs the latter. See Positioning above.
|
|
53
|
+
- **startup**: The two boot passes, `startupBeforeServe` and `startupAfterServe`. See Startup below for the full order.
|
|
54
|
+
- **infrastructure**: The real adapters behind core's ports, grouped by domain concern to mirror `core/domain`, never by storage technology. Each folder owns one aggregate's adapter, so a future SQLite or Postgres store lands beside the filesystem one instead of in a separate `sql/` tree. `hitl/` persists proposals and clarifications, `workspace/` the graph and workspace files, `history/` records every change as a git commit, `skill/` runs a skill as a subprocess and streams its events back. `_shared/` holds the cross-cutting fs plumbing, its underscore marking it as the one folder that is not a domain concern, matching `routes/_shared.ts`. `users/ auth/ secrets/ oauth/` are host services with no core port.
|
|
55
|
+
- **routes**: One `createXxxRouter(deps)` per resource, each taking only the services it needs. Bodies validate through zod, path ids parse through their branded schema.
|
|
56
|
+
- **middleware**: The cross-cutting edge. Auth resolves the user, workspace middleware scopes and authorizes the request, and the error middleware maps `BraidError` subclasses to problem+json status codes.
|
|
57
|
+
|
|
58
|
+
## Startup
|
|
59
|
+
|
|
60
|
+
The blocking phase runs inside `composeFsApp` before the server accepts a request, in two groups.
|
|
74
61
|
|
|
75
|
-
|
|
76
|
-
running Braid server, and the REST surface becomes MCP tools for the
|
|
77
|
-
duration of the skill run.
|
|
62
|
+
Provision host identity, who may use this server:
|
|
78
63
|
|
|
79
|
-
|
|
80
|
-
`openapi-mcp-gateway` under `~/.cache/uv/`). Subsequent runs hit the
|
|
81
|
-
cache.
|
|
64
|
+
1. `authMode.provision` seeds what the deployment's mode needs. Local trust seeds the `local-user` fallback account, authenticated mode syncs the login allowlist to the user roster. See Auth Mode below.
|
|
82
65
|
|
|
83
|
-
|
|
66
|
+
Reconcile workspaces, register then boot each:
|
|
84
67
|
|
|
85
|
-
|
|
68
|
+
2. `discoverCanonicalWorkspaces` registers workspaces present on disk but absent from the registry.
|
|
69
|
+
3. `ensureWorkspaceOwners` gives any ownerless workspace the auth mode's default principal, or throws under authenticated mode where every workspace must have an explicit owner.
|
|
70
|
+
4. `startupBeforeServe` runs the per-workspace pass. Per workspace it provisions the git repo and store, recovers a batch left running by a killed process, subscribes the reactor when the workspace opts in, and fires a catch-up sync for each loader-backed source.
|
|
86
71
|
|
|
87
|
-
|
|
88
|
-
- `braid_get_scope(workspaceId, nodeId, depth)`
|
|
89
|
-
- `braid_get_ontology(workspaceId)`
|
|
90
|
-
- `braid_submit_proposal(workspaceId, operations, generatedBy, rationale)`
|
|
91
|
-
- `braid_submit_clarify(workspaceId, question, candidates)`
|
|
92
|
-
- `braid_mark_clarify_applied(workspaceId, clarifyTicketId, status, userId, proposalId?)`
|
|
93
|
-
- …and the rest, one per operation in `/openapi.json`.
|
|
72
|
+
After `serve()`, the background phase runs cosmetic recovery that need not finish first, via `startupAfterServe`:
|
|
94
73
|
|
|
95
|
-
|
|
96
|
-
(typically `<server-name>_<operationId>` with snake_case
|
|
97
|
-
normalisation). Inspect the spec or the gateway's `tools/list`
|
|
98
|
-
response to see live names.
|
|
74
|
+
5. `reapOrphanRuns` marks runs left without a completion, from a killed process, as aborted so the UI does not show them active forever.
|
|
99
75
|
|
|
100
|
-
|
|
76
|
+
Both passes live in `startup.ts`, `startupBeforeServe` before `serve()` and `startupAfterServe` after. A new blocking per-workspace step is added to `startupBeforeServe`, a new background step to `startupAfterServe`. Provisioning tied to one adapter stays next to that adapter's construction. Source loaders take part without a bespoke step, the sync in step 4 fires for any registered loader.
|
|
101
77
|
|
|
102
|
-
|
|
103
|
-
toolchains) you can pin a specific `uvx` binary via the
|
|
104
|
-
`BRAID_UVX_BIN` env var. composeFs preflight-checks the pinned
|
|
105
|
-
binary; if it's not executable, the gateway entry is skipped same as
|
|
106
|
-
when `uv` is missing entirely.
|
|
78
|
+
## Auth Mode
|
|
107
79
|
|
|
108
|
-
|
|
109
|
-
|
|
80
|
+
One axis separates a trusted local install from an authenticated remote server, who the implicit user is. Rather than scatter that decision, an `AuthMode` strategy carries it, and the auth and ownership code reads the strategy, never a hardcoded `local-user`.
|
|
81
|
+
|
|
82
|
+
```mermaid
|
|
83
|
+
classDiagram
|
|
84
|
+
class AuthMode {
|
|
85
|
+
<<interface>>
|
|
86
|
+
+defaultPrincipal: UserId | null
|
|
87
|
+
+requiresAuth: boolean
|
|
88
|
+
+provision(context) Promise
|
|
89
|
+
}
|
|
90
|
+
class localTrust {
|
|
91
|
+
<<const>>
|
|
92
|
+
defaultPrincipal = local-user
|
|
93
|
+
requiresAuth = false
|
|
94
|
+
provision() seeds local-user
|
|
95
|
+
}
|
|
96
|
+
class authenticated {
|
|
97
|
+
<<const>>
|
|
98
|
+
defaultPrincipal = null
|
|
99
|
+
requiresAuth = true
|
|
100
|
+
provision() syncs allowlist
|
|
101
|
+
}
|
|
102
|
+
AuthMode <|.. localTrust
|
|
103
|
+
AuthMode <|.. authenticated
|
|
110
104
|
```
|
|
111
105
|
|
|
112
|
-
|
|
106
|
+
Two consumers read the strategy, neither a hardcoded account. `authMiddleware` resolves the caller, applying the Bearer gate under `requiresAuth` and falling back to `defaultPrincipal` when one is present. `ensureWorkspaceOwners` gives an ownerless workspace the principal, or throws when there is none.
|
|
107
|
+
|
|
108
|
+
`composeFsApp` picks the mode from `BRAID_LOCAL_TRUST`, local trust by default. Adding a mode, a service account or an SSO-only deployment, is a new `AuthMode`, with no change to the middleware, the ownership code, or boot.
|
|
109
|
+
|
|
110
|
+
## Authorization
|
|
111
|
+
|
|
112
|
+
Every gated action is a capability. The server is the authoritative check, and Studio mirrors the same list to grey out affordances it cannot use. The authoritative logic is `packages/server/src/policy/checks.ts`, the matrix below is a readable mirror of it.
|
|
113
|
+
|
|
114
|
+
### Where the decision happens
|
|
115
|
+
|
|
116
|
+
A request's permission is decided in three steps, all under `policy/`.
|
|
117
|
+
|
|
118
|
+
1. `resolveViewer(user, member)` builds a `ViewerContext` once per request, the caller's `effectiveRole` in this workspace. It is the sole place a server admin short-circuits to an `owner` role.
|
|
119
|
+
2. `workspaceAccessMiddleware` runs `resolveViewer`, stamps the viewer on the request, and rejects an outright outsider. `requirePermission(cap)` and the server-scope `requireServerCapability(cap)` are the route gates that read it.
|
|
120
|
+
3. `PermissionRegistry.can(capability, viewer)` finds the capability's check and evaluates it against the viewer. An unregistered capability denies by default.
|
|
121
|
+
|
|
122
|
+
Each capability owns one pure check in `checks.ts`, a stateless const object. Plugins register their own checks on the same registry, so adding a capability never edits an existing one.
|
|
123
|
+
|
|
124
|
+
### Capability matrix
|
|
125
|
+
|
|
126
|
+
Workspace roles resolve from membership. `admin` is the server role, which short-circuits to an `owner` effectiveRole in any workspace, so an admin holds every workspace capability below.
|
|
127
|
+
|
|
128
|
+
| Capability | owner | maintainer | member | Notes |
|
|
129
|
+
|---|:--:|:--:|:--:|---|
|
|
130
|
+
| `server.admin` | n/a | n/a | n/a | Server role `admin` only. Gates `/admin`, read from the server role, not `effectiveRole`, since a workspace owner also resolves to `owner`. |
|
|
131
|
+
| `workspace.create` | n/a | n/a | n/a | Server scope, resolved with no member, so only a server admin passes. |
|
|
132
|
+
| `workspace.read` | yes | yes | yes | Any member. |
|
|
133
|
+
| `workspace.write` | yes | | | Owner only. |
|
|
134
|
+
| `proposal.read` | yes | yes | | Owner or maintainer. |
|
|
135
|
+
| `proposal.write` | yes | yes | | Owner or maintainer. |
|
|
136
|
+
| `clarification.read` | yes | yes | | Owner or maintainer. |
|
|
137
|
+
| `clarification.write` | yes | yes | | Owner or maintainer. |
|
|
138
|
+
| `history.write` | yes | | | Owner only. |
|
|
139
|
+
| `skill.run` | yes | maybe | maybe | Owner always. Otherwise the skill's `allowedRoles`, overridden per member by `skillOverrides`. |
|
|
140
|
+
|
|
141
|
+
## Boundaries
|
|
142
|
+
|
|
143
|
+
These are the rules for anyone editing server. They are enforced in review rather than by tooling.
|
|
144
|
+
|
|
145
|
+
- **Composition Only Here**: Infrastructure concretes are instantiated at the composition root, never inside a route or a service.
|
|
146
|
+
- **Routes Stay Thin**: A route validates input, calls one service, and shapes the response. Business rules live in core, not in the handler.
|
|
147
|
+
- **Adapters Implement Ports**: Every fs, git, or agent class satisfies an interface declared in core, so swapping one never touches the framework.
|
|
148
|
+
- **Errors Map at the Edge**: Domain code throws a `BraidError`, and the error middleware is the only place that turns it into an HTTP status.
|
|
149
|
+
- **Scope Through Middleware**: Workspace access is checked once in middleware, not re-derived inside each route.
|
|
150
|
+
|
|
151
|
+
## Dependencies
|
|
113
152
|
|
|
114
|
-
|
|
153
|
+
Server sits at the outer edge, above core and the plugin packages the coding preset bundles as defaults.
|
|
115
154
|
|
|
116
|
-
-
|
|
117
|
-
|
|
118
|
-
`/openapi.json` and REST endpoints, with auth headers passed
|
|
119
|
-
through workspace-level MCP server config.
|
|
120
|
-
- If claude runs in the cloud (browser Studio): the stdio path runs
|
|
121
|
-
server-side, gateway loopbacks to the local server.
|
|
155
|
+
- **Depends On**: `@braidhq/core` and `@braidhq/schema`, `hono` for HTTP, `simple-git` for history, and, only through the coding preset, the default plugin bundle of `storage-kuzu`, `agent-claude-code`, `ontology-ddd`, and `source-loader-*`. The kernel itself needs none of the plugin packages; they leave with the preset when it extracts. See Positioning.
|
|
156
|
+
- **Consumed By**: `cli` and the `desktop` Tauri shell, which run it as their backend.
|
|
122
157
|
|
|
123
|
-
|
|
124
|
-
so workspaces can declare any third-party HTTP MCP server (Redmine /
|
|
125
|
-
Notion / Linear / …) alongside the stdio braid-core. The two
|
|
126
|
-
transports are not mutually exclusive.
|
|
158
|
+
## MCP Gateway
|
|
127
159
|
|
|
128
|
-
|
|
160
|
+
Skills run as coding-agent subprocesses and reach this server's REST API as MCP tools, not by curl. An off-the-shelf translator, `openapi-mcp-gateway`, reads `/openapi.json` and re-exposes each operation as a tool named `braid-core`.
|
|
129
161
|
|
|
130
|
-
-
|
|
131
|
-
`/workspaces/{ws}/events`) — not invocable as one-shot MCP tools.
|
|
132
|
-
- OAuth callbacks (`/oauth/google/callback`) — HTML response.
|
|
133
|
-
- Workspace management (`/workspaces/*`) — admin surface for CLI
|
|
134
|
-
and Studio, not for skills.
|
|
162
|
+
The gateway is spawned per skill run and torn down with it, so there is no long-lived gateway process, no open port, and no network auth to manage. The transport is an implementation detail of the runner.
|
|
135
163
|
|
|
136
|
-
The `GET /openapi.json` test in `test/app.test.ts` pins
|
|
164
|
+
SSE streams, the OAuth HTML callback, and the workspace-admin routes are deliberately absent from the spec, they are not one-shot MCP tools. The `GET /openapi.json` test in `test/app.test.ts` pins that boundary.
|
package/dist/app.d.ts
CHANGED
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
import type { AppDependencies } from './
|
|
1
|
+
import type { AppDependencies } from './composeApp.js';
|
|
2
2
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
3
3
|
export interface AppOptions {
|
|
4
4
|
readonly corsOrigins?: readonly string[];
|
|
5
5
|
/**
|
|
6
|
-
* Base URL the OpenAPI spec advertises in its `servers[]` block.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* composeFsApp threads its `apiUrl`
|
|
11
|
-
*
|
|
12
|
-
* `--base-url` flag.
|
|
6
|
+
* Base URL the OpenAPI spec advertises in its `servers[]` block.
|
|
7
|
+
* Downstream consumers use it to dispatch REST calls,
|
|
8
|
+
* openapi-mcp-gateway, Swagger UI, and code generators among them.
|
|
9
|
+
* When unset, the spec omits `servers[]` and leaves the consumer to guess.
|
|
10
|
+
* `composeFsApp` threads its `apiUrl` here,
|
|
11
|
+
* so the gateway routes calls back without an explicit base-url flag.
|
|
13
12
|
*/
|
|
14
13
|
readonly apiUrl?: string;
|
|
15
|
-
/**
|
|
16
|
-
* When true (or `BRAID_LOCAL_TRUST=true`), the auth middleware lets
|
|
17
|
-
* every request through and the embedded `userIdMiddleware` falls
|
|
18
|
-
* back to `local-user`. Set by `composeFs` for the Tauri sidecar;
|
|
19
|
-
* production remote servers leave it `false`.
|
|
20
|
-
*/
|
|
21
|
-
readonly localTrust?: boolean;
|
|
22
14
|
}
|
|
23
15
|
export declare function createApp(deps: AppDependencies, options?: AppOptions): OpenAPIHono;
|
|
24
16
|
//# sourceMappingURL=app.d.ts.map
|
package/dist/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AA8B/C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxC;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,GAAE,UAAe,GAAG,WAAW,CAqMtF"}
|
package/dist/app.js
CHANGED
|
@@ -2,14 +2,12 @@ import { OpenAPIHono } from '@hono/zod-openapi';
|
|
|
2
2
|
import { authMiddleware } from './middleware/auth.js';
|
|
3
3
|
import { corsMiddleware } from './middleware/cors.js';
|
|
4
4
|
import { errorHandler } from './middleware/error.js';
|
|
5
|
-
import { userIdMiddleware } from './middleware/userId.js';
|
|
6
5
|
import { workspaceAccessMiddleware } from './middleware/workspaceAccess.js';
|
|
7
6
|
import { workspaceIdMiddleware } from './middleware/workspaceId.js';
|
|
8
7
|
import { createAdminRouter } from './routes/admin.js';
|
|
9
8
|
import { createAuthRouter } from './routes/auth.js';
|
|
10
9
|
import { createBatchRouter } from './routes/batch.js';
|
|
11
|
-
import {
|
|
12
|
-
import { createDecisionsRouter } from './routes/decisions.js';
|
|
10
|
+
import { createClarificationRouter } from './routes/clarifications.js';
|
|
13
11
|
import { createEdgesRouter } from './routes/edges.js';
|
|
14
12
|
import { healthRouter } from './routes/health.js';
|
|
15
13
|
import { createHistoryRouter } from './routes/history.js';
|
|
@@ -18,38 +16,33 @@ import { createNodesRouter } from './routes/nodes.js';
|
|
|
18
16
|
import { createOAuthRouter } from './routes/oauth.js';
|
|
19
17
|
import { createOntologyRouter } from './routes/ontology.js';
|
|
20
18
|
import { createProposalsRouter } from './routes/proposals.js';
|
|
19
|
+
import { createReactorCyclesRouter } from './routes/reactorCycles.js';
|
|
21
20
|
import { createRunsRouter } from './routes/runs.js';
|
|
22
21
|
import { createSkillInputOptionsRouter } from './routes/skillInputOptions.js';
|
|
23
22
|
import { createSkillsRouter } from './routes/skills.js';
|
|
24
23
|
import { createSourceLoadersRouter } from './routes/sourceLoaders.js';
|
|
25
|
-
import {
|
|
24
|
+
import { createSourceUnitObservationsRouter } from './routes/sourceUnitObservations.js';
|
|
25
|
+
import { createGithubWebhookReceiver, createSourceWebhooksAdminRouter } from './routes/sourceWebhooks.js';
|
|
26
26
|
import { createUsersRouter } from './routes/users.js';
|
|
27
27
|
import { createWorkspaceEventsRouter } from './routes/workspaceEvents.js';
|
|
28
28
|
import { createTransferOwnershipRouter, createWorkspaceMembersRouter } from './routes/workspaceMembers.js';
|
|
29
29
|
import { createWorkspacesRouter } from './routes/workspaces.js';
|
|
30
30
|
export function createApp(deps, options = {}) {
|
|
31
31
|
const app = new OpenAPIHono();
|
|
32
|
+
// Global middleware, every request passes these in order.
|
|
32
33
|
app.use('*', options.corsOrigins
|
|
33
34
|
? corsMiddleware({ allowedOrigins: options.corsOrigins })
|
|
34
35
|
: corsMiddleware());
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
sessionStore: deps.sessionStore,
|
|
44
|
-
localTrust,
|
|
45
|
-
}));
|
|
46
|
-
}
|
|
47
|
-
// Phase A identity. Stamps `c.set('userId', ...)` from `X-Braid-User`
|
|
48
|
-
// when the auth layer left it empty — i.e. local-trust mode, or any
|
|
49
|
-
// public route. Bearer-authenticated requests already have a userId
|
|
50
|
-
// by the time this runs and pass through untouched.
|
|
51
|
-
app.use('*', userIdMiddleware);
|
|
36
|
+
// Identity and auth gate. Resolves the caller's `userId` from a Bearer session
|
|
37
|
+
// when auth is enforced, else the `X-Braid-User` header or the default principal.
|
|
38
|
+
// Non-public routes that lack a required Bearer token are rejected.
|
|
39
|
+
app.use('*', authMiddleware({
|
|
40
|
+
...(deps.sessionStore ? { sessionStore: deps.sessionStore } : {}),
|
|
41
|
+
requireAuth: deps.authMode.requiresAuth,
|
|
42
|
+
defaultPrincipal: deps.authMode.defaultPrincipal,
|
|
43
|
+
}));
|
|
52
44
|
app.onError(errorHandler);
|
|
45
|
+
// Host-level routes, not scoped to a single workspace.
|
|
53
46
|
app.route('/health', healthRouter);
|
|
54
47
|
if (deps.sessionStore && deps.accessPolicy && deps.userRegistry) {
|
|
55
48
|
app.route('/auth', createAuthRouter({
|
|
@@ -59,13 +52,12 @@ export function createApp(deps, options = {}) {
|
|
|
59
52
|
userRegistry: deps.userRegistry,
|
|
60
53
|
...(deps.googleOAuth ? { googleOAuth: deps.googleOAuth } : {}),
|
|
61
54
|
studioUrl: deps.studioUrl ?? 'http://localhost:5173',
|
|
62
|
-
|
|
55
|
+
requiresAuth: deps.authMode.requiresAuth,
|
|
63
56
|
}));
|
|
64
57
|
}
|
|
65
58
|
if (deps.userRegistry) {
|
|
66
59
|
app.route('/users', createUsersRouter({
|
|
67
60
|
userRegistry: deps.userRegistry,
|
|
68
|
-
clock: deps.clock,
|
|
69
61
|
}));
|
|
70
62
|
}
|
|
71
63
|
if (deps.userRegistry && deps.accessPolicy && deps.workspaceRegistry) {
|
|
@@ -80,22 +72,37 @@ export function createApp(deps, options = {}) {
|
|
|
80
72
|
workspaceService: deps.workspaceService,
|
|
81
73
|
sourceLoaderRunner: deps.sourceLoaderRunner,
|
|
82
74
|
workspacesRoot: deps.workspacesRoot,
|
|
75
|
+
pluginRegistry: deps.pluginRegistry,
|
|
83
76
|
...(deps.bootstrap ? { bootstrap: deps.bootstrap } : {}),
|
|
84
77
|
...(deps.workspaceRegistry ? { workspaceRegistry: deps.workspaceRegistry } : {}),
|
|
85
78
|
...(deps.userRegistry ? { userRegistry: deps.userRegistry } : {}),
|
|
79
|
+
...(deps.historyService ? { historyService: deps.historyService } : {}),
|
|
86
80
|
}));
|
|
87
81
|
app.route('/workspaces', createWorkspaceEventsRouter({ eventBus: deps.eventBus }));
|
|
88
|
-
// Server-level plugin discovery
|
|
89
|
-
// from the active PluginRegistry
|
|
90
|
-
//
|
|
91
|
-
// installed", which is identical across workspaces.
|
|
82
|
+
// Server-level plugin discovery for Studio's loader dropdown,
|
|
83
|
+
// sourced from the active PluginRegistry, not hardcoded strings.
|
|
84
|
+
// Installed loaders are identical across workspaces, not scoped to one.
|
|
92
85
|
app.route('/source-loaders', createSourceLoadersRouter({ pluginRegistry: deps.pluginRegistry }));
|
|
86
|
+
// Public webhook receivers, authenticated by per-source HMAC secrets,
|
|
87
|
+
// inside the handler, not by a Bearer token.
|
|
88
|
+
// The auth middleware exempts the `/webhooks/` prefix.
|
|
89
|
+
// Mounted only when a SecretStore is wired,
|
|
90
|
+
// without one there is nowhere to read the secrets.
|
|
91
|
+
if (deps.secretStore) {
|
|
92
|
+
app.route('/webhooks', createGithubWebhookReceiver({
|
|
93
|
+
workspaceService: deps.workspaceService,
|
|
94
|
+
sourceLoaderRunner: deps.sourceLoaderRunner,
|
|
95
|
+
secretStore: deps.secretStore,
|
|
96
|
+
pluginRegistry: deps.pluginRegistry,
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
// Workspace-scoped sub-app, mounted under `/workspaces/:workspaceId` below.
|
|
93
100
|
const workspaceScoped = new OpenAPIHono();
|
|
94
101
|
workspaceScoped.use('*', workspaceIdMiddleware);
|
|
95
|
-
// Workspace membership gate
|
|
96
|
-
// registry and user registry
|
|
97
|
-
//
|
|
98
|
-
// routes keep behaving.
|
|
102
|
+
// Workspace membership gate, present only in composeFsApp,
|
|
103
|
+
// which wires both the workspace registry and the user registry.
|
|
104
|
+
// In-memory tests compose without these and stay open,
|
|
105
|
+
// so existing routes keep behaving.
|
|
99
106
|
if (deps.workspaceRegistry && deps.userRegistry) {
|
|
100
107
|
workspaceScoped.use('*', workspaceAccessMiddleware({
|
|
101
108
|
registry: deps.workspaceRegistry,
|
|
@@ -110,17 +117,24 @@ export function createApp(deps, options = {}) {
|
|
|
110
117
|
hitlService: deps.hitlService,
|
|
111
118
|
proposalRepository: deps.proposalRepository,
|
|
112
119
|
modelRepository: deps.modelRepository,
|
|
113
|
-
|
|
120
|
+
modelValidationService: deps.modelValidationService,
|
|
114
121
|
workspaceService: deps.workspaceService,
|
|
115
122
|
}));
|
|
116
|
-
workspaceScoped.route('/
|
|
123
|
+
workspaceScoped.route('/clarifications', createClarificationRouter({
|
|
117
124
|
hitlService: deps.hitlService,
|
|
118
|
-
|
|
119
|
-
decisionRepository: deps.decisionRepository,
|
|
125
|
+
clarificationRepository: deps.clarificationRepository,
|
|
120
126
|
}));
|
|
121
|
-
workspaceScoped.route('/
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
workspaceScoped.route('/source-unit-states', createSourceUnitObservationsRouter({
|
|
128
|
+
sourceUnitObservationService: deps.sourceUnitObservationService,
|
|
129
|
+
...(deps.intentLister && deps.sourceUnitDigest
|
|
130
|
+
? {
|
|
131
|
+
diffSupport: {
|
|
132
|
+
workspaceService: deps.workspaceService,
|
|
133
|
+
intentLister: deps.intentLister,
|
|
134
|
+
digest: deps.sourceUnitDigest,
|
|
135
|
+
},
|
|
136
|
+
}
|
|
137
|
+
: {}),
|
|
124
138
|
}));
|
|
125
139
|
workspaceScoped.route('/ontology', createOntologyRouter({
|
|
126
140
|
workspaceRepository: deps.workspaceRepository,
|
|
@@ -131,6 +145,9 @@ export function createApp(deps, options = {}) {
|
|
|
131
145
|
skillRegistry: deps.skillRegistry,
|
|
132
146
|
skillRunner: deps.skillRunner,
|
|
133
147
|
workspaceRepository: deps.workspaceRepository,
|
|
148
|
+
sourceUnitObservationService: deps.sourceUnitObservationService,
|
|
149
|
+
runRepository: deps.runRepository,
|
|
150
|
+
pluginRegistry: deps.pluginRegistry,
|
|
134
151
|
}));
|
|
135
152
|
workspaceScoped.route('/runs', createRunsRouter({
|
|
136
153
|
runRepository: deps.runRepository,
|
|
@@ -144,9 +161,20 @@ export function createApp(deps, options = {}) {
|
|
|
144
161
|
if (deps.batchService) {
|
|
145
162
|
workspaceScoped.route('/batch', createBatchRouter({ batchService: deps.batchService }));
|
|
146
163
|
}
|
|
164
|
+
workspaceScoped.route('/reactor-cycles', createReactorCyclesRouter({
|
|
165
|
+
reactorCycleRepository: deps.reactorCycleRepository,
|
|
166
|
+
}));
|
|
167
|
+
if (deps.secretStore) {
|
|
168
|
+
workspaceScoped.route('/source-webhooks', createSourceWebhooksAdminRouter({
|
|
169
|
+
workspaceService: deps.workspaceService,
|
|
170
|
+
secretStore: deps.secretStore,
|
|
171
|
+
pluginRegistry: deps.pluginRegistry,
|
|
172
|
+
...(options.apiUrl ? { apiUrl: options.apiUrl } : {}),
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
147
175
|
workspaceScoped.route('/skill-input-options', createSkillInputOptionsRouter({
|
|
148
176
|
modelRepository: deps.modelRepository,
|
|
149
|
-
|
|
177
|
+
clarificationRepository: deps.clarificationRepository,
|
|
150
178
|
workspaceRepository: deps.workspaceRepository,
|
|
151
179
|
pluginRegistry: deps.pluginRegistry,
|
|
152
180
|
}));
|
|
@@ -169,12 +197,11 @@ export function createApp(deps, options = {}) {
|
|
|
169
197
|
...(deps.googleOAuth ? { google: deps.googleOAuth } : {}),
|
|
170
198
|
}));
|
|
171
199
|
}
|
|
172
|
-
// OpenAPI 3 spec
|
|
173
|
-
//
|
|
174
|
-
//
|
|
175
|
-
//
|
|
176
|
-
//
|
|
177
|
-
// upstream API base URL without an explicit --base-url flag.
|
|
200
|
+
// OpenAPI 3 spec, consumed by openapi-mcp-gateway, to surface REST operations as MCP tools.
|
|
201
|
+
// SSE routes and the OAuth HTML callback are intentionally absent,
|
|
202
|
+
// they mount plain Hono sub-routers, so they never register with the doc.
|
|
203
|
+
// The `servers[]` block lets the gateway resolve the upstream base URL,
|
|
204
|
+
// without an explicit --base-url flag.
|
|
178
205
|
app.doc('/openapi.json', {
|
|
179
206
|
openapi: '3.0.0',
|
|
180
207
|
info: {
|
package/dist/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BA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CAAuC;IACvC,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE;QACvB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE;YACJ,KAAK,EAAE,gBAAgB;YACvB,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,2GAA2G;SACzH;QACD,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClE,CAAC,CAAA;IAEF,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { UserId } from '@braidhq/schema';
|
|
2
|
+
import type { AccessPolicy } from './infrastructure/auth/AccessPolicy.js';
|
|
3
|
+
import type { UserRegistryFile } from './infrastructure/users/UserRegistryFile.js';
|
|
4
|
+
export declare const LOCAL_USER_ID: string & import("zod").$brand<"UserId">;
|
|
5
|
+
export interface AuthContext {
|
|
6
|
+
readonly userRegistry: UserRegistryFile;
|
|
7
|
+
readonly accessPolicy: AccessPolicy;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* How a deployment resolves identity.
|
|
11
|
+
* The one axis that separates a trusted local install,
|
|
12
|
+
* from an authenticated remote server.
|
|
13
|
+
*
|
|
14
|
+
* Two separate axes, not one nullable field.
|
|
15
|
+
* `defaultPrincipal` is the identity axis, the implicit user for an
|
|
16
|
+
* unauthenticated request, and the owner a workspace falls back to,
|
|
17
|
+
* or null when there is no implicit user.
|
|
18
|
+
* `requiresAuth` is the policy axis, whether a caller must present a valid
|
|
19
|
+
* Bearer token. The middleware reads this, never the principal's null-ness.
|
|
20
|
+
*
|
|
21
|
+
* Stateless behaviour behind an interface, so a const object per mode,
|
|
22
|
+
* the idiomatic strategy form when there is no constructor dependency.
|
|
23
|
+
*/
|
|
24
|
+
export interface AuthMode {
|
|
25
|
+
readonly defaultPrincipal: UserId | null;
|
|
26
|
+
readonly requiresAuth: boolean;
|
|
27
|
+
provision: (context: AuthContext) => Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A local desktop or sidecar. One implicit user owns everything,
|
|
31
|
+
* so provision seeds that `local-user` admin account, idempotently.
|
|
32
|
+
*/
|
|
33
|
+
export declare const localTrust: AuthMode;
|
|
34
|
+
/**
|
|
35
|
+
* A remote server. Real users authenticate against an allowlist,
|
|
36
|
+
* so provision back-fills `approvedEmails` from the roster, idempotently.
|
|
37
|
+
*/
|
|
38
|
+
export declare const authenticated: AuthMode;
|
|
39
|
+
//# sourceMappingURL=authMode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authMode.d.ts","sourceRoot":"","sources":["../src/authMode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAA;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAA;AAKlF,eAAO,MAAM,aAAa,yCAAmC,CAAA;AAE7D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAA;IACvC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAA;CACpC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IACxC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;IAE9B,SAAS,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACnD;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,QAaxB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,QAS3B,CAAA"}
|