Commit Graph

353 Commits

Author SHA1 Message Date
Levi Neely a6b6e911dd 9p: goroutine-per-request; *wait files use connection context
Serve now dispatches each 9P request to its own goroutine with a shared
response channel, so blocking reads no longer stall the serve loop.

*wait files are handled via SessionFileStore.Wait(connCtx, name), which
merges the connection context with the session context via
context.AfterFunc — the wait unblocks on either connection close or
session kill, preventing goroutine leaks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 16:19:11 +02:00
Levi Neely 596f658703 9p: add statewait/usagewait/ctxszwait/cwdwait; rename enqueue/dequeue
*wait files block on read until the corresponding value changes, then
return the new value. enqueue/dequeue renamed to fifo.in/fifo.out.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 16:11:10 +02:00
Levi Neely 1e1769860a docs: update p/ and pl/ references for hook-based priming
- Remove 06_tool-plan.md from p/ listing (removed)
- Remove pl/ from filesystem layout and backing stores table
- Replace Go-template note with prime/agentSpawn hook explanation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 12:16:25 +02:00
Levi Neely 8dbec81362 server: remove pl/ directory and OLLIE_PLAN_PATH support
The markdown planning mechanism has been removed. pl/ no longer needs
to exist as a 9P directory.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 11:42:06 +02:00
Levi Neely 439ee6af1e p9: rename PluginStore to ExecStore
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 05:55:15 +02:00
Levi Neely fe5363702f correct prompt names in doc 2026-04-18 22:12:23 +02:00
Levi Neely 680e2a49bd p9: add x/ plugin namespace; wire elevation via x/elevate
Add PluginStore backed by scripts/x/, exposed read-only at x/ in the
9P filesystem. Remove elevator field and elevation.Detect(); update
execute.Decl() call sites to drop the now-removed elevator parameter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 20:50:27 +02:00
Levi Neely 8b233c295e p9: wire elevation.Detect() into execute server; remove session env injection
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 20:06:48 +02:00
Levi Neely 9b747e011b p9: add writable s/{id}/env file for session-scoped env injection
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 19:19:59 +02:00
Levi Neely 734d5b4d45 9p: use env.NAME= in s/new template (no angle brackets)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 19:05:14 +02:00
Levi Neely f2cddff6ea 9p: add env.<NAME>= to s/new read template
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 19:03:19 +02:00
Levi Neely 0c585b4346 env: session-scoped injection via s/new spec; remove global env file
- createSession parses env.NAME=VALUE from spec, passes sessionEnv to
  BuildAgentEnv for MCP expansion and core.SetEnv for execute subprocesses
