@braidhq/server 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +134 -106
- package/dist/app.d.ts +7 -15
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +74 -45
- package/dist/app.js.map +1 -1
- package/dist/authMode.d.ts +39 -0
- package/dist/authMode.d.ts.map +1 -0
- package/dist/authMode.js +50 -0
- package/dist/authMode.js.map +1 -0
- package/dist/composeApp.d.ts +80 -0
- package/dist/composeApp.d.ts.map +1 -0
- package/dist/composeApp.js +137 -0
- package/dist/composeApp.js.map +1 -0
- package/dist/composeFsApp.d.ts +27 -0
- package/dist/composeFsApp.d.ts.map +1 -0
- package/dist/{composeFs.js → composeFsApp.js} +127 -126
- package/dist/composeFsApp.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/_shared/env.d.ts +10 -0
- package/dist/infrastructure/_shared/env.d.ts.map +1 -0
- package/dist/infrastructure/{env.js → _shared/env.js} +5 -6
- package/dist/infrastructure/_shared/env.js.map +1 -0
- package/dist/infrastructure/_shared/frontmatter.d.ts +13 -0
- package/dist/infrastructure/_shared/frontmatter.d.ts.map +1 -0
- package/dist/infrastructure/{fs → _shared}/frontmatter.js +5 -5
- package/dist/infrastructure/_shared/frontmatter.js.map +1 -0
- package/dist/infrastructure/_shared/jsonFileStore.d.ts.map +1 -0
- package/dist/infrastructure/_shared/jsonFileStore.js.map +1 -0
- package/dist/infrastructure/{fs → _shared}/paths.d.ts +17 -10
- package/dist/infrastructure/_shared/paths.d.ts.map +1 -0
- package/dist/infrastructure/{fs → _shared}/paths.js +27 -20
- package/dist/infrastructure/_shared/paths.js.map +1 -0
- package/dist/infrastructure/auth/AccessPolicy.d.ts +33 -58
- package/dist/infrastructure/auth/AccessPolicy.d.ts.map +1 -1
- package/dist/infrastructure/auth/AccessPolicy.js +35 -42
- package/dist/infrastructure/auth/AccessPolicy.js.map +1 -1
- package/dist/infrastructure/auth/SessionStore.d.ts +22 -12
- package/dist/infrastructure/auth/SessionStore.d.ts.map +1 -1
- package/dist/infrastructure/auth/SessionStore.js +20 -20
- package/dist/infrastructure/auth/SessionStore.js.map +1 -1
- package/dist/infrastructure/batch/FsBatchPlanRepository.d.ts +14 -0
- package/dist/infrastructure/batch/FsBatchPlanRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs → batch}/FsBatchPlanRepository.js +9 -7
- package/dist/infrastructure/batch/FsBatchPlanRepository.js.map +1 -0
- package/dist/infrastructure/history/GitWorkspaceHistory.d.ts.map +1 -0
- package/dist/infrastructure/{git → history}/GitWorkspaceHistory.js +31 -24
- package/dist/infrastructure/history/GitWorkspaceHistory.js.map +1 -0
- package/dist/infrastructure/history/commitMessage.d.ts.map +1 -0
- package/dist/infrastructure/history/commitMessage.js +90 -0
- package/dist/infrastructure/history/commitMessage.js.map +1 -0
- package/dist/infrastructure/hitl/FsClarificationRepository.d.ts +13 -0
- package/dist/infrastructure/hitl/FsClarificationRepository.d.ts.map +1 -0
- package/dist/infrastructure/hitl/FsClarificationRepository.js +40 -0
- package/dist/infrastructure/hitl/FsClarificationRepository.js.map +1 -0
- package/dist/infrastructure/hitl/FsProposalRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs → hitl}/FsProposalRepository.js +8 -8
- package/dist/infrastructure/hitl/FsProposalRepository.js.map +1 -0
- package/dist/infrastructure/hitl/StatusedJsonStore.d.ts +30 -0
- package/dist/infrastructure/hitl/StatusedJsonStore.d.ts.map +1 -0
- package/dist/infrastructure/{fs/FsStatusedJsonRepository.js → hitl/StatusedJsonStore.js} +3 -3
- package/dist/infrastructure/hitl/StatusedJsonStore.js.map +1 -0
- package/dist/infrastructure/model/FsModelSerializer.d.ts +94 -0
- package/dist/infrastructure/model/FsModelSerializer.d.ts.map +1 -0
- package/dist/infrastructure/{fs/FsGraphSerializer.js → model/FsModelSerializer.js} +11 -11
- package/dist/infrastructure/model/FsModelSerializer.js.map +1 -0
- package/dist/infrastructure/oauth/GoogleOAuth.d.ts +20 -38
- package/dist/infrastructure/oauth/GoogleOAuth.d.ts.map +1 -1
- package/dist/infrastructure/oauth/GoogleOAuth.js +21 -22
- package/dist/infrastructure/oauth/GoogleOAuth.js.map +1 -1
- package/dist/infrastructure/reactor/FsReactorCycleRepository.d.ts +29 -0
- package/dist/infrastructure/reactor/FsReactorCycleRepository.d.ts.map +1 -0
- package/dist/infrastructure/reactor/FsReactorCycleRepository.js +94 -0
- package/dist/infrastructure/reactor/FsReactorCycleRepository.js.map +1 -0
- package/dist/infrastructure/secrets/SecretStore.d.ts +11 -14
- package/dist/infrastructure/secrets/SecretStore.d.ts.map +1 -1
- package/dist/infrastructure/secrets/SecretStore.js +4 -4
- package/dist/infrastructure/secrets/SecretStore.js.map +1 -1
- package/dist/infrastructure/{fs → skill}/FsRunRepository.d.ts +5 -3
- package/dist/infrastructure/skill/FsRunRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs → skill}/FsRunRepository.js +11 -9
- package/dist/infrastructure/skill/FsRunRepository.js.map +1 -0
- package/dist/infrastructure/{fs → skill}/FsSkillRegistry.d.ts +4 -13
- package/dist/infrastructure/skill/FsSkillRegistry.d.ts.map +1 -0
- package/dist/infrastructure/{fs → skill}/FsSkillRegistry.js +28 -20
- package/dist/infrastructure/skill/FsSkillRegistry.js.map +1 -0
- package/dist/infrastructure/skill/SubprocessSkillRunner.d.ts +52 -0
- package/dist/infrastructure/skill/SubprocessSkillRunner.d.ts.map +1 -0
- package/dist/infrastructure/{agent → skill}/SubprocessSkillRunner.js +107 -55
- package/dist/infrastructure/skill/SubprocessSkillRunner.js.map +1 -0
- package/dist/infrastructure/skill/asyncQueue.d.ts +20 -0
- package/dist/infrastructure/skill/asyncQueue.d.ts.map +1 -0
- package/dist/infrastructure/{agent → skill}/asyncQueue.js +2 -3
- package/dist/infrastructure/{agent → skill}/asyncQueue.js.map +1 -1
- package/dist/infrastructure/skill/lineBuffer.d.ts +15 -0
- package/dist/infrastructure/skill/lineBuffer.d.ts.map +1 -0
- package/dist/infrastructure/{agent/streamJsonParser.js → skill/lineBuffer.js} +5 -17
- package/dist/infrastructure/skill/lineBuffer.js.map +1 -0
- package/dist/infrastructure/skill/orphanReaper.d.ts +20 -0
- package/dist/infrastructure/skill/orphanReaper.d.ts.map +1 -0
- package/dist/infrastructure/{orphanReaper.js → skill/orphanReaper.js} +7 -5
- package/dist/infrastructure/skill/orphanReaper.js.map +1 -0
- package/dist/infrastructure/skill/subprocessEventStream.d.ts +16 -0
- package/dist/infrastructure/skill/subprocessEventStream.d.ts.map +1 -0
- package/dist/infrastructure/skill/subprocessEventStream.js +29 -0
- package/dist/infrastructure/skill/subprocessEventStream.js.map +1 -0
- package/dist/infrastructure/source/FsSourceUnitDigest.d.ts +19 -0
- package/dist/infrastructure/source/FsSourceUnitDigest.d.ts.map +1 -0
- package/dist/infrastructure/{fs → source}/FsSourceUnitDigest.js +9 -9
- package/dist/infrastructure/source/FsSourceUnitDigest.js.map +1 -0
- package/dist/infrastructure/source/FsSourceUnitObservationRepository.d.ts +31 -0
- package/dist/infrastructure/source/FsSourceUnitObservationRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs/FsSourceUnitStateRepository.js → source/FsSourceUnitObservationRepository.js} +18 -17
- package/dist/infrastructure/source/FsSourceUnitObservationRepository.js.map +1 -0
- package/dist/infrastructure/source/unitScan.d.ts +11 -0
- package/dist/infrastructure/source/unitScan.d.ts.map +1 -0
- package/dist/infrastructure/{fs/intentScan.js → source/unitScan.js} +36 -27
- package/dist/infrastructure/source/unitScan.js.map +1 -0
- package/dist/infrastructure/users/UserDirectoryFromRegistry.d.ts +2 -2
- package/dist/infrastructure/users/UserDirectoryFromRegistry.d.ts.map +1 -1
- package/dist/infrastructure/users/UserDirectoryFromRegistry.js +3 -2
- package/dist/infrastructure/users/UserDirectoryFromRegistry.js.map +1 -1
- package/dist/infrastructure/users/UserRegistryFile.d.ts +4 -5
- package/dist/infrastructure/users/UserRegistryFile.d.ts.map +1 -1
- package/dist/infrastructure/users/UserRegistryFile.js +6 -8
- package/dist/infrastructure/users/UserRegistryFile.js.map +1 -1
- package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts +9 -6
- package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts.map +1 -1
- package/dist/infrastructure/users/ensureWorkspaceOwners.js +10 -7
- package/dist/infrastructure/users/ensureWorkspaceOwners.js.map +1 -1
- package/dist/infrastructure/workspace/FsWorkspaceRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs → workspace}/FsWorkspaceRepository.js +7 -6
- package/dist/infrastructure/workspace/FsWorkspaceRepository.js.map +1 -0
- package/dist/infrastructure/workspace/WorkspaceDiscovery.d.ts +18 -0
- package/dist/infrastructure/workspace/WorkspaceDiscovery.d.ts.map +1 -0
- package/dist/infrastructure/{fs → workspace}/WorkspaceDiscovery.js +15 -11
- package/dist/infrastructure/workspace/WorkspaceDiscovery.js.map +1 -0
- package/dist/infrastructure/{fs → workspace}/WorkspaceRegistryFile.d.ts +10 -9
- package/dist/infrastructure/workspace/WorkspaceRegistryFile.d.ts.map +1 -0
- package/dist/infrastructure/{fs → workspace}/WorkspaceRegistryFile.js +15 -17
- package/dist/infrastructure/workspace/WorkspaceRegistryFile.js.map +1 -0
- package/dist/infrastructure/workspace/productManifestWriter.d.ts +24 -0
- package/dist/infrastructure/workspace/productManifestWriter.d.ts.map +1 -0
- package/dist/infrastructure/{fs → workspace}/productManifestWriter.js +14 -26
- package/dist/infrastructure/workspace/productManifestWriter.js.map +1 -0
- package/dist/middleware/auth.d.ts +27 -17
- package/dist/middleware/auth.d.ts.map +1 -1
- package/dist/middleware/auth.js +69 -53
- package/dist/middleware/auth.js.map +1 -1
- package/dist/middleware/cors.d.ts.map +1 -1
- package/dist/middleware/cors.js +4 -1
- package/dist/middleware/cors.js.map +1 -1
- package/dist/middleware/error.d.ts.map +1 -1
- package/dist/middleware/error.js +15 -13
- package/dist/middleware/error.js.map +1 -1
- package/dist/middleware/workspaceAccess.d.ts +23 -19
- package/dist/middleware/workspaceAccess.d.ts.map +1 -1
- package/dist/middleware/workspaceAccess.js +31 -26
- package/dist/middleware/workspaceAccess.js.map +1 -1
- package/dist/policy/CapabilityCheck.d.ts +5 -5
- package/dist/policy/PermissionRegistry.d.ts +11 -9
- package/dist/policy/PermissionRegistry.d.ts.map +1 -1
- package/dist/policy/PermissionRegistry.js +10 -8
- package/dist/policy/PermissionRegistry.js.map +1 -1
- package/dist/policy/ViewerContext.d.ts +13 -11
- package/dist/policy/ViewerContext.d.ts.map +1 -1
- package/dist/policy/checks.d.ts +9 -9
- package/dist/policy/checks.d.ts.map +1 -1
- package/dist/policy/checks.js +14 -11
- package/dist/policy/checks.js.map +1 -1
- package/dist/policy/defaultRegistry.d.ts +3 -4
- package/dist/policy/defaultRegistry.d.ts.map +1 -1
- package/dist/policy/defaultRegistry.js +3 -4
- package/dist/policy/defaultRegistry.js.map +1 -1
- package/dist/policy/index.d.ts +2 -2
- package/dist/policy/index.d.ts.map +1 -1
- package/dist/policy/index.js +1 -1
- package/dist/policy/index.js.map +1 -1
- package/dist/policy/resolveViewer.d.ts +9 -9
- package/dist/policy/resolveViewer.js +9 -9
- package/dist/routes/_shared.d.ts +93 -153
- package/dist/routes/_shared.d.ts.map +1 -1
- package/dist/routes/_shared.js +9 -5
- package/dist/routes/_shared.js.map +1 -1
- package/dist/routes/admin.d.ts +1 -1
- package/dist/routes/admin.d.ts.map +1 -1
- package/dist/routes/admin.js +13 -12
- package/dist/routes/admin.js.map +1 -1
- package/dist/routes/auth.d.ts +12 -10
- package/dist/routes/auth.d.ts.map +1 -1
- package/dist/routes/auth.js +32 -34
- package/dist/routes/auth.js.map +1 -1
- package/dist/routes/clarifications.d.ts +8 -0
- package/dist/routes/clarifications.d.ts.map +1 -0
- package/dist/routes/clarifications.js +246 -0
- package/dist/routes/clarifications.js.map +1 -0
- package/dist/routes/edges.d.ts.map +1 -1
- package/dist/routes/edges.js +2 -6
- package/dist/routes/edges.js.map +1 -1
- package/dist/routes/history.d.ts.map +1 -1
- package/dist/routes/history.js +12 -10
- package/dist/routes/history.js.map +1 -1
- package/dist/routes/nodes.d.ts.map +1 -1
- package/dist/routes/nodes.js +4 -8
- package/dist/routes/nodes.js.map +1 -1
- package/dist/routes/oauth.d.ts +6 -7
- package/dist/routes/oauth.d.ts.map +1 -1
- package/dist/routes/oauth.js +6 -7
- package/dist/routes/oauth.js.map +1 -1
- package/dist/routes/ontologies.d.ts +7 -0
- package/dist/routes/ontologies.d.ts.map +1 -0
- package/dist/routes/ontologies.js +29 -0
- package/dist/routes/ontologies.js.map +1 -0
- package/dist/routes/ontology.d.ts.map +1 -1
- package/dist/routes/ontology.js +2 -1
- package/dist/routes/ontology.js.map +1 -1
- package/dist/routes/proposals.d.ts +2 -2
- package/dist/routes/proposals.d.ts.map +1 -1
- package/dist/routes/proposals.js +35 -30
- package/dist/routes/proposals.js.map +1 -1
- package/dist/routes/reactorCycles.d.ts +7 -0
- package/dist/routes/reactorCycles.d.ts.map +1 -0
- package/dist/routes/reactorCycles.js +60 -0
- package/dist/routes/reactorCycles.js.map +1 -0
- package/dist/routes/runs.d.ts.map +1 -1
- package/dist/routes/runs.js +22 -19
- package/dist/routes/runs.js.map +1 -1
- package/dist/routes/skillInputOptions.d.ts +2 -2
- package/dist/routes/skillInputOptions.d.ts.map +1 -1
- package/dist/routes/skillInputOptions.js +53 -53
- package/dist/routes/skillInputOptions.js.map +1 -1
- package/dist/routes/skills.d.ts +19 -1
- package/dist/routes/skills.d.ts.map +1 -1
- package/dist/routes/skills.js +141 -7
- package/dist/routes/skills.js.map +1 -1
- package/dist/routes/sourceLoaders.d.ts.map +1 -1
- package/dist/routes/sourceLoaders.js +1 -0
- package/dist/routes/sourceLoaders.js.map +1 -1
- package/dist/routes/sourceUnitObservations.d.ts +20 -0
- package/dist/routes/sourceUnitObservations.d.ts.map +1 -0
- package/dist/routes/sourceUnitObservations.js +80 -0
- package/dist/routes/sourceUnitObservations.js.map +1 -0
- package/dist/routes/sourceWebhooks.d.ts +26 -0
- package/dist/routes/sourceWebhooks.d.ts.map +1 -0
- package/dist/routes/sourceWebhooks.js +301 -0
- package/dist/routes/sourceWebhooks.js.map +1 -0
- package/dist/routes/users.d.ts +0 -2
- package/dist/routes/users.d.ts.map +1 -1
- package/dist/routes/users.js +15 -33
- package/dist/routes/users.js.map +1 -1
- package/dist/routes/workspaceEvents.d.ts +5 -4
- package/dist/routes/workspaceEvents.d.ts.map +1 -1
- package/dist/routes/workspaceEvents.js +7 -6
- package/dist/routes/workspaceEvents.js.map +1 -1
- package/dist/routes/workspaceMembers.d.ts +1 -1
- package/dist/routes/workspaceMembers.d.ts.map +1 -1
- package/dist/routes/workspaceMembers.js +2 -2
- package/dist/routes/workspaceMembers.js.map +1 -1
- package/dist/routes/workspaces.d.ts +21 -10
- package/dist/routes/workspaces.d.ts.map +1 -1
- package/dist/routes/workspaces.js +95 -69
- package/dist/routes/workspaces.js.map +1 -1
- package/dist/server.js +6 -70
- package/dist/server.js.map +1 -1
- package/dist/serviceAccounts.d.ts +13 -0
- package/dist/serviceAccounts.d.ts.map +1 -0
- package/dist/serviceAccounts.js +26 -0
- package/dist/serviceAccounts.js.map +1 -0
- package/dist/startServer.d.ts +17 -0
- package/dist/startServer.d.ts.map +1 -0
- package/dist/startServer.js +81 -0
- package/dist/startServer.js.map +1 -0
- package/dist/startup.d.ts +28 -0
- package/dist/startup.d.ts.map +1 -0
- package/dist/startup.js +94 -0
- package/dist/startup.js.map +1 -0
- package/package.json +35 -40
- package/dist/composeFs.d.ts +0 -55
- package/dist/composeFs.d.ts.map +0 -1
- package/dist/composeFs.js.map +0 -1
- package/dist/composition.d.ts +0 -133
- package/dist/composition.d.ts.map +0 -1
- package/dist/composition.js +0 -113
- package/dist/composition.js.map +0 -1
- package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts +0 -75
- package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts.map +0 -1
- package/dist/infrastructure/agent/SubprocessSkillRunner.js.map +0 -1
- package/dist/infrastructure/agent/asyncQueue.d.ts +0 -22
- package/dist/infrastructure/agent/asyncQueue.d.ts.map +0 -1
- package/dist/infrastructure/agent/mcpConfig.d.ts +0 -38
- package/dist/infrastructure/agent/mcpConfig.d.ts.map +0 -1
- package/dist/infrastructure/agent/mcpConfig.js +0 -55
- package/dist/infrastructure/agent/mcpConfig.js.map +0 -1
- package/dist/infrastructure/agent/streamJsonParser.d.ts +0 -20
- package/dist/infrastructure/agent/streamJsonParser.d.ts.map +0 -1
- package/dist/infrastructure/agent/streamJsonParser.js.map +0 -1
- package/dist/infrastructure/agent/subprocessEventStream.d.ts +0 -26
- package/dist/infrastructure/agent/subprocessEventStream.d.ts.map +0 -1
- package/dist/infrastructure/agent/subprocessEventStream.js +0 -112
- package/dist/infrastructure/agent/subprocessEventStream.js.map +0 -1
- package/dist/infrastructure/auth/ensureApprovedEmails.d.ts +0 -16
- package/dist/infrastructure/auth/ensureApprovedEmails.d.ts.map +0 -1
- package/dist/infrastructure/auth/ensureApprovedEmails.js +0 -20
- package/dist/infrastructure/auth/ensureApprovedEmails.js.map +0 -1
- package/dist/infrastructure/env.d.ts +0 -11
- package/dist/infrastructure/env.d.ts.map +0 -1
- package/dist/infrastructure/env.js.map +0 -1
- package/dist/infrastructure/fs/FsBatchPlanRepository.d.ts +0 -300
- package/dist/infrastructure/fs/FsBatchPlanRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsBatchPlanRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts +0 -13
- package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsClarifyTicketRepository.js +0 -39
- package/dist/infrastructure/fs/FsClarifyTicketRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsDecisionRepository.d.ts +0 -13
- package/dist/infrastructure/fs/FsDecisionRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsDecisionRepository.js +0 -56
- package/dist/infrastructure/fs/FsDecisionRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsGraphSerializer.d.ts +0 -629
- package/dist/infrastructure/fs/FsGraphSerializer.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsGraphSerializer.js.map +0 -1
- package/dist/infrastructure/fs/FsProposalRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsProposalRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsRunRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsRunRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsSkillRegistry.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsSkillRegistry.js.map +0 -1
- package/dist/infrastructure/fs/FsSourceUnitDigest.d.ts +0 -19
- package/dist/infrastructure/fs/FsSourceUnitDigest.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsSourceUnitDigest.js.map +0 -1
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.d.ts +0 -30
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsStatusedJsonRepository.d.ts +0 -35
- package/dist/infrastructure/fs/FsStatusedJsonRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsStatusedJsonRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsWorkspaceRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsWorkspaceRepository.js.map +0 -1
- package/dist/infrastructure/fs/WorkspaceDiscovery.d.ts +0 -15
- package/dist/infrastructure/fs/WorkspaceDiscovery.d.ts.map +0 -1
- package/dist/infrastructure/fs/WorkspaceDiscovery.js.map +0 -1
- package/dist/infrastructure/fs/WorkspaceRegistryFile.d.ts.map +0 -1
- package/dist/infrastructure/fs/WorkspaceRegistryFile.js.map +0 -1
- package/dist/infrastructure/fs/frontmatter.d.ts +0 -13
- package/dist/infrastructure/fs/frontmatter.d.ts.map +0 -1
- package/dist/infrastructure/fs/frontmatter.js.map +0 -1
- package/dist/infrastructure/fs/intentScan.d.ts +0 -9
- package/dist/infrastructure/fs/intentScan.d.ts.map +0 -1
- package/dist/infrastructure/fs/intentScan.js.map +0 -1
- package/dist/infrastructure/fs/jsonFileStore.d.ts.map +0 -1
- package/dist/infrastructure/fs/jsonFileStore.js.map +0 -1
- package/dist/infrastructure/fs/paths.d.ts.map +0 -1
- package/dist/infrastructure/fs/paths.js.map +0 -1
- package/dist/infrastructure/fs/productManifestWriter.d.ts +0 -22
- package/dist/infrastructure/fs/productManifestWriter.d.ts.map +0 -1
- package/dist/infrastructure/fs/productManifestWriter.js.map +0 -1
- package/dist/infrastructure/git/GitWorkspaceHistory.d.ts.map +0 -1
- package/dist/infrastructure/git/GitWorkspaceHistory.js.map +0 -1
- package/dist/infrastructure/git/commitMessage.d.ts.map +0 -1
- package/dist/infrastructure/git/commitMessage.js +0 -71
- package/dist/infrastructure/git/commitMessage.js.map +0 -1
- package/dist/infrastructure/orphanReaper.d.ts +0 -18
- package/dist/infrastructure/orphanReaper.d.ts.map +0 -1
- package/dist/infrastructure/orphanReaper.js.map +0 -1
- package/dist/infrastructure/users/ensureLocalUser.d.ts +0 -15
- package/dist/infrastructure/users/ensureLocalUser.d.ts.map +0 -1
- package/dist/infrastructure/users/ensureLocalUser.js +0 -38
- package/dist/infrastructure/users/ensureLocalUser.js.map +0 -1
- package/dist/middleware/requireAdmin.d.ts +0 -10
- package/dist/middleware/requireAdmin.d.ts.map +0 -1
- package/dist/middleware/requireAdmin.js +0 -24
- package/dist/middleware/requireAdmin.js.map +0 -1
- package/dist/middleware/userId.d.ts +0 -16
- package/dist/middleware/userId.d.ts.map +0 -1
- package/dist/middleware/userId.js +0 -27
- package/dist/middleware/userId.js.map +0 -1
- package/dist/policy/Capability.d.ts +0 -12
- package/dist/policy/Capability.d.ts.map +0 -1
- package/dist/policy/Capability.js +0 -31
- package/dist/policy/Capability.js.map +0 -1
- package/dist/routes/clarify.d.ts +0 -9
- package/dist/routes/clarify.d.ts.map +0 -1
- package/dist/routes/clarify.js +0 -274
- package/dist/routes/clarify.js.map +0 -1
- package/dist/routes/decisions.d.ts +0 -7
- package/dist/routes/decisions.d.ts.map +0 -1
- package/dist/routes/decisions.js +0 -68
- package/dist/routes/decisions.js.map +0 -1
- package/dist/routes/sourceUnitStates.d.ts +0 -7
- package/dist/routes/sourceUnitStates.d.ts.map +0 -1
- package/dist/routes/sourceUnitStates.js +0 -45
- package/dist/routes/sourceUnitStates.js.map +0 -1
- /package/dist/infrastructure/{fs → _shared}/jsonFileStore.d.ts +0 -0
- /package/dist/infrastructure/{fs → _shared}/jsonFileStore.js +0 -0
- /package/dist/infrastructure/{git → history}/GitWorkspaceHistory.d.ts +0 -0
- /package/dist/infrastructure/{git → history}/commitMessage.d.ts +0 -0
- /package/dist/infrastructure/{fs → hitl}/FsProposalRepository.d.ts +0 -0
- /package/dist/infrastructure/{fs → workspace}/FsWorkspaceRepository.d.ts +0 -0
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { UserId as UserIdType } from '@braidhq/schema';
|
|
2
|
-
import type { Context, MiddlewareHandler } from 'hono';
|
|
3
|
-
declare module 'hono' {
|
|
4
|
-
interface ContextVariableMap {
|
|
5
|
-
userId: UserIdType;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Resolve the caller's userId from `X-Braid-User` (Phase A) and stash
|
|
10
|
-
* it on the request context. Falls back to `local-user` when the
|
|
11
|
-
* header is absent, preserving local-only behaviour for the embedded
|
|
12
|
-
* sidecar that doesn't bother sending one.
|
|
13
|
-
*/
|
|
14
|
-
export declare const userIdMiddleware: MiddlewareHandler;
|
|
15
|
-
export declare function getUserId(context: Context): UserIdType;
|
|
16
|
-
//# sourceMappingURL=userId.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"userId.d.ts","sourceRoot":"","sources":["../../src/middleware/userId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAA;AAGtD,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAU,kBAAkB;QAC1B,MAAM,EAAE,UAAU,CAAA;KACnB;CACF;AAaD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,iBAM9B,CAAA;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,CAEtD"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { UserId } from '@braidhq/schema';
|
|
2
|
-
/**
|
|
3
|
-
* Header name carrying the caller's userId in Phase A (pre-auth).
|
|
4
|
-
* Phase B (Google OAuth) will replace this with `Authorization: Bearer`
|
|
5
|
-
* token resolution and `c.set('userId', ...)` upstream of this middleware;
|
|
6
|
-
* the rest of the codebase only ever calls `getUserId(c)`, so the
|
|
7
|
-
* substitution stays local to the auth layer.
|
|
8
|
-
*/
|
|
9
|
-
const HEADER = 'X-Braid-User';
|
|
10
|
-
const DEFAULT_USER_ID = UserId.parse('local-user');
|
|
11
|
-
/**
|
|
12
|
-
* Resolve the caller's userId from `X-Braid-User` (Phase A) and stash
|
|
13
|
-
* it on the request context. Falls back to `local-user` when the
|
|
14
|
-
* header is absent, preserving local-only behaviour for the embedded
|
|
15
|
-
* sidecar that doesn't bother sending one.
|
|
16
|
-
*/
|
|
17
|
-
export const userIdMiddleware = async (context, next) => {
|
|
18
|
-
if (context.get('userId') === undefined) {
|
|
19
|
-
const header = context.req.header(HEADER);
|
|
20
|
-
context.set('userId', header && header.length > 0 ? UserId.parse(header) : DEFAULT_USER_ID);
|
|
21
|
-
}
|
|
22
|
-
await next();
|
|
23
|
-
};
|
|
24
|
-
export function getUserId(context) {
|
|
25
|
-
return context.get('userId');
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=userId.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"userId.js","sourceRoot":"","sources":["../../src/middleware/userId.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAQxC;;;;;;GAMG;AACH,MAAM,MAAM,GAAG,cAAc,CAAA;AAE7B,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;AAElD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAsB,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACzE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE,CAAC;QACxC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QACzC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAA;IAC7F,CAAC;IACD,MAAM,IAAI,EAAE,CAAA;AACd,CAAC,CAAA;AAED,MAAM,UAAU,SAAS,CAAC,OAAgB;IACxC,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAC9B,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Closed enumeration of capability identifiers known to the core
|
|
3
|
-
* platform. Plugins can register their own checks under custom string
|
|
4
|
-
* ids; this list is the central catalog so first-party code has a
|
|
5
|
-
* type-safe handle.
|
|
6
|
-
*
|
|
7
|
-
* New capability = add to CAPABILITY_IDS + write a CapabilityCheck
|
|
8
|
-
* class implementing it. Existing checks don't care about new ids.
|
|
9
|
-
*/
|
|
10
|
-
export declare const CAPABILITY_IDS: readonly ["workspace.create", "workspace.read", "workspace.write", "proposal.read", "proposal.write", "clarify.read", "clarify.write", "history.write", "skill.run"];
|
|
11
|
-
export type Capability = (typeof CAPABILITY_IDS)[number];
|
|
12
|
-
//# sourceMappingURL=Capability.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Capability.d.ts","sourceRoot":"","sources":["../../src/policy/Capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,sKAsBjB,CAAA;AAEV,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Closed enumeration of capability identifiers known to the core
|
|
3
|
-
* platform. Plugins can register their own checks under custom string
|
|
4
|
-
* ids; this list is the central catalog so first-party code has a
|
|
5
|
-
* type-safe handle.
|
|
6
|
-
*
|
|
7
|
-
* New capability = add to CAPABILITY_IDS + write a CapabilityCheck
|
|
8
|
-
* class implementing it. Existing checks don't care about new ids.
|
|
9
|
-
*/
|
|
10
|
-
export const CAPABILITY_IDS = [
|
|
11
|
-
// Server-scope. No workspace member required; resolveViewer is built
|
|
12
|
-
// with member=undefined so only admins resolve to effectiveRole='owner'.
|
|
13
|
-
'workspace.create', // scaffold a new workspace or register a path
|
|
14
|
-
// Workspace-scope. Each resource has at most one read and one write
|
|
15
|
-
// capability. "Read" means see, "write" means change anything mutable
|
|
16
|
-
// in that resource. We deliberately don't split write into submit /
|
|
17
|
-
// approve / delete sub-verbs. If you can change anything, you can
|
|
18
|
-
// change everything inside that resource.
|
|
19
|
-
'workspace.read', // open the workspace, see settings, sources, members, graph, history
|
|
20
|
-
'workspace.write', // edit PRODUCT.md / sources / plugins / ontology / members / delete
|
|
21
|
-
'proposal.read', // list and read pending or decided proposals
|
|
22
|
-
'proposal.write', // submit, apply, reject
|
|
23
|
-
'clarify.read', // list and read clarify tickets
|
|
24
|
-
'clarify.write', // answer, skip
|
|
25
|
-
'history.write', // restore a past commit, manage tags
|
|
26
|
-
// Skill execution carries a per-(member, skill) override matrix on
|
|
27
|
-
// top of role default, so it can't be collapsed into a plain
|
|
28
|
-
// read/write pair. Kept as its own verb for that reason.
|
|
29
|
-
'skill.run',
|
|
30
|
-
];
|
|
31
|
-
//# sourceMappingURL=Capability.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Capability.js","sourceRoot":"","sources":["../../src/policy/Capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,qEAAqE;IACrE,yEAAyE;IACzE,kBAAkB,EAAE,8CAA8C;IAElE,oEAAoE;IACpE,sEAAsE;IACtE,oEAAoE;IACpE,kEAAkE;IAClE,0CAA0C;IAC1C,gBAAgB,EAAE,qEAAqE;IACvF,iBAAiB,EAAE,oEAAoE;IACvF,eAAe,EAAE,6CAA6C;IAC9D,gBAAgB,EAAE,wBAAwB;IAC1C,cAAc,EAAE,gCAAgC;IAChD,eAAe,EAAE,eAAe;IAChC,eAAe,EAAE,qCAAqC;IAEtD,mEAAmE;IACnE,6DAA6D;IAC7D,yDAAyD;IACzD,WAAW;CACH,CAAA"}
|
package/dist/routes/clarify.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ClarifyTicketRepository, DecisionRepository, HITLService } from '@braidhq/core';
|
|
2
|
-
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
3
|
-
export interface ClarifyRouterDeps {
|
|
4
|
-
hitlService: HITLService;
|
|
5
|
-
clarifyRepository: ClarifyTicketRepository;
|
|
6
|
-
decisionRepository: DecisionRepository;
|
|
7
|
-
}
|
|
8
|
-
export declare function createClarifyRouter(deps: ClarifyRouterDeps): OpenAPIHono;
|
|
9
|
-
//# sourceMappingURL=clarify.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clarify.d.ts","sourceRoot":"","sources":["../../src/routes/clarify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAI7F,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAA;AAwF/D,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,WAAW,CAAA;IACxB,iBAAiB,EAAE,uBAAuB,CAAA;IAC1C,kBAAkB,EAAE,kBAAkB,CAAA;CACvC;AAiHD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,WAAW,CAsGxE"}
|
package/dist/routes/clarify.js
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import { newClarifyCandidateId } from '@braidhq/core';
|
|
2
|
-
import { ClarifyCandidate, ClarifyCandidateId, ClarifyDraft, ClarifyStatus, ClarifyTicket, ClarifyTicketId, Decision, ProposalId, UserId } from '@braidhq/schema';
|
|
3
|
-
import { createRoute, OpenAPIHono, z } from '@hono/zod-openapi';
|
|
4
|
-
import { getUserId } from '../middleware/userId.js';
|
|
5
|
-
import { getViewerContext, requirePermission } from '../middleware/workspaceAccess.js';
|
|
6
|
-
import { getWorkspaceId } from '../middleware/workspaceId.js';
|
|
7
|
-
import { NotFoundResponse, ValidationFailureResponse, WorkspaceIdParam } from './_shared.js';
|
|
8
|
-
import { assertEntityInWorkspace } from './helpers.js';
|
|
9
|
-
async function latestRationale(decisions, workspaceId, ticketId, action) {
|
|
10
|
-
const all = await decisions.list({ workspaceId, actions: [action] });
|
|
11
|
-
const match = all
|
|
12
|
-
.filter(d => d.references.clarifyTicketId === ticketId && typeof d.rationale === 'string')
|
|
13
|
-
.sort((a, b) => (a.timestamp < b.timestamp ? 1 : -1))[0];
|
|
14
|
-
return match?.rationale;
|
|
15
|
-
}
|
|
16
|
-
const ListQuery = z.object({
|
|
17
|
-
status: z.union([ClarifyStatus, z.array(ClarifyStatus)]).optional().openapi({ description: 'Filter by ticket status; pass one or many.' }),
|
|
18
|
-
limit: z.coerce.number().int().positive().optional(),
|
|
19
|
-
offset: z.coerce.number().int().nonnegative().optional(),
|
|
20
|
-
showAll: z.coerce.boolean().optional().openapi({ description: 'Owner-only: bypass the personal-pending filter so every member\'s open questions are visible.' }),
|
|
21
|
-
});
|
|
22
|
-
// Reviewer-facing answer body. The selection is either an existing
|
|
23
|
-
// `candidateId` or a freshly authored `customCandidate` (description
|
|
24
|
-
// only — the server appends it to the ticket and answers in one
|
|
25
|
-
// transaction). `note` is a free-text rationale that survives on the
|
|
26
|
-
// Decision log; the GET projection surfaces it back as `answerNote`.
|
|
27
|
-
// `userId` accepted for backwards compat; authoritative value is the
|
|
28
|
-
// request context (set by `userIdMiddleware`).
|
|
29
|
-
const AnswerBody = z
|
|
30
|
-
.object({
|
|
31
|
-
candidateId: ClarifyCandidateId.optional(),
|
|
32
|
-
customCandidate: z.object({ description: z.string().min(1) }).optional(),
|
|
33
|
-
userId: UserId.optional(),
|
|
34
|
-
note: z.string().min(1).optional(),
|
|
35
|
-
})
|
|
36
|
-
.refine(body => Boolean(body.candidateId) !== Boolean(body.customCandidate), { message: 'Provide exactly one of candidateId or customCandidate' })
|
|
37
|
-
.openapi('ClarifyAnswerBody');
|
|
38
|
-
const SkipBody = z.object({
|
|
39
|
-
reason: z.string().min(1),
|
|
40
|
-
userId: UserId.optional(),
|
|
41
|
-
}).openapi('ClarifySkipBody');
|
|
42
|
-
// PATCH body for clarify state transitions. Currently the only legal
|
|
43
|
-
// transition the skill drives is `answered → applied`. proposalId is
|
|
44
|
-
// optional: present when a Proposal was produced, absent when the
|
|
45
|
-
// chosen candidate had no graph impact (skill records the ticket as
|
|
46
|
-
// applied without a linking proposal).
|
|
47
|
-
const ApplyBody = z.object({
|
|
48
|
-
status: z.literal('applied'),
|
|
49
|
-
proposalId: ProposalId.optional(),
|
|
50
|
-
userId: UserId.optional(),
|
|
51
|
-
}).openapi('ClarifyApplyBody');
|
|
52
|
-
// Skill-emitted candidates ship their own ids (`cc-1`, `cc-merge`, …);
|
|
53
|
-
// human-authored ones via Studio's "New question" form omit them and
|
|
54
|
-
// let the server mint via `newClarifyCandidateId`. Keeps the ID
|
|
55
|
-
// minting rule (no `crypto.randomUUID() as XxxId` in clients) intact.
|
|
56
|
-
const CreateBody = ClarifyDraft
|
|
57
|
-
.omit({ workspaceId: true })
|
|
58
|
-
.extend({ candidates: z.array(ClarifyCandidate.partial({ id: true })) })
|
|
59
|
-
.openapi('ClarifyCreateBody');
|
|
60
|
-
const ClarifyTicketIdParam = WorkspaceIdParam.extend({
|
|
61
|
-
clarifyTicketId: ClarifyTicketId.openapi({ param: { name: 'clarifyTicketId', in: 'path' } }),
|
|
62
|
-
});
|
|
63
|
-
const ClarifyListResponse = z.object({
|
|
64
|
-
items: z.array(ClarifyTicket),
|
|
65
|
-
}).openapi('ClarifyListResponse');
|
|
66
|
-
// GET /clarify/:id may attach a projection field (`skipReason` /
|
|
67
|
-
// `answerNote`) when surfacing the latest Decision rationale. Either
|
|
68
|
-
// field shows up on top of the base ClarifyTicket shape; never both.
|
|
69
|
-
const ClarifyTicketWithProjection = ClarifyTicket.extend({
|
|
70
|
-
skipReason: z.string().optional(),
|
|
71
|
-
answerNote: z.string().optional(),
|
|
72
|
-
}).openapi('ClarifyTicketWithProjection');
|
|
73
|
-
const createClarifyRoute = createRoute({
|
|
74
|
-
method: 'post',
|
|
75
|
-
path: '/',
|
|
76
|
-
operationId: 'createClarifyTicket',
|
|
77
|
-
summary: 'Create a clarify ticket. Skills submit this when they cannot decide between candidate interpretations.',
|
|
78
|
-
tags: ['clarify'],
|
|
79
|
-
request: {
|
|
80
|
-
params: WorkspaceIdParam,
|
|
81
|
-
body: { content: { 'application/json': { schema: CreateBody } } },
|
|
82
|
-
},
|
|
83
|
-
responses: {
|
|
84
|
-
201: {
|
|
85
|
-
description: 'The saved clarify ticket.',
|
|
86
|
-
content: { 'application/json': { schema: ClarifyTicket } },
|
|
87
|
-
},
|
|
88
|
-
400: ValidationFailureResponse,
|
|
89
|
-
},
|
|
90
|
-
});
|
|
91
|
-
const listClarifyRoute = createRoute({
|
|
92
|
-
method: 'get',
|
|
93
|
-
path: '/',
|
|
94
|
-
operationId: 'listClarifyTickets',
|
|
95
|
-
summary: 'List clarify tickets for a workspace, optionally filtered by status.',
|
|
96
|
-
tags: ['clarify'],
|
|
97
|
-
request: {
|
|
98
|
-
params: WorkspaceIdParam,
|
|
99
|
-
query: ListQuery,
|
|
100
|
-
},
|
|
101
|
-
responses: {
|
|
102
|
-
200: {
|
|
103
|
-
description: 'A page of matching clarify tickets.',
|
|
104
|
-
content: { 'application/json': { schema: ClarifyListResponse } },
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
const getClarifyRoute = createRoute({
|
|
109
|
-
method: 'get',
|
|
110
|
-
path: '/{clarifyTicketId}',
|
|
111
|
-
operationId: 'getClarifyTicket',
|
|
112
|
-
summary: 'Fetch a single clarify ticket. May include `skipReason` / `answerNote` projection when terminal.',
|
|
113
|
-
tags: ['clarify'],
|
|
114
|
-
request: { params: ClarifyTicketIdParam },
|
|
115
|
-
responses: {
|
|
116
|
-
200: {
|
|
117
|
-
description: 'The requested ticket (optionally with skipReason / answerNote projection).',
|
|
118
|
-
content: { 'application/json': { schema: ClarifyTicketWithProjection } },
|
|
119
|
-
},
|
|
120
|
-
404: NotFoundResponse,
|
|
121
|
-
},
|
|
122
|
-
});
|
|
123
|
-
const answerClarifyRoute = createRoute({
|
|
124
|
-
method: 'post',
|
|
125
|
-
path: '/{clarifyTicketId}/answer',
|
|
126
|
-
operationId: 'answerClarifyTicket',
|
|
127
|
-
summary: 'Reviewer answers a clarify ticket. Triggers `pending → answered` transition.',
|
|
128
|
-
tags: ['clarify'],
|
|
129
|
-
request: {
|
|
130
|
-
params: ClarifyTicketIdParam,
|
|
131
|
-
body: { content: { 'application/json': { schema: AnswerBody } } },
|
|
132
|
-
},
|
|
133
|
-
responses: {
|
|
134
|
-
200: {
|
|
135
|
-
description: 'The recorded Decision.',
|
|
136
|
-
content: { 'application/json': { schema: Decision } },
|
|
137
|
-
},
|
|
138
|
-
404: NotFoundResponse,
|
|
139
|
-
},
|
|
140
|
-
});
|
|
141
|
-
const applyClarifyRoute = createRoute({
|
|
142
|
-
method: 'patch',
|
|
143
|
-
path: '/{clarifyTicketId}',
|
|
144
|
-
operationId: 'markClarifyTicketApplied',
|
|
145
|
-
summary: 'Mark a clarify ticket applied. Optionally link the materialised Proposal.',
|
|
146
|
-
description: 'Called by the braid-clarify skill once it has wrapped the resolution into a Proposal (or determined there is no graph impact). Transitions `answered → applied`.',
|
|
147
|
-
tags: ['clarify'],
|
|
148
|
-
request: {
|
|
149
|
-
params: ClarifyTicketIdParam,
|
|
150
|
-
body: { content: { 'application/json': { schema: ApplyBody } } },
|
|
151
|
-
},
|
|
152
|
-
responses: {
|
|
153
|
-
200: {
|
|
154
|
-
description: 'The recorded Decision.',
|
|
155
|
-
content: { 'application/json': { schema: Decision } },
|
|
156
|
-
},
|
|
157
|
-
404: NotFoundResponse,
|
|
158
|
-
},
|
|
159
|
-
});
|
|
160
|
-
const skipClarifyRoute = createRoute({
|
|
161
|
-
method: 'post',
|
|
162
|
-
path: '/{clarifyTicketId}/skip',
|
|
163
|
-
operationId: 'skipClarifyTicket',
|
|
164
|
-
summary: 'Skip a clarify ticket with a reason. Triggers `pending → skipped` transition.',
|
|
165
|
-
tags: ['clarify'],
|
|
166
|
-
request: {
|
|
167
|
-
params: ClarifyTicketIdParam,
|
|
168
|
-
body: { content: { 'application/json': { schema: SkipBody } } },
|
|
169
|
-
},
|
|
170
|
-
responses: {
|
|
171
|
-
200: {
|
|
172
|
-
description: 'The recorded Decision.',
|
|
173
|
-
content: { 'application/json': { schema: Decision } },
|
|
174
|
-
},
|
|
175
|
-
404: NotFoundResponse,
|
|
176
|
-
},
|
|
177
|
-
});
|
|
178
|
-
export function createClarifyRouter(deps) {
|
|
179
|
-
const router = new OpenAPIHono();
|
|
180
|
-
// Answer / skip / mark-applied are HITL decisions — Owner + Maintainer
|
|
181
|
-
// only. Guests never see the tab but a direct curl still 403s here.
|
|
182
|
-
router.use('/:clarifyTicketId/answer', requirePermission('clarify.write'));
|
|
183
|
-
router.use('/:clarifyTicketId/skip', requirePermission('clarify.write'));
|
|
184
|
-
router.use('/:clarifyTicketId', requirePermission('clarify.write'));
|
|
185
|
-
router.openapi(createClarifyRoute, async (context) => {
|
|
186
|
-
const workspaceId = getWorkspaceId(context);
|
|
187
|
-
const body = context.req.valid('json');
|
|
188
|
-
const submitterId = getUserId(context);
|
|
189
|
-
const candidates = body.candidates.map(c => ({
|
|
190
|
-
...c,
|
|
191
|
-
id: c.id ?? newClarifyCandidateId(),
|
|
192
|
-
}));
|
|
193
|
-
const ticket = await deps.hitlService.submitClarifyTicket({ ...body, workspaceId, candidates, submitterId });
|
|
194
|
-
return context.json(ticket.toData(), 201);
|
|
195
|
-
});
|
|
196
|
-
router.openapi(listClarifyRoute, async (context) => {
|
|
197
|
-
const workspaceId = getWorkspaceId(context);
|
|
198
|
-
const { status, limit, offset, showAll } = context.req.valid('query');
|
|
199
|
-
const statuses = status === undefined ? undefined : Array.isArray(status) ? status : [status];
|
|
200
|
-
const viewer = getViewerContext(context);
|
|
201
|
-
const viewerId = (showAll && viewer?.effectiveRole === 'owner') ? undefined : getUserId(context);
|
|
202
|
-
const tickets = await deps.clarifyRepository.list({
|
|
203
|
-
workspaceId,
|
|
204
|
-
statuses,
|
|
205
|
-
limit,
|
|
206
|
-
offset,
|
|
207
|
-
...(viewerId ? { viewerId } : {}),
|
|
208
|
-
});
|
|
209
|
-
return context.json({ items: tickets.map(ticket => ticket.toData()) }, 200);
|
|
210
|
-
});
|
|
211
|
-
router.openapi(getClarifyRoute, async (context) => {
|
|
212
|
-
const workspaceId = getWorkspaceId(context);
|
|
213
|
-
const { clarifyTicketId } = context.req.valid('param');
|
|
214
|
-
const ticket = await deps.clarifyRepository.load(clarifyTicketId);
|
|
215
|
-
assertEntityInWorkspace(workspaceId, ticket.workspaceId, 'ClarifyTicket', clarifyTicketId);
|
|
216
|
-
const data = ticket.toData();
|
|
217
|
-
// Surface the reviewer's free-text rationale alongside the ticket
|
|
218
|
-
// so the UI can show it without a separate decisions fetch. The
|
|
219
|
-
// text lives only on the Decision; we read the latest matching one
|
|
220
|
-
// and add a projection field (`skipReason` or `answerNote`) for
|
|
221
|
-
// the relevant terminal status.
|
|
222
|
-
if (data.status === 'skipped') {
|
|
223
|
-
const reason = await latestRationale(deps.decisionRepository, workspaceId, clarifyTicketId, 'skipClarifyTicket');
|
|
224
|
-
if (reason)
|
|
225
|
-
return context.json({ ...data, skipReason: reason }, 200);
|
|
226
|
-
}
|
|
227
|
-
else if (data.status === 'answered' || data.status === 'applied') {
|
|
228
|
-
const note = await latestRationale(deps.decisionRepository, workspaceId, clarifyTicketId, 'answerClarifyTicket');
|
|
229
|
-
if (note)
|
|
230
|
-
return context.json({ ...data, answerNote: note }, 200);
|
|
231
|
-
}
|
|
232
|
-
return context.json(data, 200);
|
|
233
|
-
});
|
|
234
|
-
router.openapi(answerClarifyRoute, async (context) => {
|
|
235
|
-
const workspaceId = getWorkspaceId(context);
|
|
236
|
-
const { clarifyTicketId } = context.req.valid('param');
|
|
237
|
-
const body = context.req.valid('json');
|
|
238
|
-
const userId = body.userId ?? getUserId(context);
|
|
239
|
-
const ticket = await deps.clarifyRepository.load(clarifyTicketId);
|
|
240
|
-
assertEntityInWorkspace(workspaceId, ticket.workspaceId, 'ClarifyTicket', clarifyTicketId);
|
|
241
|
-
const selection = body.candidateId
|
|
242
|
-
? { kind: 'existing', candidateId: body.candidateId }
|
|
243
|
-
: { kind: 'custom', description: body.customCandidate.description };
|
|
244
|
-
const decision = await deps.hitlService.answerClarifyTicket({
|
|
245
|
-
clarifyTicketId,
|
|
246
|
-
selection,
|
|
247
|
-
userId,
|
|
248
|
-
...(body.note ? { note: body.note } : {}),
|
|
249
|
-
});
|
|
250
|
-
return context.json(decision, 200);
|
|
251
|
-
});
|
|
252
|
-
router.openapi(applyClarifyRoute, async (context) => {
|
|
253
|
-
const workspaceId = getWorkspaceId(context);
|
|
254
|
-
const { clarifyTicketId } = context.req.valid('param');
|
|
255
|
-
const { proposalId, userId: bodyUserId } = context.req.valid('json');
|
|
256
|
-
const userId = bodyUserId ?? getUserId(context);
|
|
257
|
-
const ticket = await deps.clarifyRepository.load(clarifyTicketId);
|
|
258
|
-
assertEntityInWorkspace(workspaceId, ticket.workspaceId, 'ClarifyTicket', clarifyTicketId);
|
|
259
|
-
const decision = await deps.hitlService.markClarifyTicketApplied(clarifyTicketId, userId, proposalId);
|
|
260
|
-
return context.json(decision, 200);
|
|
261
|
-
});
|
|
262
|
-
router.openapi(skipClarifyRoute, async (context) => {
|
|
263
|
-
const workspaceId = getWorkspaceId(context);
|
|
264
|
-
const { clarifyTicketId } = context.req.valid('param');
|
|
265
|
-
const { reason, userId: bodyUserId } = context.req.valid('json');
|
|
266
|
-
const userId = bodyUserId ?? getUserId(context);
|
|
267
|
-
const ticket = await deps.clarifyRepository.load(clarifyTicketId);
|
|
268
|
-
assertEntityInWorkspace(workspaceId, ticket.workspaceId, 'ClarifyTicket', clarifyTicketId);
|
|
269
|
-
const decision = await deps.hitlService.skipClarifyTicket(clarifyTicketId, reason, userId);
|
|
270
|
-
return context.json(decision, 200);
|
|
271
|
-
});
|
|
272
|
-
return router;
|
|
273
|
-
}
|
|
274
|
-
//# sourceMappingURL=clarify.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clarify.js","sourceRoot":"","sources":["../../src/routes/clarify.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,QAAQ,EA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C,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QAChE,MAAM,MAAM,GAAG,UAAU,IAAI,SAAS,CAAC,OAAO,CAAC,CAAA;QAC/C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;QACjE,uBAAuB,CAAC,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,eAAe,EAAE,eAAe,CAAC,CAAA;QAC1F,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,eAAe,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QAC1F,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { DecisionRepository } from '@braidhq/core';
|
|
2
|
-
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
3
|
-
export interface DecisionsRouterDeps {
|
|
4
|
-
decisionRepository: DecisionRepository;
|
|
5
|
-
}
|
|
6
|
-
export declare function createDecisionsRouter(deps: DecisionsRouterDeps): OpenAPIHono;
|
|
7
|
-
//# sourceMappingURL=decisions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decisions.d.ts","sourceRoot":"","sources":["../../src/routes/decisions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAEvD,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAA;AAmB/D,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,EAAE,kBAAkB,CAAA;CACvC;AAqCD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,mBAAmB,GAAG,WAAW,CAoB5E"}
|
package/dist/routes/decisions.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Decision, DecisionAction, DecisionId } from '@braidhq/schema';
|
|
2
|
-
import { createRoute, OpenAPIHono, z } from '@hono/zod-openapi';
|
|
3
|
-
import { getWorkspaceId } from '../middleware/workspaceId.js';
|
|
4
|
-
import { NotFoundResponse, ValidationFailureResponse, WorkspaceIdParam } from './_shared.js';
|
|
5
|
-
import { assertEntityInWorkspace } from './helpers.js';
|
|
6
|
-
const ListQuery = z.object({
|
|
7
|
-
action: z.union([DecisionAction, z.array(DecisionAction)]).optional().openapi({ description: 'Filter by decision action; pass one or many.' }),
|
|
8
|
-
limit: z.coerce.number().int().positive().optional(),
|
|
9
|
-
offset: z.coerce.number().int().nonnegative().optional(),
|
|
10
|
-
});
|
|
11
|
-
const DecisionIdParam = WorkspaceIdParam.extend({
|
|
12
|
-
decisionId: DecisionId.openapi({ param: { name: 'decisionId', in: 'path' } }),
|
|
13
|
-
});
|
|
14
|
-
const DecisionListResponse = z.object({
|
|
15
|
-
items: z.array(Decision),
|
|
16
|
-
}).openapi('DecisionListResponse');
|
|
17
|
-
const listDecisionsRoute = createRoute({
|
|
18
|
-
method: 'get',
|
|
19
|
-
path: '/',
|
|
20
|
-
operationId: 'listDecisions',
|
|
21
|
-
summary: 'List apply / reject / answer / skip decisions for a workspace.',
|
|
22
|
-
tags: ['decisions'],
|
|
23
|
-
request: {
|
|
24
|
-
params: WorkspaceIdParam,
|
|
25
|
-
query: ListQuery,
|
|
26
|
-
},
|
|
27
|
-
responses: {
|
|
28
|
-
200: {
|
|
29
|
-
description: 'A page of matching decisions.',
|
|
30
|
-
content: { 'application/json': { schema: DecisionListResponse } },
|
|
31
|
-
},
|
|
32
|
-
400: ValidationFailureResponse,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
const getDecisionRoute = createRoute({
|
|
36
|
-
method: 'get',
|
|
37
|
-
path: '/{decisionId}',
|
|
38
|
-
operationId: 'getDecision',
|
|
39
|
-
summary: 'Fetch a single decision by id.',
|
|
40
|
-
tags: ['decisions'],
|
|
41
|
-
request: { params: DecisionIdParam },
|
|
42
|
-
responses: {
|
|
43
|
-
200: {
|
|
44
|
-
description: 'The requested decision.',
|
|
45
|
-
content: { 'application/json': { schema: Decision } },
|
|
46
|
-
},
|
|
47
|
-
404: NotFoundResponse,
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
export function createDecisionsRouter(deps) {
|
|
51
|
-
const router = new OpenAPIHono();
|
|
52
|
-
router.openapi(listDecisionsRoute, async (context) => {
|
|
53
|
-
const workspaceId = getWorkspaceId(context);
|
|
54
|
-
const { action, limit, offset } = context.req.valid('query');
|
|
55
|
-
const actions = action === undefined ? undefined : Array.isArray(action) ? action : [action];
|
|
56
|
-
const decisions = await deps.decisionRepository.list({ workspaceId, actions, limit, offset });
|
|
57
|
-
return context.json({ items: decisions }, 200);
|
|
58
|
-
});
|
|
59
|
-
router.openapi(getDecisionRoute, async (context) => {
|
|
60
|
-
const workspaceId = getWorkspaceId(context);
|
|
61
|
-
const { decisionId } = context.req.valid('param');
|
|
62
|
-
const decision = await deps.decisionRepository.load(decisionId);
|
|
63
|
-
assertEntityInWorkspace(workspaceId, decision.workspaceId, 'Decision', decisionId);
|
|
64
|
-
return context.json(decision, 200);
|
|
65
|
-
});
|
|
66
|
-
return router;
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=decisions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decisions.js","sourceRoot":"","sources":["../../src/routes/decisions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC5F,OAAO,EAAE,u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CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACjD,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;QAC3C,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACjD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QAC/D,uBAAuB,CAAC,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,CAAA;QAClF,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { SourceUnitStateService } from '@braidhq/core';
|
|
2
|
-
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
3
|
-
export interface SourceUnitStatesRouterDeps {
|
|
4
|
-
sourceUnitStateService: SourceUnitStateService;
|
|
5
|
-
}
|
|
6
|
-
export declare function createSourceUnitStatesRouter(deps: SourceUnitStatesRouterDeps): OpenAPIHono;
|
|
7
|
-
//# sourceMappingURL=sourceUnitStates.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sourceUnitStates.d.ts","sourceRoot":"","sources":["../../src/routes/sourceUnitStates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAE3D,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAA;AAY/D,MAAM,WAAW,0BAA0B;IACzC,sBAAsB,EAAE,sBAAsB,CAAA;CAC/C;AAyBD,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,0BAA0B,GAAG,WAAW,CAa1F"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { SourceId, SourceUnitState } from '@braidhq/schema';
|
|
2
|
-
import { createRoute, OpenAPIHono, z } from '@hono/zod-openapi';
|
|
3
|
-
import { getWorkspaceId } from '../middleware/workspaceId.js';
|
|
4
|
-
import { ValidationFailureResponse, WorkspaceIdParam } from './_shared.js';
|
|
5
|
-
const ListQuery = z.object({
|
|
6
|
-
sourceId: SourceId.optional().openapi({ description: 'Restrict to one source.' }),
|
|
7
|
-
});
|
|
8
|
-
const ListResponse = z.object({
|
|
9
|
-
items: z.array(SourceUnitState),
|
|
10
|
-
}).openapi('SourceUnitStateListResponse');
|
|
11
|
-
const listRoute = createRoute({
|
|
12
|
-
method: 'get',
|
|
13
|
-
path: '/',
|
|
14
|
-
operationId: 'listSourceUnitStates',
|
|
15
|
-
summary: 'List recorded observations per source unit for a workspace.',
|
|
16
|
-
description: 'Returns the framework\'s current view of each source unit '
|
|
17
|
-
+ 'last seen by an extract run. One entry per (sourceId, path). Used '
|
|
18
|
-
+ 'by Studio to display per-unit freshness and by Reactor to compute '
|
|
19
|
-
+ 'what needs re-extraction.',
|
|
20
|
-
tags: ['source-unit-states'],
|
|
21
|
-
request: {
|
|
22
|
-
params: WorkspaceIdParam,
|
|
23
|
-
query: ListQuery,
|
|
24
|
-
},
|
|
25
|
-
responses: {
|
|
26
|
-
200: {
|
|
27
|
-
description: 'The recorded observations.',
|
|
28
|
-
content: { 'application/json': { schema: ListResponse } },
|
|
29
|
-
},
|
|
30
|
-
400: ValidationFailureResponse,
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
export function createSourceUnitStatesRouter(deps) {
|
|
34
|
-
const router = new OpenAPIHono();
|
|
35
|
-
router.openapi(listRoute, async (context) => {
|
|
36
|
-
const workspaceId = getWorkspaceId(context);
|
|
37
|
-
const { sourceId } = context.req.valid('query');
|
|
38
|
-
const items = sourceId
|
|
39
|
-
? await deps.sourceUnitStateService.listBySource(workspaceId, sourceId)
|
|
40
|
-
: await deps.sourceUnitStateService.listByWorkspace(workspaceId);
|
|
41
|
-
return context.json({ items: [...items] }, 200);
|
|
42
|
-
});
|
|
43
|
-
return router;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=sourceUnitStates.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sourceUnitStates.js","sourceRoot":"","sources":["../../src/routes/sourceUnitStates.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE1E,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;CAClF,CAAC,CAAA;AAEF,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;CAChC,CAAC,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAA;AAMzC,MAAM,SAAS,GAAG,WAAW,CAAC;IAC5B,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,GAAG;IACT,WAAW,EAAE,sBAAsB;IACnC,OAAO,EAAE,6DAA6D;IACtE,WAAW,EAAE,4DAA4D;UACrE,oEAAoE;UACpE,oEAAoE;UACpE,2BAA2B;IAC/B,IAAI,EAAE,CAAC,oBAAoB,CAAC;IAC5B,OAAO,EAAE;QACP,MAAM,EAAE,gBAAgB;QACxB,KAAK,EAAE,SAAS;KACjB;IACD,SAAS,EAAE;QACT,GAAG,EAAE;YACH,WAAW,EAAE,4BAA4B;YACzC,OAAO,EAAE,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE;SAC1D;QACD,GAAG,EAAE,yBAAyB;KAC/B;CACF,CAAC,CAAA;AAEF,MAAM,UAAU,4BAA4B,CAAC,IAAgC;IAC3E,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAA;IAEhC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAC1C,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;QAC3C,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC/C,MAAM,KAAK,GAAG,QAAQ;YACpB,CAAC,CAAC,MAAM,IAAI,CAAC,sBAAsB,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC;YACvE,CAAC,CAAC,MAAM,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,WAAW,CAAC,CAAA;QAClE,OAAO,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|