Commit graph

200 commits

Author SHA1 Message Date
Snider
e5caa8d32e feat(mcp): RFC §3 tools + §8 discovery alignment
New tools (RFC §3):
- webview_render / webview_update: embedded UI HTML + state broadcast
  via webview.render / webview.update channels with merge-or-replace
- ws_connect / ws_send / ws_close: outbound WebSocket client tools
  with stable ws-<hex> connection IDs
- process_run: blocking command executor returning ID/exit/output
- rag_search / rag_index: aliases for rag_query / rag_ingest per spec
- rag_retrieve: fetch chunks for a source, ordered by chunk index
- ide_dashboard_state / ide_dashboard_update: merge-or-replace state
  with activity feed entries and dashboard.state.updated broadcast
- agentic_issue_dispatch: spec-aligned name for agentic_dispatch_issue

Discovery (RFC §8.2):
- transport_http.go: /.well-known/mcp-servers.json advertises both
  core-agent and core-mcp with semantic use_when hints

Tool count: 25 → 33. Good/Bad/Ugly coverage added for every new tool.

Pre-existing cmd/mcpcmd Cobra-style build error flagged but untouched
— same cmd vs core.Command migration pattern seen in cmd/api and
cmd/build (which were migrated earlier this session).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-14 18:02:36 +01:00
Snider
982a3b4b00 fix(mcp): transport addr default + progress notifications + auth timing safety
- transport_http.go: addr "" now defaults to 127.0.0.1:9101 per RFC
- pkg/mcp/agentic/dispatch.go: emits NotifyProgress milestones during
  validation, workspace prep, queue/slot, spawn, start completion
- pkg/mcp/agentic/watch.go: emits NotifyProgress per watched workspace
  completion/failure with running totals
- pkg/mcp/authz.go: restore crypto/subtle for constant-time token
  comparison (timing-attack resistance)
- pkg/mcp/registry.go: related touch-up for the auth path

Spark-medium pass. Unused net/http import cleaned after verify.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-14 18:02:36 +01:00
Snider
91803e32df refactor: AX compliance sweep — replace banned stdlib imports with core primitives
Replaced fmt, strings, sort, os, io, sync, encoding/json, path/filepath,
errors, log, reflect with core.Sprintf, core.E, core.Contains, core.Trim,
core.Split, core.Join, core.JoinPath, slices.Sort, c.Fs(), c.Lock(),
core.JSONMarshal, core.ReadAll and other CoreGO v0.8.0 primitives.

Framework boundary exceptions preserved where stdlib types are required
by external interfaces (Gin, net/http, CGo, Wails, bubbletea).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-14 18:02:36 +01:00
Snider
65b686283f feat(mcp): export NotifySession for raw JSON-RPC notifications
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-14 18:02:36 +01:00
Snider
cbab302661 refactor(mcp): migrate stdlib imports to core/go primitives + upgrade go-sdk v1.5.0
- Replace fmt/errors/strings/path/filepath with core.Sprintf, core.E,
  core.Contains, core.Path etc. across 16 files
- Remove 'errors' import from bridge.go (core.Is/core.As)
- Remove 'fmt' from transport_tcp.go, ide.go (core.Print, inline interface)
- Remove 'strings' from notify.go, transport_http.go, tools_webview.go,
  process_notifications.go (core.Trim, core.HasPrefix, core.Lower etc.)
- Upgrade go-sdk from v1.4.1 to v1.5.0
- Keep encoding/json for json.NewDecoder/MarshalIndent (no core equivalent)
- Keep os/exec in agentic subsystem (needs go-process Action wiring)

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-14 18:02:36 +01:00
Snider
7fde0c1c21 refactor(mcp): migrate stdlib imports to core/go primitives + upgrade go-sdk v1.5.0
- Replace fmt/errors/strings/path/filepath with core.Sprintf, core.E,
  core.Contains, core.Path etc. across 16 files
