Commit Graph

472 Commits

Author SHA1 Message Date
Levi Neely d00a15093d expand $VAR references in env file values and sandbox paths 2026-05-20 18:35:09 +02:00
Levi Neely 66d9d0502d expand ~ in env file values and sandbox paths 2026-05-20 18:34:00 +02:00
Levi Neely fa9c98fb05 agent: add exec event role for ! command output
Shell command output uses a dedicated "exec" role instead of "info",
formatted with ``` fences in the chat log.
2026-05-20 16:49:41 +02:00
Levi Neely 1479aea274 agent: publish events on pubsub bus, self-drain queue
- Add pubsub.Bus to agent; all events published on "event" topic
- Remove EventHandler param from Submit (and internal methods)
- Queue() self-drains via goroutine when agent is idle
- /i submits directly when idle, injects when running
2026-05-20 16:45:32 +02:00
Levi Neely 2bbafb51ec execute: use session OLLIE for PATH prepend, keep ollie-9p-mount on $PATH 2026-05-20 14:16:04 +02:00
Levi Neely 5099ccf51d /agent: preserve session ID when switching agents 2026-05-20 10:57:04 +02:00
Levi Neely 82df12e293 add test for SetSessionID preamble update 2026-05-20 10:50:20 +02:00
Levi Neely 09a9364b6f SetSessionID: update session ID in system prompt on rename 2026-05-20 10:47:56 +02:00
Levi Neely 10991ec319 env: load ~/.config/ollie/env at server startup
EnsureDefaults now loads the env file before setting path defaults.
This ensures OLLIE_TIER_*, OLLIE_ENABLED_BACKENDS, and all other
user-configured vars are available to tool scripts from the start,
rather than only after the first backend.NewWithName() call.
2026-05-20 09:36:04 +02:00
Levi Neely 97d14f1100 fix: filter inherited env vars overridden by per-session envExtra
Prevents the agent from using the user's global OLLIE mount to
bypass per-session permission enforcement.
2026-05-19 15:45:00 +02:00
Levi Neely ccacdc4ec8 fix: clear OLLIE env in tests to prevent FUSE mount hangs 2026-05-19 15:20:31 +02:00
Levi Neely 1e96d4c7f4 agent: separate uname (principal) from session ID
Session identity is now a numeric UID (starting at 10000) assigned at
creation and never changed. Session names can be renamed freely without
affecting the 9P identity.

- AgentCoreConfig.Uname carries the principal
- pushSessionEnv sets OLLIE_UNAME on the execute server
- startMount gated by WithMount() option (not env var)
- Close() uses context timeout to avoid hanging on fusermount
2026-05-19 15:06:16 +02:00
Levi Neely e20f9a7a06 execute: per-session FUSE mount for 9P identity
The execute server now starts ollie-9p-mount when OLLIE_SESSION_ID is
set, giving each agent session its own FUSE proxy that attaches to
olliesrv with Uname=session_id. Tools see the full namespace through
$OLLIE but all 9P operations carry the session's identity.

Close() tears down the mount on session destroy.
2026-05-19 14:10:09 +02:00
Levi Neely 5efed7040d fix: inject OLLIE_SESSION_ID into prompt resolution subprocesses
resolveExecPrompt spawns x/prime which uses envsubst to expand
${OLLIE_SESSION_ID} in the system prompt template. The variable was
never in the process environment at resolution time — it was only
set on the execute server after the prompt was already rendered.

Add env []string parameter to resolvePrompt/resolveExecPrompt and
BuildAgentEnv so callers can inject session-scoped vars into the
subprocess environment. Generate session ID before BuildAgentEnv in
the agent-switch path so it is available at prompt resolution time.
2026-05-18 12:31:35 +02:00
Levi Neely 1207e26a07 remove trustedTools and Confirm callback; trust is implicit via allowExecutors 2026-05-17 15:21:26 +02:00
Levi Neely 93c0b374d5 truncation: avoid mid-rune cut with ToValidUTF8 2026-05-17 12:59:49 +02:00
Levi Neely 7237980ff5 truncation: raise hard ceiling to 128KB, include tool name in message 2026-05-17 12:51:43 +02:00
Levi Neely 011843a59d loop: per-step budgets — replan gate (8 rounds) and stall detection (5 rounds) 2026-05-17 12:13:26 +02:00
Levi Neely 8be8b9c42d task state: read PlanStep from plan file (ground truth) with text fallback 2026-05-17 11:09:44 +02:00
Levi Neely 837c95c483 state: expose estimateTokens/stripCold on interface; remove type assertion 2026-05-17 11:06:45 +02:00
Levi Neely 62774e60a6 session: strip cold results at restore time to eliminate resume hot spot 2026-05-17 11:05:27 +02:00
Levi Neely d1ac24fb1d loop: auto-infer TaskState from actual tool results each round 2026-05-17 11:04:55 +02:00
Levi Neely bfc7f15254 tier: built-in default cold table for known read-only tools 2026-05-17 11:03:54 +02:00
Levi Neely 1cf171adae loop: proactive cold stripping at 50% context budget before backend call 2026-05-17 11:01:21 +02:00
Levi Neely 779b99fd9b tool results: tier classification (hot/warm/cold) with immediate cold summarization 2026-05-17 10:59:17 +02:00
Levi Neely da36db8f2b loop: introduce StepContext — per-turn context object assembled once 2026-05-17 10:54:10 +02:00
Levi Neely fa88c89369 compact: tiered compaction — cold (summary), warm (decision index), hot (verbatim tail) 2026-05-17 10:52:48 +02:00
Levi Neely ea4a3084e0 session: add Checkpoint for typed subflow handoff 2026-05-17 10:15:24 +02:00
Levi Neely b5b2ee43ec loop: replace plan file re-injection with structured TaskState re-injection 2026-05-17 10:14:44 +02:00
Levi Neely 283a2e24d8 state: extend interface with recentHistory/taskState; loop uses selective context 2026-05-17 10:10:33 +02:00
Levi Neely 54351e8c85 compact: structured TaskState compaction with recent message tail 2026-05-17 10:08:33 +02:00
Levi Neely b775e5df7a agent: add TaskState — persisted structured overlay injected at each turn 2026-05-17 10:06:21 +02:00
Levi Neely 45959cb79d agent: apply config backend/model when switching agents via /agent 2026-05-17 00:19:55 +02:00
Levi Neely 8c3b40ffe1 config: add backend and model fields 2026-05-17 00:15:39 +02:00
Levi Neely 22d72f143d fix: wire allowExecutors/allowTools in BuildAgentEnv; add missing IncrToolCallCount field 2026-05-17 00:05:34 +02:00
Levi Neely 161d0d237f add allowExecutors/allowTools two-layer tool restriction 2026-05-16 23:54:55 +02:00
Levi Neely 3867d52689 add generation params: top_p, top_k, min_p, top_a, repetition_penalty, max_completion_tokens, response_format, reasoning_effort, include_reasoning, stop, verbosity 2026-05-16 23:54:04 +02:00
Levi Neely 6dfae368d0 fix: wire PlanFile, add missing rate-limit constants, simplify test helpers, fix regex
- Wire PlanFile from $OLLIE/s/{id}/plan into agentConfig so plan
  re-injection is no longer dead code
- Add missing failureWindow/maxFailures/blockDuration constants
- Replace hand-rolled contains() with strings.Contains
- Fix rm -rf .. regex to match end-of-string and whitespace
- Add TestPlanReinjection covering periodic plan re-surfacing
- Add loop_maxsteps_helpers_test.go with mockResponse/newState/sequentialStream
2026-05-16 23:54:04 +02:00
Levi Neely 35a78169e5
Merge pull request #3 from lneely/feat/configurable-max-steps
agent: configurable MaxSteps override in AgentCoreConfig + /maxsteps command
2026-05-16 21:53:44 +00:00
Levi Neely 2101a2c023 agent: add MaxSteps override in AgentCoreConfig and /maxsteps command
- AgentCoreConfig.MaxSteps: when non-zero, overrides the value loaded
  from the agent JSON (cfg.Env.maxSteps). Zero means "use the agent
  JSON value, or unlimited if absent". Callers (9p frontend, httpgw,
  CLI) can now inject a per-session limit at construction time without
  touching any agent config file.

- /maxsteps [n] command: shows the current limit (0 = unlimited) or
  sets it live during a session. Follows the same pattern as /model.
  Added to /help listing.
2026-05-16 18:56:39 +00:00
Levi Neely d8467a4f16 agent: add ToolCallCount to Core interface; wire tcct accumulator
Adds a monotonically increasing tool-call counter (tcct) to the agent.

- atomic.Int64 toolCallCount on the agent struct
- ToolCallCount() int64 on the Core interface
- IncrToolCallCount func() int64 on agentConfig, wired in executeTurn
- Incremented in execOne after the pre-tool hook returns (blocked calls
  don't count) and before cfg.Exec is called (timeout/error still counts)

The counter never resets. Consumers use modulo arithmetic:
  tcct % 10 == 0  ->  fires every 10 actual executions

The primary consumer is ollie-9p, which exposes tcct as a read-only
9P file that pre_tool / post_tool hooks can inspect via cat.
2026-05-15 20:16:43 +00:00
Levi Neely 4fdf5e042d loop: re-surface plan file every 10 tool rounds; nudge includes plan reminder 2026-05-15 19:48:13 +00:00
Levi Neely 0d9405f9bc core: read MaxSteps from config into agentConfig 2026-05-15 19:33:44 +00:00
Levi Neely 7702ae4080 config,core: wire MaxSteps from agent JSON through to agentConfig loop 2026-05-15 19:27:44 +00:00
Levi Neely c20a5203ca agent: add MaxSteps soft guardrail to agentConfig and loop 2026-05-15 19:25:10 +00:00
Levi Neely 46940eef07 docs: remove misplaced OBSERVATIONS.md (belongs in ollie/doc) 2026-05-15 18:59:26 +00:00
Levi Neely 21e6c0954b docs: add OBSERVATIONS.md 2026-05-15 18:58:25 +00:00
Levi Neely 860b1ce64d execute: fix test suite — Yolo mode for CI, correct classifyStep expectation 2026-05-15 18:54:20 +00:00
Levi Neely 8cf82f3551 execute: update tests for split execute_code / call_tool / pipe tools 2026-05-15 18:50:20 +00:00
Levi Neely 0903254c6c execute: wire call_tool and pipe dispatch; execute_code is code-only 2026-05-15 18:48:23 +00:00