agentic-dataset-builder 0.2.1 → 0.2.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/README.md CHANGED
@@ -18,7 +18,7 @@ The CLI is native Node.js + TypeScript. It does not require Python.
18
18
  If the package is published on npm:
19
19
 
20
20
  ```bash
21
- npx --registry=https://registry.npmjs.org/ agentic-dataset-builder@0.2.1 --output-root ./out
21
+ npx --registry=https://registry.npmjs.org/ agentic-dataset-builder@0.2.3 --output-root ./out
22
22
  ```
23
23
 
24
24
  If working from this repo locally:
package/dist/cli.js CHANGED
@@ -10,10 +10,10 @@ import { Qwen35RecordSchema } from './schemas/qwen35.js';
10
10
  import { writeParquet } from './parquet.js';
11
11
  function parseArgs(argv) {
12
12
  if (argv.includes('--help') || argv.includes('-h')) {
13
- console.log(`agentic-dataset-builder@0.2.1
13
+ console.log(`agentic-dataset-builder@0.2.3
14
14
 
15
15
  Usage:
16
- npx agentic-dataset-builder@0.2.1 --output-root ./out
16
+ npx agentic-dataset-builder@0.2.3 --output-root ./out
17
17
 
18
18
  Options:
19
19
  --output-root <dir> Output directory root
@@ -1,13 +1,36 @@
1
1
  import os from 'node:os';
2
2
  import path from 'node:path';
3
3
  import fs from 'node:fs';
4
+ function currentPlatform() {
5
+ return process.platform;
6
+ }
7
+ function xdgConfigHome() {
8
+ return process.env.XDG_CONFIG_HOME;
9
+ }
10
+ function xdgDataHome() {
11
+ return process.env.XDG_DATA_HOME;
12
+ }
13
+ function macAppSupportHome() {
14
+ if (currentPlatform() !== 'darwin')
15
+ return undefined;
16
+ return path.join(os.homedir(), 'Library', 'Application Support');
17
+ }
4
18
  export function candidatePiRoots() {
5
19
  const home = os.homedir();
6
20
  const appdata = process.env.APPDATA;
7
21
  const localappdata = process.env.LOCALAPPDATA;
22
+ const xdgConfig = xdgConfigHome();
23
+ const xdgData = xdgDataHome();
24
+ const macAppSupport = macAppSupportHome();
8
25
  return dedupe([
9
26
  process.env.PI_SESSION_ROOT,
10
27
  path.join(home, '.pi', 'agent', 'sessions'),
28
+ xdgConfig ? path.join(xdgConfig, 'pi', 'agent', 'sessions') : undefined,
29
+ xdgConfig ? path.join(xdgConfig, '.pi', 'agent', 'sessions') : undefined,
30
+ xdgData ? path.join(xdgData, 'pi', 'agent', 'sessions') : undefined,
31
+ xdgData ? path.join(xdgData, '.pi', 'agent', 'sessions') : undefined,
32
+ macAppSupport ? path.join(macAppSupport, 'pi', 'agent', 'sessions') : undefined,
33
+ macAppSupport ? path.join(macAppSupport, '.pi', 'agent', 'sessions') : undefined,
11
34
  appdata ? path.join(appdata, 'pi', 'agent', 'sessions') : undefined,
12
35
  appdata ? path.join(appdata, '.pi', 'agent', 'sessions') : undefined,
13
36
  localappdata ? path.join(localappdata, 'pi', 'agent', 'sessions') : undefined,
@@ -18,9 +41,18 @@ export function candidateCodexRoots() {
18
41
  const home = os.homedir();
19
42
  const appdata = process.env.APPDATA;
20
43
  const localappdata = process.env.LOCALAPPDATA;
44
+ const xdgConfig = xdgConfigHome();
45
+ const xdgData = xdgDataHome();
46
+ const macAppSupport = macAppSupportHome();
21
47
  return dedupe([
22
48
  process.env.CODEX_SESSION_ROOT,
23
49
  path.join(home, '.codex', 'sessions'),
50
+ xdgConfig ? path.join(xdgConfig, 'codex', 'sessions') : undefined,
51
+ xdgConfig ? path.join(xdgConfig, '.codex', 'sessions') : undefined,
52
+ xdgData ? path.join(xdgData, 'codex', 'sessions') : undefined,
53
+ xdgData ? path.join(xdgData, '.codex', 'sessions') : undefined,
54
+ macAppSupport ? path.join(macAppSupport, 'Codex', 'sessions') : undefined,
55
+ macAppSupport ? path.join(macAppSupport, '.codex', 'sessions') : undefined,
24
56
  appdata ? path.join(appdata, 'Codex', 'sessions') : undefined,
25
57
  appdata ? path.join(appdata, '.codex', 'sessions') : undefined,
26
58
  localappdata ? path.join(localappdata, 'Codex', 'sessions') : undefined,
@@ -31,9 +63,18 @@ export function candidateClaudeRoots() {
31
63
  const home = os.homedir();
32
64
  const appdata = process.env.APPDATA;
33
65
  const localappdata = process.env.LOCALAPPDATA;
66
+ const xdgConfig = xdgConfigHome();
67
+ const xdgData = xdgDataHome();
68
+ const macAppSupport = macAppSupportHome();
34
69
  return dedupe([
35
70
  process.env.CLAUDE_SESSION_ROOT,
36
71
  path.join(home, '.claude', 'projects'),
72
+ xdgConfig ? path.join(xdgConfig, 'claude', 'projects') : undefined,
73
+ xdgConfig ? path.join(xdgConfig, '.claude', 'projects') : undefined,
74
+ xdgData ? path.join(xdgData, 'claude', 'projects') : undefined,
75
+ xdgData ? path.join(xdgData, '.claude', 'projects') : undefined,
76
+ macAppSupport ? path.join(macAppSupport, 'Claude', 'projects') : undefined,
77
+ macAppSupport ? path.join(macAppSupport, '.claude', 'projects') : undefined,
37
78
  appdata ? path.join(appdata, 'Claude', 'projects') : undefined,
38
79
  appdata ? path.join(appdata, '.claude', 'projects') : undefined,
39
80
  localappdata ? path.join(localappdata, 'Claude', 'projects') : undefined,
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';
2
+ const envBackup = { ...process.env };
3
+ describe('platform path candidates', () => {
4
+ beforeEach(() => {
5
+ vi.resetModules();
6
+ process.env = { ...envBackup };
7
+ });
8
+ afterEach(() => {
9
+ process.env = { ...envBackup };
10
+ vi.unstubAllGlobals();
11
+ });
12
+ it('includes XDG candidates for pi on linux', async () => {
13
+ process.env.XDG_CONFIG_HOME = '/home/test/.config';
14
+ process.env.XDG_DATA_HOME = '/home/test/.local/share';
15
+ vi.stubGlobal('process', { ...process, platform: 'linux', env: process.env });
16
+ const mod = await import('./paths.js');
17
+ const candidates = mod.candidatePiRoots();
18
+ expect(candidates).toContain('/home/test/.config/pi/agent/sessions');
19
+ expect(candidates).toContain('/home/test/.local/share/pi/agent/sessions');
20
+ });
21
+ it('includes Application Support candidates for codex on macOS', async () => {
22
+ vi.stubGlobal('process', { ...process, platform: 'darwin', env: process.env });
23
+ const mod = await import('./paths.js');
24
+ const candidates = mod.candidateCodexRoots();
25
+ expect(candidates.some((value) => value.includes('Library/Application Support/Codex/sessions'))).toBe(true);
26
+ });
27
+ it('includes APPDATA and LOCALAPPDATA candidates for claude on Windows', async () => {
28
+ process.env.APPDATA = 'C:/Users/test/AppData/Roaming';
29
+ process.env.LOCALAPPDATA = 'C:/Users/test/AppData/Local';
30
+ vi.stubGlobal('process', { ...process, platform: 'win32', env: process.env });
31
+ const mod = await import('./paths.js');
32
+ const candidates = mod.candidateClaudeRoots();
33
+ expect(candidates).toContain('C:/Users/test/AppData/Roaming/Claude/projects');
34
+ expect(candidates).toContain('C:/Users/test/AppData/Local/Claude/projects');
35
+ });
36
+ });
@@ -68,8 +68,16 @@ class TurnBuilder {
68
68
  this.flushAssistant();
69
69
  if (role === 'user')
70
70
  this.messages.push({ role: 'user', content: text });
71
- else if (role === 'developer' && text)
72
- this.messages.push({ role: 'system', content: text });
71
+ else if (role === 'developer' && text) {
72
+ const seenNonSystem = this.messages.some((message) => message.role !== 'system');
73
+ if (seenNonSystem) {
74
+ this.lossyReasons.add('late_developer_message_demoted');
75
+ this.messages.push({ role: 'assistant', content: `[developer]\n${text}` });
76
+ }
77
+ else {
78
+ this.messages.push({ role: 'system', content: text });
79
+ }
80
+ }
73
81
  }
74
82
  ingestReasoning(payload) {
75
83
  const summary = Array.isArray(payload.summary) ? payload.summary : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-dataset-builder",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Pure TypeScript agentic dataset builder for Pi, Codex, and Claude Code history",
5
5
  "license": "MIT",
6
6
  "type": "module",