coauthored 1.0.1 → 1.0.2

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.
@@ -1,11 +1,11 @@
1
1
  import { basename, dirname, join } from 'node:path';
2
2
  import { normalizeContentText } from '../../report/content/redact.js';
3
3
  import { contentExcluded, textParts } from './content.js';
4
- import { arr, count, defineAdapter, fileSession, hasCounts, obj, segments, str, timestamp, tokens } from './shared.js';
4
+ import { arr, count, defineAdapter, fileSession, hasCounts, obj, profileDirs, segments, str, timestamp, tokens } from './shared.js';
5
5
  const usageFields = ['input_tokens', 'output_tokens', 'cache_read_input_tokens', 'cache_creation_input_tokens'];
6
6
  export const claudeCodeAdapter = defineAdapter({
7
7
  id: 'claude-code', displayName: 'Claude Code', tier: 1, defaultRetentionDays: 30,
8
- roots: ({ env, homeDir }) => [join(env.CLAUDE_CONFIG_DIR || join(homeDir, '.claude'), 'projects')],
8
+ roots: ({ env, homeDir }) => profileDirs(homeDir, '.claude', env.CLAUDE_CONFIG_DIR).map((dir) => join(dir, 'projects')),
9
9
  matches(path) {
10
10
  const parts = segments(path);
11
11
  return parts.includes('projects') && /\.jsonl$/i.test(path) &&
@@ -1,16 +1,14 @@
1
1
  import { basename, join } from 'node:path';
2
2
  import { contentExcluded, DeferredContent, textParts } from './content.js';
3
- import { count, defineAdapter, fileSession, hasCounts, obj, parseJson, str, timestamp, tokens } from './shared.js';
3
+ import { count, defineAdapter, fileSession, hasCounts, obj, parseJson, profileDirs, str, timestamp, tokens } from './shared.js';
4
4
  const axes = ['input_tokens', 'cached_input_tokens', 'cache_write_input_tokens', 'output_tokens', 'reasoning_output_tokens'];
5
5
  const isUsage = (value) => hasCounts(value, ['input_tokens', 'output_tokens']);
6
6
  const values = (row) => axes.map(axis => count(row[axis]));
7
7
  const equals = (a, b) => a.every((value, i) => value === b[i]);
8
8
  export const codexCliAdapter = defineAdapter({
9
9
  id: 'codex-cli', displayName: 'Codex CLI', tier: 1, defaultRetentionDays: null,
10
- roots: ({ env, homeDir }) => {
11
- const home = env.CODEX_HOME || join(homeDir, '.codex');
12
- return [join(home, 'sessions'), join(home, 'archived_sessions')];
13
- },
10
+ roots: ({ env, homeDir }) => profileDirs(homeDir, '.codex', env.CODEX_HOME)
11
+ .flatMap((home) => [join(home, 'sessions'), join(home, 'archived_sessions')]),
14
12
  matches(path) {
15
13
  return /^rollout[-_].*\.jsonl$/i.test(basename(path));
16
14
  },
@@ -1,4 +1,5 @@
1
1
  import { createHmac } from 'node:crypto';
2
+ import { readdirSync, realpathSync } from 'node:fs';
2
3
  import { basename, dirname, join, relative } from 'node:path';
3
4
  import { toolArgumentText } from './content.js';
4
5
  import { INJECTED_USER_TEXT } from '../../report/content/policy.js';
@@ -51,6 +52,43 @@ export function timestamp(...values) {
51
52
  }
52
53
  return undefined;
53
54
  }
55
+ /**
56
+ * Profile folders of one harness in the home directory: the one an env var names, the default (`.claude`), and
57
+ * sibling profiles such as `.claude_second` or `.claude-work` that wrappers create with CLAUDE_CONFIG_DIR or
58
+ * CODEX_HOME. Only directory names in the home folder are listed here; nothing inside them is read.
59
+ * The same folder reached twice (through the env var or a link) is kept once, by its real path.
60
+ */
61
+ export function profileDirs(homeDir, base, fromEnv) {
62
+ const found = [fromEnv, join(homeDir, base)];
63
+ const prefix = base.toLowerCase();
64
+ try {
65
+ for (const entry of readdirSync(homeDir, { withFileTypes: true })) {
66
+ const name = entry.name.toLowerCase();
67
+ if (!entry.isDirectory() || name.length > prefix.length + 40 || !name.startsWith(prefix))
68
+ continue;
69
+ const rest = name.slice(prefix.length);
70
+ if (/^[-_.][a-z0-9][a-z0-9_.-]*$/.test(rest) && !/\.(json|bak|old|tmp|lock)$/.test(rest))
71
+ found.push(join(homeDir, entry.name));
72
+ }
73
+ }
74
+ catch {
75
+ // An unreadable home folder leaves the env var and the default.
76
+ }
77
+ const seen = new Set();
78
+ return found.filter((dir) => {
79
+ if (!dir)
80
+ return false;
81
+ let key = dir.toLowerCase();
82
+ try {
83
+ key = realpathSync.native(dir).toLowerCase();
84
+ }
85
+ catch { /* missing: kept, discovery skips it */ }
86
+ if (seen.has(key))
87
+ return false;
88
+ seen.add(key);
89
+ return true;
90
+ });
91
+ }
54
92
  export function defineAdapter(spec) {
55
93
  const version = '1.0.0';
56
94
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coauthored",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Your 2026 agentic coding year, recovered and read out as an offline, privacy-first flight recorder report.",
5
5
  "license": "MIT",
6
6
  "type": "module",