@braidhq/server 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +134 -106
- package/dist/app.d.ts +7 -15
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +72 -45
- package/dist/app.js.map +1 -1
- package/dist/authMode.d.ts +39 -0
- package/dist/authMode.d.ts.map +1 -0
- package/dist/authMode.js +50 -0
- package/dist/authMode.js.map +1 -0
- package/dist/composeApp.d.ts +79 -0
- package/dist/composeApp.d.ts.map +1 -0
- package/dist/composeApp.js +136 -0
- package/dist/composeApp.js.map +1 -0
- package/dist/composeFsApp.d.ts +27 -0
- package/dist/composeFsApp.d.ts.map +1 -0
- package/dist/{composeFs.js → composeFsApp.js} +118 -125
- package/dist/composeFsApp.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/_shared/env.d.ts +10 -0
- package/dist/infrastructure/_shared/env.d.ts.map +1 -0
- package/dist/infrastructure/{env.js → _shared/env.js} +5 -6
- package/dist/infrastructure/_shared/env.js.map +1 -0
- package/dist/infrastructure/_shared/frontmatter.d.ts +13 -0
- package/dist/infrastructure/_shared/frontmatter.d.ts.map +1 -0
- package/dist/infrastructure/{fs → _shared}/frontmatter.js +5 -5
- package/dist/infrastructure/_shared/frontmatter.js.map +1 -0
- package/dist/infrastructure/_shared/jsonFileStore.d.ts.map +1 -0
- package/dist/infrastructure/_shared/jsonFileStore.js.map +1 -0
- package/dist/infrastructure/{fs → _shared}/paths.d.ts +17 -10
- package/dist/infrastructure/_shared/paths.d.ts.map +1 -0
- package/dist/infrastructure/{fs → _shared}/paths.js +27 -20
- package/dist/infrastructure/_shared/paths.js.map +1 -0
- package/dist/infrastructure/auth/AccessPolicy.d.ts +33 -58
- package/dist/infrastructure/auth/AccessPolicy.d.ts.map +1 -1
- package/dist/infrastructure/auth/AccessPolicy.js +35 -42
- package/dist/infrastructure/auth/AccessPolicy.js.map +1 -1
- package/dist/infrastructure/auth/SessionStore.d.ts +22 -12
- package/dist/infrastructure/auth/SessionStore.d.ts.map +1 -1
- package/dist/infrastructure/auth/SessionStore.js +15 -18
- package/dist/infrastructure/auth/SessionStore.js.map +1 -1
- package/dist/infrastructure/batch/FsBatchPlanRepository.d.ts +79 -0
- package/dist/infrastructure/batch/FsBatchPlanRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs → batch}/FsBatchPlanRepository.js +1 -1
- package/dist/infrastructure/batch/FsBatchPlanRepository.js.map +1 -0
- package/dist/infrastructure/history/GitWorkspaceHistory.d.ts.map +1 -0
- package/dist/infrastructure/{git → history}/GitWorkspaceHistory.js +31 -24
- package/dist/infrastructure/history/GitWorkspaceHistory.js.map +1 -0
- package/dist/infrastructure/history/commitMessage.d.ts.map +1 -0
- package/dist/infrastructure/history/commitMessage.js +90 -0
- package/dist/infrastructure/history/commitMessage.js.map +1 -0
- package/dist/infrastructure/hitl/FsClarificationRepository.d.ts +13 -0
- package/dist/infrastructure/hitl/FsClarificationRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs/FsClarifyTicketRepository.js → hitl/FsClarificationRepository.js} +15 -15
- package/dist/infrastructure/hitl/FsClarificationRepository.js.map +1 -0
- package/dist/infrastructure/hitl/FsProposalRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs → hitl}/FsProposalRepository.js +7 -8
- package/dist/infrastructure/hitl/FsProposalRepository.js.map +1 -0
- package/dist/infrastructure/hitl/StatusedJsonStore.d.ts +30 -0
- package/dist/infrastructure/hitl/StatusedJsonStore.d.ts.map +1 -0
- package/dist/infrastructure/{fs/FsStatusedJsonRepository.js → hitl/StatusedJsonStore.js} +3 -3
- package/dist/infrastructure/hitl/StatusedJsonStore.js.map +1 -0
- package/dist/infrastructure/model/FsModelSerializer.d.ts +96 -0
- package/dist/infrastructure/model/FsModelSerializer.d.ts.map +1 -0
- package/dist/infrastructure/{fs/FsGraphSerializer.js → model/FsModelSerializer.js} +11 -11
- package/dist/infrastructure/model/FsModelSerializer.js.map +1 -0
- package/dist/infrastructure/oauth/GoogleOAuth.d.ts +20 -38
- package/dist/infrastructure/oauth/GoogleOAuth.d.ts.map +1 -1
- package/dist/infrastructure/oauth/GoogleOAuth.js +21 -22
- package/dist/infrastructure/oauth/GoogleOAuth.js.map +1 -1
- package/dist/infrastructure/reactor/FsReactorCycleRepository.d.ts +29 -0
- package/dist/infrastructure/reactor/FsReactorCycleRepository.d.ts.map +1 -0
- package/dist/infrastructure/reactor/FsReactorCycleRepository.js +94 -0
- package/dist/infrastructure/reactor/FsReactorCycleRepository.js.map +1 -0
- package/dist/infrastructure/secrets/SecretStore.d.ts +11 -14
- package/dist/infrastructure/secrets/SecretStore.d.ts.map +1 -1
- package/dist/infrastructure/secrets/SecretStore.js +4 -4
- package/dist/infrastructure/secrets/SecretStore.js.map +1 -1
- package/dist/infrastructure/{fs → skill}/FsRunRepository.d.ts +5 -3
- package/dist/infrastructure/skill/FsRunRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs → skill}/FsRunRepository.js +11 -9
- package/dist/infrastructure/skill/FsRunRepository.js.map +1 -0
- package/dist/infrastructure/{fs → skill}/FsSkillRegistry.d.ts +4 -13
- package/dist/infrastructure/skill/FsSkillRegistry.d.ts.map +1 -0
- package/dist/infrastructure/{fs → skill}/FsSkillRegistry.js +28 -20
- package/dist/infrastructure/skill/FsSkillRegistry.js.map +1 -0
- package/dist/infrastructure/skill/SubprocessSkillRunner.d.ts +52 -0
- package/dist/infrastructure/skill/SubprocessSkillRunner.d.ts.map +1 -0
- package/dist/infrastructure/{agent → skill}/SubprocessSkillRunner.js +107 -55
- package/dist/infrastructure/skill/SubprocessSkillRunner.js.map +1 -0
- package/dist/infrastructure/skill/asyncQueue.d.ts +20 -0
- package/dist/infrastructure/skill/asyncQueue.d.ts.map +1 -0
- package/dist/infrastructure/{agent → skill}/asyncQueue.js +2 -3
- package/dist/infrastructure/{agent → skill}/asyncQueue.js.map +1 -1
- package/dist/infrastructure/skill/lineBuffer.d.ts +15 -0
- package/dist/infrastructure/skill/lineBuffer.d.ts.map +1 -0
- package/dist/infrastructure/{agent/streamJsonParser.js → skill/lineBuffer.js} +5 -17
- package/dist/infrastructure/skill/lineBuffer.js.map +1 -0
- package/dist/infrastructure/skill/orphanReaper.d.ts +20 -0
- package/dist/infrastructure/skill/orphanReaper.d.ts.map +1 -0
- package/dist/infrastructure/{orphanReaper.js → skill/orphanReaper.js} +7 -5
- package/dist/infrastructure/skill/orphanReaper.js.map +1 -0
- package/dist/infrastructure/skill/subprocessEventStream.d.ts +16 -0
- package/dist/infrastructure/skill/subprocessEventStream.d.ts.map +1 -0
- package/dist/infrastructure/skill/subprocessEventStream.js +29 -0
- package/dist/infrastructure/skill/subprocessEventStream.js.map +1 -0
- package/dist/infrastructure/source/FsSourceUnitDigest.d.ts +19 -0
- package/dist/infrastructure/source/FsSourceUnitDigest.d.ts.map +1 -0
- package/dist/infrastructure/{fs → source}/FsSourceUnitDigest.js +9 -9
- package/dist/infrastructure/source/FsSourceUnitDigest.js.map +1 -0
- package/dist/infrastructure/source/FsSourceUnitObservationRepository.d.ts +31 -0
- package/dist/infrastructure/source/FsSourceUnitObservationRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs/FsSourceUnitStateRepository.js → source/FsSourceUnitObservationRepository.js} +18 -17
- package/dist/infrastructure/source/FsSourceUnitObservationRepository.js.map +1 -0
- package/dist/infrastructure/{fs → source}/intentScan.d.ts +4 -0
- package/dist/infrastructure/source/intentScan.d.ts.map +1 -0
- package/dist/infrastructure/{fs → source}/intentScan.js +18 -16
- package/dist/infrastructure/source/intentScan.js.map +1 -0
- package/dist/infrastructure/users/UserDirectoryFromRegistry.d.ts +2 -2
- package/dist/infrastructure/users/UserDirectoryFromRegistry.js +2 -2
- package/dist/infrastructure/users/UserRegistryFile.d.ts +4 -5
- package/dist/infrastructure/users/UserRegistryFile.d.ts.map +1 -1
- package/dist/infrastructure/users/UserRegistryFile.js +6 -8
- package/dist/infrastructure/users/UserRegistryFile.js.map +1 -1
- package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts +9 -6
- package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts.map +1 -1
- package/dist/infrastructure/users/ensureWorkspaceOwners.js +10 -7
- package/dist/infrastructure/users/ensureWorkspaceOwners.js.map +1 -1
- package/dist/infrastructure/workspace/FsWorkspaceRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs → workspace}/FsWorkspaceRepository.js +7 -6
- package/dist/infrastructure/workspace/FsWorkspaceRepository.js.map +1 -0
- package/dist/infrastructure/workspace/WorkspaceDiscovery.d.ts +18 -0
- package/dist/infrastructure/workspace/WorkspaceDiscovery.d.ts.map +1 -0
- package/dist/infrastructure/{fs → workspace}/WorkspaceDiscovery.js +15 -11
- package/dist/infrastructure/workspace/WorkspaceDiscovery.js.map +1 -0
- package/dist/infrastructure/{fs → workspace}/WorkspaceRegistryFile.d.ts +10 -9
- package/dist/infrastructure/workspace/WorkspaceRegistryFile.d.ts.map +1 -0
- package/dist/infrastructure/{fs → workspace}/WorkspaceRegistryFile.js +15 -17
- package/dist/infrastructure/workspace/WorkspaceRegistryFile.js.map +1 -0
- package/dist/infrastructure/workspace/productManifestWriter.d.ts +24 -0
- package/dist/infrastructure/workspace/productManifestWriter.d.ts.map +1 -0
- package/dist/infrastructure/{fs → workspace}/productManifestWriter.js +14 -26
- package/dist/infrastructure/workspace/productManifestWriter.js.map +1 -0
- package/dist/middleware/auth.d.ts +27 -17
- package/dist/middleware/auth.d.ts.map +1 -1
- package/dist/middleware/auth.js +59 -53
- package/dist/middleware/auth.js.map +1 -1
- package/dist/middleware/cors.d.ts.map +1 -1
- package/dist/middleware/cors.js +4 -1
- package/dist/middleware/cors.js.map +1 -1
- package/dist/middleware/error.d.ts.map +1 -1
- package/dist/middleware/error.js +15 -13
- package/dist/middleware/error.js.map +1 -1
- package/dist/middleware/workspaceAccess.d.ts +23 -19
- package/dist/middleware/workspaceAccess.d.ts.map +1 -1
- package/dist/middleware/workspaceAccess.js +31 -26
- package/dist/middleware/workspaceAccess.js.map +1 -1
- package/dist/policy/CapabilityCheck.d.ts +5 -5
- package/dist/policy/PermissionRegistry.d.ts +11 -9
- package/dist/policy/PermissionRegistry.d.ts.map +1 -1
- package/dist/policy/PermissionRegistry.js +10 -8
- package/dist/policy/PermissionRegistry.js.map +1 -1
- package/dist/policy/ViewerContext.d.ts +13 -11
- package/dist/policy/ViewerContext.d.ts.map +1 -1
- package/dist/policy/checks.d.ts +9 -9
- package/dist/policy/checks.d.ts.map +1 -1
- package/dist/policy/checks.js +14 -11
- package/dist/policy/checks.js.map +1 -1
- package/dist/policy/defaultRegistry.d.ts +3 -4
- package/dist/policy/defaultRegistry.d.ts.map +1 -1
- package/dist/policy/defaultRegistry.js +3 -4
- package/dist/policy/defaultRegistry.js.map +1 -1
- package/dist/policy/index.d.ts +2 -2
- package/dist/policy/index.d.ts.map +1 -1
- package/dist/policy/index.js +1 -1
- package/dist/policy/index.js.map +1 -1
- package/dist/policy/resolveViewer.d.ts +9 -9
- package/dist/policy/resolveViewer.js +9 -9
- package/dist/routes/_shared.d.ts +93 -153
- package/dist/routes/_shared.d.ts.map +1 -1
- package/dist/routes/_shared.js +9 -5
- package/dist/routes/_shared.js.map +1 -1
- package/dist/routes/admin.d.ts +1 -1
- package/dist/routes/admin.d.ts.map +1 -1
- package/dist/routes/admin.js +13 -12
- package/dist/routes/admin.js.map +1 -1
- package/dist/routes/auth.d.ts +12 -10
- package/dist/routes/auth.d.ts.map +1 -1
- package/dist/routes/auth.js +32 -34
- package/dist/routes/auth.js.map +1 -1
- package/dist/routes/clarifications.d.ts +8 -0
- package/dist/routes/clarifications.d.ts.map +1 -0
- package/dist/routes/clarifications.js +243 -0
- package/dist/routes/clarifications.js.map +1 -0
- package/dist/routes/edges.d.ts.map +1 -1
- package/dist/routes/edges.js +2 -6
- package/dist/routes/edges.js.map +1 -1
- package/dist/routes/history.d.ts.map +1 -1
- package/dist/routes/history.js +12 -10
- package/dist/routes/history.js.map +1 -1
- package/dist/routes/nodes.d.ts.map +1 -1
- package/dist/routes/nodes.js +4 -8
- package/dist/routes/nodes.js.map +1 -1
- package/dist/routes/oauth.d.ts +6 -7
- package/dist/routes/oauth.d.ts.map +1 -1
- package/dist/routes/oauth.js +6 -7
- package/dist/routes/oauth.js.map +1 -1
- package/dist/routes/proposals.d.ts +2 -2
- package/dist/routes/proposals.d.ts.map +1 -1
- package/dist/routes/proposals.js +30 -28
- package/dist/routes/proposals.js.map +1 -1
- package/dist/routes/reactorCycles.d.ts +7 -0
- package/dist/routes/reactorCycles.d.ts.map +1 -0
- package/dist/routes/reactorCycles.js +60 -0
- package/dist/routes/reactorCycles.js.map +1 -0
- package/dist/routes/runs.d.ts.map +1 -1
- package/dist/routes/runs.js +22 -19
- package/dist/routes/runs.js.map +1 -1
- package/dist/routes/skillInputOptions.d.ts +2 -2
- package/dist/routes/skillInputOptions.d.ts.map +1 -1
- package/dist/routes/skillInputOptions.js +43 -45
- package/dist/routes/skillInputOptions.js.map +1 -1
- package/dist/routes/skills.d.ts +19 -1
- package/dist/routes/skills.d.ts.map +1 -1
- package/dist/routes/skills.js +139 -7
- package/dist/routes/skills.js.map +1 -1
- package/dist/routes/sourceLoaders.d.ts.map +1 -1
- package/dist/routes/sourceLoaders.js +1 -0
- package/dist/routes/sourceLoaders.js.map +1 -1
- package/dist/routes/sourceUnitObservations.d.ts +20 -0
- package/dist/routes/sourceUnitObservations.d.ts.map +1 -0
- package/dist/routes/sourceUnitObservations.js +80 -0
- package/dist/routes/sourceUnitObservations.js.map +1 -0
- package/dist/routes/sourceWebhooks.d.ts +26 -0
- package/dist/routes/sourceWebhooks.d.ts.map +1 -0
- package/dist/routes/sourceWebhooks.js +301 -0
- package/dist/routes/sourceWebhooks.js.map +1 -0
- package/dist/routes/users.d.ts +0 -2
- package/dist/routes/users.d.ts.map +1 -1
- package/dist/routes/users.js +15 -33
- package/dist/routes/users.js.map +1 -1
- package/dist/routes/workspaceEvents.d.ts +5 -4
- package/dist/routes/workspaceEvents.d.ts.map +1 -1
- package/dist/routes/workspaceEvents.js +7 -6
- package/dist/routes/workspaceEvents.js.map +1 -1
- package/dist/routes/workspaceMembers.d.ts +1 -1
- package/dist/routes/workspaceMembers.d.ts.map +1 -1
- package/dist/routes/workspaceMembers.js +2 -2
- package/dist/routes/workspaceMembers.js.map +1 -1
- package/dist/routes/workspaces.d.ts +21 -10
- package/dist/routes/workspaces.d.ts.map +1 -1
- package/dist/routes/workspaces.js +97 -69
- package/dist/routes/workspaces.js.map +1 -1
- package/dist/server.js +6 -70
- package/dist/server.js.map +1 -1
- package/dist/startServer.d.ts +17 -0
- package/dist/startServer.d.ts.map +1 -0
- package/dist/startServer.js +81 -0
- package/dist/startServer.js.map +1 -0
- package/dist/startup.d.ts +28 -0
- package/dist/startup.d.ts.map +1 -0
- package/dist/startup.js +94 -0
- package/dist/startup.js.map +1 -0
- package/package.json +9 -9
- package/dist/composeFs.d.ts +0 -55
- package/dist/composeFs.d.ts.map +0 -1
- package/dist/composeFs.js.map +0 -1
- package/dist/composition.d.ts +0 -133
- package/dist/composition.d.ts.map +0 -1
- package/dist/composition.js +0 -113
- package/dist/composition.js.map +0 -1
- package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts +0 -75
- package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts.map +0 -1
- package/dist/infrastructure/agent/SubprocessSkillRunner.js.map +0 -1
- package/dist/infrastructure/agent/asyncQueue.d.ts +0 -22
- package/dist/infrastructure/agent/asyncQueue.d.ts.map +0 -1
- package/dist/infrastructure/agent/mcpConfig.d.ts +0 -38
- package/dist/infrastructure/agent/mcpConfig.d.ts.map +0 -1
- package/dist/infrastructure/agent/mcpConfig.js +0 -55
- package/dist/infrastructure/agent/mcpConfig.js.map +0 -1
- package/dist/infrastructure/agent/streamJsonParser.d.ts +0 -20
- package/dist/infrastructure/agent/streamJsonParser.d.ts.map +0 -1
- package/dist/infrastructure/agent/streamJsonParser.js.map +0 -1
- package/dist/infrastructure/agent/subprocessEventStream.d.ts +0 -26
- package/dist/infrastructure/agent/subprocessEventStream.d.ts.map +0 -1
- package/dist/infrastructure/agent/subprocessEventStream.js +0 -112
- package/dist/infrastructure/agent/subprocessEventStream.js.map +0 -1
- package/dist/infrastructure/auth/ensureApprovedEmails.d.ts +0 -16
- package/dist/infrastructure/auth/ensureApprovedEmails.d.ts.map +0 -1
- package/dist/infrastructure/auth/ensureApprovedEmails.js +0 -20
- package/dist/infrastructure/auth/ensureApprovedEmails.js.map +0 -1
- package/dist/infrastructure/env.d.ts +0 -11
- package/dist/infrastructure/env.d.ts.map +0 -1
- package/dist/infrastructure/env.js.map +0 -1
- package/dist/infrastructure/fs/FsBatchPlanRepository.d.ts +0 -300
- package/dist/infrastructure/fs/FsBatchPlanRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsBatchPlanRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts +0 -13
- package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsClarifyTicketRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsDecisionRepository.d.ts +0 -13
- package/dist/infrastructure/fs/FsDecisionRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsDecisionRepository.js +0 -56
- package/dist/infrastructure/fs/FsDecisionRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsGraphSerializer.d.ts +0 -629
- package/dist/infrastructure/fs/FsGraphSerializer.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsGraphSerializer.js.map +0 -1
- package/dist/infrastructure/fs/FsProposalRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsProposalRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsRunRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsRunRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsSkillRegistry.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsSkillRegistry.js.map +0 -1
- package/dist/infrastructure/fs/FsSourceUnitDigest.d.ts +0 -19
- package/dist/infrastructure/fs/FsSourceUnitDigest.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsSourceUnitDigest.js.map +0 -1
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.d.ts +0 -30
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsStatusedJsonRepository.d.ts +0 -35
- package/dist/infrastructure/fs/FsStatusedJsonRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsStatusedJsonRepository.js.map +0 -1
- package/dist/infrastructure/fs/FsWorkspaceRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsWorkspaceRepository.js.map +0 -1
- package/dist/infrastructure/fs/WorkspaceDiscovery.d.ts +0 -15
- package/dist/infrastructure/fs/WorkspaceDiscovery.d.ts.map +0 -1
- package/dist/infrastructure/fs/WorkspaceDiscovery.js.map +0 -1
- package/dist/infrastructure/fs/WorkspaceRegistryFile.d.ts.map +0 -1
- package/dist/infrastructure/fs/WorkspaceRegistryFile.js.map +0 -1
- package/dist/infrastructure/fs/frontmatter.d.ts +0 -13
- package/dist/infrastructure/fs/frontmatter.d.ts.map +0 -1
- package/dist/infrastructure/fs/frontmatter.js.map +0 -1
- package/dist/infrastructure/fs/intentScan.d.ts.map +0 -1
- package/dist/infrastructure/fs/intentScan.js.map +0 -1
- package/dist/infrastructure/fs/jsonFileStore.d.ts.map +0 -1
- package/dist/infrastructure/fs/jsonFileStore.js.map +0 -1
- package/dist/infrastructure/fs/paths.d.ts.map +0 -1
- package/dist/infrastructure/fs/paths.js.map +0 -1
- package/dist/infrastructure/fs/productManifestWriter.d.ts +0 -22
- package/dist/infrastructure/fs/productManifestWriter.d.ts.map +0 -1
- package/dist/infrastructure/fs/productManifestWriter.js.map +0 -1
- package/dist/infrastructure/git/GitWorkspaceHistory.d.ts.map +0 -1
- package/dist/infrastructure/git/GitWorkspaceHistory.js.map +0 -1
- package/dist/infrastructure/git/commitMessage.d.ts.map +0 -1
- package/dist/infrastructure/git/commitMessage.js +0 -71
- package/dist/infrastructure/git/commitMessage.js.map +0 -1
- package/dist/infrastructure/orphanReaper.d.ts +0 -18
- package/dist/infrastructure/orphanReaper.d.ts.map +0 -1
- package/dist/infrastructure/orphanReaper.js.map +0 -1
- package/dist/infrastructure/users/ensureLocalUser.d.ts +0 -15
- package/dist/infrastructure/users/ensureLocalUser.d.ts.map +0 -1
- package/dist/infrastructure/users/ensureLocalUser.js +0 -38
- package/dist/infrastructure/users/ensureLocalUser.js.map +0 -1
- package/dist/middleware/requireAdmin.d.ts +0 -10
- package/dist/middleware/requireAdmin.d.ts.map +0 -1
- package/dist/middleware/requireAdmin.js +0 -24
- package/dist/middleware/requireAdmin.js.map +0 -1
- package/dist/middleware/userId.d.ts +0 -16
- package/dist/middleware/userId.d.ts.map +0 -1
- package/dist/middleware/userId.js +0 -27
- package/dist/middleware/userId.js.map +0 -1
- package/dist/policy/Capability.d.ts +0 -12
- package/dist/policy/Capability.d.ts.map +0 -1
- package/dist/policy/Capability.js +0 -31
- package/dist/policy/Capability.js.map +0 -1
- package/dist/routes/clarify.d.ts +0 -9
- package/dist/routes/clarify.d.ts.map +0 -1
- package/dist/routes/clarify.js +0 -274
- package/dist/routes/clarify.js.map +0 -1
- package/dist/routes/decisions.d.ts +0 -7
- package/dist/routes/decisions.d.ts.map +0 -1
- package/dist/routes/decisions.js +0 -68
- package/dist/routes/decisions.js.map +0 -1
- package/dist/routes/sourceUnitStates.d.ts +0 -7
- package/dist/routes/sourceUnitStates.d.ts.map +0 -1
- package/dist/routes/sourceUnitStates.js +0 -45
- package/dist/routes/sourceUnitStates.js.map +0 -1
- /package/dist/infrastructure/{fs → _shared}/jsonFileStore.d.ts +0 -0
- /package/dist/infrastructure/{fs → _shared}/jsonFileStore.js +0 -0
- /package/dist/infrastructure/{git → history}/GitWorkspaceHistory.d.ts +0 -0
- /package/dist/infrastructure/{git → history}/commitMessage.d.ts +0 -0
- /package/dist/infrastructure/{fs → hitl}/FsProposalRepository.d.ts +0 -0
- /package/dist/infrastructure/{fs → workspace}/FsWorkspaceRepository.d.ts +0 -0
|
@@ -2,24 +2,24 @@ import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
|
|
|
2
2
|
import process from 'node:process';
|
|
3
3
|
import { GraphEdge, GraphNode } from '@braidhq/schema';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { graphJsonPath, workspaceArtifactsDir } from '
|
|
6
|
-
export const
|
|
7
|
-
export const
|
|
5
|
+
import { graphJsonPath, workspaceArtifactsDir } from '../_shared/paths.js';
|
|
6
|
+
export const MODEL_JSON_VERSION = 1;
|
|
7
|
+
export const ModelJsonFile = z.object({
|
|
8
8
|
version: z.number().int(),
|
|
9
9
|
nodes: z.array(GraphNode),
|
|
10
10
|
edges: z.array(GraphEdge),
|
|
11
11
|
});
|
|
12
|
-
export class
|
|
12
|
+
export class FsModelSerializer {
|
|
13
13
|
async write(workspace, snapshot) {
|
|
14
14
|
const path = graphJsonPath(workspace.rootPath);
|
|
15
15
|
await mkdir(workspaceArtifactsDir(workspace.rootPath), { recursive: true });
|
|
16
16
|
const payload = {
|
|
17
|
-
version:
|
|
17
|
+
version: MODEL_JSON_VERSION,
|
|
18
18
|
nodes: [...snapshot.nodes].sort(byId),
|
|
19
19
|
edges: [...snapshot.edges].sort(byId),
|
|
20
20
|
};
|
|
21
|
-
// Atomic write
|
|
22
|
-
// mis-
|
|
21
|
+
// Atomic write. A crashed server must not leave a half-file behind,
|
|
22
|
+
// one that would mis-hydrate Kùzu on the next restart.
|
|
23
23
|
const tmp = `${path}.tmp-${process.pid}-${Date.now()}`;
|
|
24
24
|
await writeFile(tmp, `${JSON.stringify(payload, null, 2)}\n`, 'utf-8');
|
|
25
25
|
await rename(tmp, path);
|
|
@@ -34,9 +34,9 @@ export class FsGraphSerializer {
|
|
|
34
34
|
return null;
|
|
35
35
|
throw error;
|
|
36
36
|
}
|
|
37
|
-
const parsed =
|
|
38
|
-
if (parsed.version !==
|
|
39
|
-
throw new Error(`
|
|
37
|
+
const parsed = ModelJsonFile.parse(JSON.parse(raw));
|
|
38
|
+
if (parsed.version !== MODEL_JSON_VERSION) {
|
|
39
|
+
throw new Error(`model.json version mismatch in ${workspace.rootPath}: expected ${MODEL_JSON_VERSION}, got ${parsed.version}`);
|
|
40
40
|
}
|
|
41
41
|
return { nodes: parsed.nodes, edges: parsed.edges };
|
|
42
42
|
}
|
|
@@ -57,4 +57,4 @@ function byId(a, b) {
|
|
|
57
57
|
return 1;
|
|
58
58
|
return 0;
|
|
59
59
|
}
|
|
60
|
-
//# sourceMappingURL=
|
|
60
|
+
//# sourceMappingURL=FsModelSerializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FsModelSerializer.js","sourceRoot":"","sources":["../../../src/infrastructure/model/FsModelSerializer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAE1E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAA;AAEnC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACzB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC;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GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;QACnD,IAAI,MAAM,CAAC,OAAO,KAAK,kBAAkB,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CACb,kCAAkC,SAAS,CAAC,QAAQ,cAAc,kBAAkB,SAAS,MAAM,CAAC,OAAO,EAAE,CAC9G,CAAA;QACH,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAA;IACrD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,SAAoB;QAC/B,IAAI,CAAC;YACH,MAAM,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAA;YAC1D,OAAO,IAAI,CAAA;QACb,CAAC;QACD,MAAM,CAAC;YACL,OAAO,KAAK,CAAA;QACd,CAAC;IACH,CAAC;CACF;AAED,SAAS,IAAI,CAA2B,CAAI,EAAE,CAAI;IAChD,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE;QACb,OAAO,CAAC,CAAC,CAAA;IACX,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE;QACb,OAAO,CAAC,CAAA;IACV,OAAO,CAAC,CAAA;AACV,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Profile fields Braid needs after Google authn.
|
|
3
|
-
* Google account id
|
|
2
|
+
* Profile fields Braid needs after Google authn.
|
|
3
|
+
* `sub` is the stable Google account id, used as the join key into `users.json`.
|
|
4
4
|
*/
|
|
5
5
|
export interface GoogleProfile {
|
|
6
6
|
readonly sub: string;
|
|
@@ -9,31 +9,14 @@ export interface GoogleProfile {
|
|
|
9
9
|
readonly emailVerified?: boolean;
|
|
10
10
|
}
|
|
11
11
|
export interface GoogleOAuthConfig {
|
|
12
|
-
/** OAuth client id from the user's GCP project. */
|
|
13
12
|
readonly clientId: string;
|
|
14
|
-
/** OAuth client secret. */
|
|
15
13
|
readonly clientSecret: string;
|
|
16
|
-
/**
|
|
17
|
-
* Redirect URI used by the Drive ingestion flow (existing OAuth
|
|
18
|
-
* router). Both paths must be registered in the GCP OAuth client's
|
|
19
|
-
* authorised redirect URIs list.
|
|
20
|
-
*/
|
|
21
14
|
readonly redirectUri: string;
|
|
22
|
-
/**
|
|
23
|
-
* Redirect URI used by the user-login flow. Optional — falls back
|
|
24
|
-
* to the Drive `redirectUri` if unset, which is what local dev
|
|
25
|
-
* wants (one path = one registered URI). Production usually points
|
|
26
|
-
* this at `${apiUrl}/auth/google/callback` so the two flows are
|
|
27
|
-
* mounted on different routes.
|
|
28
|
-
*/
|
|
29
15
|
readonly loginRedirectUri?: string;
|
|
30
16
|
}
|
|
31
17
|
export interface AuthorizationUrlInput {
|
|
32
|
-
/** OAuth scope(s) requested. Braid passes Drive read-only. */
|
|
33
18
|
readonly scopes: readonly string[];
|
|
34
|
-
/** State token (CSRF + flow-restore). */
|
|
35
19
|
readonly state: string;
|
|
36
|
-
/** PKCE verifier; the URL embeds its SHA-256 challenge. */
|
|
37
20
|
readonly codeVerifier: string;
|
|
38
21
|
}
|
|
39
22
|
export interface TokenSet {
|
|
@@ -48,20 +31,19 @@ export interface RefreshedAccessToken {
|
|
|
48
31
|
readonly expiresAt: string;
|
|
49
32
|
}
|
|
50
33
|
/**
|
|
51
|
-
* Minimal Google OAuth 2.0 client for installed-app
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* surface auditable.
|
|
34
|
+
* Minimal Google OAuth 2.0 client for the installed-app or web flow.
|
|
35
|
+
* We skip `openid-client` and `google-auth-library`,
|
|
36
|
+
* because only four calls are needed (build URL, exchange code, refresh, revoke).
|
|
37
|
+
* Avoiding a heavyweight dependency keeps the server's install footprint small,
|
|
38
|
+
* and the auth surface auditable.
|
|
57
39
|
*/
|
|
58
40
|
export declare class GoogleOAuth {
|
|
59
41
|
private readonly config;
|
|
60
42
|
constructor(config: GoogleOAuthConfig);
|
|
61
43
|
/**
|
|
62
44
|
* Build the URL the user's browser is sent to. `state` and `codeVerifier`
|
|
63
|
-
* MUST be unique per flow
|
|
64
|
-
* the callback arrives.
|
|
45
|
+
* MUST be unique per flow,
|
|
46
|
+
* the caller stores them in pending-state until the callback arrives.
|
|
65
47
|
*/
|
|
66
48
|
buildAuthorizationUrl(input: AuthorizationUrlInput): string;
|
|
67
49
|
exchangeCode(input: {
|
|
@@ -69,11 +51,11 @@ export declare class GoogleOAuth {
|
|
|
69
51
|
codeVerifier: string;
|
|
70
52
|
}): Promise<TokenSet>;
|
|
71
53
|
/**
|
|
72
|
-
* Login flow URL. Same client
|
|
73
|
-
* `openid email profile` scopes and no `prompt=consent
|
|
74
|
-
* suppresses the consent screen when the user has already approved
|
|
75
|
-
*
|
|
76
|
-
* a refresh_token is required and `prompt=consent` is forced
|
|
54
|
+
* Login flow URL. Same client and redirect as the Drive flow,
|
|
55
|
+
* but with `openid email profile` scopes and no `prompt=consent`.
|
|
56
|
+
* Google suppresses the consent screen when the user has already approved those scopes,
|
|
57
|
+
* which is what login wants,
|
|
58
|
+
* unlike Drive where a refresh_token is required and `prompt=consent` is forced.
|
|
77
59
|
*/
|
|
78
60
|
buildLoginUrl(input: {
|
|
79
61
|
state: string;
|
|
@@ -82,12 +64,12 @@ export declare class GoogleOAuth {
|
|
|
82
64
|
/** Path Google sends the login callback to. Routed under `/auth/google/callback`. */
|
|
83
65
|
loginRedirectUri(): string;
|
|
84
66
|
/**
|
|
85
|
-
* Exchange an authorization code from the login flow for the user's
|
|
86
|
-
*
|
|
87
|
-
* Braid server issues its own session afterwards,
|
|
88
|
-
* are discarded after this call
|
|
89
|
-
*
|
|
90
|
-
* to read 3 fields.
|
|
67
|
+
* Exchange an authorization code from the login flow for the user's profile.
|
|
68
|
+
* Does NOT require `refresh_token`, since login is one-shot.
|
|
69
|
+
* The Braid server issues its own session afterwards,
|
|
70
|
+
* so Google's tokens are discarded after this call.
|
|
71
|
+
* Uses the userinfo endpoint instead of decoding the id_token,
|
|
72
|
+
* so no JWT verifier is pulled in just to read 3 fields.
|
|
91
73
|
*/
|
|
92
74
|
loginWithCode(input: {
|
|
93
75
|
code: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleOAuth.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/oauth/GoogleOAuth.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CACjC;AAED,MAAM,WAAW,iBAAiB;
|
|
1
|
+
{"version":3,"file":"GoogleOAuth.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/oauth/GoogleOAuth.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CACjC;AAED,MAAM,WAAW,iBAAiB;IAEhC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IAEzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAG7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAM5B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CACnC;AAED,MAAM,WAAW,qBAAqB;IAEpC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;IAElC,QAAQ,CAAC,KAAK,EAAE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CAEzC"}
|
|
@@ -3,12 +3,11 @@ const AUTH_ENDPOINT = 'https://accounts.google.com/o/oauth2/v2/auth';
|
|
|
3
3
|
const TOKEN_ENDPOINT = 'https://oauth2.googleapis.com/token';
|
|
4
4
|
const USERINFO_ENDPOINT = 'https://openidconnect.googleapis.com/v1/userinfo';
|
|
5
5
|
/**
|
|
6
|
-
* Minimal Google OAuth 2.0 client for installed-app
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* surface auditable.
|
|
6
|
+
* Minimal Google OAuth 2.0 client for the installed-app or web flow.
|
|
7
|
+
* We skip `openid-client` and `google-auth-library`,
|
|
8
|
+
* because only four calls are needed (build URL, exchange code, refresh, revoke).
|
|
9
|
+
* Avoiding a heavyweight dependency keeps the server's install footprint small,
|
|
10
|
+
* and the auth surface auditable.
|
|
12
11
|
*/
|
|
13
12
|
export class GoogleOAuth {
|
|
14
13
|
config;
|
|
@@ -17,8 +16,8 @@ export class GoogleOAuth {
|
|
|
17
16
|
}
|
|
18
17
|
/**
|
|
19
18
|
* Build the URL the user's browser is sent to. `state` and `codeVerifier`
|
|
20
|
-
* MUST be unique per flow
|
|
21
|
-
* the callback arrives.
|
|
19
|
+
* MUST be unique per flow,
|
|
20
|
+
* the caller stores them in pending-state until the callback arrives.
|
|
22
21
|
*/
|
|
23
22
|
buildAuthorizationUrl(input) {
|
|
24
23
|
const params = new URLSearchParams({
|
|
@@ -26,7 +25,7 @@ export class GoogleOAuth {
|
|
|
26
25
|
redirect_uri: this.config.redirectUri,
|
|
27
26
|
response_type: 'code',
|
|
28
27
|
scope: input.scopes.join(' '),
|
|
29
|
-
access_type: 'offline', //
|
|
28
|
+
access_type: 'offline', // yields refresh_token in the response
|
|
30
29
|
prompt: 'consent', // ensure refresh_token even on re-auth
|
|
31
30
|
include_granted_scopes: 'true',
|
|
32
31
|
state: input.state,
|
|
@@ -55,18 +54,18 @@ export class GoogleOAuth {
|
|
|
55
54
|
}
|
|
56
55
|
const payload = await response.json();
|
|
57
56
|
if (!payload.refresh_token) {
|
|
58
|
-
// Google only returns refresh_token on first consent.
|
|
59
|
-
// one, the caller can't store anything useful for next time.
|
|
57
|
+
// Google only returns refresh_token on first consent.
|
|
58
|
+
// Without one, the caller can't store anything useful for next time.
|
|
60
59
|
throw new Error('Google did not return a refresh_token. Add prompt=consent and ensure access_type=offline.');
|
|
61
60
|
}
|
|
62
61
|
return tokenSetFromPayload(payload);
|
|
63
62
|
}
|
|
64
63
|
/**
|
|
65
|
-
* Login flow URL. Same client
|
|
66
|
-
* `openid email profile` scopes and no `prompt=consent
|
|
67
|
-
* suppresses the consent screen when the user has already approved
|
|
68
|
-
*
|
|
69
|
-
* a refresh_token is required and `prompt=consent` is forced
|
|
64
|
+
* Login flow URL. Same client and redirect as the Drive flow,
|
|
65
|
+
* but with `openid email profile` scopes and no `prompt=consent`.
|
|
66
|
+
* Google suppresses the consent screen when the user has already approved those scopes,
|
|
67
|
+
* which is what login wants,
|
|
68
|
+
* unlike Drive where a refresh_token is required and `prompt=consent` is forced.
|
|
70
69
|
*/
|
|
71
70
|
buildLoginUrl(input) {
|
|
72
71
|
const params = new URLSearchParams({
|
|
@@ -87,12 +86,12 @@ export class GoogleOAuth {
|
|
|
87
86
|
return this.config.loginRedirectUri ?? this.config.redirectUri;
|
|
88
87
|
}
|
|
89
88
|
/**
|
|
90
|
-
* Exchange an authorization code from the login flow for the user's
|
|
91
|
-
*
|
|
92
|
-
* Braid server issues its own session afterwards,
|
|
93
|
-
* are discarded after this call
|
|
94
|
-
*
|
|
95
|
-
* to read 3 fields.
|
|
89
|
+
* Exchange an authorization code from the login flow for the user's profile.
|
|
90
|
+
* Does NOT require `refresh_token`, since login is one-shot.
|
|
91
|
+
* The Braid server issues its own session afterwards,
|
|
92
|
+
* so Google's tokens are discarded after this call.
|
|
93
|
+
* Uses the userinfo endpoint instead of decoding the id_token,
|
|
94
|
+
* so no JWT verifier is pulled in just to read 3 fields.
|
|
96
95
|
*/
|
|
97
96
|
async loginWithCode(input) {
|
|
98
97
|
const body = new URLSearchParams({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleOAuth.js","sourceRoot":"","sources":["../../../src/infrastructure/oauth/GoogleOAuth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,aAAa,GAAG,8CAA8C,CAAA;AACpE,MAAM,cAAc,GAAG,qCAAqC,CAAA;AAC5D,MAAM,iBAAiB,GAAG,kDAAkD,CAAA;
|
|
1
|
+
{"version":3,"file":"GoogleOAuth.js","sourceRoot":"","sources":["../../../src/infrastructure/oauth/GoogleOAuth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,aAAa,GAAG,8CAA8C,CAAA;AACpE,MAAM,cAAc,GAAG,qCAAqC,CAAA;AAC5D,MAAM,iBAAiB,GAAG,kDAAkD,CAAA;AAmD5E;;;;;;GAMG;AACH,MAAM,OAAO,WAAW;IACO;IAA7B,YAA6B,MAAyB;QAAzB,WAAM,GAAN,MAAM,CAAmB;IAAG,CAAC;IAE1D;;;;OAIG;IACH,qBAAqB,CAAC,KAA4B;QAChD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;YACjC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC/B,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;YACrC,aAAa,EAAE,MAAM;YACrB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;YAC7B,WAAW,EAAE,SAAS,EAAE,uCAAuC;YAC/D,MAAM,EAAE,SAAS,EAAE,uCAAuC;YAC1D,sBAAsB,EAAE,MAAM;YAC9B,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,cAAc,EAAE,aAAa,CAAC,KAAK,CAAC,YAAY,CA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AAC,CAAA;AAClE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;AAC9C,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ReactorCycleRepository } from '@braidhq/core';
|
|
2
|
+
import type { AbsolutePath, ReactorCycle, ReactorCycleId, WorkspaceId } from '@braidhq/schema';
|
|
3
|
+
export interface FsReactorCycleRepositoryOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Lookup of workspaceId to workspaceRoot. Shared with the other Fs repositories,
|
|
6
|
+
* so this repo doesn't introduce a separate dependency on `WorkspaceService`.
|
|
7
|
+
* `composeFs.ts` builds a single closure once and passes it to every fs repo.
|
|
8
|
+
*/
|
|
9
|
+
readonly workspaceRoots: () => Promise<ReadonlyMap<WorkspaceId, AbsolutePath>>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Filesystem-backed `ReactorCycleRepository`. One JSON file per cycle,
|
|
13
|
+
* at `artifacts/reactor-cycles/<cycleId>.json`.
|
|
14
|
+
* Each save is an atomic rename,
|
|
15
|
+
* so the Studio Activity page never reads a half-written file.
|
|
16
|
+
*
|
|
17
|
+
* The file body is exactly the `ReactorCycle` shape, no wrapper or envelope.
|
|
18
|
+
* A future SQLite or Postgres impl maps one file to one row keyed by `cycleId`,
|
|
19
|
+
* with `(workspaceId, startedAt)` indexed for the list query.
|
|
20
|
+
*/
|
|
21
|
+
export declare class FsReactorCycleRepository implements ReactorCycleRepository {
|
|
22
|
+
private readonly options;
|
|
23
|
+
constructor(options: FsReactorCycleRepositoryOptions);
|
|
24
|
+
save(cycle: ReactorCycle): Promise<void>;
|
|
25
|
+
load(workspaceId: WorkspaceId, cycleId: ReactorCycleId): Promise<ReactorCycle | undefined>;
|
|
26
|
+
listByWorkspace(workspaceId: WorkspaceId): Promise<readonly ReactorCycle[]>;
|
|
27
|
+
private resolveRoot;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=FsReactorCycleRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FsReactorCycleRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/reactor/FsReactorCycleRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAU9F,MAAM,WAAW,+BAA+B;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAA;CAC/E;AAED;;;;;;;;;GASG;AACH,qBAAa,wBAAyB,YAAW,sBAAsB;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,+BAA+B;IAE/D,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAUxC,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAoB1F,eAAe,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC;YA0BnE,WAAW;CAO1B"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { mkdir, readdir, readFile, rename, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import process from 'node:process';
|
|
5
|
+
import { NotFoundError } from '@braidhq/core';
|
|
6
|
+
import { ReactorCycle as ReactorCycleSchema } from '@braidhq/schema';
|
|
7
|
+
import { reactorCycleFilePath, reactorCyclesDir } from '../_shared/paths.js';
|
|
8
|
+
/**
|
|
9
|
+
* Filesystem-backed `ReactorCycleRepository`. One JSON file per cycle,
|
|
10
|
+
* at `artifacts/reactor-cycles/<cycleId>.json`.
|
|
11
|
+
* Each save is an atomic rename,
|
|
12
|
+
* so the Studio Activity page never reads a half-written file.
|
|
13
|
+
*
|
|
14
|
+
* The file body is exactly the `ReactorCycle` shape, no wrapper or envelope.
|
|
15
|
+
* A future SQLite or Postgres impl maps one file to one row keyed by `cycleId`,
|
|
16
|
+
* with `(workspaceId, startedAt)` indexed for the list query.
|
|
17
|
+
*/
|
|
18
|
+
export class FsReactorCycleRepository {
|
|
19
|
+
options;
|
|
20
|
+
constructor(options) {
|
|
21
|
+
this.options = options;
|
|
22
|
+
}
|
|
23
|
+
async save(cycle) {
|
|
24
|
+
const root = await this.resolveRoot(cycle.workspaceId);
|
|
25
|
+
const file = reactorCycleFilePath(root, cycle.id);
|
|
26
|
+
await mkdir(reactorCyclesDir(root), { recursive: true });
|
|
27
|
+
// Random suffix so concurrent saves in the same ms don't collide.
|
|
28
|
+
const tmp = `${file}.tmp-${process.pid}-${randomUUID()}`;
|
|
29
|
+
await writeFile(tmp, `${JSON.stringify(cycle, null, 2)}\n`, 'utf-8');
|
|
30
|
+
await rename(tmp, file);
|
|
31
|
+
}
|
|
32
|
+
async load(workspaceId, cycleId) {
|
|
33
|
+
const root = await this.resolveRoot(workspaceId);
|
|
34
|
+
const file = reactorCycleFilePath(root, cycleId);
|
|
35
|
+
try {
|
|
36
|
+
const raw = await readFile(file, 'utf-8');
|
|
37
|
+
const parsed = ReactorCycleSchema.parse(JSON.parse(raw));
|
|
38
|
+
// The directory layout is per-workspace already,
|
|
39
|
+
// but double-check the body matches, guarding the case,
|
|
40
|
+
// where an operator copy-pasted in a file from another workspace.
|
|
41
|
+
if (parsed.workspaceId !== workspaceId)
|
|
42
|
+
return undefined;
|
|
43
|
+
return parsed;
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
if (error.code === 'ENOENT')
|
|
47
|
+
return undefined;
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async listByWorkspace(workspaceId) {
|
|
52
|
+
const root = await this.resolveRoot(workspaceId);
|
|
53
|
+
const dir = reactorCyclesDir(root);
|
|
54
|
+
const entries = await safeReaddir(dir);
|
|
55
|
+
const cycles = [];
|
|
56
|
+
for (const entry of entries) {
|
|
57
|
+
if (!entry.isFile() || !entry.name.endsWith('.json'))
|
|
58
|
+
continue;
|
|
59
|
+
if (entry.name.includes('.tmp-'))
|
|
60
|
+
continue;
|
|
61
|
+
const raw = await readFile(join(dir, entry.name), 'utf-8');
|
|
62
|
+
try {
|
|
63
|
+
const parsed = ReactorCycleSchema.parse(JSON.parse(raw));
|
|
64
|
+
if (parsed.workspaceId === workspaceId)
|
|
65
|
+
cycles.push(parsed);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// Skip files that fail validation, truncated half-writes,
|
|
69
|
+
// or manual edits gone wrong.
|
|
70
|
+
// Raising them as errors here would,
|
|
71
|
+
// in turn, block the Activity page from rendering recent cycles.
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return cycles.sort((a, b) => b.startedAt.localeCompare(a.startedAt));
|
|
75
|
+
}
|
|
76
|
+
async resolveRoot(workspaceId) {
|
|
77
|
+
const roots = await this.options.workspaceRoots();
|
|
78
|
+
const root = roots.get(workspaceId);
|
|
79
|
+
if (!root)
|
|
80
|
+
throw new NotFoundError(`Workspace "${workspaceId}" has no registered root path`);
|
|
81
|
+
return root;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async function safeReaddir(dir) {
|
|
85
|
+
try {
|
|
86
|
+
return await readdir(dir, { withFileTypes: true });
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
if (error.code === 'ENOENT')
|
|
90
|
+
return [];
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=FsReactorCycleRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FsReactorCycleRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/reactor/FsReactorCycleRepository.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAW5E;;;;;;;;;GASG;AACH,MAAM,OAAO,wBAAwB;IACN;IAA7B,YAA6B,OAAwC;QAAxC,YAAO,GAAP,OAAO,CAAiC;IAAG,CAAC;IAEzE,KAAK,CAAC,IAAI,CAAC,KAAmB;QAC5B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QACtD,MAAM,IAAI,GAAG,oBAAoB,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,CAAA;QACjD,MAAM,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QACxD,kEAAkE;QAClE,MAAM,GAAG,GAAG,GAAG,IAAI,QAAQ,OAAO,CAAC,GAAG,IAAI,UAAU,EAAE,EAAE,CAAA;QACxD,MAAM,SAAS,CAAC,GAAG,EAAE,GAAG,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O,EAAE,CAAA;QACX,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Per-scope JSON secret storage on the local filesystem.
|
|
3
|
-
* `(namespace, key)` under `<root>/<namespace>/<key>.json`.
|
|
4
|
-
* written with mode 0600 so only the running user can read them
|
|
5
|
-
* containing directory is mode 0700.
|
|
2
|
+
* Per-scope JSON secret storage on the local filesystem.
|
|
3
|
+
* One file per `(namespace, key)` under `<root>/<namespace>/<key>.json`.
|
|
4
|
+
* Files are written with mode 0600 so only the running user can read them,
|
|
5
|
+
* the containing directory is mode 0700.
|
|
6
6
|
*
|
|
7
|
-
* This is NOT an encrypted-at-rest store.
|
|
8
|
-
* single-user Braid installs (the OSS target).
|
|
9
|
-
* would swap this for a vault adapter
|
|
10
|
-
*
|
|
7
|
+
* This is NOT an encrypted-at-rest store.
|
|
8
|
+
* It suits local, single-user Braid installs (the OSS target).
|
|
9
|
+
* A hosted SaaS deployment would swap this for a vault adapter,
|
|
10
|
+
* such as AWS Secrets Manager or Vault, behind the same interface.
|
|
11
11
|
*
|
|
12
|
-
* Layout
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* <workspaceId>--<sourceId>.json # one set of tokens per source
|
|
16
|
-
* oauth-github/
|
|
17
|
-
* <workspaceId>--<sourceId>.json
|
|
12
|
+
* Layout, one tokens file per source under a per-provider namespace,
|
|
13
|
+
* so Google tokens live at `<root>/oauth-google/<workspaceId>--<sourceId>.json`,
|
|
14
|
+
* and GitHub tokens at `<root>/oauth-github/<workspaceId>--<sourceId>.json`.
|
|
18
15
|
*/
|
|
19
16
|
export interface SecretRecord {
|
|
20
17
|
readonly value: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecretStore.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/secrets/SecretStore.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"SecretStore.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/secrets/SecretStore.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAA;IACnE,KAAK,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACxE,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1D;AAED,qBAAa,aAAc,YAAW,WAAW;IACnC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,MAAM;IAEnC,IAAI,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAc/D,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAWpE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK3D,OAAO,CAAC,OAAO;CAGhB"}
|
|
@@ -23,8 +23,8 @@ export class FsSecretStore {
|
|
|
23
23
|
await mkdir(dirname(path), { recursive: true, mode: 0o700 });
|
|
24
24
|
const record = { value, updatedAt: new Date().toISOString() };
|
|
25
25
|
await writeFile(path, JSON.stringify(record, null, 2), { encoding: 'utf-8', mode: 0o600 });
|
|
26
|
-
// mkdir's mode arg is ignored on some platforms
|
|
27
|
-
// dir
|
|
26
|
+
// mkdir's mode arg is ignored on some platforms,
|
|
27
|
+
// so chmod the dir and file explicitly to keep perms stable across reboots and restores.
|
|
28
28
|
await chmod(dirname(path), 0o700);
|
|
29
29
|
await chmod(path, 0o600);
|
|
30
30
|
}
|
|
@@ -36,8 +36,8 @@ export class FsSecretStore {
|
|
|
36
36
|
return join(this.root, sanitize(namespace), `${sanitize(key)}.json`);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
// Conservative
|
|
40
|
-
//
|
|
39
|
+
// Conservative allowlist of ASCII letters, digits, `-`, `_`, and `.`.
|
|
40
|
+
// Anything else becomes `_` so a hostile workspaceId can't escape the dir.
|
|
41
41
|
function sanitize(input) {
|
|
42
42
|
return input.replace(/[^\w.-]/g, '_');
|
|
43
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecretStore.js","sourceRoot":"","sources":["../../../src/infrastructure/secrets/SecretStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"SecretStore.js","sourceRoot":"","sources":["../../../src/infrastructure/secrets/SecretStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AA4BzC,MAAM,OAAO,aAAa;IACK;IAA7B,YAA6B,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAE7C,KAAK,CAAC,IAAI,CAAI,SAAiB,EAAE,GAAW;QAC1C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AAE,GAAG,CAAC,CAAA;QACzC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACjC,CAAC;IAEO,OAAO,CAAC,SAAiB,EAAE,GAAW;QAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACtE,CAAC;CACF;AAED,sEAAsE;AACtE,2EAA2E;AAC3E,SAAS,QAAQ,CAAC,KAAa;IAC7B,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;AACvC,CAAC"}
|
|
@@ -7,9 +7,10 @@ import type { AbsolutePath, RunRecord, SessionMetadata, SkillEvent, SkillRunId }
|
|
|
7
7
|
* ├── index.jsonl (append-only summary, last-wins per runId)
|
|
8
8
|
* └── <runId>.jsonl (full SkillEvent stream for one run)
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* The index is append-only because every write of one workspace goes,
|
|
11
|
+
* today, through a single server process.
|
|
12
|
+
* Should that ever change,
|
|
13
|
+
* we would swap to atomic `mv tmp final` rewrites, or hand it to sqlite.
|
|
13
14
|
*/
|
|
14
15
|
export declare class FsRunRepository implements RunRepository {
|
|
15
16
|
saveRecord(workspace: Workspace, record: RunRecord): Promise<void>;
|
|
@@ -20,5 +21,6 @@ export declare class FsRunRepository implements RunRepository {
|
|
|
20
21
|
saveSessionMetadata(workspace: Workspace, metadata: SessionMetadata): Promise<void>;
|
|
21
22
|
listSessionMetadata(workspace: Workspace): Promise<readonly SessionMetadata[]>;
|
|
22
23
|
}
|
|
24
|
+
/** Re-exported so callers don't need to thread AbsolutePath types around. */
|
|
23
25
|
export type { AbsolutePath };
|
|
24
26
|
//# sourceMappingURL=FsRunRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FsRunRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/skill/FsRunRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAQvG;;;;;;;;;;;GAWG;AACH,qBAAa,eAAgB,YAAW,aAAa;IAC7C,UAAU,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAOlE,WAAW,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAOtF,WAAW,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,SAAS,EAAE,CAAC;IAyB9D,UAAU,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,GAAG,aAAa,CAAC,UAAU,CAAC;IAkBhF,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAqCjF,mBAAmB,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAOnF,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC;CAsBrF;AA6BD,6EAA6E;AAC7E,YAAY,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -3,7 +3,7 @@ import { appendFile, mkdir, readFile, rename, rm, writeFile } from 'node:fs/prom
|
|
|
3
3
|
import process from 'node:process';
|
|
4
4
|
import { createInterface } from 'node:readline/promises';
|
|
5
5
|
import { RunRecord as RunRecordSchema, SessionMetadata as SessionMetadataSchema, SkillEvent as SkillEventSchema } from '@braidhq/schema';
|
|
6
|
-
import { runEventsPath, runIndexPath, runsDir, runSessionsMetadataPath } from '
|
|
6
|
+
import { runEventsPath, runIndexPath, runsDir, runSessionsMetadataPath } from '../_shared/paths.js';
|
|
7
7
|
/**
|
|
8
8
|
* File-system adapter for skill-run recording.
|
|
9
9
|
*
|
|
@@ -11,9 +11,10 @@ import { runEventsPath, runIndexPath, runsDir, runSessionsMetadataPath } from '.
|
|
|
11
11
|
* ├── index.jsonl (append-only summary, last-wins per runId)
|
|
12
12
|
* └── <runId>.jsonl (full SkillEvent stream for one run)
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* The index is append-only because every write of one workspace goes,
|
|
15
|
+
* today, through a single server process.
|
|
16
|
+
* Should that ever change,
|
|
17
|
+
* we would swap to atomic `mv tmp final` rewrites, or hand it to sqlite.
|
|
17
18
|
*/
|
|
18
19
|
export class FsRunRepository {
|
|
19
20
|
async saveRecord(workspace, record) {
|
|
@@ -85,9 +86,10 @@ export class FsRunRepository {
|
|
|
85
86
|
throw error;
|
|
86
87
|
}
|
|
87
88
|
// Rewrite the index excluding every line that names a target run.
|
|
88
|
-
// Last-wins reader semantics mean we must drop ALL occurrences,
|
|
89
|
-
// just the latest one
|
|
90
|
-
//
|
|
89
|
+
// Last-wins reader semantics mean we must drop ALL occurrences,
|
|
90
|
+
// not just the latest one.
|
|
91
|
+
// An earlier entry left behind would,
|
|
92
|
+
// otherwise resurrect the run when `listRecords()` next runs.
|
|
91
93
|
const kept = [];
|
|
92
94
|
for (const line of raw.split('\n')) {
|
|
93
95
|
if (line.length === 0)
|
|
@@ -100,8 +102,8 @@ export class FsRunRepository {
|
|
|
100
102
|
const tmp = `${indexPath}.tmp-${process.pid}-${Date.now()}`;
|
|
101
103
|
await writeFile(tmp, kept.length === 0 ? '' : `${kept.join('\n')}\n`, 'utf-8');
|
|
102
104
|
await rename(tmp, indexPath);
|
|
103
|
-
// Per-runId event files
|
|
104
|
-
// fine
|
|
105
|
+
// Per-runId event files get best-effort removal.
|
|
106
|
+
// A missing file is fine, the run errored before any event landed.
|
|
105
107
|
await Promise.all(runIds.map(id => rm(runEventsPath(root, id), { force: true })));
|
|
106
108
|
}
|
|
107
109
|
async saveSessionMetadata(workspace, metadata) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FsRunRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/skill/FsRunRepository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACrF,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,eAAe,IAAI,qBAAqB,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACxI,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAEnG;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,eAAe;IAC1B,KAAK,CAAC,UAAU,CAAC,SAAoB,EAAE,MAAiB;QACtD,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAA;QAC/B,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QAC/C,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAA;QAC1C,MAAM,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IACrD,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,SAAoB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AAS,cAAc,CAAC,IAAY;IAClC,IAAI,CAAC;QACH,OAAO,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;IACjD,CAAC;IACD,MAAM,CAAC;QACL,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED,SAAS,wBAAwB,CAAC,IAAY;IAC5C,IAAI,CAAC;QACH,OAAO,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;IACtD,CAAC;IACD,MAAM,CAAC;QACL,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -3,11 +3,10 @@ import { type PluginRegistry, SkillManifest, type SkillRegistry, type Workspace
|
|
|
3
3
|
export interface FsSkillRegistryOptions {
|
|
4
4
|
readonly builtinSkillsRoot: AbsolutePath;
|
|
5
5
|
/**
|
|
6
|
-
* Optional plugin registry. When provided, skills
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* extension origins are discovered.
|
|
6
|
+
* Optional plugin registry. When provided, plugin-declared skills mount,
|
|
7
|
+
* between builtins and workspace skills, under the `plugin` origin.
|
|
8
|
+
* Without it, as in unit tests that compose no registry, only builtin,
|
|
9
|
+
* workspace, and extension origins are discovered.
|
|
11
10
|
*/
|
|
12
11
|
readonly pluginRegistry?: PluginRegistry;
|
|
13
12
|
}
|
|
@@ -18,14 +17,6 @@ export declare class FsSkillRegistry implements SkillRegistry {
|
|
|
18
17
|
find(workspace: Workspace, skillId: SkillId): Promise<SkillManifest | undefined>;
|
|
19
18
|
get(workspace: Workspace, skillId: SkillId): Promise<SkillManifest>;
|
|
20
19
|
private scanSkillsRoot;
|
|
21
|
-
/**
|
|
22
|
-
* Resolve every PluginSkillRef in the registry to a parsed
|
|
23
|
-
* SkillManifest. Each ref's `directory` is converted to an absolute
|
|
24
|
-
* fs path (URL via fileURLToPath), then `SKILL.md` is read and
|
|
25
|
-
* parsed. Missing files at a plugin-declared path are an error,
|
|
26
|
-
* not a silent skip: a plugin that ships a broken ref deserves a
|
|
27
|
-
* loud startup failure, not a mysteriously-absent skill.
|
|
28
|
-
*/
|
|
29
20
|
private scanPluginSkills;
|
|
30
21
|
private scanExtensionRoot;
|
|
31
22
|
private readSkillFrontmatter;
|