@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
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import type { WorkspaceService } from '@braidhq/core';
|
|
2
2
|
import type { Context, MiddlewareHandler } from 'hono';
|
|
3
|
-
import type { WorkspaceRegistryFile } from '../infrastructure/fs/WorkspaceRegistryFile.js';
|
|
4
3
|
import type { UserRegistryFile } from '../infrastructure/users/UserRegistryFile.js';
|
|
4
|
+
import type { WorkspaceRegistryFile } from '../infrastructure/workspace/WorkspaceRegistryFile.js';
|
|
5
5
|
import type { Capability, ViewerContext } from '../policy/index.js';
|
|
6
6
|
/**
|
|
7
|
-
* Server-scope capability guard
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Server-scope capability guard for actions without a workspace context,
|
|
8
|
+
* such as workspace creation.
|
|
9
|
+
* Builds a viewer with an absent member,
|
|
10
|
+
* so non-admin users resolve to a null effectiveRole,
|
|
11
|
+
* and fail every check by construction.
|
|
11
12
|
*
|
|
12
|
-
* Skips the gate when userRegistry
|
|
13
|
-
* compositions stay open.
|
|
13
|
+
* Skips the gate when userRegistry is absent,
|
|
14
|
+
* so in-memory test compositions stay open.
|
|
15
|
+
* Production deployments always pass it.
|
|
14
16
|
*/
|
|
15
17
|
export declare function requireServerCapability(capability: Capability, userRegistry: UserRegistryFile | undefined): MiddlewareHandler;
|
|
16
18
|
declare module 'hono' {
|
|
@@ -24,24 +26,26 @@ export interface WorkspaceAccessOptions {
|
|
|
24
26
|
readonly userRegistry: UserRegistryFile;
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
|
-
* Resolves the caller's ViewerContext for this workspace
|
|
28
|
-
* it on the Hono context for every downstream layer to read.
|
|
29
|
-
* after `workspaceIdMiddleware`
|
|
30
|
-
* member row
|
|
29
|
+
* Resolves the caller's ViewerContext for this workspace,
|
|
30
|
+
* and stashes it on the Hono context for every downstream layer to read.
|
|
31
|
+
* Composes after `workspaceIdMiddleware` and `authMiddleware`.
|
|
32
|
+
* Outsiders get 403 here, meaning no member row and not a server admin.
|
|
31
33
|
*
|
|
32
|
-
* The actual policy decisions live in `policy
|
|
33
|
-
* builds the viewer
|
|
34
|
+
* The actual policy decisions live in `policy/`.
|
|
35
|
+
* This middleware only builds the viewer,
|
|
36
|
+
* and rejects unauthenticated outsiders.
|
|
34
37
|
*/
|
|
35
38
|
export declare function workspaceAccessMiddleware(options: WorkspaceAccessOptions): MiddlewareHandler;
|
|
36
39
|
export declare function getViewerContext(context: Context): ViewerContext | undefined;
|
|
37
40
|
/**
|
|
38
|
-
* Mutation guard.
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
+
* Mutation guard.
|
|
42
|
+
* Returns 403 when the viewer cannot perform the given capability.
|
|
43
|
+
* Optional `buildResource` lets a capability such as `skill.run`
|
|
44
|
+
* attach per-request data the check needs.
|
|
41
45
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* deployments always mount
|
|
46
|
+
* Compositions that don't mount `workspaceAccessMiddleware`,
|
|
47
|
+
* such as in-memory tests or the headless server, skip the gate.
|
|
48
|
+
* Production deployments always mount it, so the gate is real.
|
|
45
49
|
*/
|
|
46
50
|
export declare function requirePermission(capability: Capability, buildResource?: (context: Context) => Promise<ViewerContext['resource']>): MiddlewareHandler;
|
|
47
51
|
//# sourceMappingURL=workspaceAccess.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspaceAccess.d.ts","sourceRoot":"","sources":["../../src/middleware/workspaceAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,K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B"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import { ForbiddenError } from '@braidhq/core';
|
|
1
2
|
import { defaultPermissionRegistry, resolveViewer } from '../policy/index.js';
|
|
2
|
-
import { getUserId } from './
|
|
3
|
+
import { getUserId } from './auth.js';
|
|
3
4
|
import { getWorkspaceId } from './workspaceId.js';
|
|
4
5
|
/**
|
|
5
|
-
* Server-scope capability guard
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Server-scope capability guard for actions without a workspace context,
|
|
7
|
+
* such as workspace creation.
|
|
8
|
+
* Builds a viewer with an absent member,
|
|
9
|
+
* so non-admin users resolve to a null effectiveRole,
|
|
10
|
+
* and fail every check by construction.
|
|
9
11
|
*
|
|
10
|
-
* Skips the gate when userRegistry
|
|
11
|
-
* compositions stay open.
|
|
12
|
+
* Skips the gate when userRegistry is absent,
|
|
13
|
+
* so in-memory test compositions stay open.
|
|
14
|
+
* Production deployments always pass it.
|
|
12
15
|
*/
|
|
13
16
|
export function requireServerCapability(capability, userRegistry) {
|
|
14
17
|
return async (context, next) => {
|
|
@@ -19,22 +22,23 @@ export function requireServerCapability(capability, userRegistry) {
|
|
|
19
22
|
const userId = getUserId(context);
|
|
20
23
|
const user = await userRegistry.get(userId);
|
|
21
24
|
if (!user)
|
|
22
|
-
return forbid(
|
|
25
|
+
return forbid(`Unknown user "${userId}".`);
|
|
23
26
|
const viewer = resolveViewer(user, undefined);
|
|
24
27
|
if (!defaultPermissionRegistry.can(capability, viewer))
|
|
25
|
-
return forbid(
|
|
28
|
+
return forbid(`Your role cannot perform "${capability}".`);
|
|
26
29
|
await next();
|
|
27
30
|
return undefined;
|
|
28
31
|
};
|
|
29
32
|
}
|
|
30
33
|
/**
|
|
31
|
-
* Resolves the caller's ViewerContext for this workspace
|
|
32
|
-
* it on the Hono context for every downstream layer to read.
|
|
33
|
-
* after `workspaceIdMiddleware`
|
|
34
|
-
* member row
|
|
34
|
+
* Resolves the caller's ViewerContext for this workspace,
|
|
35
|
+
* and stashes it on the Hono context for every downstream layer to read.
|
|
36
|
+
* Composes after `workspaceIdMiddleware` and `authMiddleware`.
|
|
37
|
+
* Outsiders get 403 here, meaning no member row and not a server admin.
|
|
35
38
|
*
|
|
36
|
-
* The actual policy decisions live in `policy
|
|
37
|
-
* builds the viewer
|
|
39
|
+
* The actual policy decisions live in `policy/`.
|
|
40
|
+
* This middleware only builds the viewer,
|
|
41
|
+
* and rejects unauthenticated outsiders.
|
|
38
42
|
*/
|
|
39
43
|
export function workspaceAccessMiddleware(options) {
|
|
40
44
|
return async (context, next) => {
|
|
@@ -42,12 +46,12 @@ export function workspaceAccessMiddleware(options) {
|
|
|
42
46
|
const userId = getUserId(context);
|
|
43
47
|
const user = await options.userRegistry.get(userId);
|
|
44
48
|
if (!user)
|
|
45
|
-
return forbid(
|
|
49
|
+
return forbid(`Unknown user "${userId}".`);
|
|
46
50
|
const workspace = await options.workspaceService.findById(workspaceId);
|
|
47
51
|
const member = await options.registry.getMember(workspace.rootPath, userId);
|
|
48
52
|
const viewer = resolveViewer(user, member);
|
|
49
53
|
if (viewer.effectiveRole === null)
|
|
50
|
-
return forbid(
|
|
54
|
+
return forbid(`You are not a member of workspace "${workspaceId}".`);
|
|
51
55
|
context.set('viewerContext', viewer);
|
|
52
56
|
await next();
|
|
53
57
|
return undefined;
|
|
@@ -57,13 +61,14 @@ export function getViewerContext(context) {
|
|
|
57
61
|
return context.get('viewerContext');
|
|
58
62
|
}
|
|
59
63
|
/**
|
|
60
|
-
* Mutation guard.
|
|
61
|
-
*
|
|
62
|
-
*
|
|
64
|
+
* Mutation guard.
|
|
65
|
+
* Returns 403 when the viewer cannot perform the given capability.
|
|
66
|
+
* Optional `buildResource` lets a capability such as `skill.run`
|
|
67
|
+
* attach per-request data the check needs.
|
|
63
68
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* deployments always mount
|
|
69
|
+
* Compositions that don't mount `workspaceAccessMiddleware`,
|
|
70
|
+
* such as in-memory tests or the headless server, skip the gate.
|
|
71
|
+
* Production deployments always mount it, so the gate is real.
|
|
67
72
|
*/
|
|
68
73
|
export function requirePermission(capability, buildResource) {
|
|
69
74
|
return async (context, next) => {
|
|
@@ -75,12 +80,12 @@ export function requirePermission(capability, buildResource) {
|
|
|
75
80
|
const resource = buildResource ? await buildResource(context) : undefined;
|
|
76
81
|
const viewer = resource ? { ...base, resource } : base;
|
|
77
82
|
if (!defaultPermissionRegistry.can(capability, viewer))
|
|
78
|
-
return forbid(
|
|
83
|
+
return forbid(`Your role cannot perform "${capability}".`);
|
|
79
84
|
await next();
|
|
80
85
|
return undefined;
|
|
81
86
|
};
|
|
82
87
|
}
|
|
83
|
-
function forbid(
|
|
84
|
-
|
|
88
|
+
function forbid(detail) {
|
|
89
|
+
throw new ForbiddenError(detail);
|
|
85
90
|
}
|
|
86
91
|
//# sourceMappingURL=workspaceAccess.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspaceAccess.js","sourceRoot":"","sources":["../../src/middleware/workspaceAccess.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"workspaceAccess.js","sourceRoot":"","sources":["../../src/middleware/workspaceAccess.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,uBAAuB,CACrC,UAAsB,EACtB,YAA0C;IAE1C,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC7B,I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capability } from '@braidhq/schema';
|
|
2
2
|
import type { ViewerContext } from './ViewerContext.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The Strategy interface, where each capability owns its decision logic.
|
|
5
|
+
* A stateless check is a const object, the first-party set lives in `checks.ts`.
|
|
6
6
|
*
|
|
7
|
-
* Implementations MUST be pure
|
|
8
|
-
*
|
|
7
|
+
* Implementations MUST be pure, with no I/O, clock, or randomness,
|
|
8
|
+
* so the same viewer always produces the same answer.
|
|
9
9
|
*/
|
|
10
10
|
export interface CapabilityCheck {
|
|
11
11
|
readonly id: Capability;
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import type { Capability } from '
|
|
1
|
+
import type { Capability } from '@braidhq/schema';
|
|
2
2
|
import type { CapabilityCheck } from './CapabilityCheck.js';
|
|
3
3
|
import type { ViewerContext } from './ViewerContext.js';
|
|
4
4
|
/**
|
|
5
|
-
* Open registry of capability strategies.
|
|
6
|
-
* `registry.register(new MyCheck())
|
|
5
|
+
* Open registry of capability strategies.
|
|
6
|
+
* A new capability arrives via `registry.register(new MyCheck())`,
|
|
7
|
+
* leaving existing checks untouched.
|
|
7
8
|
*
|
|
8
|
-
* Unknown capability ids resolve to `false
|
|
9
|
-
*
|
|
10
|
-
* accidentally allowing.
|
|
9
|
+
* Unknown capability ids resolve to `false`, a default deny.
|
|
10
|
+
* This makes a typo'd capability id safe,
|
|
11
|
+
* since the call denies rather than accidentally allowing.
|
|
11
12
|
*/
|
|
12
13
|
export declare class PermissionRegistry {
|
|
13
14
|
private readonly checks;
|
|
14
15
|
register(check: CapabilityCheck): this;
|
|
15
16
|
has(capability: Capability): boolean;
|
|
16
17
|
/**
|
|
17
|
-
* Decide whether a viewer can perform a capability.
|
|
18
|
-
* already carries its own resource
|
|
19
|
-
*
|
|
18
|
+
* Decide whether a viewer can perform a capability.
|
|
19
|
+
* The viewer already carries its own resource,
|
|
20
|
+
* such as the skill for skill.run,
|
|
21
|
+
* so the caller is responsible for building the right viewer.
|
|
20
22
|
*/
|
|
21
23
|
can(capability: Capability, viewer: ViewerContext): boolean;
|
|
22
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionRegistry.d.ts","sourceRoot":"","sources":["../../src/policy/PermissionRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD
|
|
1
|
+
{"version":3,"file":"PermissionRegistry.d.ts","sourceRoot":"","sources":["../../src/policy/PermissionRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD;;;;;;;;GAQG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyC;IAEhE,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;IAKtC,GAAG,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO;IAIpC;;;;;OAKG;IACH,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO;CAG5D"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Open registry of capability strategies.
|
|
3
|
-
* `registry.register(new MyCheck())
|
|
2
|
+
* Open registry of capability strategies.
|
|
3
|
+
* A new capability arrives via `registry.register(new MyCheck())`,
|
|
4
|
+
* leaving existing checks untouched.
|
|
4
5
|
*
|
|
5
|
-
* Unknown capability ids resolve to `false
|
|
6
|
-
*
|
|
7
|
-
* accidentally allowing.
|
|
6
|
+
* Unknown capability ids resolve to `false`, a default deny.
|
|
7
|
+
* This makes a typo'd capability id safe,
|
|
8
|
+
* since the call denies rather than accidentally allowing.
|
|
8
9
|
*/
|
|
9
10
|
export class PermissionRegistry {
|
|
10
11
|
checks = new Map();
|
|
@@ -16,9 +17,10 @@ export class PermissionRegistry {
|
|
|
16
17
|
return this.checks.has(capability);
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
|
-
* Decide whether a viewer can perform a capability.
|
|
20
|
-
* already carries its own resource
|
|
21
|
-
*
|
|
20
|
+
* Decide whether a viewer can perform a capability.
|
|
21
|
+
* The viewer already carries its own resource,
|
|
22
|
+
* such as the skill for skill.run,
|
|
23
|
+
* so the caller is responsible for building the right viewer.
|
|
22
24
|
*/
|
|
23
25
|
can(capability, viewer) {
|
|
24
26
|
return this.checks.get(capability)?.evaluate(viewer) ?? false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionRegistry.js","sourceRoot":"","sources":["../../src/policy/PermissionRegistry.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"PermissionRegistry.js","sourceRoot":"","sources":["../../src/policy/PermissionRegistry.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,MAAM,OAAO,kBAAkB;IACZ,MAAM,GAAG,IAAI,GAAG,EAA+B,CAAA;IAEhE,QAAQ,CAAC,KAAsB;QAC7B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;QAChC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,GAAG,CAAC,UAAsB;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACpC,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,UAAsB,EAAE,MAAqB;QAC/C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,CAAA;IAC/D,CAAC;CACF"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import type { SkillFrontmatter, User, WorkspaceMember, WorkspaceRole } from '@braidhq/schema';
|
|
2
2
|
/**
|
|
3
|
-
* The single resolved-identity object that every capability check
|
|
4
|
-
*
|
|
5
|
-
* into the registry.
|
|
3
|
+
* The single resolved-identity object that every capability check reads.
|
|
4
|
+
* Built once per request by `resolveViewer`,
|
|
5
|
+
* then passed unchanged into the registry.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* Permission gates read `effectiveRole`,
|
|
8
|
+
* where admins always land as owner regardless of any member row.
|
|
9
|
+
* `member` is the stored row when present,
|
|
10
|
+
* used for display and skillOverrides lookup,
|
|
11
|
+
* and stays independent of effectiveRole.
|
|
12
|
+
* An admin who joined as a guest has a guest member.role,
|
|
13
|
+
* yet an owner effectiveRole.
|
|
12
14
|
*
|
|
13
|
-
* `resource` is the per-action context the check needs
|
|
14
|
-
*
|
|
15
|
-
*
|
|
15
|
+
* `resource` is the per-action context the check needs.
|
|
16
|
+
* skill.run reads `skill`, the manifest, along with `skillId`.
|
|
17
|
+
* Future checks can extend it without breaking siblings.
|
|
16
18
|
*/
|
|
17
19
|
export interface ViewerContext {
|
|
18
20
|
readonly user: User;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewerContext.d.ts","sourceRoot":"","sources":["../../src/policy/ViewerContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE7F
|
|
1
|
+
{"version":3,"file":"ViewerContext.d.ts","sourceRoot":"","sources":["../../src/policy/ViewerContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE7F;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CAAA;IAC5C,QAAQ,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI,CAAA;IAC5C,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,GAAG,SAAS,CAAA;CAC/C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAAA;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAC1B"}
|
package/dist/policy/checks.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { CapabilityCheck } from './CapabilityCheck.js';
|
|
2
2
|
/**
|
|
3
|
-
* First-party capability checks,
|
|
4
|
-
* `packages/studio/src/policy/checks.ts`.
|
|
5
|
-
*
|
|
6
|
-
* affordances without hitting a 403.
|
|
3
|
+
* First-party capability checks,
|
|
4
|
+
* mirrored byte-equivalent in `packages/studio/src/policy/checks.ts`.
|
|
5
|
+
* The server is the authoritative gate.
|
|
6
|
+
* The client copy lets Studio render locked affordances, without hitting a 403.
|
|
7
7
|
*
|
|
8
|
-
* Workspace-scope verbs collapse to
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* Workspace-scope verbs collapse to read and write per resource.
|
|
9
|
+
* `workspace.create` is server-scope, resolved with no member.
|
|
10
|
+
* `skill.run` keeps its own verb for its three-step resolution,
|
|
11
|
+
* covering owner short-circuit, per-member override, allowedRoles,
|
|
12
|
+
* which does not fit a read or write pair.
|
|
13
13
|
*/
|
|
14
14
|
export declare const checks: readonly CapabilityCheck[];
|
|
15
15
|
//# sourceMappingURL=checks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src/policy/checks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,MAAM,EAAE,SAAS,eAAe,
|
|
1
|
+
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src/policy/checks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,MAAM,EAAE,SAAS,eAAe,EAyC5C,CAAA"}
|
package/dist/policy/checks.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* First-party capability checks,
|
|
3
|
-
* `packages/studio/src/policy/checks.ts`.
|
|
4
|
-
*
|
|
5
|
-
* affordances without hitting a 403.
|
|
2
|
+
* First-party capability checks,
|
|
3
|
+
* mirrored byte-equivalent in `packages/studio/src/policy/checks.ts`.
|
|
4
|
+
* The server is the authoritative gate.
|
|
5
|
+
* The client copy lets Studio render locked affordances, without hitting a 403.
|
|
6
6
|
*
|
|
7
|
-
* Workspace-scope verbs collapse to
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* Workspace-scope verbs collapse to read and write per resource.
|
|
8
|
+
* `workspace.create` is server-scope, resolved with no member.
|
|
9
|
+
* `skill.run` keeps its own verb for its three-step resolution,
|
|
10
|
+
* covering owner short-circuit, per-member override, allowedRoles,
|
|
11
|
+
* which does not fit a read or write pair.
|
|
12
12
|
*/
|
|
13
13
|
export const checks = [
|
|
14
14
|
{ id: 'workspace.create', evaluate: v => v.effectiveRole === 'owner' },
|
|
15
|
+
// Server admin reads serverRole directly, not effectiveRole,
|
|
16
|
+
// since a workspace owner also resolves to an owner effectiveRole.
|
|
17
|
+
{ id: 'server.admin', evaluate: v => v.user.serverRole === 'admin' },
|
|
15
18
|
{ id: 'workspace.read', evaluate: v => v.effectiveRole !== null },
|
|
16
19
|
{ id: 'workspace.write', evaluate: v => v.effectiveRole === 'owner' },
|
|
17
20
|
{
|
|
@@ -23,11 +26,11 @@ export const checks = [
|
|
|
23
26
|
evaluate: v => v.effectiveRole === 'owner' || v.effectiveRole === 'maintainer',
|
|
24
27
|
},
|
|
25
28
|
{
|
|
26
|
-
id: '
|
|
29
|
+
id: 'clarification.read',
|
|
27
30
|
evaluate: v => v.effectiveRole === 'owner' || v.effectiveRole === 'maintainer',
|
|
28
31
|
},
|
|
29
32
|
{
|
|
30
|
-
id: '
|
|
33
|
+
id: 'clarification.write',
|
|
31
34
|
evaluate: v => v.effectiveRole === 'owner' || v.effectiveRole === 'maintainer',
|
|
32
35
|
},
|
|
33
36
|
{ id: 'history.write', evaluate: v => v.effectiveRole === 'owner' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checks.js","sourceRoot":"","sources":["../../src/policy/checks.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,MAAM,GAA+B;IAChD,EAAE,EAAE,EAAE,kBAAkB,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,OAAO,EAAE;IACtE,EAAE,EAAE,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,IAAI,EAAE;IACjE,EAAE,EAAE,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,OAAO,EAAE;IACrE;QACE,EAAE,EAAE,eAAe;QACnB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,OAAO,IAAI,CAAC,CAAC,aAAa,KAAK,YAAY;KAC/E;IACD;QACE,EAAE,EAAE,gBAAgB;QACpB,QAAQ,EAAE,CAAC,CAAC,E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AAE,CAAC,CAAC,CAAC,aAAa,KAAK,OAAO,IAAI,CAAC,CAAC,aAAa,KAAK,YAAY;KAC/E;IACD,EAAE,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,OAAO,EAAE;IACnE;QACE,EAAE,EAAE,WAAW;QACf,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YACd,MAAM,KAAK,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAA;YAC/B,MAAM,OAAO,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAA;YACnC,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO;gBACpB,OAAO,KAAK,CAAA;YACd,IAAI,CAAC,CAAC,aAAa,KAAK,IAAI;gBAC1B,OAAO,KAAK,CAAA;YACd,IAAI,CAAC,CAAC,aAAa,KAAK,OAAO;gBAC7B,OAAO,IAAI,CAAA;YACb,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,OAA+C,CAAC,CAAA;YAC5F,IAAI,QAAQ;gBACV,OAAO,QAAQ,KAAK,OAAO,CAAA;YAC7B,OAAO,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAA;QAC3D,CAAC;KACF;CACF,CAAA"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { PermissionRegistry } from './PermissionRegistry.js';
|
|
2
2
|
/**
|
|
3
|
-
* Default registry preloaded with the
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* via `new PermissionRegistry()` to inject mocks.
|
|
3
|
+
* Default registry preloaded with the first-party capabilities.
|
|
4
|
+
* Plugins register their own checks, calling `register()` on this instance.
|
|
5
|
+
* Tests build a fresh `PermissionRegistry` instead, to inject mocks.
|
|
7
6
|
*/
|
|
8
7
|
export declare function buildDefaultPermissionRegistry(): PermissionRegistry;
|
|
9
8
|
export declare const defaultPermissionRegistry: PermissionRegistry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultRegistry.d.ts","sourceRoot":"","sources":["../../src/policy/defaultRegistry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D
|
|
1
|
+
{"version":3,"file":"defaultRegistry.d.ts","sourceRoot":"","sources":["../../src/policy/defaultRegistry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D;;;;GAIG;AACH,wBAAgB,8BAA8B,IAAI,kBAAkB,CAKnE;AAED,eAAO,MAAM,yBAAyB,oBAAmC,CAAA"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { checks } from './checks.js';
|
|
2
2
|
import { PermissionRegistry } from './PermissionRegistry.js';
|
|
3
3
|
/**
|
|
4
|
-
* Default registry preloaded with the
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* via `new PermissionRegistry()` to inject mocks.
|
|
4
|
+
* Default registry preloaded with the first-party capabilities.
|
|
5
|
+
* Plugins register their own checks, calling `register()` on this instance.
|
|
6
|
+
* Tests build a fresh `PermissionRegistry` instead, to inject mocks.
|
|
8
7
|
*/
|
|
9
8
|
export function buildDefaultPermissionRegistry() {
|
|
10
9
|
const registry = new PermissionRegistry();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultRegistry.js","sourceRoot":"","sources":["../../src/policy/defaultRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D
|
|
1
|
+
{"version":3,"file":"defaultRegistry.js","sourceRoot":"","sources":["../../src/policy/defaultRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D;;;;GAIG;AACH,MAAM,UAAU,8BAA8B;IAC5C,MAAM,QAAQ,GAAG,IAAI,kBAAkB,EAAE,CAAA;IACzC,KAAK,MAAM,KAAK,IAAI,MAAM;QACxB,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC1B,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,8BAA8B,EAAE,CAAA"}
|
package/dist/policy/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type { Capability } from './Capability.js';
|
|
2
|
-
export { CAPABILITY_IDS } from './Capability.js';
|
|
3
1
|
export type { CapabilityCheck } from './CapabilityCheck.js';
|
|
4
2
|
export { buildDefaultPermissionRegistry, defaultPermissionRegistry } from './defaultRegistry.js';
|
|
5
3
|
export { PermissionRegistry } from './PermissionRegistry.js';
|
|
6
4
|
export { resolveViewer } from './resolveViewer.js';
|
|
7
5
|
export type { ViewerContext, ViewerResource } from './ViewerContext.js';
|
|
6
|
+
export type { Capability } from '@braidhq/schema';
|
|
7
|
+
export { CAPABILITY_IDS } from '@braidhq/schema';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/policy/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/policy/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,8BAA8B,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACvE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/policy/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { CAPABILITY_IDS } from './Capability.js';
|
|
2
1
|
export { buildDefaultPermissionRegistry, defaultPermissionRegistry } from './defaultRegistry.js';
|
|
3
2
|
export { PermissionRegistry } from './PermissionRegistry.js';
|
|
4
3
|
export { resolveViewer } from './resolveViewer.js';
|
|
4
|
+
export { CAPABILITY_IDS } from '@braidhq/schema';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/dist/policy/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/policy/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/policy/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGlD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { User, WorkspaceMember } from '@braidhq/schema';
|
|
2
2
|
import type { ViewerContext, ViewerResource } from './ViewerContext.js';
|
|
3
3
|
/**
|
|
4
|
-
* The sole place server-admin promotion happens. Every other layer
|
|
5
|
-
*
|
|
6
|
-
* `effectiveRole` and never re-derives it.
|
|
4
|
+
* The sole place server-admin promotion happens. Every other layer,
|
|
5
|
+
* including middleware, capability checks, and the Studio mirror,
|
|
6
|
+
* consumes the resulting `effectiveRole` and never re-derives it.
|
|
7
7
|
*
|
|
8
|
-
* Resolution:
|
|
9
|
-
* 1.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* 2.
|
|
13
|
-
* 3.
|
|
8
|
+
* Resolution runs in order:
|
|
9
|
+
* 1. An admin serverRole yields an owner effectiveRole.
|
|
10
|
+
* The stored member.role, if any, stays on `member` for display,
|
|
11
|
+
* yet gates ignore it.
|
|
12
|
+
* 2. A present member yields effectiveRole = member.role.
|
|
13
|
+
* 3. Otherwise effectiveRole is null, meaning no access.
|
|
14
14
|
*/
|
|
15
15
|
export declare function resolveViewer(user: User, member: WorkspaceMember | undefined, resource?: ViewerResource): ViewerContext;
|
|
16
16
|
//# sourceMappingURL=resolveViewer.d.ts.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The sole place server-admin promotion happens. Every other layer
|
|
3
|
-
*
|
|
4
|
-
* `effectiveRole` and never re-derives it.
|
|
2
|
+
* The sole place server-admin promotion happens. Every other layer,
|
|
3
|
+
* including middleware, capability checks, and the Studio mirror,
|
|
4
|
+
* consumes the resulting `effectiveRole` and never re-derives it.
|
|
5
5
|
*
|
|
6
|
-
* Resolution:
|
|
7
|
-
* 1.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* 2.
|
|
11
|
-
* 3.
|
|
6
|
+
* Resolution runs in order:
|
|
7
|
+
* 1. An admin serverRole yields an owner effectiveRole.
|
|
8
|
+
* The stored member.role, if any, stays on `member` for display,
|
|
9
|
+
* yet gates ignore it.
|
|
10
|
+
* 2. A present member yields effectiveRole = member.role.
|
|
11
|
+
* 3. Otherwise effectiveRole is null, meaning no access.
|
|
12
12
|
*/
|
|
13
13
|
export function resolveViewer(user, member, resource) {
|
|
14
14
|
if (user.serverRole === 'admin') {
|