Commit graph

23 commits

Author SHA1 Message Date
Snider
67658ec90c fix: imports forge.lthn.ai/core/mcp → dappco.re/go/mcp
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 21:40:04 +00:00
Snider
919dcf963f feat: factories return instances — WithService handles registration
Register factories no longer call c.RegisterService() explicitly.
WithService auto-discovers name from package path and registers.
Eliminates double-registration error.

Uses WithOption("name", "core-agent") for Options struct.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 20:36:17 +00:00
Snider
adafee0f18 feat: use RegisterService + ServiceFor — proper instance lifecycle
- agentic.PrepSubsystem implements Startable/Stoppable
- monitor.Subsystem implements Startable/Stoppable (OnStartup/OnShutdown)
- Register factories use c.RegisterService() — auto-discovers interfaces
- Register factories return instances via Result.Value
- main.go uses ServiceFor[T]() instead of ConfigGet — typed retrieval
- No more c.Config().Set("x.instance") workaround

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 17:42:16 +00:00
Snider
4e69daf2da feat: replace initServices() with core.New() service conclave
Services are now registered during Core construction:
  core.New(
      core.WithService(agentic.Register),
      core.WithService(monitor.Register),
      core.WithService(brain.Register),
  )

- Remove initServices() closure — services created once in conclave
- Commands use c.ServiceStartup()/c.ServiceShutdown() for lifecycle
- Service instances retrieved via c.Config() for MCP tool registration
- run/orchestrator reduced to ServiceStartup + block + ServiceShutdown
- run/task uses conclave's agentic instance

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 16:33:04 +00:00
Snider
9f8a63ae21 feat: Register() factories + consume new core.New() API
Each package exposes Register(c *Core) Result for core.WithService():
- agentic.Register: creates PrepSubsystem, wires IPC handlers, lifecycle
- monitor.Register: creates Subsystem, wires IPC handler, lifecycle
- brain.Register: creates Direct, registers service

main.go updated for core.New() returning Result.
Ready for core.New(WithService(agentic.Register)) pattern.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 16:23:44 +00:00
Snider
ed842122a2 fix(brain): resolve direct AX findings
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 13:02:37 +00:00
Snider
4f66eb4cca fix: resolve final AX audit findings
- cmd/main.go: keyed core.Result literals (go vet clean)
- pkg/brain/direct.go: compile-time mcp.Subsystem assertion
- pkg/monitor/monitor.go: compile-time Subsystem + CompletionNotifier assertions
- pkg/agentic/prep.go: alias stdlib io as goio
- pkg/agentic/remote_client.go: UK English (initialise/initialised)
- pkg/monitor/monitor_test.go: updated inbox tests for current contract

AX audit now returns 0 convention findings.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:42:42 +00:00
Snider
a0dc9c32e7 refactor: migrate core/agent to Core primitives — reference implementation
Phase 1: go-io/go-log → core.Fs{}, core.E(), core.Error/Info/Warn
Phase 2: strings/fmt → core.Contains, core.Sprintf, core.Split etc
Phase 3: embed.FS → core.Mount/core.Embed, core.Extract
Phase 4: cmd/main.go → core.Command(), c.Cli().Run(), no cli package

All packages migrated:
- pkg/lib (Codex): core.Mount, core.Extract, Result returns, AX comments
- pkg/setup (Codex): core.Fs, core.E, fixed missing lib helpers
- pkg/brain (Codex): Core primitives, AX comments
- pkg/monitor (Codex): Core string/logging primitives
- pkg/agentic (Codex): 20 files, Core primitives throughout
- cmd/main.go: pure Core CLI, no fmt/log/filepath/strings/cli

