thoth-agents 0.4.1 → 0.5.0

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.
Files changed (117) hide show
  1. package/LICENSE +30 -0
  2. package/README.md +86 -58
  3. package/dist/agents/prompt-sections.d.ts +5 -3
  4. package/dist/agents/prompt-utils.d.ts +1 -1
  5. package/dist/agents/worker.d.ts +2 -0
  6. package/dist/{chunk-STCURXAQ.js → chunk-MRFCA3U2.js} +33 -67
  7. package/dist/{chunk-EFGSGPYM.js → chunk-OW6I7ZUU.js} +391 -416
  8. package/dist/chunk-V7HSGRMB.js +1016 -0
  9. package/dist/{chunk-2D7E7GMP.js → chunk-VUNYH263.js} +1650 -380
  10. package/dist/cli/claude-code-paths.d.ts +2 -2
  11. package/dist/cli/codex-install.d.ts +5 -2
  12. package/dist/cli/codex-paths.d.ts +2 -2
  13. package/dist/cli/index.js +47 -11
  14. package/dist/cli/model-defaults.d.ts +4 -0
  15. package/dist/cli/operations/pi.d.ts +1 -0
  16. package/dist/cli/pi-effort.d.ts +1 -1
  17. package/dist/cli/pi-external-package.d.ts +24 -0
  18. package/dist/cli/pi-git-source.d.ts +1 -0
  19. package/dist/cli/pi-install.d.ts +92 -15
  20. package/dist/cli/pi-managed-write.d.ts +3 -0
  21. package/dist/cli/pi-model-config.d.ts +17 -0
  22. package/dist/cli/pi-native-probe.d.ts +2 -0
  23. package/dist/cli/pi-paths.d.ts +2 -0
  24. package/dist/cli/pi-resources.d.ts +3 -1
  25. package/dist/cli/pi-tool-config.d.ts +32 -0
  26. package/dist/cli/tui/index.js +32 -7
  27. package/dist/cli/tui/operations.d.ts +3 -1
  28. package/dist/cli/types.d.ts +2 -0
  29. package/dist/config/constants.d.ts +4 -8
  30. package/dist/config/schema.d.ts +7 -36
  31. package/dist/harness/adapters/claude-code.d.ts +2 -4
  32. package/dist/harness/core/agent-pack.d.ts +52 -42
  33. package/dist/harness/core/memory-governance.d.ts +2 -2
  34. package/dist/harness/core/sdd.d.ts +159 -319
  35. package/dist/harness/writers/pi-agent.d.ts +3 -1
  36. package/dist/index.js +12 -6
  37. package/dist/pi/tools-panel.d.ts +51 -0
  38. package/dist/pi.d.ts +44 -2
  39. package/dist/pi.js +471 -9
  40. package/dist/utils/subprocess.d.ts +1 -0
  41. package/package.json +18 -4
  42. package/pi/.thoth-agents-assets.json +5 -6
  43. package/pi/agents/thoth-designer.md +23 -8
  44. package/pi/agents/thoth-explorer.md +29 -9
  45. package/pi/agents/thoth-librarian.md +30 -8
  46. package/pi/agents/thoth-oracle.md +18 -10
  47. package/pi/agents/thoth-worker.md +96 -0
  48. package/plugin/.claude-plugin/.thoth-agents-plugin-assets.json +7 -12
  49. package/plugin/.claude-plugin/plugin.json +2 -2
  50. package/plugin/.codex-plugin/plugin.json +2 -2
  51. package/plugin/agents/designer.md +13 -5
  52. package/plugin/agents/explorer.md +16 -5
  53. package/plugin/agents/librarian.md +15 -4
  54. package/plugin/agents/oracle.md +13 -7
  55. package/plugin/agents/orchestrator.md +82 -91
  56. package/plugin/agents/worker.md +76 -0
  57. package/plugin/skills/plan-reviewer/SKILL.md +39 -141
  58. package/plugin/skills/thoth-archive/SKILL.md +50 -47
  59. package/plugin/skills/thoth-archive/scripts/archive.mjs +287 -654
  60. package/plugin/skills/thoth-constitution/SKILL.md +23 -42
  61. package/plugin/skills/thoth-constitution/templates/constitution.md +54 -44
  62. package/plugin/skills/thoth-init/SKILL.md +19 -29
  63. package/plugin/skills/thoth-init/scripts/init.mjs +73 -66
  64. package/plugin/skills/thoth-sdd/SKILL.md +164 -117
  65. package/plugin/skills/thoth-sdd/references/phases/checklist.md +2 -22
  66. package/plugin/skills/thoth-sdd/references/phases/clarify.md +14 -12
  67. package/plugin/skills/thoth-sdd/references/phases/converge.md +2 -13
  68. package/plugin/skills/thoth-sdd/references/phases/explore.md +3 -8
  69. package/plugin/skills/thoth-sdd/references/phases/implement.md +58 -57
  70. package/plugin/skills/thoth-sdd/references/phases/plan.md +2 -18
  71. package/plugin/skills/thoth-sdd/references/phases/specify.md +2 -33
  72. package/plugin/skills/thoth-sdd/references/phases/tasks.md +4 -45
  73. package/plugin/skills/thoth-sdd/references/phases/verify.md +4 -22
  74. package/plugin/skills/thoth-sdd/scripts/validate.mjs +610 -1232
  75. package/plugin/skills/thoth-sdd/templates/change.md +94 -0
  76. package/skills/README.md +11 -13
  77. package/skills/plan-reviewer/SKILL.md +39 -141
  78. package/skills/thoth-archive/SKILL.md +50 -47
  79. package/skills/thoth-archive/scripts/archive.mjs +287 -654
  80. package/skills/thoth-constitution/SKILL.md +23 -42
  81. package/skills/thoth-constitution/templates/constitution.md +54 -44
  82. package/skills/thoth-init/SKILL.md +19 -29
  83. package/skills/thoth-init/scripts/init.mjs +73 -66
  84. package/skills/thoth-sdd/SKILL.md +164 -117
  85. package/skills/thoth-sdd/references/phases/checklist.md +2 -22
  86. package/skills/thoth-sdd/references/phases/clarify.md +14 -12
  87. package/skills/thoth-sdd/references/phases/converge.md +2 -13
  88. package/skills/thoth-sdd/references/phases/explore.md +3 -8
  89. package/skills/thoth-sdd/references/phases/implement.md +58 -57
  90. package/skills/thoth-sdd/references/phases/plan.md +2 -18
  91. package/skills/thoth-sdd/references/phases/specify.md +2 -33
  92. package/skills/thoth-sdd/references/phases/tasks.md +4 -45
  93. package/skills/thoth-sdd/references/phases/verify.md +4 -22
  94. package/skills/thoth-sdd/scripts/validate.mjs +610 -1232
  95. package/skills/thoth-sdd/templates/change.md +94 -0
  96. package/thoth-agents.schema.json +9 -77
  97. package/dist/agents/deep.d.ts +0 -2
  98. package/dist/agents/quick.d.ts +0 -2
  99. package/dist/chunk-2U5MBLLV.js +0 -312
  100. package/pi/agents/thoth-deep.md +0 -81
  101. package/pi/agents/thoth-quick.md +0 -81
  102. package/plugin/agents/deep.md +0 -68
  103. package/plugin/agents/quick.md +0 -68
  104. package/plugin/skills/plan-reviewer/templates/plan-review.md +0 -65
  105. package/plugin/skills/thoth-sdd/templates/archive-report.md +0 -25
  106. package/plugin/skills/thoth-sdd/templates/checklist.md +0 -27
  107. package/plugin/skills/thoth-sdd/templates/plan.md +0 -46
  108. package/plugin/skills/thoth-sdd/templates/spec.md +0 -62
  109. package/plugin/skills/thoth-sdd/templates/tasks.md +0 -58
  110. package/plugin/skills/thoth-sdd/templates/verify-report.md +0 -28
  111. package/skills/plan-reviewer/templates/plan-review.md +0 -65
  112. package/skills/thoth-sdd/templates/archive-report.md +0 -25
  113. package/skills/thoth-sdd/templates/checklist.md +0 -27
  114. package/skills/thoth-sdd/templates/plan.md +0 -46
  115. package/skills/thoth-sdd/templates/spec.md +0 -62
  116. package/skills/thoth-sdd/templates/tasks.md +0 -58
  117. package/skills/thoth-sdd/templates/verify-report.md +0 -28
