@timurproko/a1 0.2.6-dev.717 → 0.2.6-dev.734
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/bin/cli.js +13 -2
- package/bin/ui.js +13 -0
- package/dist/app/session-shell/clipboard-services.d.ts +19 -0
- package/dist/app/session-shell/clipboard-services.js +7 -0
- package/dist/app/session-shell/exit-notice.d.ts +9 -5
- package/dist/app/session-shell/exit-notice.js +5 -5
- package/dist/app/session-shell/index.d.ts +3 -1
- package/dist/app/session-shell/index.js +1 -0
- package/dist/app/session-shell/paste-preparation-client.d.ts +3 -0
- package/dist/app/session-shell/paste-preparation-client.js +5 -2
- package/dist/app/session-shell/path-chip-presentation.d.ts +10 -3
- package/dist/app/session-shell/path-chip-presentation.js +48 -6
- package/dist/app/session-shell/prompt-chips.js +30 -4
- package/dist/app/session-shell/prompt-suggestion-controller.d.ts +5 -4
- package/dist/app/session-shell/prompt-suggestion-controller.js +148 -58
- package/dist/app/session-shell/quit-outro.d.ts +3 -1
- package/dist/app/session-shell/quit-outro.js +23 -8
- package/dist/app/session-shell/response-copy-transport.d.ts +6 -1
- package/dist/app/session-shell/response-copy-transport.js +8 -2
- package/dist/app/session-shell/session-shell-root.d.ts +22 -11
- package/dist/app/session-shell/session-shell-root.js +19 -12
- package/dist/app/session-shell/session-shell.d.ts +19 -21
- package/dist/app/session-shell/session-shell.js +678 -840
- package/dist/app/session-shell/session-viewport-controller.js +33 -21
- package/dist/cli/dispatch.js +5 -3
- package/dist/cli/session-context.d.ts +5 -1
- package/dist/cli/session-context.js +25 -8
- package/dist/composition/owned-ui.d.ts +23 -2
- package/dist/composition/owned-ui.js +124 -33
- package/dist/composition/session-info-reference.d.ts +2 -2
- package/dist/composition/session-info-reference.js +2 -2
- package/dist/composition/settings-route-host.js +2 -1
- package/dist/contracts/agent-engine/capability-ports.d.ts +1 -85
- package/dist/contracts/agent-engine/capability-ports.js +1 -35
- package/dist/contracts/agent-engine/index.d.ts +1 -7
- package/dist/contracts/agent-engine/index.js +0 -4
- package/dist/contracts/owned-ui/index.d.ts +9 -3
- package/dist/contracts/owned-ui/index.js +2 -1
- package/dist/contracts/owned-ui/model.d.ts +10 -0
- package/dist/contracts/owned-ui/session-backend.d.ts +119 -0
- package/dist/contracts/owned-ui/session-presenters.d.ts +55 -0
- package/dist/contracts/owned-ui/session-presenters.js +1 -0
- package/dist/contracts/owned-ui/session-workflows.d.ts +342 -0
- package/dist/contracts/owned-ui/session-workflows.js +30 -0
- package/dist/contracts/owned-ui/suggestion-diagnostics.d.ts +5 -1
- package/dist/contracts/owned-ui/suggestion-diagnostics.js +3 -1
- package/dist/contracts/owned-ui/validation.js +7 -0
- package/dist/features/launch/index.d.ts +1 -1
- package/dist/features/launch/session-context.d.ts +17 -2
- package/dist/features/launch/session-context.js +9 -5
- package/dist/features/owned-ui/settings-app.js +56 -54
- package/dist/features/prompt-suggestions/diagnostics.js +4 -1
- package/dist/foundation/lifecycle/index.d.ts +2 -2
- package/dist/foundation/lifecycle/index.js +1 -1
- package/dist/foundation/lifecycle/session-repository-context.d.ts +19 -2
- package/dist/foundation/lifecycle/session-repository-context.js +434 -66
- package/dist/foundation/process-containment/index.d.ts +1 -0
- package/dist/foundation/process-containment/index.js +1 -0
- package/dist/foundation/process-containment/native-process-inspector.d.ts +3 -0
- package/dist/foundation/process-containment/native-process-inspector.js +21 -0
- package/dist/foundation/release/bootstrap.js +1 -2
- package/dist/foundation/release/progress-palette.generated.d.ts +2 -2
- package/dist/foundation/release/progress-palette.generated.js +2 -2
- package/dist/foundation/release/release-gc.js +1 -1
- package/dist/foundation/release/update.js +0 -4
- package/dist/foundation/startup/startup-descriptor.js +2 -2
- package/dist/foundation/storage/control-store.js +0 -12
- package/dist/integrations/pi/components/components.js +2 -18
- package/dist/integrations/pi/components/index.d.ts +4 -4
- package/dist/integrations/pi/components/index.js +2 -2
- package/dist/integrations/pi/components/modal-frame.js +3 -4
- package/dist/integrations/pi/components/models-dialog.js +6 -35
- package/dist/integrations/pi/components/prompt-input-port.d.ts +1 -0
- package/dist/integrations/pi/components/resources/builtin-themes.d.ts +2 -2
- package/dist/integrations/pi/components/resources/builtin-themes.js +2 -2
- package/dist/integrations/pi/components/share-operation-dialog.js +3 -3
- package/dist/integrations/pi/components/shell-editor-autocomplete.js +19 -16
- package/dist/integrations/pi/components/shell-extension-ui.d.ts +5 -3
- package/dist/integrations/pi/components/shell-extension-ui.js +26 -12
- package/dist/integrations/pi/components/shell-hotkey-sections.js +2 -2
- package/dist/integrations/pi/components/shell-presenters-info.js +10 -10
- package/dist/integrations/pi/components/shell-presenters-transcript.js +13 -13
- package/dist/integrations/pi/components/shell-selectors-dialogs.js +5 -6
- package/dist/integrations/pi/components/shell-shared-facade.d.ts +21 -1
- package/dist/integrations/pi/components/shell-shared-facade.js +19 -3
- package/dist/integrations/pi/components/skills-dialog.js +3 -3
- package/dist/integrations/pi/components/submitted-prompt-adapter.js +2 -3
- package/dist/integrations/pi/components/theme.d.ts +9 -0
- package/dist/integrations/pi/components/theme.js +30 -0
- package/dist/integrations/pi/components/tool-result-adapter.js +6 -1
- package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.js +1 -1
- package/dist/integrations/pi/components/upstream/assets/earendil-image.json +2 -2
- package/dist/integrations/pi/components/upstream/components/countdown-timer.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/earendil-announcement.js +1 -1
- package/dist/integrations/pi/components/upstream/components/extension-editor.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/extension-editor.js +6 -6
- package/dist/integrations/pi/components/upstream/components/extension-input.js +4 -4
- package/dist/integrations/pi/components/upstream/components/extension-selector.js +4 -4
- package/dist/integrations/pi/components/upstream/components/mermaid.js +1 -1
- package/dist/integrations/pi/components/upstream/components/owned-editor.d.ts +5 -5
- package/dist/integrations/pi/components/upstream/components/owned-editor.js +8 -5
- package/dist/integrations/pi/components/upstream/components/pi-logo.js +1 -1
- package/dist/integrations/pi/components/upstream/components/scoped-models-selector.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/scoped-models-selector.js +3 -3
- package/dist/integrations/pi/components/upstream/components/session-footer.js +1 -1
- package/dist/integrations/pi/components/upstream/components/session-selector-search.js +1 -1
- package/dist/integrations/pi/components/upstream/components/session-selector.js +9 -9
- package/dist/integrations/pi/components/upstream/components/skill-invocation-message.d.ts +3 -2
- package/dist/integrations/pi/components/upstream/components/skill-invocation-message.js +6 -3
- package/dist/integrations/pi/components/upstream/components/status-indicator.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/status-indicator.js +1 -1
- package/dist/integrations/pi/components/upstream/components/themed-text.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/themed-text.js +1 -1
- package/dist/integrations/pi/components/upstream/components/thinking-selector.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/thinking-selector.js +2 -2
- package/dist/integrations/pi/components/upstream/components/tool-execution.d.ts +4 -0
- package/dist/integrations/pi/components/upstream/components/tool-execution.js +11 -1
- package/dist/integrations/pi/components/upstream/components/tree-selector.d.ts +2 -2
- package/dist/integrations/pi/components/upstream/components/tree-selector.js +27 -18
- package/dist/integrations/pi/components/upstream/components/trust-selector.js +1 -1
- package/dist/integrations/pi/components/upstream/external-editor.js +1 -1
- package/dist/integrations/pi/components/upstream/history/editor-core.d.ts +4 -4
- package/dist/integrations/pi/components/upstream/history/editor-core.js +11 -7
- package/dist/integrations/pi/components/upstream/history/kill-ring.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/history/kill-ring.js +1 -1
- package/dist/integrations/pi/components/upstream/history/printable-key.js +1 -1
- package/dist/integrations/pi/components/upstream/history/text-helpers.js +1 -1
- package/dist/integrations/pi/components/upstream/history/undo-stack.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/history/undo-stack.js +1 -1
- package/dist/integrations/pi/components/upstream/history/word-navigation.js +1 -1
- package/dist/integrations/pi/components/upstream/model-search.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/program-status-reporter.d.ts +31 -0
- package/dist/integrations/pi/components/upstream/program-status-reporter.js +89 -0
- package/dist/integrations/pi/components/upstream/theme/theme-controller.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/theme/theme.d.ts +22 -1
- package/dist/integrations/pi/components/upstream/theme/theme.js +225 -10
- package/dist/integrations/pi/engine/adapter.d.ts +44 -24
- package/dist/integrations/pi/engine/adapter.js +130 -22
- package/dist/integrations/pi/engine/command-dispatch.d.ts +2 -5
- package/dist/integrations/pi/engine/extension-ui-binding.d.ts +2 -11
- package/dist/integrations/pi/engine/host-ports.d.ts +20 -0
- package/dist/integrations/pi/engine/host-ports.js +13 -0
- package/dist/integrations/pi/engine/host.d.ts +70 -0
- package/dist/integrations/pi/engine/host.js +147 -0
- package/dist/integrations/pi/engine/index.d.ts +8 -4
- package/dist/integrations/pi/engine/index.js +3 -1
- package/dist/integrations/pi/engine/pi-settings-metadata.json +1 -1
- package/dist/integrations/pi/engine/resource-catalog.d.ts +4 -23
- package/dist/integrations/pi/engine/resources/changelog.json +4 -4
- package/dist/integrations/pi/engine/runtime-integration.d.ts +8 -2
- package/dist/integrations/pi/engine/runtime-integration.js +12 -7
- package/dist/integrations/pi/engine/session-events.js +10 -2
- package/dist/integrations/pi/engine/session-integration.d.ts +3 -8
- package/dist/integrations/pi/engine/session-integration.js +0 -49
- package/dist/integrations/pi/engine/session-runtime.d.ts +18 -3
- package/dist/integrations/pi/engine/session-runtime.js +18 -7
- package/dist/integrations/pi/engine/settings-bridge.d.ts +2 -2
- package/dist/integrations/pi/engine/settings-bridge.js +0 -2
- package/dist/integrations/pi/engine/settings-port.d.ts +2 -0
- package/dist/integrations/pi/engine/settings-port.js +3 -5
- package/dist/integrations/pi/engine/transcript-projection.js +2 -1
- package/dist/integrations/pi/engine/workflows.d.ts +33 -260
- package/dist/integrations/pi/engine/workflows.js +6 -28
- package/dist/integrations/pi/session-presenters/index.d.ts +2 -0
- package/dist/integrations/pi/session-presenters/index.js +1 -0
- package/dist/integrations/pi/session-presenters/presenters.d.ts +16 -0
- package/dist/integrations/pi/session-presenters/presenters.js +341 -0
- package/dist/integrations/pi/startup-public.js +306 -290
- package/dist/integrations/pi/startup-public.manifest.json +289 -265
- package/dist/integrations/pi/tui-runtime/adapter.d.ts +2 -1
- package/dist/integrations/pi/tui-runtime/adapter.js +7 -2
- package/dist/integrations/pi/tui-runtime/contracts.d.ts +3 -1
- package/dist/integrations/pi/tui-runtime/damage-aware-terminal.d.ts +8 -1
- package/dist/integrations/pi/tui-runtime/damage-aware-terminal.js +67 -2
- package/dist/integrations/pi/tui-runtime/index.d.ts +1 -1
- package/dist/integrations/pi/tui-runtime/index.js +1 -1
- package/dist/native/darwin-arm64/manifest.json +1 -1
- package/dist/native/linux-x64/manifest.json +1 -1
- package/dist/native/win32-x64/manifest.json +2 -2
- package/dist/native/win32-x64/process-guardian.exe +0 -0
- package/dist/product-identity.d.ts +2 -2
- package/dist/product-identity.js +2 -2
- package/dist/product-identity.json +3 -1
- package/dist/runtime-payload-inventory.json +3092 -2878
- package/dist/ui/components/prompt-input.d.ts +2 -0
- package/dist/ui/components/prompt-input.js +5 -1
- package/dist/ui/components/text-selection.d.ts +1 -1
- package/dist/ui/components/text-selection.js +3 -1
- package/dist/ui/components/theme.d.ts +2 -0
- package/dist/ui/components/transcript-viewport.d.ts +6 -4
- package/dist/ui/components/transcript-viewport.js +94 -16
- package/dist/ui/components/value-menu.d.ts +2 -0
- package/dist/ui/components/value-menu.js +13 -8
- package/dist/ui/settings/declarations.d.ts +38 -14
- package/dist/ui/settings/declarations.js +35 -11
- package/dist/ui/settings/migrations.js +23 -0
- package/docs/architecture/boundaries.md +9 -1
- package/docs/architecture/project-structure.md +7 -5
- package/docs/architecture/prompt-suggestions.md +14 -10
- package/docs/local-worktree-cleanup.md +11 -5
- package/docs/openspec-archive-automation.md +6 -5
- package/package.json +3 -3
- package/dist/contracts/agent-engine/model.d.ts +0 -78
- package/dist/contracts/agent-engine/model.js +0 -1
- package/dist/contracts/agent-engine/ports.d.ts +0 -18
- package/dist/contracts/agent-engine/serialization.d.ts +0 -7
- package/dist/contracts/agent-engine/serialization.js +0 -58
- package/dist/contracts/agent-engine/validation.d.ts +0 -5
- package/dist/contracts/agent-engine/validation.js +0 -128
- package/dist/integrations/pi/components/upstream/theme/system-theme.d.ts +0 -61
- package/dist/integrations/pi/components/upstream/theme/system-theme.js +0 -709
- /package/dist/contracts/{agent-engine/ports.js → owned-ui/session-backend.js} +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provenance: @earendil-works/pi-coding-agent 1.1.0 (MIT), commit abe508e1b89912adde45528136c3221eb69acdd7,
|
|
3
|
+
* packages/coding-agent/src/modes/interactive/program-status-reporter.ts.
|
|
4
|
+
* Modifications: Remap Pi session events to A1's neutral run events, inject the terminal reporter, use
|
|
5
|
+
* A1's application identity, and clear dialog state when the owned session changes.
|
|
6
|
+
* Deviations: none.
|
|
7
|
+
*/
|
|
8
|
+
import type { ProgramStatus } from "@earendil-works/pi-tui";
|
|
9
|
+
import type { OwnedUiEvent } from "../../../../contracts/owned-ui/index.js";
|
|
10
|
+
export type ProgramStatusBlocked = {
|
|
11
|
+
readonly kind: NonNullable<ProgramStatus["kind"]>;
|
|
12
|
+
readonly message: string;
|
|
13
|
+
};
|
|
14
|
+
type ProgramStatusRunEvent = Extract<OwnedUiEvent, {
|
|
15
|
+
type: "agent-run-started" | "assistant-message-completed" | "agent-run-settled";
|
|
16
|
+
}>;
|
|
17
|
+
/** Reports A1's owned session lifecycle through Pi TUI's OSC 7501 terminal contract. */
|
|
18
|
+
export declare class ProgramStatusReporter {
|
|
19
|
+
#private;
|
|
20
|
+
constructor(reportStatus: (status: ProgramStatus) => void, getSessionName: () => string | undefined, app?: string);
|
|
21
|
+
handleEvent(event: ProgramStatusRunEvent): void;
|
|
22
|
+
/** Report `blocked` for a dialog until it is cleared with `undefined`. Reopening a source replaces it. */
|
|
23
|
+
setBlocked(source: string, status: ProgramStatusBlocked | undefined): void;
|
|
24
|
+
/** Preserve the first visible error line without exposing transcript or prompt content. */
|
|
25
|
+
setErrorMessage(message: string | undefined): void;
|
|
26
|
+
/** Forget the previous session's run and transient dialogs. */
|
|
27
|
+
reset(): void;
|
|
28
|
+
clear(): void;
|
|
29
|
+
report(): void;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
function firstLine(text) {
|
|
2
|
+
return text?.split(/\r?\n/, 1)[0]?.trim() || "Error";
|
|
3
|
+
}
|
|
4
|
+
/** Reports A1's owned session lifecycle through Pi TUI's OSC 7501 terminal contract. */
|
|
5
|
+
export class ProgramStatusReporter {
|
|
6
|
+
#reportStatus;
|
|
7
|
+
#getSessionName;
|
|
8
|
+
#app;
|
|
9
|
+
#runActive = false;
|
|
10
|
+
#runResult = { state: "done" };
|
|
11
|
+
#restingStatus = { state: "idle" };
|
|
12
|
+
#blocked = new Map();
|
|
13
|
+
#lastReport;
|
|
14
|
+
constructor(reportStatus, getSessionName, app = "a1") {
|
|
15
|
+
this.#reportStatus = reportStatus;
|
|
16
|
+
this.#getSessionName = getSessionName;
|
|
17
|
+
this.#app = app;
|
|
18
|
+
}
|
|
19
|
+
handleEvent(event) {
|
|
20
|
+
switch (event.type) {
|
|
21
|
+
case "agent-run-started":
|
|
22
|
+
this.#runActive = true;
|
|
23
|
+
this.#runResult = { state: "done" };
|
|
24
|
+
break;
|
|
25
|
+
case "assistant-message-completed":
|
|
26
|
+
this.#runResult = event.successful
|
|
27
|
+
? { state: "done" }
|
|
28
|
+
: this.#runResult.state === "error" ? this.#runResult : { state: "error" };
|
|
29
|
+
break;
|
|
30
|
+
case "agent-run-settled":
|
|
31
|
+
this.#runActive = false;
|
|
32
|
+
this.#restingStatus = event.aborted
|
|
33
|
+
? { state: "idle" }
|
|
34
|
+
: event.successful
|
|
35
|
+
? this.#runResult
|
|
36
|
+
: this.#runResult.state === "error" ? this.#runResult : { state: "error" };
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
this.report();
|
|
40
|
+
}
|
|
41
|
+
/** Report `blocked` for a dialog until it is cleared with `undefined`. Reopening a source replaces it. */
|
|
42
|
+
setBlocked(source, status) {
|
|
43
|
+
this.#blocked.delete(source);
|
|
44
|
+
if (status !== undefined)
|
|
45
|
+
this.#blocked.set(source, status);
|
|
46
|
+
this.report();
|
|
47
|
+
}
|
|
48
|
+
/** Preserve the first visible error line without exposing transcript or prompt content. */
|
|
49
|
+
setErrorMessage(message) {
|
|
50
|
+
const status = { state: "error", message: firstLine(message) };
|
|
51
|
+
if (this.#runActive)
|
|
52
|
+
this.#runResult = status;
|
|
53
|
+
else
|
|
54
|
+
this.#restingStatus = status;
|
|
55
|
+
this.report();
|
|
56
|
+
}
|
|
57
|
+
/** Forget the previous session's run and transient dialogs. */
|
|
58
|
+
reset() {
|
|
59
|
+
this.#runActive = false;
|
|
60
|
+
this.#runResult = { state: "done" };
|
|
61
|
+
this.#restingStatus = { state: "idle" };
|
|
62
|
+
this.#blocked.clear();
|
|
63
|
+
this.report();
|
|
64
|
+
}
|
|
65
|
+
clear() {
|
|
66
|
+
this.#emit({ state: "clear", app: this.#app });
|
|
67
|
+
}
|
|
68
|
+
report() {
|
|
69
|
+
this.#emit({ ...this.#currentStatus(), app: this.#app });
|
|
70
|
+
}
|
|
71
|
+
#emit(status) {
|
|
72
|
+
const key = JSON.stringify(status);
|
|
73
|
+
if (key === this.#lastReport)
|
|
74
|
+
return;
|
|
75
|
+
this.#lastReport = key;
|
|
76
|
+
this.#reportStatus(status);
|
|
77
|
+
}
|
|
78
|
+
#currentStatus() {
|
|
79
|
+
const blocked = [...this.#blocked.values()].at(-1);
|
|
80
|
+
if (blocked !== undefined)
|
|
81
|
+
return { state: "blocked", ...blocked };
|
|
82
|
+
const status = this.#runActive ? { state: "working" } : this.#restingStatus;
|
|
83
|
+
if (status.state === "working" || status.state === "done") {
|
|
84
|
+
const message = this.#getSessionName();
|
|
85
|
+
return { ...status, ...(message === undefined ? {} : { message }) };
|
|
86
|
+
}
|
|
87
|
+
return status;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Provenance: @earendil-works/pi-coding-agent 1.0
|
|
2
|
+
* Provenance: @earendil-works/pi-coding-agent 1.1.0 (MIT), commit abe508e1b89912adde45528136c3221eb69acdd7,
|
|
3
3
|
* packages/coding-agent/src/modes/interactive/theme/theme-controller.ts.
|
|
4
4
|
* Modifications: Source-synchronized controller port: renamed owner class, injected dependency-free
|
|
5
5
|
* settings/runtime ports, remapped private theme helpers to the public-backed A1 theme adapter, and
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Theme, type ThemeColor } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
export type { ThemeColor } from "@earendil-works/pi-coding-agent";
|
|
3
|
-
import { type RgbColor } from "@earendil-works/pi-tui";
|
|
3
|
+
import { type Color, type RgbColor } from "@earendil-works/pi-tui";
|
|
4
|
+
import type { OwnedUiBackgroundStyle, UiAccentColor } from "../../../../../contracts/owned-ui/index.js";
|
|
4
5
|
export declare const PINNED_PI_LAYOUT: Readonly<{
|
|
5
6
|
readonly editorPaddingX: 0;
|
|
6
7
|
readonly outputPad: 1;
|
|
@@ -35,9 +36,29 @@ export interface PiTerminalThemeDetector {
|
|
|
35
36
|
readonly timeoutMs: number;
|
|
36
37
|
}): Promise<PiTerminalTheme | undefined>;
|
|
37
38
|
}
|
|
39
|
+
export interface PiAccentProjection {
|
|
40
|
+
readonly accent: Color;
|
|
41
|
+
readonly border: Color;
|
|
42
|
+
readonly secondaryHeading: Color;
|
|
43
|
+
readonly selectedBg: Color;
|
|
44
|
+
readonly userMessageBg: Color;
|
|
45
|
+
}
|
|
46
|
+
/** Derive the complete semantic family from any primary accent, including future custom colors. */
|
|
47
|
+
export declare function derivePiAccentProjection(accent: Color, appearance: PiTerminalTheme): PiAccentProjection;
|
|
38
48
|
export declare function ensurePiTheme(): Theme;
|
|
39
49
|
export declare function piTheme(): Theme;
|
|
40
50
|
export declare function currentPiThemeName(): string;
|
|
51
|
+
export declare function currentPiAccentColor(): UiAccentColor;
|
|
52
|
+
/** Paints one menu swatch from a named A1 palette entry. */
|
|
53
|
+
export declare function renderPiAccentPreview(color: string, text: string): string | null;
|
|
54
|
+
/** Derives A1's fullscreen canvas without adding a token to Pi's theme grammar. */
|
|
55
|
+
export declare function derivePiCanvasBackground(style: OwnedUiBackgroundStyle, accent: Color): Color | null;
|
|
56
|
+
/** Resolves the selected canvas through the active accent and terminal color mode. */
|
|
57
|
+
export declare function piCanvasBackgroundAnsi(style: OwnedUiBackgroundStyle): string | null;
|
|
58
|
+
/** Keeps the complete comparison theme unmodified while bare A1 projects its semantic accent family. */
|
|
59
|
+
export declare function setPiPackageBorderProjectionEnabled(enabled: boolean): void;
|
|
60
|
+
/** Reprojects the active base theme; repeated changes never derive from an earlier projection. */
|
|
61
|
+
export declare function setPiAccentColor(color: UiAccentColor): void;
|
|
41
62
|
export declare function applyPiTheme(name: string, enableWatcher?: boolean, mode?: PiColorMode): PiThemeResult;
|
|
42
63
|
export declare function applyPiThemeInstance(theme: Theme): PiThemeResult;
|
|
43
64
|
export declare function onPiThemeChange(listener: () => void): () => void;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Provenance: @earendil-works/pi-coding-agent 1.0
|
|
2
|
+
* Provenance: @earendil-works/pi-coding-agent 1.1.0 (MIT), commit abe508e1b89912adde45528136c3221eb69acdd7,
|
|
3
3
|
* packages/coding-agent/src/modes/interactive/theme/theme.ts.
|
|
4
4
|
* Modifications: Source-synchronized theme port: retain pinned theme schema, variable/color
|
|
5
5
|
* resolution, built-in and custom loading, terminal detection, and layout defaults while constructing
|
|
6
|
-
* the public package-root Theme class
|
|
7
|
-
*
|
|
6
|
+
* the public package-root Theme class, projecting A1's optional semantic accent, and deriving its
|
|
7
|
+
* owned fullscreen canvas.
|
|
8
|
+
* Deviations: theme-public-api-boundary, theme-owned-watcher-boundary, semantic-accent-projection.
|
|
8
9
|
*/
|
|
9
10
|
import { existsSync, readFileSync, readdirSync, watch } from "node:fs";
|
|
10
11
|
import { join } from "node:path";
|
|
11
12
|
import { getAgentDir, initTheme, Theme, } from "../../../startup-public.js";
|
|
12
|
-
import { getCapabilities } from "@earendil-works/pi-tui";
|
|
13
|
+
import { backgroundAnsi, colorToOkhsl, foregroundAnsi, getCapabilities, okhslColor, } from "@earendil-works/pi-tui";
|
|
13
14
|
import { BUILTIN_THEME_RESOURCES, isBuiltinThemeName } from "../../resources/builtin-themes.js";
|
|
14
15
|
export const PINNED_PI_LAYOUT = Object.freeze({
|
|
15
16
|
editorPaddingX: 0,
|
|
@@ -31,12 +32,53 @@ const FOREGROUND_COLORS = [
|
|
|
31
32
|
const BACKGROUND_COLORS = [
|
|
32
33
|
"selectedBg", "searchMatchBg", "userMessageBg", "customMessageBg", "toolPendingBg", "toolSuccessBg", "toolErrorBg",
|
|
33
34
|
];
|
|
35
|
+
const ACCENT_PALETTE = Object.freeze({
|
|
36
|
+
purple: Object.freeze({
|
|
37
|
+
dark: Object.freeze({ kind: "rgb", r: 167, g: 152, b: 215 }),
|
|
38
|
+
light: Object.freeze({ kind: "rgb", r: 116, g: 89, b: 180 }),
|
|
39
|
+
}),
|
|
40
|
+
blue: Object.freeze({ dark: okhslColor(268, 0.80, 0.67), light: okhslColor(268, 0.90, 0.47) }),
|
|
41
|
+
cyan: Object.freeze({ dark: okhslColor(202, 0.58, 0.67), light: okhslColor(203, 0.73, 0.46) }),
|
|
42
|
+
green: Object.freeze({ dark: okhslColor(159, 0.59, 0.67), light: okhslColor(159, 0.75, 0.46) }),
|
|
43
|
+
orange: Object.freeze({ dark: okhslColor(48, 0.75, 0.67), light: okhslColor(48, 0.90, 0.47) }),
|
|
44
|
+
pink: Object.freeze({ dark: okhslColor(337, 0.72, 0.67), light: okhslColor(337, 0.75, 0.48) }),
|
|
45
|
+
});
|
|
46
|
+
function clamp(value, minimum, maximum) {
|
|
47
|
+
return Math.max(minimum, Math.min(maximum, value));
|
|
48
|
+
}
|
|
49
|
+
function wrapHue(hue) {
|
|
50
|
+
return ((hue % 360) + 360) % 360;
|
|
51
|
+
}
|
|
52
|
+
/** Derive the complete semantic family from any primary accent, including future custom colors. */
|
|
53
|
+
export function derivePiAccentProjection(accent, appearance) {
|
|
54
|
+
const { h, s, l } = colorToOkhsl(accent);
|
|
55
|
+
const warm = h < 90 || h >= 270;
|
|
56
|
+
const magenta = h >= 270 && h < 325;
|
|
57
|
+
const blue = h >= 210 && h < 270;
|
|
58
|
+
const borderHue = wrapHue(h + (warm ? -20 : 20));
|
|
59
|
+
const secondaryHue = wrapHue(h + (magenta ? 55 : blue ? -50 : warm ? 35 : -35));
|
|
60
|
+
const dark = appearance === "dark";
|
|
61
|
+
const selectedSaturation = clamp(s * (dark ? 0.25 : 0.16), dark ? 0.10 : 0.08, dark ? 0.16 : 0.11);
|
|
62
|
+
const selectedLightness = dark ? l * 0.37 : 1 - (1 - l) * 0.075;
|
|
63
|
+
return Object.freeze({
|
|
64
|
+
accent,
|
|
65
|
+
border: okhslColor(borderHue, clamp(s * 0.78, 0.30, 0.64), clamp(l - (dark ? 0.17 : 0.11), 0, 1)),
|
|
66
|
+
secondaryHeading: okhslColor(secondaryHue, clamp(s + 0.20, 0.62, 0.82), clamp(l + (dark ? 0.09 : -0.09), 0, 1)),
|
|
67
|
+
selectedBg: okhslColor(h, selectedSaturation, selectedLightness),
|
|
68
|
+
userMessageBg: okhslColor(h, selectedSaturation * 2 / 3, dark ? l * 0.34 : 1 - (1 - l) * 0.055),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
let activeBaseTheme;
|
|
34
72
|
let activeTheme;
|
|
35
73
|
let activeThemeName;
|
|
36
74
|
let activeThemeMode;
|
|
75
|
+
let activeAccentColor = "purple";
|
|
76
|
+
let packageBorderProjectionEnabled = true;
|
|
37
77
|
let themeWatcher;
|
|
38
78
|
let themeReloadTimer;
|
|
39
79
|
const themeChangeListeners = new Set();
|
|
80
|
+
const accentProjectionBases = new WeakMap();
|
|
81
|
+
const accentProjectionCache = new WeakMap();
|
|
40
82
|
export function ensurePiTheme() {
|
|
41
83
|
if (activeTheme)
|
|
42
84
|
return activeTheme;
|
|
@@ -51,13 +93,65 @@ export function currentPiThemeName() {
|
|
|
51
93
|
ensurePiTheme();
|
|
52
94
|
return activeThemeName;
|
|
53
95
|
}
|
|
96
|
+
export function currentPiAccentColor() {
|
|
97
|
+
return activeAccentColor;
|
|
98
|
+
}
|
|
99
|
+
/** Paints one menu swatch from a named A1 palette entry. */
|
|
100
|
+
export function renderPiAccentPreview(color, text) {
|
|
101
|
+
ensurePiTheme();
|
|
102
|
+
const base = activeBaseTheme;
|
|
103
|
+
if (!isAccentColor(color))
|
|
104
|
+
return null;
|
|
105
|
+
const accent = ACCENT_PALETTE[color][base.appearance];
|
|
106
|
+
return `${foregroundAnsi(accent, base.getColorMode())}${text}\u001b[39m`;
|
|
107
|
+
}
|
|
108
|
+
/** Derives A1's fullscreen canvas without adding a token to Pi's theme grammar. */
|
|
109
|
+
export function derivePiCanvasBackground(style, accent) {
|
|
110
|
+
if (style === "transparent")
|
|
111
|
+
return null;
|
|
112
|
+
if (style === "dark")
|
|
113
|
+
return okhslColor(229, 0.03, 0.12);
|
|
114
|
+
const { h } = colorToOkhsl(accent);
|
|
115
|
+
return okhslColor(h, 0.12, 0.12);
|
|
116
|
+
}
|
|
117
|
+
/** Resolves the selected canvas through the active accent and terminal color mode. */
|
|
118
|
+
export function piCanvasBackgroundAnsi(style) {
|
|
119
|
+
ensurePiTheme();
|
|
120
|
+
const base = activeBaseTheme;
|
|
121
|
+
const accent = ACCENT_PALETTE[activeAccentColor][base.appearance];
|
|
122
|
+
const background = derivePiCanvasBackground(style, accent);
|
|
123
|
+
return background === null ? null : backgroundAnsi(background, base.getColorMode());
|
|
124
|
+
}
|
|
125
|
+
/** Keeps the complete comparison theme unmodified while bare A1 projects its semantic accent family. */
|
|
126
|
+
export function setPiPackageBorderProjectionEnabled(enabled) {
|
|
127
|
+
if (packageBorderProjectionEnabled === enabled)
|
|
128
|
+
return;
|
|
129
|
+
packageBorderProjectionEnabled = enabled;
|
|
130
|
+
if (activeBaseTheme !== undefined)
|
|
131
|
+
activeTheme = resolvePiAccentTheme(activeBaseTheme);
|
|
132
|
+
syncPiPackageBorderProjection();
|
|
133
|
+
notifyThemeChanged();
|
|
134
|
+
}
|
|
135
|
+
/** Reprojects the active base theme; repeated changes never derive from an earlier projection. */
|
|
136
|
+
export function setPiAccentColor(color) {
|
|
137
|
+
if (activeAccentColor === color)
|
|
138
|
+
return;
|
|
139
|
+
activeAccentColor = color;
|
|
140
|
+
if (activeBaseTheme === undefined)
|
|
141
|
+
return;
|
|
142
|
+
activeTheme = resolvePiAccentTheme(activeBaseTheme);
|
|
143
|
+
syncPiPackageBorderProjection();
|
|
144
|
+
notifyThemeChanged();
|
|
145
|
+
}
|
|
54
146
|
export function applyPiTheme(name, enableWatcher = false, mode) {
|
|
55
147
|
try {
|
|
56
148
|
const loaded = loadPiTheme(name, mode);
|
|
57
149
|
initTheme(name, false);
|
|
58
|
-
|
|
150
|
+
activeBaseTheme = loaded;
|
|
151
|
+
activeTheme = resolvePiAccentTheme(loaded);
|
|
59
152
|
activeThemeName = name;
|
|
60
153
|
activeThemeMode = mode;
|
|
154
|
+
syncPiPackageBorderProjection();
|
|
61
155
|
if (enableWatcher)
|
|
62
156
|
startPiThemeWatcher(name);
|
|
63
157
|
notifyThemeChanged();
|
|
@@ -65,18 +159,23 @@ export function applyPiTheme(name, enableWatcher = false, mode) {
|
|
|
65
159
|
}
|
|
66
160
|
catch (error) {
|
|
67
161
|
initTheme("dark", false);
|
|
68
|
-
|
|
162
|
+
activeBaseTheme = loadPiTheme("dark", mode);
|
|
163
|
+
activeTheme = resolvePiAccentTheme(activeBaseTheme);
|
|
69
164
|
activeThemeName = "dark";
|
|
70
165
|
activeThemeMode = mode;
|
|
166
|
+
syncPiPackageBorderProjection();
|
|
71
167
|
notifyThemeChanged();
|
|
72
168
|
return { success: false, name: "dark", error: error instanceof Error ? error.message : String(error) };
|
|
73
169
|
}
|
|
74
170
|
}
|
|
75
171
|
export function applyPiThemeInstance(theme) {
|
|
76
172
|
stopPiThemeWatcher();
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
173
|
+
const base = accentProjectionBases.get(theme) ?? theme;
|
|
174
|
+
activeBaseTheme = base;
|
|
175
|
+
activeTheme = resolvePiAccentTheme(base);
|
|
176
|
+
activeThemeName = base.name ?? "<in-memory>";
|
|
177
|
+
activeThemeMode = base.getColorMode();
|
|
178
|
+
syncPiPackageBorderProjection();
|
|
80
179
|
notifyThemeChanged();
|
|
81
180
|
return { success: true, name: activeThemeName };
|
|
82
181
|
}
|
|
@@ -236,7 +335,9 @@ function startPiThemeWatcher(name) {
|
|
|
236
335
|
if (activeThemeName !== name || !existsSync(path))
|
|
237
336
|
return;
|
|
238
337
|
try {
|
|
239
|
-
|
|
338
|
+
activeBaseTheme = loadPiTheme(name, activeThemeMode);
|
|
339
|
+
activeTheme = resolvePiAccentTheme(activeBaseTheme);
|
|
340
|
+
syncPiPackageBorderProjection();
|
|
240
341
|
notifyThemeChanged();
|
|
241
342
|
}
|
|
242
343
|
catch { }
|
|
@@ -248,6 +349,120 @@ function notifyThemeChanged() {
|
|
|
248
349
|
for (const listener of themeChangeListeners)
|
|
249
350
|
listener();
|
|
250
351
|
}
|
|
352
|
+
function resolvePiAccentTheme(base) {
|
|
353
|
+
const rootBase = accentProjectionBases.get(base) ?? base;
|
|
354
|
+
return packageBorderProjectionEnabled ? projectPiAccent(rootBase, activeAccentColor) : rootBase;
|
|
355
|
+
}
|
|
356
|
+
function syncPiPackageBorderProjection() {
|
|
357
|
+
if (activeBaseTheme === undefined || activeTheme === undefined)
|
|
358
|
+
return;
|
|
359
|
+
if (!packageBorderProjectionEnabled) {
|
|
360
|
+
setPiPackageThemeInstance(activeBaseTheme);
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
const base = activeBaseTheme;
|
|
364
|
+
const projected = activeTheme;
|
|
365
|
+
setPiPackageThemeInstance(new Proxy(base, {
|
|
366
|
+
get(target, property) {
|
|
367
|
+
if (property === "colors")
|
|
368
|
+
return Object.freeze({ ...target.colors, border: projected.colors.border });
|
|
369
|
+
if (property === "fg") {
|
|
370
|
+
return (token, text) => token === "border"
|
|
371
|
+
? projected.fg(token, text)
|
|
372
|
+
: target.fg(token, text);
|
|
373
|
+
}
|
|
374
|
+
if (property === "getFgAnsi") {
|
|
375
|
+
return (token) => token === "border"
|
|
376
|
+
? projected.getFgAnsi(token)
|
|
377
|
+
: target.getFgAnsi(token);
|
|
378
|
+
}
|
|
379
|
+
if (property === "style") {
|
|
380
|
+
return (text, options) => target.style(text, {
|
|
381
|
+
...options,
|
|
382
|
+
...(options.fg === "border" ? { fg: projected.colors.border } : {}),
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
const value = Reflect.get(target, property, target);
|
|
386
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
387
|
+
},
|
|
388
|
+
}));
|
|
389
|
+
}
|
|
390
|
+
function setPiPackageThemeInstance(theme) {
|
|
391
|
+
Reflect.set(globalThis, Symbol.for("@earendil-works/pi-coding-agent:theme"), theme);
|
|
392
|
+
Reflect.set(globalThis, Symbol.for("@mariozechner/pi-coding-agent:theme"), theme);
|
|
393
|
+
}
|
|
394
|
+
function isAccentColor(value) {
|
|
395
|
+
return Object.hasOwn(ACCENT_PALETTE, value);
|
|
396
|
+
}
|
|
397
|
+
/** A transparent Theme projection keeps every role outside the selected accent family on the base. */
|
|
398
|
+
function projectPiAccent(base, color) {
|
|
399
|
+
const rootBase = accentProjectionBases.get(base) ?? base;
|
|
400
|
+
const cached = accentProjectionCache.get(rootBase)?.get(color);
|
|
401
|
+
if (cached !== undefined)
|
|
402
|
+
return cached;
|
|
403
|
+
const tone = derivePiAccentProjection(ACCENT_PALETTE[color][rootBase.appearance], rootBase.appearance);
|
|
404
|
+
const accentAnsi = foregroundAnsi(tone.accent, rootBase.getColorMode());
|
|
405
|
+
const foregrounds = Object.freeze({
|
|
406
|
+
accent: tone.accent,
|
|
407
|
+
border: tone.border,
|
|
408
|
+
mdHeading: tone.secondaryHeading,
|
|
409
|
+
mdListBullet: tone.secondaryHeading,
|
|
410
|
+
});
|
|
411
|
+
const foregroundSequences = Object.freeze({
|
|
412
|
+
accent: accentAnsi,
|
|
413
|
+
border: foregroundAnsi(tone.border, rootBase.getColorMode()),
|
|
414
|
+
mdHeading: foregroundAnsi(tone.secondaryHeading, rootBase.getColorMode()),
|
|
415
|
+
mdListBullet: foregroundAnsi(tone.secondaryHeading, rootBase.getColorMode()),
|
|
416
|
+
});
|
|
417
|
+
const backgrounds = Object.freeze({
|
|
418
|
+
selectedBg: tone.selectedBg,
|
|
419
|
+
userMessageBg: tone.userMessageBg,
|
|
420
|
+
});
|
|
421
|
+
const backgroundSequences = Object.freeze({
|
|
422
|
+
selectedBg: backgroundAnsi(tone.selectedBg, rootBase.getColorMode()),
|
|
423
|
+
userMessageBg: backgroundAnsi(tone.userMessageBg, rootBase.getColorMode()),
|
|
424
|
+
});
|
|
425
|
+
const projection = new Proxy(rootBase, {
|
|
426
|
+
get(target, property) {
|
|
427
|
+
if (property === "colors")
|
|
428
|
+
return Object.freeze({
|
|
429
|
+
...target.colors,
|
|
430
|
+
...foregrounds,
|
|
431
|
+
...backgrounds,
|
|
432
|
+
});
|
|
433
|
+
if (property === "fg") {
|
|
434
|
+
return (token, text) => foregroundSequences[token] === undefined
|
|
435
|
+
? target.fg(token, text)
|
|
436
|
+
: `${foregroundSequences[token]}${text}\u001b[39m`;
|
|
437
|
+
}
|
|
438
|
+
if (property === "bg") {
|
|
439
|
+
return (token, text) => backgroundSequences[token] === undefined
|
|
440
|
+
? target.bg(token, text)
|
|
441
|
+
: `${backgroundSequences[token]}${text}\u001b[49m`;
|
|
442
|
+
}
|
|
443
|
+
if (property === "getFgAnsi") {
|
|
444
|
+
return (token) => foregroundSequences[token] ?? target.getFgAnsi(token);
|
|
445
|
+
}
|
|
446
|
+
if (property === "getBgAnsi") {
|
|
447
|
+
return (token) => backgroundSequences[token] ?? target.getBgAnsi(token);
|
|
448
|
+
}
|
|
449
|
+
if (property === "style") {
|
|
450
|
+
return (text, options) => target.style(text, {
|
|
451
|
+
...options,
|
|
452
|
+
...(typeof options.fg === "string" && foregrounds[options.fg] !== undefined ? { fg: foregrounds[options.fg] } : {}),
|
|
453
|
+
...(typeof options.bg === "string" && backgrounds[options.bg] !== undefined ? { bg: backgrounds[options.bg] } : {}),
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
const value = Reflect.get(target, property, target);
|
|
457
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
458
|
+
},
|
|
459
|
+
});
|
|
460
|
+
accentProjectionBases.set(projection, rootBase);
|
|
461
|
+
const projections = accentProjectionCache.get(rootBase) ?? new Map();
|
|
462
|
+
projections.set(color, projection);
|
|
463
|
+
accentProjectionCache.set(rootBase, projections);
|
|
464
|
+
return projection;
|
|
465
|
+
}
|
|
251
466
|
function customThemePath(name) {
|
|
252
467
|
return join(getAgentDir(), "themes", `${name}.json`);
|
|
253
468
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AgentSession } from "../startup-public.js";
|
|
2
|
-
import { type OwnedUiCommand, type OwnedUiImageAttachment, type OwnedUiPromptSuggestionGeneratorPort, type OwnedUiPromptSuggestionReasoning, type OwnedUiPromptSuggestionRequest, type OwnedUiPromptSuggestionResult, type OwnedUiEvent, type OwnedUiSessionViewModel, type OwnedUiSnapshot } from "../../../contracts/owned-ui/index.js";
|
|
2
|
+
import { type OwnedUiCommand, type OwnedUiExtensionPort, type OwnedUiExtensionUiPort, type OwnedUiImageAttachment, type OwnedUiPromptSuggestionGeneratorPort, type OwnedUiPromptSuggestionReasoning, type OwnedUiPromptSuggestionRequest, type OwnedUiPromptSuggestionResult, type OwnedUiEvent, type OwnedUiReleaseUpdate, type OwnedUiSessionBackend, type OwnedUiSessionCatalogPort, type OwnedUiSessionIdentityPort, type OwnedUiSessionPort, type OwnedUiSessionSettingsPort, type OwnedUiSessionViewModel, type OwnedUiSnapshot, type OwnedUiWorkflowPort } from "../../../contracts/owned-ui/index.js";
|
|
3
3
|
import type { PiAuthenticationProviderOption, PiBashWorkflowResult, PiModelsContext, PiModelsRefreshResult, PiPinnedSettingsCallback, PiPinnedSettingsSnapshot, PiProjectTrustContext, PiProjectTrustUpdate, PiScopedModelsContext, PiScopedModelsRefreshResult, PiSessionResumeMetadata, PiSessionSelectorContext, PiTreeSelectorContext, PiWorkflowAutocompleteCommand, PiWorkflowHost, PiWorkflowInteractionHost, PiWorkflowOption, PiWorkflowRequest, PiWorkflowResult } from "./workflows.js";
|
|
4
4
|
import type { PiSettingsBridge } from "./settings-bridge.js";
|
|
5
5
|
import type { PiSettingOwnerHandlers } from "./settings-bridge.js";
|
|
@@ -10,11 +10,29 @@ import { type AdapterCommandResult } from "./command-dispatch.js";
|
|
|
10
10
|
import { type OwnedPiVisualExtensionSupport } from "./extension-ui-binding.js";
|
|
11
11
|
import { type OwnedPiExtensionResourceSummary, type OwnedPiResourceSummary } from "./resource-catalog.js";
|
|
12
12
|
import { type PiEnginePackageUpdateProbe, type PiEngineRuntimeFactory, type PiRepositoryContextReader } from "./session-runtime.js";
|
|
13
|
+
import { type PiEngineHostSessionPorts } from "./host-ports.js";
|
|
13
14
|
import { PiWorkflowContexts } from "./workflow-contexts.js";
|
|
14
15
|
export type { OwnedPiExtensionResourceSummary, OwnedPiExtensionSourceSummary, OwnedPiResourceSummary } from "./resource-catalog.js";
|
|
15
16
|
export type { PiEngineRuntimeFactory, PiEngineRuntimeFactoryInput } from "./session-runtime.js";
|
|
16
17
|
export type { AdapterCommandResult } from "./command-dispatch.js";
|
|
17
18
|
export type { OwnedPiVisualExtensionSupport } from "./extension-ui-binding.js";
|
|
19
|
+
/**
|
|
20
|
+
* The Pi objects pinned selectors and transcript renderers are built from. They are not part of the
|
|
21
|
+
* session backend contract; only the session presenters owner reads them.
|
|
22
|
+
*/
|
|
23
|
+
export interface PiSessionPresentationSource {
|
|
24
|
+
pinnedModelSelectorContext(): ReturnType<PiWorkflowContexts["pinnedModelSelectorContext"]>;
|
|
25
|
+
pinnedSessionSelectorContext(): PiSessionSelectorContext;
|
|
26
|
+
pinnedTreeSelectorContext(): PiTreeSelectorContext;
|
|
27
|
+
pinnedMessageRenderer(customType: string): unknown;
|
|
28
|
+
pinnedToolRenderers(toolName: string): unknown;
|
|
29
|
+
pinnedShortcutDescriptions(bindings: Parameters<AgentSession["extensionRunner"]["getShortcuts"]>[0]): readonly {
|
|
30
|
+
readonly key: string;
|
|
31
|
+
readonly description: string;
|
|
32
|
+
}[];
|
|
33
|
+
pinnedSettingsModels(): Pick<PiPinnedSettingsSnapshot, "currentModel" | "availableDefaultModels">;
|
|
34
|
+
applyPinnedSettingValue(callback: PiPinnedSettingsCallback, value: unknown): Promise<PiWorkflowResult>;
|
|
35
|
+
}
|
|
18
36
|
/** Explicit flush failure when required delivery was interrupted rather than completed. */
|
|
19
37
|
export declare class EngineDeliveryError extends Error {
|
|
20
38
|
constructor();
|
|
@@ -22,7 +40,13 @@ export declare class EngineDeliveryError extends Error {
|
|
|
22
40
|
export interface PiEngineAdapterOptions {
|
|
23
41
|
readonly cwd?: string;
|
|
24
42
|
readonly agentDir?: string;
|
|
25
|
-
|
|
43
|
+
/** Unique within the process; the engine host assigns one when the caller has none. */
|
|
44
|
+
readonly sessionId: string;
|
|
45
|
+
/**
|
|
46
|
+
* The process-level host this session belongs to. Absent only for adapters built directly in
|
|
47
|
+
* tests and tools: then no process dispatcher is installed and nothing is announced.
|
|
48
|
+
*/
|
|
49
|
+
readonly engineHost?: PiEngineHostSessionPorts;
|
|
26
50
|
readonly sessionPath?: string;
|
|
27
51
|
readonly sessionSelection?: PiSessionSelection;
|
|
28
52
|
readonly sessionForkPrompt?: PiSessionForkPrompt;
|
|
@@ -41,14 +65,20 @@ export interface PiEngineAdapterOptions {
|
|
|
41
65
|
* mode. Returns display names of packages with updates available.
|
|
42
66
|
*/
|
|
43
67
|
readonly checkPackageUpdates?: PiEnginePackageUpdateProbe;
|
|
44
|
-
/** Comparison profiles preserve Pi's startup changelog; bare A1 owns release-note startup. */
|
|
45
|
-
readonly announceStartupChangelog?: boolean;
|
|
46
68
|
readonly repositoryContextReader?: PiRepositoryContextReader;
|
|
47
69
|
}
|
|
48
|
-
/** Owns the pinned Pi session lifecycle and
|
|
49
|
-
export declare class PiEngineAdapter implements OwnedUiPromptSuggestionGeneratorPort {
|
|
70
|
+
/** Owns the pinned Pi session lifecycle and serves it to the owned shell as the neutral session backend. */
|
|
71
|
+
export declare class PiEngineAdapter implements OwnedUiSessionBackend, OwnedUiPromptSuggestionGeneratorPort {
|
|
50
72
|
#private;
|
|
51
|
-
constructor(options
|
|
73
|
+
constructor(options: PiEngineAdapterOptions);
|
|
74
|
+
get identity(): OwnedUiSessionIdentityPort;
|
|
75
|
+
get session(): OwnedUiSessionPort;
|
|
76
|
+
get workflows(): OwnedUiWorkflowPort;
|
|
77
|
+
get settings(): OwnedUiSessionSettingsPort;
|
|
78
|
+
get catalog(): OwnedUiSessionCatalogPort;
|
|
79
|
+
get extensions(): OwnedUiExtensionPort;
|
|
80
|
+
/** The Pi objects behind pinned selectors and renderers, for the session presenters owner only. */
|
|
81
|
+
presentationSource(): PiSessionPresentationSource;
|
|
52
82
|
setWorkflowInteractionHost(interaction: PiWorkflowInteractionHost): void;
|
|
53
83
|
get sessionId(): string;
|
|
54
84
|
get sessionGeneration(): number;
|
|
@@ -65,14 +95,14 @@ export declare class PiEngineAdapter implements OwnedUiPromptSuggestionGenerator
|
|
|
65
95
|
* pinned Pi's `Update Available` notice; it arrives whenever the check resolves, so a late
|
|
66
96
|
* result is appended to the transcript like Pi's own fire-and-forget version check.
|
|
67
97
|
*/
|
|
68
|
-
announceReleaseUpdate(release:
|
|
69
|
-
readonly version: string;
|
|
70
|
-
readonly command: string;
|
|
71
|
-
readonly changelogUrl: string | null;
|
|
72
|
-
}): void;
|
|
98
|
+
announceReleaseUpdate(release: OwnedUiReleaseUpdate): void;
|
|
73
99
|
suggestionReasoningPolicy(): OwnedUiPromptSuggestionReasoning;
|
|
74
100
|
generate(request: OwnedUiPromptSuggestionRequest): Promise<OwnedUiPromptSuggestionResult>;
|
|
75
101
|
start(): Promise<OwnedUiSessionViewModel>;
|
|
102
|
+
/** Announce pinned Pi's changelog since the profile's last seen version; the host calls this once per process. */
|
|
103
|
+
announceStartupChangelog(): Promise<void>;
|
|
104
|
+
/** Probe extension packages for updates and announce them; the host calls this once per process. */
|
|
105
|
+
announcePackageUpdates(): Promise<void>;
|
|
76
106
|
onEvent(listener: (event: OwnedUiEvent) => void): () => void;
|
|
77
107
|
/** Developer-only pressure evidence; never mirrored into visible diagnostic/status arrays. */
|
|
78
108
|
deliveryDiagnostics(): {
|
|
@@ -93,13 +123,11 @@ export declare class PiEngineAdapter implements OwnedUiPromptSuggestionGenerator
|
|
|
93
123
|
extensionResources(): readonly OwnedPiExtensionResourceSummary[];
|
|
94
124
|
workflowAutocompleteCommands(): readonly PiWorkflowAutocompleteCommand[];
|
|
95
125
|
visualExtensionSupport(): OwnedPiVisualExtensionSupport;
|
|
96
|
-
bindExtensionUi(ui:
|
|
126
|
+
bindExtensionUi(ui: OwnedUiExtensionUiPort, shutdown?: () => void | Promise<void>): Promise<void>;
|
|
97
127
|
unbindExtensionUi(): Promise<void>;
|
|
98
128
|
cycleModelWorkflow(direction: "forward" | "backward"): Promise<PiWorkflowResult>;
|
|
99
|
-
pinnedModelSelectorContext(): ReturnType<PiWorkflowContexts["pinnedModelSelectorContext"]>;
|
|
100
129
|
pinnedProjectTrustContext(): PiProjectTrustContext;
|
|
101
130
|
persistProjectTrust(updates: readonly PiProjectTrustUpdate[]): void;
|
|
102
|
-
pinnedSessionSelectorContext(): PiSessionSelectorContext;
|
|
103
131
|
pinnedScopedModelsContext(): PiScopedModelsContext;
|
|
104
132
|
updateScopedModels(enabledModelIds: readonly string[] | null): void;
|
|
105
133
|
persistScopedModels(enabledModelIds: readonly string[] | null): void;
|
|
@@ -116,7 +144,6 @@ export declare class PiEngineAdapter implements OwnedUiPromptSuggestionGenerator
|
|
|
116
144
|
pinnedAmbientAuthentication(selection: string): ReturnType<PiWorkflowContexts["pinnedAmbientAuthentication"]>;
|
|
117
145
|
pinnedLogoutOptions(): Promise<readonly PiAuthenticationProviderOption[]>;
|
|
118
146
|
pinnedForkOptions(): readonly PiWorkflowOption[];
|
|
119
|
-
pinnedTreeSelectorContext(): PiTreeSelectorContext;
|
|
120
147
|
/** Bind the owned UI's clipboard lifecycle without changing the comparison host. True means acknowledged delivery. */
|
|
121
148
|
bindClipboardWriter(writer: (text: string) => Promise<boolean>): () => void;
|
|
122
149
|
/** Workflow and tree copying share the active owner's write fence and delivery acknowledgment. */
|
|
@@ -138,17 +165,10 @@ export declare class PiEngineAdapter implements OwnedUiPromptSuggestionGenerator
|
|
|
138
165
|
get settingsProductMode(): "bare" | "comparison";
|
|
139
166
|
bindSettingsOwner(owner: AgentSettingOwner, handlers: PiSettingOwnerHandlers): () => void;
|
|
140
167
|
pinnedSettingsSnapshot(): PiPinnedSettingsSnapshot;
|
|
141
|
-
applyPinnedSettingValue(callback: PiPinnedSettingsCallback, value: unknown): Promise<PiWorkflowResult>;
|
|
142
|
-
pinnedMessageRenderer(customType: string): unknown;
|
|
143
|
-
pinnedShortcutDescriptions(bindings: Parameters<AgentSession["extensionRunner"]["getShortcuts"]>[0]): readonly {
|
|
144
|
-
readonly key: string;
|
|
145
|
-
readonly description: string;
|
|
146
|
-
}[];
|
|
147
|
-
pinnedToolRenderers(toolName: string): unknown;
|
|
148
168
|
clearQueuedWorkflows(): readonly string[];
|
|
149
169
|
view(): OwnedUiSessionViewModel;
|
|
150
170
|
snapshot(): OwnedUiSnapshot;
|
|
151
171
|
execute(command: OwnedUiCommand): Promise<AdapterCommandResult>;
|
|
152
172
|
dispose(): Promise<void>;
|
|
153
173
|
}
|
|
154
|
-
export declare function createPiEngineAdapter(options
|
|
174
|
+
export declare function createPiEngineAdapter(options: PiEngineAdapterOptions): Promise<PiEngineAdapter>;
|