paseo-recap 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/OVERVIEW.md CHANGED
@@ -30,7 +30,7 @@ A recap reads only the text of recent user and assistant messages, short error m
30
30
 
31
31
  With **Same as agent** or **Metadata model**, a model that is unavailable or fails is followed by the next one: the agent's own provider first (for Same as agent, when it has a small model), then the models in Paseo's metadata generation settings, then Paseo's small models that are installed (Claude Haiku, GPT-5.4 mini, MiniMax M3, Nemotron 3 Super). Any of those providers can therefore receive the conversation text. Unlike Paseo's own metadata generation, a recap never falls back to the agent's large model. Choosing Claude, Codex, or OpenCode sends recaps only to that provider, with no fallback.
32
32
 
33
- Claude runs with no tools, MCP servers, or user settings. Codex runs in a read-only sandbox with your own Codex configuration, which includes any MCP servers you have set up there. OpenCode runs its read-only plan agent. Each run uses a temporary folder. Claude and Codex runs are not saved as sessions. OpenCode always saves one, and the plugin deletes it right after the run; if that deletion fails, the session stays in OpenCode.
33
+ Claude runs with no tools, MCP servers, or user settings. Codex runs in a read-only sandbox with your own Codex configuration, which includes any MCP servers you have set up there. OpenCode runs its read-only plan agent. OpenCode 1.x uses `--pure`; 2.x has no equivalent, so OpenCode plugins load. Each run uses a temporary folder. Claude and Codex runs are not saved as sessions. OpenCode always saves one, and the plugin deletes it right after the run; if that deletion fails, the session stays in OpenCode. On OpenCode 2.x, both the run and session deletion use `--standalone` to avoid a persistent background service.
34
34
 
35
35
  Recaps are saved with owner-only permissions in the Paseo data folder, kept for 30 days, and deleted when the agent is archived.
36
36
 
package/README.md CHANGED
@@ -41,7 +41,7 @@ paseo plugin install npm:paseo-recap
41
41
  ```
42
42
 
43
43
  You can also paste `npm:paseo-recap` into **Settings → Plugins → Plugin source**, or install the
44
- latest source with `paseo plugin install github:kingsleydon/paseo-recap`.
44
+ latest source with `paseo plugin install github:kingsleydon/paseo-plugins:plugins/recap`.
45
45
 
46
46
  Recaps start with the next completed turn of each agent. For an agent that is already idle, tap its
47
47
  **Recap** pill and choose **Generate**.
@@ -80,7 +80,7 @@ you type.
80
80
  |---|---|
81
81
  | `claude` | `claude -p --json-schema … --tools "" --strict-mcp-config --setting-sources "" --no-session-persistence`, thinking off |
82
82
  | `codex` | `codex exec --ephemeral --sandbox read-only --output-schema … --disable hooks`, low reasoning effort, with your Codex configuration |
83
- | `opencode` | `opencode run --pure --agent plan --format json`; the session is deleted afterwards |
83
+ | `opencode` | 1.x: `opencode run --pure --agent plan --format json`; 2.x: `opencode run --standalone --agent plan --format json`; the session is deleted afterwards, also with `--standalone` on 2.x |
84
84
 
85
85
  See [docs/design.md](docs/design.md) for the full design, edge cases, and a comparison with Claude
86
86
  Code, Codex, and OMP.
@@ -94,7 +94,9 @@ Code, Codex, and OMP.
94
94
  gets recaps only for itself.
95
95
  - Claude runs with no tools, MCP servers, or settings. Codex runs in a read-only sandbox with your
96
96
  own Codex configuration, including any MCP servers you set up there. OpenCode uses its read-only
97
- `plan` agent, which rejects permission requests.
97
+ `plan` agent, which rejects permission requests. OpenCode 1.x uses `--pure`; 2.x has no equivalent,
98
+ so OpenCode plugins load. On 2.x, both the run and session deletion use `--standalone` to avoid a
99
+ persistent background service.
98
100
  - Recaps are stored with owner-only permissions, kept for 30 days, and deleted when the agent is
99
101
  archived. Recap rows in the conversation live in daemon memory and are gone after a restart.
100
102
  - Like every Paseo plugin, this is trusted code that runs unsandboxed on the daemon host.
@@ -125,17 +127,14 @@ paseo plugin logs paseo-recap
125
127
  ## Releasing
126
128
 
127
129
  Releases publish to npm from GitHub Actions with [trusted publishing](https://docs.npmjs.com/trusted-publishers)
128
- (OIDC), so no npm token is stored anywhere. The publish job runs in the `npm` GitHub environment,
129
- which only `v*` tags can deploy to, and npm trusts only that environment. Bump `version` in `package.json` in a PR, merge it,
130
- then tag the merged commit:
130
+ (OIDC), so no npm token is stored anywhere. Bump `version` in `package.json` in a PR, merge it,
131
+ then tag the merged commit with `recap-v<version>`:
131
132
 
132
133
  ```bash
