@justjoshn/pi-pstack-v2 0.1.2 → 0.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justjoshn/pi-pstack-v2",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Use the pstack skills and workflow in Pi, with sandboxed Pi workers and shell jobs running in tmux.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,4 +1,4 @@
1
- import { existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
1
+ import { copyFileSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
2
2
  import { isAbsolute, join, resolve } from 'node:path';
3
3
 
4
4
  /**
@@ -12,9 +12,7 @@ type Credentials = Record<string, Record<string, unknown>>;
12
12
 
13
13
  export const jobAgentDir = (top: string): string => join(top, 'agent');
14
14
 
15
- // Entries a job's Pi must not share: your credentials, its lock, pstack's own state, and your saved sessions. Settings are
16
- // copied with their paths rewritten, since Pi resolves them from the agent directory, which is a different one in a job.
17
- const PRIVATE = new Set(['auth.json', 'auth.json.lock', 'pstack-v2', 'sessions', 'settings.json', 'settings.json.lock']);
15
+ const PRIVATE = new Set(['auth.json', 'auth.json.lock', 'models-store.json', 'models-store.json.lock', 'pstack-v2', 'sessions', 'settings.json', 'settings.json.lock']);
18
16
 
19
17
  /** A settings path as it resolves from your real agent directory: local ones made absolute, sources and names kept. */
20
18
  function anchored(realAgentDir: string, entry: string): string {
@@ -74,6 +72,8 @@ export function makeJobAgentDir(realAgentDir: string, dir: string, resolved: Rec
74
72
  const link = join(dir, name);
75
73
  if (!PRIVATE.has(name) && !existsSync(link) && !isLink(link)) symlinkSync(join(realAgentDir, name), link);
76
74
  }
75
+ const catalog = join(realAgentDir, 'models-store.json');
76
+ if (existsSync(catalog)) copyFileSync(catalog, join(dir, 'models-store.json'));
77
77
  const settings = join(realAgentDir, 'settings.json');
78
78
  const parsed = existsSync(settings) ? parse(readFileSync(settings, 'utf8')) : undefined;
79
79
  if (parsed) writeFileSync(join(dir, 'settings.json'), `${JSON.stringify(anchoredSettings(realAgentDir, parsed), null, 2)}\n`);