- Remove /env root file (was daemon-global and readable)
- No writable s/{sid}/env file needed; spec is the injection point

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 19:02:27 +02:00
Levi Neely eef8ccecd9 env: use pkg/env for defaults; expose ollie/env in 9p filesystem
- Replace inline ensureEnv() with env.EnsureDefaults() from ollie/pkg/env
- Serve ollie/env as a readable file containing the daemon's full process env
- Remove extraEnv/InitialEnv session-spec mechanism (no longer needed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 15:44:24 +02:00
Levi Neely 237e4dec8c 9p: add b/cleanup script to server
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:39:33 +02:00
Levi Neely 80b7d1aad6 doc: move Agents and Example session from monorepo USAGE.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:28:01 +02:00
Levi Neely afe514525d doc: move Sessions reference back from monorepo USAGE.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:27:16 +02:00
Levi Neely 43dff26415 doc: move usage content to monorepo; README is now server reference only
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:25:39 +02:00
Levi Neely cf4ccc2cf1 doc: document s/sh interactive shell
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:23:39 +02:00
Levi Neely 4576b32a7a doc: document background job scheduling with b/sched
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:21:45 +02:00
Levi Neely 9611150181 doc: document AI pipeline composition with b/* and u/optimize
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:19:07 +02:00
Levi Neely 81f34a5516 doc: update README for u/ namespace and script reorganization
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:18:08 +02:00
Levi Neely 4a42002a0f 9p: move job script to b/; remove job from s/ sessionStoreFiles
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:14:09 +02:00
Levi Neely 0c3f4e8e4a 9p: add u/ namespace; move q/sched/optimize to correct namespaces
- Add u/ as a top-level namespace backed by scripts/u/
- Expose b/q and b/sched as script files under b/
- Remove q, sched, optimize from s/ (sessionStoreFiles)
- Update s/ script read path to scripts/s/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:08:43 +02:00
Levi Neely 723d586678 9p: drive SessionStore.Get from sessionStoreFiles map
Eliminates the explicit script name list — any entry in sessionStoreFiles
beyond "new" and "idx" is automatically served from disk.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 11:33:11 +02:00
Levi Neely 5bb1783808 9p: add s/optimize to session store
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 11:28:48 +02:00
Levi Neely 3a96284d98 9p: expose s/ scripts via sessionStoreFiles map
Add s/sh, s/job, s/q, s/sched, s/ls, and s/kill as file-backed entries
in the session store, all served from ~/.config/ollie/scripts/. Introduce
sessionStoreFiles to centralize permissions and drive routing, mode, and
stat length — replacing per-entry switch cases and OR chains in server.go.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 11:05:42 +02:00
Levi Neely 4ec6707bf9 9p: add s/kill synthetic script
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 10:32:14 +02:00
Levi Neely d10bdf6fcc 9p: remove tailable machinery from non-chat session files
Tailing works well for append-only logs but is fundamentally racy for
files that get overwritten: fast state changes collapse into a single
truncation signal, so tail reads the wrong (already-stale) value.

Remove mutableFile, mutableVers, trackMutable, and the per-fid readBuf
entirely. Only chat retains append-only stat reporting (Qid.Vers +
Length) for tail -f. All other session files (state, usage, backend,
model, agent, cwd) are plain poll-on-read files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 10:20:32 +02:00
Levi Neely a876190310 Merge ollie-tmp into master 2026-04-18 09:51:41 +02:00
Levi Neely 3e7c05a6e1 9p: add s/{id}/params endpoint
Expose generation parameters (maxTokens, temperature, frequencyPenalty,
presencePenalty) as a readable/writable 9P file. Read returns all four
keys as key=value lines; empty value means unset (API default). Write
parses the same format, updating only the keys present.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 09:49:48 +02:00
Levi Neely 5286551f4c use paths.CfgDir/DataDir for config and data directories
Replace hard-coded ~/.config/ollie and ~/.local/share/ollie paths
with paths.CfgDir() and paths.DataDir() to support OLLIE_CFG_PATH
and OLLIE_DATA_PATH env vars.
2026-04-17 15:31:19 +02:00
Levi Neely 231e9ebcc5 s/ls, ollie-tmp-path 2026-04-17 13:05:23 +02:00
Levi Neely 9cf6ba8d51 9p: update ollie/tmp doc comment
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 09:29:00 +02:00
Levi Neely ece8d22e75 9p: add ollie/tmp backed by OLLIE_TMP_PATH flatdirstore
Replaces /tmp/ollie per-session scratch space with a 9P-served tmp/
directory backed by OLLIE_TMP_PATH (~/.local/share/ollie/tmp by default).
Markers are now global, hash-addressed by absolute file path, and shared
across all sessions. OLLIE_TMP_PATH is always set by ensureEnv().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 09:20:27 +02:00
Levi Neely f17774163c olliesrv: fix subcommand flag parsing
flags after the subcommand (e.g. start -tcp :564) were silently ignored
because flag.Parse() stopped at the first non-flag argument. parse
os.Args[2:] after extracting the subcommand from os.Args[1].

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 23:32:28 +02:00
Levi Neely 3b5f494aef olliesrv: add TCP listener and mount subcommand
- -tcp <addr> flag on start/fgstart listens on TCP in addition to the Unix socket
- mount <address> [mountpoint] mounts a remote olliesrv namespace locally via 9pfuse

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 23:12:23 +02:00
Levi Neely 90428a7017 9p: add remove handler for tr/ transcripts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 22:38:36 +02:00
Levi Neely b4974cc6c2 9p: add transcript store (tr/) and save via chat write or ctl save
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 22:35:02 +02:00
Levi Neely 261fa547fb 9p: fix offset to point past user prompt in chat
Capture chatOffset after the user event is appended rather than
before Submit, so tail -c +$((offset+1)) yields only the model
response for that turn.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 22:14:42 +02:00
Levi Neely de1bf9612d 9p: expose offset file in session directory
Records the byte position of chat EOF immediately before each prompt
is submitted. Clients can read offset after a turn completes and use
tail -c +$((offset+1)) to extract just the new output without needing
a dedicated reply file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 22:05:03 +02:00
Levi Neely e277937619 batchstore: set result to status message on failure
On failure, result is empty and only status carries the error.
Callers (subagent_spawn, oq) now always have a useful value in
result regardless of success or failure.
2026-04-16 20:54:27 +02:00
Levi Neely 181e629009 batchstore: surface backend errors from Submit as failed job status
executeJob was only capturing 'assistant' events from core.Submit.
Backend errors emit an 'error' event that was silently dropped,
causing jobs with nonexistent models to show status=done with empty
result instead of status=failed.
2026-04-16 20:46:45 +02:00
Levi Neely 9a51d287f7 README: document b/ batch namespace
- Add b/ to filesystem layout (job spec, status, result, usage, ctxsz)
- Add BatchStore to backing stores table
- Add Batch jobs section with submit/poll/remove examples and oq reference
- Remove s/{id}/reply from layout
2026-04-16 19:41:46 +02:00
Levi Neely 793cf6b4fa 9p: add b/ batch namespace for ephemeral one-shot jobs
Introduces b/ as a first-class 9P namespace alongside s/. Writing to
b/new creates one or more ephemeral agent jobs (parallel=N suffix -0..-N)
each running the same prompt in an independent agentCore with no
persistent session state.

Per-job files: spec, status, result, usage, ctxsz.
BatchStore/BatchJobStore mirror SessionStore/SessionFileStore.
rm -r b/{id} cancels and removes the job.

Also removes s/{id}/reply: b/{id}/result is the purpose-built
replacement for one-shot prompt->reply use cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 19:22:39 +02:00
Levi Neely cb00afb8bd flush log on shutdown 2026-04-15 18:19:59 +02:00
Levi Neely f478f7545c ensureEnv: set OLLIE_* defaults at startup
Ensure all OLLIE_* path env vars (OLLIE, OLLIE_TOOLS_PATH,
OLLIE_SKILLS_PATH, OLLIE_PLAN_PATH, OLLIE_MEMORY_PATH) are set
to their default values via os.Setenv before the server or any
session is created. This guarantees they are visible to tool
subprocesses without requiring explicit external configuration.
2026-04-15 11:16:16 +02:00
Levi Neely 10a0a36681 switch to shared logger from ollie/pkg/log
Replace ad-hoc debug vars and olliesrv fprintf calls with
plog tagged "9p". Operational messages are Info level.
2026-04-15 10:24:25 +02:00
Levi Neely c705053dd5 fix stat reporting zero length for readable files; add debug logging
makeStat was reporting Length=0 for /s/new, /s/idx, /backends, /help,
and all store-backed files (/a/*, /p/*, /sk/*, /t/*). Clients that
check stat before reading (cat, 9pfuse) saw an empty file and never
issued Tread.

Also adds debug logging (OLLIE_9P_DEBUG=1) across all 9P operations,
tagged with "9p:" prefix.
2026-04-15 10:13:32 +02:00
Levi Neely 2ad8cf558f fix: handle rm -r on session directories
rm -r first unlinks each synthetic file in s/{id}/ before removing the
directory. The remove handler was passing the file basename to
SessionStore.Delete, which failed with "session not found".

Treat /s/{id}/{file} removes as no-ops so rm -r can proceed to the
directory removal, which triggers the actual session kill.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 23:24:23 +02:00
Levi Neely b8c23dd7b6 doc: fix broken relative ollie link in README
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 22:56:41 +02:00