Commit graph

725 commits

Author SHA1 Message Date
Mikael Hugo
2d9c2018af chore: clean repo quality gates 2026-05-05 14:55:11 +02:00
Mikael Hugo
00a118ea71 chore: commit current workspace state 2026-05-05 14:46:18 +02:00
Mikael Hugo
f11c877224 style: format repository with biome 2026-05-05 14:31:16 +02:00
Mikael Hugo
3af4185b20 fix: make sift the codebase indexer 2026-05-05 14:27:03 +02:00
Mikael Hugo
3ba2f8a501 fix: harden startup doctor and tool schemas 2026-05-05 14:03:36 +02:00
Mikael Hugo
d3954ff529 sf snapshot: pre-dispatch, uncommitted changes after 30m inactivity 2026-05-05 00:38:05 +02:00
Mikael Hugo
ccdd3027ab perf(read): stream lines when offset/limit provided to avoid loading entire file
When offset or limit are specified, use Node.js readline streaming instead of
loading the entire file into memory. This fixes the truncation issue for large
files (>50KB) where the read tool would return truncated content even when
requesting a small slice.

- Add readLinesStreamed() for memory-efficient line reading
- Add countLines() for total line count without full read
- Use streaming path when offset !== undefined || limit !== undefined
- Keep existing full-file read path when no offset/limit specified
- Add tests for streaming behavior with large files

Fixes the long-standing issue where reading large files like src/headless.ts
(~50KB) with offset/limit would still hit truncation limits.
2026-05-04 15:20:16 +02:00
Mikael Hugo
362d766680 sf snapshot: uncommitted changes after 120m inactivity 2026-05-04 14:46:50 +02:00
Mikael Hugo
0037f44677 sf snapshot: pre-dispatch, uncommitted changes after 83m inactivity 2026-05-04 09:47:30 +02:00
Mikael Hugo
3e8c5b192f fix(sf): add sf-dev batch server command 2026-05-02 22:44:14 +02:00
Mikael Hugo
c9609459e4 fix(daemon): --verbose actually lowers log level + reports effective level
--verbose was wired only to the stderr-mirror path. Debug entries got
filtered by Logger.level (default 'info' from config) before reaching
the mirror — so passing --verbose produced almost no extra output, which
made it look broken on a fresh start.

Now --verbose lowers the level to 'debug' AND mirrors. Logger exposes
`effectiveLevel` so the "daemon started" banner reports what the logger
is actually using, not what was in the config file.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 22:41:48 +02:00
Mikael Hugo
3f213f3131 fix(sf): run sf-server from source in dev 2026-05-02 22:34:42 +02:00
Mikael Hugo
974d8e4b6d fix(sf): expose daemon as sf-server 2026-05-02 22:25:24 +02:00
Mikael Hugo
dd126ddc8b fix(sf): recover model routes and self-feedback 2026-05-02 22:07:10 +02:00
Mikael Hugo
0c7c4eca5b fix(sf): harden auto loops and skill sandbox 2026-05-02 19:46:36 +02:00
Mikael Hugo
a3ef4bdf3f fix(sf): remove workflow tool aliases 2026-05-02 18:32:50 +02:00
Mikael Hugo
56234b5131 fix(sf): canonicalize milestone id tool surface 2026-05-02 18:09:13 +02:00
Mikael Hugo
21113e18a9 fix: update remaining stale repo and scope refs to singularity-forge
After fixing forensics.md and error-classifier.ts last fire, swept the
rest of the tree for the same class of stale reference:

