harnessed 4.42.0 → 4.43.1

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.
@@ -13,35 +13,80 @@ function isAblated(env = process.env) {
13
13
  return env.HARNESSED_OFF === '1'
14
14
  }
15
15
 
16
- // src/checkpoint/hookStateRoot.ts
16
+ // src/platform/platform.ts
17
17
  import { existsSync, readFileSync } from 'node:fs'
18
18
  import { homedir } from 'node:os'
19
19
  import { join } from 'node:path'
20
- function hookStateRoot(home = homedir()) {
21
- const override = process.env.HARNESSED_ROOT_OVERRIDE
22
- if (override !== void 0 && override !== '') return override
20
+ function claudeDescriptor(home = homedir()) {
23
21
  const claudeHome = join(home, '.claude')
22
+ return {
23
+ id: 'claude',
24
+ homeDir: claudeHome,
25
+ stateRoot: join(claudeHome, 'harnessed'),
26
+ settingsPath: join(claudeHome, 'settings.json'),
27
+ skillsDir: join(claudeHome, 'skills'),
28
+ commandsDir: join(claudeHome, 'commands'),
29
+ pluginsRegistry: join(claudeHome, 'plugins', 'installed_plugins.json'),
30
+ // mcpConfigPath is a SIBLING of `.claude` (`<home>/.claude.json`), based on
31
+ // the same home base — not a child of homeDir.
32
+ mcpConfigPath: join(home, '.claude.json'),
33
+ // claude writes its env keys into JSON settings.json (capability present).
34
+ supportsEnvKeyWrite: true,
35
+ // Claude Code exposes the active session id to Bash-invoked CLI + hooks.
36
+ sessionIdEnv: 'CLAUDE_CODE_SESSION_ID',
37
+ }
38
+ }
39
+ function codexDescriptor(home = homedir()) {
24
40
  const codexHome = join(home, '.codex')
25
- const rootOf = (id) =>
26
- id === 'claude'
27
- ? join(claudeHome, 'harnessed')
28
- : id === 'codex'
29
- ? join(codexHome, 'harnessed')
30
- : null
31
- const env = process.env.HARNESSED_PLATFORM
32
- if (env !== void 0 && env !== '') {
33
- const r = rootOf(env)
34
- if (r) return r
41
+ const configToml = join(codexHome, 'config.toml')
42
+ return {
43
+ id: 'codex',
44
+ homeDir: codexHome,
45
+ stateRoot: join(codexHome, 'harnessed'),
46
+ settingsPath: null,
47
+ // SHARED convention dir, NOT <homeDir>/skills.
48
+ skillsDir: join(home, '.agents', 'skills'),
49
+ commandsDir: join(codexHome, 'prompts'),
50
+ pluginsRegistry: null,
51
+ mcpConfigPath: configToml,
52
+ supportsEnvKeyWrite: false,
53
+ // Measured on codex-cli 0.154: codex shells carry it, equal to hook session_id.
54
+ sessionIdEnv: 'CODEX_SESSION_ID',
55
+ }
56
+ }
57
+ function descriptorById(id, home) {
58
+ if (id === 'claude') return claudeDescriptor(home)
59
+ if (id === 'codex') return codexDescriptor(home)
60
+ return void 0
61
+ }
62
+ function detectPlatform(home = homedir()) {
63
+ const resolved = resolveHost(home)
64
+ const override = process.env.HARNESSED_ROOT_OVERRIDE
65
+ if (override !== void 0 && override !== '') return { ...resolved, stateRoot: override }
66
+ return resolved
67
+ }
68
+ function resolveHost(home) {
69
+ const base = claudeDescriptor(home)
70
+ const envPlatform = process.env.HARNESSED_PLATFORM
71
+ if (envPlatform !== void 0 && envPlatform !== '') {
72
+ const d = descriptorById(envPlatform, home)
73
+ if (d) return d
74
+ }
75
+ const inClaude = Boolean(process.env.CLAUDE_CODE_SESSION_ID?.trim())
76
+ const inCodex = Boolean(process.env.CODEX_SESSION_ID?.trim())
77
+ if (inClaude !== inCodex) return inClaude ? base : codexDescriptor(home)
78
+ for (const pinRoot of [codexDescriptor(home).stateRoot, base.stateRoot]) {
79
+ try {
80
+ const d = descriptorById(readFileSync(join(pinRoot, '.platform'), 'utf8').trim(), home)
81
+ if (d) return d
82
+ } catch {}
35
83
  }
36
84
  try {
37
- const r = rootOf(readFileSync(join(claudeHome, 'harnessed', '.platform'), 'utf8').trim())
38
- if (r) return r
39
- } catch {}
40
- try {
41
- if (existsSync(claudeHome)) return join(claudeHome, 'harnessed')
42
- if (existsSync(codexHome)) return join(codexHome, 'harnessed')
85
+ if (existsSync(base.homeDir)) return base
86
+ const codex = codexDescriptor(home)
87
+ if (existsSync(codex.homeDir)) return codex
43
88
  } catch {}
44
- return join(claudeHome, 'harnessed')
89
+ return base
45
90
  }
46
91
 
47
92
  // src/checkpoint/injectCache.ts
@@ -449,14 +494,6 @@ function repoKey(cwd) {
449
494
  }
450
495
  return resolve(cwd)
451
496
  }
452
- function harnessedRoot() {
453
- return hookStateRoot()
454
- }
455
- function sessionIdEnvName() {
456
- const platform = (process.env.HARNESSED_PLATFORM || 'claude').trim()
457
- if (platform === 'codex') return null
458
- return 'CLAUDE_CODE_SESSION_ID'
459
- }
460
497
  function readWorkflow(root, keys) {
461
498
  let wf = null
462
499
  let intent = null
@@ -508,13 +545,14 @@ function shouldEmitPc(root, repoRoot, sid, pc) {
508
545
  function main() {
509
546
  if (isAblated()) return
510
547
  try {
511
- const root = harnessedRoot()
548
+ const platform = detectPlatform()
549
+ const root = platform.stateRoot
512
550
  if (process.argv.includes('--invalidate')) {
513
551
  invalidateInjectCache(root)
514
552
  return
515
553
  }
516
554
  const key = repoKey(process.cwd())
517
- const envName = sessionIdEnvName()
555
+ const envName = platform.sessionIdEnv
518
556
  const sid = envName ? process.env[envName]?.trim() : void 0
519
557
  const { wf, intent, ledgerAgeMs } = readWorkflow(root, sid ? [`${key}::${sid}`, key] : [key])
520
558
  let learningsMd = ''
@@ -18,35 +18,80 @@ function isAblated(env = process.env) {
18
18
  return env.HARNESSED_OFF === '1'
19
19
  }
20
20
 
21
- // src/checkpoint/hookStateRoot.ts
21
+ // src/platform/platform.ts
22
22
  import { existsSync, readFileSync } from 'node:fs'
23
23
  import { homedir } from 'node:os'
24
24
  import { join } from 'node:path'
25
- function hookStateRoot(home = homedir()) {
26
- const override = process.env.HARNESSED_ROOT_OVERRIDE
27
- if (override !== void 0 && override !== '') return override
25
+ function claudeDescriptor(home = homedir()) {
28
26
  const claudeHome = join(home, '.claude')
27
+ return {
28
+ id: 'claude',
29
+ homeDir: claudeHome,
30
+ stateRoot: join(claudeHome, 'harnessed'),
31
+ settingsPath: join(claudeHome, 'settings.json'),
32
+ skillsDir: join(claudeHome, 'skills'),
33
+ commandsDir: join(claudeHome, 'commands'),
34
+ pluginsRegistry: join(claudeHome, 'plugins', 'installed_plugins.json'),
35
+ // mcpConfigPath is a SIBLING of `.claude` (`<home>/.claude.json`), based on
36
+ // the same home base — not a child of homeDir.
37
+ mcpConfigPath: join(home, '.claude.json'),
38
+ // claude writes its env keys into JSON settings.json (capability present).
39
+ supportsEnvKeyWrite: true,
40
+ // Claude Code exposes the active session id to Bash-invoked CLI + hooks.
41
+ sessionIdEnv: 'CLAUDE_CODE_SESSION_ID',
42
+ }
43
+ }
44
+ function codexDescriptor(home = homedir()) {
29
45
  const codexHome = join(home, '.codex')
30
- const rootOf = (id) =>
31
- id === 'claude'
32
- ? join(claudeHome, 'harnessed')
33
- : id === 'codex'
34
- ? join(codexHome, 'harnessed')
35
- : null
36
- const env = process.env.HARNESSED_PLATFORM
37
- if (env !== void 0 && env !== '') {
38
- const r = rootOf(env)
39
- if (r) return r
46
+ const configToml = join(codexHome, 'config.toml')
47
+ return {
48
+ id: 'codex',
49
+ homeDir: codexHome,
50
+ stateRoot: join(codexHome, 'harnessed'),
51
+ settingsPath: null,
52
+ // SHARED convention dir, NOT <homeDir>/skills.
53
+ skillsDir: join(home, '.agents', 'skills'),
54
+ commandsDir: join(codexHome, 'prompts'),
55
+ pluginsRegistry: null,
56
+ mcpConfigPath: configToml,
57
+ supportsEnvKeyWrite: false,
58
+ // Measured on codex-cli 0.154: codex shells carry it, equal to hook session_id.
59
+ sessionIdEnv: 'CODEX_SESSION_ID',
60
+ }
61
+ }
62
+ function descriptorById(id, home) {
63
+ if (id === 'claude') return claudeDescriptor(home)
64
+ if (id === 'codex') return codexDescriptor(home)
65
+ return void 0
66
+ }
67
+ function detectPlatform(home = homedir()) {
68
+ const resolved = resolveHost(home)
69
+ const override = process.env.HARNESSED_ROOT_OVERRIDE
70
+ if (override !== void 0 && override !== '') return { ...resolved, stateRoot: override }
71
+ return resolved
72
+ }
73
+ function resolveHost(home) {
74
+ const base = claudeDescriptor(home)
75
+ const envPlatform = process.env.HARNESSED_PLATFORM
76
+ if (envPlatform !== void 0 && envPlatform !== '') {
77
+ const d = descriptorById(envPlatform, home)
78
+ if (d) return d
79
+ }
80
+ const inClaude = Boolean(process.env.CLAUDE_CODE_SESSION_ID?.trim())
81
+ const inCodex = Boolean(process.env.CODEX_SESSION_ID?.trim())
82
+ if (inClaude !== inCodex) return inClaude ? base : codexDescriptor(home)
83
+ for (const pinRoot of [codexDescriptor(home).stateRoot, base.stateRoot]) {
84
+ try {
85
+ const d = descriptorById(readFileSync(join(pinRoot, '.platform'), 'utf8').trim(), home)
86
+ if (d) return d
87
+ } catch {}
40
88
  }
41
89
  try {
42
- const r = rootOf(readFileSync(join(claudeHome, 'harnessed', '.platform'), 'utf8').trim())
43
- if (r) return r
44
- } catch {}
45
- try {
46
- if (existsSync(claudeHome)) return join(claudeHome, 'harnessed')
47
- if (existsSync(codexHome)) return join(codexHome, 'harnessed')
90
+ if (existsSync(base.homeDir)) return base
91
+ const codex = codexDescriptor(home)
92
+ if (existsSync(codex.homeDir)) return codex
48
93
  } catch {}
49
- return join(claudeHome, 'harnessed')
94
+ return base
50
95
  }
51
96
 
52
97
  // src/checkpoint/modeBDetect.ts
@@ -82,7 +127,7 @@ function detectModeB(content) {
82
127
  // src/checkpoint/stopHookMain.ts
83
128
  var MAX_RETRIES = 2
84
129
  function stateRoot() {
85
- return hookStateRoot()
130
+ return detectPlatform().stateRoot
86
131
  }
87
132
  function messageSig(content) {
88
133
  const text = content
package/dist/cli.mjs CHANGED
@@ -38,7 +38,7 @@ var init_package = __esm({
38
38
  "package.json"() {
39
39
  package_default = {
40
40
  name: "harnessed",
41
- version: "4.42.0",
41
+ version: "4.43.1",
42
42
  description: "AI coding harness package manager + composition orchestrator",
43
43
  type: "module",
44
44
  license: "Apache-2.0",
@@ -182,15 +182,15 @@ function codexDescriptor(home = homedir()) {
182
182
  id: "codex",
183
183
  homeDir: codexHome,
184
184
  stateRoot: join(codexHome, "harnessed"),
185
- settingsPath: configToml,
185
+ settingsPath: null,
186
186
  // SHARED convention dir, NOT <homeDir>/skills.
187
187
  skillsDir: join(home, ".agents", "skills"),
188
188
  commandsDir: join(codexHome, "prompts"),
189
189
  pluginsRegistry: null,
190
190
  mcpConfigPath: configToml,
191
191
  supportsEnvKeyWrite: false,
192
- // No verified codex session-id env → single-session fallback (anti-stale).
193
- sessionIdEnv: null
192
+ // Measured on codex-cli 0.154: codex shells carry it, equal to hook session_id.
193
+ sessionIdEnv: "CODEX_SESSION_ID"
194
194
  };
195
195
  }
196
196
  function descriptorById(id, home) {
@@ -199,19 +199,27 @@ function descriptorById(id, home) {
199
199
  return void 0;
200
200
  }
201
201
  function detectPlatform(home = homedir()) {
202
- const base = claudeDescriptor(home);
202
+ const resolved = resolveHost(home);
203
203
  const override = process.env.HARNESSED_ROOT_OVERRIDE;
204
- if (override !== void 0 && override !== "") return { ...base, stateRoot: override };
204
+ if (override !== void 0 && override !== "") return { ...resolved, stateRoot: override };
205
+ return resolved;
206
+ }
207
+ function resolveHost(home) {
208
+ const base = claudeDescriptor(home);
205
209
  const envPlatform = process.env.HARNESSED_PLATFORM;
206
210
  if (envPlatform !== void 0 && envPlatform !== "") {
207
211
  const d = descriptorById(envPlatform, home);
208
212
  if (d) return d;
209
213
  }
210
- try {
211
- const pin = readFileSync(join(base.stateRoot, ".platform"), "utf8").trim();
212
- const d = descriptorById(pin, home);
213
- if (d) return d;
214
- } catch {
214
+ const inClaude = Boolean(process.env.CLAUDE_CODE_SESSION_ID?.trim());
215
+ const inCodex = Boolean(process.env.CODEX_SESSION_ID?.trim());
216
+ if (inClaude !== inCodex) return inClaude ? base : codexDescriptor(home);
217
+ for (const pinRoot of [codexDescriptor(home).stateRoot, base.stateRoot]) {
218
+ try {
219
+ const d = descriptorById(readFileSync(join(pinRoot, ".platform"), "utf8").trim(), home);
220
+ if (d) return d;
221
+ } catch {
222
+ }
215
223
  }
216
224
  try {
217
225
  if (existsSync(base.homeDir)) return base;
@@ -1935,7 +1943,7 @@ var init_en = __esm({
1935
1943
  "setup.doctor_hint": "\nRun harnessed doctor to verify your environment.",
1936
1944
  "agent_teams.missing_header": "\n\u26A0\uFE0F Agent Teams not enabled \u2014 parallelism upgrade path unavailable",
1937
1945
  "agent_teams.missing_fix": " fix: claude config set env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS 1",
1938
- "agent_teams.missing_explanation": " harnessed task parallelism uses Subagent or Agent Teams (CC 2.1.133+)",
1946
+ "agent_teams.missing_explanation": " harnessed task parallelism uses Subagent or Agent Teams (CC 2.1.178+)",
1939
1947
  "agent_teams.missing_nonblocking": " non-blocking \u2014 auto-degrades to subagent fan-out\n",
1940
1948
  "install.manifest_not_found": "error: manifest '{{name}}' not found",
1941
1949
  "install.manifest_not_found.fix": " fix: ensure manifests/tools/{{name}}.yaml, manifests/skill-packs/{{name}}.yaml, or manifests/optional/{{name}}.yaml exists",
@@ -2493,6 +2501,7 @@ async function isPluginRegistered(pluginName) {
2493
2501
  }
2494
2502
  }
2495
2503
  for (const path of [getSettingsPath(), getMcpConfigPath()]) {
2504
+ if (path === null) continue;
2496
2505
  try {
2497
2506
  const raw = await readFile(path, "utf8");
2498
2507
  const parsed = JSON.parse(raw);
@@ -2513,6 +2522,8 @@ var init_readClaudeConfig = __esm({
2513
2522
  });
2514
2523
  async function mergeSettingsEnvKey(key, value, opts = {}) {
2515
2524
  const path = getSettingsPath();
2525
+ if (path === null)
2526
+ return { outcome: "warn", message: `no settings file on ${detectPlatform().id} \u2014 skipped` };
2516
2527
  let raw;
2517
2528
  try {
2518
2529
  raw = await readFile(path, "utf8");
@@ -2644,7 +2655,8 @@ function planEnvExemption(existing) {
2644
2655
  async function readCurrentEnvValue(deps = {}) {
2645
2656
  const readSettings = deps.readSettings ?? (async () => {
2646
2657
  try {
2647
- return await readFile(getSettingsPath(), "utf8");
2658
+ const path = getSettingsPath();
2659
+ return path === null ? null : await readFile(path, "utf8");
2648
2660
  } catch {
2649
2661
  return null;
2650
2662
  }
@@ -2668,7 +2680,7 @@ function previewLines(existing, newValue) {
2668
2680
  const change = existing === void 0 ? ` + env.${EXEMPT_ENV_KEY} = "${newValue}"` : ` ~ env.${EXEMPT_ENV_KEY}: "${existing}" \u2192 "${newValue}"`;
2669
2681
  return [
2670
2682
  `[harnessed] GateGuard \u2194 evidence-guard conflict \u2014 sanctioned fix available:`,
2671
- ` file: ${getSettingsPath()}`,
2683
+ ` file: ${getSettingsPath() ?? "(no settings file on this platform)"}`,
2672
2684
  change,
2673
2685
  ` backup: settings.json.<timestamp>.bak under the harnessed backups dir (written first)`
2674
2686
  ];
@@ -2764,7 +2776,8 @@ function defaultDeps() {
2764
2776
  env: process.env,
2765
2777
  readSettings: async () => {
2766
2778
  try {
2767
- return await readFile(getSettingsPath(), "utf8");
2779
+ const path = getSettingsPath();
2780
+ return path === null ? null : await readFile(path, "utf8");
2768
2781
  } catch {
2769
2782
  return null;
2770
2783
  }
@@ -4798,7 +4811,7 @@ async function checkAgentTeams() {
4798
4811
  let settingsOn = false;
4799
4812
  try {
4800
4813
  const path = getSettingsPath();
4801
- const raw = await readFile(path, "utf8");
4814
+ const raw = path === null ? "{}" : await readFile(path, "utf8");
4802
4815
  const data = JSON.parse(raw);
4803
4816
  settingsValue = data.env?.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS;
4804
4817
  settingsOn = settingsValue === "1";
@@ -4813,7 +4826,7 @@ async function checkAgentTeams() {
4813
4826
  detected,
4814
4827
  envValue,
4815
4828
  settingsValue,
4816
- remediation: 'Agent Teams not enabled. Add to ~/.claude/settings.json:\n "env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" }\nOR run: claude config set env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS 1\nOR export env var:\n export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1\nThen restart Claude Code (CC >= 2.1.133 required).'
4829
+ remediation: 'Agent Teams not enabled. Add to ~/.claude/settings.json:\n "env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" }\nOR run: claude config set env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS 1\nOR export env var:\n export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1\nThen restart Claude Code (CC >= 2.1.178 required).'
4817
4830
  };
4818
4831
  }
4819
4832
  var init_checkAgentTeams = __esm({
@@ -5015,7 +5028,8 @@ async function probeSearchMcpKey(server) {
5015
5028
  } catch {
5016
5029
  }
5017
5030
  try {
5018
- const raw = await readFile(getSettingsPath(), "utf8");
5031
+ const path = getSettingsPath();
5032
+ const raw = path === null ? "{}" : await readFile(path, "utf8");
5019
5033
  const parsed = JSON.parse(raw);
5020
5034
  if (parsed?.env && nonEmpty(parsed.env[envVar])) {
5021
5035
  return { server, envVar, present: true, source: "settings-env" };
@@ -5953,6 +5967,12 @@ function checkStaleHooks(deps) {
5953
5967
  }
5954
5968
  });
5955
5969
  const exists = deps?.exists ?? existsSync;
5970
+ if (settingsPath === null)
5971
+ return {
5972
+ name: NAME,
5973
+ status: "pass",
5974
+ message: `no settings file on ${detectPlatform().id} \u2014 skipped`
5975
+ };
5956
5976
  const raw = readText(settingsPath);
5957
5977
  if (raw === null) return { name: NAME, status: "pass", message: "no settings.json" };
5958
5978
  let data;
@@ -6145,6 +6165,12 @@ function checkInjectInvalidate(deps) {
6145
6165
  return null;
6146
6166
  }
6147
6167
  });
6168
+ if (settingsPath === null)
6169
+ return {
6170
+ name: NAME3,
6171
+ status: "pass",
6172
+ message: `no settings file on ${detectPlatform().id} \u2014 skipped`
6173
+ };
6148
6174
  const raw = readText(settingsPath);
6149
6175
  if (raw === null) return { name: NAME3, status: "pass", message: "no settings.json" };
6150
6176
  let hooks;
@@ -6480,11 +6506,7 @@ var init_judgment = __esm({
6480
6506
  );
6481
6507
  FallbackRule = Type.Object(
6482
6508
  {
6483
- description: Type.Optional(Type.String()),
6484
- fallback_action: Type.Optional(Type.String()),
6485
- message_template: Type.Optional(Type.String()),
6486
- override_signal: Type.Optional(Type.Array(Type.String())),
6487
- chain_isolation: Type.Optional(Type.Boolean())
6509
+ description: Type.Optional(Type.String())
6488
6510
  },
6489
6511
  { additionalProperties: false }
6490
6512
  );
@@ -7415,6 +7437,7 @@ var init_ccHookAdd2 = __esm({
7415
7437
  return { ok: false, phase: "preflight", error: e };
7416
7438
  }
7417
7439
  const settingsPath = getSettingsPath();
7440
+ if (settingsPath === null) return { aborted: true, reason: "platform-mismatch" };
7418
7441
  let existing;
7419
7442
  try {
7420
7443
  existing = await readFile(settingsPath, "utf8");
@@ -7992,11 +8015,14 @@ async function isAlreadyInstalled(ctx, opts = {}) {
7992
8015
  if (ctx.opts.dryRun) return false;
7993
8016
  const installCfg = ctx.manifest.spec.install;
7994
8017
  if (installCfg.method === "cc-hook-add") {
7995
- let raw;
7996
- try {
7997
- raw = await readFile(getSettingsPath(), "utf8");
7998
- } catch {
7999
- raw = null;
8018
+ const settingsPath = getSettingsPath();
8019
+ let raw = null;
8020
+ if (settingsPath !== null) {
8021
+ try {
8022
+ raw = await readFile(settingsPath, "utf8");
8023
+ } catch {
8024
+ raw = null;
8025
+ }
8000
8026
  }
8001
8027
  return detectCcHookInstalled(
8002
8028
  raw,
@@ -12663,8 +12689,6 @@ var Enforcement = Type.Union([
12663
12689
  // process.exit non-zero, sister fallbackHandlers
12664
12690
  Type.Literal("warn"),
12665
12691
  // console.warn emit, continue
12666
- Type.Literal("auto-fix"),
12667
- // run auto_fix_cmd then continue (biome --write pattern)
12668
12692
  Type.Literal("info")
12669
12693
  // log only, no action
12670
12694
  ]);
@@ -12675,22 +12699,21 @@ var DisciplineRule = Type.Object(
12675
12699
  description: Type.String(),
12676
12700
  // human-readable
12677
12701
  enforcement: Enforcement,
12678
- trigger: Type.Union([Type.String(), Type.Array(Type.String())]),
12702
+ trigger: Type.Union([Type.String(), Type.Array(Type.String())])
12679
12703
  // expr OR always-on list
12680
- check_method: Type.String(),
12681
- // heuristic / regex / external-cmd / llm-judge / file-content-match
12682
- auto_fix_cmd: Type.Optional(Type.String())
12683
- // only enforcement=auto-fix
12704
+ // 4.43.0 — `check_method` / `auto_fix_cmd` and the `auto-fix` enforcement value
12705
+ // removed: nothing ever evaluated them (the only runner, the before-commit hook,
12706
+ // was unreachable and deleted in 4.42.0). A rule's description reaches the model
12707
+ // via `harnessed prompt`; mechanical checks live in `harnessed check-docs`.
12684
12708
  },
12685
12709
  { additionalProperties: false }
12686
12710
  );
12687
12711
  var PriorityHierarchy = Type.Array(Type.String(), { minItems: 1 });
12688
12712
  var ProtocolShape = Type.Object(
12689
12713
  {
12714
+ // required_fields / forbidden_phrases / file_ownership removed 4.43.0 (never
12715
+ // checked); their content now lives in the protocol's description text.
12690
12716
  description: Type.String(),
12691
- required_fields: Type.Optional(Type.Array(Type.String())),
12692
- forbidden_phrases: Type.Optional(Type.Array(Type.String())),
12693
- file_ownership: Type.Optional(Type.Record(Type.String(), Type.Array(Type.String()))),
12694
12717
  rules: Type.Optional(Type.Array(DisciplineRule))
12695
12718
  },
12696
12719
  { additionalProperties: false }
@@ -12701,7 +12724,6 @@ var Discipline = Type.Object(
12701
12724
  discipline: Type.String({ minLength: 1 }),
12702
12725
  // basename (karpathy / output-style / ...)
12703
12726
  enforcement_layer: EnforcementLayer,
12704
- auto_enforce: Type.Boolean(),
12705
12727
  rules: Type.Array(DisciplineRule),
12706
12728
  priority_hierarchy: Type.Optional(PriorityHierarchy),
12707
12729
  // priority.yaml only
@@ -15124,7 +15146,7 @@ async function warnIfAgentTeamsMissing() {
15124
15146
  console.warn("\n\u26A0\uFE0F Agent Teams \u672A\u542F\u7528 \u2014 parallelism-gate \u5347\u7EA7\u8DEF\u5F84\u4E0D\u53EF\u7528");
15125
15147
  console.warn(" \u4FEE\u590D: claude config set env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS 1");
15126
15148
  console.warn(
15127
- " \u8BF4\u660E: harnessed v3.0 \u4E09\u5C42\u6808\u65B9\u6CD5\u8BBA parallelism-gate \u5347\u7EA7\u8DEF\u5F84\u9700 CC 2.1.133+ Agent Teams enable"
15149
+ " \u8BF4\u660E: harnessed v3.0 \u4E09\u5C42\u6808\u65B9\u6CD5\u8BBA parallelism-gate \u5347\u7EA7\u8DEF\u5F84\u9700 CC 2.1.178+ Agent Teams enable"
15128
15150
  );
15129
15151
  console.warn(
15130
15152
  " \u4E0D\u963B\u585E setup,\u540E\u7EED parallelism-gate workflow phase \u89E6\u53D1\u65F6\u81EA\u52A8\u964D\u7EA7 subagent fan-out\n"
@@ -15352,10 +15374,21 @@ async function applyPlatformOption(platform, persist) {
15352
15374
  }
15353
15375
  process.env.HARNESSED_PLATFORM = platform;
15354
15376
  if (!persist) return;
15355
- const pinRoot = claudeDescriptor().stateRoot;
15377
+ const [own, other] = platform === "codex" ? [codexDescriptor().stateRoot, claudeDescriptor().stateRoot] : [claudeDescriptor().stateRoot, codexDescriptor().stateRoot];
15356
15378
  try {
15357
- await mkdir(pinRoot, { recursive: true });
15358
- await writeFile(join(pinRoot, ".platform"), platform, "utf8");
15379
+ await mkdir(own, { recursive: true });
15380
+ await writeFile(join(own, ".platform"), platform, "utf8");
15381
+ const otherPin = join(other, ".platform");
15382
+ let existing;
15383
+ try {
15384
+ const raw = await readFile(otherPin, "utf8");
15385
+ existing = typeof raw === "string" ? raw.trim() : void 0;
15386
+ } catch {
15387
+ existing = void 0;
15388
+ }
15389
+ if (existing !== void 0 && existing !== platform) {
15390
+ await writeFile(otherPin, platform, "utf8");
15391
+ }
15359
15392
  } catch (e) {
15360
15393
  console.warn(` [--platform] could not persist .platform pin (${e.message})`);
15361
15394
  }
@@ -15828,6 +15861,7 @@ var uninstallCcHookAdd = async (ctx) => {
15828
15861
  const abort = dryRunGate(ctx);
15829
15862
  if (abort) return abort;
15830
15863
  const settingsPath = getSettingsPath();
15864
+ if (settingsPath === null) return { ok: true, removedPaths: [] };
15831
15865
  let existing;
15832
15866
  try {
15833
15867
  existing = await readFile(settingsPath, "utf8");
@@ -16196,6 +16230,7 @@ async function discoverCommandFiles(commandsDir) {
16196
16230
  return owned;
16197
16231
  }
16198
16232
  async function checkSettingsEnv(settingsPath) {
16233
+ if (settingsPath === null) return { hasAgentTeams: false, hasUserLang: false, staleHooks: 0 };
16199
16234
  try {
16200
16235
  const raw = await readFile(settingsPath, "utf8");
16201
16236
  const data = JSON.parse(raw);
@@ -16327,7 +16362,7 @@ async function runUnifiedUninstall(home, dryRun) {
16327
16362
  }
16328
16363
  let removedSettings = false;
16329
16364
  let removedHooks = 0;
16330
- if (hasSettingsChanges || staleHooks > 0) {
16365
+ if (settingsPath !== null && (hasSettingsChanges || staleHooks > 0)) {
16331
16366
  try {
16332
16367
  const r = await removeSettingsFootprint(settingsPath);
16333
16368
  removedSettings = r.envRemoved;