Add AgentForkFn and AgentCleanupFn type aliases. Extend AgentOptions
with fork: AgentForkFn | null and cleanup: AgentCleanupFn | null
fields. Add getAskSessionId / setAskSessionId session-cache helpers
using <stepHash>:ask key shape (coexists with exec sessions in the
same per-agent cache file). All four adapters pass fork: null,
cleanup: null — real wiring lands in Phase 2b. Resolves#145.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When frontmatter validation fails, the step is never written to CAS, so
isFirstVisit remains true on the next run. Both agent-claude-code and
agent-hermes gated session cache lookup behind !isFirstVisit, which
caused them to start a fresh session (and a new worktree) instead of
resuming the one that already has all the work done.
Changes:
- Remove the isFirstVisit guard from both adapters so they always check
the session cache.
- When isFirstVisit + cache hit (frontmatter-only failure), send a
minimal correction prompt via buildFrontmatterRetryPrompt() instead
of re-sending the full initial prompt — the session already has full
context, we just need the agent to re-output correctly formatted
frontmatter.
- Add buildFrontmatterRetryPrompt to util-agent with tests.
Fixes#139
Replace hardcoded HERMES_COMMAND constant with resolveHermesCommand()
that checks UWF_HERMES_BIN first, falling back to 'hermes' via PATH.
This fixes environments where hermes is installed in a venv or
non-standard location that isn't in the non-login shell PATH
(e.g. ~/.local/bin symlink only available in login shell).
Refs #134
Agents now receive a Thread Progress section showing current step number
and role visit count, eliminating tool calls to count turns.
- util-agent: new buildThreadProgress() helper
- agent-hermes: inject before continuation/first-visit prompt
- agent-claude-code: same injection point
Fixes#127
Address review nit from PR #97: clientInfo.version should be
agent-hermes's own version for correct identification under
independent versioning.
小橘 🍊(NEKO Team)
- All uwf-* adapter CLIs now support --version / -V
- util VERSION constant reads from package.json at runtime
- agent-hermes ACP clientInfo uses dynamic VERSION
小橘 🍊(NEKO Team)
Tokens (inputTokens, outputTokens) now come from ACP PromptResponse.usage
which is populated synchronously from run_conversation() — no WAL race.
Turns still come from DB before/after snapshot.
Previously both were read from hermes state.db after ACP prompt returned,
but WAL write lag caused incomplete token data (e.g. 235 vs actual 26,080).
Refs #91
On session resume, turns/inputTokens/outputTokens were cumulative
(entire session history) instead of per-step increments. Now we
snapshot metrics before prompt, compare after, and report the delta.
Changes:
- acp-client: add getSessionId() accessor
- hermes: extract snapshotUsage() + computeUsageDelta() pure functions
- hermes: runPrompt/runHermes/continueHermes use before/after snapshots
- 9 new unit tests for usage delta computation
Refs #68
- Add inputTokens/outputTokens to HermesSessionJson type
- Query input_tokens, output_tokens from sessions table in loadHermesSessionFromDb
- Update test fixture schema with token columns
- runPrompt now reports real token counts from Hermes state.db
Refs #76, #68
- @ocas/core and @ocas/fs upgraded from ^0.2.2 to ^0.3.0
- agent-hermes: replace better-sqlite3 with node:sqlite (DatabaseSync)
- Remove better-sqlite3 and @types/better-sqlite3 dependencies
- Fix remaining bun references in cli test helpers (execFileSync)
Refs #28
- Add missing await on store.cas.put() in run.ts:192
- Replace #!/usr/bin/env bun → #!/usr/bin/env node in all CLI bins
- Update issue-551 test to assert node shebang