thoth-agents 0.3.12 → 0.4.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.
- package/README.md +181 -474
- package/dist/agents/prompt-dialects.d.ts +4 -1
- package/dist/agents/prompt-sections.d.ts +2 -1
- package/dist/{chunk-VPVBYBPU.js → chunk-2D7E7GMP.js} +2298 -188
- package/dist/chunk-2U5MBLLV.js +312 -0
- package/dist/chunk-62L3ORXN.js +30 -0
- package/dist/{chunk-DX4U3AD3.js → chunk-EFGSGPYM.js} +121 -64
- package/dist/{chunk-5UBJB5QO.js → chunk-STCURXAQ.js} +1 -1
- package/dist/cli/index.js +184 -13
- package/dist/cli/install-completion.d.ts +13 -0
- package/dist/cli/install-ledger.d.ts +1 -1
- package/dist/cli/install.d.ts +11 -1
- package/dist/cli/operations/pi.d.ts +43 -0
- package/dist/cli/owned-skills.d.ts +17 -0
- package/dist/cli/pi-effort.d.ts +10 -0
- package/dist/cli/pi-install.d.ts +131 -0
- package/dist/cli/pi-migration.d.ts +12 -0
- package/dist/cli/pi-native-probe.d.ts +34 -0
- package/dist/cli/pi-package-receipt.d.ts +59 -0
- package/dist/cli/pi-paths.d.ts +20 -0
- package/dist/cli/pi-resources.d.ts +15 -0
- package/dist/cli/skills.d.ts +1 -1
- package/dist/cli/tui/index.js +12 -4
- package/dist/cli/tui/operations.d.ts +1 -0
- package/dist/cli/types.d.ts +4 -2
- package/dist/config/constants.d.ts +9 -9
- package/dist/harness/adapters/pi.d.ts +8 -0
- package/dist/harness/pi-specialists.d.ts +6 -0
- package/dist/harness/types.d.ts +2 -2
- package/dist/harness/writers/pi-agent.d.ts +16 -0
- package/dist/index.js +6 -4
- package/dist/pi.d.ts +11 -0
- package/dist/pi.js +46 -0
- package/package.json +14 -3
- package/pi/.thoth-agents-assets.json +12 -0
- package/pi/agents/thoth-deep.md +81 -0
- package/pi/agents/thoth-designer.md +81 -0
- package/pi/agents/thoth-explorer.md +81 -0
- package/pi/agents/thoth-librarian.md +83 -0
- package/pi/agents/thoth-oracle.md +83 -0
- package/pi/agents/thoth-quick.md +81 -0
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/skills/thoth-archive/SKILL.md +1 -1
- package/plugin/skills/thoth-constitution/SKILL.md +1 -1
- package/plugin/skills/thoth-init/SKILL.md +1 -1
- package/plugin/skills/thoth-sdd/SKILL.md +1 -1
- package/skills/thoth-archive/SKILL.md +1 -1
- package/skills/thoth-constitution/SKILL.md +1 -1
- package/skills/thoth-init/SKILL.md +1 -1
- package/skills/thoth-sdd/SKILL.md +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
getOpenCodeVersion,
|
|
5
5
|
isOpenCodeInstalled,
|
|
6
6
|
opencodeAdapter
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-STCURXAQ.js";
|
|
8
8
|
import {
|
|
9
9
|
CODEX_ROLE_NAMES,
|
|
10
10
|
REQUIRED_SKILLS,
|
|
@@ -15,6 +15,8 @@ import {
|
|
|
15
15
|
applyCodexPluginSetup,
|
|
16
16
|
applyCodexSetup,
|
|
17
17
|
applyOpenCodePlan,
|
|
18
|
+
applyPiPlan,
|
|
19
|
+
applyPiSetup,
|
|
18
20
|
buildClaudeCodeModelPlan,
|
|
19
21
|
buildClaudeCodeSetupPlan,
|
|
20
22
|
buildClaudeCodeSyncPlan,
|
|
@@ -27,13 +29,19 @@ import {
|
|
|
27
29
|
buildOpenCodeModelPlan,
|
|
28
30
|
buildOpenCodeSyncPlan,
|
|
29
31
|
buildOpenCodeUpdatePlan,
|
|
32
|
+
buildPiModelPlan,
|
|
33
|
+
buildPiSetupPlan,
|
|
34
|
+
buildPiSyncPlan,
|
|
35
|
+
buildPiUpdatePlan,
|
|
30
36
|
claudeCodeAdapter,
|
|
31
37
|
codexAdapter,
|
|
32
38
|
defaultClaudeCodeModelRoles,
|
|
39
|
+
defaultPiModelRoles,
|
|
33
40
|
finalizeHarnessInstall,
|
|
34
41
|
formatClaudeCodeSetupPlan,
|
|
35
42
|
formatCodexPluginSetupPlan,
|
|
36
43
|
formatCodexSetupPlan,
|
|
44
|
+
formatPiSetupPlan,
|
|
37
45
|
getClaudeCodeModelRoles,
|
|
38
46
|
getClaudeCodeStatus,
|
|
39
47
|
getCodexModelRoles,
|
|
@@ -42,12 +50,20 @@ import {
|
|
|
42
50
|
getOpenCodeModelRoles,
|
|
43
51
|
getOpenCodeStatus,
|
|
44
52
|
getOperationHarness,
|
|
53
|
+
getPiModelRoles,
|
|
54
|
+
getPiStatus,
|
|
45
55
|
getRequiredSkillInstallCommand,
|
|
56
|
+
inspectPiPackageSkills,
|
|
46
57
|
installRequiredSkill,
|
|
47
58
|
listOperationHarnesses,
|
|
48
59
|
normalizeEffortSelection,
|
|
60
|
+
recordHarnessInstallCompletion,
|
|
49
61
|
syncOpenCodeOwnedSkills
|
|
50
|
-
} from "../chunk-
|
|
62
|
+
} from "../chunk-2D7E7GMP.js";
|
|
63
|
+
import "../chunk-62L3ORXN.js";
|
|
64
|
+
import {
|
|
65
|
+
piAdapter
|
|
66
|
+
} from "../chunk-2U5MBLLV.js";
|
|
51
67
|
import {
|
|
52
68
|
ALL_AGENT_NAMES,
|
|
53
69
|
detectCurrentConfig,
|
|
@@ -58,7 +74,7 @@ import {
|
|
|
58
74
|
resolveExecutingPackageVersion,
|
|
59
75
|
updateOpenCodeMainConfig,
|
|
60
76
|
writeLiteConfig
|
|
61
|
-
} from "../chunk-
|
|
77
|
+
} from "../chunk-EFGSGPYM.js";
|
|
62
78
|
|
|
63
79
|
// src/cli/index.ts
|
|
64
80
|
import { pathToFileURL } from "url";
|
|
@@ -67,7 +83,8 @@ import { pathToFileURL } from "url";
|
|
|
67
83
|
var HARNESS_ADAPTERS = {
|
|
68
84
|
opencode: opencodeAdapter,
|
|
69
85
|
codex: codexAdapter,
|
|
70
|
-
claude: claudeCodeAdapter
|
|
86
|
+
claude: claudeCodeAdapter,
|
|
87
|
+
pi: piAdapter
|
|
71
88
|
};
|
|
72
89
|
var SUPPORTED_HARNESSES = Object.keys(HARNESS_ADAPTERS);
|
|
73
90
|
function getHarnessAdapter(harness) {
|
|
@@ -77,6 +94,7 @@ function getHarnessAdapter(harness) {
|
|
|
77
94
|
// src/cli/install.ts
|
|
78
95
|
import { existsSync } from "fs";
|
|
79
96
|
import { homedir } from "os";
|
|
97
|
+
import { join } from "path";
|
|
80
98
|
import { cwd } from "process";
|
|
81
99
|
var GREEN = "\x1B[32m";
|
|
82
100
|
var BLUE = "\x1B[34m";
|
|
@@ -250,6 +268,9 @@ function finalizeInstallForHarness(harness, dryRun, version, dependencies) {
|
|
|
250
268
|
});
|
|
251
269
|
const providerComplete = printThothMemSetupResult(result.provider, dryRun);
|
|
252
270
|
if (!providerComplete) return false;
|
|
271
|
+
return printInstallLedgerResult(result);
|
|
272
|
+
}
|
|
273
|
+
function printInstallLedgerResult(result) {
|
|
253
274
|
if (!result.success) {
|
|
254
275
|
printError(result.error ?? "Failed to record the completed CLI install.");
|
|
255
276
|
return false;
|
|
@@ -261,6 +282,25 @@ function finalizeInstallForHarness(harness, dryRun, version, dependencies) {
|
|
|
261
282
|
}
|
|
262
283
|
return true;
|
|
263
284
|
}
|
|
285
|
+
function finalizeLocalPiInstall(dryRun, version, dependencies) {
|
|
286
|
+
printWarning(
|
|
287
|
+
"Local thoth-agents install omits thoth-mem setup; install thoth-mem separately from its local checkout."
|
|
288
|
+
);
|
|
289
|
+
printInfo(
|
|
290
|
+
'Separate command: node <thoth-mem-root>/dist/index.js setup pi --local-package-root "<absolute-thoth-mem-root>"'
|
|
291
|
+
);
|
|
292
|
+
const record = dependencies.recordHarnessInstallCompletion ?? recordHarnessInstallCompletion;
|
|
293
|
+
return printInstallLedgerResult(
|
|
294
|
+
record({
|
|
295
|
+
harness: "pi",
|
|
296
|
+
version,
|
|
297
|
+
dryRun,
|
|
298
|
+
ledgerOptions: dependencies.installLedgerOptions ?? {
|
|
299
|
+
homeDir: dependencies.homeDir ?? homedir()
|
|
300
|
+
}
|
|
301
|
+
})
|
|
302
|
+
);
|
|
303
|
+
}
|
|
264
304
|
async function runInstall(config, dependencies, pluginVersion) {
|
|
265
305
|
const detected = detectCurrentConfig();
|
|
266
306
|
const isUpdate = detected.isInstalled;
|
|
@@ -356,10 +396,93 @@ ${JSON.stringify(liteConfig, null, 2)}
|
|
|
356
396
|
);
|
|
357
397
|
return 0;
|
|
358
398
|
}
|
|
399
|
+
async function runPiInstall(config, dependencies, packageVersion, executingPackageRoot) {
|
|
400
|
+
const buildPlan = dependencies.buildPiSetupPlan ?? buildPiSetupPlan;
|
|
401
|
+
const applyPlan = dependencies.applyPiSetup ?? applyPiSetup;
|
|
402
|
+
const plan = buildPlan({
|
|
403
|
+
dryRun: config.dryRun,
|
|
404
|
+
homeDir: dependencies.homeDir ?? homedir(),
|
|
405
|
+
cwd: cwd(),
|
|
406
|
+
commandExecutor: dependencies.piCommandExecutor,
|
|
407
|
+
expectedVersion: packageVersion,
|
|
408
|
+
packageRoot: executingPackageRoot,
|
|
409
|
+
...config.localPackageRoot ? { firstPartySource: config.localPackageRoot } : {},
|
|
410
|
+
receiptOptions: dependencies.installLedgerOptions,
|
|
411
|
+
verifyFirstParty: dependencies.verifyPiFirstParty
|
|
412
|
+
});
|
|
413
|
+
console.log(formatPiSetupPlan(plan));
|
|
414
|
+
for (const diagnostic of [...plan.diagnostics, ...plan.disclaimers]) {
|
|
415
|
+
printInfo(diagnostic);
|
|
416
|
+
}
|
|
417
|
+
if (!plan.ready) {
|
|
418
|
+
for (const blocker of plan.blockers) printError(blocker);
|
|
419
|
+
return 1;
|
|
420
|
+
}
|
|
421
|
+
const applied = applyPlan(plan);
|
|
422
|
+
for (const diagnostic of applied.diagnostics) printInfo(diagnostic);
|
|
423
|
+
if (!applied.success) {
|
|
424
|
+
printError(
|
|
425
|
+
`Pi install failed after ${applied.installedPackages.length} package step(s): ${applied.error ?? "unknown error"}`
|
|
426
|
+
);
|
|
427
|
+
return 1;
|
|
428
|
+
}
|
|
429
|
+
if (config.dryRun) {
|
|
430
|
+
printInfo(
|
|
431
|
+
"Pi package-declared skills remain unavailable until the first-party package is receipt-validated."
|
|
432
|
+
);
|
|
433
|
+
} else {
|
|
434
|
+
if (!applied.configuredPackageRoot) {
|
|
435
|
+
printError("Verified configured Pi package root is unavailable.");
|
|
436
|
+
return 1;
|
|
437
|
+
}
|
|
438
|
+
const packageSkills = (dependencies.inspectPiPackageSkills ?? inspectPiPackageSkills)({ packageRoot: applied.configuredPackageRoot });
|
|
439
|
+
for (const skill of packageSkills.skills)
|
|
440
|
+
printInfo(
|
|
441
|
+
` - ${skill.name}: ${join(skill.destinationPath, "SKILL.md")}`
|
|
442
|
+
);
|
|
443
|
+
if (!packageSkills.success) {
|
|
444
|
+
printError(
|
|
445
|
+
`Failed to inspect package-declared Pi skills: ${packageSkills.error ?? "unknown error"}`
|
|
446
|
+
);
|
|
447
|
+
return 1;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
if (config.dryRun) {
|
|
451
|
+
if (!installRequiredSkillsForHarness("pi", true, dependencies.homeDir)) {
|
|
452
|
+
return 1;
|
|
453
|
+
}
|
|
454
|
+
} else {
|
|
455
|
+
const installSkill = dependencies.installRequiredSkill ?? installRequiredSkill;
|
|
456
|
+
for (const skill of REQUIRED_SKILLS) {
|
|
457
|
+
const result = installSkill(skill, "pi", {
|
|
458
|
+
homeDir: dependencies.homeDir ?? homedir()
|
|
459
|
+
});
|
|
460
|
+
if (result.status === "failed") {
|
|
461
|
+
printError(`Failed to install required Pi skill: ${skill.name}`);
|
|
462
|
+
return 1;
|
|
463
|
+
}
|
|
464
|
+
printInfo(` - ${skill.name}: ${result.skillPath}`);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
const finalized = config.localPackageRoot ? finalizeLocalPiInstall(config.dryRun, packageVersion, dependencies) : finalizeInstallForHarness(
|
|
468
|
+
"pi",
|
|
469
|
+
config.dryRun,
|
|
470
|
+
packageVersion,
|
|
471
|
+
dependencies
|
|
472
|
+
);
|
|
473
|
+
if (!finalized) {
|
|
474
|
+
return 1;
|
|
475
|
+
}
|
|
476
|
+
printSuccess(
|
|
477
|
+
config.dryRun ? `Pi dry-run complete; no packages, files, provider state, or ledger state changed${config.localPackageRoot ? "; thoth-mem remains a separate local install" : ""}` : `Complete Pi native package, agent, skill, research, and ledger setup applied${config.localPackageRoot ? "; thoth-mem remains a separate local install" : ", including provider setup"}`
|
|
478
|
+
);
|
|
479
|
+
return 0;
|
|
480
|
+
}
|
|
359
481
|
function createInstallConfig(args) {
|
|
360
482
|
return {
|
|
361
483
|
agent: args.agent ?? "opencode",
|
|
362
484
|
hasTmux: args.tmux === "yes",
|
|
485
|
+
...args.localPackageRoot ? { localPackageRoot: args.localPackageRoot } : {},
|
|
363
486
|
dryRun: args.dryRun,
|
|
364
487
|
reset: args.reset ?? false
|
|
365
488
|
};
|
|
@@ -455,6 +578,14 @@ async function install(args, dependencies = {}) {
|
|
|
455
578
|
);
|
|
456
579
|
return 0;
|
|
457
580
|
}
|
|
581
|
+
if (config.agent === "pi") {
|
|
582
|
+
return runPiInstall(
|
|
583
|
+
config,
|
|
584
|
+
dependencies,
|
|
585
|
+
packageVersion.version,
|
|
586
|
+
packageVersion.packageRoot
|
|
587
|
+
);
|
|
588
|
+
}
|
|
458
589
|
return runInstall(config, dependencies, packageVersion.version);
|
|
459
590
|
}
|
|
460
591
|
|
|
@@ -615,7 +746,7 @@ Usage: thoth-agents [COMMAND] [OPTIONS]
|
|
|
615
746
|
|
|
616
747
|
Commands:
|
|
617
748
|
(no command) Open the interactive TUI in a TTY; fall back to OpenCode install in CI/non-TTY
|
|
618
|
-
install Install OpenCode, Codex,
|
|
749
|
+
install Install OpenCode, Codex, Claude Code, or Pi agent assets
|
|
619
750
|
generate Generate harness-specific artifacts
|
|
620
751
|
status Show official CLI-managed versions and managed install status
|
|
621
752
|
list List managed surfaces and actions
|
|
@@ -629,9 +760,11 @@ Options:
|
|
|
629
760
|
--dry-run Simulate install without writing files
|
|
630
761
|
--apply Apply a reviewed update, sync, or model plan
|
|
631
762
|
--reset Repair managed installer-owned targets
|
|
632
|
-
--agent=opencode|codex|claude
|
|
633
|
-
Select OpenCode plugin install (default), Codex
|
|
634
|
-
--
|
|
763
|
+
--agent=opencode|codex|claude|pi
|
|
764
|
+
Select OpenCode plugin install (default), Codex/Claude setup, or complete Pi-native setup
|
|
765
|
+
--local-package-root=PATH
|
|
766
|
+
Install local thoth-agents with --agent=pi; thoth-mem is installed separately
|
|
767
|
+
--harness=... Select harness for status/update/sync/model (opencode|codex|claude|pi)
|
|
635
768
|
--role-effort=role=effort
|
|
636
769
|
Set a repeatable role effort; use inherit or default for no override
|
|
637
770
|
-h, --help Show this help message
|
|
@@ -673,6 +806,8 @@ Examples:
|
|
|
673
806
|
pnpm dlx thoth-agents@latest install --agent=codex --dry-run
|
|
674
807
|
pnpm dlx thoth-agents@latest install --agent=claude
|
|
675
808
|
pnpm dlx thoth-agents@latest install --agent=claude --dry-run
|
|
809
|
+
pnpm dlx thoth-agents@latest install --agent=pi --dry-run
|
|
810
|
+
node dist/cli/index.js install --agent=pi --local-package-root="<absolute-path>"
|
|
676
811
|
pnpm dlx thoth-agents install --no-tui --tmux=no
|
|
677
812
|
pnpm dlx thoth-agents install --dry-run
|
|
678
813
|
pnpm dlx thoth-agents install --reset
|
|
@@ -691,6 +826,7 @@ function statusReports(args, context = operationContext()) {
|
|
|
691
826
|
return harnesses.map((harness) => {
|
|
692
827
|
if (harness === "opencode") return getOpenCodeStatus(context);
|
|
693
828
|
if (harness === "claude") return getClaudeCodeStatus(context);
|
|
829
|
+
if (harness === "pi") return getPiStatus(context);
|
|
694
830
|
return getCodexStatus(context);
|
|
695
831
|
});
|
|
696
832
|
}
|
|
@@ -702,6 +838,9 @@ function buildOperationPlan(command, args, context = operationContext()) {
|
|
|
702
838
|
if (harness === "claude") {
|
|
703
839
|
return command === "update" ? buildClaudeCodeUpdatePlan(context) : buildClaudeCodeSyncPlan(context);
|
|
704
840
|
}
|
|
841
|
+
if (harness === "pi") {
|
|
842
|
+
return command === "update" ? buildPiUpdatePlan(context) : buildPiSyncPlan(context);
|
|
843
|
+
}
|
|
705
844
|
return command === "update" ? buildCodexUpdatePlan(context) : buildCodexSyncPlan(context);
|
|
706
845
|
}
|
|
707
846
|
function defaultModelRoles(harness) {
|
|
@@ -714,6 +853,7 @@ function defaultModelRoles(harness) {
|
|
|
714
853
|
if (harness === "claude") {
|
|
715
854
|
return defaultClaudeCodeModelRoles();
|
|
716
855
|
}
|
|
856
|
+
if (harness === "pi") return defaultPiModelRoles();
|
|
717
857
|
return ALL_AGENT_NAMES.map((role) => ({
|
|
718
858
|
role,
|
|
719
859
|
model: getDefaultOpenCodeModel(role),
|
|
@@ -747,6 +887,7 @@ var defaultModelCommandServices = {
|
|
|
747
887
|
modelRoles(harness) {
|
|
748
888
|
if (harness === "opencode") return getOpenCodeModelRoles();
|
|
749
889
|
if (harness === "claude") return getClaudeCodeModelRoles();
|
|
890
|
+
if (harness === "pi") return getPiModelRoles();
|
|
750
891
|
return getCodexModelRoles();
|
|
751
892
|
},
|
|
752
893
|
modelOptions: getModelOptions
|
|
@@ -779,11 +920,13 @@ async function buildModelPlan(args, services) {
|
|
|
779
920
|
};
|
|
780
921
|
if (harness === "opencode") return buildOpenCodeModelPlan(input, context);
|
|
781
922
|
if (harness === "claude") return buildClaudeCodeModelPlan(input, context);
|
|
923
|
+
if (harness === "pi") return buildPiModelPlan(input, context);
|
|
782
924
|
return buildCodexModelPlan(input, context);
|
|
783
925
|
}
|
|
784
926
|
function applyOperationPlan(plan) {
|
|
785
927
|
if (plan.harness === "opencode") return applyOpenCodePlan(plan);
|
|
786
928
|
if (plan.harness === "claude") return applyClaudeCodePlan(plan);
|
|
929
|
+
if (plan.harness === "pi") return applyPiPlan(plan);
|
|
787
930
|
return applyCodexPlan(plan);
|
|
788
931
|
}
|
|
789
932
|
function printPlanOrApply(plan, args, applyPlan) {
|
|
@@ -871,6 +1014,9 @@ async function runCliCommand(parsed, modelServices = defaultModelCommandServices
|
|
|
871
1014
|
);
|
|
872
1015
|
}
|
|
873
1016
|
|
|
1017
|
+
// src/cli/parser.ts
|
|
1018
|
+
import { isAbsolute, resolve } from "path";
|
|
1019
|
+
|
|
874
1020
|
// src/cli/runtime.ts
|
|
875
1021
|
var automationEnvironmentKeys = [
|
|
876
1022
|
"CI",
|
|
@@ -922,9 +1068,9 @@ function parseBooleanArg(name, value) {
|
|
|
922
1068
|
return value;
|
|
923
1069
|
}
|
|
924
1070
|
function parseOperationHarness(value) {
|
|
925
|
-
if (value !== "opencode" && value !== "codex" && value !== "claude") {
|
|
1071
|
+
if (value !== "opencode" && value !== "codex" && value !== "claude" && value !== "pi") {
|
|
926
1072
|
throw new Error(
|
|
927
|
-
`Unsupported operation harness: ${value}. Supported harnesses: opencode, codex, claude.`
|
|
1073
|
+
`Unsupported operation harness: ${value}. Supported harnesses: opencode, codex, claude, pi.`
|
|
928
1074
|
);
|
|
929
1075
|
}
|
|
930
1076
|
return value;
|
|
@@ -1027,7 +1173,9 @@ function parseInstallArgs(args) {
|
|
|
1027
1173
|
tui: true,
|
|
1028
1174
|
agent: "opencode"
|
|
1029
1175
|
};
|
|
1030
|
-
for (
|
|
1176
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
1177
|
+
const arg = args[index];
|
|
1178
|
+
if (arg === void 0) break;
|
|
1031
1179
|
if (arg === "--no-tui") {
|
|
1032
1180
|
result.tui = false;
|
|
1033
1181
|
} else if (arg.startsWith("--tmux=")) {
|
|
@@ -1038,18 +1186,41 @@ function parseInstallArgs(args) {
|
|
|
1038
1186
|
result.reset = true;
|
|
1039
1187
|
} else if (arg.startsWith("--agent=")) {
|
|
1040
1188
|
const agent = arg.split("=")[1];
|
|
1041
|
-
if (agent !== "opencode" && agent !== "codex" && agent !== "claude") {
|
|
1189
|
+
if (agent !== "opencode" && agent !== "codex" && agent !== "claude" && agent !== "pi") {
|
|
1042
1190
|
throw new Error(
|
|
1043
|
-
`Unsupported install agent: ${agent}. Supported agents: opencode, codex, claude.`
|
|
1191
|
+
`Unsupported install agent: ${agent}. Supported agents: opencode, codex, claude, pi.`
|
|
1044
1192
|
);
|
|
1045
1193
|
}
|
|
1046
1194
|
result.agent = agent;
|
|
1195
|
+
} else if (arg === "--local-package-root" || arg.startsWith("--local-package-root=")) {
|
|
1196
|
+
if (result.localPackageRoot !== void 0) {
|
|
1197
|
+
throw new Error("--local-package-root cannot be repeated.");
|
|
1198
|
+
}
|
|
1199
|
+
let localPackageRoot;
|
|
1200
|
+
if (arg === "--local-package-root") {
|
|
1201
|
+
index += 1;
|
|
1202
|
+
localPackageRoot = args[index];
|
|
1203
|
+
} else {
|
|
1204
|
+
localPackageRoot = arg.slice("--local-package-root=".length);
|
|
1205
|
+
}
|
|
1206
|
+
if (!localPackageRoot || localPackageRoot.startsWith("--")) {
|
|
1207
|
+
throw new Error("--local-package-root requires a value.");
|
|
1208
|
+
}
|
|
1209
|
+
if (!isAbsolute(localPackageRoot) || resolve(localPackageRoot) !== localPackageRoot) {
|
|
1210
|
+
throw new Error(
|
|
1211
|
+
"--local-package-root requires a normalized absolute path."
|
|
1212
|
+
);
|
|
1213
|
+
}
|
|
1214
|
+
result.localPackageRoot = localPackageRoot;
|
|
1047
1215
|
} else if (arg === "-h" || arg === "--help") {
|
|
1048
1216
|
throw new Error("help");
|
|
1049
1217
|
} else {
|
|
1050
1218
|
throw new Error(`Unsupported install option: ${arg}`);
|
|
1051
1219
|
}
|
|
1052
1220
|
}
|
|
1221
|
+
if (result.localPackageRoot !== void 0 && result.agent !== "pi") {
|
|
1222
|
+
throw new Error("--local-package-root is supported only with --agent=pi.");
|
|
1223
|
+
}
|
|
1053
1224
|
return result;
|
|
1054
1225
|
}
|
|
1055
1226
|
function parseGenerateArgs(args) {
|
|
@@ -22,6 +22,18 @@ export interface HarnessInstallCompletionResult {
|
|
|
22
22
|
ledger: InstallCompletionLedgerResult;
|
|
23
23
|
error?: string;
|
|
24
24
|
}
|
|
25
|
+
export interface HarnessInstallLedgerCompletionResult {
|
|
26
|
+
success: boolean;
|
|
27
|
+
ledger: InstallCompletionLedgerResult;
|
|
28
|
+
error?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface RecordHarnessInstallCompletionOptions {
|
|
31
|
+
harness: InstallHarnessId;
|
|
32
|
+
version: string;
|
|
33
|
+
dryRun?: boolean;
|
|
34
|
+
recordCompletedInstall?: (options: Parameters<typeof recordCompletedInstall>[0]) => RecordCompletedInstallResult;
|
|
35
|
+
ledgerOptions?: InstallLedgerOptions;
|
|
36
|
+
}
|
|
25
37
|
export interface FinalizeHarnessInstallOptions {
|
|
26
38
|
harness: InstallHarnessId;
|
|
27
39
|
version: string;
|
|
@@ -31,4 +43,5 @@ export interface FinalizeHarnessInstallOptions {
|
|
|
31
43
|
recordCompletedInstall?: (options: Parameters<typeof recordCompletedInstall>[0]) => RecordCompletedInstallResult;
|
|
32
44
|
ledgerOptions?: InstallLedgerOptions;
|
|
33
45
|
}
|
|
46
|
+
export declare function recordHarnessInstallCompletion(options: RecordHarnessInstallCompletionOptions): HarnessInstallLedgerCompletionResult;
|
|
34
47
|
export declare function finalizeHarnessInstall(options: FinalizeHarnessInstallOptions): HarnessInstallCompletionResult;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const INSTALL_LEDGER_SCHEMA_VERSION: 1;
|
|
2
|
-
export type InstallHarnessId = 'opencode' | 'codex' | 'claude';
|
|
2
|
+
export type InstallHarnessId = 'opencode' | 'codex' | 'claude' | 'pi';
|
|
3
3
|
export interface InstallLedger {
|
|
4
4
|
schemaVersion: typeof INSTALL_LEDGER_SCHEMA_VERSION;
|
|
5
5
|
harnesses: Partial<Record<InstallHarnessId, {
|
package/dist/cli/install.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { updateOpenCodeMainConfig } from './config-manager';
|
|
2
|
-
import { finalizeHarnessInstall } from './install-completion';
|
|
2
|
+
import { finalizeHarnessInstall, recordHarnessInstallCompletion } from './install-completion';
|
|
3
3
|
import type { InstallLedgerOptions } from './install-ledger';
|
|
4
|
+
import { inspectPiPackageSkills } from './owned-skills';
|
|
4
5
|
import { type ExecutingPackageVersionResult } from './package-version';
|
|
6
|
+
import { applyPiSetup, buildPiSetupPlan, type PiCommandExecutor, type PiSetupOptions } from './pi-install';
|
|
7
|
+
import { installRequiredSkill } from './skills';
|
|
5
8
|
import type { ThothMemSetupOptions, ThothMemSetupResult } from './thoth-mem-install';
|
|
6
9
|
import type { InstallArgs, InstallConfig } from './types';
|
|
7
10
|
export interface InstallDependencies {
|
|
@@ -11,7 +14,14 @@ export interface InstallDependencies {
|
|
|
11
14
|
resolveExecutingPackageVersion?: () => ExecutingPackageVersionResult;
|
|
12
15
|
updateOpenCodeMainConfig?: typeof updateOpenCodeMainConfig;
|
|
13
16
|
finalizeHarnessInstall?: typeof finalizeHarnessInstall;
|
|
17
|
+
recordHarnessInstallCompletion?: typeof recordHarnessInstallCompletion;
|
|
14
18
|
installLedgerOptions?: InstallLedgerOptions;
|
|
19
|
+
piCommandExecutor?: PiCommandExecutor;
|
|
20
|
+
buildPiSetupPlan?: typeof buildPiSetupPlan;
|
|
21
|
+
applyPiSetup?: typeof applyPiSetup;
|
|
22
|
+
inspectPiPackageSkills?: typeof inspectPiPackageSkills;
|
|
23
|
+
verifyPiFirstParty?: PiSetupOptions['verifyFirstParty'];
|
|
24
|
+
installRequiredSkill?: typeof installRequiredSkill;
|
|
15
25
|
}
|
|
16
26
|
export declare function createInstallConfig(args: InstallArgs): InstallConfig;
|
|
17
27
|
export declare function install(args: InstallArgs, dependencies?: InstallDependencies): Promise<number>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ProviderEvidenceInput } from '../../harness/types';
|
|
2
|
+
import { type FinalizeHarnessInstallOptions, finalizeHarnessInstall } from '../install-completion';
|
|
3
|
+
import { type InstallLedgerOptions } from '../install-ledger';
|
|
4
|
+
import { inspectPiPackageSkills } from '../owned-skills';
|
|
5
|
+
import { applyPiSetup, buildPiSetupPlan, type PiCommandExecutor } from '../pi-install';
|
|
6
|
+
import { installRequiredSkill } from '../skills';
|
|
7
|
+
import type { HarnessAction, HarnessStatusReport, ModelConfigInput, ModelRoleInput, OperationApplyResult, OperationContext, OperationPlan } from './types';
|
|
8
|
+
export interface PiOperationContext extends OperationContext {
|
|
9
|
+
homeDir?: string;
|
|
10
|
+
packageRoot?: string;
|
|
11
|
+
env?: Readonly<Record<string, string | undefined>>;
|
|
12
|
+
installLedgerOptions?: InstallLedgerOptions;
|
|
13
|
+
buildPiSetupPlan?: typeof buildPiSetupPlan;
|
|
14
|
+
applyPiSetup?: typeof applyPiSetup;
|
|
15
|
+
inspectPiPackageSkills?: typeof inspectPiPackageSkills;
|
|
16
|
+
piCommandExecutor?: PiCommandExecutor;
|
|
17
|
+
installRequiredSkill?: typeof installRequiredSkill;
|
|
18
|
+
finalizeHarnessInstall?: (options: FinalizeHarnessInstallOptions) => ReturnType<typeof finalizeHarnessInstall>;
|
|
19
|
+
runThothMemSetup?: FinalizeHarnessInstallOptions['runThothMemSetup'];
|
|
20
|
+
}
|
|
21
|
+
export type PiResearchProviderId = 'context7' | 'web-access' | 'grep';
|
|
22
|
+
export type PiResearchRuntimeState = 'ready' | 'unverified' | 'credential-required' | 'unreachable' | 'drifted' | 'failed';
|
|
23
|
+
export interface PiResearchRuntimeEvidence {
|
|
24
|
+
state: PiResearchRuntimeState;
|
|
25
|
+
basis: readonly string[];
|
|
26
|
+
}
|
|
27
|
+
export interface PiStatusEvidence extends ProviderEvidenceInput {
|
|
28
|
+
research?: Partial<Record<PiResearchProviderId, PiResearchRuntimeEvidence>>;
|
|
29
|
+
}
|
|
30
|
+
export declare const piOperationAdapter: {
|
|
31
|
+
readonly id: "pi";
|
|
32
|
+
readonly displayName: "Pi";
|
|
33
|
+
readonly available: true;
|
|
34
|
+
readonly description: "Pi-native packages, ambient root, six specialists, skills, and hybrid research stack.";
|
|
35
|
+
readonly actions: HarnessAction[];
|
|
36
|
+
};
|
|
37
|
+
export declare function getPiStatus(context?: PiOperationContext, evidence?: PiStatusEvidence): HarnessStatusReport;
|
|
38
|
+
export declare function buildPiInstallPlan(context?: PiOperationContext): OperationPlan;
|
|
39
|
+
export declare function buildPiUpdatePlan(context?: PiOperationContext): OperationPlan;
|
|
40
|
+
export declare function buildPiSyncPlan(context?: PiOperationContext): OperationPlan;
|
|
41
|
+
export declare function defaultPiModelRoles(context?: PiOperationContext): ModelRoleInput[];
|
|
42
|
+
export declare function buildPiModelPlan(input: ModelConfigInput, context?: PiOperationContext): OperationPlan;
|
|
43
|
+
export declare function applyPiPlan(plan: OperationPlan): OperationApplyResult;
|
|
@@ -15,6 +15,23 @@ export interface OpenCodeOwnedSkillSyncResult {
|
|
|
15
15
|
skills: OpenCodeOwnedSkillSyncEntry[];
|
|
16
16
|
error?: string;
|
|
17
17
|
}
|
|
18
|
+
export interface PiPackageSkillInspectionResult {
|
|
19
|
+
success: boolean;
|
|
20
|
+
state: 'available' | 'unavailable';
|
|
21
|
+
skills: OpenCodeOwnedSkillSyncEntry[];
|
|
22
|
+
issues: Array<{
|
|
23
|
+
name: ThothOwnedSkillName;
|
|
24
|
+
state: 'missing' | 'drift';
|
|
25
|
+
message: string;
|
|
26
|
+
}>;
|
|
27
|
+
error?: string;
|
|
28
|
+
}
|
|
18
29
|
export declare function resolveOwnedSkillPackageRoot(moduleUrl: string): string;
|
|
19
30
|
export declare function getOpenCodeOwnedSkillEntries(options?: Pick<OpenCodeOwnedSkillSyncOptions, 'homeDir' | 'packageRoot'>): OpenCodeOwnedSkillSyncEntry[];
|
|
31
|
+
export declare function getPiOwnedSkillEntries(options: {
|
|
32
|
+
packageRoot: string;
|
|
33
|
+
}): OpenCodeOwnedSkillSyncEntry[];
|
|
20
34
|
export declare function syncOpenCodeOwnedSkills(options?: OpenCodeOwnedSkillSyncOptions): OpenCodeOwnedSkillSyncResult;
|
|
35
|
+
export declare function inspectPiPackageSkills(options: {
|
|
36
|
+
packageRoot: string;
|
|
37
|
+
}): PiPackageSkillInspectionResult;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ModelRoleInput } from './operations/types';
|
|
2
|
+
export declare const PI_EFFORT_VALUES: readonly ["off", "minimal", "low", "medium", "high", "xhigh"];
|
|
3
|
+
export type PiEffortResolution = {
|
|
4
|
+
ok: true;
|
|
5
|
+
effort: string | undefined;
|
|
6
|
+
} | {
|
|
7
|
+
ok: false;
|
|
8
|
+
message: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function resolvePiEffort(input: Pick<ModelRoleInput, 'availableEfforts' | 'effort' | 'model'>): PiEffortResolution;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { type PiPackageReceipt, type PiPackageReceiptOptions } from './pi-package-receipt';
|
|
2
|
+
import { type PiPathOptions, type PiPaths } from './pi-paths';
|
|
3
|
+
export declare const PI_MINIMUM_VERSION = "0.84.4";
|
|
4
|
+
export declare const PI_NODE_MINIMUM = "22.19.0";
|
|
5
|
+
export declare const PI_COMMAND_TIMEOUT_MS = 120000;
|
|
6
|
+
export declare const PI_PACKAGE_SPECS: readonly [{
|
|
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";
|
|
11
|
+
}, {
|
|
12
|
+
readonly id: "context7";
|
|
13
|
+
readonly source: "npm:@upstash/context7-pi@0.1.2";
|
|
14
|
+
readonly packageName: "@upstash/context7-pi";
|
|
15
|
+
readonly version: "0.1.2";
|
|
16
|
+
}, {
|
|
17
|
+
readonly id: "web-access";
|
|
18
|
+
readonly source: "npm:pi-web-access@0.27.0";
|
|
19
|
+
readonly packageName: "pi-web-access";
|
|
20
|
+
readonly version: "0.27.0";
|
|
21
|
+
}, {
|
|
22
|
+
readonly id: "grep-adapter";
|
|
23
|
+
readonly source: "npm:pi-mcp-adapter@2.32.1";
|
|
24
|
+
readonly packageName: "pi-mcp-adapter";
|
|
25
|
+
readonly version: "2.32.1";
|
|
26
|
+
}, {
|
|
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";
|
|
31
|
+
}, {
|
|
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";
|
|
36
|
+
}];
|
|
37
|
+
export declare const PI_GREP_MCP_ENTRY: {
|
|
38
|
+
readonly url: "https://mcp.grep.app";
|
|
39
|
+
readonly protocolVersion: "legacy";
|
|
40
|
+
readonly lifecycle: "lazy";
|
|
41
|
+
};
|
|
42
|
+
export interface PiCommandResult {
|
|
43
|
+
exitCode: number | null;
|
|
44
|
+
stdout: string;
|
|
45
|
+
stderr: string;
|
|
46
|
+
error?: unknown;
|
|
47
|
+
}
|
|
48
|
+
export type PiCommandExecutor = (command: string, args: readonly string[]) => PiCommandResult;
|
|
49
|
+
export interface PiSetupOptions extends PiPathOptions {
|
|
50
|
+
dryRun?: boolean;
|
|
51
|
+
commandExecutor?: PiCommandExecutor;
|
|
52
|
+
expectedVersion?: string;
|
|
53
|
+
packageRoot?: string;
|
|
54
|
+
firstPartySource?: string;
|
|
55
|
+
receiptOptions?: PiPackageReceiptOptions;
|
|
56
|
+
verifyFirstParty?: (input: {
|
|
57
|
+
source: string;
|
|
58
|
+
installSource: string;
|
|
59
|
+
version: string;
|
|
60
|
+
packageRoot: string;
|
|
61
|
+
}) => {
|
|
62
|
+
success: true;
|
|
63
|
+
receipt: PiPackageReceipt;
|
|
64
|
+
} | {
|
|
65
|
+
success: false;
|
|
66
|
+
error: string;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export interface PiSetupPlanItem {
|
|
70
|
+
kind: 'preflight' | 'package' | 'root' | 'agent' | 'mcp';
|
|
71
|
+
description: string;
|
|
72
|
+
target: string;
|
|
73
|
+
command?: {
|
|
74
|
+
command: string;
|
|
75
|
+
args: string[];
|
|
76
|
+
};
|
|
77
|
+
content?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface PiSetupPlan {
|
|
80
|
+
dryRun: boolean;
|
|
81
|
+
ready: boolean;
|
|
82
|
+
paths: PiPaths;
|
|
83
|
+
items: PiSetupPlanItem[];
|
|
84
|
+
blockers: string[];
|
|
85
|
+
diagnostics: string[];
|
|
86
|
+
disclaimers: string[];
|
|
87
|
+
options: PiSetupOptions;
|
|
88
|
+
}
|
|
89
|
+
export interface PiApplyResult {
|
|
90
|
+
success: boolean;
|
|
91
|
+
changed: string[];
|
|
92
|
+
diagnostics: string[];
|
|
93
|
+
error?: string;
|
|
94
|
+
failedStep?: string;
|
|
95
|
+
installedPackages: string[];
|
|
96
|
+
receiptCommitted?: boolean;
|
|
97
|
+
rollbackFailed?: boolean;
|
|
98
|
+
manualRecovery?: string;
|
|
99
|
+
configuredPackageRoot?: string;
|
|
100
|
+
}
|
|
101
|
+
export declare function getPiFirstPartySource(version: string): string;
|
|
102
|
+
export declare function verifyPiFirstPartyPackage(input: {
|
|
103
|
+
source: string;
|
|
104
|
+
installSource: string;
|
|
105
|
+
version: string;
|
|
106
|
+
packageRoot: string;
|
|
107
|
+
}): {
|
|
108
|
+
success: true;
|
|
109
|
+
receipt: PiPackageReceipt;
|
|
110
|
+
} | {
|
|
111
|
+
success: false;
|
|
112
|
+
error: string;
|
|
113
|
+
};
|
|
114
|
+
export declare function mergePiGrepMcpConfig(current: Record<string, unknown>): Record<string, unknown>;
|
|
115
|
+
export declare function mergePiRootBlock(current: string, managedBlock: string): string;
|
|
116
|
+
export declare function buildPiSetupPlan(options?: PiSetupOptions): PiSetupPlan;
|
|
117
|
+
export declare function formatPiSetupPlan(plan: PiSetupPlan): string;
|
|
118
|
+
export declare function isVersionAtLeast(actual: string, expected: string): boolean;
|
|
119
|
+
export declare function hasExactInstalledPiPackage(output: string, source: string): boolean;
|
|
120
|
+
export interface PiConfiguredPackage {
|
|
121
|
+
scope: 'user' | 'project';
|
|
122
|
+
source: string;
|
|
123
|
+
installedPath?: string;
|
|
124
|
+
packageName?: string;
|
|
125
|
+
packageVersion?: string;
|
|
126
|
+
}
|
|
127
|
+
export declare function parsePiPackageList(output: string): PiConfiguredPackage[];
|
|
128
|
+
export declare function isThothPackageLocation(candidate: PiConfiguredPackage, knownSource?: string): boolean;
|
|
129
|
+
export declare function getPiFirstPartyPackages(packages: readonly PiConfiguredPackage[], knownSource?: string): PiConfiguredPackage[];
|
|
130
|
+
export declare function writePiManagedText(path: string, content: string): boolean;
|
|
131
|
+
export declare function applyPiSetup(plan: PiSetupPlan): PiApplyResult;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface PiLegacyMigrationOptions {
|
|
2
|
+
packageRoot: string;
|
|
3
|
+
piRoot: string;
|
|
4
|
+
dryRun?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface PiLegacyMigrationResult {
|
|
7
|
+
success: boolean;
|
|
8
|
+
changed: string[];
|
|
9
|
+
manualActions: string[];
|
|
10
|
+
error?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function migrateLegacyPiResources(options: PiLegacyMigrationOptions): PiLegacyMigrationResult;
|