Commit Graph

1403 Commits

Author SHA1 Message Date
Levi Neely 0790dc7e4e logseq tool: use REST API instead of broken MCP endpoint
Logseq 2.0.1 has bug #12413 where POST /mcp always returns 400.
Switched to the REST API at POST /api which works correctly.
Requires OLLIE_LOGSEQ_TOKEN env var.

Commands: listPages, getPage, searchBlocks, listTags, listProperties,
upsertNodes, getCurrentGraph
2026-07-31 15:07:40 +02:00
Levi Neely c75dc6f6c7 add logseq tool: query/modify Logseq DB graph via built-in MCP server
- data/tools/logseq: Python wrapper (same pattern as atlassian_cli)
- data/tools/logseq.meta: tool metadata with full prompt
- data/scripts/logseq-cli: shell bridge using mcp-to-command + mcp-remote
- justfile: install logseq tool + logseq-cli script

Commands: listPages, getPage, searchBlocks, listTags, listProperties, upsertNodes
Transport: streamable-http to http://127.0.0.1:12315/mcp (Logseq 2 DB built-in)
2026-07-31 15:01:20 +02:00
Levi Neely 9b087f23d1 fix copilot.json: remove trailing comma 2026-07-31 14:19:58 +02:00
Levi Neely 0acc36abfd toolsrv: embed sandbox/default.yaml, fix lifecycle
- Embed the full sandbox/default.yaml instead of sandbox-remote.yaml
  so local ollie-remote subprocesses get proper sandbox permissions
  (DNS, git config, etc.)
- justfile copies sandbox/default.yaml temporarily during build
- Register builtins + ToolRegistry + SkillsRegistry on ollie-remote
- Pdeathsig: kernel auto-SIGTERMs children when parent dies
- Cleanup: SIGTERM → 3s grace → SIGKILL (guaranteed kill)
- Atomic counter for unique socket paths (no collisions)
2026-07-31 14:17:59 +02:00
Levi Neely 59b672966f toolsrv: unified socket-based execution
Execution is now identical for local and remote:
- Session calls Spawn()/SpawnRemote() → owns *Process with socket
- Clients call Dial(LocalAddr(socket)) → *Conn over Unix socket
- ollie-remote serves --listen mode with multi-client accept loop
- Builtins (shell, tool_load, skill_load) run in subprocess with registries

Lifecycle:
- Pdeathsig ensures children die with parent (no orphans)
- Cleanup: SIGTERM → 3s grace → SIGKILL (guaranteed)
- Socket paths use atomic counter for uniqueness
- Session Kill() closes Process

Protocol:
- Extended RPC: set_env, set_cwd, detach, list_detached, etc.
- Shell goes through builtin dispatch (parses 'cmd' field correctly)
- Streaming output via JSON-RPC notifications
2026-07-31 14:10:47 +02:00
Levi Neely eb7bacc243 ollie-remote: fix empty output and wire generic tool dispatch
Shell results were returned as raw strings but the agent expects
structured content blocks ({content:[{type:text,text:...}]}). Fixed
shell handler to return the same format as the local Server.CallTool.

Shell errors now return as isError content blocks rather than RPC
errors, matching local behavior (output is preserved in errors).

The default RPC handler now dispatches to srv.CallTool() for any
unknown method, enabling named tools (file_read, file_grep, etc.)
from the embedded tools to be called remotely.
2026-07-31 11:32:46 +02:00
Levi Neely 0c75d06c59 remote: auto-upgrade ollie-remote on each tool call
Before each CallTool, check if the local ollie-remote binary hash
differs from what was deployed. If so, close the SSH connection,
re-dial (triggering bootstrap to upload the new binary), and swap
the connection transparently.

Emits info events when upgrade is detected and when it completes.
2026-07-31 11:23:15 +02:00
Levi Neely 249b9f80f9 ollie-remote: wire streaming output to JSON-RPC notifications
ExecuteInSandbox uses StreamFunc(ctx) to emit partial output. The
context passed to it lacked a WithOutputStream callback, so no output
was ever streamed back to the client.

