@braidhq/server 0.0.1 → 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 +164 -0
- package/dist/app.d.ts +12 -3
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +154 -9
- 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/composeFsApp.js +309 -0
- 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/_shared/env.js +19 -0
- 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/_shared/paths.d.ts +43 -0
- package/dist/infrastructure/_shared/paths.d.ts.map +1 -0
- package/dist/infrastructure/_shared/paths.js +96 -0
- package/dist/infrastructure/_shared/paths.js.map +1 -0
- package/dist/infrastructure/auth/AccessPolicy.d.ts +87 -0
- package/dist/infrastructure/auth/AccessPolicy.d.ts.map +1 -0
- package/dist/infrastructure/auth/AccessPolicy.js +177 -0
- package/dist/infrastructure/auth/AccessPolicy.js.map +1 -0
- package/dist/infrastructure/auth/SessionStore.d.ts +50 -0
- package/dist/infrastructure/auth/SessionStore.d.ts.map +1 -0
- package/dist/infrastructure/auth/SessionStore.js +104 -0
- package/dist/infrastructure/auth/SessionStore.js.map +1 -0
- package/dist/infrastructure/batch/FsBatchPlanRepository.d.ts +79 -0
- package/dist/infrastructure/batch/FsBatchPlanRepository.d.ts.map +1 -0
- package/dist/infrastructure/batch/FsBatchPlanRepository.js +42 -0
- package/dist/infrastructure/batch/FsBatchPlanRepository.js.map +1 -0
- package/dist/infrastructure/history/GitWorkspaceHistory.d.ts +18 -0
- package/dist/infrastructure/history/GitWorkspaceHistory.d.ts.map +1 -0
- package/dist/infrastructure/history/GitWorkspaceHistory.js +310 -0
- package/dist/infrastructure/history/GitWorkspaceHistory.js.map +1 -0
- package/dist/infrastructure/history/commitMessage.d.ts +4 -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 +39 -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 +10 -3
- 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/model/FsModelSerializer.js +60 -0
- package/dist/infrastructure/model/FsModelSerializer.js.map +1 -0
- package/dist/infrastructure/oauth/GoogleOAuth.d.ts +43 -14
- package/dist/infrastructure/oauth/GoogleOAuth.d.ts.map +1 -1
- package/dist/infrastructure/oauth/GoogleOAuth.js +78 -11
- 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 +9 -4
- package/dist/infrastructure/skill/FsRunRepository.d.ts.map +1 -0
- package/dist/infrastructure/skill/FsRunRepository.js +162 -0
- 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 +38 -18
- package/dist/infrastructure/skill/FsSkillRegistry.js.map +1 -0
- package/dist/infrastructure/{agent → skill}/SubprocessSkillRunner.d.ts +13 -15
- package/dist/infrastructure/skill/SubprocessSkillRunner.d.ts.map +1 -0
- package/dist/infrastructure/{agent → skill}/SubprocessSkillRunner.js +124 -40
- 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/source/FsSourceUnitDigest.js +58 -0
- 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/source/FsSourceUnitObservationRepository.js +88 -0
- package/dist/infrastructure/source/FsSourceUnitObservationRepository.js.map +1 -0
- package/dist/infrastructure/source/intentScan.d.ts +13 -0
- package/dist/infrastructure/source/intentScan.d.ts.map +1 -0
- package/dist/infrastructure/source/intentScan.js +137 -0
- package/dist/infrastructure/source/intentScan.js.map +1 -0
- package/dist/infrastructure/users/UserDirectoryFromRegistry.d.ts +14 -0
- package/dist/infrastructure/users/UserDirectoryFromRegistry.d.ts.map +1 -0
- package/dist/infrastructure/users/UserDirectoryFromRegistry.js +21 -0
- package/dist/infrastructure/users/UserDirectoryFromRegistry.js.map +1 -0
- package/dist/infrastructure/users/UserRegistryFile.d.ts +22 -0
- package/dist/infrastructure/users/UserRegistryFile.d.ts.map +1 -0
- package/dist/infrastructure/users/UserRegistryFile.js +89 -0
- package/dist/infrastructure/users/UserRegistryFile.js.map +1 -0
- package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts +12 -0
- package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts.map +1 -0
- package/dist/infrastructure/users/ensureWorkspaceOwners.js +25 -0
- package/dist/infrastructure/users/ensureWorkspaceOwners.js.map +1 -0
- package/dist/infrastructure/workspace/FsWorkspaceRepository.d.ts.map +1 -0
- package/dist/infrastructure/{fs → workspace}/FsWorkspaceRepository.js +15 -5
- 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/workspace/WorkspaceDiscovery.js +50 -0
- package/dist/infrastructure/workspace/WorkspaceDiscovery.js.map +1 -0
- package/dist/infrastructure/workspace/WorkspaceRegistryFile.d.ts +42 -0
- package/dist/infrastructure/workspace/WorkspaceRegistryFile.d.ts.map +1 -0
- package/dist/infrastructure/workspace/WorkspaceRegistryFile.js +160 -0
- 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 -28
- package/dist/infrastructure/workspace/productManifestWriter.js.map +1 -0
- package/dist/middleware/auth.d.ts +39 -0
- package/dist/middleware/auth.d.ts.map +1 -0
- package/dist/middleware/auth.js +87 -0
- package/dist/middleware/auth.js.map +1 -0
- package/dist/middleware/cors.d.ts.map +1 -1
- package/dist/middleware/cors.js +5 -2
- 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 +51 -0
- package/dist/middleware/workspaceAccess.d.ts.map +1 -0
- package/dist/middleware/workspaceAccess.js +91 -0
- package/dist/middleware/workspaceAccess.js.map +1 -0
- package/dist/policy/CapabilityCheck.d.ts +14 -0
- package/dist/policy/CapabilityCheck.d.ts.map +1 -0
- package/dist/policy/CapabilityCheck.js +2 -0
- package/dist/policy/CapabilityCheck.js.map +1 -0
- package/dist/policy/PermissionRegistry.d.ts +25 -0
- package/dist/policy/PermissionRegistry.d.ts.map +1 -0
- package/dist/policy/PermissionRegistry.js +29 -0
- package/dist/policy/PermissionRegistry.js.map +1 -0
- package/dist/policy/ViewerContext.d.ts +29 -0
- package/dist/policy/ViewerContext.d.ts.map +1 -0
- package/dist/policy/ViewerContext.js +2 -0
- package/dist/policy/ViewerContext.js.map +1 -0
- package/dist/policy/checks.d.ts +15 -0
- package/dist/policy/checks.d.ts.map +1 -0
- package/dist/policy/checks.js +55 -0
- package/dist/policy/checks.js.map +1 -0
- package/dist/policy/defaultRegistry.d.ts +9 -0
- package/dist/policy/defaultRegistry.d.ts.map +1 -0
- package/dist/policy/defaultRegistry.js +15 -0
- package/dist/policy/defaultRegistry.js.map +1 -0
- package/dist/policy/index.d.ts +8 -0
- package/dist/policy/index.d.ts.map +1 -0
- package/dist/policy/index.js +5 -0
- package/dist/policy/index.js.map +1 -0
- package/dist/policy/resolveViewer.d.ts +16 -0
- package/dist/policy/resolveViewer.d.ts.map +1 -0
- package/dist/policy/resolveViewer.js +37 -0
- package/dist/policy/resolveViewer.js.map +1 -0
- package/dist/routes/_shared.d.ts +138 -0
- package/dist/routes/_shared.d.ts.map +1 -0
- package/dist/routes/_shared.js +33 -0
- package/dist/routes/_shared.js.map +1 -0
- package/dist/routes/admin.d.ts +13 -0
- package/dist/routes/admin.d.ts.map +1 -0
- package/dist/routes/admin.js +228 -0
- package/dist/routes/admin.js.map +1 -0
- package/dist/routes/auth.d.ts +35 -0
- package/dist/routes/auth.d.ts.map +1 -0
- package/dist/routes/auth.js +168 -0
- package/dist/routes/auth.js.map +1 -0
- package/dist/routes/batch.d.ts +7 -0
- package/dist/routes/batch.d.ts.map +1 -0
- package/dist/routes/batch.js +47 -0
- package/dist/routes/batch.js.map +1 -0
- 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 +2 -2
- package/dist/routes/edges.d.ts.map +1 -1
- package/dist/routes/edges.js +34 -16
- package/dist/routes/edges.js.map +1 -1
- package/dist/routes/health.d.ts +2 -2
- package/dist/routes/health.d.ts.map +1 -1
- package/dist/routes/health.js +21 -3
- package/dist/routes/health.js.map +1 -1
- package/dist/routes/history.d.ts +7 -0
- package/dist/routes/history.d.ts.map +1 -0
- package/dist/routes/history.js +90 -0
- package/dist/routes/history.js.map +1 -0
- package/dist/routes/model.d.ts +2 -2
- package/dist/routes/model.d.ts.map +1 -1
- package/dist/routes/model.js +20 -4
- package/dist/routes/model.js.map +1 -1
- package/dist/routes/nodes.d.ts +2 -2
- package/dist/routes/nodes.d.ts.map +1 -1
- package/dist/routes/nodes.js +77 -25
- 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/ontology.d.ts +2 -2
- package/dist/routes/ontology.d.ts.map +1 -1
- package/dist/routes/ontology.js +22 -5
- package/dist/routes/ontology.js.map +1 -1
- package/dist/routes/proposals.d.ts +5 -4
- package/dist/routes/proposals.d.ts.map +1 -1
- package/dist/routes/proposals.js +176 -45
- 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 +66 -12
- package/dist/routes/runs.js.map +1 -1
- package/dist/routes/skillInputOptions.d.ts +10 -0
- package/dist/routes/skillInputOptions.d.ts.map +1 -0
- package/dist/routes/skillInputOptions.js +159 -0
- package/dist/routes/skillInputOptions.js.map +1 -0
- package/dist/routes/skills.d.ts +21 -3
- package/dist/routes/skills.d.ts.map +1 -1
- package/dist/routes/skills.js +223 -21
- package/dist/routes/skills.js.map +1 -1
- package/dist/routes/sourceLoaders.d.ts +7 -0
- package/dist/routes/sourceLoaders.d.ts.map +1 -0
- package/dist/routes/sourceLoaders.js +30 -0
- package/dist/routes/sourceLoaders.js.map +1 -0
- 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 +7 -0
- package/dist/routes/users.d.ts.map +1 -0
- package/dist/routes/users.js +109 -0
- package/dist/routes/users.js.map +1 -0
- 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 +11 -0
- package/dist/routes/workspaceMembers.d.ts.map +1 -0
- package/dist/routes/workspaceMembers.js +81 -0
- package/dist/routes/workspaceMembers.js.map +1 -0
- package/dist/routes/workspaces.d.ts +30 -1
- package/dist/routes/workspaces.d.ts.map +1 -1
- package/dist/routes/workspaces.js +207 -63
- package/dist/routes/workspaces.js.map +1 -1
- package/dist/server.js +9 -29
- 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 +49 -32
- package/LICENSE +0 -21
- package/dist/composeFs.d.ts +0 -20
- package/dist/composeFs.d.ts.map +0 -1
- package/dist/composeFs.js +0 -134
- package/dist/composeFs.js.map +0 -1
- package/dist/composition.d.ts +0 -49
- package/dist/composition.d.ts.map +0 -1
- package/dist/composition.js +0 -43
- package/dist/composition.js.map +0 -1
- package/dist/infrastructure/agent/ClaudeCodeAgentBinding.d.ts +0 -8
- package/dist/infrastructure/agent/ClaudeCodeAgentBinding.d.ts.map +0 -1
- package/dist/infrastructure/agent/ClaudeCodeAgentBinding.js +0 -62
- package/dist/infrastructure/agent/ClaudeCodeAgentBinding.js.map +0 -1
- 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 -18
- package/dist/infrastructure/agent/mcpConfig.d.ts.map +0 -1
- package/dist/infrastructure/agent/mcpConfig.js +0 -47
- 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/fs/FsClarifyTicketRepository.d.ts +0 -13
- package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts.map +0 -1
- package/dist/infrastructure/fs/FsClarifyTicketRepository.js +0 -33
- 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/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 +0 -88
- 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/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/WorkspaceRegistryFile.d.ts +0 -17
- package/dist/infrastructure/fs/WorkspaceRegistryFile.d.ts.map +0 -1
- package/dist/infrastructure/fs/WorkspaceRegistryFile.js +0 -58
- 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/jsonFileStore.d.ts.map +0 -1
- package/dist/infrastructure/fs/jsonFileStore.js.map +0 -1
- package/dist/infrastructure/fs/paths.d.ts +0 -22
- package/dist/infrastructure/fs/paths.d.ts.map +0 -1
- package/dist/infrastructure/fs/paths.js +0 -46
- 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/orphanReaper.d.ts +0 -18
- package/dist/infrastructure/orphanReaper.d.ts.map +0 -1
- package/dist/infrastructure/orphanReaper.js.map +0 -1
- package/dist/routes/clarify.d.ts +0 -8
- package/dist/routes/clarify.d.ts.map +0 -1
- package/dist/routes/clarify.js +0 -84
- 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 -30
- package/dist/routes/decisions.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/{fs → hitl}/FsProposalRepository.d.ts +0 -0
- /package/dist/infrastructure/{fs → workspace}/FsWorkspaceRepository.d.ts +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { BatchPlanRepository, Workspace } from '@braidhq/core';
|
|
2
|
+
import { BatchPlan } from '@braidhq/core';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export declare const BATCH_PLAN_VERSION = 1;
|
|
5
|
+
export declare const BatchPlanFile: z.ZodObject<{
|
|
6
|
+
version: z.ZodNumber;
|
|
7
|
+
plan: z.ZodObject<{
|
|
8
|
+
id: z.core.$ZodBranded<z.ZodString, "BatchPlanId", "out">;
|
|
9
|
+
workspaceId: z.core.$ZodBranded<z.ZodString, "WorkspaceId", "out">;
|
|
10
|
+
createdAt: z.ZodString;
|
|
11
|
+
updatedAt: z.ZodString;
|
|
12
|
+
mode: z.ZodEnum<{
|
|
13
|
+
intent: "intent";
|
|
14
|
+
derive: "derive";
|
|
15
|
+
}>;
|
|
16
|
+
status: z.ZodEnum<{
|
|
17
|
+
running: "running";
|
|
18
|
+
completed: "completed";
|
|
19
|
+
failed: "failed";
|
|
20
|
+
idle: "idle";
|
|
21
|
+
deriving: "deriving";
|
|
22
|
+
stopped: "stopped";
|
|
23
|
+
archived: "archived";
|
|
24
|
+
}>;
|
|
25
|
+
autoApply: z.ZodBoolean;
|
|
26
|
+
baselineTag: z.ZodOptional<z.ZodString>;
|
|
27
|
+
units: z.ZodArray<z.ZodObject<{
|
|
28
|
+
id: z.core.$ZodBranded<z.ZodString, "BatchUnitId", "out">;
|
|
29
|
+
name: z.ZodString;
|
|
30
|
+
description: z.ZodString;
|
|
31
|
+
sourceId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "SourceId", "out">>;
|
|
32
|
+
scopeHint: z.ZodOptional<z.ZodString>;
|
|
33
|
+
status: z.ZodEnum<{
|
|
34
|
+
pending: "pending";
|
|
35
|
+
running: "running";
|
|
36
|
+
completed: "completed";
|
|
37
|
+
failed: "failed";
|
|
38
|
+
skipped: "skipped";
|
|
39
|
+
}>;
|
|
40
|
+
skillRunId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "SkillRunId", "out">>;
|
|
41
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
42
|
+
completedAt: z.ZodOptional<z.ZodString>;
|
|
43
|
+
proposalIds: z.ZodDefault<z.ZodArray<z.core.$ZodBranded<z.ZodString, "ProposalId", "out">>>;
|
|
44
|
+
clarificationIds: z.ZodDefault<z.ZodArray<z.core.$ZodBranded<z.ZodString, "ClarificationId", "out">>>;
|
|
45
|
+
error: z.ZodOptional<z.ZodString>;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
running: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
unitId: z.core.$ZodBranded<z.ZodString, "BatchUnitId", "out">;
|
|
49
|
+
skillRunId: z.core.$ZodBranded<z.ZodString, "SkillRunId", "out">;
|
|
50
|
+
}, z.core.$strip>>;
|
|
51
|
+
error: z.ZodOptional<z.ZodString>;
|
|
52
|
+
checkpointPhases: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
53
|
+
status: z.ZodEnum<{
|
|
54
|
+
running: "running";
|
|
55
|
+
completed: "completed";
|
|
56
|
+
failed: "failed";
|
|
57
|
+
}>;
|
|
58
|
+
unitIds: z.ZodArray<z.core.$ZodBranded<z.ZodString, "BatchUnitId", "out">>;
|
|
59
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
60
|
+
completedAt: z.ZodOptional<z.ZodString>;
|
|
61
|
+
skillRunId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "SkillRunId", "out">>;
|
|
62
|
+
error: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strip>>>;
|
|
64
|
+
batchPolicy: z.ZodOptional<z.ZodObject<{
|
|
65
|
+
perUnitSkillId: z.core.$ZodBranded<z.ZodString, "SkillId", "out">;
|
|
66
|
+
perUnitLabel: z.ZodOptional<z.ZodString>;
|
|
67
|
+
checkpointSkillId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "SkillId", "out">>;
|
|
68
|
+
checkpointLabel: z.ZodOptional<z.ZodString>;
|
|
69
|
+
checkpointChunkSize: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
checkpointRunAtEnd: z.ZodOptional<z.ZodBoolean>;
|
|
71
|
+
}, z.core.$strip>>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
export declare class FsBatchPlanRepository implements BatchPlanRepository {
|
|
75
|
+
load(workspace: Workspace): Promise<BatchPlan | null>;
|
|
76
|
+
save(workspace: Workspace, plan: BatchPlan): Promise<void>;
|
|
77
|
+
clear(workspace: Workspace): Promise<void>;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=FsBatchPlanRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FsBatchPlanRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/batch/FsBatchPlanRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGnE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,kBAAkB,IAAI,CAAA;AAEnC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGxB,CAAA;AAEF,qBAAa,qBAAsB,YAAW,mBAAmB;IACzD,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAmBrD,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAU1D,KAAK,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
import { BatchPlan } from '@braidhq/core';
|
|
4
|
+
import { BatchPlan as BatchPlanData } from '@braidhq/schema';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { batchPlanPath, workspaceArtifactsDir } from '../_shared/paths.js';
|
|
7
|
+
export const BATCH_PLAN_VERSION = 1;
|
|
8
|
+
export const BatchPlanFile = z.object({
|
|
9
|
+
version: z.number().int(),
|
|
10
|
+
plan: BatchPlanData,
|
|
11
|
+
});
|
|
12
|
+
export class FsBatchPlanRepository {
|
|
13
|
+
async load(workspace) {
|
|
14
|
+
let raw;
|
|
15
|
+
try {
|
|
16
|
+
raw = await readFile(batchPlanPath(workspace.rootPath), 'utf-8');
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
if (error.code === 'ENOENT')
|
|
20
|
+
return null;
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
const parsed = BatchPlanFile.parse(JSON.parse(raw));
|
|
24
|
+
if (parsed.version !== BATCH_PLAN_VERSION) {
|
|
25
|
+
throw new Error(`batch-plan.json version mismatch in ${workspace.rootPath}: expected ${BATCH_PLAN_VERSION}, got ${parsed.version}`);
|
|
26
|
+
}
|
|
27
|
+
return new BatchPlan(parsed.plan);
|
|
28
|
+
}
|
|
29
|
+
async save(workspace, plan) {
|
|
30
|
+
const path = batchPlanPath(workspace.rootPath);
|
|
31
|
+
await mkdir(workspaceArtifactsDir(workspace.rootPath), { recursive: true });
|
|
32
|
+
const payload = { version: BATCH_PLAN_VERSION, plan: plan.toData() };
|
|
33
|
+
// Atomic write so a crashed server can't leave a half-file mid-run.
|
|
34
|
+
const tmp = `${path}.tmp-${process.pid}-${Date.now()}`;
|
|
35
|
+
await writeFile(tmp, `${JSON.stringify(payload, null, 2)}\n`, 'utf-8');
|
|
36
|
+
await rename(tmp, path);
|
|
37
|
+
}
|
|
38
|
+
async clear(workspace) {
|
|
39
|
+
await rm(batchPlanPath(workspace.rootPath), { force: true });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=FsBatchPlanRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FsBatchPlanRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/batch/FsBatchPlanRepository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACzE,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,E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,CAAA;QAC3E,MAAM,OAAO,GAAG,EAAE,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAA;QACpE,oEAAoE;QACpE,MAAM,GAAG,GAAG,GAAG,IAAI,QAAQ,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,CAAA;QACtD,MAAM,SAAS,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACtE,MAAM,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IACzB,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,SAAoB;QAC9B,MAAM,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IAC9D,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ListCommitsOptions, Workspace, WorkspaceHistory } from '@braidhq/core';
|
|
2
|
+
import type { CommitMessage, CommitMeta, FileDiff, ModelSnapshot, TagMeta } from '@braidhq/schema';
|
|
3
|
+
import { CommitSha } from '@braidhq/schema';
|
|
4
|
+
export declare class GitWorkspaceHistory implements WorkspaceHistory {
|
|
5
|
+
ensureInitialised(workspace: Workspace): Promise<void>;
|
|
6
|
+
commit(workspace: Workspace, message: CommitMessage): Promise<CommitSha>;
|
|
7
|
+
listCommits(workspace: Workspace, options?: ListCommitsOptions): Promise<readonly CommitMeta[]>;
|
|
8
|
+
getCommit(workspace: Workspace, sha: CommitSha): Promise<CommitMeta | null>;
|
|
9
|
+
readGraphAtCommit(workspace: Workspace, sha: CommitSha): Promise<ModelSnapshot>;
|
|
10
|
+
getCommitDiff(workspace: Workspace, sha: CommitSha): Promise<readonly FileDiff[]>;
|
|
11
|
+
restore(workspace: Workspace, targetSha: CommitSha, message: CommitMessage): Promise<CommitSha>;
|
|
12
|
+
tag(workspace: Workspace, sha: CommitSha, name: string, note?: string): Promise<TagMeta>;
|
|
13
|
+
listTags(workspace: Workspace): Promise<readonly TagMeta[]>;
|
|
14
|
+
deleteTag(workspace: Workspace, name: string): Promise<void>;
|
|
15
|
+
private hasPendingChanges;
|
|
16
|
+
private commitWithMeta;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=GitWorkspaceHistory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitWorkspaceHistory.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/history/GitWorkspaceHistory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACpF,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,QAAQ,EACR,aAAa,EACb,OAAO,EAER,MAAM,iBAAiB,CAAA;AAIxB,OAAO,EAAE,SAAS,EAA0B,MAAM,iBAAiB,CAAA;AAsDnE,qBAAa,mBAAoB,YAAW,gBAAgB;IACpD,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBtD,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC;IAYxE,WAAW,CACf,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC;IAiB3B,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAe3E,iBAAiB,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC;IAoB/E,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,QAAQ,EAAE,CAAC;IAWjF,OAAO,CACX,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,SAAS,CAAC;IAoBf,GAAG,CACP,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,OAAO,CAAC;IAwBb,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC;IAY3D,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAKpD,iBAAiB;YAUjB,cAAc;CAiB7B"}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { writeFile } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { CommitSha, Timestamp, WorkspaceId } from '@braidhq/schema';
|
|
5
|
+
import { simpleGit } from 'simple-git';
|
|
6
|
+
import { MODEL_JSON_VERSION, ModelJsonFile } from '../model/FsModelSerializer.js';
|
|
7
|
+
import { parseCommitMessage, serializeCommitMessage } from './commitMessage.js';
|
|
8
|
+
// ASCII control chars never appear in commit subjects / refnames.
|
|
9
|
+
const LOG_FIELD_SEPARATOR = '';
|
|
10
|
+
const LOG_RECORD_SEPARATOR = '';
|
|
11
|
+
const GIT_LOG_FORMAT_ARG = `--pretty=tformat:%H${LOG_FIELD_SEPARATOR}%an${LOG_FIELD_SEPARATOR}%ae${LOG_FIELD_SEPARATOR}%aI${LOG_FIELD_SEPARATOR}%P${LOG_FIELD_SEPARATOR}%B${LOG_RECORD_SEPARATOR}`;
|
|
12
|
+
const TAG_RECORD_SEPARATOR = '';
|
|
13
|
+
const TAG_FIELD_SEPARATOR = '';
|
|
14
|
+
// `%(*objectname)` dereferences annotated tags to the underlying commit.
|
|
15
|
+
const TAG_FORMAT = [
|
|
16
|
+
'%(refname:short)',
|
|
17
|
+
'%(if)%(*objectname)%(then)%(*objectname)%(else)%(objectname)%(end)',
|
|
18
|
+
'%(taggerdate:iso-strict)',
|
|
19
|
+
'%(creatordate:iso-strict)',
|
|
20
|
+
'%(taggername)',
|
|
21
|
+
'%(taggeremail)',
|
|
22
|
+
'%(contents:subject)',
|
|
23
|
+
].join(TAG_FIELD_SEPARATOR) + TAG_RECORD_SEPARATOR;
|
|
24
|
+
// Intent docs and codebases are re-fetchable.
|
|
25
|
+
// Tracking them would nest foreign `.git/` dirs and bloat history.
|
|
26
|
+
const DEFAULT_GITIGNORE = `# Braid auto-generated.
|
|
27
|
+
|
|
28
|
+
.braid/
|
|
29
|
+
.braid-sessions/
|
|
30
|
+
.braid-mcp-*.json
|
|
31
|
+
artifacts/runs/
|
|
32
|
+
intents/
|
|
33
|
+
codebases/
|
|
34
|
+
.DS_Store
|
|
35
|
+
`;
|
|
36
|
+
// Swapped for the calling user's identity once Theme 13 lands.
|
|
37
|
+
const BOOTSTRAP_USER_ID = 'braid-bootstrap';
|
|
38
|
+
const INITIAL_COMMIT = {
|
|
39
|
+
kind: 'initial',
|
|
40
|
+
subject: 'workspace registered',
|
|
41
|
+
userId: BOOTSTRAP_USER_ID,
|
|
42
|
+
};
|
|
43
|
+
// `core.quotePath=false` keeps non-ASCII paths intact,
|
|
44
|
+
// in log and name-status output.
|
|
45
|
+
function openGit(baseDir) {
|
|
46
|
+
return simpleGit({
|
|
47
|
+
baseDir,
|
|
48
|
+
config: ['core.quotePath=false', 'i18n.logoutputencoding=utf-8'],
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export class GitWorkspaceHistory {
|
|
52
|
+
async ensureInitialised(workspace) {
|
|
53
|
+
const root = workspace.rootPath;
|
|
54
|
+
if (existsSync(join(root, '.git')))
|
|
55
|
+
return;
|
|
56
|
+
const git = openGit(root);
|
|
57
|
+
await git.init();
|
|
58
|
+
const gitignorePath = join(root, '.gitignore');
|
|
59
|
+
if (!existsSync(gitignorePath))
|
|
60
|
+
await writeFile(gitignorePath, DEFAULT_GITIGNORE, 'utf-8');
|
|
61
|
+
await git.add(['-A']);
|
|
62
|
+
// Allow empty when the workspace dir has nothing tracked yet,
|
|
63
|
+
// so HEAD exists for later commits to parent on.
|
|
64
|
+
const allowEmpty = !(await this.hasPendingChanges(git));
|
|
65
|
+
await this.commitWithMeta(git, INITIAL_COMMIT, { allowEmpty });
|
|
66
|
+
}
|
|
67
|
+
async commit(workspace, message) {
|
|
68
|
+
const git = openGit(workspace.rootPath);
|
|
69
|
+
await git.add(['-A']);
|
|
70
|
+
// Redundant commit attempts resolve to a no-op,
|
|
71
|
+
// for example a reject after the artifact was already persisted.
|
|
72
|
+
if (!(await this.hasPendingChanges(git))) {
|
|
73
|
+
const head = await git.revparse(['HEAD']);
|
|
74
|
+
return CommitSha.parse(head.trim());
|
|
75
|
+
}
|
|
76
|
+
return this.commitWithMeta(git, message, { allowEmpty: false });
|
|
77
|
+
}
|
|
78
|
+
async listCommits(workspace, options) {
|
|
79
|
+
const git = openGit(workspace.rootPath);
|
|
80
|
+
const limit = options?.limit ?? 50;
|
|
81
|
+
const args = ['log', `--max-count=${limit}`, GIT_LOG_FORMAT_ARG];
|
|
82
|
+
if (options?.since)
|
|
83
|
+
args.splice(1, 0, `${options.since}^`);
|
|
84
|
+
const raw = await git.raw(args).catch((err) => {
|
|
85
|
+
// Fresh repo with no commits, `git log` exits non-zero. Treat as empty.
|
|
86
|
+
if (looksLikeNoCommits(err))
|
|
87
|
+
return '';
|
|
88
|
+
throw err;
|
|
89
|
+
});
|
|
90
|
+
if (!raw.trim())
|
|
91
|
+
return [];
|
|
92
|
+
return splitLogRecords(raw).map(rec => parseLogRecord(rec, workspace.id));
|
|
93
|
+
}
|
|
94
|
+
async getCommit(workspace, sha) {
|
|
95
|
+
const git = openGit(workspace.rootPath);
|
|
96
|
+
try {
|
|
97
|
+
const raw = await git.raw(['show', '--no-patch', GIT_LOG_FORMAT_ARG, sha]);
|
|
98
|
+
if (!raw.trim())
|
|
99
|
+
return null;
|
|
100
|
+
return parseLogRecord(raw.trim(), workspace.id);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
if (looksLikeUnknownRevision(err))
|
|
104
|
+
return null;
|
|
105
|
+
throw err;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async readGraphAtCommit(workspace, sha) {
|
|
109
|
+
const git = openGit(workspace.rootPath);
|
|
110
|
+
// Pre-bootstrap commits don't carry `model.json`.
|
|
111
|
+
// An empty snapshot lets diffs classify everything as `added`.
|
|
112
|
+
const raw = await git.raw(['show', `${sha}:artifacts/model.json`]).catch((err) => {
|
|
113
|
+
if (looksLikePathNotInCommit(err) || looksLikeUnknownRevision(err))
|
|
114
|
+
return '';
|
|
115
|
+
throw err;
|
|
116
|
+
});
|
|
117
|
+
if (!raw.trim())
|
|
118
|
+
return { nodes: [], edges: [] };
|
|
119
|
+
const parsed = ModelJsonFile.parse(JSON.parse(raw));
|
|
120
|
+
if (parsed.version !== MODEL_JSON_VERSION) {
|
|
121
|
+
throw new Error(`model.json version mismatch at ${sha}: expected ${MODEL_JSON_VERSION}, got ${parsed.version}`);
|
|
122
|
+
}
|
|
123
|
+
return { nodes: parsed.nodes, edges: parsed.edges };
|
|
124
|
+
}
|
|
125
|
+
async getCommitDiff(workspace, sha) {
|
|
126
|
+
const git = openGit(workspace.rootPath);
|
|
127
|
+
// `--root` keeps the root commit diffable against the empty tree, instead of erroring.
|
|
128
|
+
const raw = await git.raw(['show', '--name-status', '--root', '--format=', sha]).catch((err) => {
|
|
129
|
+
if (looksLikeUnknownRevision(err))
|
|
130
|
+
return '';
|
|
131
|
+
throw err;
|
|
132
|
+
});
|
|
133
|
+
return parseNameStatus(raw);
|
|
134
|
+
}
|
|
135
|
+
async restore(workspace, targetSha, message) {
|
|
136
|
+
const git = openGit(workspace.rootPath);
|
|
137
|
+
const headRaw = await git.revparse(['HEAD']);
|
|
138
|
+
const head = CommitSha.parse(headRaw.trim());
|
|
139
|
+
if (head === targetSha)
|
|
140
|
+
return head;
|
|
141
|
+
// `checkout <sha> -- .` only restores files present in <sha>.
|
|
142
|
+
// We need an EXACT match, so newer files must also go.
|
|
143
|
+
await git.raw(['read-tree', targetSha]);
|
|
144
|
+
await git.raw(['checkout-index', '--force', '--all']);
|
|
145
|
+
await git.raw(['clean', '-fd']);
|
|
146
|
+
await git.add(['-A']);
|
|
147
|
+
return this.commitWithMeta(git, {
|
|
148
|
+
...message,
|
|
149
|
+
kind: 'restore',
|
|
150
|
+
revertedFrom: head,
|
|
151
|
+
revertedTo: targetSha,
|
|
152
|
+
}, { allowEmpty: false });
|
|
153
|
+
}
|
|
154
|
+
async tag(workspace, sha, name, note) {
|
|
155
|
+
const git = openGit(workspace.rootPath);
|
|
156
|
+
if (note) {
|
|
157
|
+
// Annotated tags need a committer identity. Pin it inline,
|
|
158
|
+
// so CI runners without global git config don't fail.
|
|
159
|
+
await git.raw([
|
|
160
|
+
'-c',
|
|
161
|
+
`user.name=${BOOTSTRAP_USER_ID}`,
|
|
162
|
+
'-c',
|
|
163
|
+
`user.email=${BOOTSTRAP_USER_ID}@braid.local`,
|
|
164
|
+
'tag',
|
|
165
|
+
'-a',
|
|
166
|
+
name,
|
|
167
|
+
sha,
|
|
168
|
+
'-m',
|
|
169
|
+
note,
|
|
170
|
+
]);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
await git.raw(['tag', name, sha]);
|
|
174
|
+
}
|
|
175
|
+
return readTagByName(git, name);
|
|
176
|
+
}
|
|
177
|
+
async listTags(workspace) {
|
|
178
|
+
const git = openGit(workspace.rootPath);
|
|
179
|
+
const raw = await git.raw(['tag', '-l', `--format=${TAG_FORMAT}`]).catch(() => '');
|
|
180
|
+
if (!raw.trim())
|
|
181
|
+
return [];
|
|
182
|
+
return raw.split(TAG_RECORD_SEPARATOR)
|
|
183
|
+
.map(s => s.trim())
|
|
184
|
+
.filter(s => s.length > 0)
|
|
185
|
+
.map(parseTagRecord)
|
|
186
|
+
.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
|
|
187
|
+
}
|
|
188
|
+
async deleteTag(workspace, name) {
|
|
189
|
+
const git = openGit(workspace.rootPath);
|
|
190
|
+
await git.raw(['tag', '-d', name]);
|
|
191
|
+
}
|
|
192
|
+
async hasPendingChanges(git) {
|
|
193
|
+
const status = await git.status();
|
|
194
|
+
return status.staged.length > 0
|
|
195
|
+
|| status.created.length > 0
|
|
196
|
+
|| status.deleted.length > 0
|
|
197
|
+
|| status.modified.length > 0
|
|
198
|
+
|| status.renamed.length > 0
|
|
199
|
+
|| status.not_added.length > 0;
|
|
200
|
+
}
|
|
201
|
+
async commitWithMeta(git, message, options) {
|
|
202
|
+
// `authorName` / `authorEmail` are snapshotted at commit time,
|
|
203
|
+
// so a later rename of the user record can't rewrite git history.
|
|
204
|
+
// When absent, we fall back to the opaque `userId` for both.
|
|
205
|
+
const name = message.authorName ?? message.userId;
|
|
206
|
+
const email = message.authorEmail ?? `${message.userId}@braid.local`;
|
|
207
|
+
const args = ['commit', '-m', serializeCommitMessage(message), `--author=${name} <${email}>`];
|
|
208
|
+
if (options.allowEmpty)
|
|
209
|
+
args.push('--allow-empty');
|
|
210
|
+
await git.raw(['-c', `user.name=${name}`, '-c', `user.email=${email}`, ...args]);
|
|
211
|
+
const head = await git.revparse(['HEAD']);
|
|
212
|
+
return CommitSha.parse(head.trim());
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function parseLogRecord(record, workspaceId) {
|
|
216
|
+
const [shaLine, authorName, authorEmail, committedAt, parents, ...bodyLines] = record.split(LOG_FIELD_SEPARATOR);
|
|
217
|
+
let body = bodyLines.join(LOG_FIELD_SEPARATOR);
|
|
218
|
+
while (body.endsWith(LOG_RECORD_SEPARATOR))
|
|
219
|
+
body = body.slice(0, -LOG_RECORD_SEPARATOR.length);
|
|
220
|
+
body = body.trim();
|
|
221
|
+
return {
|
|
222
|
+
sha: CommitSha.parse(shaLine.trim()),
|
|
223
|
+
workspaceId: WorkspaceId.parse(workspaceId),
|
|
224
|
+
message: parseCommitMessage(body),
|
|
225
|
+
author: { name: authorName.trim(), email: authorEmail.trim() },
|
|
226
|
+
committedAt: Timestamp.parse(committedAt.trim()),
|
|
227
|
+
parents: parents.trim()
|
|
228
|
+
? parents.trim().split(' ').map(s => CommitSha.parse(s.trim()))
|
|
229
|
+
: [],
|
|
230
|
+
// Stats are derived lazily via `getCommitDiff`,
|
|
231
|
+
// to avoid N extra diff calls per list page.
|
|
232
|
+
stats: null,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
async function readTagByName(git, name) {
|
|
236
|
+
const raw = await git.raw(['tag', '-l', `--format=${TAG_FORMAT}`, name]);
|
|
237
|
+
const record = raw.split(TAG_RECORD_SEPARATOR).map(s => s.trim()).find(s => s.length > 0);
|
|
238
|
+
if (!record)
|
|
239
|
+
throw new Error(`Tag "${name}" not found immediately after creation`);
|
|
240
|
+
return parseTagRecord(record);
|
|
241
|
+
}
|
|
242
|
+
function parseTagRecord(record) {
|
|
243
|
+
const parts = record.split(TAG_FIELD_SEPARATOR);
|
|
244
|
+
const [name, sha, taggerDate, creatorDate, taggerName, taggerEmail, note] = parts;
|
|
245
|
+
const createdRaw = (taggerDate ?? '').trim() || (creatorDate ?? '').trim();
|
|
246
|
+
return {
|
|
247
|
+
name: (name ?? '').trim(),
|
|
248
|
+
sha: CommitSha.parse((sha ?? '').trim()),
|
|
249
|
+
createdAt: Timestamp.parse(createdRaw),
|
|
250
|
+
...(note && note.trim() ? { note: note.trim() } : {}),
|
|
251
|
+
...((taggerName?.trim() && taggerEmail?.trim())
|
|
252
|
+
? {
|
|
253
|
+
taggedBy: {
|
|
254
|
+
name: taggerName.trim(),
|
|
255
|
+
email: taggerEmail.trim().replace(/^<|>$/g, ''),
|
|
256
|
+
},
|
|
257
|
+
}
|
|
258
|
+
: {}),
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
function parseNameStatus(raw) {
|
|
262
|
+
const out = [];
|
|
263
|
+
for (const line of raw.split('\n')) {
|
|
264
|
+
if (!line.trim())
|
|
265
|
+
continue;
|
|
266
|
+
const cols = line.split('\t');
|
|
267
|
+
const code = cols[0]?.trim() ?? '';
|
|
268
|
+
if (code.startsWith('R') && cols.length >= 3) {
|
|
269
|
+
out.push({ path: cols[2].trim(), status: 'renamed', previousPath: cols[1].trim() });
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
const path = cols[1]?.trim();
|
|
273
|
+
if (!path)
|
|
274
|
+
continue;
|
|
275
|
+
out.push({ path, status: statusFromCode(code[0]) });
|
|
276
|
+
}
|
|
277
|
+
return out;
|
|
278
|
+
}
|
|
279
|
+
function splitLogRecords(raw) {
|
|
280
|
+
return raw.split(LOG_RECORD_SEPARATOR).map(s => s.trim()).filter(s => s.length > 0);
|
|
281
|
+
}
|
|
282
|
+
// Unknown letters fall back to `updated` so the row still surfaces.
|
|
283
|
+
function statusFromCode(code) {
|
|
284
|
+
switch (code) {
|
|
285
|
+
case 'A':
|
|
286
|
+
case 'C':
|
|
287
|
+
return 'added';
|
|
288
|
+
case 'D':
|
|
289
|
+
return 'removed';
|
|
290
|
+
case 'M':
|
|
291
|
+
return 'updated';
|
|
292
|
+
default:
|
|
293
|
+
return 'updated';
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
function looksLikeNoCommits(err) {
|
|
297
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
298
|
+
return /does not have any commits yet|bad default revision/i.test(msg);
|
|
299
|
+
}
|
|
300
|
+
function looksLikeUnknownRevision(err) {
|
|
301
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
302
|
+
return /unknown revision|bad revision|ambiguous argument/i.test(msg);
|
|
303
|
+
}
|
|
304
|
+
// `git show <sha>:<path>` for an untracked path reports a specific message,
|
|
305
|
+
// either "exists on disk, but not in" or "does not exist in".
|
|
306
|
+
function looksLikePathNotInCommit(err) {
|
|
307
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
308
|
+
return /exists on disk, but not in|does not exist in|path .* does not exist/i.test(msg);
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=GitWorkspaceHistory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitWorkspaceHistory.js","sourceRoot":"","sources":["../../../src/infrastructure/history/GitWorkspaceHistory.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AACjF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAE/E,kEAAkE;AAClE,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAC/B,MAAM,oBAAoB,GAAG,GAAG,CAAA;AAChC,MAAM,kBAAkB,GAAG,sBAAsB,mBAAmB,MAAM,mBAAmB,MAAM,mBAAmB,MAAM,mBAAmB,KAAK,mBAAmB,KAAK,oBAAoB,EAAE,CAAA;AAElM,MAAM,oBAAoB,GAAG,GAAG,CAAA;AAChC,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAC/B,yEAAyE;AACzE,MAAM,UAAU,GAAG;IACjB,kBAAkB;IAClB,oEAAoE;IACpE,0BAA0B;IAC1B,2BAA2B;IAC3B,eAAe;IACf,gBAAgB;IAChB,qBAAqB;CACtB,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,oBAAoB,CAAA;AAElD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B;YACE,OAAO,SAAS,CAAA;IACpB,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,GAAY;IACtC,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC5D,OAAO,qDAAqD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACxE,CAAC;AAED,SAAS,wBAAwB,CAAC,GAAY;IAC5C,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC5D,OAAO,mDAAmD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACtE,CAAC;AAED,4EAA4E;AAC5E,8DAA8D;AAC9D,SAAS,wBAAwB,CAAC,GAAY;IAC5C,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC5D,OAAO,sEAAsE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACzF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commitMessage.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/history/commitMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAcpD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAwBrE;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAgC7D"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { ClarificationId, CommitKind, CommitSha, ProposalId, SourceId, UserId, } from '@braidhq/schema';
|
|
2
|
+
// Trailer keys recognised by `git interpret-trailers`,
|
|
3
|
+
// so future tooling can lean on the same parser.
|
|
4
|
+
const TRAILER_KEY_PATTERN = /^[a-z][a-z-]*$/i;
|
|
5
|
+
export function serializeCommitMessage(message) {
|
|
6
|
+
const trailers = [
|
|
7
|
+
`Kind: ${message.kind}`,
|
|
8
|
+
`Author: ${message.userId}`,
|
|
9
|
+
];
|
|
10
|
+
if (message.proposalId)
|
|
11
|
+
trailers.push(`Proposal-Id: ${message.proposalId}`);
|
|
12
|
+
if (message.clarificationId)
|
|
13
|
+
trailers.push(`Clarification-Id: ${message.clarificationId}`);
|
|
14
|
+
if (message.sourceId)
|
|
15
|
+
trailers.push(`Source-Id: ${message.sourceId}`);
|
|
16
|
+
if (message.revertedFrom)
|
|
17
|
+
trailers.push(`Reverted-From: ${message.revertedFrom}`);
|
|
18
|
+
if (message.revertedTo)
|
|
19
|
+
trailers.push(`Reverted-To: ${message.revertedTo}`);
|
|
20
|
+
// Subjects can span lines, reject/skip reasons and answer notes are free text.
|
|
21
|
+
// First line stays the git subject, the rest becomes the commit body,
|
|
22
|
+
// so `parseCommitMessage` can rebuild the whole subject with nothing dropped.
|
|
23
|
+
const [firstLine = '', ...bodyLines] = message.subject.split('\n');
|
|
24
|
+
const body = bodyLines.join('\n').trim();
|
|
25
|
+
const header = body
|
|
26
|
+
? `${message.kind}: ${firstLine}\n\n${body}`
|
|
27
|
+
: `${message.kind}: ${firstLine}`;
|
|
28
|
+
return `${header}\n\n${trailers.join('\n')}\n`;
|
|
29
|
+
}
|
|
30
|
+
export function parseCommitMessage(raw) {
|
|
31
|
+
const lines = raw.split('\n');
|
|
32
|
+
const subjectLine = lines[0] ?? '';
|
|
33
|
+
const colonIdx = subjectLine.indexOf(':');
|
|
34
|
+
const firstLine = colonIdx >= 0 ? subjectLine.slice(colonIdx + 1).trim() : subjectLine.trim();
|
|
35
|
+
// Split off the free-text body the serializer stored below the subject,
|
|
36
|
+
// so a multi-line reason or note survives the round-trip intact.
|
|
37
|
+
const { body, trailers } = splitBodyAndTrailers(lines);
|
|
38
|
+
const subject = body ? `${firstLine}\n${body}` : firstLine;
|
|
39
|
+
const kindRaw = trailers.Kind ?? subjectLine.slice(0, colonIdx).trim();
|
|
40
|
+
// Fall back to `snapshot` on unknown kinds,
|
|
41
|
+
// so a manual `git commit` from the CLI still renders in the timeline.
|
|
42
|
+
const kind = CommitKind.safeParse(kindRaw).data ?? 'snapshot';
|
|
43
|
+
const userId = UserId.parse(trailers.Author ?? 'unknown');
|
|
44
|
+
const out = {
|
|
45
|
+
kind,
|
|
46
|
+
subject: subject || `(unsubject ${kind})`,
|
|
47
|
+
userId,
|
|
48
|
+
};
|
|
49
|
+
if (trailers['Proposal-Id'])
|
|
50
|
+
Object.assign(out, { proposalId: ProposalId.parse(trailers['Proposal-Id']) });
|
|
51
|
+
if (trailers['Clarification-Id'])
|
|
52
|
+
Object.assign(out, { clarificationId: ClarificationId.parse(trailers['Clarification-Id']) });
|
|
53
|
+
if (trailers['Source-Id'])
|
|
54
|
+
Object.assign(out, { sourceId: SourceId.parse(trailers['Source-Id']) });
|
|
55
|
+
if (trailers['Reverted-From'])
|
|
56
|
+
Object.assign(out, { revertedFrom: CommitSha.parse(trailers['Reverted-From']) });
|
|
57
|
+
if (trailers['Reverted-To'])
|
|
58
|
+
Object.assign(out, { revertedTo: CommitSha.parse(trailers['Reverted-To']) });
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
// indexOf-based scan instead of a single regex,
|
|
62
|
+
// to avoid polynomial backtracking against adversarial commit bodies.
|
|
63
|
+
function splitBodyAndTrailers(lines) {
|
|
64
|
+
const trailers = {};
|
|
65
|
+
let bodyEnd = 1;
|
|
66
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
67
|
+
const line = lines[i];
|
|
68
|
+
if (line.trim().length === 0) {
|
|
69
|
+
// Blank line fencing the trailer block, the body ends here.
|
|
70
|
+
if (Object.keys(trailers).length > 0) {
|
|
71
|
+
bodyEnd = i;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const colon = line.indexOf(':');
|
|
77
|
+
if (colon < 1) {
|
|
78
|
+
bodyEnd = i + 1;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
const key = line.slice(0, colon);
|
|
82
|
+
if (!TRAILER_KEY_PATTERN.test(key)) {
|
|
83
|
+
bodyEnd = i + 1;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
trailers[key] = line.slice(colon + 1).trim();
|
|
87
|
+
}
|
|
88
|
+
return { body: lines.slice(1, bodyEnd).join('\n').trim(), trailers };
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=commitMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commitMessage.js","sourceRoot":"","sources":["../../../src/infrastructure/history/commitMessage.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,UAAU,EACV,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,GACP,MAAM,iBAAiB,CAAA;AAExB,uDAAuD;AACvD,iDAAiD;AACjD,MAAM,mBAAmB,GAAG,iBAAiB,CAAA;AAE7C,MAAM,UAAU,sBAAsB,CAAC,OAAsB;IAC3D,MAAM,QAAQ,GAAa;QACzB,SAAS,OAAO,CAAC,IAAI,EAAE;QACvB,WAAW,OAAO,CAAC,MAAM,EAAE;KAC5B,CAAA;IACD,IAAI,OAAO,CAAC,UAAU;QACpB,QAAQ,CAAC,IAAI,CAAC,gBAAgB,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IACrD,IAAI,OAAO,CAAC,eAAe;QACzB,QAAQ,CAAC,IAAI,CAAC,qBAAqB,OAAO,CAAC,eAAe,EAAE,CAAC,CAAA;IAC/D,IAAI,OAAO,CAAC,QAAQ;QAClB,QAAQ,CAAC,IAAI,CAAC,cAAc,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;IACjD,IAAI,OAAO,CAAC,YAAY;QACtB,QAAQ,CAAC,IAAI,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A;IAC9C,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAA;AACtE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AbsolutePath, ClarificationFilter, ClarificationId, WorkspaceId } from '@braidhq/schema';
|
|
2
|
+
import { Clarification, type ClarificationRepository } from '@braidhq/core';
|
|
3
|
+
export interface FsClarificationRepositoryOptions {
|
|
4
|
+
readonly workspaceRoots: () => Promise<ReadonlyMap<WorkspaceId, AbsolutePath>>;
|
|
5
|
+
}
|
|
6
|
+
export declare class FsClarificationRepository implements ClarificationRepository {
|
|
7
|
+
private readonly base;
|
|
8
|
+
constructor(options: FsClarificationRepositoryOptions);
|
|
9
|
+
list(filter?: ClarificationFilter): Promise<Clarification[]>;
|
|
10
|
+
load(clarificationId: ClarificationId): Promise<Clarification>;
|
|
11
|
+
save(ticket: Clarification): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=FsClarificationRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FsClarificationRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/hitl/FsClarificationRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,WAAW,EACZ,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,aAAa,EAAE,KAAK,uBAAuB,EAAY,MAAM,eAAe,CAAA;AAKrF,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,cAAc,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAA;CAC/E;AAED,qBAAa,yBAA0B,YAAW,uBAAuB;IACvE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAoF;gBAE7F,OAAO,EAAE,gCAAgC;IAgB/C,IAAI,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAgBlE,IAAI,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;IAI9D,IAAI,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3C"}
|