twining-mcp 1.3.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/LICENSE +21 -0
- package/README.md +165 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +78 -0
- package/dist/config.js.map +1 -0
- package/dist/dashboard/api-routes.d.ts +21 -0
- package/dist/dashboard/api-routes.d.ts.map +1 -0
- package/dist/dashboard/api-routes.js +516 -0
- package/dist/dashboard/api-routes.js.map +1 -0
- package/dist/dashboard/dashboard-config.d.ts +19 -0
- package/dist/dashboard/dashboard-config.d.ts.map +1 -0
- package/dist/dashboard/dashboard-config.js +17 -0
- package/dist/dashboard/dashboard-config.js.map +1 -0
- package/dist/dashboard/http-server.d.ts +29 -0
- package/dist/dashboard/http-server.d.ts.map +1 -0
- package/dist/dashboard/http-server.js +177 -0
- package/dist/dashboard/http-server.js.map +1 -0
- package/dist/dashboard/public/app.js +2396 -0
- package/dist/dashboard/public/assets/favicon.svg +44 -0
- package/dist/dashboard/public/assets/icon-512.png +0 -0
- package/dist/dashboard/public/assets/logo.svg +45 -0
- package/dist/dashboard/public/favicon.ico +0 -0
- package/dist/dashboard/public/index.html +338 -0
- package/dist/dashboard/public/style.css +858 -0
- package/dist/dashboard/public/vendor/cytoscape.min.js +1 -0
- package/dist/dashboard/public/vendor/vis-timeline-graph2d.min.css +2 -0
- package/dist/dashboard/public/vendor/vis-timeline-graph2d.min.js +48 -0
- package/dist/embeddings/embedder.d.ts +24 -0
- package/dist/embeddings/embedder.d.ts.map +1 -0
- package/dist/embeddings/embedder.js +109 -0
- package/dist/embeddings/embedder.js.map +1 -0
- package/dist/embeddings/index-manager.d.ts +27 -0
- package/dist/embeddings/index-manager.d.ts.map +1 -0
- package/dist/embeddings/index-manager.js +115 -0
- package/dist/embeddings/index-manager.js.map +1 -0
- package/dist/embeddings/search.d.ts +52 -0
- package/dist/embeddings/search.d.ts.map +1 -0
- package/dist/embeddings/search.js +170 -0
- package/dist/embeddings/search.js.map +1 -0
- package/dist/engine/archiver.d.ts +28 -0
- package/dist/engine/archiver.d.ts.map +1 -0
- package/dist/engine/archiver.js +153 -0
- package/dist/engine/archiver.js.map +1 -0
- package/dist/engine/blackboard.d.ts +55 -0
- package/dist/engine/blackboard.d.ts.map +1 -0
- package/dist/engine/blackboard.js +90 -0
- package/dist/engine/blackboard.js.map +1 -0
- package/dist/engine/context-assembler.d.ts +50 -0
- package/dist/engine/context-assembler.d.ts.map +1 -0
- package/dist/engine/context-assembler.js +483 -0
- package/dist/engine/context-assembler.js.map +1 -0
- package/dist/engine/coordination.d.ts +53 -0
- package/dist/engine/coordination.d.ts.map +1 -0
- package/dist/engine/coordination.js +239 -0
- package/dist/engine/coordination.js.map +1 -0
- package/dist/engine/decisions.d.ts +147 -0
- package/dist/engine/decisions.d.ts.map +1 -0
- package/dist/engine/decisions.js +540 -0
- package/dist/engine/decisions.js.map +1 -0
- package/dist/engine/exporter.d.ts +30 -0
- package/dist/engine/exporter.d.ts.map +1 -0
- package/dist/engine/exporter.js +192 -0
- package/dist/engine/exporter.js.map +1 -0
- package/dist/engine/graph.d.ts +55 -0
- package/dist/engine/graph.d.ts.map +1 -0
- package/dist/engine/graph.js +119 -0
- package/dist/engine/graph.js.map +1 -0
- package/dist/engine/planning-bridge.d.ts +53 -0
- package/dist/engine/planning-bridge.d.ts.map +1 -0
- package/dist/engine/planning-bridge.js +170 -0
- package/dist/engine/planning-bridge.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +82 -0
- package/dist/server.js.map +1 -0
- package/dist/storage/agent-store.d.ts +36 -0
- package/dist/storage/agent-store.d.ts.map +1 -0
- package/dist/storage/agent-store.js +119 -0
- package/dist/storage/agent-store.js.map +1 -0
- package/dist/storage/blackboard-store.d.ts +21 -0
- package/dist/storage/blackboard-store.d.ts.map +1 -0
- package/dist/storage/blackboard-store.js +56 -0
- package/dist/storage/blackboard-store.js.map +1 -0
- package/dist/storage/decision-store.d.ts +23 -0
- package/dist/storage/decision-store.d.ts.map +1 -0
- package/dist/storage/decision-store.js +179 -0
- package/dist/storage/decision-store.js.map +1 -0
- package/dist/storage/file-store.d.ts +20 -0
- package/dist/storage/file-store.d.ts.map +1 -0
- package/dist/storage/file-store.js +108 -0
- package/dist/storage/file-store.js.map +1 -0
- package/dist/storage/graph-store.d.ts +39 -0
- package/dist/storage/graph-store.d.ts.map +1 -0
- package/dist/storage/graph-store.js +143 -0
- package/dist/storage/graph-store.js.map +1 -0
- package/dist/storage/handoff-store.d.ts +44 -0
- package/dist/storage/handoff-store.d.ts.map +1 -0
- package/dist/storage/handoff-store.js +136 -0
- package/dist/storage/handoff-store.js.map +1 -0
- package/dist/storage/init.d.ts +10 -0
- package/dist/storage/init.d.ts.map +1 -0
- package/dist/storage/init.js +48 -0
- package/dist/storage/init.js.map +1 -0
- package/dist/tools/blackboard-tools.d.ts +4 -0
- package/dist/tools/blackboard-tools.d.ts.map +1 -0
- package/dist/tools/blackboard-tools.js +131 -0
- package/dist/tools/blackboard-tools.js.map +1 -0
- package/dist/tools/context-tools.d.ts +4 -0
- package/dist/tools/context-tools.d.ts.map +1 -0
- package/dist/tools/context-tools.js +76 -0
- package/dist/tools/context-tools.js.map +1 -0
- package/dist/tools/coordination-tools.d.ts +6 -0
- package/dist/tools/coordination-tools.d.ts.map +1 -0
- package/dist/tools/coordination-tools.js +220 -0
- package/dist/tools/coordination-tools.js.map +1 -0
- package/dist/tools/decision-tools.d.ts +4 -0
- package/dist/tools/decision-tools.d.ts.map +1 -0
- package/dist/tools/decision-tools.js +265 -0
- package/dist/tools/decision-tools.js.map +1 -0
- package/dist/tools/export-tools.d.ts +4 -0
- package/dist/tools/export-tools.d.ts.map +1 -0
- package/dist/tools/export-tools.js +30 -0
- package/dist/tools/export-tools.js.map +1 -0
- package/dist/tools/graph-tools.d.ts +4 -0
- package/dist/tools/graph-tools.d.ts.map +1 -0
- package/dist/tools/graph-tools.js +127 -0
- package/dist/tools/graph-tools.js.map +1 -0
- package/dist/tools/lifecycle-tools.d.ts +9 -0
- package/dist/tools/lifecycle-tools.d.ts.map +1 -0
- package/dist/tools/lifecycle-tools.js +142 -0
- package/dist/tools/lifecycle-tools.js.map +1 -0
- package/dist/utils/errors.d.ts +24 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +31 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/ids.d.ts +2 -0
- package/dist/utils/ids.d.ts.map +1 -0
- package/dist/utils/ids.js +10 -0
- package/dist/utils/ids.js.map +1 -0
- package/dist/utils/liveness.d.ts +14 -0
- package/dist/utils/liveness.d.ts.map +1 -0
- package/dist/utils/liveness.js +19 -0
- package/dist/utils/liveness.js.map +1 -0
- package/dist/utils/tags.d.ts +9 -0
- package/dist/utils/tags.d.ts.map +1 -0
- package/dist/utils/tags.js +12 -0
- package/dist/utils/tags.js.map +1 -0
- package/dist/utils/tokens.d.ts +6 -0
- package/dist/utils/tokens.d.ts.map +1 -0
- package/dist/utils/tokens.js +8 -0
- package/dist/utils/tokens.js.map +1 -0
- package/dist/utils/types.d.ts +308 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +18 -0
- package/dist/utils/types.js.map +1 -0
- package/package.json +60 -0
- package/src/dashboard/public/app.js +2396 -0
- package/src/dashboard/public/assets/favicon.svg +44 -0
- package/src/dashboard/public/assets/icon-512.png +0 -0
- package/src/dashboard/public/assets/logo.svg +45 -0
- package/src/dashboard/public/favicon.ico +0 -0
- package/src/dashboard/public/index.html +338 -0
- package/src/dashboard/public/style.css +858 -0
- package/src/dashboard/public/vendor/cytoscape.min.js +1 -0
- package/src/dashboard/public/vendor/vis-timeline-graph2d.min.css +2 -0
- package/src/dashboard/public/vendor/vis-timeline-graph2d.min.js +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dave Angulo
|
|
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
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/logo.png" alt="Twining" width="400">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>Separate threads, stronger together.</strong><br>
|
|
7
|
+
Agent coordination for Claude Code and other MCP clients.
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<a href="https://www.npmjs.com/package/twining-mcp"><img src="https://img.shields.io/npm/v/twining-mcp" alt="npm version"></a>
|
|
12
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT License"></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
Twining provides a shared blackboard, decision tracking with rationale, selective context assembly, a lightweight knowledge graph, agent coordination with capability-based delegation, and local semantic search — all backed by plain JSONL/JSON files that are git-trackable and human-inspectable. Includes an embedded web dashboard for browsing and visualizing all state.
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- **Shared Blackboard** — Append-only message stream for findings, needs, warnings, and questions across agents
|
|
22
|
+
- **Decision Tracking** — Record decisions with rationale, alternatives, confidence, dependency chains, and git commit linking
|
|
23
|
+
- **Context Assembly** — Build tailored context packages for a task within a token budget, with handoff results and agent suggestions
|
|
24
|
+
- **Knowledge Graph** — Lightweight entity-relation graph with traversal, search, and full state export
|
|
25
|
+
- **Semantic Search** — Local embeddings via all-MiniLM-L6-v2 with automatic keyword fallback
|
|
26
|
+
- **Agent Coordination** — Registry with capability-based discovery, delegation matching, structured handoffs, and liveness tracking
|
|
27
|
+
- **Web Dashboard** — Embedded HTTP server with stats, search, decision timeline, interactive graph visualization, and agent coordination views
|
|
28
|
+
- **Archiving** — Move stale entries to archive while preserving decision records
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install -g twining-mcp
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Configure in Claude Code
|
|
39
|
+
|
|
40
|
+
Add to your Claude Code MCP settings (`~/.claude/claude_desktop_config.json` or project `.mcp.json`):
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"mcpServers": {
|
|
45
|
+
"twining": {
|
|
46
|
+
"command": "twining-mcp",
|
|
47
|
+
"args": ["--project", "/path/to/your/project"]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
If `--project` is omitted, Twining uses the current working directory.
|
|
54
|
+
|
|
55
|
+
### Usage
|
|
56
|
+
|
|
57
|
+
Once configured, Twining tools are available in your Claude Code sessions:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
> Use twining_post to share a finding about the auth module
|
|
61
|
+
> Use twining_assemble to get context for the refactoring task
|
|
62
|
+
> Use twining_decide to record the database choice with rationale
|
|
63
|
+
> Use twining_why to understand why we chose PostgreSQL
|
|
64
|
+
> Use twining_agents to see which agents are available
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
All state is stored in a `.twining/` directory in your project root.
|
|
68
|
+
|
|
69
|
+
### Claude Code Integration
|
|
70
|
+
|
|
71
|
+
For maximum value with Claude Code, add Twining instructions to your project's `CLAUDE.md`. See **[docs/CLAUDE_TEMPLATE.md](docs/CLAUDE_TEMPLATE.md)** for a ready-to-copy template covering Twining + Serena + GSD integration.
|
|
72
|
+
|
|
73
|
+
### Dashboard
|
|
74
|
+
|
|
75
|
+
The web dashboard starts automatically on port 24282 (configurable via `TWINING_DASHBOARD_PORT`). Open `http://localhost:24282` to browse blackboard entries, decisions, knowledge graph, and agent coordination state.
|
|
76
|
+
|
|
77
|
+
## Tools
|
|
78
|
+
|
|
79
|
+
### Blackboard
|
|
80
|
+
|
|
81
|
+
| Tool | Description |
|
|
82
|
+
|------|-------------|
|
|
83
|
+
| `twining_post` | Post an entry (finding, need, warning, question) to the shared blackboard |
|
|
84
|
+
| `twining_read` | Read blackboard entries with optional filters by type, scope, or agent |
|
|
85
|
+
| `twining_query` | Semantic search across blackboard entries, with keyword fallback |
|
|
86
|
+
| `twining_recent` | Get the most recent blackboard entries |
|
|
87
|
+
|
|
88
|
+
### Decisions
|
|
89
|
+
|
|
90
|
+
| Tool | Description |
|
|
91
|
+
|------|-------------|
|
|
92
|
+
| `twining_decide` | Record a decision with rationale, alternatives, and traceability |
|
|
93
|
+
| `twining_why` | Retrieve all decisions affecting a given scope or file |
|
|
94
|
+
| `twining_trace` | Trace a decision's dependency chain upstream and/or downstream |
|
|
95
|
+
| `twining_reconsider` | Flag a decision for reconsideration with downstream impact analysis |
|
|
96
|
+
| `twining_override` | Override a decision with a reason, optionally creating a replacement |
|
|
97
|
+
| `twining_search_decisions` | Search decisions by keyword or semantic similarity with filters |
|
|
98
|
+
| `twining_link_commit` | Link a git commit hash to an existing decision |
|
|
99
|
+
| `twining_commits` | Query decisions by git commit hash |
|
|
100
|
+
|
|
101
|
+
### Context & Lifecycle
|
|
102
|
+
|
|
103
|
+
| Tool | Description |
|
|
104
|
+
|------|-------------|
|
|
105
|
+
| `twining_assemble` | Build tailored context for a task within a token budget |
|
|
106
|
+
| `twining_summarize` | Get a high-level summary of project state and activity |
|
|
107
|
+
| `twining_what_changed` | Report what changed since a given point in time |
|
|
108
|
+
| `twining_status` | Overall health check — entry counts, agent counts, warnings, and summary |
|
|
109
|
+
| `twining_archive` | Archive old blackboard entries to reduce working set size |
|
|
110
|
+
| `twining_export` | Export full Twining state as a single markdown document |
|
|
111
|
+
|
|
112
|
+
### Knowledge Graph
|
|
113
|
+
|
|
114
|
+
| Tool | Description |
|
|
115
|
+
|------|-------------|
|
|
116
|
+
| `twining_add_entity` | Add or update a knowledge graph entity (upsert semantics) |
|
|
117
|
+
| `twining_add_relation` | Add a relation between two knowledge graph entities |
|
|
118
|
+
| `twining_neighbors` | Traverse the knowledge graph from an entity up to depth 3 |
|
|
119
|
+
| `twining_graph_query` | Search the knowledge graph by name or property substring |
|
|
120
|
+
|
|
121
|
+
### Agent Coordination
|
|
122
|
+
|
|
123
|
+
| Tool | Description |
|
|
124
|
+
|------|-------------|
|
|
125
|
+
| `twining_agents` | List registered agents with capabilities, liveness status, and filtering |
|
|
126
|
+
| `twining_discover` | Find agents matching required capabilities, ranked by overlap and liveness |
|
|
127
|
+
| `twining_delegate` | Post a delegation request to the blackboard with capability requirements |
|
|
128
|
+
| `twining_handoff` | Create a handoff between agents with work results and auto-assembled context |
|
|
129
|
+
| `twining_acknowledge` | Acknowledge receipt of a handoff |
|
|
130
|
+
|
|
131
|
+
## Architecture
|
|
132
|
+
|
|
133
|
+
Twining is organized in layers:
|
|
134
|
+
|
|
135
|
+
- **Storage Layer** — File-backed stores for blackboard (JSONL), decisions (JSON index + individual files), knowledge graph (JSON), agent registry, and handoff records. All I/O goes through this layer with file locking for concurrent access.
|
|
136
|
+
- **Engine Layer** — Business logic for each domain: blackboard posting/querying, decision recording/tracing, graph traversal, context assembly with token budgeting, agent coordination with capability-based discovery and delegation, and archiving.
|
|
137
|
+
- **Embeddings Layer** — Lazy-loaded local embeddings using `@huggingface/transformers` with all-MiniLM-L6-v2. Falls back to keyword search if model loading fails. The server never fails to start because of embedding issues.
|
|
138
|
+
- **Dashboard Layer** — Embedded HTTP server running alongside MCP stdio transport. Vanilla HTML/CSS/JS with cytoscape.js for graph visualization and vis-timeline for decision timelines. Read-only observer of Twining state.
|
|
139
|
+
- **Tools Layer** — MCP tool definitions that map 1:1 to the tool surface. Each tool validates input with Zod and returns structured results.
|
|
140
|
+
|
|
141
|
+
All state lives in `.twining/` as plain files — JSONL for the blackboard stream, JSON for decisions, graph, agents, and handoffs. Everything is `jq`-queryable, `grep`-able, and git-diffable.
|
|
142
|
+
|
|
143
|
+
See [TWINING-DESIGN-SPEC.md](TWINING-DESIGN-SPEC.md) for the full design specification.
|
|
144
|
+
|
|
145
|
+
## Development
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# Install dependencies
|
|
149
|
+
npm install
|
|
150
|
+
|
|
151
|
+
# Build
|
|
152
|
+
npm run build
|
|
153
|
+
|
|
154
|
+
# Run tests
|
|
155
|
+
npm test
|
|
156
|
+
|
|
157
|
+
# Watch mode
|
|
158
|
+
npm run test:watch
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Requires Node.js >= 18.
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
[MIT](LICENSE)
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TwiningConfig } from "./utils/types.js";
|
|
2
|
+
export declare const DEFAULT_CONFIG: TwiningConfig;
|
|
3
|
+
/**
|
|
4
|
+
* Load config from .twining/config.yml, deep-merged with defaults.
|
|
5
|
+
* If the file doesn't exist, returns DEFAULT_CONFIG.
|
|
6
|
+
*/
|
|
7
|
+
export declare function loadConfig(twiningDir: string): TwiningConfig;
|
|
8
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,eAAO,MAAM,cAAc,EAAE,aAgC5B,CAAC;AA+BF;;;GAGG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CAc5D"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration loading from .twining/config.yml with sensible defaults.
|
|
3
|
+
*/
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import yaml from "js-yaml";
|
|
7
|
+
export const DEFAULT_CONFIG = {
|
|
8
|
+
version: 1,
|
|
9
|
+
project_name: "",
|
|
10
|
+
embedding_model: "all-MiniLM-L6-v2",
|
|
11
|
+
archive: {
|
|
12
|
+
auto_archive_on_commit: true,
|
|
13
|
+
auto_archive_on_context_switch: true,
|
|
14
|
+
max_blackboard_entries_before_archive: 500,
|
|
15
|
+
},
|
|
16
|
+
context_assembly: {
|
|
17
|
+
default_max_tokens: 4000,
|
|
18
|
+
priority_weights: {
|
|
19
|
+
recency: 0.3,
|
|
20
|
+
relevance: 0.4,
|
|
21
|
+
decision_confidence: 0.2,
|
|
22
|
+
warning_boost: 0.1,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
conflict_resolution: "human",
|
|
26
|
+
agents: {
|
|
27
|
+
liveness: {
|
|
28
|
+
idle_after_ms: 300000, // 5 minutes
|
|
29
|
+
gone_after_ms: 1800000, // 30 minutes
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
delegations: {
|
|
33
|
+
timeouts: {
|
|
34
|
+
high_ms: 300000, // 5 minutes
|
|
35
|
+
normal_ms: 1800000, // 30 minutes
|
|
36
|
+
low_ms: 14400000, // 4 hours
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
/** Deep merge source into target, returning a new object */
|
|
41
|
+
function deepMerge(target, source) {
|
|
42
|
+
const result = { ...target };
|
|
43
|
+
for (const key of Object.keys(target)) {
|
|
44
|
+
const targetVal = target[key];
|
|
45
|
+
const sourceVal = source[key];
|
|
46
|
+
if (sourceVal === undefined)
|
|
47
|
+
continue;
|
|
48
|
+
if (targetVal !== null &&
|
|
49
|
+
typeof targetVal === "object" &&
|
|
50
|
+
!Array.isArray(targetVal) &&
|
|
51
|
+
sourceVal !== null &&
|
|
52
|
+
typeof sourceVal === "object" &&
|
|
53
|
+
!Array.isArray(sourceVal)) {
|
|
54
|
+
result[key] = deepMerge(targetVal, sourceVal);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
result[key] = sourceVal;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Load config from .twining/config.yml, deep-merged with defaults.
|
|
64
|
+
* If the file doesn't exist, returns DEFAULT_CONFIG.
|
|
65
|
+
*/
|
|
66
|
+
export function loadConfig(twiningDir) {
|
|
67
|
+
const configPath = path.join(twiningDir, "config.yml");
|
|
68
|
+
if (!fs.existsSync(configPath)) {
|
|
69
|
+
return { ...DEFAULT_CONFIG };
|
|
70
|
+
}
|
|
71
|
+
const raw = fs.readFileSync(configPath, "utf-8");
|
|
72
|
+
const parsed = yaml.load(raw);
|
|
73
|
+
if (parsed === null || parsed === undefined || typeof parsed !== "object") {
|
|
74
|
+
return { ...DEFAULT_CONFIG };
|
|
75
|
+
}
|
|
76
|
+
return deepMerge(DEFAULT_CONFIG, parsed);
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,SAAS,CAAC;AAG3B,MAAM,CAAC,MAAM,cAAc,GAAkB;IAC3C,OAAO,EAAE,CAAC;IACV,YAAY,EAAE,EAAE;IAChB,eAAe,EAAE,kBAAkB;IACnC,OAAO,EAAE;QACP,sBAAsB,EAAE,IAAI;QAC5B,8BAA8B,EAAE,IAAI;QACpC,qCAAqC,EAAE,GAAG;KAC3C;IACD,gBAAgB,EAAE;QAChB,kBAAkB,EAAE,IAAI;QACxB,gBAAgB,EAAE;YAChB,OAAO,EAAE,GAAG;YACZ,SAAS,EAAE,GAAG;YACd,mBAAmB,EAAE,GAAG;YACxB,aAAa,EAAE,GAAG;SACnB;KACF;IACD,mBAAmB,EAAE,OAAO;IAC5B,MAAM,EAAE;QACN,QAAQ,EAAE;YACR,aAAa,EAAE,MAAM,EAAE,YAAY;YACnC,aAAa,EAAE,OAAO,EAAE,aAAa;SACtC;KACF;IACD,WAAW,EAAE;QACX,QAAQ,EAAE;YACR,OAAO,EAAE,MAAM,EAAQ,YAAY;YACnC,SAAS,EAAE,OAAO,EAAK,aAAa;YACpC,MAAM,EAAE,QAAQ,EAAO,UAAU;SAClC;KACF;CACF,CAAC;AAEF,4DAA4D;AAC5D,SAAS,SAAS,CAChB,MAA+B,EAC/B,MAA+B;IAE/B,MAAM,MAAM,GAA4B,EAAE,GAAG,MAAM,EAAE,CAAC;IACtD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC9B,IAAI,SAAS,KAAK,SAAS;YAAE,SAAS;QACtC,IACE,SAAS,KAAK,IAAI;YAClB,OAAO,SAAS,KAAK,QAAQ;YAC7B,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;YACzB,SAAS,KAAK,IAAI;YAClB,OAAO,SAAS,KAAK,QAAQ;YAC7B,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EACzB,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CACrB,SAAoC,EACpC,SAAoC,CACrC,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,UAAkB;IAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IACvD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC;IAC/B,CAAC;IACD,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1E,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC;IAC/B,CAAC;IACD,OAAO,SAAS,CACd,cAAoD,EACpD,MAAiC,CACN,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboard API route handlers.
|
|
3
|
+
*
|
|
4
|
+
* Factory function creates a request handler that serves JSON endpoints
|
|
5
|
+
* for blackboard entries, decisions, graph data, and operational status.
|
|
6
|
+
*
|
|
7
|
+
* CRITICAL: Never use console.log or process.stdout in this module.
|
|
8
|
+
* The MCP StdioServerTransport owns stdout exclusively.
|
|
9
|
+
*/
|
|
10
|
+
import http from "node:http";
|
|
11
|
+
/**
|
|
12
|
+
* Create an API request handler for the given project root.
|
|
13
|
+
*
|
|
14
|
+
* Returns an async function that handles /api/* routes and returns true
|
|
15
|
+
* if the request was handled, false if it should fall through to other
|
|
16
|
+
* handlers (e.g., static file serving).
|
|
17
|
+
*
|
|
18
|
+
* Store instances are created once in the closure, not per-request.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createApiHandler(projectRoot: string): (req: http.IncomingMessage, res: http.ServerResponse) => Promise<boolean>;
|
|
21
|
+
//# sourceMappingURL=api-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-routes.d.ts","sourceRoot":"","sources":["../../src/dashboard/api-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAsC7B;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,GAClB,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,IAAI,CAAC,cAAc,KAAK,OAAO,CAAC,OAAO,CAAC,CAukB3E"}
|