@xingular/harness 1.3.1-unstable.2 → 1.3.1-unstable.4
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/CHANGELOG.md +82 -0
- package/README.md +1 -1
- package/dist/cli.js +3680 -1947
- package/dist/sdk/cli.js +2 -0
- package/dist/sdk/commands/registry.d.ts +15 -0
- package/dist/sdk/commands/registry.js +2 -0
- package/dist/sdk/computer/screenshot.d.ts +32 -0
- package/dist/sdk/computer/screenshot.js +35 -0
- package/dist/sdk/context/attribution.d.ts +18 -0
- package/dist/sdk/context/attribution.js +295 -0
- package/dist/sdk/context/types.d.ts +94 -0
- package/dist/sdk/context/types.js +10 -0
- package/dist/sdk/index.d.ts +2 -1
- package/dist/sdk/index.js +2 -1
- package/dist/sdk/plugins/builtin.js +1 -0
- package/dist/sdk/prompt/compile.d.ts +42 -2
- package/dist/sdk/prompt/compile.js +87 -15
- package/dist/sdk/remote/addresses.d.ts +19 -0
- package/dist/sdk/remote/addresses.js +52 -0
- package/dist/sdk/remote/pairing.d.ts +59 -0
- package/dist/sdk/remote/pairing.js +160 -0
- package/dist/sdk/remote/seal.d.ts +28 -0
- package/dist/sdk/remote/seal.js +84 -0
- package/dist/sdk/remote/server.d.ts +28 -0
- package/dist/sdk/remote/server.js +158 -0
- package/dist/sdk/remote/service.d.ts +125 -0
- package/dist/sdk/remote/service.js +330 -0
- package/dist/sdk/remote/webClient.d.ts +4 -0
- package/dist/sdk/remote/webClient.js +444 -0
- package/dist/sdk/server/methods.js +3 -0
- package/dist/sdk/sessions/contracts.d.ts +4 -0
- package/dist/sdk/sessions/contracts.js +2 -0
- package/dist/sdk/sessions/planMode.d.ts +26 -1
- package/dist/sdk/sessions/planMode.js +48 -1
- package/dist/sdk/sessions/runner.d.ts +12 -0
- package/dist/sdk/sessions/runner.js +34 -2
- package/dist/sdk/sessions/sessions.js +1 -0
- package/dist/sdk/sessions/subagentService.d.ts +11 -1
- package/dist/sdk/sessions/subagentService.js +120 -38
- package/dist/sdk/sessions/subagents.d.ts +31 -0
- package/dist/sdk/sessions/subagents.js +45 -0
- package/dist/sdk/sessions/workSlice.d.ts +5 -9
- package/dist/sdk/sessions/workSlice.js +8 -149
- package/dist/sdk/terminal/client.d.ts +3 -1
- package/dist/sdk/terminal/client.js +15 -6
- package/dist/sdk/terminal/control.d.ts +1 -1
- package/dist/sdk/terminal/control.js +2 -2
- package/dist/sdk/terminal/controller.d.ts +22 -0
- package/dist/sdk/terminal/controller.js +104 -13
- package/dist/sdk/terminal/piExtension.js +106 -4
- package/dist/sdk/terminal/stallWatch.d.ts +13 -0
- package/dist/sdk/terminal/stallWatch.js +16 -0
- package/dist/sdk/terminal/standalone.d.ts +2 -0
- package/dist/sdk/terminal/standalone.js +9 -2
- package/dist/sdk/terminal/terminals.d.ts +14 -0
- package/dist/sdk/terminal/terminals.js +98 -2
- package/dist/sdk/terminal/tui/commandPages.d.ts +4 -1
- package/dist/sdk/terminal/tui/commandPages.js +12 -0
- package/dist/sdk/terminal/tui/commands.d.ts +3 -2
- package/dist/sdk/terminal/tui/commands.js +19 -5
- package/dist/sdk/terminal/tui/dialogs.d.ts +3 -2
- package/dist/sdk/terminal/tui/dialogs.js +4 -3
- package/dist/sdk/terminal/tui/keybindings.d.ts +1 -1
- package/dist/sdk/terminal/tui/keybindings.js +1 -1
- package/dist/sdk/terminal/tui/markdown.d.ts +16 -0
- package/dist/sdk/terminal/tui/markdown.js +55 -0
- package/dist/sdk/terminal/tui/modeChoices.d.ts +3 -2
- package/dist/sdk/terminal/tui/modeChoices.js +4 -4
- package/dist/sdk/terminal/tui/mouseReport.d.ts +30 -0
- package/dist/sdk/terminal/tui/mouseReport.js +80 -0
- package/dist/sdk/terminal/tui/pages/annotatePage.js +3 -2
- package/dist/sdk/terminal/tui/pages/browserPage.d.ts +1 -1
- package/dist/sdk/terminal/tui/pages/contextPage.d.ts +62 -0
- package/dist/sdk/terminal/tui/pages/contextPage.js +484 -0
- package/dist/sdk/terminal/tui/pages/remoteControlPage.d.ts +32 -0
- package/dist/sdk/terminal/tui/pages/remoteControlPage.js +170 -0
- package/dist/sdk/terminal/tui/pages/trajectoryPage.js +5 -4
- package/dist/sdk/terminal/tui/qr.d.ts +4 -0
- package/dist/sdk/terminal/tui/qr.js +35 -0
- package/dist/sdk/terminal/tui/runtime.js +8 -2
- package/dist/sdk/terminal/tui/search.js +3 -2
- package/dist/sdk/terminal/tui/sideQuestion.d.ts +1 -0
- package/dist/sdk/terminal/tui/sideQuestion.js +8 -3
- package/dist/sdk/terminal/tui/skillInvocation.d.ts +21 -2
- package/dist/sdk/terminal/tui/skillInvocation.js +31 -11
- package/dist/sdk/terminal/tui/status.d.ts +6 -0
- package/dist/sdk/terminal/tui/status.js +15 -1
- package/dist/sdk/terminal/tui/theme.d.ts +9 -0
- package/dist/sdk/terminal/tui/theme.js +9 -0
- package/dist/sdk/tools/defaultSkills.d.ts +19 -0
- package/dist/sdk/tools/defaultSkills.js +27 -1
- package/dist/sdk/tools/dispatch.js +8 -9
- package/dist/sdk/tools/spawnSubagent.d.ts +1 -1
- package/dist/sdk/tools/spawnSubagent.js +4 -2
- package/dist/terminal-opentui.js +1607 -492
- package/dist/terminal-pi.js +256 -144
- package/docs/README.md +1 -0
- package/docs/architecture/02-sessions-and-runs.md +55 -22
- package/docs/architecture/04-prompt.md +23 -4
- package/docs/architecture/07-tools-and-gate.md +4 -2
- package/docs/architecture/10-server-protocol.md +24 -0
- package/docs/architecture/11-terminal.md +52 -10
- package/docs/architecture/12-storage.md +5 -2
- package/docs/architecture/13-world-tools.md +17 -3
- package/docs/architecture/14-surfaces-and-parity.md +7 -3
- package/docs/architecture/15-remote-control.md +118 -0
- package/docs/architecture/README.md +3 -0
- package/docs/architecture/proposals/PROP-0049-context-attribution.md +409 -0
- package/docs/architecture/proposals/README.md +2 -1
- package/docs/decisions/ADR-0039-progress-aware-stall-guards.md +4 -0
- package/docs/decisions/ADR-0048-required-skills-from-a-message.md +42 -0
- package/docs/decisions/ADR-0050-approved-window-screenshots.md +19 -0
- package/docs/decisions/ADR-0051-terminal-decision-wait.md +10 -0
- package/docs/decisions/ADR-0052-per-profile-subagent-budgets.md +25 -0
- package/docs/decisions/ADR-0053-no-repeated-work-guard.md +45 -0
- package/docs/decisions/ADR-0054-terminal-reply-heartbeat-and-stall.md +52 -0
- package/docs/decisions/ADR-0055-plan-output-repair.md +51 -0
- package/docs/decisions/ADR-0056-remote-control.md +53 -0
- package/docs/decisions/ADR-0057-structured-plan-outcomes.md +39 -0
- package/docs/decisions/ADR-0058-ask-user-only-plan-clarification.md +36 -0
- package/docs/parity.md +14 -10
- package/docs/releases/1.3.1-unstable.3.md +54 -0
- package/docs/releases/1.3.1-unstable.4.md +56 -0
- package/docs/terminal-tui.md +43 -18
- package/package.json +3 -1
|
@@ -4,7 +4,7 @@ declare module '@earendil-works/pi-tui' {
|
|
|
4
4
|
interface Keybindings {
|
|
5
5
|
'app.thinking.increase': true;
|
|
6
6
|
'app.thinking.decrease': true;
|
|
7
|
-
'app.message.
|
|
7
|
+
'app.message.steer': true;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
export declare const HARNESS_KEYBINDINGS: KeybindingDefinitions;
|
|
@@ -11,7 +11,7 @@ const actions = {
|
|
|
11
11
|
'app.model.cycleForward': 'ctrl+p', 'app.model.cycleBackward': 'alt+p',
|
|
12
12
|
'app.model.select': 'ctrl+l', 'app.tools.expand': 'ctrl+o', 'app.thinking.toggle': 'ctrl+t',
|
|
13
13
|
'app.editor.external': 'ctrl+g', 'app.message.copy': 'ctrl+x',
|
|
14
|
-
'app.message.
|
|
14
|
+
'app.message.steer': ['super+enter', 'ctrl+enter', 'alt+enter'], 'app.message.dequeue': 'alt+up',
|
|
15
15
|
'app.clipboard.pasteImage': process.platform === 'darwin' ? ['ctrl+v', 'alt+v'] : 'ctrl+v',
|
|
16
16
|
'app.session.toggleNamedFilter': 'ctrl+n', 'app.session.togglePath': 'ctrl+p',
|
|
17
17
|
'app.session.toggleSort': 'ctrl+s', 'app.session.rename': 'ctrl+r',
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Theme } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
import { type MarkdownTheme } from '@earendil-works/pi-tui';
|
|
3
|
+
/** The Harness markdown colours, mapped onto the component's callbacks. */
|
|
4
|
+
export declare function markdownTheme(theme: Theme): MarkdownTheme;
|
|
5
|
+
/** Model output as markdown source: terminal control sequences never reach the renderer. */
|
|
6
|
+
export declare function markdownSource(text: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* One surface's Markdown component. It re-renders only when the streamed text, the width or the
|
|
9
|
+
* theme changes, and drops trailing blank rows so the caller frames the block itself.
|
|
10
|
+
*/
|
|
11
|
+
export declare class MarkdownBlock {
|
|
12
|
+
private component;
|
|
13
|
+
private theme;
|
|
14
|
+
private text;
|
|
15
|
+
lines(text: string, width: number, theme: Theme): string[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Markdown, stripTerminalSequences } from '@earendil-works/pi-tui';
|
|
2
|
+
/** The Harness markdown colours, mapped onto the component's callbacks. */
|
|
3
|
+
export function markdownTheme(theme) {
|
|
4
|
+
return {
|
|
5
|
+
heading: text => theme.fg('mdHeading', text),
|
|
6
|
+
link: text => theme.fg('mdLink', text),
|
|
7
|
+
linkUrl: text => theme.fg('mdLinkUrl', text),
|
|
8
|
+
code: text => theme.fg('mdCode', text),
|
|
9
|
+
codeBlock: text => theme.fg('mdCodeBlock', text),
|
|
10
|
+
codeBlockBorder: text => theme.fg('mdCodeBlockBorder', text),
|
|
11
|
+
quote: text => theme.fg('mdQuote', text),
|
|
12
|
+
quoteBorder: text => theme.fg('mdQuoteBorder', text),
|
|
13
|
+
hr: text => theme.fg('mdHr', text),
|
|
14
|
+
listBullet: text => theme.fg('mdListBullet', text),
|
|
15
|
+
bold: text => theme.bold(text),
|
|
16
|
+
italic: text => theme.italic(text),
|
|
17
|
+
underline: text => theme.underline(text),
|
|
18
|
+
strikethrough: text => theme.strikethrough(text),
|
|
19
|
+
// A block surface has no syntax highlighter; its code keeps the theme's code colour.
|
|
20
|
+
highlightCode: code => code.split('\n').map(line => theme.fg('mdCodeBlock', line))
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** Model output as markdown source: terminal control sequences never reach the renderer. */
|
|
24
|
+
export function markdownSource(text) {
|
|
25
|
+
return stripTerminalSequences(text)
|
|
26
|
+
.replace(/\r\n?/gu, '\n')
|
|
27
|
+
.replace(/[\x00-\x08\x0b-\x1f\x7f]/gu, ' ');
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* One surface's Markdown component. It re-renders only when the streamed text, the width or the
|
|
31
|
+
* theme changes, and drops trailing blank rows so the caller frames the block itself.
|
|
32
|
+
*/
|
|
33
|
+
export class MarkdownBlock {
|
|
34
|
+
component;
|
|
35
|
+
theme;
|
|
36
|
+
text = '';
|
|
37
|
+
lines(text, width, theme) {
|
|
38
|
+
if (width < 1 || !text.trim())
|
|
39
|
+
return [];
|
|
40
|
+
if (!this.component || this.theme !== theme) {
|
|
41
|
+
this.component = new Markdown('', 0, 0, markdownTheme(theme));
|
|
42
|
+
this.theme = theme;
|
|
43
|
+
this.text = '';
|
|
44
|
+
}
|
|
45
|
+
if (this.text !== text) {
|
|
46
|
+
this.component.setText(text);
|
|
47
|
+
this.text = text;
|
|
48
|
+
}
|
|
49
|
+
const lines = this.component.render(width);
|
|
50
|
+
let end = lines.length;
|
|
51
|
+
while (end > 0 && !stripTerminalSequences(lines[end - 1]).trim())
|
|
52
|
+
end -= 1;
|
|
53
|
+
return lines.slice(0, end);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -34,9 +34,10 @@ export declare class ModeChoices {
|
|
|
34
34
|
quietly<T>(action: () => T | Promise<T>): Promise<T>;
|
|
35
35
|
/**
|
|
36
36
|
* Applies a mode's saved model and effort to the session. A model the account cannot use is
|
|
37
|
-
* skipped, and Pi clamps an effort the model does not support.
|
|
37
|
+
* skipped, and Pi clamps an effort the model does not support. A mode with no effort of its own
|
|
38
|
+
* returns to `fallback`, so a level chosen in another mode does not stay with this one.
|
|
38
39
|
*/
|
|
39
|
-
apply(session: ChoiceSession, mode: ComposerMode, modelFor: (reference: string) => ChoiceModel | undefined): Promise<void>;
|
|
40
|
+
apply(session: ChoiceSession, mode: ComposerMode, modelFor: (reference: string) => ChoiceModel | undefined, fallback: AgentSession['thinkingLevel']): Promise<void>;
|
|
40
41
|
/** Records a selection the person made in `mode`. Skipped while the terminal is making its own change. */
|
|
41
42
|
record(mode: ComposerMode, patch: ChoicePatch): Promise<void>;
|
|
42
43
|
}
|
|
@@ -31,9 +31,10 @@ export class ModeChoices {
|
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Applies a mode's saved model and effort to the session. A model the account cannot use is
|
|
34
|
-
* skipped, and Pi clamps an effort the model does not support.
|
|
34
|
+
* skipped, and Pi clamps an effort the model does not support. A mode with no effort of its own
|
|
35
|
+
* returns to `fallback`, so a level chosen in another mode does not stay with this one.
|
|
35
36
|
*/
|
|
36
|
-
async apply(session, mode, modelFor) {
|
|
37
|
+
async apply(session, mode, modelFor, fallback) {
|
|
37
38
|
const choice = this.resolve(mode);
|
|
38
39
|
await this.quietly(async () => {
|
|
39
40
|
const model = choice.model ? modelFor(choice.model) : undefined;
|
|
@@ -45,8 +46,7 @@ export class ModeChoices {
|
|
|
45
46
|
// Not usable on this account (no key, or no longer offered): keep the session's model.
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
-
session.setThinkingLevel(choice.effort, { persist: false });
|
|
49
|
+
session.setThinkingLevel((choice.effort ?? fallback), { persist: false });
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
/** Records a selection the person made in `mode`. Skipped while the terminal is making its own change. */
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Input } from '@earendil-works/pi-tui';
|
|
2
|
+
/** A leaked report is echoed within one read; ten characters in this window is 50 characters a second. */
|
|
3
|
+
export declare const MOUSE_REPORT_TAIL_WINDOW_MS = 200;
|
|
4
|
+
export interface MouseReportMatch {
|
|
5
|
+
/** The whole report the keys spelled, without its `ESC[` prefix. */
|
|
6
|
+
report: string;
|
|
7
|
+
/** What a text field already held before the completing sequence. */
|
|
8
|
+
inserted: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Follows the printable characters of one report. A caller that receives the completing sequence
|
|
12
|
+
* before insertion removes `inserted`; a caller that receives it after insertion removes `report`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class MouseReportTail {
|
|
15
|
+
private text;
|
|
16
|
+
private startedAt;
|
|
17
|
+
push(sequence: string, nowMs?: number): MouseReportMatch | undefined;
|
|
18
|
+
reset(): void;
|
|
19
|
+
}
|
|
20
|
+
/** A single-line input that drops a leaked mouse report instead of keeping it as text. */
|
|
21
|
+
export declare class MouseSafeInput extends Input {
|
|
22
|
+
private readonly mouseTail;
|
|
23
|
+
handleInput(data: string): void;
|
|
24
|
+
setValue(value: string): void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Removes reports from text that is about to be printed. A bare `<\d;\d;\d>M` stays: once recorded it
|
|
28
|
+
* is content, and rewriting it would misreport what a run received.
|
|
29
|
+
*/
|
|
30
|
+
export declare function stripMouseReports(text: string): string;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// A mouse report that the input parser split across its timeout loses its `ESC[` prefix: the orphaned
|
|
2
|
+
// prefix is flushed as an unknown response and the rest is decoded as keystrokes. These helpers keep
|
|
3
|
+
// that tail out of text fields, without touching what a person types or pastes.
|
|
4
|
+
import { Input } from '@earendil-works/pi-tui';
|
|
5
|
+
/** A leaked report is echoed within one read; ten characters in this window is 50 characters a second. */
|
|
6
|
+
export const MOUSE_REPORT_TAIL_WINDOW_MS = 200;
|
|
7
|
+
const REPORT = /^<\d{1,3};\d{1,4};\d{1,4}[Mm]$/;
|
|
8
|
+
const PARTIAL = /^<\d{0,3}(;\d{0,4}){0,2}$/;
|
|
9
|
+
const WHOLE = /^(?:\x1b\[)?<\d{1,3};\d{1,4};\d{1,4}[Mm]$/;
|
|
10
|
+
const SGR_REPORT = /\x1b\[<\d+;\d+;\d+[Mm]|\\u001b\[<\d+;\d+;\d+[Mm]|\\x1b\[<\d+;\d+;\d+[Mm]/g;
|
|
11
|
+
const X10_REPORT = /\x1b\[M[\u0020-\u00ff]{3}/g;
|
|
12
|
+
/**
|
|
13
|
+
* Follows the printable characters of one report. A caller that receives the completing sequence
|
|
14
|
+
* before insertion removes `inserted`; a caller that receives it after insertion removes `report`.
|
|
15
|
+
*/
|
|
16
|
+
export class MouseReportTail {
|
|
17
|
+
text = '';
|
|
18
|
+
startedAt = 0;
|
|
19
|
+
push(sequence, nowMs = Date.now()) {
|
|
20
|
+
if (WHOLE.test(sequence)) {
|
|
21
|
+
this.reset();
|
|
22
|
+
return { report: sequence.replace(/^\x1b\[/, ''), inserted: '' };
|
|
23
|
+
}
|
|
24
|
+
if (sequence.length !== 1) {
|
|
25
|
+
this.reset();
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
if (sequence === '<') {
|
|
29
|
+
this.text = '<';
|
|
30
|
+
this.startedAt = nowMs;
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
if (!this.text)
|
|
34
|
+
return undefined;
|
|
35
|
+
if (nowMs - this.startedAt > MOUSE_REPORT_TAIL_WINDOW_MS) {
|
|
36
|
+
this.reset();
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
const next = this.text + sequence;
|
|
40
|
+
if (REPORT.test(next)) {
|
|
41
|
+
const inserted = this.text;
|
|
42
|
+
this.reset();
|
|
43
|
+
return { report: next, inserted };
|
|
44
|
+
}
|
|
45
|
+
if (!PARTIAL.test(next)) {
|
|
46
|
+
this.reset();
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
this.text = next;
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
reset() {
|
|
53
|
+
this.text = '';
|
|
54
|
+
this.startedAt = 0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** A single-line input that drops a leaked mouse report instead of keeping it as text. */
|
|
58
|
+
export class MouseSafeInput extends Input {
|
|
59
|
+
mouseTail = new MouseReportTail();
|
|
60
|
+
handleInput(data) {
|
|
61
|
+
super.handleInput(data);
|
|
62
|
+
const match = this.mouseTail.push(data);
|
|
63
|
+
if (!match)
|
|
64
|
+
return;
|
|
65
|
+
const value = this.getValue();
|
|
66
|
+
if (value.endsWith(match.report))
|
|
67
|
+
this.setValue(value.slice(0, -match.report.length));
|
|
68
|
+
}
|
|
69
|
+
setValue(value) {
|
|
70
|
+
this.mouseTail.reset();
|
|
71
|
+
super.setValue(value);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Removes reports from text that is about to be printed. A bare `<\d;\d;\d>M` stays: once recorded it
|
|
76
|
+
* is content, and rewriting it would misreport what a run received.
|
|
77
|
+
*/
|
|
78
|
+
export function stripMouseReports(text) {
|
|
79
|
+
return text.replace(SGR_REPORT, '').replace(X10_REPORT, '');
|
|
80
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { matchesKey, truncateToWidth, visibleWidth } from '@earendil-works/pi-tui';
|
|
2
|
+
import { MouseSafeInput } from "../mouseReport.js";
|
|
2
3
|
import { FilterList } from "../list.js";
|
|
3
4
|
import { normalizeAddress, normalizeDevTools } from "../annotateCommand.js";
|
|
4
5
|
import { describeSend, sendUnsent, unsent } from "../annotateSend.js";
|
|
@@ -185,7 +186,7 @@ export class AnnotatePage {
|
|
|
185
186
|
return 'Load the bridge script in the app (shown at the top), then reload the app.';
|
|
186
187
|
}
|
|
187
188
|
openField(kind) {
|
|
188
|
-
const input = new
|
|
189
|
+
const input = new MouseSafeInput({ prompt: '', placeholder: FIELDS[kind].placeholder, placeholderStyle: text => this.options.theme().fg('dim', text) });
|
|
189
190
|
this.field = { kind, input };
|
|
190
191
|
this.syncFocus();
|
|
191
192
|
this.options.changed();
|
|
@@ -52,7 +52,7 @@ export declare class BrowserPage implements TerminalPage {
|
|
|
52
52
|
get focused(): boolean;
|
|
53
53
|
set focused(value: boolean);
|
|
54
54
|
tabs(): {
|
|
55
|
-
id: "skills" | "tools" | "connections" | "plugins" | "variant" | "library" | "
|
|
55
|
+
id: "skills" | "tools" | "connections" | "plugins" | "variant" | "library" | "foundation" | "overview";
|
|
56
56
|
title: string;
|
|
57
57
|
}[];
|
|
58
58
|
activeTab(): string;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Theme } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
import type { ContextAttribution } from "../../../context/types.js";
|
|
3
|
+
import { type TabInfo } from "../chrome.js";
|
|
4
|
+
import type { TerminalPage } from "../page.js";
|
|
5
|
+
export type ContextTab = 'request' | 'growth';
|
|
6
|
+
export type ContextGrouping = 'owner' | 'kind';
|
|
7
|
+
interface ContextPageOptions {
|
|
8
|
+
theme(): Theme;
|
|
9
|
+
call(method: string, params?: Record<string, unknown>): Promise<unknown>;
|
|
10
|
+
changed(): void;
|
|
11
|
+
initialTab?: ContextTab;
|
|
12
|
+
/** Opens the variant editor for the row the person wants to shrink. */
|
|
13
|
+
openVariant?(): void;
|
|
14
|
+
/** Runs the session's compaction, after the page confirms what it would free. */
|
|
15
|
+
compact?(): Promise<void>;
|
|
16
|
+
confirm?(title: string, message: string): Promise<boolean>;
|
|
17
|
+
}
|
|
18
|
+
/** Cells for each value out of `total`, by largest remainder, so the runs always add up. */
|
|
19
|
+
export declare function allocateCells(values: readonly number[], total: number): number[];
|
|
20
|
+
/** The bar and its legend: one colour per kind of context, the track for free space, a marker at the reserve. */
|
|
21
|
+
export declare function contextBar(data: ContextAttribution, width: number, theme: Theme): {
|
|
22
|
+
bar: string;
|
|
23
|
+
legend: string[];
|
|
24
|
+
};
|
|
25
|
+
export declare class ContextPage implements TerminalPage {
|
|
26
|
+
private readonly options;
|
|
27
|
+
presentation: "fullscreen";
|
|
28
|
+
focused: boolean;
|
|
29
|
+
private tab;
|
|
30
|
+
private grouping;
|
|
31
|
+
private data;
|
|
32
|
+
private detail;
|
|
33
|
+
private selectedId;
|
|
34
|
+
private folded;
|
|
35
|
+
private offset;
|
|
36
|
+
private detailOffset;
|
|
37
|
+
private maxOffset;
|
|
38
|
+
private scrollRows;
|
|
39
|
+
private busy;
|
|
40
|
+
private reloadPending;
|
|
41
|
+
private error;
|
|
42
|
+
private disposed;
|
|
43
|
+
constructor(options: ContextPageOptions);
|
|
44
|
+
tabs(): readonly TabInfo[];
|
|
45
|
+
activeTab(): string;
|
|
46
|
+
selectTab(id: string): void;
|
|
47
|
+
hint(): string;
|
|
48
|
+
activate(): void;
|
|
49
|
+
dispose(): void;
|
|
50
|
+
private load;
|
|
51
|
+
handleInput(data: string): boolean;
|
|
52
|
+
private move;
|
|
53
|
+
private compact;
|
|
54
|
+
/** The rows in the order the page draws them, with the heading each one introduces. */
|
|
55
|
+
private entries;
|
|
56
|
+
render(width: number, rows: number): string[];
|
|
57
|
+
private requestBody;
|
|
58
|
+
private rowLine;
|
|
59
|
+
private growthBody;
|
|
60
|
+
private detailBody;
|
|
61
|
+
}
|
|
62
|
+
export {};
|