@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
package/dist/routes/nodes.js
CHANGED
|
@@ -3,11 +3,9 @@ import { createRoute, OpenAPIHono, z } from '@hono/zod-openapi';
|
|
|
3
3
|
import { getWorkspaceId } from '../middleware/workspaceId.js';
|
|
4
4
|
import { NotFoundResponse, ValidationFailureResponse, WorkspaceIdParam } from './_shared.js';
|
|
5
5
|
const ListQuery = z.object({
|
|
6
|
-
type: z.union([NodeTypeId, z.array(NodeTypeId)]).optional().openapi({ description: 'Filter by node type id
|
|
7
|
-
status: z.union([NodeStatus, z.array(NodeStatus)]).optional().openapi({ description: 'Filter by node status
|
|
6
|
+
type: z.union([NodeTypeId, z.array(NodeTypeId)]).optional().openapi({ description: 'Filter by node type id. Pass one or many.' }),
|
|
7
|
+
status: z.union([NodeStatus, z.array(NodeStatus)]).optional().openapi({ description: 'Filter by node status. Pass one or many.' }),
|
|
8
8
|
q: z.string().optional().openapi({ description: 'Case-insensitive substring match against node name.' }),
|
|
9
|
-
limit: z.coerce.number().int().positive().optional(),
|
|
10
|
-
offset: z.coerce.number().int().nonnegative().optional(),
|
|
11
9
|
});
|
|
12
10
|
const NodeIdParam = WorkspaceIdParam.extend({
|
|
13
11
|
nodeId: NodeId.openapi({ param: { name: 'nodeId', in: 'path' } }),
|
|
@@ -73,15 +71,13 @@ export function createNodesRouter(deps) {
|
|
|
73
71
|
const router = new OpenAPIHono();
|
|
74
72
|
router.openapi(listNodesRoute, async (context) => {
|
|
75
73
|
const workspaceId = getWorkspaceId(context);
|
|
76
|
-
const { type, status, q
|
|
74
|
+
const { type, status, q } = context.req.valid('query');
|
|
77
75
|
const types = type === undefined ? undefined : Array.isArray(type) ? type : [type];
|
|
78
76
|
const statuses = status === undefined ? undefined : Array.isArray(status) ? status : [status];
|
|
79
|
-
const nodes = await deps.modelService.
|
|
77
|
+
const nodes = await deps.modelService.listNodes(workspaceId, {
|
|
80
78
|
types,
|
|
81
79
|
statuses,
|
|
82
80
|
nameContains: q,
|
|
83
|
-
limit,
|
|
84
|
-
offset,
|
|
85
81
|
});
|
|
86
82
|
return context.json({ items: nodes }, 200);
|
|
87
83
|
});
|
package/dist/routes/nodes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../src/routes/nodes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC1F,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;AAE5F,MAAM,SAAS,GAAG,CAAC,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E,KAAK,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC5C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;QAC5E,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/dist/routes/oauth.d.ts
CHANGED
|
@@ -7,14 +7,13 @@ export interface OAuthRouterDeps {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* OAuth routes for source-loader providers that need user consent.
|
|
10
|
+
* `POST /oauth/google/start` returns an authorizationUrl.
|
|
11
|
+
* `GET /oauth/google/callback` returns an HTML page that closes the popup.
|
|
10
12
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* (single browser round-trip); a server restart cancels in-flight flows,
|
|
16
|
-
* which is acceptable for a local desktop / single-user install. SaaS
|
|
17
|
-
* deployments should swap the in-memory `pending` map for a shared store.
|
|
13
|
+
* Pending state is kept in process memory. The flow is short-lived,
|
|
14
|
+
* a single browser round-trip, and a server restart cancels it,
|
|
15
|
+
* acceptable for a local desktop or single-user install.
|
|
16
|
+
* SaaS deployments should swap `pending` for a shared store.
|
|
18
17
|
*/
|
|
19
18
|
export declare function createOAuthRouter(deps: OAuthRouterDeps): Hono;
|
|
20
19
|
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/routes/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAY,MAAM,wCAAwC,CAAA;AACnF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAA;AAE3E,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAW3B,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAC9B;AASD
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/routes/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAY,MAAM,wCAAwC,CAAA;AACnF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAA;AAE3E,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAW3B,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAC9B;AASD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CAqD7D"}
|
package/dist/routes/oauth.js
CHANGED
|
@@ -9,14 +9,13 @@ const StartBodySchema = z.object({
|
|
|
9
9
|
});
|
|
10
10
|
/**
|
|
11
11
|
* OAuth routes for source-loader providers that need user consent.
|
|
12
|
+
* `POST /oauth/google/start` returns an authorizationUrl.
|
|
13
|
+
* `GET /oauth/google/callback` returns an HTML page that closes the popup.
|
|
12
14
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* (single browser round-trip); a server restart cancels in-flight flows,
|
|
18
|
-
* which is acceptable for a local desktop / single-user install. SaaS
|
|
19
|
-
* deployments should swap the in-memory `pending` map for a shared store.
|
|
15
|
+
* Pending state is kept in process memory. The flow is short-lived,
|
|
16
|
+
* a single browser round-trip, and a server restart cancels it,
|
|
17
|
+
* acceptable for a local desktop or single-user install.
|
|
18
|
+
* SaaS deployments should swap `pending` for a shared store.
|
|
20
19
|
*/
|
|
21
20
|
export function createOAuthRouter(deps) {
|
|
22
21
|
const router = new Hono();
|
package/dist/routes/oauth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../src/routes/oauth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAA;AAE7F,MAAM,oBAAoB,GAAG,gDAAgD,CAAA;AAE7E,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5B,CAAC,CAAA;AAcF
|
|
1
|
+
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../src/routes/oauth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAA;AAE7F,MAAM,oBAAoB,GAAG,gDAAgD,CAAA;AAE7E,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5B,CAAC,CAAA;AAcF;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAA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,CAAC,KAAK,CAAC,OAAO,CAAC;;;0FAG0D,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;;;eAGjG,CAAA;AACf,CAAC;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAE,CAAC,CAAA;AACrH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PluginRegistry } from '@braidhq/core';
|
|
2
|
+
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
3
|
+
export interface OntologiesRouterDeps {
|
|
4
|
+
pluginRegistry: PluginRegistry;
|
|
5
|
+
}
|
|
6
|
+
export declare function createOntologiesRouter(deps: OntologiesRouterDeps): OpenAPIHono;
|
|
7
|
+
//# sourceMappingURL=ontologies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ontologies.d.ts","sourceRoot":"","sources":["../../src/routes/ontologies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEnD,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE5D,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,cAAc,CAAA;CAC/B;AAgBD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,oBAAoB,GAAG,WAAW,CAc9E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { OntologyListResponse } from '@braidhq/schema';
|
|
2
|
+
import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
3
|
+
const listRoute = createRoute({
|
|
4
|
+
method: 'get',
|
|
5
|
+
path: '/',
|
|
6
|
+
operationId: 'listOntologies',
|
|
7
|
+
summary: 'List every registered ontology (node types, edge types, source roles).',
|
|
8
|
+
tags: ['ontology'],
|
|
9
|
+
responses: {
|
|
10
|
+
200: {
|
|
11
|
+
description: 'The registered ontologies.',
|
|
12
|
+
content: { 'application/json': { schema: OntologyListResponse } },
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
export function createOntologiesRouter(deps) {
|
|
17
|
+
const router = new OpenAPIHono();
|
|
18
|
+
router.openapi(listRoute, (context) => {
|
|
19
|
+
const ontologies = deps.pluginRegistry.ontologies().map(ontology => ({
|
|
20
|
+
ontologyId: ontology.ontologyId,
|
|
21
|
+
nodeTypes: ontology.nodeTypes,
|
|
22
|
+
edgeTypes: ontology.edgeTypes,
|
|
23
|
+
sourceRoles: ontology.sourceRoles,
|
|
24
|
+
}));
|
|
25
|
+
return context.json(OntologyListResponse.parse({ ontologies }), 200);
|
|
26
|
+
});
|
|
27
|
+
return router;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=ontologies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ontologies.js","sourceRoot":"","sources":["../../src/routes/ontologies.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAM5D,MAAM,SAAS,GAAG,WAAW,CAAC;IAC5B,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,GAAG;IACT,WAAW,EAAE,gBAAgB;IAC7B,OAAO,EAAE,wEAAwE;IACjF,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,WAAW,EAAE,4BAA4B;YACzC,OAAO,EAAE,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,oBAAoB,EAAE,EAAE;SAClE;KACF;CACF,CAAC,CAAA;AAEF,MAAM,UAAU,sBAAsB,CAAC,IAA0B;IAC/D,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAA;IAEhC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;QACpC,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YACnE,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,WAAW,EAAE,QAAQ,CAAC,WAAW;SAClC,CAAC,CAAC,CAAA;QACH,OAAO,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,GAAG,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ontology.d.ts","sourceRoot":"","sources":["../../src/routes/ontology.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAGxE,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAI5D,MAAM,WAAW,kBAAkB;IACjC,mBAAmB,EAAE,mBAAmB,CAAA;IACxC,cAAc,EAAE,cAAc,CAAA;CAC/B;AAkBD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"ontology.d.ts","sourceRoot":"","sources":["../../src/routes/ontology.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAGxE,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAI5D,MAAM,WAAW,kBAAkB;IACjC,mBAAmB,EAAE,mBAAmB,CAAA;IACxC,cAAc,EAAE,cAAc,CAAA;CAC/B;AAkBD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,GAAG,WAAW,CAmB1E"}
|
package/dist/routes/ontology.js
CHANGED
|
@@ -7,7 +7,7 @@ const getOntologyRoute = createRoute({
|
|
|
7
7
|
method: 'get',
|
|
8
8
|
path: '/',
|
|
9
9
|
operationId: 'getOntology',
|
|
10
|
-
summary: 'Return the active ontology (node types
|
|
10
|
+
summary: 'Return the active ontology (node types, edge types, source roles) for a workspace.',
|
|
11
11
|
tags: ['ontology'],
|
|
12
12
|
request: { params: WorkspaceIdParam },
|
|
13
13
|
responses: {
|
|
@@ -31,6 +31,7 @@ export function createOntologyRouter(deps) {
|
|
|
31
31
|
ontologyId: ontology.ontologyId,
|
|
32
32
|
nodeTypes: ontology.nodeTypes,
|
|
33
33
|
edgeTypes: ontology.edgeTypes,
|
|
34
|
+
sourceRoles: ontology.sourceRoles,
|
|
34
35
|
}), 200);
|
|
35
36
|
});
|
|
36
37
|
return router;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ontology.js","sourceRoot":"","sources":["../../src/routes/ontology.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAOjE,MAAM,gBAAgB,GAAG,WAAW,CAAC;IACnC,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,GAAG;IACT,WAAW,EAAE,aAAa;IAC1B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ontology.js","sourceRoot":"","sources":["../../src/routes/ontology.ts"],"names":[],"mappings":"AAC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AAc,CAAC,eAAe,CAAC,SAAS,CAAC,eAAe,CAAC,UAAU,CAAC,CAAA;QAC1F,OAAO,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;YACzC,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,WAAW,EAAE,QAAQ,CAAC,WAAW;SAClC,CAAC,EAAE,GAAG,CAAC,CAAA;IACV,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { HITLService, ModelRepository,
|
|
1
|
+
import type { HITLService, ModelRepository, ModelValidationService, ProposalRepository, WorkspaceService } from '@braidhq/core';
|
|
2
2
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
3
3
|
export interface ProposalsRouterDeps {
|
|
4
4
|
hitlService: HITLService;
|
|
5
5
|
proposalRepository: ProposalRepository;
|
|
6
6
|
modelRepository: ModelRepository;
|
|
7
|
-
|
|
7
|
+
modelValidationService: ModelValidationService;
|
|
8
8
|
workspaceService: WorkspaceService;
|
|
9
9
|
}
|
|
10
10
|
export declare function createProposalsRouter(deps: ProposalsRouterDeps): OpenAPIHono;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposals.d.ts","sourceRoot":"","sources":["../../src/routes/proposals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"proposals.d.ts","sourceRoot":"","sources":["../../src/routes/proposals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAE/H,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAA;AA2C/D,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,WAAW,CAAA;IACxB,kBAAkB,EAAE,kBAAkB,CAAA;IACtC,eAAe,EAAE,eAAe,CAAA;IAChC,sBAAsB,EAAE,sBAAsB,CAAA;IAC9C,gBAAgB,EAAE,gBAAgB,CAAA;CACnC;AA8GD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,mBAAmB,GAAG,WAAW,CAgF5E"}
|
package/dist/routes/proposals.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Proposal, ProposalCreate, ProposalId, ProposalStatus, UserId, ValidationResult } from '@braidhq/schema';
|
|
2
2
|
import { createRoute, OpenAPIHono, z } from '@hono/zod-openapi';
|
|
3
|
-
import { getUserId } from '../middleware/
|
|
3
|
+
import { getUserId } from '../middleware/auth.js';
|
|
4
4
|
import { getViewerContext, requirePermission } from '../middleware/workspaceAccess.js';
|
|
5
5
|
import { getWorkspaceId } from '../middleware/workspaceId.js';
|
|
6
6
|
import { NotFoundResponse, ValidationFailureResponse, WorkspaceIdParam } from './_shared.js';
|
|
7
7
|
import { assertEntityInWorkspace } from './helpers.js';
|
|
8
8
|
const ListQuery = z.object({
|
|
9
|
-
status: z.union([ProposalStatus, z.array(ProposalStatus)]).optional().openapi({ description: 'Filter by proposal status
|
|
9
|
+
status: z.union([ProposalStatus, z.array(ProposalStatus)]).optional().openapi({ description: 'Filter by proposal status. Pass one or many.' }),
|
|
10
10
|
limit: z.coerce.number().int().positive().optional(),
|
|
11
11
|
offset: z.coerce.number().int().nonnegative().optional(),
|
|
12
12
|
showAll: z.coerce.boolean().optional().openapi({ description: 'Owner-only: bypass the personal-pending filter so every member\'s drafts are visible.' }),
|
|
13
13
|
});
|
|
14
|
-
// Body `userId` is a back-compat shim
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
14
|
+
// Body `userId` is a back-compat shim.
|
|
15
|
+
// It serves API consumers still on neither the `X-Braid-User` header,
|
|
16
|
+
// nor the Bearer-token flow.
|
|
17
|
+
// When present it overrides the middleware-derived id.
|
|
18
|
+
// When omitted the handler falls back to `getUserId(c)`.
|
|
19
|
+
// Studio sends it via header only.
|
|
20
|
+
// The path will be removed once the deprecation window closes.
|
|
19
21
|
const ApplyBody = z.object({
|
|
20
22
|
userId: UserId.optional(),
|
|
21
23
|
}).openapi('ProposalApplyBody');
|
|
@@ -23,10 +25,10 @@ const RejectBody = z.object({
|
|
|
23
25
|
reason: z.string().min(1),
|
|
24
26
|
userId: UserId.optional(),
|
|
25
27
|
}).openapi('ProposalRejectBody');
|
|
26
|
-
// Skill-facing create. Body must carry `workspaceId` matching the route
|
|
27
|
-
//
|
|
28
|
-
// HITLService.submitProposal
|
|
29
|
-
const CreateBody =
|
|
28
|
+
// Skill-facing create. Body must carry `workspaceId` matching the route param.
|
|
29
|
+
// Zod parses the rest of the ProposalCreate fields,
|
|
30
|
+
// and HITLService.submitProposal validates ops against the live graph.
|
|
31
|
+
const CreateBody = ProposalCreate.omit({ workspaceId: true }).openapi('ProposalCreateBody');
|
|
30
32
|
const ProposalIdParam = WorkspaceIdParam.extend({
|
|
31
33
|
proposalId: ProposalId.openapi({ param: { name: 'proposalId', in: 'path' } }),
|
|
32
34
|
});
|
|
@@ -88,7 +90,7 @@ const validateProposalRoute = createRoute({
|
|
|
88
90
|
method: 'get',
|
|
89
91
|
path: '/{proposalId}/validate',
|
|
90
92
|
operationId: 'validateProposal',
|
|
91
|
-
summary: 'Pre-apply check
|
|
93
|
+
summary: 'Pre-apply check that returns the validation issues a proposal would hit if applied now.',
|
|
92
94
|
tags: ['proposals'],
|
|
93
95
|
request: { params: ProposalIdParam },
|
|
94
96
|
responses: {
|
|
@@ -111,8 +113,8 @@ const applyProposalRoute = createRoute({
|
|
|
111
113
|
},
|
|
112
114
|
responses: {
|
|
113
115
|
200: {
|
|
114
|
-
description: 'The
|
|
115
|
-
content: { 'application/json': { schema:
|
|
116
|
+
description: 'The updated proposal.',
|
|
117
|
+
content: { 'application/json': { schema: Proposal } },
|
|
116
118
|
},
|
|
117
119
|
404: NotFoundResponse,
|
|
118
120
|
},
|
|
@@ -129,17 +131,17 @@ const rejectProposalRoute = createRoute({
|
|
|
129
131
|
},
|
|
130
132
|
responses: {
|
|
131
133
|
200: {
|
|
132
|
-
description: 'The
|
|
133
|
-
content: { 'application/json': { schema:
|
|
134
|
+
description: 'The updated proposal.',
|
|
135
|
+
content: { 'application/json': { schema: Proposal } },
|
|
134
136
|
},
|
|
135
137
|
404: NotFoundResponse,
|
|
136
138
|
},
|
|
137
139
|
});
|
|
138
140
|
export function createProposalsRouter(deps) {
|
|
139
141
|
const router = new OpenAPIHono();
|
|
140
|
-
// Apply
|
|
141
|
-
// never see the buttons
|
|
142
|
-
// means a direct curl from a Guest
|
|
142
|
+
// Apply and reject are HITL decisions, Owner and Maintainer only.
|
|
143
|
+
// Guests never see the buttons, the UI hides the tab.
|
|
144
|
+
// Defence-in-depth here means a direct curl from a Guest still 403s.
|
|
143
145
|
router.use('/:proposalId/apply', requirePermission('proposal.write'));
|
|
144
146
|
router.use('/:proposalId/reject', requirePermission('proposal.write'));
|
|
145
147
|
router.openapi(createProposalRoute, async (context) => {
|
|
@@ -153,17 +155,20 @@ export function createProposalsRouter(deps) {
|
|
|
153
155
|
const workspaceId = getWorkspaceId(context);
|
|
154
156
|
const { status, limit, offset, showAll } = context.req.valid('query');
|
|
155
157
|
const statuses = status === undefined ? undefined : Array.isArray(status) ? status : [status];
|
|
156
|
-
// Show All bypass is gated to the workspace owner
|
|
157
|
-
// is forced through the personal-pending filter
|
|
158
|
-
//
|
|
158
|
+
// Show All bypass is gated to the workspace owner.
|
|
159
|
+
// Everyone else is forced through the personal-pending filter,
|
|
160
|
+
// whatever they send.
|
|
159
161
|
const viewer = getViewerContext(context);
|
|
160
|
-
const
|
|
162
|
+
const isOwner = viewer?.effectiveRole === 'owner';
|
|
163
|
+
// No viewer is an open composition (in-memory), which applies no personal filter.
|
|
164
|
+
const viewerId = (!viewer || (showAll && isOwner)) ? undefined : getUserId(context);
|
|
165
|
+
// Owners also see service-owned (autonomous) pending, since only they can apply it.
|
|
161
166
|
const proposals = await deps.proposalRepository.list({
|
|
162
167
|
workspaceId,
|
|
163
168
|
statuses,
|
|
164
169
|
limit,
|
|
165
170
|
offset,
|
|
166
|
-
...(viewerId ? { viewerId } : {}),
|
|
171
|
+
...(viewerId ? { viewerId, includeServiceOwned: isOwner } : {}),
|
|
167
172
|
});
|
|
168
173
|
return context.json({ items: proposals.map(proposal => proposal.toData()) }, 200);
|
|
169
174
|
});
|
|
@@ -181,7 +186,7 @@ export function createProposalsRouter(deps) {
|
|
|
181
186
|
assertEntityInWorkspace(workspaceId, proposal.workspaceId, 'Proposal', proposalId);
|
|
182
187
|
const workspace = await deps.workspaceService.findById(workspaceId);
|
|
183
188
|
const snapshot = await deps.modelRepository.load(workspaceId);
|
|
184
|
-
const result = await deps.
|
|
189
|
+
const result = await deps.modelValidationService.validateOperations(snapshot, proposal.operations, workspace);
|
|
185
190
|
return context.json(result, 200);
|
|
186
191
|
});
|
|
187
192
|
router.openapi(applyProposalRoute, async (context) => {
|
|
@@ -191,8 +196,8 @@ export function createProposalsRouter(deps) {
|
|
|
191
196
|
const userId = body.userId ?? getUserId(context);
|
|
192
197
|
const proposal = await deps.proposalRepository.load(proposalId);
|
|
193
198
|
assertEntityInWorkspace(workspaceId, proposal.workspaceId, 'Proposal', proposalId);
|
|
194
|
-
const
|
|
195
|
-
return context.json(
|
|
199
|
+
const applied = await deps.hitlService.applyProposal(proposalId, userId);
|
|
200
|
+
return context.json(applied.toData(), 200);
|
|
196
201
|
});
|
|
197
202
|
router.openapi(rejectProposalRoute, async (context) => {
|
|
198
203
|
const workspaceId = getWorkspaceId(context);
|
|
@@ -201,8 +206,8 @@ export function createProposalsRouter(deps) {
|
|
|
201
206
|
const userId = bodyUserId ?? getUserId(context);
|
|
202
207
|
const proposal = await deps.proposalRepository.load(proposalId);
|
|
203
208
|
assertEntityInWorkspace(workspaceId, proposal.workspaceId, 'Proposal', proposalId);
|
|
204
|
-
const
|
|
205
|
-
return context.json(
|
|
209
|
+
const rejected = await deps.hitlService.rejectProposal(proposalId, reason, userId);
|
|
210
|
+
return context.json(rejected.toData(), 200);
|
|
206
211
|
});
|
|
207
212
|
return router;
|
|
208
213
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposals.js","sourceRoot":"","sources":["../../src/routes/proposals.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"proposals.js","sourceRoot":"","sources":["../../src/routes/proposals.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAChH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC5F,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IACzB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;IAC9I,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EA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B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QAC/D,uBAAuB,CAAC,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,CAAA;QAClF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QAClF,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,CAAA;IAC7C,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactorCycleRepository } from '@braidhq/core';
|
|
2
|
+
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
3
|
+
export interface ReactorCyclesRouterDeps {
|
|
4
|
+
reactorCycleRepository: ReactorCycleRepository;
|
|
5
|
+
}
|
|
6
|
+
export declare function createReactorCyclesRouter(deps: ReactorCyclesRouterDeps): OpenAPIHono;
|
|
7
|
+
//# sourceMappingURL=reactorCycles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactorCycles.d.ts","sourceRoot":"","sources":["../../src/routes/reactorCycles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAG3D,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAA;AAY/D,MAAM,WAAW,uBAAuB;IACtC,sBAAsB,EAAE,sBAAsB,CAAA;CAC/C;AAmCD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,uBAAuB,GAAG,WAAW,CAmBpF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { NotFoundError } from '@braidhq/core';
|
|
2
|
+
import { ReactorCycle, ReactorCycleId } from '@braidhq/schema';
|
|
3
|
+
import { createRoute, OpenAPIHono, z } from '@hono/zod-openapi';
|
|
4
|
+
import { getWorkspaceId } from '../middleware/workspaceId.js';
|
|
5
|
+
import { NotFoundResponse, WorkspaceIdParam } from './_shared.js';
|
|
6
|
+
const CycleIdParam = WorkspaceIdParam.extend({
|
|
7
|
+
cycleId: ReactorCycleId.openapi({ param: { name: 'cycleId', in: 'path' } }),
|
|
8
|
+
});
|
|
9
|
+
const ListResponse = z.object({
|
|
10
|
+
items: z.array(ReactorCycle),
|
|
11
|
+
}).openapi('ReactorCycleListResponse');
|
|
12
|
+
const listRoute = createRoute({
|
|
13
|
+
method: 'get',
|
|
14
|
+
path: '/',
|
|
15
|
+
operationId: 'listReactorCycles',
|
|
16
|
+
summary: 'List reactor passes for a workspace, newest first.',
|
|
17
|
+
description: 'One entry per reactor cycle. The full timeline (units + checkpoint) is on each entry, so the Activity page does not need a second round-trip to render the list.',
|
|
18
|
+
tags: ['reactor'],
|
|
19
|
+
request: { params: WorkspaceIdParam },
|
|
20
|
+
responses: {
|
|
21
|
+
200: {
|
|
22
|
+
description: 'The reactor passes recorded for this workspace.',
|
|
23
|
+
content: { 'application/json': { schema: ListResponse } },
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const getRoute = createRoute({
|
|
28
|
+
method: 'get',
|
|
29
|
+
path: '/{cycleId}',
|
|
30
|
+
operationId: 'getReactorCycle',
|
|
31
|
+
summary: 'Fetch one reactor cycle by id.',
|
|
32
|
+
description: 'The Activity page subscribes to the workspace event stream and refreshes this endpoint whenever a `reactor.unit.*` or `reactor.checkpoint.*` event fires for the open cycle.',
|
|
33
|
+
tags: ['reactor'],
|
|
34
|
+
request: { params: CycleIdParam },
|
|
35
|
+
responses: {
|
|
36
|
+
200: {
|
|
37
|
+
description: 'The cycle record.',
|
|
38
|
+
content: { 'application/json': { schema: ReactorCycle } },
|
|
39
|
+
},
|
|
40
|
+
404: NotFoundResponse,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
export function createReactorCyclesRouter(deps) {
|
|
44
|
+
const router = new OpenAPIHono();
|
|
45
|
+
router.openapi(listRoute, async (context) => {
|
|
46
|
+
const workspaceId = getWorkspaceId(context);
|
|
47
|
+
const passes = await deps.reactorCycleRepository.listByWorkspace(workspaceId);
|
|
48
|
+
return context.json({ items: [...passes] }, 200);
|
|
49
|
+
});
|
|
50
|
+
router.openapi(getRoute, async (context) => {
|
|
51
|
+
const workspaceId = getWorkspaceId(context);
|
|
52
|
+
const { cycleId } = context.req.valid('param');
|
|
53
|
+
const cycle = await deps.reactorCycleRepository.load(workspaceId, cycleId);
|
|
54
|
+
if (!cycle)
|
|
55
|
+
throw new NotFoundError(`Reactor cycle "${cycleId}" not found for workspace "${workspaceId}"`);
|
|
56
|
+
return context.json(cycle, 200);
|
|
57
|
+
});
|
|
58
|
+
return router;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=reactorCycles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactorCycles.js","sourceRoot":"","sources":["../../src/routes/reactorCycles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC9D,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,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAEjE,MAAM,YAAY,GAAG,gBAAgB,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC;CAC5E,CAAC,CAAA;AAEF,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,KAAK,EAAE,CAAC,CAAC,KAAK,CA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AC7E,OAAO,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;IAClD,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACzC,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;QAC3C,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC9C,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QAC1E,IAAI,CAAC,KAAK;YACR,MAAM,IAAI,aAAa,CAAC,kBAAkB,OAAO,8BAA8B,WAAW,GAAG,CAAC,CAAA;QAChG,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IACjC,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../src/routes/runs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,mBAAmB,EACpB,MAAM,eAAe,CAAA;AAItB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAO3B,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAA;IACrC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;IACjC,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAA;CAClD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../src/routes/runs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,mBAAmB,EACpB,MAAM,eAAe,CAAA;AAItB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAO3B,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAA;IACrC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;IACjC,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAA;CAClD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAkI3D"}
|
package/dist/routes/runs.js
CHANGED
|
@@ -3,7 +3,7 @@ import { SkillRunId } from '@braidhq/schema';
|
|
|
3
3
|
import { Hono } from 'hono';
|
|
4
4
|
import { streamSSE } from 'hono/streaming';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import { createAsyncQueue } from '../infrastructure/
|
|
6
|
+
import { createAsyncQueue } from '../infrastructure/skill/asyncQueue.js';
|
|
7
7
|
import { getWorkspaceId } from '../middleware/workspaceId.js';
|
|
8
8
|
import { loadWorkspaceById } from './helpers.js';
|
|
9
9
|
export function createRunsRouter(deps) {
|
|
@@ -13,9 +13,10 @@ export function createRunsRouter(deps) {
|
|
|
13
13
|
const items = await deps.runRepository.listRecords(workspace);
|
|
14
14
|
return context.json({ items });
|
|
15
15
|
});
|
|
16
|
-
// Replay the persisted JSONL log
|
|
17
|
-
//
|
|
18
|
-
//
|
|
16
|
+
// Replay the persisted JSONL log,
|
|
17
|
+
// and if the run is still active, tail new events as they arrive.
|
|
18
|
+
// Clients can open, close, and reopen this stream freely,
|
|
19
|
+
// the underlying subprocess and event log are untouched.
|
|
19
20
|
router.get('/:runId/events', async (context) => {
|
|
20
21
|
const workspace = await loadWorkspaceById(getWorkspaceId(context), deps.workspaceRepository);
|
|
21
22
|
const runId = SkillRunId.parse(context.req.param('runId'));
|
|
@@ -26,9 +27,10 @@ export function createRunsRouter(deps) {
|
|
|
26
27
|
}
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
29
|
-
// Subscribe BEFORE reading JSONL.
|
|
30
|
-
// how many events were
|
|
31
|
-
//
|
|
30
|
+
// Subscribe BEFORE reading JSONL.
|
|
31
|
+
// The positionAtSubscribe count snapshots how many events were persisted,
|
|
32
|
+
// so we read exactly that many from disk,
|
|
33
|
+
// and rely on the live listener for everything after.
|
|
32
34
|
const queue = createAsyncQueue();
|
|
33
35
|
const { unsubscribe, positionAtSubscribe } = deps.skillRunner.subscribe(runId, (event) => {
|
|
34
36
|
queue.push(event);
|
|
@@ -54,9 +56,9 @@ export function createRunsRouter(deps) {
|
|
|
54
56
|
}
|
|
55
57
|
});
|
|
56
58
|
});
|
|
57
|
-
// SIGTERM the underlying claude subprocess.
|
|
58
|
-
// `completed` event with the
|
|
59
|
-
// receive normally. 404 if the run already finished.
|
|
59
|
+
// SIGTERM the underlying claude subprocess.
|
|
60
|
+
// The drain loop emits a `completed` event with the real exit code,
|
|
61
|
+
// which the SSE tailers receive normally. 404 if the run already finished.
|
|
60
62
|
router.post('/:runId/cancel', async (context) => {
|
|
61
63
|
const runId = SkillRunId.parse(context.req.param('runId'));
|
|
62
64
|
await deps.skillRunner.cancel(runId);
|
|
@@ -65,13 +67,13 @@ export function createRunsRouter(deps) {
|
|
|
65
67
|
router.delete('/sessions/:sessionId', async (context) => {
|
|
66
68
|
const sessionId = context.req.param('sessionId');
|
|
67
69
|
if (!sessionId)
|
|
68
|
-
throw new NotFoundError('sessionId is required');
|
|
70
|
+
throw new NotFoundError('Query parameter sessionId is required');
|
|
69
71
|
await deps.skillRunner.forgetSession(sessionId);
|
|
70
|
-
// `?purge=true` also drops the persisted run records and event
|
|
71
|
-
//
|
|
72
|
-
// by the Studio's per-conversation Delete action
|
|
73
|
-
//
|
|
74
|
-
// "New conversation"
|
|
72
|
+
// `?purge=true` also drops the persisted run records and event logs,
|
|
73
|
+
// matching the workspace-level `?purge=true` pattern.
|
|
74
|
+
// Used by the Studio's per-conversation Delete action.
|
|
75
|
+
// Without purge it keeps the lightweight `forgetSession` semantics,
|
|
76
|
+
// which "New conversation" relies on.
|
|
75
77
|
if (context.req.query('purge') === 'true') {
|
|
76
78
|
const workspace = await loadWorkspaceById(getWorkspaceId(context), deps.workspaceRepository);
|
|
77
79
|
const all = await deps.runRepository.listRecords(workspace);
|
|
@@ -83,8 +85,9 @@ export function createRunsRouter(deps) {
|
|
|
83
85
|
}
|
|
84
86
|
return context.body(null, 204);
|
|
85
87
|
});
|
|
86
|
-
// Single-run delete, used by orphan
|
|
87
|
-
// no sessionId to anchor against.
|
|
88
|
+
// Single-run delete, used by orphan Conversations rows,
|
|
89
|
+
// that have no sessionId to anchor against.
|
|
90
|
+
// Refuses to touch an in-flight run.
|
|
88
91
|
router.delete('/:runId', async (context) => {
|
|
89
92
|
const runId = SkillRunId.parse(context.req.param('runId'));
|
|
90
93
|
if (deps.skillRunner.isActive(runId))
|
|
@@ -105,7 +108,7 @@ export function createRunsRouter(deps) {
|
|
|
105
108
|
router.patch('/sessions/:sessionId', async (context) => {
|
|
106
109
|
const sessionId = context.req.param('sessionId');
|
|
107
110
|
if (!sessionId)
|
|
108
|
-
throw new NotFoundError('sessionId is required');
|
|
111
|
+
throw new NotFoundError('Query parameter sessionId is required');
|
|
109
112
|
const body = await context.req.json().catch(() => null);
|
|
110
113
|
const parsed = SessionPatchBody.safeParse(body);
|
|
111
114
|
if (!parsed.success)
|