Fix: wrap ctx with WithOutputStream that encodes output as JSON-RPC
notifications (id=0, result={data:...}). The client side already
handles these via the outputNotification path in CallTool.
2026-07-31 11:18:53 +02:00
Levi Neely c88ed95b94 remote: deploy landrun alongside ollie-remote
The bootstrap script now also checks for and deploys the landrun
sandbox binary to ~/.cache/ollie/bin/landrun on the remote host.
Without this, ollie-remote couldn't sandbox tool execution.

Protocol extended: OLLIE_LOADER_START now includes need_landrun field.
Transfers are sequential: ollie-remote first, then landrun if needed.
Each binary has independent hash-based caching.
2026-07-31 11:13:38 +02:00
Levi Neely d597758909 feat(ollie-remote): embed compiled LSP tools alongside scripts in build 2026-07-31 11:07:49 +02:00
Levi Neely 136ae81a6c fix(ollie-remote): add tools/.gitkeep so embed directive works without justfile 2026-07-31 11:05:10 +02:00
Levi Neely c031cb430e session/remote: fail fast on SSH auth and deploy errors
- Skip cwd existence check when remote is specified (cwd is on remote)
- Add BatchMode=yes to SSH: pubkey-only, no password fallback
- Add StrictHostKeyChecking=accept-new: auto-accept new hosts, reject
  changed keys
- Deploy failure already propagates as session creation error via
  RemoteDial returning error
2026-07-31 11:00:07 +02:00
Levi Neely d49c0f05dc update kde submodule: add remote field to session dialog 2026-07-31 10:54:46 +02:00
Levi Neely a73899bc2f session: reject creation with non-existent cwd
When a session is created with a cwd that doesn't exist, all tool
execution fails with a confusing 'fork/exec landrun: no such file or
directory' because exec.Command sets cmd.Dir to the non-existent path.

Validate that cwd exists and is a directory at session creation time,
returning a clear error instead of allowing a broken session.

Also includes the earlier USER/NAMESPACE env export fix (agent.go,
shell.go) for the ollie-9p namespace path issue.
2026-07-31 09:28:44 +02:00
Levi Neely ae59151344 toolsrv: export USER and NAMESPACE to shell environment
ollie-9p computes its namespace path from $USER and $DISPLAY via
client.Namespace(). When run inside the sandboxed shell, USER was not
guaranteed to be in the environment, producing /tmp/ns..:0/ollie.

