Commit graph

64 commits

Author SHA1 Message Date
Snider
57fb08928c chore: bump forge.lthn.ai dep versions to latest tags
All checks were successful
Security Scan / security (push) Successful in 15s
Test / test (push) Successful in 11m19s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-26 05:34:22 +00:00
ab5d4614f9 Merge pull request 'chore: replace chat.js with TypeScript-built bundle' (#2) from chore/lem-chat-typescript-bundle into main
All checks were successful
Security Scan / security (push) Successful in 15s
Test / test (push) Successful in 2m35s
2026-02-24 18:25:23 +00:00
Claude
12d326edd9
chore: replace monolithic chat.js with TypeScript-built bundle
All checks were successful
Security Scan / security (pull_request) Successful in 11s
Test / test (pull_request) Successful in 2m50s
Updated chat.js is now built from TypeScript source in core/go/lem-chat/
via esbuild. Functionally identical, 15KB ESM bundle (was 833 lines,
now 556 — esbuild compacts class syntax).

Source: forge.lthn.ai/core/go → lem-chat/src/

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 18:24:22 +00:00
8f3722f7bd Merge pull request 'chore: Go 1.26 modernization' (#1) from chore/go-1.26-modernization into main
All checks were successful
Security Scan / security (push) Successful in 7s
Test / test (push) Successful in 2m51s
2026-02-24 18:01:42 +00:00
Claude
b1e6787b24
chore: use slices.Sorted(maps.Keys()) for ordered iteration
Some checks failed
Security Scan / security (pull_request) Successful in 11s
Test / test (pull_request) Failing after 15m27s
2026-02-24 16:03:25 +00:00
Claude
4060bc28a3
chore: use range-over-integer (Go 1.22+) 2026-02-24 16:02:32 +00:00
Claude
bf911d7298
chore: use min()/max() builtins (Go 1.21+) 2026-02-24 16:02:03 +00:00
Claude
2c2f2784a9
chore: sort.Slice → slices.SortFunc 2026-02-24 16:00:38 +00:00
Claude
7ae5fee661
chore: fmt.Errorf(static) → errors.New 2026-02-24 15:58:11 +00:00
Claude
8ef36f98ca
chore: replace interface{} with any (Go 1.18+ alias) 2026-02-24 15:57:27 +00:00
Claude
f413111f08
docs: archive completed backend-result-type plan
All checks were successful
Security Scan / security (push) Successful in 10s
Test / test (push) Successful in 2m40s
Move backend-result-type plan to docs/plans/completed/ with summary.
Unified Result struct now used across all ML backends.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 13:51:21 +00:00
Snider
0cf35221e6 docs: document InspectAttention pass-through on InferenceAdapter
All checks were successful
Security Scan / security (push) Successful in 12s
Test / test (push) Successful in 2m31s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 12:34:32 +00:00
Snider
08c8cddbe4 chore: bump forge.lthn.ai dep versions to latest tags
All checks were successful
Security Scan / security (push) Successful in 12s
Test / test (push) Successful in 7m49s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:49:43 +00:00
Snider
e550d7e428 chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig)
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:45:41 +00:00
Snider
19807bf0be chore: refresh go.sum after upstream tag updates
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:35:19 +00:00
Snider
5340a975a7 refactor: modernise to Go 1.26 — iterators, slices, maps
Some checks failed
Security Scan / security (push) Successful in 9s
Test / test (push) Failing after 41s
- Add DiscoverCheckpointsIter, FindUnscoredIter (iter.Seq2/iter.Seq)
- Add BackendsIter on Service
- Replace sort.Slice with slices.SortFunc, sort.Strings with slices.Sort
- Replace manual map-key-collect-sort with slices.Sorted(maps.Keys(...))
- Refactor ProbeCategories to use slices.Sorted with inline iterator
- Existing slice-returning methods preserved, backed by new iterators

Co-Authored-By: Gemini <noreply@google.com>
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:11:55 +00:00
Claude
fc41c6f520
ci: add Forgejo Actions test and security scan workflows
Some checks failed
Security Scan / security (push) Successful in 10s
Test / test (push) Failing after 34s
Uses reusable workflows from core/go-devops for Go testing
(with race detector and coverage) and security scanning
(govulncheck, gitleaks, trivy).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 03:29:04 +00:00
Snider
45e9fed280 feat: add InspectAttention pass-through on InferenceAdapter
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 00:37:37 +00:00
Claude
1c5fd160f2
chore: refresh go.sum after upstream tag updates
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 23:36:25 +00:00
Snider
9d74275568 refactor: migrate CLI imports from core/go to core/cli
Update imports from forge.lthn.ai/core/go/pkg/cli to
forge.lthn.ai/core/cli/pkg/cli following CLI package split.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 23:29:51 +00:00
Claude
1110eac4a5
chore: sync workspace dependency versions
Run go work sync to align dependency versions across workspace.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:42:15 +00:00
Snider
a6fb45da67 refactor: apply go fix modernizers for Go 1.26
Automated fixes: interface{} → any, range-over-int, t.Context(),
wg.Go(), strings.SplitSeq, strings.Builder, slices.Contains,
maps helpers, min/max builtins.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 21:00:16 +00:00
Snider
ab14be25cc chore: bump go directive to 1.26.0
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 20:33:48 +00:00
Snider
86fc6a0138 chore: pin forge deps to v0.0.1 tags for Go 1.26 compat
Go 1.26 rejects non-semver version strings (like 'main') in go.mod.
Tags v0.0.1 now exist on all forge repos — workspace still overrides
for local development.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 20:15:06 +00:00
Snider
926fb268f6 chore: use workspace-resolved versions, drop replace directives
Forge module versions now use main branch resolution via ~/Code/go.work
workspace. Removes local replace directives — the central go.work handles
all cross-repo resolution during development.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 19:49:36 +00:00
Snider
950b67d25d chore: add missing go-i18n dependency via go mod tidy
Pre-existing issue: cmd/cmd_benchmark.go imports go-i18n/reversal
but the dependency was absent from go.mod.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:48:36 +00:00
Snider
7601614e07 test: update all test assertions for Result type
All Backend.Generate/Chat calls now return Result. Test assertions
updated to use .Text and check .Metrics where appropriate.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:45:32 +00:00
Snider
3b6dba5d85 refactor(cmd): unwrap Result.Text across all commands
Updates cmd_ab, cmd_sandwich, cmd_lesson, cmd_sequence,
cmd_benchmark, cmd_serve, and api/routes.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:41:16 +00:00
Snider
ef44f0ae25 refactor: unwrap Result.Text in expand, judge, agent_eval
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:39:17 +00:00
Snider
22cc1a5afd refactor(service): Generate returns Result
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:38:14 +00:00
Snider
44e063c1fa refactor(http-textmodel): unwrap Result.Text from Backend calls
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:37:56 +00:00
Snider
52f27fc476 feat(llama): return Result from Generate/Chat
Delegates to HTTPBackend which already returns Result.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:37:34 +00:00
Snider
8a36bafa83 feat(http): return Result from Generate/Chat
HTTP backend returns Result{Text: text} with nil Metrics since
remote APIs don't provide Metal-level inference metrics.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:37:18 +00:00
Snider
d90bd7b779 feat(adapter): return Result with Metrics from TextModel
InferenceAdapter.Generate and Chat now return Result{Text, Metrics}
where Metrics is populated from the underlying TextModel.Metrics().

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:36:53 +00:00
Snider
5578671f90 feat: add Result type, break Backend interface to return Result
Backend.Generate and Backend.Chat now return (Result, error) instead of
(string, error). Result carries the response text and optional
inference.GenerateMetrics for backends that support them.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 17:36:16 +00:00
Snider
dcf58d041d feat: add Ubuntu workstation setup script from CLI
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-21 21:20:13 +00:00
Snider
812c926dac feat: migrate cmd/ml from CLI repo, resolve forge deps
Move all 40 ML command files from core/cli/cmd/ml to go-ml/cmd/.
Commands self-register via init() + cli.RegisterCommands().

- Fixed stale go-ai/ml import in cmd_ab.go (now uses go-ml + go-mlx)
- Disabled cmd_train.go (needs go-mlx training API export)
- Removed all local replace directives, deps resolve from forge
- go build ./... passes cleanly

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-21 19:14:58 +00:00
Snider
0c238589af feat(api): add REST route group for ML endpoints via go-api
Implements RouteGroup and StreamGroup interfaces from go-api, exposing
ML inference service methods as REST endpoints: GET /backends, GET /status,
POST /generate. Includes 12 integration tests covering interface satisfaction,
engine registration, envelope format, and error handling.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 16:00:52 +00:00
Snider
861e44fedd docs: add README with quick start and docs links
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 15:11:19 +00:00
Snider
3918051112 docs: graduate TODO/FINDINGS into production documentation
Replace internal task tracking (TODO.md, FINDINGS.md) with structured
documentation in docs/. Trim CLAUDE.md to agent instructions only.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 15:01:55 +00:00
Claude
7075d7cbe7
fix(go.mod): correct replace path for core/go
Was ../host-uk/core (wrong), now ../go matching workspace layout.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 14:22:47 +00:00
Snider
74ebbe634c docs: mark deferred items complete in TODO — all phases done
Memory controls handled by go-mlx internally. Integration smoke test
covered by Phase 4 mock tests; real-model test deferred to LEM Lab.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 12:45:28 +00:00
Snider
1fc4c640ff docs: mark Phase 4 test coverage complete — all phases done
25 benchmarks baselined on M3 Ultra, 34 backend tests, 6 race-condition
tests. go test -race clean.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:49:54 +00:00
Snider
09bf40301d test: add Phase 4 test coverage and benchmarks
Backend tests: LlamaBackend (20 tests via httptest mock), MLX/InferenceAdapter
(8 tests via mock TextModel). Race condition tests: concurrent scoring (20
responses), mixed suites fan-out, semaphore boundary (concurrency=1), context
cancellation, heuristic-only (50 responses), multi-model concurrent map writes.
Benchmarks: heuristic (5 sizes), exact match (4 patterns), JSON extraction
(6 variants), judge round-trip (2 suites), ScoreAll (2 modes), sub-components
(5 heuristic stages). All pass with -race.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:49:07 +00:00
Snider
c925391174 docs: mark Phase 3 Step 3.4 agent tests complete — Phase 3 done
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:23:43 +00:00
Snider
3e227610fe test: add agent subsystem tests (25 tests, 528 LOC)
Tests for AdapterMeta (model family → tag/prefix/stem mapping),
FindUnscored (checkpoint filtering), BufferInfluxResult/ReplayInfluxBuffer
(JSONL persistence round-trip), and DiscoverCheckpoints (SSH output parsing
via fakeTransport mock implementing RemoteTransport interface).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:23:13 +00:00
Snider
987831bd16 docs: mark Phase 3 Step 3.3 configurable infrastructure complete
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:18:38 +00:00
Snider
12f3a1c79d refactor: extract hardcoded values into package constants
Move magic numbers and strings into named constants in agent_config.go:
- EpochBase (was 1739577600 in 5 locations)
- 5 InfluxDB measurement names (capability_score, probe_score, etc.)
- 2 DuckDB table names (checkpoint_scores, probe_results)
- Probe defaults (temperature, max tokens, response truncation)
- InfluxBufferFile, LogSeparatorWidth, InterCheckpointDelay

Replace hardcoded probe counts ("23", "6") with len(CapabilityProbes),
len(ContentProbes). 7 files modified, no functional changes.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:18:19 +00:00
Snider
6f6bdd7c5c docs: mark Phase 3 Step 3.2 RemoteTransport complete
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:10:08 +00:00
Snider
1c2a6a6902 feat: add RemoteTransport interface for SSH abstraction
Introduce RemoteTransport interface (Run, CopyFrom, CopyTo) with
SSHTransport implementation using ssh/scp binaries. AgentConfig gains
a Transport field with lazy initialization from M3 credentials.

All internal callers (DiscoverCheckpoints, processMLXNative,
processWithConversion) now use cfg.transport() instead of global
SSHCommand/SCPFrom. Old functions preserved as deprecated wrappers.

Enables mock injection for testing agent loop without real SSH.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 03:09:42 +00:00