@braidhq/server 0.0.1 → 0.1.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 +136 -0
- package/dist/app.d.ts +19 -2
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +121 -3
- package/dist/app.js.map +1 -1
- package/dist/composeFs.d.ts +41 -6
- package/dist/composeFs.d.ts.map +1 -1
- package/dist/composeFs.js +234 -52
- package/dist/composeFs.js.map +1 -1
- package/dist/composition.d.ts +86 -2
- package/dist/composition.d.ts.map +1 -1
- package/dist/composition.js +71 -1
- package/dist/composition.js.map +1 -1
- package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts +21 -0
- package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts.map +1 -1
- package/dist/infrastructure/agent/SubprocessSkillRunner.js +35 -3
- package/dist/infrastructure/agent/SubprocessSkillRunner.js.map +1 -1
- package/dist/infrastructure/agent/mcpConfig.d.ts +25 -5
- package/dist/infrastructure/agent/mcpConfig.d.ts.map +1 -1
- package/dist/infrastructure/agent/mcpConfig.js +22 -14
- package/dist/infrastructure/agent/mcpConfig.js.map +1 -1
- package/dist/infrastructure/auth/AccessPolicy.d.ts +112 -0
- package/dist/infrastructure/auth/AccessPolicy.d.ts.map +1 -0
- package/dist/infrastructure/auth/AccessPolicy.js +184 -0
- package/dist/infrastructure/auth/AccessPolicy.js.map +1 -0
- package/dist/infrastructure/auth/SessionStore.d.ts +40 -0
- package/dist/infrastructure/auth/SessionStore.d.ts.map +1 -0
- package/dist/infrastructure/auth/SessionStore.js +107 -0
- package/dist/infrastructure/auth/SessionStore.js.map +1 -0
- package/dist/infrastructure/auth/ensureApprovedEmails.d.ts +16 -0
- package/dist/infrastructure/auth/ensureApprovedEmails.d.ts.map +1 -0
- package/dist/infrastructure/auth/ensureApprovedEmails.js +20 -0
- package/dist/infrastructure/auth/ensureApprovedEmails.js.map +1 -0
- package/dist/infrastructure/env.d.ts +11 -0
- package/dist/infrastructure/env.d.ts.map +1 -0
- package/dist/infrastructure/env.js +20 -0
- package/dist/infrastructure/env.js.map +1 -0
- package/dist/infrastructure/fs/FsBatchPlanRepository.d.ts +300 -0
- package/dist/infrastructure/fs/FsBatchPlanRepository.d.ts.map +1 -0
- package/dist/infrastructure/fs/FsBatchPlanRepository.js +42 -0
- package/dist/infrastructure/fs/FsBatchPlanRepository.js.map +1 -0
- package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts.map +1 -1
- package/dist/infrastructure/fs/FsClarifyTicketRepository.js +7 -1
- package/dist/infrastructure/fs/FsClarifyTicketRepository.js.map +1 -1
- package/dist/infrastructure/fs/FsGraphSerializer.d.ts +629 -0
- package/dist/infrastructure/fs/FsGraphSerializer.d.ts.map +1 -0
- package/dist/infrastructure/fs/FsGraphSerializer.js +60 -0
- package/dist/infrastructure/fs/FsGraphSerializer.js.map +1 -0
- package/dist/infrastructure/fs/FsProposalRepository.d.ts.map +1 -1
- package/dist/infrastructure/fs/FsProposalRepository.js +8 -0
- package/dist/infrastructure/fs/FsProposalRepository.js.map +1 -1
- package/dist/infrastructure/fs/FsRunRepository.d.ts +4 -1
- package/dist/infrastructure/fs/FsRunRepository.d.ts.map +1 -1
- package/dist/infrastructure/fs/FsRunRepository.js +75 -3
- package/dist/infrastructure/fs/FsRunRepository.js.map +1 -1
- package/dist/infrastructure/fs/FsSkillRegistry.d.ts.map +1 -1
- package/dist/infrastructure/fs/FsSkillRegistry.js +15 -3
- package/dist/infrastructure/fs/FsSkillRegistry.js.map +1 -1
- package/dist/infrastructure/fs/FsSourceUnitDigest.d.ts +19 -0
- package/dist/infrastructure/fs/FsSourceUnitDigest.d.ts.map +1 -0
- package/dist/infrastructure/fs/FsSourceUnitDigest.js +58 -0
- package/dist/infrastructure/fs/FsSourceUnitDigest.js.map +1 -0
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.d.ts +30 -0
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.d.ts.map +1 -0
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.js +87 -0
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.js.map +1 -0
- package/dist/infrastructure/fs/FsWorkspaceRepository.d.ts.map +1 -1
- package/dist/infrastructure/fs/FsWorkspaceRepository.js +12 -3
- package/dist/infrastructure/fs/FsWorkspaceRepository.js.map +1 -1
- package/dist/infrastructure/fs/WorkspaceDiscovery.d.ts +15 -0
- package/dist/infrastructure/fs/WorkspaceDiscovery.d.ts.map +1 -0
- package/dist/infrastructure/fs/WorkspaceDiscovery.js +46 -0
- package/dist/infrastructure/fs/WorkspaceDiscovery.js.map +1 -0
- package/dist/infrastructure/fs/WorkspaceRegistryFile.d.ts +26 -2
- package/dist/infrastructure/fs/WorkspaceRegistryFile.d.ts.map +1 -1
- package/dist/infrastructure/fs/WorkspaceRegistryFile.js +109 -5
- package/dist/infrastructure/fs/WorkspaceRegistryFile.js.map +1 -1
- package/dist/infrastructure/fs/intentScan.d.ts +9 -0
- package/dist/infrastructure/fs/intentScan.d.ts.map +1 -0
- package/dist/infrastructure/fs/intentScan.js +135 -0
- package/dist/infrastructure/fs/intentScan.js.map +1 -0
- package/dist/infrastructure/fs/paths.d.ts +14 -0
- package/dist/infrastructure/fs/paths.d.ts.map +1 -1
- package/dist/infrastructure/fs/paths.js +43 -0
- package/dist/infrastructure/fs/paths.js.map +1 -1
- package/dist/infrastructure/fs/productManifestWriter.d.ts +1 -1
- package/dist/infrastructure/fs/productManifestWriter.d.ts.map +1 -1
- package/dist/infrastructure/fs/productManifestWriter.js +1 -3
- package/dist/infrastructure/fs/productManifestWriter.js.map +1 -1
- package/dist/infrastructure/git/GitWorkspaceHistory.d.ts +18 -0
- package/dist/infrastructure/git/GitWorkspaceHistory.d.ts.map +1 -0
- package/dist/infrastructure/git/GitWorkspaceHistory.js +303 -0
- package/dist/infrastructure/git/GitWorkspaceHistory.js.map +1 -0
- package/dist/infrastructure/git/commitMessage.d.ts +4 -0
- package/dist/infrastructure/git/commitMessage.d.ts.map +1 -0
- package/dist/infrastructure/git/commitMessage.js +71 -0
- package/dist/infrastructure/git/commitMessage.js.map +1 -0
- package/dist/infrastructure/oauth/GoogleOAuth.d.ts +48 -1
- package/dist/infrastructure/oauth/GoogleOAuth.d.ts.map +1 -1
- package/dist/infrastructure/oauth/GoogleOAuth.js +68 -0
- package/dist/infrastructure/oauth/GoogleOAuth.js.map +1 -1
- 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 +23 -0
- package/dist/infrastructure/users/UserRegistryFile.d.ts.map +1 -0
- package/dist/infrastructure/users/UserRegistryFile.js +91 -0
- package/dist/infrastructure/users/UserRegistryFile.js.map +1 -0
- package/dist/infrastructure/users/ensureLocalUser.d.ts +15 -0
- package/dist/infrastructure/users/ensureLocalUser.d.ts.map +1 -0
- package/dist/infrastructure/users/ensureLocalUser.js +38 -0
- package/dist/infrastructure/users/ensureLocalUser.js.map +1 -0
- package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts +9 -0
- package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts.map +1 -0
- package/dist/infrastructure/users/ensureWorkspaceOwners.js +22 -0
- package/dist/infrastructure/users/ensureWorkspaceOwners.js.map +1 -0
- package/dist/middleware/auth.d.ts +29 -0
- package/dist/middleware/auth.d.ts.map +1 -0
- package/dist/middleware/auth.js +81 -0
- package/dist/middleware/auth.js.map +1 -0
- package/dist/middleware/cors.js +1 -1
- package/dist/middleware/cors.js.map +1 -1
- package/dist/middleware/requireAdmin.d.ts +10 -0
- package/dist/middleware/requireAdmin.d.ts.map +1 -0
- package/dist/middleware/requireAdmin.js +24 -0
- package/dist/middleware/requireAdmin.js.map +1 -0
- package/dist/middleware/userId.d.ts +16 -0
- package/dist/middleware/userId.d.ts.map +1 -0
- package/dist/middleware/userId.js +27 -0
- package/dist/middleware/userId.js.map +1 -0
- package/dist/middleware/workspaceAccess.d.ts +47 -0
- package/dist/middleware/workspaceAccess.d.ts.map +1 -0
- package/dist/middleware/workspaceAccess.js +86 -0
- package/dist/middleware/workspaceAccess.js.map +1 -0
- package/dist/policy/Capability.d.ts +12 -0
- package/dist/policy/Capability.d.ts.map +1 -0
- package/dist/policy/Capability.js +31 -0
- package/dist/policy/Capability.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 +23 -0
- package/dist/policy/PermissionRegistry.d.ts.map +1 -0
- package/dist/policy/PermissionRegistry.js +27 -0
- package/dist/policy/PermissionRegistry.js.map +1 -0
- package/dist/policy/ViewerContext.d.ts +27 -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 +52 -0
- package/dist/policy/checks.js.map +1 -0
- package/dist/policy/defaultRegistry.d.ts +10 -0
- package/dist/policy/defaultRegistry.d.ts.map +1 -0
- package/dist/policy/defaultRegistry.js +16 -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 +198 -0
- package/dist/routes/_shared.d.ts.map +1 -0
- package/dist/routes/_shared.js +29 -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 +227 -0
- package/dist/routes/admin.js.map +1 -0
- package/dist/routes/auth.d.ts +33 -0
- package/dist/routes/auth.d.ts.map +1 -0
- package/dist/routes/auth.js +170 -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/clarify.d.ts +4 -3
- package/dist/routes/clarify.d.ts.map +1 -1
- package/dist/routes/clarify.js +247 -57
- package/dist/routes/clarify.js.map +1 -1
- package/dist/routes/decisions.d.ts +2 -2
- package/dist/routes/decisions.d.ts.map +1 -1
- package/dist/routes/decisions.js +50 -12
- package/dist/routes/decisions.js.map +1 -1
- package/dist/routes/edges.d.ts +2 -2
- package/dist/routes/edges.d.ts.map +1 -1
- package/dist/routes/edges.js +35 -13
- 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 +88 -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 +75 -19
- package/dist/routes/nodes.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 +4 -3
- package/dist/routes/proposals.d.ts.map +1 -1
- package/dist/routes/proposals.js +170 -41
- package/dist/routes/proposals.js.map +1 -1
- package/dist/routes/runs.d.ts.map +1 -1
- package/dist/routes/runs.js +52 -1
- 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 +161 -0
- package/dist/routes/skillInputOptions.js.map +1 -0
- package/dist/routes/skills.d.ts +2 -2
- package/dist/routes/skills.d.ts.map +1 -1
- package/dist/routes/skills.js +89 -19
- 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 +29 -0
- package/dist/routes/sourceLoaders.js.map +1 -0
- package/dist/routes/sourceUnitStates.d.ts +7 -0
- package/dist/routes/sourceUnitStates.d.ts.map +1 -0
- package/dist/routes/sourceUnitStates.js +45 -0
- package/dist/routes/sourceUnitStates.js.map +1 -0
- package/dist/routes/users.d.ts +9 -0
- package/dist/routes/users.d.ts.map +1 -0
- package/dist/routes/users.js +127 -0
- package/dist/routes/users.js.map +1 -0
- 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 +19 -1
- package/dist/routes/workspaces.d.ts.map +1 -1
- package/dist/routes/workspaces.js +161 -45
- package/dist/routes/workspaces.js.map +1 -1
- package/dist/server.js +69 -25
- package/dist/server.js.map +1 -1
- package/package.json +48 -31
- package/LICENSE +0 -21
- 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/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# @braidhq/server
|
|
2
|
+
|
|
3
|
+
REST + SSE server for Braid. Hono-based, with an OpenAPI 3 spec
|
|
4
|
+
exposed at `GET /openapi.json` for any consumer that wants typed
|
|
5
|
+
access to the graph operations.
|
|
6
|
+
|
|
7
|
+
## openapi-mcp-gateway Integration
|
|
8
|
+
|
|
9
|
+
Skills shipped with `@braidhq/core` and `@braidhq/ontology-ddd` invoke
|
|
10
|
+
the server through MCP tools, not curl. The wiring runs the gateway
|
|
11
|
+
as a **per-skill stdio child of claude** — no long-running HTTP
|
|
12
|
+
server, gateway lifecycle tracks the skill run automatically.
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
┌──────────────────┐ /openapi.json ┌─────────────────────┐
|
|
16
|
+
│ @braidhq/server │ ◀───── HTTP ────── │ openapi-mcp-gateway │
|
|
17
|
+
│ (this package) │ ────── REST ────▶ │ (uvx, stdio child) │
|
|
18
|
+
└──────────────────┘ └─────────────────────┘
|
|
19
|
+
▲ stdin/stdout
|
|
20
|
+
│ MCP
|
|
21
|
+
┌─────────────────────┐
|
|
22
|
+
│ spawned claude │
|
|
23
|
+
│ subprocess (skill) │
|
|
24
|
+
└─────────────────────┘
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 1. Install `uv` (one-time setup)
|
|
28
|
+
|
|
29
|
+
`openapi-mcp-gateway` is a Python package distributed via PyPI. The
|
|
30
|
+
gateway is launched on demand by claude via `uvx` (UV's "run an
|
|
31
|
+
ephemeral package" command), so the only thing you have to install
|
|
32
|
+
locally is the `uv` runtime itself:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# macOS
|
|
36
|
+
brew install uv
|
|
37
|
+
# linux / windows: see https://docs.astral.sh/uv/getting-started/installation/
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The Braid server **preflight-checks for `uv` at boot**. If it's not
|
|
41
|
+
found, you'll see:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
[braid] `uv` not found on PATH; the built-in braid-core MCP gateway
|
|
45
|
+
will not be available. Install via `brew install uv` or
|
|
46
|
+
https://docs.astral.sh/uv/ to enable.
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Skills with `requiredMcpServers: ['braid-core']` will then surface
|
|
50
|
+
as not-ready in Studio's sidebar. Other skills keep working.
|
|
51
|
+
|
|
52
|
+
### 2. That's it
|
|
53
|
+
|
|
54
|
+
No environment variables to set, no separate gateway process to run.
|
|
55
|
+
When Braid spawns a skill, the skill's mcp-config gets a stdio entry:
|
|
56
|
+
|
|
57
|
+
```jsonc
|
|
58
|
+
{
|
|
59
|
+
"braid-core": {
|
|
60
|
+
"type": "stdio",
|
|
61
|
+
"command": "uvx",
|
|
62
|
+
"args": [
|
|
63
|
+
"openapi-mcp-gateway",
|
|
64
|
+
"--spec",
|
|
65
|
+
"http://127.0.0.1:4321/openapi.json",
|
|
66
|
+
"--transport",
|
|
67
|
+
"stdio",
|
|
68
|
+
"--name",
|
|
69
|
+
"braid-core"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
claude spawns the gateway, the gateway pulls the spec from the
|
|
76
|
+
running Braid server, and the REST surface becomes MCP tools for the
|
|
77
|
+
duration of the skill run.
|
|
78
|
+
|
|
79
|
+
First-time runs take an extra ~1–2 seconds (uvx caches
|
|
80
|
+
`openapi-mcp-gateway` under `~/.cache/uv/`). Subsequent runs hit the
|
|
81
|
+
cache.
|
|
82
|
+
|
|
83
|
+
### 3. Author skills against the MCP tools
|
|
84
|
+
|
|
85
|
+
Skill prompts call MCP tools by their `operationId`:
|
|
86
|
+
|
|
87
|
+
- `braid_search_nodes(workspaceId, q, type?, status?, limit?, offset?)`
|
|
88
|
+
- `braid_get_scope(workspaceId, nodeId, depth)`
|
|
89
|
+
- `braid_get_ontology(workspaceId)`
|
|
90
|
+
- `braid_submit_proposal(workspaceId, operations, generatedBy, rationale)`
|
|
91
|
+
- `braid_submit_clarify(workspaceId, question, candidates)`
|
|
92
|
+
- `braid_mark_clarify_applied(workspaceId, clarifyTicketId, status, userId, proposalId?)`
|
|
93
|
+
- …and the rest, one per operation in `/openapi.json`.
|
|
94
|
+
|
|
95
|
+
Exact tool names depend on `openapi-mcp-gateway`'s naming convention
|
|
96
|
+
(typically `<server-name>_<operationId>` with snake_case
|
|
97
|
+
normalisation). Inspect the spec or the gateway's `tools/list`
|
|
98
|
+
response to see live names.
|
|
99
|
+
|
|
100
|
+
### Pinning the uv binary
|
|
101
|
+
|
|
102
|
+
For reproducibility (e.g. CI environments with multiple Python
|
|
103
|
+
toolchains) you can pin a specific `uvx` binary via the
|
|
104
|
+
`BRAID_UVX_BIN` env var. composeFs preflight-checks the pinned
|
|
105
|
+
binary; if it's not executable, the gateway entry is skipped same as
|
|
106
|
+
when `uv` is missing entirely.
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
export BRAID_UVX_BIN=/opt/homebrew/bin/uvx
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Forward compatibility (hosted Braid)
|
|
113
|
+
|
|
114
|
+
When Braid grows a hosted product where the server runs remotely:
|
|
115
|
+
|
|
116
|
+
- If claude runs locally (desktop spawns it): the stdio path above
|
|
117
|
+
still works. The local gateway just talks HTTPS to the remote
|
|
118
|
+
`/openapi.json` and REST endpoints, with auth headers passed
|
|
119
|
+
through workspace-level MCP server config.
|
|
120
|
+
- If claude runs in the cloud (browser Studio): the stdio path runs
|
|
121
|
+
server-side, gateway loopbacks to the local server.
|
|
122
|
+
|
|
123
|
+
The `streamable-http` MCP transport stays first-class in the schema
|
|
124
|
+
so workspaces can declare any third-party HTTP MCP server (Redmine /
|
|
125
|
+
Notion / Linear / …) alongside the stdio braid-core. The two
|
|
126
|
+
transports are not mutually exclusive.
|
|
127
|
+
|
|
128
|
+
## Routes That Are Not in the Spec
|
|
129
|
+
|
|
130
|
+
- SSE streams (`/workspaces/{ws}/runs/{runId}/events`,
|
|
131
|
+
`/workspaces/{ws}/events`) — not invocable as one-shot MCP tools.
|
|
132
|
+
- OAuth callbacks (`/oauth/google/callback`) — HTML response.
|
|
133
|
+
- Workspace management (`/workspaces/*`) — admin surface for CLI
|
|
134
|
+
and Studio, not for skills.
|
|
135
|
+
|
|
136
|
+
The `GET /openapi.json` test in `test/app.test.ts` pins this list.
|
package/dist/app.d.ts
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import type { AppDependencies } from './composition.js';
|
|
2
|
-
import {
|
|
2
|
+
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
3
3
|
export interface AppOptions {
|
|
4
4
|
readonly corsOrigins?: readonly string[];
|
|
5
|
+
/**
|
|
6
|
+
* Base URL the OpenAPI spec advertises in its `servers[]` block. This
|
|
7
|
+
* is what downstream consumers (openapi-mcp-gateway, Swagger UI, code
|
|
8
|
+
* generators, …) use to dispatch REST calls. When unset, the spec is
|
|
9
|
+
* emitted without `servers[]`, which leaves the consumer to guess.
|
|
10
|
+
* composeFsApp threads its `apiUrl` through here so the gateway can
|
|
11
|
+
* route REST calls back to this server without an explicit
|
|
12
|
+
* `--base-url` flag.
|
|
13
|
+
*/
|
|
14
|
+
readonly apiUrl?: string;
|
|
15
|
+
/**
|
|
16
|
+
* When true (or `BRAID_LOCAL_TRUST=true`), the auth middleware lets
|
|
17
|
+
* every request through and the embedded `userIdMiddleware` falls
|
|
18
|
+
* back to `local-user`. Set by `composeFs` for the Tauri sidecar;
|
|
19
|
+
* production remote servers leave it `false`.
|
|
20
|
+
*/
|
|
21
|
+
readonly localTrust?: boolean;
|
|
5
22
|
}
|
|
6
|
-
export declare function createApp(deps: AppDependencies, options?: AppOptions):
|
|
23
|
+
export declare function createApp(deps: AppDependencies, options?: AppOptions): OpenAPIHono;
|
|
7
24
|
//# sourceMappingURL=app.d.ts.map
|
package/dist/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AA8B/C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxC;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAC9B;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,GAAE,UAAe,GAAG,WAAW,CAwKtF"}
|
package/dist/app.js
CHANGED
|
@@ -1,34 +1,108 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
+
import { authMiddleware } from './middleware/auth.js';
|
|
2
3
|
import { corsMiddleware } from './middleware/cors.js';
|
|
3
4
|
import { errorHandler } from './middleware/error.js';
|
|
5
|
+
import { userIdMiddleware } from './middleware/userId.js';
|
|
6
|
+
import { workspaceAccessMiddleware } from './middleware/workspaceAccess.js';
|
|
4
7
|
import { workspaceIdMiddleware } from './middleware/workspaceId.js';
|
|
8
|
+
import { createAdminRouter } from './routes/admin.js';
|
|
9
|
+
import { createAuthRouter } from './routes/auth.js';
|
|
10
|
+
import { createBatchRouter } from './routes/batch.js';
|
|
5
11
|
import { createClarifyRouter } from './routes/clarify.js';
|
|
6
12
|
import { createDecisionsRouter } from './routes/decisions.js';
|
|
7
13
|
import { createEdgesRouter } from './routes/edges.js';
|
|
8
14
|
import { healthRouter } from './routes/health.js';
|
|
15
|
+
import { createHistoryRouter } from './routes/history.js';
|
|
9
16
|
import { createModelRouter } from './routes/model.js';
|
|
10
17
|
import { createNodesRouter } from './routes/nodes.js';
|
|
11
18
|
import { createOAuthRouter } from './routes/oauth.js';
|
|
12
19
|
import { createOntologyRouter } from './routes/ontology.js';
|
|
13
20
|
import { createProposalsRouter } from './routes/proposals.js';
|
|
14
21
|
import { createRunsRouter } from './routes/runs.js';
|
|
22
|
+
import { createSkillInputOptionsRouter } from './routes/skillInputOptions.js';
|
|
15
23
|
import { createSkillsRouter } from './routes/skills.js';
|
|
24
|
+
import { createSourceLoadersRouter } from './routes/sourceLoaders.js';
|
|
25
|
+
import { createSourceUnitStatesRouter } from './routes/sourceUnitStates.js';
|
|
26
|
+
import { createUsersRouter } from './routes/users.js';
|
|
16
27
|
import { createWorkspaceEventsRouter } from './routes/workspaceEvents.js';
|
|
28
|
+
import { createTransferOwnershipRouter, createWorkspaceMembersRouter } from './routes/workspaceMembers.js';
|
|
17
29
|
import { createWorkspacesRouter } from './routes/workspaces.js';
|
|
18
30
|
export function createApp(deps, options = {}) {
|
|
19
|
-
const app = new
|
|
31
|
+
const app = new OpenAPIHono();
|
|
20
32
|
app.use('*', options.corsOrigins
|
|
21
33
|
? corsMiddleware({ allowedOrigins: options.corsOrigins })
|
|
22
34
|
: corsMiddleware());
|
|
35
|
+
// Phase B auth gate. In local-trust mode it short-circuits and lets
|
|
36
|
+
// the unauthenticated request through; otherwise a Bearer token is
|
|
37
|
+
// required (Google OAuth-issued session). Public routes — `/auth/*`,
|
|
38
|
+
// `/health` — are excluded inside the middleware so the login flow
|
|
39
|
+
// itself isn't gated.
|
|
40
|
+
if (deps.sessionStore) {
|
|
41
|
+
const localTrust = options.localTrust ?? deps.localTrust;
|
|
42
|
+
app.use('*', authMiddleware({
|
|
43
|
+
sessionStore: deps.sessionStore,
|
|
44
|
+
localTrust,
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
// Phase A identity. Stamps `c.set('userId', ...)` from `X-Braid-User`
|
|
48
|
+
// when the auth layer left it empty — i.e. local-trust mode, or any
|
|
49
|
+
// public route. Bearer-authenticated requests already have a userId
|
|
50
|
+
// by the time this runs and pass through untouched.
|
|
51
|
+
app.use('*', userIdMiddleware);
|
|
23
52
|
app.onError(errorHandler);
|
|
24
53
|
app.route('/health', healthRouter);
|
|
54
|
+
if (deps.sessionStore && deps.accessPolicy && deps.userRegistry) {
|
|
55
|
+
app.route('/auth', createAuthRouter({
|
|
56
|
+
clock: deps.clock,
|
|
57
|
+
sessionStore: deps.sessionStore,
|
|
58
|
+
accessPolicy: deps.accessPolicy,
|
|
59
|
+
userRegistry: deps.userRegistry,
|
|
60
|
+
...(deps.googleOAuth ? { googleOAuth: deps.googleOAuth } : {}),
|
|
61
|
+
studioUrl: deps.studioUrl ?? 'http://localhost:5173',
|
|
62
|
+
localTrust: options.localTrust ?? deps.localTrust,
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
if (deps.userRegistry) {
|
|
66
|
+
app.route('/users', createUsersRouter({
|
|
67
|
+
userRegistry: deps.userRegistry,
|
|
68
|
+
clock: deps.clock,
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
if (deps.userRegistry && deps.accessPolicy && deps.workspaceRegistry) {
|
|
72
|
+
app.route('/admin', createAdminRouter({
|
|
73
|
+
userRegistry: deps.userRegistry,
|
|
74
|
+
accessPolicy: deps.accessPolicy,
|
|
75
|
+
workspaceRegistry: deps.workspaceRegistry,
|
|
76
|
+
workspaceService: deps.workspaceService,
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
25
79
|
app.route('/workspaces', createWorkspacesRouter({
|
|
26
80
|
workspaceService: deps.workspaceService,
|
|
27
81
|
sourceLoaderRunner: deps.sourceLoaderRunner,
|
|
82
|
+
workspacesRoot: deps.workspacesRoot,
|
|
83
|
+
...(deps.bootstrap ? { bootstrap: deps.bootstrap } : {}),
|
|
84
|
+
...(deps.workspaceRegistry ? { workspaceRegistry: deps.workspaceRegistry } : {}),
|
|
85
|
+
...(deps.userRegistry ? { userRegistry: deps.userRegistry } : {}),
|
|
28
86
|
}));
|
|
29
87
|
app.route('/workspaces', createWorkspaceEventsRouter({ eventBus: deps.eventBus }));
|
|
30
|
-
|
|
88
|
+
// Server-level plugin discovery: lets Studio render its loader dropdown
|
|
89
|
+
// from the active PluginRegistry rather than hardcoded strings. Not
|
|
90
|
+
// workspace-scoped because the answer is "what does this server have
|
|
91
|
+
// installed", which is identical across workspaces.
|
|
92
|
+
app.route('/source-loaders', createSourceLoadersRouter({ pluginRegistry: deps.pluginRegistry }));
|
|
93
|
+
const workspaceScoped = new OpenAPIHono();
|
|
31
94
|
workspaceScoped.use('*', workspaceIdMiddleware);
|
|
95
|
+
// Workspace membership gate. Mounted only when both the workspace
|
|
96
|
+
// registry and user registry are present (i.e. composeFsApp);
|
|
97
|
+
// in-memory tests that compose without these stay open so existing
|
|
98
|
+
// routes keep behaving.
|
|
99
|
+
if (deps.workspaceRegistry && deps.userRegistry) {
|
|
100
|
+
workspaceScoped.use('*', workspaceAccessMiddleware({
|
|
101
|
+
registry: deps.workspaceRegistry,
|
|
102
|
+
workspaceService: deps.workspaceService,
|
|
103
|
+
userRegistry: deps.userRegistry,
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
32
106
|
workspaceScoped.route('/model', createModelRouter({ modelService: deps.modelService }));
|
|
33
107
|
workspaceScoped.route('/nodes', createNodesRouter({ modelService: deps.modelService }));
|
|
34
108
|
workspaceScoped.route('/edges', createEdgesRouter({ modelService: deps.modelService }));
|
|
@@ -37,12 +111,17 @@ export function createApp(deps, options = {}) {
|
|
|
37
111
|
proposalRepository: deps.proposalRepository,
|
|
38
112
|
modelRepository: deps.modelRepository,
|
|
39
113
|
validationService: deps.validationService,
|
|
114
|
+
workspaceService: deps.workspaceService,
|
|
40
115
|
}));
|
|
41
116
|
workspaceScoped.route('/clarify', createClarifyRouter({
|
|
42
117
|
hitlService: deps.hitlService,
|
|
43
118
|
clarifyRepository: deps.clarifyRepository,
|
|
119
|
+
decisionRepository: deps.decisionRepository,
|
|
44
120
|
}));
|
|
45
121
|
workspaceScoped.route('/decisions', createDecisionsRouter({ decisionRepository: deps.decisionRepository }));
|
|
122
|
+
workspaceScoped.route('/source-unit-states', createSourceUnitStatesRouter({
|
|
123
|
+
sourceUnitStateService: deps.sourceUnitStateService,
|
|
124
|
+
}));
|
|
46
125
|
workspaceScoped.route('/ontology', createOntologyRouter({
|
|
47
126
|
workspaceRepository: deps.workspaceRepository,
|
|
48
127
|
pluginRegistry: deps.pluginRegistry,
|
|
@@ -59,6 +138,30 @@ export function createApp(deps, options = {}) {
|
|
|
59
138
|
workspaceRepository: deps.workspaceRepository,
|
|
60
139
|
}));
|
|
61
140
|
}
|
|
141
|
+
if (deps.historyService) {
|
|
142
|
+
workspaceScoped.route('/history', createHistoryRouter({ historyService: deps.historyService }));
|
|
143
|
+
}
|
|
144
|
+
if (deps.batchService) {
|
|
145
|
+
workspaceScoped.route('/batch', createBatchRouter({ batchService: deps.batchService }));
|
|
146
|
+
}
|
|
147
|
+
workspaceScoped.route('/skill-input-options', createSkillInputOptionsRouter({
|
|
148
|
+
modelRepository: deps.modelRepository,
|
|
149
|
+
clarifyRepository: deps.clarifyRepository,
|
|
150
|
+
workspaceRepository: deps.workspaceRepository,
|
|
151
|
+
pluginRegistry: deps.pluginRegistry,
|
|
152
|
+
}));
|
|
153
|
+
if (deps.workspaceRegistry) {
|
|
154
|
+
workspaceScoped.route('/members', createWorkspaceMembersRouter({
|
|
155
|
+
workspaceService: deps.workspaceService,
|
|
156
|
+
registry: deps.workspaceRegistry,
|
|
157
|
+
clock: deps.clock,
|
|
158
|
+
}));
|
|
159
|
+
workspaceScoped.route('/transfer-ownership', createTransferOwnershipRouter({
|
|
160
|
+
workspaceService: deps.workspaceService,
|
|
161
|
+
registry: deps.workspaceRegistry,
|
|
162
|
+
clock: deps.clock,
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
62
165
|
app.route('/workspaces/:workspaceId', workspaceScoped);
|
|
63
166
|
if (deps.secretStore) {
|
|
64
167
|
app.route('/oauth', createOAuthRouter({
|
|
@@ -66,6 +169,21 @@ export function createApp(deps, options = {}) {
|
|
|
66
169
|
...(deps.googleOAuth ? { google: deps.googleOAuth } : {}),
|
|
67
170
|
}));
|
|
68
171
|
}
|
|
172
|
+
// OpenAPI 3 spec; consumed by openapi-mcp-gateway to surface REST
|
|
173
|
+
// operations as MCP tools. SSE routes and the OAuth HTML callback
|
|
174
|
+
// are intentionally absent — they're mounted via app.route() with
|
|
175
|
+
// plain Hono sub-routers so they don't register with the OpenAPI
|
|
176
|
+
// registry. The `servers[]` block lets the gateway resolve the
|
|
177
|
+
// upstream API base URL without an explicit --base-url flag.
|
|
178
|
+
app.doc('/openapi.json', {
|
|
179
|
+
openapi: '3.0.0',
|
|
180
|
+
info: {
|
|
181
|
+
title: 'Braid REST API',
|
|
182
|
+
version: '0.0.1',
|
|
183
|
+
description: 'REST surface exposed by @braidhq/server. Each operation also becomes an MCP tool via openapi-mcp-gateway.',
|
|
184
|
+
},
|
|
185
|
+
...(options.apiUrl ? { servers: [{ url: options.apiUrl }] } : {}),
|
|
186
|
+
});
|
|
69
187
|
return app;
|
|
70
188
|
}
|
|
71
189
|
//# sourceMappingURL=app.js.map
|
package/dist/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,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E,eAAe,CAAC,CAAA;IAEtD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,iBAAiB,CAAC;YACpC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1D,CAAC,CAAC,CAAA;IACL,CAAC;IAED,kEAAkE;IAClE,kEAAkE;IAClE,kEAAkE;IAClE,iEAAiE;IACjE,+DAA+D;IAC/D,6DAA6D;IAC7D,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE;QACvB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE;YACJ,KAAK,EAAE,gBAAgB;YACvB,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,2GAA2G;SACzH;QACD,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClE,CAAC,CAAA;IAEF,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
package/dist/composeFs.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AgentPlugin, OntologyPlugin, SourceLoaderPlugin, StoragePlugin } from '@braidhq/core';
|
|
2
|
+
import type { AgentEffort, StorageKind } from '@braidhq/schema';
|
|
2
3
|
import type { AppDependencies } from './composition.js';
|
|
4
|
+
import { AgentKind } from '@braidhq/schema';
|
|
3
5
|
export interface ComposeFsOptions {
|
|
4
6
|
/** Where to persist registered workspace paths. Default `$BRAID_HOME` or `~/.braid`. */
|
|
5
7
|
readonly braidHome?: string;
|
|
@@ -9,12 +11,45 @@ export interface ComposeFsOptions {
|
|
|
9
11
|
readonly agentModel?: string;
|
|
10
12
|
/** Coding-agent effort tier (default `high`). */
|
|
11
13
|
readonly agentEffort?: AgentEffort;
|
|
14
|
+
/**
|
|
15
|
+
* Graph storage backend kind. Resolved against the StoragePlugin
|
|
16
|
+
* registry; default `kuzu`. Set via `BRAID_STORAGE_KIND` env to swap
|
|
17
|
+
* (e.g. `neo4j` once `@braidhq/storage-neo4j` is registered).
|
|
18
|
+
*/
|
|
19
|
+
readonly storageKind?: StorageKind;
|
|
20
|
+
/** Coding-agent kind to spawn skill subprocesses with. Default `claude-code`. */
|
|
21
|
+
readonly agentKind?: AgentKind;
|
|
22
|
+
/**
|
|
23
|
+
* Extra plugins to register alongside the defaults bundled with this
|
|
24
|
+
* composition. The defaults bundle is:
|
|
25
|
+
* - storage: `kuzuStoragePlugin`
|
|
26
|
+
* - ontology: `dddOntology`
|
|
27
|
+
* - source-loader: `gitLoader`, `createGithubLoader()`, `createGoogleDriveLoader()`
|
|
28
|
+
* (gdrive throws an actionable error at ingest if OAuth env is missing;
|
|
29
|
+
* github falls back to anonymous if `${GH_TOKEN}` is unset, subject to
|
|
30
|
+
* the 60 req/h public rate limit)
|
|
31
|
+
* - agent: `claudeCodeAgentPlugin`
|
|
32
|
+
*
|
|
33
|
+
* `composeFsApp` is the opinionated entry that ships with batteries.
|
|
34
|
+
* Callers who want a different bundle should use `composeApp` directly
|
|
35
|
+
* with their own pluginRegistry.
|
|
36
|
+
*/
|
|
37
|
+
readonly extraStoragePlugins?: readonly StoragePlugin[];
|
|
38
|
+
readonly extraOntologyPlugins?: readonly OntologyPlugin[];
|
|
39
|
+
readonly extraSourceLoaderPlugins?: readonly SourceLoaderPlugin[];
|
|
40
|
+
readonly extraAgentPlugins?: readonly AgentPlugin[];
|
|
12
41
|
}
|
|
13
42
|
/**
|
|
14
|
-
*
|
|
15
|
-
* proposals / clarify / decisions, built-in skills loaded
|
|
16
|
-
*
|
|
17
|
-
*
|
|
43
|
+
* Opinionated production composition: real filesystem persistence for
|
|
44
|
+
* workspaces / proposals / clarify / decisions, built-in skills loaded
|
|
45
|
+
* from `@braidhq/core`, and a batteries-included plugin bundle (Kuzu
|
|
46
|
+
* storage / DDD ontology / Git+GDrive source loaders / Claude Code
|
|
47
|
+
* agent).
|
|
48
|
+
*
|
|
49
|
+
* To run with a different plugin set, either:
|
|
50
|
+
* 1. Pass `extraXxxPlugins` to add alongside defaults + flip `storageKind`
|
|
51
|
+
* / `agentKind` to pick a different active one, OR
|
|
52
|
+
* 2. Call `composeApp` directly with a `pluginRegistry` you built yourself.
|
|
18
53
|
*/
|
|
19
|
-
export declare function composeFsApp(options?: ComposeFsOptions): AppDependencies
|
|
54
|
+
export declare function composeFsApp(options?: ComposeFsOptions): Promise<AppDependencies>;
|
|
20
55
|
//# sourceMappingURL=composeFs.d.ts.map
|
package/dist/composeFs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeFs.d.ts","sourceRoot":"","sources":["../src/composeFs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,WAAW,
|
|
1
|
+
{"version":3,"file":"composeFs.d.ts","sourceRoot":"","sources":["../src/composeFs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACnG,OAAO,KAAK,EAAgB,WAAW,EAAE,WAAW,EAAe,MAAM,iBAAiB,CAAA;AAC1F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAiBvD,OAAO,EAAW,SAAS,EAAoC,MAAM,iBAAiB,CAAA;AAgCtF,MAAM,WAAW,gBAAgB;IAC/B,wFAAwF;IACxF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,yEAAyE;IACzE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,qDAAqD;IACrD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC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