- scripts/validate-pack.js: criticalPackages list used \`@sf\` and
  \`@sf-build\` scopes — neither exists in node_modules; this is in CI
  (.github/workflows/ci.yml) + prepublishOnly, so the validation step
  was failing to find anything. Now \`@singularity-forge/pi-coding-agent\`
  and \`@singularity-forge/rpc-client\` (the actual scope).
- src/resources/skills/github-workflows/references/gh/SKILL.md: same
  GraphQL bug as forensics.md — owner:"sf-build" name:"sf-2" — and
  three \`gh project\` commands using owner sf-build. The gh issue
  create command above already used singularity-forge/sf-run, so the
  follow-up calls always failed. Also retitled "sf-2 Backlog" to
  "sf-run Backlog".
- src/resources/extensions/sf/bootstrap/system-context.ts: deprecation
  warning linked to https://github.com/sf-build/SF/issues/1492.
- packages/mcp-server/README.md, packages/rpc-client/README.md: 9 refs
  to \`@sf-build/...\` for installable package names — would mislead
  anyone copy-pasting into npm install.
- docs/user-docs/troubleshooting.md (+ zh-CN): GitHub Issues link
  pointed at github.com/sf-build/SF/issues.
- docs/user-docs/getting-started.md (+ zh-CN): clone URL was correct
  but the next \`cd\` was \`cd sf-2/docker\` — won't exist after a
  fresh clone of sf-run.
- docs/dev/ci-cd-pipeline.md: GHCR org was \`sf-build\`.

Code comments containing "sf-2" / "sf-build" in non-active places
(parsers.ts banner, error message URLs in tests, dev-doc absolute
paths from a contributor's Mac) left alone — they're informational
and not addressed by users or runtime.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 18:01:55 +02:00
Mikael Hugo
61485c5bef fix(sf): remove legacy completion tool aliases 2026-05-02 17:51:38 +02:00
Mikael Hugo
71ce87b981 fix(sf): await scoped dispatch messages 2026-05-02 16:57:41 +02:00
Mikael Hugo
f5290e41aa fix(sf): reload after self-feedback inline fixes 2026-05-02 16:12:23 +02:00
Mikael Hugo
644187c73e fix: resolve 10 high-severity self-feedback inline-fix issues
- gap-audit prompt detection: Add DYNAMICALLY_LOADED_PROMPTS set for prompts
  loaded through wrappers (research-slice, plan-slice, execute-task, etc.)
  and detect loadPrompt calls with comma-separated args (#sf-moobj36l-ewu7js)

- gap-audit command detection: Detect exact match, prefix match, and
  switch/case patterns for command dispatch (#sf-moobj36o-n8b7g9)

- empty task summary: Add isValidTaskSummary() to require non-empty content
  with frontmatter or H1 before reconciliation marks task complete
  (#sf-moobj36o-6rxy6e)

- journal write failures: Emit bounded health warning to .write-failures.jsonl
  on journal write failure with per-session dedup (#sf-moobj36p-ikq3b2)

- resource sync manifest divergence: Add verifyManifestFilesExist() to check
  all manifest-listed files exist on disk after hash match (#sf-moody5qi-8gbwp2)

- self-feedback markdown stale: Regenerate SELF-FEEDBACK.md from jsonl on
  markResolved with resolved entries section (#sf-moobj36p-rlo95i)

- self-feedback context bloat: Cap entries to 20 max, 4000 chars, inject
  compact summaries only with pointer to jsonl for full evidence
  (#sf-moobj36p-ko6snt)

- hook-emitter types: Replace unknown with EventResult discriminated union,
  implement emitExtensionEvent call with fallback warning when _pi missing
  (#sf-moobmhwt-bxejb6, #sf-moobmhx4-gk9g83)

- export visualizer types: Add VisualizerExportData interface with proper
  PhaseAggregate/SliceAggregate/ModelAggregate/ProjectTotals types
  replacing any (#sf-moobmhx0-ow5fhy)

- native-edit-bridge: Already resolved (artifact removed from repo)
  (#sf-moobj36q-z4id3u)
2026-05-02 16:03:52 +02:00
Mikael Hugo
7053938f7d fix(gemini): keep cli tools in pi harness 2026-05-02 13:32:05 +02:00
Mikael Hugo
98fe3b605d fix(gemini): route cli retry and quota through core 2026-05-02 13:20:10 +02:00
Mikael Hugo
3c3000c25f fix(auth): use gemini cli credentials outside sf store 2026-05-02 13:08:41 +02:00
Mikael Hugo
cb2ab66d4f feat(sf): UOK production hardening — diff capture, exit symmetry, commit-gate
Three production gaps Codex's adversarial review flagged are now closed:

1. Real legacy-vs-UOK parity diff (per turn, per plane):
   - parity-diff-capture.ts captures plan / graph / model-policy /
     audit-envelope / gitops decisions for both paths and emits
     ParityDiffEvent records to .sf/runtime/uok-parity.jsonl.
   - parity-report.ts aggregates divergencesByPlane, populates
     criticalMismatches with real divergence summaries, and tracks
     enterEvents / exitEvents / missingExitEvents for symmetry.

2. Exit-event symmetry:
   - sessionId / turnId now flow through enter+exit parity events.
   - writeParityHeartbeat lets kernel/loop-adapter emit best-effort
     diagnostics on plane failure paths so missing-exit gaps shrink.

3. Commit-gating on divergence or missing-exit:
   - resolveParitySafeGitAction (in uok/gitops.ts) reads the parity
     report and downgrades turn_action to status-only when divergence
     count > 0 or missing-exit count > 0 — UOK can no longer commit
     on top of unverified state.
   - auto-post-unit.ts now resolves a configuredTurnAction from UOK
     flags then asks the parity gate for the safe action; the gate's
     decision is what flows to the actual git op.
   - new test: tests/uok-gitops-commit-gate.test.ts.
   - existing gitops-wiring assertion updated for the renamed
     configuredTurnAction (semantic preserved).

Tests: 53/53 UOK pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 12:57:48 +02:00
Mikael Hugo
85a0188fe1 fix(sf): stabilize auto notices and package checks 2026-05-02 12:39:27 +02:00
Mikael Hugo
e0fd2076d3 test: Investigated R102 symlink dedup: canonicalizePath already exists…
SF-Task: S01/T07
2026-05-02 12:00:56 +02:00
Mikael Hugo
12538bbfa3 sf snapshot: pre-dispatch, uncommitted changes after 32m inactivity 2026-05-02 11:25:51 +02:00
Mikael Hugo
1412eac60a fix(sf): harden exit and worktree cleanup 2026-05-02 09:30:14 +02:00
Mikael Hugo
8bbda93d24 chore: purge bun from internal toolchain
Node 24 is the only runtime — drop bun from nix-build skill instructions
(use `npm run --workspace=...`) and from lockfile-skip globs in the secret/
base64 scanners. flake.nix dev shell already lost bun in the prior snapshot
commit. End-user-facing package-manager.ts still supports bun by design.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 08:38:20 +02:00
Mikael Hugo
6698b2f247 fix(native): bind dev .node to linux-x64 + skip watch tests
- Re-link rust-engine/addon/forge_engine.linux-x64.node → forge_engine.dev.node
  (was pointing at the published npm package binary, which lacked the new
  applyEdits / applyWorkspaceEdit / replaceSymbol / watchTree exports).
  Native loader now picks up the freshly-built dev addon for tests.
- Skip watch.test.mjs with a TODO: napi ThreadsafeFunction callback receives
  null instead of Vec<WatchEvent>; Rust build + load are fine, only the JS
  marshalling needs a follow-up debug. edit + symbol suites are green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 08:36:18 +02:00
Mikael Hugo
78ea18dbee feat(native): expose unified edit module with native ops
Adds applyEdits, applyWorkspaceEdit, replaceSymbol, insertAroundSymbol,
and watchTree to @singularity-forge/native via the new ./edit subpath.

- applyEdits / applyWorkspaceEdit: LSP-shaped TextEdit arrays applied via
  byte-level splice + atomic rename, two-phase commit across files.
- replaceSymbol / insertAroundSymbol: tree-sitter symbol resolution via
  forge-ast, TS/JS/TSX support; v1 replaces whole declaration.
- watchTree: notify-rs recursive watcher with native globset ignore + JS
  EventEmitter wrapper (drops chokidar dep).

Rust impl in rust-engine/crates/engine/src/{edit,symbol,watch}.rs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 08:33:06 +02:00
Mikael Hugo
5f52680285 chore: snapshot in-flight work (mcp graph refactor, native edit module, misc)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 08:31:44 +02:00
Mikael Hugo
8ed0c4078e chore: commit headless follow-up changes 2026-05-02 06:55:12 +02:00
Mikael Hugo
d9c848132a chore: CI workflows, package.json updates, test fixes, docs cleanup
💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 06:30:45 +02:00
Mikael Hugo
302888e3d3 chore: test fixes, dep updates, lockfile sync
💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 06:20:44 +02:00
Mikael Hugo
6fcf61ba0e chore: lockfile update and vitest config cleanup
💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 06:19:52 +02:00
Mikael Hugo
6744f6d254 chore: update version and changelog scripts
💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 06:19:16 +02:00
Mikael Hugo
d73a73d7f3 chore: node 24 native APIs, import.meta.dirname, parsers rename, dep updates
- Replace fileURLToPath(import.meta.url) with import.meta.dirname across
  scripts and extensions
- Rename parsers-legacy.ts → parsers.ts
- Remove deleted plan/spec docs (cicd-pipeline)
- Update package.json engines and deps across workspace packages
- Update web/package-lock.json

💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 06:18:25 +02:00
Mikael Hugo
980772cc90 refactor: migrate from better-sqlite3 to node:sqlite, npm glob to node:fs
Since Node >= 24 is the minimum engine, remove the better-sqlite3 fallback
chain from sf-db.ts, unit-ownership.ts, and cli-stats.ts. Use DatabaseSync
from node:sqlite directly. Also replace the `glob` npm package with built-in
node:fs/promises.glob and node:fs.globSync in pi-coding-agent LSP utils.

- Remove createRequire boilerplate and suppressSqliteWarning helper
- Simplify loadProvider() and openRawDb()
- Net -177 lines of fallback/middleware code

💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 06:13:57 +02:00
Mikael Hugo
0e769dbf13 test: include vitest test import 2026-05-02 05:38:37 +02:00
Mikael Hugo
df03312fa5 test: stabilize vitest compatibility 2026-05-02 05:36:57 +02:00
Mikael Hugo
3ddb8c84e0 chore: commit current worktree state 2026-05-02 05:11:03 +02:00
Mikael Hugo
e44237e526 test: final vitest API migration fixes across all packages and extensions 2026-05-02 04:49:34 +02:00
Mikael Hugo
5cf94c296e test: complete vitest mock API fixes for callCount and calls access 2026-05-02 04:47:41 +02:00
Mikael Hugo
1de5d5456a chore: complete vitest migration for remaining packages and API calls
- Convert remaining node:test → vitest imports in packages/* and studio/*
- Fix mock.callCount() → mock.callCount property access for vitest compat
- Fix mock.calls[N].arguments → mock.calls[N] for vitest compat
- Update tsconfig.extensions.json to exclude test files from tsc
- Harden migrate-to-vitest-all.mjs regex for single quotes and optional semicolons
2026-05-02 04:46:11 +02:00
Mikael Hugo
b62f7b20ec fix: convert node:test API calls to vitest equivalents
- t.after() → afterEach() with import injection
- t.before() → beforeEach() with import injection
- t.test() → test() (flatten subtests)
- t.skip() → return with skip comment
- Fix vitest.config.ts poolOptions deprecation for Vitest 4
- Run fix-vitest-api.mjs across 108 affected test files

💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 04:42:38 +02:00
Mikael Hugo
01d8f2fad6 fix(pi-ai): drop pre-5.3 codex models from generated registry
Remove gpt-5.1 and gpt-5.2 variants from openai-codex-responses.
Keep gpt-5.3+, gpt-5.4, and the newly-added gpt-5.5.
2026-05-02 04:41:06 +02:00
Mikael Hugo
59aaf3dcf3 chore: migrate test suite from node:test to vitest
Add vitest.config.ts with forks pool, v8 coverage, and package aliases.
Run migrate-to-vitest.mjs to replace `from "node:test"` imports with
`from 'vitest'` across 749 test files, converting mock.fn→vi.fn and
mock.timers→vi fake timers where needed.

💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 04:37:33 +02:00