thoth-agents 0.5.1 → 0.6.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.
- package/README.md +81 -10
- package/dist/{chunk-VUNYH263.js → chunk-7YCSKK2X.js} +203 -40
- package/dist/{chunk-V7HSGRMB.js → chunk-U7FNFTM5.js} +31 -136
- package/dist/cli/index.js +2 -2
- package/dist/cli/pi-install.d.ts +34 -67
- package/dist/cli/pi-tool-config.d.ts +19 -0
- package/dist/cli/tui/index.js +2 -2
- package/dist/pi.d.ts +6 -35
- package/dist/pi.js +36 -432
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/pi/tools-panel.d.ts +0 -51
|
@@ -460,24 +460,6 @@ function scalarString(node, name, source) {
|
|
|
460
460
|
);
|
|
461
461
|
return node.value;
|
|
462
462
|
}
|
|
463
|
-
function sourceRange(node, source) {
|
|
464
|
-
if (!node || typeof node !== "object" || !("range" in node))
|
|
465
|
-
throw new Error(
|
|
466
|
-
"Cannot safely edit this Pi specialist YAML value without source ranges."
|
|
467
|
-
);
|
|
468
|
-
const range = node.range;
|
|
469
|
-
const sourceTokens = "srcToken" in node ? node.srcToken : void 0;
|
|
470
|
-
if (!Array.isArray(range) || !sourceTokens || range.length < 3 || !range.every(Number.isInteger) || range[0] < 0 || range[1] < range[0] || range[2] < range[1] || range[2] > source.length)
|
|
471
|
-
throw new Error(
|
|
472
|
-
"Cannot safely edit this Pi specialist YAML value using its source range."
|
|
473
|
-
);
|
|
474
|
-
let end = range[1];
|
|
475
|
-
if (isSeq(node) && !node.flow) {
|
|
476
|
-
const trailingNewline = source.slice(range[0], end).match(/\r?\n$/)?.[0];
|
|
477
|
-
if (trailingNewline) end -= trailingNewline.length;
|
|
478
|
-
}
|
|
479
|
-
return [range[0], end];
|
|
480
|
-
}
|
|
481
463
|
function validatePiSpecialistTools(tools) {
|
|
482
464
|
if (!Array.isArray(tools) || tools.length === 0)
|
|
483
465
|
throw new Error("Select at least one Pi tool name or glob.");
|
|
@@ -549,126 +531,41 @@ function readPiSpecialistToolOverrides(content) {
|
|
|
549
531
|
...subagentMode ? { subagentMode } : {}
|
|
550
532
|
};
|
|
551
533
|
}
|
|
552
|
-
function
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
const seen = /* @__PURE__ */ new Set();
|
|
559
|
-
for (const role of roles) {
|
|
560
|
-
if (!isPiSpecialistRole(role))
|
|
561
|
-
throw new Error(`Unsupported Pi specialist: ${role}`);
|
|
562
|
-
if (seen.has(role)) throw new Error(`Duplicate Pi specialist: ${role}`);
|
|
563
|
-
seen.add(role);
|
|
564
|
-
const content = readOwnedPiSpecialistDefinition(snapshot2.piRoot, role);
|
|
565
|
-
snapshot2.contents[role] = content;
|
|
566
|
-
const parsed = readPiSpecialistToolOverrides(content);
|
|
567
|
-
snapshot2.roles.push({
|
|
568
|
-
role,
|
|
569
|
-
tools: parsed.tools ?? getPiSpecialistDefaultTools(role),
|
|
570
|
-
defaultTools: getPiSpecialistDefaultTools(role),
|
|
571
|
-
disallowedTools: parsed.disallowedTools ?? []
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
return snapshot2;
|
|
575
|
-
}
|
|
576
|
-
function replaceToolsField(content, tools) {
|
|
577
|
-
const parsed = parseFrontmatter(content);
|
|
578
|
-
const pair = fieldPair(parsed.mapping, "tools");
|
|
579
|
-
const rendered = JSON.stringify(tools.join(", "));
|
|
580
|
-
if (!pair) {
|
|
581
|
-
if (parsed.mapping.flow)
|
|
582
|
-
throw new Error(
|
|
583
|
-
"Cannot safely add tools to a flow-style Pi specialist frontmatter mapping."
|
|
584
|
-
);
|
|
585
|
-
const newline = parsed.source.match(/\r?\n/)?.[0] ?? (content.includes("\r\n") ? "\r\n" : "\n");
|
|
586
|
-
return `${content.slice(0, parsed.blockStart)}tools: ${rendered}${newline}${content.slice(parsed.blockStart)}`;
|
|
587
|
-
}
|
|
588
|
-
if (pair.value === null)
|
|
589
|
-
throw new Error("The tools field must contain an explicit list.");
|
|
590
|
-
let [start, end] = sourceRange(pair.value, parsed.source);
|
|
591
|
-
let replacement = rendered;
|
|
592
|
-
const explicitKey = pair.srcToken && "explicitKey" in pair.srcToken && pair.srcToken.explicitKey === true;
|
|
593
|
-
if (isSeq(pair.value) && !pair.value.flow && !explicitKey) {
|
|
594
|
-
const [keyStart, keyEnd] = sourceRange(pair.key, parsed.source);
|
|
595
|
-
start = keyStart;
|
|
596
|
-
replacement = `${parsed.source.slice(keyStart, keyEnd)}: ${rendered}`;
|
|
597
|
-
}
|
|
598
|
-
const next = content.slice(0, parsed.blockStart + start) + replacement + content.slice(parsed.blockStart + end);
|
|
599
|
-
const verifiedTools = readPiSpecialistToolOverrides(next).tools;
|
|
600
|
-
if (JSON.stringify(verifiedTools) !== JSON.stringify(tools))
|
|
601
|
-
throw new Error(
|
|
602
|
-
"Cannot safely replace the tools field without changing its parsed value."
|
|
534
|
+
function createPiToolsPanelAdapter(piRoot) {
|
|
535
|
+
const root = resolve3(piRoot);
|
|
536
|
+
const managedRole = (target) => {
|
|
537
|
+
if (target.scope !== "global") return void 0;
|
|
538
|
+
return PI_SPECIALIST_ROLES.find(
|
|
539
|
+
(role) => target.role === piSpecialistName(role) && resolve3(target.filePath) === join2(root, "agents", `${piSpecialistName(role)}.md`)
|
|
603
540
|
);
|
|
604
|
-
return next;
|
|
605
|
-
}
|
|
606
|
-
function errorMessage(error) {
|
|
607
|
-
return error instanceof Error ? error.message : String(error);
|
|
608
|
-
}
|
|
609
|
-
function savePiToolConfig(snapshot2, roles) {
|
|
610
|
-
const changedRoles = [];
|
|
611
|
-
const nextSnapshot = {
|
|
612
|
-
...snapshot2,
|
|
613
|
-
roles: structuredClone(snapshot2.roles),
|
|
614
|
-
contents: { ...snapshot2.contents }
|
|
615
541
|
};
|
|
616
|
-
|
|
617
|
-
const
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
if (seen.has(input.role))
|
|
622
|
-
throw new Error(`Duplicate Pi specialist: ${input.role}`);
|
|
623
|
-
seen.add(input.role);
|
|
624
|
-
validatePiSpecialistTools(input.tools);
|
|
625
|
-
const expected = snapshot2.contents[input.role];
|
|
626
|
-
if (expected === void 0)
|
|
627
|
-
throw new Error(`Missing specialist snapshot: ${input.role}`);
|
|
628
|
-
readPiSpecialistToolOverrides(expected);
|
|
629
|
-
const current = readOwnedPiSpecialistDefinition(
|
|
630
|
-
snapshot2.piRoot,
|
|
631
|
-
input.role
|
|
542
|
+
const validatedRole = (target, content) => {
|
|
543
|
+
const role = managedRole(target);
|
|
544
|
+
if (!role)
|
|
545
|
+
throw new Error(
|
|
546
|
+
`Not a managed global Thoth specialist: ${target.filePath}`
|
|
632
547
|
);
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
}
|
|
639
|
-
for (const input of roles) {
|
|
640
|
-
const current = snapshot2.contents[input.role];
|
|
641
|
-
const original = snapshot2.roles.find(({ role }) => role === input.role);
|
|
642
|
-
if (!current || !original)
|
|
643
|
-
throw new Error(`Missing specialist snapshot: ${input.role}`);
|
|
644
|
-
if (JSON.stringify(original.tools) === JSON.stringify(input.tools))
|
|
645
|
-
continue;
|
|
646
|
-
const next = replaceToolsField(current, input.tools);
|
|
647
|
-
if (readOwnedPiSpecialistDefinition(snapshot2.piRoot, input.role) !== current)
|
|
648
|
-
throw new Error(
|
|
649
|
-
`Pi specialist changed before saving: ${input.role}. Reopen the editor.`
|
|
650
|
-
);
|
|
651
|
-
if (writePiManagedText(
|
|
652
|
-
join2(snapshot2.piRoot, "agents", `${piSpecialistName(input.role)}.md`),
|
|
653
|
-
next,
|
|
654
|
-
current
|
|
655
|
-
))
|
|
656
|
-
changedRoles.push(input.role);
|
|
657
|
-
nextSnapshot.contents[input.role] = next;
|
|
658
|
-
const nextRole = nextSnapshot.roles.find(
|
|
659
|
-
({ role }) => role === input.role
|
|
548
|
+
const current = readOwnedPiSpecialistDefinition(root, role);
|
|
549
|
+
readPiSpecialistToolOverrides(current);
|
|
550
|
+
if (current !== content)
|
|
551
|
+
throw new Error(
|
|
552
|
+
`Thoth specialist changed during validation: ${target.role}. Reopen the editor.`
|
|
660
553
|
);
|
|
661
|
-
|
|
554
|
+
return role;
|
|
555
|
+
};
|
|
556
|
+
return {
|
|
557
|
+
version: 1,
|
|
558
|
+
appliesTo(target, content) {
|
|
559
|
+
if (!managedRole(target)) return false;
|
|
560
|
+
return parseFrontmatter(content).mapping.get("managed-by") === "thoth-agents";
|
|
561
|
+
},
|
|
562
|
+
validate(target, content) {
|
|
563
|
+
validatedRole(target, content);
|
|
564
|
+
},
|
|
565
|
+
defaultTools(target, content) {
|
|
566
|
+
return getPiSpecialistDefaultTools(validatedRole(target, content));
|
|
662
567
|
}
|
|
663
|
-
|
|
664
|
-
} catch (error) {
|
|
665
|
-
return {
|
|
666
|
-
success: false,
|
|
667
|
-
changedRoles,
|
|
668
|
-
snapshot: nextSnapshot,
|
|
669
|
-
error: errorMessage(error)
|
|
670
|
-
};
|
|
671
|
-
}
|
|
568
|
+
};
|
|
672
569
|
}
|
|
673
570
|
|
|
674
571
|
// src/cli/pi-resources.ts
|
|
@@ -1006,9 +903,7 @@ export {
|
|
|
1006
903
|
resolvePiEffort,
|
|
1007
904
|
readPiModelConfig,
|
|
1008
905
|
savePiModelConfig,
|
|
1009
|
-
|
|
1010
|
-
readPiToolConfig,
|
|
1011
|
-
savePiToolConfig,
|
|
906
|
+
createPiToolsPanelAdapter,
|
|
1012
907
|
syncPiSpecialists,
|
|
1013
908
|
renderConfiguredRolePrompt,
|
|
1014
909
|
renderPiRootInstructions,
|
package/dist/cli/index.js
CHANGED
|
@@ -59,11 +59,11 @@ import {
|
|
|
59
59
|
normalizeEffortSelection,
|
|
60
60
|
recordHarnessInstallCompletion,
|
|
61
61
|
syncOpenCodeOwnedSkills
|
|
62
|
-
} from "../chunk-
|
|
62
|
+
} from "../chunk-7YCSKK2X.js";
|
|
63
63
|
import "../chunk-62L3ORXN.js";
|
|
64
64
|
import {
|
|
65
65
|
piAdapter
|
|
66
|
-
} from "../chunk-
|
|
66
|
+
} from "../chunk-U7FNFTM5.js";
|
|
67
67
|
import {
|
|
68
68
|
ALL_AGENT_NAMES,
|
|
69
69
|
detectCurrentConfig,
|
package/dist/cli/pi-install.d.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import { type PiExternalPackageEvidence, type PiExternalPackageSpec } from './pi-external-package';
|
|
1
2
|
import { type PiPackageReceipt, type PiPackageReceiptOptions } from './pi-package-receipt';
|
|
2
3
|
import { type PiPathOptions, type PiPaths } from './pi-paths';
|
|
3
4
|
export declare const PI_MINIMUM_VERSION = "0.99.0";
|
|
4
5
|
export declare const PI_NODE_MINIMUM = "22.19.0";
|
|
5
6
|
export declare const PI_COMMAND_TIMEOUT_MS = 120000;
|
|
7
|
+
export interface PiSetupPackageSpec extends PiExternalPackageSpec {
|
|
8
|
+
id: string;
|
|
9
|
+
preserveUserCopy?: boolean;
|
|
10
|
+
}
|
|
6
11
|
export declare const PI_PACKAGE_SPECS: readonly [{
|
|
7
12
|
readonly id: "delegation";
|
|
8
|
-
readonly source: "npm:@thoth-agents/pi-subagents@>=0.
|
|
13
|
+
readonly source: "npm:@thoth-agents/pi-subagents@>=0.3.0";
|
|
9
14
|
readonly packageName: "@thoth-agents/pi-subagents";
|
|
10
|
-
readonly version: "0.
|
|
15
|
+
readonly version: "0.3.0";
|
|
11
16
|
}, {
|
|
12
17
|
readonly id: "context7";
|
|
13
18
|
readonly source: "npm:@upstash/context7-pi@>=0.1.2";
|
|
@@ -25,14 +30,32 @@ export declare const PI_PACKAGE_SPECS: readonly [{
|
|
|
25
30
|
readonly version: "2.32.1";
|
|
26
31
|
}, {
|
|
27
32
|
readonly id: "ask-user-question";
|
|
28
|
-
readonly source: "npm:@thoth-agents/pi-questions-user@>=0.
|
|
33
|
+
readonly source: "npm:@thoth-agents/pi-questions-user@>=0.3.0";
|
|
29
34
|
readonly packageName: "@thoth-agents/pi-questions-user";
|
|
30
|
-
readonly version: "0.
|
|
35
|
+
readonly version: "0.3.0";
|
|
31
36
|
}, {
|
|
32
37
|
readonly id: "todo";
|
|
33
|
-
readonly source: "npm:@thoth-agents/pi-todo@>=0.
|
|
38
|
+
readonly source: "npm:@thoth-agents/pi-todo@>=0.3.0";
|
|
34
39
|
readonly packageName: "@thoth-agents/pi-todo";
|
|
35
|
-
readonly version: "0.
|
|
40
|
+
readonly version: "0.3.0";
|
|
41
|
+
}, {
|
|
42
|
+
readonly id: "theme";
|
|
43
|
+
readonly source: "npm:@thoth-agents/pi-thoth-theme@>=0.3.0";
|
|
44
|
+
readonly packageName: "@thoth-agents/pi-thoth-theme";
|
|
45
|
+
readonly version: "0.3.0";
|
|
46
|
+
readonly preserveUserCopy: true;
|
|
47
|
+
}, {
|
|
48
|
+
readonly id: "background-tasks";
|
|
49
|
+
readonly source: "npm:@thoth-agents/pi-background-tasks@>=0.3.0";
|
|
50
|
+
readonly packageName: "@thoth-agents/pi-background-tasks";
|
|
51
|
+
readonly version: "0.3.0";
|
|
52
|
+
readonly preserveUserCopy: true;
|
|
53
|
+
}, {
|
|
54
|
+
readonly id: "sidebar";
|
|
55
|
+
readonly source: "npm:@thoth-agents/pi-sidebar@>=0.3.0";
|
|
56
|
+
readonly packageName: "@thoth-agents/pi-sidebar";
|
|
57
|
+
readonly version: "0.3.0";
|
|
58
|
+
readonly preserveUserCopy: true;
|
|
36
59
|
}];
|
|
37
60
|
export declare const PI_GREP_MCP_ENTRY: {
|
|
38
61
|
readonly url: "https://mcp.grep.app";
|
|
@@ -114,68 +137,10 @@ export declare function verifyPiFirstPartyPackage(input: {
|
|
|
114
137
|
error: string;
|
|
115
138
|
};
|
|
116
139
|
export declare function isPiIncumbentDelegationSource(source: string): boolean;
|
|
117
|
-
export declare function getPiExternalPackageSpecs(options?: Pick<PiSetupOptions, 'runtimePackageRoot'>): readonly [
|
|
118
|
-
|
|
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
|
-
})[];
|
|
140
|
+
export declare function getPiExternalPackageSpecs(options?: Pick<PiSetupOptions, 'runtimePackageRoot'>): readonly PiSetupPackageSpec[];
|
|
141
|
+
export declare function inspectPiSetupPackage(packages: readonly PiConfiguredPackage[], spec: PiSetupPackageSpec, requireManagedSource?: boolean): PiExternalPackageEvidence;
|
|
178
142
|
export declare function piIncumbentTodoRecovery(source: string, scope: PiConfiguredPackage['scope'], identityLimitation?: string, unmappedSource?: boolean): string;
|
|
143
|
+
export declare function resolvePiPreservationPackages(output: string, options: PiSetupOptions): PiConfiguredPackage[];
|
|
179
144
|
export declare function mergePiSubagentsConfig(current: Record<string, unknown>): Record<string, unknown>;
|
|
180
145
|
export declare function mergePiGrepMcpConfig(current: Record<string, unknown>): Record<string, unknown>;
|
|
181
146
|
export declare function mergePiRootBlock(current: string, managedBlock: string): string;
|
|
@@ -190,6 +155,8 @@ export interface PiConfiguredPackage {
|
|
|
190
155
|
packageName?: string;
|
|
191
156
|
packageVersion?: string;
|
|
192
157
|
identityLimitation?: string;
|
|
158
|
+
/** Scoped settings explicitly disable extensions and select only resources. */
|
|
159
|
+
resourceOnly?: boolean;
|
|
193
160
|
/** Directory-only evidence; source is a display path, not a removal source. */
|
|
194
161
|
unmappedSource?: boolean;
|
|
195
162
|
}
|
|
@@ -30,3 +30,22 @@ export declare function validatePiSpecialistTools(tools: readonly string[]): voi
|
|
|
30
30
|
export declare function readPiSpecialistToolOverrides(content: string): PiSpecialistToolOverrides;
|
|
31
31
|
export declare function readPiToolConfig(piRoot: string, roles?: readonly PiSpecialistRole[]): PiToolConfigSnapshot;
|
|
32
32
|
export declare function savePiToolConfig(snapshot: PiToolConfigSnapshot, roles: readonly PiToolRoleInput[]): PiToolSaveResult;
|
|
33
|
+
/** Structural pi-subagents v1 adapter; root has no dependency on its runtime. */
|
|
34
|
+
export declare function createPiToolsPanelAdapter(piRoot: string): {
|
|
35
|
+
version: 1;
|
|
36
|
+
appliesTo(target: {
|
|
37
|
+
role: string;
|
|
38
|
+
filePath: string;
|
|
39
|
+
scope: "global" | "project";
|
|
40
|
+
}, content: string): boolean;
|
|
41
|
+
validate(target: {
|
|
42
|
+
role: string;
|
|
43
|
+
filePath: string;
|
|
44
|
+
scope: "global" | "project";
|
|
45
|
+
}, content: string): void;
|
|
46
|
+
defaultTools(target: {
|
|
47
|
+
role: string;
|
|
48
|
+
filePath: string;
|
|
49
|
+
scope: "global" | "project";
|
|
50
|
+
}, content: string): string[];
|
|
51
|
+
};
|
package/dist/cli/tui/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
defaultTuiOperations,
|
|
3
3
|
effortChoicesForModel,
|
|
4
4
|
listOperationHarnesses
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-7YCSKK2X.js";
|
|
6
6
|
import "../../chunk-62L3ORXN.js";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-U7FNFTM5.js";
|
|
8
8
|
import "../../chunk-OW6I7ZUU.js";
|
|
9
9
|
|
|
10
10
|
// src/cli/tui/index.tsx
|
package/dist/pi.d.ts
CHANGED
|
@@ -1,52 +1,23 @@
|
|
|
1
|
-
import { type OverlayOptions } from '@earendil-works/pi-tui';
|
|
2
|
-
import { readPiToolConfig, savePiToolConfig } from './cli/pi-tool-config';
|
|
3
|
-
import { type ToolsPanelKey } from './pi/tools-panel';
|
|
4
1
|
type PiHandler = (event: Record<string, unknown>, context?: {
|
|
5
|
-
isIdle(): boolean;
|
|
6
|
-
|
|
7
|
-
interface PiCommandContext {
|
|
8
|
-
mode: string;
|
|
9
|
-
ui: {
|
|
2
|
+
isIdle?(): boolean;
|
|
3
|
+
ui?: {
|
|
10
4
|
notify(message: string, type?: 'info' | 'warning' | 'error'): void;
|
|
11
|
-
custom<T>(factory: (tui: {
|
|
12
|
-
requestRender(): void;
|
|
13
|
-
terminal: {
|
|
14
|
-
rows: number;
|
|
15
|
-
};
|
|
16
|
-
}, theme: unknown, keybindings: unknown, done: (result: T) => void) => {
|
|
17
|
-
render(width: number): string[];
|
|
18
|
-
invalidate(): void;
|
|
19
|
-
handleInput(data: string): void;
|
|
20
|
-
}, options?: {
|
|
21
|
-
overlay?: boolean;
|
|
22
|
-
overlayOptions?: OverlayOptions;
|
|
23
|
-
}): Promise<T>;
|
|
24
5
|
};
|
|
25
|
-
}
|
|
26
|
-
interface PiNativeModules {
|
|
27
|
-
matchesKey(data: string, key: string): boolean;
|
|
28
|
-
truncateToWidth(text: string, width: number): string;
|
|
29
|
-
visibleWidth(text: string): number;
|
|
30
|
-
keys: Record<ToolsPanelKey, string>;
|
|
31
|
-
}
|
|
6
|
+
}) => unknown;
|
|
32
7
|
export interface PiExtensionApi {
|
|
33
8
|
on(event: 'input' | 'before_agent_start' | 'session_start', handler: PiHandler): void;
|
|
34
9
|
registerCommand?(name: string, command: {
|
|
35
10
|
description: string;
|
|
36
|
-
handler(args: string | undefined, context:
|
|
11
|
+
handler(args: string | undefined, context: unknown): unknown;
|
|
37
12
|
}): void;
|
|
38
|
-
|
|
13
|
+
getCommands?(): Array<{
|
|
39
14
|
name: string;
|
|
40
|
-
|
|
15
|
+
source?: string;
|
|
41
16
|
}>;
|
|
42
|
-
getActiveTools?(): string[];
|
|
43
17
|
}
|
|
44
18
|
export interface PiExtensionOptions {
|
|
45
19
|
packageRoot?: string;
|
|
46
20
|
piRoot?: string;
|
|
47
|
-
readToolConfig?: typeof readPiToolConfig;
|
|
48
|
-
saveToolConfig?: typeof savePiToolConfig;
|
|
49
|
-
loadNativeModules?: () => Promise<PiNativeModules>;
|
|
50
21
|
}
|
|
51
22
|
export declare function injectPiRoot(systemPrompt: string): string;
|
|
52
23
|
export default function thothAgentsPiExtension(pi: PiExtensionApi, options?: PiExtensionOptions): void;
|