- Remove 'errors' import from bridge.go (core.Is/core.As)
- Remove 'fmt' from transport_tcp.go, ide.go (core.Print, inline interface)
- Remove 'strings' from notify.go, transport_http.go, tools_webview.go,
  process_notifications.go (core.Trim, core.HasPrefix, core.Lower etc.)
- Upgrade go-sdk from v1.4.1 to v1.5.0
- Keep encoding/json for json.NewDecoder/MarshalIndent (no core equivalent)
- Keep os/exec in agentic subsystem (needs go-process Action wiring)

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-08 22:00:20 +01:00
Snider
f8f137b465 fix(mcp): disable ListChanged to prevent premature stdio notifications
The go-sdk fires notifications/tools/list_changed and
notifications/resources/list_changed with 10ms delay after AddTool/AddResource.
Since all registration happens before server.Run(), these hit stdout
before the client sends initialize, breaking the MCP handshake.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-08 20:50:46 +01:00
Snider
429f1c2b6c Revert "perf(mcp): gate extended built-in tools behind CORE_MCP_FULL"
This reverts commit 9f7dd84d4a.
2026-04-08 20:47:34 +01:00
Snider
9f7dd84d4a perf(mcp): gate extended built-in tools behind CORE_MCP_FULL
Metrics, RAG, and webview tools only register when CORE_MCP_FULL=1.
Process and WS tools always register (used by factory).
Reduces default tool count by 15.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-08 19:17:32 +01:00
Snider
9bd3084da4 fix(mcp): bridge test body + process dep resolution
- Fix TestBridgeToAPI_Good_EndToEnd: POST with empty JSON body instead of nil
- Add local replace for go-process to resolve API drift with core v0.8.0

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-08 16:39:28 +01:00
Snider
20e4a381cf fix: migrate module paths from forge.lthn.ai to dappco.re
Update all import paths and version pins:
- forge.lthn.ai/core/go-* → dappco.re/go/core/*
- forge.lthn.ai/core/api → dappco.re/go/core/api
- forge.lthn.ai/core/cli → dappco.re/go/core/cli
- Updated: api v0.3.0, cli v0.5.2, ai v0.2.2, io v0.4.1, log v0.1.2
- Updated: process v0.5.0, rag v0.1.13, ws v0.4.0, webview v0.2.1
- Updated: i18n v0.2.3, inference v0.3.0, scm v0.6.1

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-07 12:59:22 +01:00
Snider
cd305904e5 fix: migrate module paths from forge.lthn.ai to dappco.re
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-04 16:21:14 +01:00
Virgil
0b63f9cd22 fix(mcp): harden tool handlers 2026-04-02 18:50:20 +00:00
Virgil
ab1aa0cad0 refactor(mcp): align REST bridge errors with AX 2026-04-02 18:46:08 +00:00
Virgil
c1d3db1ad3 fix(mcp): ensure CLI shutdown cleanup 2026-04-02 18:42:03 +00:00
Virgil
1b3d102684 refactor(agentic): canonicalize PR input DTO 2026-04-02 18:38:03 +00:00
Virgil
23063599df docs(mcp): clarify channel capability helpers 2026-04-02 18:34:15 +00:00
Virgil
476a699b96 fix(mcp): type REST bridge input errors 2026-04-02 18:29:51 +00:00
Virgil
0bd3f70e20 docs(mcp): align public API comments with AX conventions 2026-04-02 18:26:17 +00:00
Virgil
6e73fb6e8d fix(agentic): preserve issue labels on unlock 2026-04-02 18:23:35 +00:00
Virgil
cf0885389a feat(brain): emit complete bridge notifications 2026-04-02 18:20:25 +00:00
Virgil
6a5a177bec refactor(mcp): default CLI to sandboxed workspace 2026-04-02 18:16:46 +00:00
Virgil
8a1efa8f12 refactor(agentic): surface workspace persistence failures 2026-04-02 18:12:16 +00:00
Virgil
583abea788 refactor(agentic): write workspace files atomically 2026-04-02 18:07:53 +00:00
Virgil
9f68a74491 docs(mcp): add AX-style usage examples to agentic DTOs 2026-04-02 18:04:32 +00:00
Virgil
954a5e1e98 refactor(mcp): document directory entry paths 2026-04-02 18:01:16 +00:00
Virgil
1373a6d296 refactor(mcp): centralize session broadcast iteration 2026-04-02 17:50:49 +00:00
Virgil
d4de2b4cd7 fix(mcp): make BridgeToAPI nil-safe 2026-04-02 17:45:55 +00:00
Virgil
1c3fe69cbc refactor(mcp): centralise channel capability name 2026-04-02 17:40:08 +00:00
Virgil
c42e7ad050 fix(mcp): harden subsystem interface contracts 2026-04-02 17:35:43 +00:00
Virgil
4732e31b74 refactor(mcp): broadcast notifications from session snapshots 2026-04-02 17:32:23 +00:00
Virgil
6e1a7d7d2a refactor(mcp): expose notification method constants 2026-04-02 17:28:30 +00:00
Virgil
5edaa7ead1 fix(mcp): align webview error handling 2026-04-02 17:23:49 +00:00
Virgil
a3c39ccae7 fix(agentic): release issue lock on dispatch failure 2026-04-02 17:18:55 +00:00
Virgil
1873adb6ae Fix MCP bridge test wiring 2026-04-02 17:14:36 +00:00
Virgil
da30f3144a refactor(mcp): record subsystem tools centrally
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 17:11:16 +00:00
Virgil
a215428df8 feat(mcp): add client notification aliases 2026-04-02 17:03:11 +00:00
Virgil
b6aa33a8e0 feat(mcp): improve tool schema generation 2026-04-02 16:58:53 +00:00
Virgil
c83df5f113 feat(agentic): surface workspace metadata in status output 2026-04-02 16:50:50 +00:00
Virgil
6b78f0c137 feat(mcp): add server resource listing 2026-04-02 16:47:03 +00:00
Virgil
4ab909f391 docs(mcp): add usage examples to agentic DTOs 2026-04-02 14:54:37 +00:00
Virgil
ffcd05ea1f chore(mcp): restore SPDX headers in public Go files
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 14:48:46 +00:00
Virgil
555f9ec614 refactor(mcp): expose channel callback subsystem contract
Make the func-based channel wiring contract explicit instead of relying on an anonymous interface inside New(). This keeps the extension point discoverable and aligned with the repository's AX-style API clarity.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 14:43:06 +00:00
Virgil
94cf1c0ba7 fix(mcp): harden notification metadata and logging
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 14:36:33 +00:00
Virgil
fa9a5eed28 refactor(mcp): add typed channel capability helper
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 14:30:04 +00:00
Virgil
af3cf3c8e3 docs(mcp): add usage examples to remaining public DTOs
Align the IDE bridge and brain subsystem public types with the repo's AX-style comment convention by adding concrete usage examples for bridge messages, DTOs, and helper callbacks.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 14:17:47 +00:00
Virgil
2a4e8b7ba3 fix(mcp): snapshot exposed service slices
Return copies from service accessors and ignore nil subsystems during construction to keep the MCP service API stable and AX-friendly.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 14:10:53 +00:00
Virgil
aae824a4d0 docs(mcp): align notification API docs with AX conventions
Reorder subsystem notification wiring so channel callbacks are available before tool registration, and add usage-example comments to the public notification DTOs and helpers.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 14:06:21 +00:00
Virgil
072a36cb73 test(mcp): cover multi-session notification fanout 2026-04-02 13:57:33 +00:00
Virgil
8b7e0c40a6 fix(mcp): harden session notification dispatch 2026-04-02 13:54:12 +00:00