@@ -1,3 +1,3 @@
1
1
  export type ClaudeCodeInstallScope = 'project' | 'user';
2
- export type ClaudeCodeRoleName = 'explorer' | 'librarian' | 'oracle' | 'designer' | 'quick' | 'deep';
3
- export declare const CLAUDE_CODE_ROLE_NAMES: readonly ["explorer", "librarian", "oracle", "designer", "quick", "deep"];
2
+ export type ClaudeCodeRoleName = 'explorer' | 'librarian' | 'oracle' | 'designer' | 'worker';
3
+ export declare const CLAUDE_CODE_ROLE_NAMES: readonly ["explorer", "librarian", "oracle", "designer", "worker"];
@@ -1,8 +1,8 @@
1
1
  import type { CodexInstallScope, CodexRoleName } from './codex-paths';
2
2
  import { type ManagedModelState } from './managed-state-io';
3
3
  export { CODEX_ROLE_NAMES } from './codex-paths';
4
- export type CodexSetupAction = 'merge-managed-block' | 'write-role-toml' | 'write-managed-model-state' | 'merge-toml' | 'diagnose-only';
5
- export type CodexTargetKind = 'root-instructions' | 'role-subagent-toml' | 'managed-model-state' | 'user-config' | 'diagnostic';
4
+ export type CodexSetupAction = 'merge-managed-block' | 'write-role-toml' | 'retire-obsolete-role-toml' | 'write-install-recovery' | 'write-managed-model-state' | 'merge-toml' | 'diagnose-only';
5
+ export type CodexTargetKind = 'root-instructions' | 'role-subagent-toml' | 'managed-model-state' | 'install-recovery' | 'user-config' | 'diagnostic';
6
6
  export interface CodexInstallConfig {
7
7
  dryRun?: boolean;
8
8
  reset: boolean;
@@ -22,6 +22,9 @@ export interface CodexSetupPlanItem {
22
22
  content?: string;
23
23
  role?: CodexRoleName;
24
24
  renderedModel?: string;
25
+ /** Apply-time guard captured while planning. */
26
+ expectedContent?: string;
27
+ expectedAbsent?: boolean;
25
28
  }
26
29
  export interface CodexSetupPlan {
27
30
  dryRun: boolean;
@@ -1,6 +1,6 @@
1
1
  export type CodexInstallScope = 'project' | 'user';
2
- export type CodexRoleName = 'explorer' | 'librarian' | 'oracle' | 'designer' | 'quick' | 'deep';
3
- export declare const CODEX_ROLE_NAMES: readonly ["explorer", "librarian", "oracle", "designer", "quick", "deep"];
2
+ export type CodexRoleName = 'explorer' | 'librarian' | 'oracle' | 'designer' | 'worker';
3
+ export declare const CODEX_ROLE_NAMES: readonly ["explorer", "librarian", "oracle", "designer", "worker"];
4
4
  export interface CodexTargetResolverOptions {
5
5
  scope: CodexInstallScope;
6
6
  projectRoot: string;
package/dist/cli/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  getOpenCodeVersion,
5
5
  isOpenCodeInstalled,
6
6
  opencodeAdapter
7
- } from "../chunk-STCURXAQ.js";
7
+ } from "../chunk-MRFCA3U2.js";
8
8
  import {
9
9
  CODEX_ROLE_NAMES,
10
10
  REQUIRED_SKILLS,
@@ -59,11 +59,11 @@ import {
59
59
  normalizeEffortSelection,
60
60
  recordHarnessInstallCompletion,
61
61
  syncOpenCodeOwnedSkills
62
- } from "../chunk-2D7E7GMP.js";
62
+ } from "../chunk-VUNYH263.js";
63
63
  import "../chunk-62L3ORXN.js";
64
64
  import {
65
65
  piAdapter
66
- } from "../chunk-2U5MBLLV.js";
66
+ } from "../chunk-V7HSGRMB.js";
67
67
  import {
68
68
  ALL_AGENT_NAMES,
69
69
  detectCurrentConfig,
@@ -74,7 +74,7 @@ import {
74
74
  resolveExecutingPackageVersion,
75
75
  updateOpenCodeMainConfig,
76
76
  writeLiteConfig
77
- } from "../chunk-EFGSGPYM.js";
77
+ } from "../chunk-OW6I7ZUU.js";
78
78
 
