@monotykamary/pi-supervisor 0.5.13 → 0.5.15
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monotykamary/pi-supervisor",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.15",
|
|
4
4
|
"description": "A pi extension that supervises the chat and steers it towards a defined outcome",
|
|
5
5
|
"author": "tintinweb (forked by monotykamary)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@commitlint/cli": "21.0.1",
|
|
42
42
|
"@commitlint/config-conventional": "21.0.1",
|
|
43
|
-
"@earendil-works/pi-tui": "0.84.
|
|
43
|
+
"@earendil-works/pi-tui": "0.84.2",
|
|
44
44
|
"@types/node": "25.9.1",
|
|
45
45
|
"knip": "6.14.1",
|
|
46
46
|
"lint-staged": "17.0.5",
|
package/src/compaction/brief.ts
CHANGED
|
@@ -489,12 +489,6 @@ export const sectionsToTranscript = (sections: BriefLine[]): TranscriptEntry[] =
|
|
|
489
489
|
return entries;
|
|
490
490
|
};
|
|
491
491
|
|
|
492
|
-
// ── convenience ──
|
|
493
|
-
|
|
494
|
-
/** Build and stringify the brief transcript in one call. */
|
|
495
|
-
export const compileBrief = (blocks: NormalizedBlock[]): string =>
|
|
496
|
-
stringifyBrief(buildBriefSections(blocks));
|
|
497
|
-
|
|
498
492
|
// ── turn identification (HCA zone) ──
|
|
499
493
|
|
|
500
494
|
const WRITE_TOOLS = new Set(['Edit', 'Write', 'edit', 'write', 'MultiEdit']);
|
|
@@ -664,9 +658,7 @@ const extractFragment = (text: string, markers: readonly string[]): string | nul
|
|
|
664
658
|
* O(n): indexOf + linear char scan per marker; no regex backtracking.
|
|
665
659
|
* Bounded: fragments are capped at CAUSAL_BREADCRUMB_MAX chars.
|
|
666
660
|
*/
|
|
667
|
-
|
|
668
|
-
text: string
|
|
669
|
-
): { cause: string | null; resolution: string | null } => {
|
|
661
|
+
const extractCausalChain = (text: string): { cause: string | null; resolution: string | null } => {
|
|
670
662
|
// Try full text first (markers can span sentence boundaries)
|
|
671
663
|
let cause = extractFragment(text, CAUSE_MARKERS);
|
|
672
664
|
let resolution = extractFragment(text, RESOLUTION_MARKERS);
|
|
@@ -47,15 +47,6 @@ const textParts = (content: Message['content']): string[] => {
|
|
|
47
47
|
|
|
48
48
|
export const textOf = (content: Message['content']): string => textParts(content).join('\n');
|
|
49
49
|
|
|
50
|
-
const thinkingParts = (content: Message['content']): string[] => {
|
|
51
|
-
if (!content) return [];
|
|
52
|
-
if (typeof content === 'string') return [];
|
|
53
|
-
return content.filter((part) => part.type === 'thinking').map((part) => part.thinking ?? '');
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const thinkingOf = (content: Message['content']): string =>
|
|
57
|
-
thinkingParts(content).join('\n');
|
|
58
|
-
|
|
59
50
|
/** Extract a snippet of ~`radius` chars around the first match of `term` in `text`. */
|
|
60
51
|
const snippet = (text: string, term: string, radius = 60): string | null => {
|
|
61
52
|
const idx = text.toLowerCase().indexOf(term.toLowerCase());
|
package/src/compaction/format.ts
CHANGED
|
@@ -32,13 +32,13 @@ const wrapLine = (line: string, maxChars: number): string[] => {
|
|
|
32
32
|
return wrapped;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
const wrapLongLines = (text: string, maxChars = TUI_SAFE_LINE_CHARS): string =>
|
|
36
36
|
text
|
|
37
37
|
.split('\n')
|
|
38
38
|
.flatMap((line) => wrapLine(line, maxChars))
|
|
39
39
|
.join('\n');
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
const capBrief = (text: string): string => {
|
|
42
42
|
const lines = text.split('\n');
|
|
43
43
|
if (lines.length <= BRIEF_MAX_LINES) return text;
|
|
44
44
|
const omitted = lines.length - BRIEF_MAX_LINES;
|
|
@@ -4,11 +4,3 @@ export const extractPath = (args: Record<string, unknown>): string | null => {
|
|
|
4
4
|
}
|
|
5
5
|
return null;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
export const summarizeToolArgs = (args: Record<string, unknown>): string => {
|
|
9
|
-
const path = extractPath(args);
|
|
10
|
-
if (path) return `path=${path}`;
|
|
11
|
-
if (typeof args.command === 'string') return `command=${args.command}`;
|
|
12
|
-
if (typeof args.query === 'string') return `query=${args.query}`;
|
|
13
|
-
return Object.keys(args).join(', ');
|
|
14
|
-
};
|
package/src/compaction/types.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import type { Message } from '@earendil-works/pi-ai';
|
|
2
2
|
|
|
3
|
-
export interface FileOps {
|
|
4
|
-
readFiles?: string[];
|
|
5
|
-
modifiedFiles?: string[];
|
|
6
|
-
createdFiles?: string[];
|
|
7
|
-
}
|
|
8
|
-
|
|
9
3
|
/** Pre-computed look-ahead index: maps tool_call index → nearest tool_result block. */
|
|
10
4
|
export interface ToolResultIndex {
|
|
11
5
|
get(callIndex: number): Extract<NormalizedBlock, { kind: 'tool_result' }> | null;
|