Fix: explicitly inject USER into envExtra in SetSessionEnv (alongside
OLLIE_SESSION_ID and OLLIE_UNAME). Also export the computed NAMESPACE
to cmd.Env so ollie-9p can use it directly without recomputing.
2026-07-31 09:22:43 +02:00
Levi Neely c846220b69 update kde submodule: remove reaction UI artifacts 2026-07-31 09:19:49 +02:00
Ollie Agent 2cda2cd38f update kde submodule pointer 2026-07-31 09:09:50 +02:00
Ollie Agent f37e81d8cc remove emoji reaction feature (core, dbus, KDE GUI) 2026-07-31 09:09:24 +02:00
Ollie Agent cfdedb2e5e help.md: sync to actual 9P tree (agent/ subdir, elevate/, toolsrv.*, react, no t/) 2026-07-31 08:46:02 +02:00
Ollie Agent 03e66c8a0a rewrite help.md: remove dead 9P dirs (sk/, u/, x/, tmp/, tr/), use 9p commands 2026-07-31 08:43:14 +02:00
Ollie Agent 3d4ac9699e remove transcript archive docs (dead feature) 2026-07-31 08:42:13 +02:00
Ollie Agent 9abf16d75f remove SUPERPOWERD and OLLIE_TRANSCRIPT_PATH references 2026-07-31 08:40:37 +02:00
Ollie Agent 5ce4477316 remove stale IDEAS_CONTROLLER.md (dead /home/lkn/mnt/ollie/session/ refs) 2026-07-31 08:37:26 +02:00
Ollie Agent 5021dedabe docs: replace /home/lkn/mnt/ollie/session/ paths with 9p commands 2026-07-31 08:36:47 +02:00
Ollie Agent e968f5407e env: remove OLLIE mount point variable from managed vars and defaults 2026-07-31 08:02:17 +02:00
Ollie Agent cb98439339 docs: remove dead s/ls, s/kill, s/cleanup refs; fix ollie-9p remove→rm 2026-07-31 07:56:39 +02:00
Ollie Agent 855671d8ac remove dead acme scripts (Kmpl, Oi, Theo, Wtf) and stale data/scripts/README 2026-07-31 07:50:41 +02:00
Ollie Agent 7a69f14277 toolsrv: typed RateLimitedError, agent loop: don't count rate-limited calls as consecutive errors 2026-07-31 07:46:32 +02:00
Ollie Agent 5c27a948bd docs: remove stale s/ u/ x/ script namespace references 2026-07-31 07:31:58 +02:00
Ollie Agent 93225704f8 docs: document sudo and tool variants 2026-07-31 07:20:52 +02:00
Ollie Agent 3ea6bc3865 docs: declare the declarative tool registration paradigm 2026-07-30 23:50:04 +02:00
Ollie Agent cb5f99b332 fix ResolveTool to check OLLIE_TOOLS_PATH for variant cmd names 2026-07-30 23:40:24 +02:00
Ollie Agent 3d65d787a2 elevate: broker credential support for privileged tool execution 2026-07-30 23:37:57 +02:00
Ollie Agent 5955562c1d system_logs: first variant-based tool + OR match support
Adds system_logs with two variants:
- journalctl (systemd hosts): unit, since, lines, grep
- dmesg (any Linux): source, lines, grep

Both declare sudo: true — privilege escalation is handled by dispatch.

Also adds OR support in match conditions: array values mean any must
pass. Combined with AND across keys:
  {"binary": ["journalctl", "systemd-cat"], "os": "linux"}
  = (journalctl OR systemd-cat) AND linux
2026-07-30 23:28:37 +02:00
Ollie Agent 5c7df3a9fe docs: document variants and update WRITING_TOOLS for network transparency 2026-07-30 23:14:53 +02:00
Ollie Agent ca8af814e9 toolsrv: conditional tool variants for heterogeneous hosts
A .meta file can now declare multiple variants, each gated by match
conditions. The first variant where all conditions pass determines the
tool's schema, documentation, and executable. If no variant matches,
the tool is hidden from the registry on that host.

Match conditions:
  binary  — exec.LookPath or absolute path stat
  file    — os.Stat (file or dir exists)
  os      — runtime.GOOS
  arch    — runtime.GOARCH
  env     — environment variable is non-empty
  nenv    — environment variable is empty

This enables network-transparent tool declarations: one .meta file
works across heterogeneous hosts (systemd vs syslog, apt vs pacman,
GUI vs headless). When ollie-remote deploys to a different machine,
tools adapt their contract to what's actually available.

No variants field = current behavior, zero breaking changes.
2026-07-30 23:13:31 +02:00
Ollie Agent 44e420fc7e toolsrv: support cmd field in .meta for external tool resolution
Tools no longer need to be co-located in $OLLIE_TOOLS_PATH. The .meta
sidecar can specify a cmd field pointing to any executable:
- Absolute path: use directly
- Bare name: resolve via $PATH

Resolution order: OLLIE_TOOLS_PATH/<name> → meta.cmd → PATH lookup.
Local wrappers always win, enabling simplified interfaces over complex
system binaries.

Rewrites doc/WRITING_TOOLS.md to document the plugin model: any
executable + .meta = tool, no source tree integration required.
2026-07-30 23:02:08 +02:00
Ollie Agent 059cceed5c AGENTS.md: document both script and compiled tool paths 2026-07-30 22:54:54 +02:00
Ollie Agent ebd994fe7e doc/EVOLUTION: add LSP Go port to Phase 12 2026-07-30 22:54:28 +02:00
Ollie Agent 9f947e93ec docs: update repo layout for tools/builtin, tools/lsp, data/ 2026-07-30 22:53:48 +02:00
Ollie Agent 5a84e8b326 toolsrv: fix Registry.discover() to use .meta files
The Registry had its own discover() method that still required
'ollie:prompt' in file content — the old header-based check that was
removed from DiscoverTools(). This caused tool_load to fail for ALL
tools (not just Go binaries) since .meta is now the sole metadata source.