Remaining stdlib: path/filepath (Core doesn't wrap OS paths),
fmt.Sscanf/strings.Map (no Core equivalent).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:13:41 +00:00
Snider
6db0110b6f refactor(brain): consolidate newFs and agentName wrappers
Remove duplicated newFs() from brain package — use agentic.LocalFs() instead.
Inline agentName() wrapper — call agentic.AgentName() directly.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 03:47:08 +00:00
Snider
deaa06a54d refactor(pkg): migrate go-io/go-log to Core primitives
Replace separate go-io (coreio) and go-log (coreerr) packages with
Core's built-in Fs and error/logging functions. This is the reference
implementation for how all Core ecosystem packages should migrate.

Changes:
- coreio.Local.Read/Write/EnsureDir/Delete/IsFile → core.Fs methods
- coreerr.E() → core.E(), coreerr.Info/Warn/Error → core.Info/Warn/Error
- (value, error) return pattern → core.Result pattern (r.OK, r.Value)
- go-io and go-log moved from direct to indirect deps in go.mod
- Added AX usage-example comments on key public types
- Added newFs("/") helper for unrestricted filesystem access

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 03:41:07 +00:00
Snider
c6490c175a refactor: migrate imports to dappco.re paths + bump mcp to v0.4.0
Update all go-* imports from forge.lthn.ai to dappco.re/go/core/*.
Bump mcp to v0.4.0 (Options{} struct API).
Versions: core v0.5.0, io v0.2.0, log v0.1.0, process v0.3.0,
ws v0.3.0, ai v0.2.0, webview v0.2.0, i18n v0.2.0.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 01:27:48 +00:00
Snider
66220021c9 fix: address Codex round 5 findings — 2 high, 5 medium, 4 low
Some checks failed
CI / test (push) Failing after 3s
High: clean stale BLOCKED.md before spawn (prevents stuck workspaces)
High: agentic_create_pr pushes to Forge URL, not local origin

Medium: watch treats merged/ready-for-review as terminal states
Medium: scan paginates org repos (was limited to first 50)
Medium: agent_conversation URL-encodes agent names (injection fix)

Low: inbox/sync/monitor URL-encode agent names in query strings
Low: pullWiki closes response body on non-200 (connection leak)

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 16:53:55 +00:00
Snider
0a77b058b6 test(brain): add unit tests for recall, remember, messaging
Coverage: 5.3% → 92.8%. Tests cover DirectSubsystem (apiCall, remember,
recall, forget via httptest), messaging (sendMessage, inbox, conversation,
parseMessages, toInt), BrainProvider (gin handlers, routes, describe,
status), Subsystem bridge-backed handlers, and RegisterTools.

Also fixes build error in dispatch.go (removed KillGroup, Timeout,
GracePeriod fields no longer in process.RunOptions).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 13:46:33 +00:00
Snider
21f234aa7c refactor: flatten go/ subdir, migrate to dappco.re/go/agent, restore process service
- Module path: dappco.re/go/agent
- Core import: dappco.re/go/core v0.4.7
- Process service re-enabled with new Core API
- Plugin bumped to v0.11.0
- Directory flattened from go/ to root

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 11:10:44 +00:00
Snider
be1130f470 agent updates 2026-03-21 11:10:44 +00:00
Snider
6d04c893b7 fix: address all code review findings (medium + low)
- os.ReadFile/WriteFile → coreio.Local in monitor and remote packages
- Deduplicate agentName() → shared agentic.AgentName()
- Deduplicate workspaceRoot() → shared agentic.WorkspaceRoot()
- fileExists uses IsFile() instead of reading whole file
- Fix SPDX-Licence → SPDX-License typo
- Remove time.Now import hack
- Fix hardcoded PR #1 in review queue

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-17 19:19:04 +00:00
Snider
4832827da7 fix: address code review findings (critical + high)
Critical:
- Fix token leaked in URL query string (getLabelID) — now uses Authorization header
- Fix unchecked type assertion panic in parseMessages — safe toInt() helper

High:
- Remove dead canDispatch() function
- Remove time.Now import hack from mirror.go
- Remove invalid --no-force git flag from mirror.go
- Tidy go.mod (remove unused deps from deleted packages)

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-17 19:12:06 +00:00
Snider
5eb26f90fc refactor: replace fmt.Errorf/os.* with go-io/go-log conventions
Replace all fmt.Errorf and errors.New in production code with
coreerr.E("caller.Method", "message", err) from go-log. Replace
all os.ReadFile/os.WriteFile/os.MkdirAll/os.Remove with coreio.Local
equivalents from go-io. Test files are intentionally untouched.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-16 21:48:31 +00:00
Snider
5f83cf902a fix: messaging routes use auth.api, fix InboxInput schema
- Remove messaging routes from core/agent (conflict with AgentApiAuth)
- Routes now only in host app with auth.api middleware (same as brain)
- Add Agent field to InboxInput so MCP schema isn't empty

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-16 15:11:10 +00:00
Snider
37f6d61368 feat: agent messaging — direct chronological messages between agents
New: agent_send, agent_inbox, agent_conversation MCP tools.
API: /v1/messages/send, /v1/messages/inbox, /v1/messages/conversation/{agent}
Model: AgentMessage with inbox, unread, conversation scopes.

Separate channel from semantic brain search. Messages are chronological,
not vector-searched. Agents can now have direct conversations.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-16 14:03:36 +00:00
Snider
85dd0555ac fix(brain): shared brain — don't filter by agent_id on recall
Was forcing agent isolation. Now all agents see all memories by default.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-16 11:50:20 +00:00
Snider
5fbaf4f211 fix(brain): use hostname-based agent_id instead of hardcoded cladius
Charon gets agent_id 'charon', Cladius gets 'cladius'.
Override with AGENT_NAME env var.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-16 11:24:59 +00:00
Snider
2ea50959f2 refactor: move brain + agentic packages into core/agent, use core/cli
Brain and agentic subsystems now live in core/agent/pkg/ instead of
core/mcp/pkg/mcp/. core-agent binary uses core/cli for proper command
framework. Usage: core-agent mcp

One repo, one clone, everything works.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-16 11:10:33 +00:00