Skip to content

Tags: tta-lab/lenos

Tags

v1.10.2+0.74.1

Toggle v1.10.2+0.74.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
feat(goal): add cli discovery and installer support (#172)

* feat(goal): add cli discovery and installer support

* feat(goal): use goal cli backend

* fix(goal): update existing explicit goals

* test(goal): cover terminal goal autodetect

v1.10.1+0.74.1

Toggle v1.10.1+0.74.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix: correct session-level token totals for ATIF final_metrics (#169)

* fix: correct ATIF final_metrics total_completion_tokens

Add lifetime token total fields (total_prompt_tokens, total_completion_tokens,
total_reasoning_tokens) to sessions table. Fix finalMetrics to use session
lifetime totals instead of hardcoding total_completion_tokens=0.

Provider normalization: Anthropic/Bedrock InputTokens already includes
CacheReadTokens as a subset; avoid double-counting in TotalPromptTokens.

ATIF extra.cache_miss_tokens now derived as total_prompt_tokens - cache_read_tokens
with non-negative guard, excluding cache_creation_tokens.

Tests cover: DB Save round-trips, compaction preserving lifetime totals,
provider normalization guard, ATIF export using session totals, and
nil-session fallback to step accumulation.

* fix: remove unused promptInput variable (lint)

* triage: clean CacheMissTokens storage, remove dead UpdateTitleAndUsage

- CacheMissTokens now stores InputTokens only (not +CacheCreationTokens).
  Trajectory export reads the column directly instead of deriving via
  total_prompt_tokens - cache_read_tokens.
- Remove UpdateTitleAndUsage SQL, service interface/impl, and test mocks.
  The production path uses saveSessionUsage → Save() → UpdateSession;
  the increment query was dead code.

* triage: normalize PromptTokens/CacheMissTokens for Anthropic, fix usage summary and stats SQL

- PromptTokens and CacheMissTokens are now provider-normalized in
  updateSessionUsage. Anthropic/Bedrock providers have CacheReadTokens
  as a subset of InputTokens; miss is derived as InputTokens - CacheReadTokens
  to avoid double-counted cache misses. PromptTokens uses InputTokens directly
  instead of InputTokens + CacheReadTokens for these providers.
- RunUsageSummary InputCacheMissTokens no longer includes CacheCreationTokens.
- stats.sql GetUsageByDay, GetUsageByDayOfWeek, and GetTotalStats now sum
  total_prompt_tokens / total_completion_tokens (lifetime totals) instead of
  the old per-turn context fields.

* triage: normalize run summary cache miss for Anthropic, fix recent activity stats

- usage_summary AddUsage normalizes InputCacheMissTokens for
  Anthropic/Bedrock (miss = InputTokens - CacheReadTokens) instead
  of using raw InputTokens for all providers.
- stats.sql GetRecentActivity uses total_prompt_tokens +
  total_completion_tokens for session token totals.

* triage: derive run summary input_tokens from clean miss+hit buckets

Use InputCacheMissTokens + InputCacheHitTokens for InputTokens instead
of RawInputTokens + InputCacheHitTokens. For Anthropic/Bedrock,
RawInputTokens already includes cache reads, so the old formula
double-counted. The new derivation is a clean disjoint sum for all
providers.

v1.10.0+0.74.1

Toggle v1.10.0+0.74.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix: installer defuddle, context files in sys prompt, per-tool --help…

… synthetic cmds (#168)

* fix: installer defuddle, context files in system prompt, replace cmd docs with --help

1. Add npm install -g defuddle to lenos-installer, with warning when npm is missing
2. Render AGENTS.md/CLAUDE.md content directly in system prompt via lenos.md.tpl
   ContextFiles template slot; remove context_files_context.md synthetic cat commands
3. Delete cmd-src/web/skill/project.md; replace with single synthetic --help command
   using echo separators; add project get orga for org references

* fix: use CommandContext instead of Command in installer

* refactor: per-tool context files with subcommand --help

Split general_context.md into src/web/skill/project_context.md.
Each includes root --help plus subcommand --help/docs (edit, replace,
delete, insert, search, fetch, docs, sgraph, list). skill_context includes
skill list, project_context includes project get orga + project list.

* fix: never truncate synthetic context command output

Synthetic commands like --help are reference material the agent needs
in full. Passing nil BashOutput to boundOutput skips truncation
entirely for context commands, while keeping normal truncation for
user-run commands intact.

* fix: wrap each context file in xml tag with path attribute

Each context file is now wrapped in <context-file path="..."> tags so
the agent can see both the file content and its filesystem location.
Removed the generic # Project Instructions heading since not all context
files are project instructions.

* fix: remove project get orga from context and fallback

Misunderstood earlier — project get orga was meant as a reference
suggestion during development, not a command to seed in synthetic context.

v1.9.0+0.74.1

Toggle v1.9.0+0.74.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
feat(agent): goal file MVP — exit gate, TUI Open Goal, CLI flags (#164)

* feat(agent): add goal file MVP with exit gate and TUI Open Goal

- Add goal file creation under .lenos/goals/<session-id>.md
- Add --goal and --goal-file CLI flags to lenos run
- Expose LENOS_GOAL env var for sandboxed runners
- Inject startup runtime goal hint on new sessions
- Gate tryEndTurn on goal status (complete/blocked or continue)
- Add TUI 'Open Goal' command palette item
- Reject --goal/--goal-file with --session/--continue

* fix(agent): auto-detect existing goal file in buildCall for TUI flow

TUI 'Open Goal' creates the goal file on disk but buildCall only
set GoalPath when CLI --goal/--goal-file overrides were present.
Auto-detect an existing goal file at the session path so subsequent
agent turns get the exit gate and LENOS_GOAL env var.

* fix(agent): deduplicate goal startup hint, fail on create error, show Open Goal always

- Add GoalStartupHint bool to SessionAgentCall; set only on explicit goal
  creation (CLI --goal/--goal-file), not on auto-detect or ordinary turns.
- Goal hint gate uses GoalStartupHint instead of isNewSession, avoiding
  repeated injection on every user message.
- buildCall now returns error when CreateGoal fails for --goal/--goal-file
  (start-time contract, not a warn-and-continue fallback).
- Show 'Open Goal' in command palette even without a session; handler
  already warns when no session is active.

* fix(agent): add missing require.NoError in coordinator test

* feat(agent): add goal update hint for TUI editor re-read

After 'Open Goal' editor closes, inject runtime hint telling the agent
to re-read $LENOS_GOAL and adjust its task. Covers goal body edits and
status transitions made through the external editor.

* fix(agent): trigger TUI Open Goal through runtime path

Add AgentRunRuntime wiring from workspace to coordinator so Open Goal can
resume the agent with runtime goal context instead of a user message.
The TUI now sends GoalUpdateHint through the runtime path after editor exit.

* test(agent): stabilize goal hint assertions and log goal parse errors

- Narrow goal hint tests to runtime structural invariants.
- Log goal status read errors while preserving treat-as-active behavior.

* chore(deps): mark yaml v3 as direct dependency

v1.8.1+0.74.1

Toggle v1.8.1+0.74.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
feat: add cmd-project.md for project command documentation (#161)

v1.8.0+0.74.1

Toggle v1.8.0+0.74.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
feat(codex): inject session identity for prompt cache routing (#156)

Add prompt_cache_key, x-client-request-id, and session_id to Codex OAuth
requests using the stable lenos session ID. The transport reads session ID
from request context and injects it into the JSON body and headers.

ChatGPT-Account-Id already flows through config extra_headers; no additional
wiring needed.

v1.7.1+0.74.1

Toggle v1.7.1+0.74.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
feat(agent): add no-sandbox flag and simplify journal preflight (#154)

* feat(agent): add no-sandbox flag and simplify journal preflight

* docs(agent): refine journal approach prompt

* docs(agent): emphasize existing patterns in preflight

* docs(agent): clarify preflight self-review

* docs(agent): generalize journal preflight guidance

* fix(cmd): reject readonly without sandbox enforcement

v1.7.0+0.74.1

Toggle v1.7.0+0.74.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
feat(ui): add sandbox toggle command (#153)

* feat(ui): add sandbox toggle command

* fix(ui): record sandbox toggles as runtime messages

* fix(exec): prevent killed flag race in background job status

v1.6.4+0.74.1

Toggle v1.6.4+0.74.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
refactor: split coordinator.go, loop.go into modules + deterministic …

…end-turn (#152)

* feat(installer): add Einai (ei) to lenos-installer tools

Add Einai with UseReleaseAPI since its release archives include the
version in the filename, so /releases/latest/download/ direct links
do not apply. Implement releaseAssetURL to fetch the download URL
from the GitHub releases API.

* fix(agent): wait for background jobs before prose-only end turn

Extract tryEndTurn gate that waits for background jobs and drains
queued runtime prompts before any end-turn decision. Both prose-only
and explicit exit paths now route through the same gate.

Make drainAndAppend return a drained flag so the gate can detect
queued completion prompts even when ActiveCount has already reached
zero (race window between Track delete and enqueue).

Add TestRunLoop_ProseEndTurnWaitsForBackgroundJob regression test.

* refactor(agent): split coordinator.go and loop.go into focused modules

Split oversized coordinator.go (1080→311) and loop.go (582→280) by
state-machine contracts.

New files:
- call_builder.go (126) — SessionAgentCall assembly
- model_factory.go (144) — model resolution and selection
- provider_factory.go (306) — provider construction for 10 providers
- provider_options.go (187) — fantasy.ProviderOptions merging
- token_refresh.go (69) — OAuth/API-key refresh and 401 handling
- loop_stream.go (144) — streaming, retries, post-bash trimming
- loop_messages.go (105) — assistant/text/reasoning message helpers
- loop_results.go (22) — command result formatting
- turn_end.go (74) — background job wait, queue drain, end-turn policy

Phase 1: mechanical extraction only, no behavior changes.
All 235 tests pass.

* fix: deterministic end-turn with WaitAndDrain completion queue

Phase 2: Fix Lenos end-turn/background completion semantics.

BackgroundRunner stores formatted completion prompts in completions
[]turnPrompt under lock atomically with the active set. WaitAndDrain
returns them directly — no counter, no race window.

tryEndTurn:
- Uses WaitAndDrain for background completions, drainQueue for other prompts
- Only marks ToolUse when continuing (not on true end-turn)
- Persists queued prompts to message service

Legacy enqueue suppressed for completed jobs (only killed jobs use it)
to prevent double-delivery in active sessions.

Added 11 tests: idle/no-bg end, active bg+prose/exit continuation,
queued prompt continuation, deterministic race test, StopAll reset,
killed no-count, single-completion delivery.

* chore: support GITHUB_TOKEN in installer release asset API call

* chore: remove periodic journal self-check injection

The token-threshold-based periodic check hint fired too frequently
because it tracked InputTokens (150K context crosses 30K threshold
every step). The whole mechanism is removed — it wasn't a good design
for surfacing journal reminders. The journal fill hint on first turn
and the auto-compact hint at 80% context window remain.

v1.6.3+0.74.1

Toggle v1.6.3+0.74.1's commit message
chore: remove periodic journal self-check injection

The token-threshold-based periodic check hint fired too frequently
because it tracked InputTokens (150K context crosses 30K threshold
every step). The whole mechanism is removed — it wasn't a good design
for surfacing journal reminders. The journal fill hint on first turn
and the auto-compact hint at 80% context window remain.