Fix: delegate to DiscoverTools() which correctly scans .meta files.
2026-07-30 22:50:49 +02:00
Ollie Agent 46a990cd42 tools/lsp: fix arg field names to match .meta schema
Binaries now read path/line/col (matching the .meta schema the model
sees) instead of file/line/character. Also fix col to be 1-indexed
(matching the schema description) with proper -1 conversion to LSP
0-indexed protocol.
2026-07-30 22:47:27 +02:00
Ollie Agent 36e42057d4 justfile: rm stale files before go build (overwrite safety) 2026-07-30 22:43:03 +02:00
Ollie Agent 77b4b624cf tools/lsp: port LSP tools from Python to Go
Implements a bridge daemon + client architecture in pure Go:
- tools/lsp/ — shared library (adapter registry, LSP server management,
  JSON-RPC framing, bridge daemon, client)
- tools/lsp/cmd/{lsp_definition,lsp_references,lsp_hover,lsp_rename,
  lsp_symbols,lsp_completion,lsp_diagnostics}/ — individual binaries

Each binary:
- Reads JSON args from stdin (same contract as before)
- Connects to bridge daemon over Unix socket (starts it if needed)
- Bridge manages long-lived LSP server processes (gopls, clangd, intelephense)
- Bridge auto-exits after 5min idle

Removes:
- Python LSP tool scripts (data/tools/lsp_*)
- Python LSP library (data/tools/_lib/lsp/)

Adds lsp-tools build target to justfile. The .meta sidecar files remain
in data/tools/ and are installed alongside the compiled binaries.
2026-07-30 22:10:56 +02:00
Ollie Agent 1015536f2c tools: move builtins to tools/builtin/
Prepares tools/ as the umbrella for all tool implementations:
- tools/builtin/ — in-process handlers (shell, reasoning, tool/skill registry)
- tools/lsp/ — (next) Go LSP tools with shared client library

Package rename: ollie/tools → ollie/tools/builtin
2026-07-30 22:04:32 +02:00
Ollie Agent ba8db09143 justfile: fix .meta install loop and remove dead targets
- Fix for loop: just doesn't need $$ escaping (that produces PID)
- Remove empty install-scripts and install-contrib targets
- Fold script installs into install-data
2026-07-30 21:55:21 +02:00
Ollie Agent 63f602fb07 README: fix custom tools description 2026-07-30 21:52:58 +02:00
Ollie Agent a632f630ce README: update for current architecture
- Remove terminal/s/sh/bfg from diagram and frontends
- Update repo layout table (data/, mount/, skills)
- Fix env var descriptions (u/complete → code completion)
- Update intro text
2026-07-30 21:52:25 +02:00
Ollie Agent 6ef99918e0 doc: add Phase 12 to EVOLUTION.md 2026-07-30 21:50:18 +02:00
Ollie Agent 69b2c2cc40 tool metadata: replace header comment parsing with .meta sidecar files
The tool registry now reads metadata exclusively from JSON .meta sidecar
files alongside each tool executable. Header comment parsing (ollie:prompt,
ollie:tier, ollie:parallel, args_json) is removed entirely.

- Add toolsrv/meta.go: MetaFile struct, LoadMetaFile, ToolInfoFromMeta
- Rewrite discover.go: scans .meta files only
- Rewrite schema.go: ParseToolInfo reads .meta only
- Rewrite tier.go: tier/readOnly from .meta only
- Generate .meta for all 35 tools
- Update all docs: README, AGENTS.md, ARCHITECTURE, CORE, USAGE, WRITING_TOOLS
2026-07-30 21:48:42 +02:00