@sanqianx/ai-coding-event-bridge-console 0.7.2 → 0.7.4

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.
Files changed (36) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +81 -81
  3. package/console/index.html +953 -953
  4. package/package.json +26 -26
  5. package/src/agent-detect.js +128 -128
  6. package/src/bridge/bin/commit-boundary.js +64 -64
  7. package/src/bridge/connectors/capture-guard.js +24 -24
  8. package/src/bridge/connectors/claude-code/hook-entry.js +45 -45
  9. package/src/bridge/connectors/claude-code/notify.js +57 -57
  10. package/src/bridge/connectors/codex/cursor-store.js +83 -83
  11. package/src/bridge/connectors/codex/hook-entry.js +215 -215
  12. package/src/bridge/connectors/codex/session-parser.js +100 -100
  13. package/src/bridge/connectors/opencode/hook-entry.js +55 -55
  14. package/src/bridge/core/bridge.js +249 -246
  15. package/src/bridge/core/commit-projection.js +288 -288
  16. package/src/bridge/core/compaction.js +23 -23
  17. package/src/bridge/core/consumer-registry.js +111 -111
  18. package/src/bridge/core/event-schema.js +127 -127
  19. package/src/bridge/core/fs-utils.js +81 -81
  20. package/src/bridge/core/journal-router.js +39 -39
  21. package/src/bridge/core/journal.js +507 -507
  22. package/src/bridge/core/lock.js +96 -96
  23. package/src/bridge/core/normalizer.js +114 -114
  24. package/src/bridge/core/paths.js +12 -12
  25. package/src/bridge/core/project-registry.js +176 -176
  26. package/src/bridge/core/repo-context.js +191 -191
  27. package/src/bridge/core/runtime-home.js +189 -189
  28. package/src/bridge/core/semver.js +23 -23
  29. package/src/bridge/core/turn-identity.js +127 -127
  30. package/src/bridge/index.js +86 -86
  31. package/src/bridge/installers/claude-code/installer.js +181 -181
  32. package/src/bridge/installers/codex/installer.js +114 -114
  33. package/src/bridge/installers/opencode/installer.js +96 -96
  34. package/src/bridge/installers/zcode/installer.js +200 -200
  35. package/src/bridge/query/conversation-query.js +194 -194
  36. package/src/server.js +825 -825
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 SanQianX
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SanQianX
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,81 +1,81 @@
1
- # @sanqianx/ai-coding-event-bridge-console
2
-
3
- Local console for the AI coding event bridge: a vector-hub-style dark UI for
4
- browsing captured conversations, a JSON query API shared with AI agents, and
5
- project import that pins each project's records to a local storage address.
6
-
7
- ## Usage
8
-
9
- ```bash
10
- # from the repository root
11
- npm install
12
- npm run serve # http://127.0.0.1:8790
13
-
14
- # or as a CLI once published
15
- npx ai-coding-event-bridge-console serve [--port 8790] [--host 127.0.0.1] [--home DIR]
16
- ```
17
-
18
- The server binds to `127.0.0.1` by default — journals contain full
19
- conversation bodies, so they stay on this machine unless `--host` says
20
- otherwise.
21
-
22
- ## Projects
23
-
24
- - **导入项目** (sidebar): pick a local Git work tree (subdirectories resolve to
25
- the repo root) and optionally a **记录保存地址**. From then on, conversations
26
- and commit boundaries captured inside that project are appended to
27
- `<store>/journal` instead of the global journal. Legacy events already in the
28
- global journal are still shown for the project.
29
- - **自动发现** (`auto` tag): repos that were captured but never imported read
30
- from the global journal only.
31
- - **注销** (hover a registered project): removes the registration only; data on
32
- disk is never deleted, and new capture falls back to the global journal.
33
- - The folder picker uses a native dialog on Windows; elsewhere (or with
34
- `BRIDGE_CONSOLE_PICK_FOLDER=0`) type the path manually.
35
-
36
- ## API
37
-
38
- | Route | Description |
39
- | --- | --- |
40
- | `GET /api/health` | `{ ok, home, registeredProjects, first/lastSequence }` |
41
- | `GET /api/system/agents` | Detect installed agent tools (Claude Code / Codex / OpenCode: CLI, config, hook wiring) + bridge runtime info + consumers |
42
-
43
- Agent detection distinguishes a found command/config from installed capture.
44
- Consumer registration never installs an Agent hook. In a host-embedded console,
45
- “管理 Agent 采集” opens the host's connector installer. ZCode status requires both
46
- managed events and `hooks.enabled`; hooks installed under an explicit Bridge
47
- home read that home's runtime even when the external Agent inherits no home
48
- environment variable. ZCode's Claude-compatible payloads retain source `zcode`.
49
- | `POST /api/system/upgrade-runtime` | Materialize/activate the runtime at the core package version (designed same-major upgrade path) |
50
- | `GET /api/system/pick-folder` | Native folder dialog (win32; 501 elsewhere) |
51
- | `GET /api/projects` | Registered + auto-discovered projects with turn counts |
52
- | `POST /api/projects` | `{ path, store? }` — import (Git work trees only) |
53
- | `DELETE /api/projects?id=` | Unregister (data stays on disk) |
54
- | `GET /api/dates?project=` | Days with turns + counts (for the date chips) |
55
- | `GET /api/turns?project&date&cursor&limit` | Merged turns + `annotations` (commit shas per turn) |
56
- | `GET /api/sessions?project=` | Session index |
57
- | `GET /api/search?q&project&limit` | Substring search over conversation bodies |
58
- | `GET /api/journals` | Global and registered project journal identities |
59
- | `POST /api/internal/workbench-event` | Private native Workbench capture; runtime token, loopback, no browser Origin |
60
-
61
- The private capture route uses `KB_EVENT_BRIDGE_RUNTIME_TOKEN`. It resolves the
62
- Git identity and requires an already registered code directory. Stable event
63
- keys deduplicate retries; only original prompts, successful final answers and
64
- turn endings enter the same bridge journal used by hooks. Credentials and
65
- injected knowledge are not accepted as event metadata. Shell proxies must not
66
- expose this route to browser callers.
67
-
68
- Turn merging: for a registered project, the project journal and the global
69
- journal (legacy pre-import events) are both read, filtered by repo identity,
70
- ordered by capture time. Sequence-span commit annotations only compare within
71
- one journal's sequence space; `openTurnIdsAtCommit` binding works across both.
72
-
73
- ## Notes
74
-
75
- - Node >= 18, CommonJS, zero runtime dependencies beyond the core package.
76
- - Public query APIs read journals; project import/unregister changes registration.
77
- The authenticated Workbench endpoint delegates capture to the core bridge,
78
- not a second conversation database.
79
- - Consumer cursors and ACKs are journal-specific. Compaction may retire sealed
80
- evidence only after every applicable consumer has acknowledged that journal;
81
- creating a commit archive is not proof that the engine consumed it.
1
+ # @sanqianx/ai-coding-event-bridge-console
2
+
3
+ Local console for the AI coding event bridge: a vector-hub-style dark UI for
4
+ browsing captured conversations, a JSON query API shared with AI agents, and
5
+ project import that pins each project's records to a local storage address.
6
+
7
+ ## Usage
8
+
9
+ ```bash
10
+ # from the repository root
11
+ npm install
12
+ npm run serve # http://127.0.0.1:8790
13
+
14
+ # or as a CLI once published
15
+ npx ai-coding-event-bridge-console serve [--port 8790] [--host 127.0.0.1] [--home DIR]
16
+ ```
17
+
18
+ The server binds to `127.0.0.1` by default — journals contain full
19
+ conversation bodies, so they stay on this machine unless `--host` says
20
+ otherwise.
21
+
22
+ ## Projects
23
+
24
+ - **导入项目** (sidebar): pick a local Git work tree (subdirectories resolve to
25
+ the repo root) and optionally a **记录保存地址**. From then on, conversations
26
+ and commit boundaries captured inside that project are appended to
27
+ `<store>/journal` instead of the global journal. Legacy events already in the
28
+ global journal are still shown for the project.
29
+ - **自动发现** (`auto` tag): repos that were captured but never imported read
30
+ from the global journal only.
31
+ - **注销** (hover a registered project): removes the registration only; data on
32
+ disk is never deleted, and new capture falls back to the global journal.
33
+ - The folder picker uses a native dialog on Windows; elsewhere (or with
34
+ `BRIDGE_CONSOLE_PICK_FOLDER=0`) type the path manually.
35
+
36
+ ## API
37
+
38
+ | Route | Description |
39
+ | --- | --- |
40
+ | `GET /api/health` | `{ ok, home, registeredProjects, first/lastSequence }` |
41
+ | `GET /api/system/agents` | Detect installed agent tools (Claude Code / Codex / OpenCode: CLI, config, hook wiring) + bridge runtime info + consumers |
42
+
43
+ Agent detection distinguishes a found command/config from installed capture.
44
+ Consumer registration never installs an Agent hook. In a host-embedded console,
45
+ “管理 Agent 采集” opens the host's connector installer. ZCode status requires both
46
+ managed events and `hooks.enabled`; hooks installed under an explicit Bridge
47
+ home read that home's runtime even when the external Agent inherits no home
48
+ environment variable. ZCode's Claude-compatible payloads retain source `zcode`.
49
+ | `POST /api/system/upgrade-runtime` | Materialize/activate the runtime at the core package version (designed same-major upgrade path) |
50
+ | `GET /api/system/pick-folder` | Native folder dialog (win32; 501 elsewhere) |
51
+ | `GET /api/projects` | Registered + auto-discovered projects with turn counts |
52
+ | `POST /api/projects` | `{ path, store? }` — import (Git work trees only) |
53
+ | `DELETE /api/projects?id=` | Unregister (data stays on disk) |
54
+ | `GET /api/dates?project=` | Days with turns + counts (for the date chips) |
55
+ | `GET /api/turns?project&date&cursor&limit` | Merged turns + `annotations` (commit shas per turn) |
56
+ | `GET /api/sessions?project=` | Session index |
57
+ | `GET /api/search?q&project&limit` | Substring search over conversation bodies |
58
+ | `GET /api/journals` | Global and registered project journal identities |
59
+ | `POST /api/internal/workbench-event` | Private native Workbench capture; runtime token, loopback, no browser Origin |
60
+
61
+ The private capture route uses `KB_EVENT_BRIDGE_RUNTIME_TOKEN`. It resolves the
62
+ Git identity and requires an already registered code directory. Stable event
63
+ keys deduplicate retries; only original prompts, successful final answers and
64
+ turn endings enter the same bridge journal used by hooks. Credentials and
65
+ injected knowledge are not accepted as event metadata. Shell proxies must not
66
+ expose this route to browser callers.
67
+
68
+ Turn merging: for a registered project, the project journal and the global
69
+ journal (legacy pre-import events) are both read, filtered by repo identity,
70
+ ordered by capture time. Sequence-span commit annotations only compare within
71
+ one journal's sequence space; `openTurnIdsAtCommit` binding works across both.
72
+
73
+ ## Notes
74
+
75
+ - Node >= 18, CommonJS, zero runtime dependencies beyond the core package.
76
+ - Public query APIs read journals; project import/unregister changes registration.
77
+ The authenticated Workbench endpoint delegates capture to the core bridge,
78
+ not a second conversation database.
79
+ - Consumer cursors and ACKs are journal-specific. Compaction may retire sealed
80
+ evidence only after every applicable consumer has acknowledged that journal;
81
+ creating a commit archive is not proof that the engine consumed it.