79
79
  // src/cli/index.ts
80
80
  import { pathToFileURL } from "url";
@@ -171,7 +171,9 @@ function formatConfigSummary(dryRun) {
171
171
  lines.push(` ${BOLD}Preset:${RESET} ${BLUE}openai${RESET}`);
172
172
  lines.push(` ${SYMBOLS.check} Seven-role adaptive thoth-agents roster`);
173
173
  lines.push(` ${SYMBOLS.check} OpenAI models by default`);
174
- lines.push(` ${SYMBOLS.check} Direct, Accelerated, and Full SDD routing`);
174
+ lines.push(
175
+ ` ${SYMBOLS.check} Proportional SDD and ID-named substantial-change records`
176
+ );
175
177
  lines.push(
176
178
  ` ${SYMBOLS.check} ${dryRun ? "thoth-mem setup plan confirmed" : "thoth-mem setup completed through its provider-owned installer"}`
177
179
  );
@@ -392,7 +394,7 @@ ${JSON.stringify(liteConfig, null, 2)}
392
394
  const modelsInfo = "Default configuration uses OpenAI models.";
393
395
  console.log(`${BOLD}${modelsInfo}${RESET}`);
394
396
  console.log(
395
- ` ${DIM}Includes the seven-role adaptive roster, native delegation, and Direct / Accelerated / Full SDD routing.${RESET}`
397
+ ` ${DIM}Includes the seven-role adaptive roster, native parallel delegation, and proportional SDD governance.${RESET}`
396
398
  );
397
399
  return 0;
398
400
  }
@@ -407,6 +409,7 @@ async function runPiInstall(config, dependencies, packageVersion, executingPacka
407
409
  expectedVersion: packageVersion,
408
410
  packageRoot: executingPackageRoot,
409
411
  ...config.localPackageRoot ? { firstPartySource: config.localPackageRoot } : {},
412
+ ...config.localPiRuntimeRoot ? { runtimePackageRoot: config.localPiRuntimeRoot } : {},
410
413
  receiptOptions: dependencies.installLedgerOptions,
411
414
  verifyFirstParty: dependencies.verifyPiFirstParty
412
415
  });
@@ -483,6 +486,7 @@ function createInstallConfig(args) {
483
486
  agent: args.agent ?? "opencode",
484
487
  hasTmux: args.tmux === "yes",
485
488
  ...args.localPackageRoot ? { localPackageRoot: args.localPackageRoot } : {},
489
+ ...args.localPiRuntimeRoot ? { localPiRuntimeRoot: args.localPiRuntimeRoot } : {},
486
490
  dryRun: args.dryRun,
487
491
  reset: args.reset ?? false
488
492
  };
@@ -788,7 +792,7 @@ Codex and Claude marketplace versions remain native-manager-owned and do not pro
788
792
  that CLI-managed agents, skills, configuration, or provider setup are aligned.
789
793
  Runtime release checks notify only; use the latest CLI install or interactive CLI Update.
790
794
 
791
- OpenCode install configures the adaptive seven-role roster and native task delegation.
795
+ OpenCode install configures the adaptive six-role roster and native task delegation.
792
796
  Provider capability is external and reported only from caller-supplied evidence.
793
797
 
794
798
  External required skills are installed for every harness:
@@ -897,8 +901,8 @@ function printModelGuidance() {
897
901
  [
898
902
  "Model command requires explicit model input.",
899
903
  "Examples:",
900
- " thoth-agents model --harness=codex --role=deep --model=openai/gpt-5.4-mini",
901
- " thoth-agents model --harness=opencode --role-model=deep=openai/gpt-5.4",
904
+ " thoth-agents model --harness=codex --role=worker --model=openai/gpt-5.4-mini",
905
+ " thoth-agents model --harness=opencode --role-model=worker=openai/gpt-5.4",
902
906
  "Preview is the default. Add --apply only after reviewing the plan."
903
907
  ].join("\n")
904
908
  );
@@ -1075,15 +1079,20 @@ function parseOperationHarness(value) {
1075
1079
  }
1076
1080
  return value;
1077
1081
  }