133
- git tag v0.2.0 && git push origin v0.2.0
134
+ git tag recap-v0.2.4 && git push origin recap-v0.2.4
134
135
  ```
135
136
 
136
- [`.github/workflows/publish.yml`](.github/workflows/publish.yml) checks that the tag matches the
137
- version, runs the type check and tests, and publishes with provenance. Once the paseo.sh listing
138
- uses the npm package as its source, the registry proposes each new version automatically.
137
+ See the [repository README](../../README.md#releasing) for how the publish workflow works.
139
138
 
140
139
  ## License
141
140
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paseo-recap",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Writes a short recap of each agent's goal, progress, and next step after every turn, like Claude Code's session recap.",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -33,11 +33,12 @@
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",
36
- "url": "git+https://github.com/kingsleydon/paseo-recap.git"
36
+ "url": "git+https://github.com/kingsleydon/paseo-plugins.git",
37
+ "directory": "plugins/recap"
37
38
  },
38
- "homepage": "https://github.com/kingsleydon/paseo-recap#readme",
39
+ "homepage": "https://github.com/kingsleydon/paseo-plugins/tree/main/plugins/recap#readme",
39
40
  "bugs": {
40
- "url": "https://github.com/kingsleydon/paseo-recap/issues"
41
+ "url": "https://github.com/kingsleydon/paseo-plugins/issues"
41
42
  },
42
43
  "keywords": [
43
44
  "paseo",
package/server/cli.ts CHANGED
@@ -54,21 +54,29 @@ export function codexArgs(model: string | null, schemaPath: string, outputPath:
54
54
  ];
55
55
  }
56
56
 
57
- export function opencodeArgs(model: string | null, workdir: string): string[] {
57
+ export function opencodeArgs(model: string | null, workdir: string, major: number | null): string[] {
58
+ // The 2.x CLI (@opencode/cli) dropped `run --pure` and `--dir`; 1.x (opencode-ai) still needs
59
+ // them. On 2.x, --standalone avoids a persistent background service. Unknown versions use 1.x flags.
60
+ const legacy = major === null || major < 2;
58
61
  return [
59
62
  "run",
60
- "--pure",
63
+ ...(legacy ? ["--pure"] : ["--standalone"]),
61
64
  "--format",
62
65
  "json",
63
66
  // Read-only agent; without --auto, any permission request is rejected.
64
67
  "--agent",
65
68
  "plan",
66
- "--dir",
67
- workdir,
69
+ ...(legacy ? ["--dir", workdir] : []),
68
70
  ...(model ? ["--model", model] : []),
69
71
  ];
70
72
  }
71
73
 
74
+ /** Parses `opencode --version` output into the CLI generation, or null when it cannot be read. */
75
+ export function parseOpencodeMajor(stdout: string, code: number | null): number | null {
76
+ const major = code === 0 ? Number(/v?(\d+)\./.exec(stdout.trim())?.[1] ?? NaN) : NaN;
77
+ return Number.isFinite(major) ? major : null;
78
+ }
79
+
72
80
  export interface OpencodeOutcome {
73
81
  sessionId: string | null;
74
82
  recap: ParsedRecap;
@@ -1,9 +1,9 @@
1
1
  import { mkdtemp, rm, writeFile } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
- import { claudeArgs, codexArgs, opencodeArgs, parseClaudeResult, parseCodexResult, parseOpencodeEvents } from "./cli";
3
+ import { claudeArgs, codexArgs, opencodeArgs, parseClaudeResult, parseCodexResult, parseOpencodeEvents, parseOpencodeMajor } from "./cli";
4
4
  import { abortError, errorMessage, GeneratorUnavailableError, NoGeneratorError } from "./errors";
5
5
  import type { GeneratorCandidate } from "./models";
6
- import { sanitizeEnv, type RunProcess } from "./process";
6
+ import { sanitizeEnv, type ProcessResult, type RunProcess } from "./process";
7
7
  import { RECAP_JSON_SCHEMA, type ParsedRecap } from "./prompt";
8
8
 
9
9
  const GENERATE_TIMEOUT_MS = 60_000;
@@ -34,6 +34,8 @@ export class RecapGenerator {
34
34
  readonly #unavailableUntil = new Map<string, number>();
35
35
  readonly #waiting: Array<() => void> = [];
36
36
  #active = 0;
37
+ /** Successfully detected opencode CLI generations, keyed by executable and leading arguments. */
38
+ readonly #opencodeMajors = new Map<string, number>();
37
39
 
38
40
  constructor(deps: GeneratorDeps) {
39
41
  this.#deps = deps;
@@ -140,9 +142,10 @@ export class RecapGenerator {
140
142
  return await parseCodexResult(result, outputPath);
141
143
  }
142
144
  case "opencode": {
143
- const parsed = parseOpencodeEvents(await run(opencodeArgs(candidate.model, workdir)));
145
+ const major = await this.#opencodeGeneration(candidate.command, run);
146
+ const parsed = parseOpencodeEvents(await run(opencodeArgs(candidate.model, workdir, major)));
144
147
  // `opencode run` always persists a session; remove it so recaps leave no trace.
145
- if (parsed.sessionId) await this.#deleteOpencodeSession(candidate, parsed.sessionId, workdir, env);
148
+ if (parsed.sessionId) await this.#deleteOpencodeSession(candidate, parsed.sessionId, major, workdir, env);
146
149
  if (parsed.error) throw parsed.error;
147
150
  return parsed.recap;
148
151
  }
@@ -152,9 +155,24 @@ export class RecapGenerator {
152
155
  }
153
156
  }
154
157
 
158
+ /** Caches successful version probes per command; spawn failures propagate as a failed candidate. */
159
+ async #opencodeGeneration(
160
+ command: readonly string[],
161
+ run: (args: readonly string[]) => Promise<ProcessResult>,
162
+ ): Promise<number | null> {
163
+ const key = command.join("\0");
164
+ const cached = this.#opencodeMajors.get(key);
165
+ if (cached !== undefined) return cached;
166
+ const result = await run(["--version"]);
167
+ const major = parseOpencodeMajor(result.stdout, result.code);
168
+ if (major !== null) this.#opencodeMajors.set(key, major);
169
+ return major;
170
+ }
171
+
155
172
  async #deleteOpencodeSession(
156
173
  candidate: GeneratorCandidate,
157
174
  sessionId: string,
175
+ major: number | null,
158
176
  workdir: string,
159
177
  env: NodeJS.ProcessEnv,
160
178
  ): Promise<void> {
@@ -162,7 +180,7 @@ export class RecapGenerator {
162
180
  try {
163
181
  const result = await this.#deps.runProcess(
164
182
  executable,
165
- [...leading, "session", "delete", sessionId],
183
+ [...leading, "session", "delete", ...(major !== null && major >= 2 ? ["--standalone"] : []), sessionId],
166
184
  { stdin: "", cwd: workdir, env, signal: new AbortController().signal, timeoutMs: CLEANUP_TIMEOUT_MS },
167
185
  );
168
186
  if (result.code !== 0) this.#deps.log("could not delete opencode recap session", sessionId);