pi-durable-subagents 1.0.18 → 1.0.19

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.19
4
+
5
+ - The orchestrator no longer keeps every workflow's pinned origin branch (the
6
+ parent session copied for `context: "fork"`) and input bytes in memory; they
7
+ are read from the pinned files when needed. With about 110 workflows of
8
+ history, the orchestrator heap had grown to 3.7 GB; on a copy of that
9
+ history it now stays near 120 MB.
10
+
3
11
  ## 1.0.18
4
12
 
5
13
  - The orchestrator uses far less CPU. Running calls share one process-table
@@ -557,7 +557,7 @@ export class Engine {
557
557
  throw new Error(`Unknown pinned agent: ${spec.agent}`);
558
558
  return { wid: st.wf.wid, widRev: `${st.wf.wid}@${st.wf.revision}`, key: entry.key, gen: entry.gen,
559
559
  callId: `${st.wf.wid}@${st.wf.revision}/${entry.key}@${entry.gen}`, spec, agent, workflowBudget: st.wf.pins.usageBudget, cwd: resolve(st.wf.cwd, spec.cwd ?? '.'), journal: st.wf.journal,
560
- ...(st.wf.pins.origin !== undefined ? { originSession: join(pinnedDir(this.ledgers.home, st.wf.wid), ...(st.wf.revision === 1 ? [] : [`r${st.wf.revision}`]), 'origin.jsonl') } : {}),
560
+ ...(st.wf.originPath !== undefined ? { originSession: st.wf.originPath } : {}),
561
561
  ...(entry.type === 'generation' ? { continueFrom: entry.from, opening: entry.opening } : {}),
562
562
  ...(entry.type === 'generation' && typeof entry.model === 'string' ? { model: entry.model } : {}) };
563
563
  }
@@ -190,8 +190,10 @@ export class Store {
190
190
  body = req.body;
191
191
  snapshot = { hash: contentHash(req), pins: await prepareRun({ ...body, maxCalls: body.maxCalls ?? this.ledgers.config.k?.spawnBudget ?? 300 }, discovery, warnings),
192
192
  ...(warnings.length ? { warnings } : {}) };
193
- if (req.kind === 'revise')
194
- snapshot.pins.origin = this.workflows.get(req.body.wid)?.pins.origin;
193
+ if (req.kind === 'revise') {
194
+ const prior = this.workflows.get(req.body.wid)?.originPath;
195
+ snapshot.pins.origin = prior === undefined ? undefined : await readFile(prior, 'utf8');
196
+ }
195
197
  }
196
198
  catch (error) {
197
199
  if (transient(error))
@@ -294,7 +296,8 @@ export class Store {
294
296
  inputs[name] = join(dir, 'inputs', file);
295
297
  }
296
298
  await publish(dir, 'inputs.json', JSON.stringify(inputs));
297
- return { pins, scriptPath: join(dir, 'script.js'), inputs };
299
+ const { origin, inputs: _bytes, ...kept } = pins;
300
+ return { pins: { ...kept, inputs: {} }, scriptPath: join(dir, 'script.js'), inputs, originPath: origin === undefined ? undefined : join(dir, 'origin.jsonl') };
298
301
  }
299
302
  /** P14, A2: Publish a new revision only after the engine has retired its predecessor. */
300
303
  async revise(intent) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-durable-subagents",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "Subagents for pi that never lose work and never do it twice. Crash-safe workflows, automatic recovery, and a live view just like the main agent.",
5
5
  "type": "module",
6
6
  "license": "MIT",