1082
+ function assertSupportedRoleName(role) {
1083
+ if (role === "quick" || role === "deep")
1084
+ throw new Error(`Unsupported removed agent role: ${role}. Use worker.`);
1085
+ }
1078
1086
  function parseRoleModel(value) {
1079
1087
  const separator = value.includes("=") ? "=" : ":";
1080
1088
  const [role, ...modelParts] = value.split(separator);
1081
1089
  const model = modelParts.join(separator);
1082
1090
  if (!role || !model) {
1083
1091
  throw new Error(
1084
- "--role-model must use role=model or role:model, for example --role-model=deep=openai/gpt-5.4-mini."
1092
+ "--role-model must use role=model or role:model, for example --role-model=worker=openai/gpt-5.4-mini."
1085
1093
  );
1086
1094
  }
1095
+ assertSupportedRoleName(role);
1087
1096
  return { role, model };
1088
1097
  }
1089
1098
  function parseRoleEffort(value) {
@@ -1092,9 +1101,10 @@ function parseRoleEffort(value) {
1092
1101
  const effort = effortParts.join(separator);
1093
1102
  if (!role || !effort) {
1094
1103
  throw new Error(
1095
- "--role-effort must use role=effort or role:effort, for example --role-effort=deep=high."
1104
+ "--role-effort must use role=effort or role:effort, for example --role-effort=worker=high."
1096
1105
  );
1097
1106
  }
1107
+ assertSupportedRoleName(role);
1098
1108
  return { role, effort: normalizeEffortSelection(effort) };
1099
1109
  }
1100
1110
  function parseOperationArgs(args) {
@@ -1140,6 +1150,7 @@ function parseOperationArgs(args) {
1140
1150
  } else if (arg.startsWith("--role=")) {
1141
1151
  pendingRole = arg.split("=")[1] ?? "";
1142
1152
  if (!pendingRole) throw new Error("--role requires a value.");
1153
+ assertSupportedRoleName(pendingRole);
1143
1154
  } else if (arg.startsWith("--provider=")) {
1144
1155
  pendingProvider = arg.split("=")[1] ?? "";
1145
1156
  if (!pendingProvider) throw new Error("--provider requires a value.");
@@ -1212,6 +1223,26 @@ function parseInstallArgs(args) {
1212
1223
  );
1213
1224
  }
1214
1225
  result.localPackageRoot = localPackageRoot;
1226
+ } else if (arg === "--local-pi-runtime-root" || arg.startsWith("--local-pi-runtime-root=")) {
1227
+ if (result.localPiRuntimeRoot !== void 0) {
1228
+ throw new Error("--local-pi-runtime-root cannot be repeated.");
1229
+ }
1230
+ let localPiRuntimeRoot;
1231
+ if (arg === "--local-pi-runtime-root") {
1232
+ index += 1;
1233
+ localPiRuntimeRoot = args[index];
1234
+ } else {
1235
+ localPiRuntimeRoot = arg.slice("--local-pi-runtime-root=".length);
1236
+ }
1237
+ if (!localPiRuntimeRoot || localPiRuntimeRoot.startsWith("--")) {
1238
+ throw new Error("--local-pi-runtime-root requires a value.");
1239
+ }
1240
+ if (!isAbsolute(localPiRuntimeRoot) || resolve(localPiRuntimeRoot) !== localPiRuntimeRoot) {
1241
+ throw new Error(
1242
+ "--local-pi-runtime-root requires a normalized absolute path."
1243
+ );
1244
+ }
1245
+ result.localPiRuntimeRoot = localPiRuntimeRoot;
1215
1246
  } else if (arg === "-h" || arg === "--help") {
1216
1247
  throw new Error("help");
1217
1248
  } else {
@@ -1221,6 +1252,11 @@ function parseInstallArgs(args) {
1221
1252
  if (result.localPackageRoot !== void 0 && result.agent !== "pi") {
1222
1253
  throw new Error("--local-package-root is supported only with --agent=pi.");
1223
1254
  }
1255
+ if (result.localPiRuntimeRoot !== void 0 && result.agent !== "pi") {
1256
+ throw new Error(
1257
+ "--local-pi-runtime-root is supported only with --agent=pi."
1258
+ );
1259
+ }
1224
1260
  return result;
1225
1261
  }
1226
1262
  function parseGenerateArgs(args) {
@@ -0,0 +1,4 @@
1
+ import type { HarnessId } from '../harness/types';
2
+ import type { ModelRoleInput } from './operations/types';
3
+ /** Shipped recommendations, independent of installed configuration. */
4
+ export declare function getShippedModelRoles(harness: HarnessId): ModelRoleInput[];
@@ -8,6 +8,7 @@ import type { HarnessAction, HarnessStatusReport, ModelConfigInput, ModelRoleInp
8
8
  export interface PiOperationContext extends OperationContext {
9
9
  homeDir?: string;
10
10
  packageRoot?: string;
11
+ runtimePackageRoot?: string;
11
12
  env?: Readonly<Record<string, string | undefined>>;
12
13
  installLedgerOptions?: InstallLedgerOptions;
13
14
  buildPiSetupPlan?: typeof buildPiSetupPlan;
@@ -1,5 +1,5 @@
1
1
  import type { ModelRoleInput } from './operations/types';
2
- export declare const PI_EFFORT_VALUES: readonly ["off", "minimal", "low", "medium", "high", "xhigh"];
2
+ export declare const PI_EFFORT_VALUES: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
3
3
  export type PiEffortResolution = {
4
4
  ok: true;
5
5
  effort: string | undefined;
@@ -0,0 +1,24 @@
1
+ export interface PiExternalPackageSpec {
2
+ source: string;
3
+ packageName: string;
4
+ version: string;
5
+ }
6
+ export interface PiConfiguredExternalPackage {
7
+ scope: 'user' | 'project';
8
+ source: string;
9
+ installedPath?: string;
10
+ }
11
+ export type PiExternalPackageEvidence = {
12
+ state: 'installed';
13
+ source: string;
14
+ installedPath: string;
15
+ version: string;
16
+ } | {
17
+ state: 'missing' | 'drift';
18
+ source?: string;
19
+ installedPath?: string;
20
+ version?: string;
21
+ reason: string;
22
+ };
23
+ export declare function piExternalSourceMatches(candidate: PiConfiguredExternalPackage, expectedSource: string): boolean;
24
+ export declare function inspectPiExternalPackage(packages: readonly PiConfiguredExternalPackage[], spec: PiExternalPackageSpec, requireManagedSource?: boolean): PiExternalPackageEvidence;
@@ -0,0 +1 @@
1
+ export declare function projectGitPackagePath(source: string, projectRoot: string): string | undefined;
@@ -1,38 +1,38 @@
1
1
  import { type PiPackageReceipt, type PiPackageReceiptOptions } from './pi-package-receipt';
2
2
  import { type PiPathOptions, type PiPaths } from './pi-paths';
3
- export declare const PI_MINIMUM_VERSION = "0.84.4";
3
+ export declare const PI_MINIMUM_VERSION = "0.99.0";
4
4
  export declare const PI_NODE_MINIMUM = "22.19.0";
5
5
  export declare const PI_COMMAND_TIMEOUT_MS = 120000;
6
6
  export declare const PI_PACKAGE_SPECS: readonly [{
7
7
  readonly id: "delegation";
8
- readonly source: "npm:pi-subagents-j0k3r@1.5.9";
9
- readonly packageName: "pi-subagents-j0k3r";
10
- readonly version: "1.5.9";
8
+ readonly source: "npm:@thoth-agents/pi-subagents@>=0.1.0";
9
+ readonly packageName: "@thoth-agents/pi-subagents";
10
+ readonly version: "0.1.0";
11
11
  }, {
12
12
  readonly id: "context7";
13
- readonly source: "npm:@upstash/context7-pi@0.1.2";
13
+ readonly source: "npm:@upstash/context7-pi@>=0.1.2";
14
14
  readonly packageName: "@upstash/context7-pi";
15
15
  readonly version: "0.1.2";
16
16
  }, {
17
17
  readonly id: "web-access";
18
- readonly source: "npm:pi-web-access@0.27.0";
18
+ readonly source: "npm:pi-web-access@>=0.27.0";
19
19
  readonly packageName: "pi-web-access";
20
20
  readonly version: "0.27.0";
21
21
  }, {
22
22
  readonly id: "grep-adapter";
23
- readonly source: "npm:pi-mcp-adapter@2.32.1";
23
+ readonly source: "npm:pi-mcp-adapter@>=2.32.1";
24
24
  readonly packageName: "pi-mcp-adapter";
25
25
  readonly version: "2.32.1";
26
26
  }, {
27
27
  readonly id: "ask-user-question";
28
- readonly source: "npm:@juicesharp/rpiv-ask-user-question@2.9.0";
29
- readonly packageName: "@juicesharp/rpiv-ask-user-question";
30
- readonly version: "2.9.0";
28
+ readonly source: "npm:@thoth-agents/pi-questions-user@>=0.1.0";
29
+ readonly packageName: "@thoth-agents/pi-questions-user";
30
+ readonly version: "0.1.0";
31
31
  }, {
32
32
  readonly id: "todo";
33
- readonly source: "npm:@juicesharp/rpiv-todo@2.9.0";
34
- readonly packageName: "@juicesharp/rpiv-todo";
35
- readonly version: "2.9.0";
33
+ readonly source: "npm:@thoth-agents/pi-todo@>=0.1.0";
34
+ readonly packageName: "@thoth-agents/pi-todo";
35
+ readonly version: "0.1.0";
36
36
  }];
37
37
  export declare const PI_GREP_MCP_ENTRY: {
38
38
  readonly url: "https://mcp.grep.app";
@@ -51,6 +51,7 @@ export interface PiSetupOptions extends PiPathOptions {
51
51
  commandExecutor?: PiCommandExecutor;
52
52
  expectedVersion?: string;
53
53
  packageRoot?: string;
54
+ runtimePackageRoot?: string;
54
55
  firstPartySource?: string;
55
56
  receiptOptions?: PiPackageReceiptOptions;
56
57
  verifyFirstParty?: (input: {
@@ -67,7 +68,7 @@ export interface PiSetupOptions extends PiPathOptions {
67
68
  };
68
69
  }
69
70
  export interface PiSetupPlanItem {
70
- kind: 'preflight' | 'package' | 'root' | 'agent' | 'mcp';
71
+ kind: 'preflight' | 'package' | 'root' | 'agent' | 'settings' | 'mcp';
71
72
  description: string;
72
73
  target: string;
73
74
  command?: {
@@ -84,6 +85,7 @@ export interface PiSetupPlan {
84
85
  blockers: string[];
85
86
  diagnostics: string[];
86
87
  disclaimers: string[];
88
+ projectIncumbentTodos?: PiConfiguredPackage[];
87
89
  options: PiSetupOptions;
88
90
  }
89
91
  export interface PiApplyResult {
@@ -111,6 +113,70 @@ export declare function verifyPiFirstPartyPackage(input: {
111
113
  success: false;
112
114
  error: string;
113
115
  };
116
+ export declare function isPiIncumbentDelegationSource(source: string): boolean;
117
+ export declare function getPiExternalPackageSpecs(options?: Pick<PiSetupOptions, 'runtimePackageRoot'>): readonly [{
118
+ readonly id: "delegation";
119
+ readonly source: "npm:@thoth-agents/pi-subagents@>=0.1.0";
120
+ readonly packageName: "@thoth-agents/pi-subagents";
121
+ readonly version: "0.1.0";
122
+ }, {
123
+ readonly id: "context7";
124
+ readonly source: "npm:@upstash/context7-pi@>=0.1.2";
125
+ readonly packageName: "@upstash/context7-pi";
126
+ readonly version: "0.1.2";
127
+ }, {
128
+ readonly id: "web-access";
129
+ readonly source: "npm:pi-web-access@>=0.27.0";
130
+ readonly packageName: "pi-web-access";
131
+ readonly version: "0.27.0";
132
+ }, {
133
+ readonly id: "grep-adapter";
134
+ readonly source: "npm:pi-mcp-adapter@>=2.32.1";
135
+ readonly packageName: "pi-mcp-adapter";
136
+ readonly version: "2.32.1";
137
+ }, {
138
+ readonly id: "ask-user-question";
139
+ readonly source: "npm:@thoth-agents/pi-questions-user@>=0.1.0";
140
+ readonly packageName: "@thoth-agents/pi-questions-user";
141
+ readonly version: "0.1.0";
142
+ }, {
143
+ readonly id: "todo";
144
+ readonly source: "npm:@thoth-agents/pi-todo@>=0.1.0";
145
+ readonly packageName: "@thoth-agents/pi-todo";
146
+ readonly version: "0.1.0";
147
+ }] | ({
148
+ readonly id: "context7";
149
+ readonly source: "npm:@upstash/context7-pi@>=0.1.2";
150
+ readonly packageName: "@upstash/context7-pi";
151
+ readonly version: "0.1.2";
152
+ } | {
153
+ readonly id: "web-access";
154
+ readonly source: "npm:pi-web-access@>=0.27.0";
155
+ readonly packageName: "pi-web-access";
156
+ readonly version: "0.27.0";
157
+ } | {
158
+ readonly id: "grep-adapter";
159
+ readonly source: "npm:pi-mcp-adapter@>=2.32.1";
160
+ readonly packageName: "pi-mcp-adapter";
161
+ readonly version: "2.32.1";
162
+ } | {
163
+ readonly id: "ask-user-question";
164
+ readonly source: "npm:@thoth-agents/pi-questions-user@>=0.1.0";
165
+ readonly packageName: "@thoth-agents/pi-questions-user";
166
+ readonly version: "0.1.0";
167
+ } | {
168
+ readonly id: "todo";
169
+ readonly source: "npm:@thoth-agents/pi-todo@>=0.1.0";
170
+ readonly packageName: "@thoth-agents/pi-todo";
171
+ readonly version: "0.1.0";
172
+ } | {
173
+ source: string;
174
+ id: "delegation";
175
+ packageName: "@thoth-agents/pi-subagents";
176
+ version: "0.1.0";
177
+ })[];
178
+ export declare function piIncumbentTodoRecovery(source: string, scope: PiConfiguredPackage['scope'], identityLimitation?: string, unmappedSource?: boolean): string;
179
+ export declare function mergePiSubagentsConfig(current: Record<string, unknown>): Record<string, unknown>;
114
180
  export declare function mergePiGrepMcpConfig(current: Record<string, unknown>): Record<string, unknown>;
115
181
  export declare function mergePiRootBlock(current: string, managedBlock: string): string;
116
182
  export declare function buildPiSetupPlan(options?: PiSetupOptions): PiSetupPlan;
@@ -123,9 +189,20 @@ export interface PiConfiguredPackage {
123
189
  installedPath?: string;
124
190
  packageName?: string;
125
191
  packageVersion?: string;
192
+ identityLimitation?: string;
193
+ /** Directory-only evidence; source is a display path, not a removal source. */
194
+ unmappedSource?: boolean;
126
195
  }
127
196
  export declare function parsePiPackageList(output: string): PiConfiguredPackage[];
197
+ export interface PiIncumbentDelegation {
198
+ candidate: PiConfiguredPackage;
199
+ classification: 'confirmed' | 'ambiguous';
200
+ reason: string;
201
+ }
202
+ export declare function findPiIncumbentDelegation(packages: readonly PiConfiguredPackage[]): PiIncumbentDelegation | undefined;
203
+ export declare function findPiIncumbentTodos(packages: readonly PiConfiguredPackage[]): PiConfiguredPackage[];
204
+ export declare function piIncumbentDelegationRecovery(incumbent: PiIncumbentDelegation): string;
128
205
  export declare function isThothPackageLocation(candidate: PiConfiguredPackage, knownSource?: string): boolean;
129
206
  export declare function getPiFirstPartyPackages(packages: readonly PiConfiguredPackage[], knownSource?: string): PiConfiguredPackage[];
130
- export declare function writePiManagedText(path: string, content: string): boolean;
207
+ export { writePiManagedText } from './pi-managed-write';
131
208
  export declare function applyPiSetup(plan: PiSetupPlan): PiApplyResult;
@@ -0,0 +1,3 @@
1
+ /** Reject links and non-directory ancestors before reading or writing a managed file. */
2
+ export declare function assertSafePiManagedPath(path: string): void;
3
+ export declare function writePiManagedText(path: string, content: string, expectedBefore?: string | null): boolean;
@@ -0,0 +1,17 @@
1
+ import { type PiSpecialistRole } from '../harness/pi-specialists';
2
+ import type { ModelRoleInput } from './operations/types';
3
+ export interface PiModelSnapshot {
4
+ piRoot: string;
5
+ roles: ModelRoleInput[];
6
+ contents: Partial<Record<PiSpecialistRole, string>>;
7
+ }
8
+ export interface PiModelSaveResult {
9
+ success: boolean;
10
+ changedRoles: PiSpecialistRole[];
11
+ /** Reflects only successful writes; use this snapshot to retry the same draft. */
12
+ snapshot: PiModelSnapshot;
13
+ error?: string;
14
+ }
15
+ export declare function readOwnedPiSpecialistDefinition(piRoot: string, role: PiSpecialistRole): string;
16
+ export declare function readPiModelConfig(piRoot: string, roles?: readonly PiSpecialistRole[]): PiModelSnapshot;
17
+ export declare function savePiModelConfig(snapshot: PiModelSnapshot, roles: readonly ModelRoleInput[]): PiModelSaveResult;
@@ -31,4 +31,6 @@ export interface PiNativeProbeResult {
31
31
  orchestratorChild?: boolean;
32
32
  sessionStartCount?: number;
33
33
  }
34
+ export declare function resolvePiWindowsCliFromShim(shimPath: string, shimContents: string): string | undefined;
35
+ export declare function findPiWindowsCli(): string | undefined;
34
36
  export declare function observePiNativeRoot(options: PiNativeProbeOptions): PiNativeProbeResult;
@@ -13,6 +13,8 @@ export interface PiPaths {
13
13
  agentsRoot: string;
14
14
  alternateAgentsRoot: string;
15
15
  ownedSkillsRoot: string;
16
+ settingsPath: string;
17
+ subagentsConfigPath: string;
16
18
  mcpConfigPath: string;
17
19
  projectAgentRoots: string[];
18
20
  projectMcpPaths: string[];
@@ -1,9 +1,11 @@
1
- export declare const PI_SPECIALIST_NAMES: ("thoth-explorer" | "thoth-librarian" | "thoth-oracle" | "thoth-designer" | "thoth-quick" | "thoth-deep")[];
1
+ export declare const PI_SPECIALIST_NAMES: ("thoth-explorer" | "thoth-librarian" | "thoth-oracle" | "thoth-designer" | "thoth-worker")[];
2
2
  export interface PiSpecialistSyncOptions {
3
3
  packageRoot: string;
4
4
  piRoot: string;
5
5
  dryRun?: boolean;
6
6
  projectRoots?: readonly string[];
7
+ /** Test-only seam for exercising replacement races before retirement. */
8
+ beforeRetireForTest?: () => void;
7
9
  }
8
10
  export interface PiSpecialistSyncResult {
9
11
  success: boolean;
@@ -0,0 +1,32 @@
1
+ import { type PiSpecialistRole } from '../harness/pi-specialists';
2
+ export interface PiToolRoleSnapshot {
3
+ role: PiSpecialistRole;
4
+ tools: string[];
5
+ defaultTools: string[];
6
+ disallowedTools: string[];
7
+ }
8
+ export interface PiToolConfigSnapshot {
9
+ piRoot: string;
10
+ roles: PiToolRoleSnapshot[];
11
+ contents: Partial<Record<PiSpecialistRole, string>>;
12
+ }
13
+ export interface PiToolRoleInput {
14
+ role: PiSpecialistRole;
15
+ tools: readonly string[];
16
+ }
17
+ export interface PiToolSaveResult {
18
+ success: boolean;
19
+ changedRoles: PiSpecialistRole[];
20
+ /** Reflects only successful writes; pass it back to retry the same draft. */
21
+ snapshot: PiToolConfigSnapshot;
22
+ error?: string;
23
+ }
24
+ export interface PiSpecialistToolOverrides {
25
+ tools?: string[];
26
+ disallowedTools?: string[];
27
+ subagentMode?: 'task' | 'background';
28
+ }
29
+ export declare function validatePiSpecialistTools(tools: readonly string[]): void;
30
+ export declare function readPiSpecialistToolOverrides(content: string): PiSpecialistToolOverrides;
31
+ export declare function readPiToolConfig(piRoot: string, roles?: readonly PiSpecialistRole[]): PiToolConfigSnapshot;
32
+ export declare function savePiToolConfig(snapshot: PiToolConfigSnapshot, roles: readonly PiToolRoleInput[]): PiToolSaveResult;
@@ -2,10 +2,10 @@ import {
2
2
  defaultTuiOperations,
3
3
  effortChoicesForModel,
4
4
  listOperationHarnesses
5
- } from "../../chunk-2D7E7GMP.js";
5
+ } from "../../chunk-VUNYH263.js";
6
6
  import "../../chunk-62L3ORXN.js";
7
- import "../../chunk-2U5MBLLV.js";
8
- import "../../chunk-EFGSGPYM.js";
7
+ import "../../chunk-V7HSGRMB.js";
8
+ import "../../chunk-OW6I7ZUU.js";
9
9
 
10
10
  // src/cli/tui/index.tsx
11
11
  import { render } from "ink";
@@ -875,6 +875,7 @@ function App({
875
875
  const providerEvidenceRequest = useRef(0);
876
876
  const [plan, setPlan] = useState();
877
877
  const [result, setResult] = useState();
878
+ const [restoringDefaults, setRestoringDefaults] = useState(false);
878
879
  const [previewAction, setPreviewAction] = useState(
879
880
  "cancel"
880
881
  );
@@ -948,7 +949,7 @@ function App({
948
949
  const choiceSelected = selectedModelIndex < 0 ? 0 : selectedModelIndex;
949
950
  const dirtyRoles = rolesForModelPlan(modelRows);
950
951
  const rolesToApply = dirtyRoles.length > 0 ? dirtyRoles : rolesForModelPlan(modelRows, true);
951
- const modelActions = dirtyRoles.length > 0 ? ["Preview changes", "Apply", "Back"] : ["Apply", "Back"];
952
+ const modelActions = dirtyRoles.length > 0 ? ["Preview changes", "Apply", "Restore defaults", "Back"] : ["Apply", "Restore defaults", "Back"];
952
953
  const modelMenuItems = [
953
954
  ...modelRows.map((role) => ({
954
955
  id: role.role,
@@ -990,6 +991,7 @@ function App({
990
991
  }
991
992
  function openPlan(harness, action, backView = "harness") {
992
993
  setActiveHarness(harness);
994
+ setRestoringDefaults(false);
993
995
  setPlan(operations.plan(harness, action));
994
996
  setResult(void 0);
995
997
  setPreviewAction("cancel");
@@ -1037,6 +1039,7 @@ function App({
1037
1039
  setView("effortChoice");
1038
1040
  }
1039
1041
  function previewModelChanges(applyImmediately) {
1042
+ setRestoringDefaults(false);
1040
1043
  const nextPlan = operations.modelPlan(modelHarness, rolesToApply);
1041
1044
  setPlan(nextPlan);
1042
1045
  setPreviewAction(applyImmediately ? "apply" : "cancel");
@@ -1067,6 +1070,26 @@ function App({
1067
1070
  setResult(void 0);
1068
1071
  setView("preview");
1069
1072
  }
1073
+ function previewDefaultModels() {
1074
+ setPlan(operations.restoreModelPlan(modelHarness, modelOptions));
1075
+ setRestoringDefaults(true);
1076
+ setResult(void 0);
1077
+ setPreviewAction("cancel");
1078
+ setPreviewBackView("modelRoles");
1079
+ setView("preview");
1080
+ }
1081
+ function applyPreview() {
1082
+ if (!plan?.canApply || restoringDefaults && result?.applied) return;
1083
+ const applied = operations.apply(plan);
1084
+ setResult(applied);
1085
+ if (restoringDefaults && applied.applied) {
1086
+ setModelRoles(operations.modelRoles(modelHarness));
1087
+ setEditedModels({});
1088
+ setEditedEfforts({});
1089
+ setModelResult(void 0);
1090
+ setModelSelected(0);
1091
+ }
1092
+ }
1070
1093
  useInput((input, key) => {
1071
1094
  if (view === "modelEdit") {
1072
1095
  if (key.escape) {
@@ -1286,6 +1309,7 @@ function App({
1286
1309
  if (action === "Back") setView("manageHarness");
1287
1310
  if (action === "Preview changes") previewModelChanges(false);
1288
1311
  if (action === "Apply") previewModelChanges(true);
1312
+ if (action === "Restore defaults") previewDefaultModels();
1289
1313
  }
1290
1314
  return;
1291
1315
  }
@@ -1301,14 +1325,14 @@ function App({
1301
1325
  }
1302
1326
  if (input === "a" && plan?.canApply) {
1303
1327
  setPreviewAction("apply");
1304
- setResult(operations.apply(plan));
1328
+ applyPreview();
1305
1329
  }
1306
1330
  if (input === "c") goBack();
1307
1331
  if (key.return && plan) {
1308
1332
  if (previewAction === "cancel" || !plan.canApply) {
1309
1333
  goBack();
1310
1334
  } else {
1311
- setResult(operations.apply(plan));
1335
+ applyPreview();
1312
1336
  }
1313
1337
  }
1314
1338
  }
@@ -1465,10 +1489,11 @@ function App({
1465
1489
  /* @__PURE__ */ jsx8(
1466
1490
  Header,
1467
1491
  {
1468
- title: plan.title,
1492
+ title: restoringDefaults ? "Restore default models" : plan.title,
1469
1493
  subtitle: "Enter selects. Escape or c returns one level."
1470
1494
  }
1471
1495
  ),
1496
+ restoringDefaults ? /* @__PURE__ */ jsx8(Text8, { color: theme.warning, children: "Replace all managed role models and reasoning efforts with this package's defaults. Review the values and targets below. Apply writes changes; Cancel keeps your current settings." }) : null,
1472
1497
  /* @__PURE__ */ jsx8(
1473
1498
  PlanPreview,
1474
1499
  {
@@ -1,7 +1,7 @@
1
1
  import type { HarnessId, ProviderCapabilityEvidence, ProviderEvidenceInput } from '../../harness/types';
2
2
  import { type ClaudeCodeOperationContext } from '../operations/claude-code';
3
3
  import { type CodexOperationContext } from '../operations/codex';
4
- import type { HarnessStatusReport, ModelRoleInput, OperationApplyResult, OperationPlan } from '../operations/types';
4
+ import type { HarnessStatusReport, ModelRoleInput, OperationApplyResult, OperationContext, OperationPlan } from '../operations/types';
5
5
  import { type ModelOption } from './model-catalog';
6
6
  export type TuiAction = 'status' | 'list' | 'install' | 'update' | 'sync' | 'model';
7
7
  export interface TuiOperations {
@@ -11,6 +11,7 @@ export interface TuiOperations {
11
11
  modelOptions(harness: HarnessId): Promise<ModelOption[]>;
12
12
  plan(harness: HarnessId, action: Exclude<TuiAction, 'status' | 'list'>): OperationPlan;
13
13
  modelPlan(harness: HarnessId, roles: ModelRoleInput[]): OperationPlan;
14
+ restoreModelPlan(harness: HarnessId, options: readonly ModelOption[]): OperationPlan;
14
15
  apply(plan: OperationPlan): OperationApplyResult;
15
16
  }
16
17
  export declare const opencodeModelRoles: ModelRoleInput[];
@@ -19,4 +20,5 @@ export declare function getCodexModelRoles(source?: CodexOperationContext): Mode
19
20
  export declare function getClaudeCodeModelRoles(_source?: ClaudeCodeOperationContext): ModelRoleInput[];
20
21
  export declare function getPiModelRoles(): ModelRoleInput[];
21
22
  export declare function getOpenCodeModelRoles(): ModelRoleInput[];
23
+ export declare function buildRestoreModelPlan(harness: HarnessId, options: readonly ModelOption[], source?: OperationContext): OperationPlan;
22
24
  export declare const defaultTuiOperations: TuiOperations;