@oh-my-pi/pi-coding-agent 17.2.11 → 17.2.12

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.
Files changed (152) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/{CHANGELOG-d9xenpn9.md → CHANGELOG-k9ghy5sn.md} +13 -0
  3. package/dist/cli.js +10795 -10791
  4. package/dist/types/advisor/runtime.d.ts +1 -1
  5. package/dist/types/config/custom-models.d.ts +31 -0
  6. package/dist/types/config/model-config-values.d.ts +19 -0
  7. package/dist/types/config/model-patch.d.ts +93 -0
  8. package/dist/types/config/model-provider-discovery.d.ts +51 -0
  9. package/dist/types/config/model-registry.d.ts +5 -52
  10. package/dist/types/config/settings.d.ts +5 -3
  11. package/dist/types/debug/raw-sse-buffer.d.ts +9 -0
  12. package/dist/types/discovery/agent-plugin-format.d.ts +6 -13
  13. package/dist/types/discovery/contained-path.d.ts +2 -3
  14. package/dist/types/eval/executor-base.d.ts +8 -2
  15. package/dist/types/eval/kernel-session-registry.d.ts +60 -0
  16. package/dist/types/export/share.d.ts +1 -1
  17. package/dist/types/lsp/diagnostics.d.ts +96 -0
  18. package/dist/types/lsp/index.d.ts +7 -128
  19. package/dist/types/lsp/servers.d.ts +72 -0
  20. package/dist/types/lsp/tool.d.ts +42 -0
  21. package/dist/types/lsp/workspace-diagnostics.d.ts +12 -0
  22. package/dist/types/lsp/writethrough.d.ts +33 -0
  23. package/dist/types/mcp/transports/header-policy.d.ts +2 -1
  24. package/dist/types/modes/components/agent-hub-projection.d.ts +2 -7
  25. package/dist/types/modes/components/agent-hub-renderer.d.ts +0 -7
  26. package/dist/types/modes/theme/color.d.ts +19 -0
  27. package/dist/types/modes/theme/loader.d.ts +19 -0
  28. package/dist/types/modes/theme/schema.d.ts +175 -0
  29. package/dist/types/modes/theme/symbols.d.ts +28 -0
  30. package/dist/types/modes/theme/theme-class.d.ts +244 -0
  31. package/dist/types/modes/theme/theme.d.ts +9 -280
  32. package/dist/types/modes/theme/tui-adapters.d.ts +13 -0
  33. package/dist/types/registry/agent-registry.d.ts +1 -3
  34. package/dist/types/secrets/index.d.ts +3 -1
  35. package/dist/types/secrets/message-transform.d.ts +40 -0
  36. package/dist/types/secrets/obfuscator.d.ts +0 -108
  37. package/dist/types/secrets/placeholder-scan.d.ts +95 -0
  38. package/dist/types/secrets/placeholder.d.ts +94 -0
  39. package/dist/types/secrets/replacement.d.ts +82 -0
  40. package/dist/types/session/agent-session-types.d.ts +6 -0
  41. package/dist/types/session/agent-session.d.ts +1 -1
  42. package/dist/types/session/session-handoff.d.ts +3 -3
  43. package/dist/types/session/session-manager.d.ts +32 -0
  44. package/dist/types/session/session-provider-boundary.d.ts +1 -1
  45. package/dist/types/session/turn-recovery.d.ts +2 -2
  46. package/dist/types/slash-commands/builtin-collaboration.d.ts +2 -0
  47. package/dist/types/slash-commands/builtin-completions.d.ts +36 -0
  48. package/dist/types/slash-commands/builtin-control.d.ts +2 -0
  49. package/dist/types/slash-commands/builtin-lifecycle.d.ts +3 -0
  50. package/dist/types/slash-commands/builtin-marketplace.d.ts +11 -0
  51. package/dist/types/slash-commands/builtin-modes.d.ts +5 -0
  52. package/dist/types/slash-commands/builtin-registry.d.ts +1 -1
  53. package/dist/types/slash-commands/builtin-session.d.ts +2 -0
  54. package/dist/types/tools/gh-common.d.ts +69 -0
  55. package/dist/types/tools/gh-pr-checkout.d.ts +84 -0
  56. package/dist/types/tools/gh-pr-diff.d.ts +102 -0
  57. package/dist/types/tools/gh-run-watch.d.ts +78 -0
  58. package/dist/types/tools/gh-search.d.ts +61 -0
  59. package/dist/types/tools/gh-types.d.ts +340 -0
  60. package/dist/types/tools/gh-view.d.ts +88 -0
  61. package/dist/types/tools/gh.d.ts +4 -201
  62. package/dist/types/tools/read-archive.d.ts +16 -0
  63. package/dist/types/tools/read-format.d.ts +104 -0
  64. package/dist/types/tools/read-path-resolution.d.ts +19 -0
  65. package/dist/types/tools/read-pdf-images.d.ts +12 -0
  66. package/dist/types/tools/read-renderer.d.ts +24 -0
  67. package/dist/types/tools/read-selector.d.ts +27 -0
  68. package/dist/types/tools/read-sqlite.d.ts +16 -0
  69. package/dist/types/tools/read-summary.d.ts +19 -0
  70. package/dist/types/tools/read.d.ts +1 -23
  71. package/dist/types/tools/shell-tokenize.d.ts +2 -1
  72. package/dist/types/utils/changelog.d.ts +0 -5
  73. package/package.json +13 -13
  74. package/src/advisor/runtime.ts +12 -7
  75. package/src/config/custom-models.ts +188 -0
  76. package/src/config/model-config-values.ts +128 -0
  77. package/src/config/model-patch.ts +252 -0
  78. package/src/config/model-provider-discovery.ts +132 -0
  79. package/src/config/model-registry.ts +64 -704
  80. package/src/config/settings.ts +7 -3
  81. package/src/debug/raw-sse-buffer.ts +20 -0
  82. package/src/discovery/agent-plugin-format.ts +7 -7
  83. package/src/discovery/contained-path.ts +2 -5
  84. package/src/edit/hashline/diff.ts +5 -1
  85. package/src/eval/executor-base.ts +39 -6
  86. package/src/eval/jl/executor.ts +82 -371
  87. package/src/eval/kernel-session-registry.ts +398 -0
  88. package/src/eval/py/executor.ts +53 -261
  89. package/src/eval/rb/executor.ts +36 -279
  90. package/src/export/share.ts +2 -1
  91. package/src/lsp/diagnostics.ts +516 -0
  92. package/src/lsp/index.ts +20 -2819
  93. package/src/lsp/servers.ts +296 -0
  94. package/src/lsp/tool.ts +1352 -0
  95. package/src/lsp/workspace-diagnostics.ts +170 -0
  96. package/src/lsp/writethrough.ts +561 -0
  97. package/src/mcp/transports/header-policy.ts +1 -1
  98. package/src/modes/components/agent-hub-projection.ts +2 -2
  99. package/src/modes/components/agent-hub-renderer.ts +3 -7
  100. package/src/modes/controllers/command-controller.ts +4 -1
  101. package/src/modes/theme/color.ts +133 -0
  102. package/src/modes/theme/loader.ts +178 -0
  103. package/src/modes/theme/schema.ts +263 -0
  104. package/src/modes/theme/symbols.ts +1000 -0
  105. package/src/modes/theme/theme-class.ts +611 -0
  106. package/src/modes/theme/theme.ts +27 -2453
  107. package/src/modes/theme/tui-adapters.ts +279 -0
  108. package/src/registry/agent-registry.ts +2 -2
  109. package/src/secrets/index.ts +6 -12
  110. package/src/secrets/message-transform.ts +287 -0
  111. package/src/secrets/obfuscator.ts +39 -1303
  112. package/src/secrets/placeholder-scan.ts +506 -0
  113. package/src/secrets/placeholder.ts +309 -0
  114. package/src/secrets/replacement.ts +216 -0
  115. package/src/session/agent-session-types.ts +6 -0
  116. package/src/session/agent-session.ts +113 -7
  117. package/src/session/indexed-session-storage.ts +7 -2
  118. package/src/session/session-advisors.ts +32 -34
  119. package/src/session/session-handoff.ts +39 -20
  120. package/src/session/session-manager.ts +67 -3
  121. package/src/session/session-provider-boundary.ts +3 -6
  122. package/src/session/turn-recovery.ts +21 -12
  123. package/src/slash-commands/builtin-collaboration.ts +504 -0
  124. package/src/slash-commands/builtin-completions.ts +291 -0
  125. package/src/slash-commands/builtin-control.ts +78 -0
  126. package/src/slash-commands/builtin-lifecycle.ts +506 -0
  127. package/src/slash-commands/builtin-marketplace.ts +567 -0
  128. package/src/slash-commands/builtin-modes.ts +518 -0
  129. package/src/slash-commands/builtin-registry.ts +21 -3000
  130. package/src/slash-commands/builtin-session.ts +592 -0
  131. package/src/task/executor.ts +17 -14
  132. package/src/tools/gh-common.ts +288 -0
  133. package/src/tools/gh-pr-checkout.ts +679 -0
  134. package/src/tools/gh-pr-diff.ts +473 -0
  135. package/src/tools/gh-run-watch.ts +1015 -0
  136. package/src/tools/gh-search.ts +500 -0
  137. package/src/tools/gh-types.ts +379 -0
  138. package/src/tools/gh-view.ts +612 -0
  139. package/src/tools/gh.ts +109 -3821
  140. package/src/tools/read-archive.ts +209 -0
  141. package/src/tools/read-format.ts +593 -0
  142. package/src/tools/read-path-resolution.ts +36 -0
  143. package/src/tools/read-pdf-images.ts +250 -0
  144. package/src/tools/read-renderer.ts +289 -0
  145. package/src/tools/read-selector.ts +84 -0
  146. package/src/tools/read-sqlite.ts +215 -0
  147. package/src/tools/read-summary.ts +199 -0
  148. package/src/tools/read.ts +77 -1820
  149. package/src/tools/shell-tokenize.ts +1 -1
  150. package/src/utils/changelog.ts +1 -1
  151. package/src/utils/title-generator.ts +3 -1
  152. package/src/web/search/providers/zai.ts +12 -3
@@ -1,130 +1,9 @@
1
- import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback, ToolApprovalDecision } from "@oh-my-pi/pi-agent-core";
2
- import type { BunFile } from "bun";
3
- import { type Theme } from "../modes/theme/theme.js";
4
- import type { ToolSession } from "../tools/index.js";
5
- import { type LspServerStatus } from "./client.js";
6
- import { type LspParams, type LspToolDetails, lspSchema } from "./types.js";
7
1
  export type { LspServerStatus } from "./client.js";
2
+ export type { FileDiagnosticsResult } from "./diagnostics.js";
3
+ export { FileFormatResult } from "./diagnostics.js";
4
+ export type { LspStartupServerInfo, LspWarmupOptions, LspWarmupResult } from "./servers.js";
5
+ export { discoverStartupLspServers, getLspStatus, LSP_READONLY_ACTIONS, warmupLspServers, } from "./servers.js";
6
+ export { LspTool } from "./tool.js";
8
7
  export type { LspToolDetails } from "./types.js";
9
- /**
10
- * LSP actions that do not mutate the workspace or language-server state.
11
- * Anything not in this set (rename, code_actions with apply, rename_file,
12
- * reload, raw request, etc.) is classified as write-tier.
13
- */
14
- export declare const LSP_READONLY_ACTIONS: ReadonlySet<string>;
15
- export interface LspStartupServerInfo {
16
- name: string;
17
- status: "connecting" | "ready" | "error" | "available";
18
- fileTypes: string[];
19
- error?: string;
20
- }
21
- /** Result from warming up LSP servers */
22
- export interface LspWarmupResult {
23
- servers: Array<LspStartupServerInfo & {
24
- status: "ready" | "error";
25
- }>;
26
- }
27
- /** Options for warming up LSP servers */
28
- export interface LspWarmupOptions {
29
- /** Called when starting to connect to servers */
30
- onConnecting?: (serverNames: string[]) => void;
31
- }
32
- export declare function discoverStartupLspServers(cwd: string, status?: LspStartupServerInfo["status"]): LspStartupServerInfo[];
33
- /**
34
- * Warm up LSP servers for a directory by connecting to all detected servers.
35
- * This should be called at startup to avoid cold-start delays.
36
- *
37
- * @param cwd - Working directory to detect and start servers for
38
- * @param options - Optional callbacks for progress reporting
39
- * @returns Status of each server that was started
40
- */
41
- export declare function warmupLspServers(cwd: string, options?: LspWarmupOptions): Promise<LspWarmupResult>;
42
- /**
43
- * Get status of currently active LSP servers.
44
- */
45
- export declare function getLspStatus(): LspServerStatus[];
46
- /** Result from getDiagnosticsForFile */
47
- export interface FileDiagnosticsResult {
48
- /** Name of the LSP server used (if available) */
49
- server?: string;
50
- /** Formatted diagnostic messages */
51
- messages: string[];
52
- /** Summary string (e.g., "2 error(s), 1 warning(s)") */
53
- summary: string;
54
- /** Whether there are any errors (severity 1) */
55
- errored: boolean;
56
- /** Whether the file was formatted */
57
- formatter?: FileFormatResult;
58
- }
59
- export declare enum FileFormatResult {
60
- UNCHANGED = "unchanged",
61
- FORMATTED = "formatted"
62
- }
63
- /** Options for creating the LSP writethrough callback */
64
- export interface WritethroughOptions {
65
- /** Whether to format the file using LSP after writing */
66
- enableFormat?: boolean;
67
- /** Whether to get LSP diagnostics after writing */
68
- enableDiagnostics?: boolean;
69
- /** Called when diagnostics arrive after the main timeout. */
70
- onDeferredDiagnostics?: (diagnostics: FileDiagnosticsResult) => void;
71
- /** Signal to cancel a pending deferred diagnostics fetch. */
72
- deferredSignal?: AbortSignal;
73
- /** Transform diagnostics before surfacing them after a successful fetch. */
74
- transformDiagnostics?: (absPath: string, result: FileDiagnosticsResult) => FileDiagnosticsResult;
75
- }
76
- /** Per-file deferred LSP diagnostics wiring for {@link WritethroughCallback}. */
77
- export type WritethroughDeferredHandle = {
78
- onDeferredDiagnostics: (diagnostics: FileDiagnosticsResult) => void;
79
- signal: AbortSignal;
80
- finalize: (diagnostics: FileDiagnosticsResult | undefined) => void;
81
- };
82
- /** Callback type for the LSP writethrough */
83
- export type WritethroughCallback = (dst: string, content: string, signal?: AbortSignal, file?: BunFile, batch?: LspWritethroughBatchRequest, getDeferred?: (dst: string) => WritethroughDeferredHandle | undefined) => Promise<FileDiagnosticsResult | undefined>;
84
- /** No-op writethrough callback */
85
- export declare function writethroughNoop(dst: string, content: string, _signal?: AbortSignal, file?: BunFile, _batch?: LspWritethroughBatchRequest, _getDeferred?: (dst: string) => WritethroughDeferredHandle | undefined): Promise<FileDiagnosticsResult | undefined>;
86
- interface LspWritethroughBatchRequest {
87
- id: string;
88
- flush: boolean;
89
- }
90
- export declare function flushLspWritethroughBatch(id: string, cwd: string, signal?: AbortSignal): Promise<FileDiagnosticsResult | undefined>;
91
- /** Create a writethrough callback for LSP aware write operations */
92
- export declare function createLspWritethrough(cwd: string, options?: WritethroughOptions): WritethroughCallback;
93
- /**
94
- * LSP tool for language server protocol operations.
95
- */
96
- export declare class LspTool implements AgentTool<typeof lspSchema, LspToolDetails, Theme> {
97
- private readonly session;
98
- readonly name = "lsp";
99
- readonly approval: (args: unknown) => ToolApprovalDecision;
100
- readonly formatApprovalDetails: (args: unknown) => string[];
101
- readonly label = "LSP";
102
- readonly loadMode = "discoverable";
103
- readonly summary = "Query LSP (language server) for diagnostics, hover info, and references";
104
- readonly description: string;
105
- readonly parameters: import("@oh-my-pi/omptype").FluentType<{
106
- action: "capabilities" | "code_actions" | "definition" | "diagnostics" | "hover" | "implementation" | "references" | "reload" | "rename" | "rename_file" | "request" | "status" | "symbols" | "type_definition";
107
- apply?: boolean | undefined;
108
- file?: string | undefined;
109
- line?: number | undefined;
110
- new_name?: string | undefined;
111
- payload?: string | undefined;
112
- query?: string | undefined;
113
- symbol?: string | undefined;
114
- timeout?: number | undefined;
115
- }, {
116
- action: "capabilities" | "code_actions" | "definition" | "diagnostics" | "hover" | "implementation" | "references" | "reload" | "rename" | "rename_file" | "request" | "status" | "symbols" | "type_definition";
117
- apply?: boolean | undefined;
118
- file?: string | undefined;
119
- line?: number | undefined;
120
- new_name?: string | undefined;
121
- payload?: string | undefined;
122
- query?: string | undefined;
123
- symbol?: string | undefined;
124
- timeout?: number | undefined;
125
- }>;
126
- readonly strict = true;
127
- constructor(session: ToolSession);
128
- static createIf(session: ToolSession): LspTool | null;
129
- execute(_toolCallId: string, params: LspParams, signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<LspToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<LspToolDetails>>;
130
- }
8
+ export type { WritethroughCallback, WritethroughDeferredHandle, WritethroughOptions, } from "./writethrough.js";
9
+ export { createLspWritethrough, flushLspWritethroughBatch, writethroughNoop, } from "./writethrough.js";
@@ -0,0 +1,72 @@
1
+ import { type LspServerStatus } from "./client.js";
2
+ import { type LspConfig } from "./config.js";
3
+ import type { LspClient, ServerConfig } from "./types.js";
4
+ /**
5
+ * LSP actions that do not mutate the workspace or language-server state.
6
+ * Anything not in this set (rename, code_actions with apply, rename_file,
7
+ * reload, raw request, etc.) is classified as write-tier.
8
+ */
9
+ export declare const LSP_READONLY_ACTIONS: ReadonlySet<string>;
10
+ export interface LspStartupServerInfo {
11
+ name: string;
12
+ status: "connecting" | "ready" | "error" | "available";
13
+ fileTypes: string[];
14
+ error?: string;
15
+ }
16
+ /** Result from warming up LSP servers */
17
+ export interface LspWarmupResult {
18
+ servers: Array<LspStartupServerInfo & {
19
+ status: "ready" | "error";
20
+ }>;
21
+ }
22
+ /** Options for warming up LSP servers */
23
+ export interface LspWarmupOptions {
24
+ /** Called when starting to connect to servers */
25
+ onConnecting?: (serverNames: string[]) => void;
26
+ }
27
+ export declare function discoverStartupLspServers(cwd: string, status?: LspStartupServerInfo["status"]): LspStartupServerInfo[];
28
+ /**
29
+ * Warm up LSP servers for a directory by connecting to all detected servers.
30
+ * This should be called at startup to avoid cold-start delays.
31
+ *
32
+ * @param cwd - Working directory to detect and start servers for
33
+ * @param options - Optional callbacks for progress reporting
34
+ * @returns Status of each server that was started
35
+ */
36
+ export declare function warmupLspServers(cwd: string, options?: LspWarmupOptions): Promise<LspWarmupResult>;
37
+ /**
38
+ * Get status of currently active LSP servers.
39
+ */
40
+ export declare function getLspStatus(): LspServerStatus[];
41
+ /**
42
+ * Sync in-memory file content to all applicable LSP servers.
43
+ * Sends didOpen (if new) or didChange (if already open).
44
+ *
45
+ * @param absolutePath - Absolute path to the file
46
+ * @param content - The new file content
47
+ * @param cwd - Working directory for LSP config resolution
48
+ * @param servers - Servers to sync to
49
+ */
50
+ export declare function syncFileContent(absolutePath: string, content: string, cwd: string, servers: Array<[string, ServerConfig]>, signal?: AbortSignal, createMissing?: boolean): Promise<void>;
51
+ /**
52
+ * Notify all LSP servers that a file was saved.
53
+ * Assumes content was already synced via syncFileContent.
54
+ *
55
+ * @param absolutePath - Absolute path to the file
56
+ * @param cwd - Working directory for LSP config resolution
57
+ * @param servers - Servers to notify
58
+ */
59
+ export declare function notifyFileSaved(absolutePath: string, cwd: string, servers: Array<[string, ServerConfig]>, signal?: AbortSignal, createMissing?: boolean): Promise<void>;
60
+ export declare const configCache: Map<string, LspConfig>;
61
+ export declare function getConfig(cwd: string): LspConfig;
62
+ export declare function splitServers(servers: Array<[string, ServerConfig]>): {
63
+ lspServers: Array<[string, ServerConfig]>;
64
+ customLinterServers: Array<[string, ServerConfig]>;
65
+ };
66
+ export declare function getLspServers(config: LspConfig): Array<[string, ServerConfig]>;
67
+ export declare function getLspServersForFile(config: LspConfig, filePath: string): Array<[string, ServerConfig]>;
68
+ export declare function getLspServerForFile(config: LspConfig, filePath: string): [string, ServerConfig] | null;
69
+ export declare function isProjectAwareLspServer(serverConfig: ServerConfig): boolean;
70
+ /** True when an LSP error indicates the server doesn't implement the requested method. */
71
+ export declare function isMethodNotFoundError(err: unknown): boolean;
72
+ export declare function reloadServer(client: LspClient, serverName: string, signal?: AbortSignal): Promise<string>;
@@ -0,0 +1,42 @@
1
+ import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback, ToolApprovalDecision } from "@oh-my-pi/pi-agent-core";
2
+ import { type Theme } from "../modes/theme/theme.js";
3
+ import type { ToolSession } from "../tools/index.js";
4
+ import { type LspParams, type LspToolDetails, lspSchema } from "./types.js";
5
+ /**
6
+ * LSP tool for language server protocol operations.
7
+ */
8
+ export declare class LspTool implements AgentTool<typeof lspSchema, LspToolDetails, Theme> {
9
+ private readonly session;
10
+ readonly name = "lsp";
11
+ readonly approval: (args: unknown) => ToolApprovalDecision;
12
+ readonly formatApprovalDetails: (args: unknown) => string[];
13
+ readonly label = "LSP";
14
+ readonly loadMode = "discoverable";
15
+ readonly summary = "Query LSP (language server) for diagnostics, hover info, and references";
16
+ readonly description: string;
17
+ readonly parameters: import("@oh-my-pi/omptype").FluentType<{
18
+ action: "capabilities" | "code_actions" | "definition" | "diagnostics" | "hover" | "implementation" | "references" | "reload" | "rename" | "rename_file" | "request" | "status" | "symbols" | "type_definition";
19
+ apply?: boolean | undefined;
20
+ file?: string | undefined;
21
+ line?: number | undefined;
22
+ new_name?: string | undefined;
23
+ payload?: string | undefined;
24
+ query?: string | undefined;
25
+ symbol?: string | undefined;
26
+ timeout?: number | undefined;
27
+ }, {
28
+ action: "capabilities" | "code_actions" | "definition" | "diagnostics" | "hover" | "implementation" | "references" | "reload" | "rename" | "rename_file" | "request" | "status" | "symbols" | "type_definition";
29
+ apply?: boolean | undefined;
30
+ file?: string | undefined;
31
+ line?: number | undefined;
32
+ new_name?: string | undefined;
33
+ payload?: string | undefined;
34
+ query?: string | undefined;
35
+ symbol?: string | undefined;
36
+ timeout?: number | undefined;
37
+ }>;
38
+ readonly strict = true;
39
+ constructor(session: ToolSession);
40
+ static createIf(session: ToolSession): LspTool | null;
41
+ execute(_toolCallId: string, params: LspParams, signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<LspToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<LspToolDetails>>;
42
+ }
@@ -0,0 +1,12 @@
1
+ /** Project type detection result */
2
+ interface ProjectType {
3
+ type: "rust" | "typescript" | "go" | "python" | "unknown";
4
+ command?: string[];
5
+ description: string;
6
+ }
7
+ /** Run workspace diagnostics command and parse output */
8
+ export declare function runWorkspaceDiagnostics(cwd: string, signal?: AbortSignal): Promise<{
9
+ output: string;
10
+ projectType: ProjectType;
11
+ }>;
12
+ export {};
@@ -0,0 +1,33 @@
1
+ import type { BunFile } from "bun";
2
+ import { type FileDiagnosticsResult } from "./diagnostics.js";
3
+ /** Options for creating the LSP writethrough callback */
4
+ export interface WritethroughOptions {
5
+ /** Whether to format the file using LSP after writing */
6
+ enableFormat?: boolean;
7
+ /** Whether to get LSP diagnostics after writing */
8
+ enableDiagnostics?: boolean;
9
+ /** Called when diagnostics arrive after the main timeout. */
10
+ onDeferredDiagnostics?: (diagnostics: FileDiagnosticsResult) => void;
11
+ /** Signal to cancel a pending deferred diagnostics fetch. */
12
+ deferredSignal?: AbortSignal;
13
+ /** Transform diagnostics before surfacing them after a successful fetch. */
14
+ transformDiagnostics?: (absPath: string, result: FileDiagnosticsResult) => FileDiagnosticsResult;
15
+ }
16
+ /** Per-file deferred LSP diagnostics wiring for {@link WritethroughCallback}. */
17
+ export type WritethroughDeferredHandle = {
18
+ onDeferredDiagnostics: (diagnostics: FileDiagnosticsResult) => void;
19
+ signal: AbortSignal;
20
+ finalize: (diagnostics: FileDiagnosticsResult | undefined) => void;
21
+ };
22
+ /** Callback type for the LSP writethrough */
23
+ export type WritethroughCallback = (dst: string, content: string, signal?: AbortSignal, file?: BunFile, batch?: LspWritethroughBatchRequest, getDeferred?: (dst: string) => WritethroughDeferredHandle | undefined) => Promise<FileDiagnosticsResult | undefined>;
24
+ /** No-op writethrough callback */
25
+ export declare function writethroughNoop(dst: string, content: string, _signal?: AbortSignal, file?: BunFile, _batch?: LspWritethroughBatchRequest, _getDeferred?: (dst: string) => WritethroughDeferredHandle | undefined): Promise<FileDiagnosticsResult | undefined>;
26
+ interface LspWritethroughBatchRequest {
27
+ id: string;
28
+ flush: boolean;
29
+ }
30
+ export declare function flushLspWritethroughBatch(id: string, cwd: string, signal?: AbortSignal): Promise<FileDiagnosticsResult | undefined>;
31
+ /** Create a writethrough callback for LSP aware write operations */
32
+ export declare function createLspWritethrough(cwd: string, options?: WritethroughOptions): WritethroughCallback;
33
+ export {};
@@ -13,7 +13,7 @@
13
13
  * origin. Method-changing redirects of non-GET requests are refused.
14
14
  */
15
15
  /** Header buckets for one MCP HTTP request. */
16
- export interface MCPHeaderSources {
16
+ interface MCPHeaderSources {
17
17
  /** Client-generated HTTP/MCP/authorization headers; win case-insensitively. */
18
18
  generated: Record<string, string>;
19
19
  /** Configured headers from the server entry (package or user config). */
@@ -43,3 +43,4 @@ export interface MCPFetchInit {
43
43
  * redirect of a JSON-RPC POST is a connection error, never a silent GET.
44
44
  */
45
45
  export declare function mcpFetch(url: string, init: MCPFetchInit, sources: MCPHeaderSources, originLocked: boolean): Promise<Response>;
46
+ export {};
@@ -6,7 +6,7 @@ export interface AggregateMetrics extends AgentMetrics {
6
6
  /** Rows whose duration is an observer-measured active runtime. */
7
7
  activeDurationAgents: number;
8
8
  }
9
- export interface AgentTreeProjection {
9
+ interface AgentTreeProjection {
10
10
  rows: AgentRef[];
11
11
  depthById: Map<string, number>;
12
12
  parentById: Map<string, string>;
@@ -15,12 +15,6 @@ export interface AgentTreeProjection {
15
15
  export declare const STATUS_ORDER: Record<AgentStatus, number>;
16
16
  /** Exact observer usage for one roster entry. */
17
17
  export declare function progressMetrics(observed: ObservableSession | undefined): AgentMetrics | undefined;
18
- /**
19
- * Read direct assistant usage from a live session. SessionStats also includes
20
- * usage embedded in completed `task` tool results, so using it for a parent
21
- * row would double-count child rows in the aggregate.
22
- */
23
- export declare function readSessionMetrics(session: NonNullable<AgentRef["session"]>): AgentMetrics | undefined;
24
18
  export declare function aggregateMetrics(args: {
25
19
  rows: readonly AgentRef[];
26
20
  observedById: ReadonlyMap<string, ObservableSession>;
@@ -36,3 +30,4 @@ export declare function aggregateMetrics(args: {
36
30
  };
37
31
  /** Parent-before-child projection preserving the roster's stable sibling order. */
38
32
  export declare function projectAgentTree(refs: readonly AgentRef[]): AgentTreeProjection;
33
+ export {};
@@ -1,4 +1,3 @@
1
- import { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
2
1
  import type { Settings } from "../../config/settings.js";
3
2
  import { type AgentRef } from "../../registry/agent-registry.js";
4
3
  import type { ObservableSession } from "../session-observer-registry.js";
@@ -7,8 +6,6 @@ export interface RosterRender {
7
6
  lines: string[];
8
7
  hitRows: Array<number | undefined>;
9
8
  }
10
- /** Legacy progress snapshots may omit counters; snapshot absence remains distinct. */
11
- export declare function metricNumber(value: number | undefined): number;
12
9
  /** Compute the max content width for the current terminal, accounting for chrome. */
13
10
  export declare function contentWidth(): number;
14
11
  /** Remove terminal controls and normalize a value before it reaches the TUI. */
@@ -19,12 +16,8 @@ export declare function clampHubLine(line: string, width: number): string;
19
16
  /** Status glyph, colored per theme status conventions. The title-line counts spell out the words. */
20
17
  export declare function statusGlyph(status: AgentRef["status"]): string;
21
18
  export declare function statusText(status: AgentRef["status"], text: string): string;
22
- /** Model id + thinking level (`sonnet-4-6 ◒ high`), level colored per theme. */
23
- export declare function formatModelBadge(modelId: string, level: ThinkingLevel | undefined): string;
24
19
  /** Textual model-role tag; color reinforces (but never replaces) the label. */
25
20
  export declare function formatRoleBadge(role: string, settings: Settings): string;
26
- /** Format a resolved selector, preserving provider identity when requested. */
27
- export declare function formatResolvedModelBadge(resolved: string, preserveProvider?: boolean, fallbackLevel?: ThinkingLevel): string;
28
21
  /**
29
22
  * Resolved model + reasoning level for a hub row. Exact executor progress is
30
23
  * authoritative (and survives completion); direct live sessions are the
@@ -0,0 +1,19 @@
1
+ import type { ColorMode, ColorValue } from "./schema.js";
2
+ export declare function detectColorMode(): ColorMode;
3
+ export declare function colorToAnsi(color: string, mode: ColorMode): string;
4
+ export declare function fgAnsi(color: string | number, mode: ColorMode): string;
5
+ export declare function bgAnsi(color: string | number, mode: ColorMode): string;
6
+ export declare function resolveVarRefs(value: ColorValue, vars: Record<string, ColorValue>, visited?: Set<string>): string | number;
7
+ export declare function resolveThemeColors<T extends Record<string, ColorValue>>(colors: T, vars?: Record<string, ColorValue>): Record<keyof T, string | number>;
8
+ /**
9
+ * Resolve a theme color value (hex string or 256-color index) to a CSS hex string.
10
+ * Empty string represents the default terminal color.
11
+ */
12
+ export declare function resolveToHex(value: string | number, isLight: boolean): string;
13
+ /**
14
+ * Convert a 256-color index to hex string.
15
+ * Indices 0-15: basic colors (approximate)
16
+ * Indices 16-231: 6x6x6 color cube
17
+ * Indices 232-255: grayscale ramp
18
+ */
19
+ export declare function ansi256ToHex(index: number): string;
@@ -0,0 +1,19 @@
1
+ import { type ColorMode, type ThemeJson } from "./schema.js";
2
+ import { type SymbolPreset } from "./symbols.js";
3
+ import { Theme } from "./theme-class.js";
4
+ export declare function getBuiltinThemes(): Record<string, ThemeJson>;
5
+ export declare function getAvailableThemes(): Promise<string[]>;
6
+ export interface ThemeInfo {
7
+ name: string;
8
+ path: string | undefined;
9
+ }
10
+ export declare function getAvailableThemesWithPaths(): Promise<ThemeInfo[]>;
11
+ export declare function loadThemeJson(name: string): Promise<ThemeJson>;
12
+ export interface CreateThemeOptions {
13
+ mode?: ColorMode;
14
+ symbolPresetOverride?: SymbolPreset;
15
+ colorBlindMode?: boolean;
16
+ }
17
+ export declare function createTheme(themeJson: ThemeJson, options?: CreateThemeOptions): Theme;
18
+ export declare function loadTheme(name: string, options?: CreateThemeOptions): Promise<Theme>;
19
+ export declare function getThemeByName(name: string): Promise<Theme | undefined>;
@@ -0,0 +1,175 @@
1
+ import type { SpinnerFramesOverride } from "./symbols.js";
2
+ export type ColorValue = string | number;
3
+ export declare const themeJsonSchema: import("@oh-my-pi/omptype").FluentType<{
4
+ $schema?: string | undefined;
5
+ colors: {
6
+ accent: string | number;
7
+ bashMode: string | number;
8
+ border: string | number;
9
+ borderAccent: string | number;
10
+ borderMuted: string | number;
11
+ customMessageBg: string | number;
12
+ customMessageLabel: string | number;
13
+ customMessageText: string | number;
14
+ dim: string | number;
15
+ error: string | number;
16
+ mdCode: string | number;
17
+ mdCodeBlock: string | number;
18
+ mdCodeBlockBorder: string | number;
19
+ mdHeading: string | number;
20
+ mdHr: string | number;
21
+ mdLink: string | number;
22
+ mdLinkUrl: string | number;
23
+ mdListBullet: string | number;
24
+ mdQuote: string | number;
25
+ mdQuoteBorder: string | number;
26
+ muted: string | number;
27
+ pythonMode: string | number;
28
+ selectedBg: string | number;
29
+ statusLineBg: string | number;
30
+ statusLineContext: string | number;
31
+ statusLineCost: string | number;
32
+ statusLineDirty: string | number;
33
+ statusLineGitClean: string | number;
34
+ statusLineGitDirty: string | number;
35
+ statusLineModel: string | number;
36
+ statusLineOutput: string | number;
37
+ statusLinePath: string | number;
38
+ statusLineSep: string | number;
39
+ statusLineSpend: string | number;
40
+ statusLineStaged: string | number;
41
+ statusLineSubagents: string | number;
42
+ statusLineUntracked: string | number;
43
+ success: string | number;
44
+ syntaxComment: string | number;
45
+ syntaxFunction: string | number;
46
+ syntaxKeyword: string | number;
47
+ syntaxNumber: string | number;
48
+ syntaxOperator: string | number;
49
+ syntaxPunctuation: string | number;
50
+ syntaxString: string | number;
51
+ syntaxType: string | number;
52
+ syntaxVariable: string | number;
53
+ text: string | number;
54
+ thinkingHigh: string | number;
55
+ thinkingLow: string | number;
56
+ thinkingMax?: string | number | undefined;
57
+ thinkingMedium: string | number;
58
+ thinkingMinimal: string | number;
59
+ thinkingOff: string | number;
60
+ thinkingText: string | number;
61
+ thinkingXhigh: string | number;
62
+ toolDiffAdded: string | number;
63
+ toolDiffContext: string | number;
64
+ toolDiffRemoved: string | number;
65
+ toolErrorBg: string | number;
66
+ toolOutput: string | number;
67
+ toolPendingBg: string | number;
68
+ toolSuccessBg: string | number;
69
+ toolTitle: string | number;
70
+ userMessageBg: string | number;
71
+ userMessageText: string | number;
72
+ warning: string | number;
73
+ };
74
+ export?: {
75
+ cardBg?: string | number | undefined;
76
+ infoBg?: string | number | undefined;
77
+ pageBg?: string | number | undefined;
78
+ } | undefined;
79
+ name: string;
80
+ symbols?: {
81
+ overrides?: Record<string, string> | undefined;
82
+ preset?: "ascii" | "nerd" | "unicode" | undefined;
83
+ spinnerFrames?: SpinnerFramesOverride | undefined;
84
+ } | undefined;
85
+ vars?: Record<string, string | number> | undefined;
86
+ }, {
87
+ $schema?: string | undefined;
88
+ colors: {
89
+ accent: string | number;
90
+ bashMode: string | number;
91
+ border: string | number;
92
+ borderAccent: string | number;
93
+ borderMuted: string | number;
94
+ customMessageBg: string | number;
95
+ customMessageLabel: string | number;
96
+ customMessageText: string | number;
97
+ dim: string | number;
98
+ error: string | number;
99
+ mdCode: string | number;
100
+ mdCodeBlock: string | number;
101
+ mdCodeBlockBorder: string | number;
102
+ mdHeading: string | number;
103
+ mdHr: string | number;
104
+ mdLink: string | number;
105
+ mdLinkUrl: string | number;
106
+ mdListBullet: string | number;
107
+ mdQuote: string | number;
108
+ mdQuoteBorder: string | number;
109
+ muted: string | number;
110
+ pythonMode: string | number;
111
+ selectedBg: string | number;
112
+ statusLineBg: string | number;
113
+ statusLineContext: string | number;
114
+ statusLineCost: string | number;
115
+ statusLineDirty: string | number;
116
+ statusLineGitClean: string | number;
117
+ statusLineGitDirty: string | number;
118
+ statusLineModel: string | number;
119
+ statusLineOutput: string | number;
120
+ statusLinePath: string | number;
121
+ statusLineSep: string | number;
122
+ statusLineSpend: string | number;
123
+ statusLineStaged: string | number;
124
+ statusLineSubagents: string | number;
125
+ statusLineUntracked: string | number;
126
+ success: string | number;
127
+ syntaxComment: string | number;
128
+ syntaxFunction: string | number;
129
+ syntaxKeyword: string | number;
130
+ syntaxNumber: string | number;
131
+ syntaxOperator: string | number;
132
+ syntaxPunctuation: string | number;
133
+ syntaxString: string | number;
134
+ syntaxType: string | number;
135
+ syntaxVariable: string | number;
136
+ text: string | number;
137
+ thinkingHigh: string | number;
138
+ thinkingLow: string | number;
139
+ thinkingMax?: string | number | undefined;
140
+ thinkingMedium: string | number;
141
+ thinkingMinimal: string | number;
142
+ thinkingOff: string | number;
143
+ thinkingText: string | number;
144
+ thinkingXhigh: string | number;
145
+ toolDiffAdded: string | number;
146
+ toolDiffContext: string | number;
147
+ toolDiffRemoved: string | number;
148
+ toolErrorBg: string | number;
149
+ toolOutput: string | number;
150
+ toolPendingBg: string | number;
151
+ toolSuccessBg: string | number;
152
+ toolTitle: string | number;
153
+ userMessageBg: string | number;
154
+ userMessageText: string | number;
155
+ warning: string | number;
156
+ };
157
+ export?: {
158
+ cardBg?: string | number | undefined;
159
+ infoBg?: string | number | undefined;
160
+ pageBg?: string | number | undefined;
161
+ } | undefined;
162
+ name: string;
163
+ symbols?: {
164
+ overrides?: Record<string, string> | undefined;
165
+ preset?: "ascii" | "nerd" | "unicode" | undefined;
166
+ spinnerFrames?: unknown;
167
+ } | undefined;
168
+ vars?: Record<string, string | number> | undefined;
169
+ }>;
170
+ export type ThemeJson = typeof themeJsonSchema.infer;
171
+ export type ThemeColor = "accent" | "border" | "borderAccent" | "borderMuted" | "success" | "error" | "warning" | "muted" | "dim" | "text" | "thinkingText" | "userMessageText" | "customMessageText" | "customMessageLabel" | "toolTitle" | "toolOutput" | "mdHeading" | "mdLink" | "mdLinkUrl" | "mdCode" | "mdCodeBlock" | "mdCodeBlockBorder" | "mdQuote" | "mdQuoteBorder" | "mdHr" | "mdListBullet" | "toolDiffAdded" | "toolDiffRemoved" | "toolDiffContext" | "syntaxComment" | "syntaxKeyword" | "syntaxFunction" | "syntaxVariable" | "syntaxString" | "syntaxNumber" | "syntaxType" | "syntaxOperator" | "syntaxPunctuation" | "thinkingOff" | "thinkingMinimal" | "thinkingLow" | "thinkingMedium" | "thinkingHigh" | "thinkingXhigh" | "thinkingMax" | "bashMode" | "pythonMode" | "statusLineSep" | "statusLineModel" | "statusLinePath" | "statusLineGitClean" | "statusLineGitDirty" | "statusLineContext" | "statusLineSpend" | "statusLineStaged" | "statusLineDirty" | "statusLineUntracked" | "statusLineOutput" | "statusLineCost" | "statusLineSubagents";
172
+ /** Check if a string is a valid ThemeColor value */
173
+ export declare function isValidThemeColor(color: string): color is ThemeColor;
174
+ export type ThemeBg = "selectedBg" | "userMessageBg" | "customMessageBg" | "toolPendingBg" | "toolSuccessBg" | "toolErrorBg" | "statusLineBg";
175
+ export type ColorMode = "truecolor" | "256color";
@@ -0,0 +1,28 @@
1
+ export type SymbolPreset = "unicode" | "nerd" | "ascii";
2
+ /**
3
+ * All available symbol keys organized by category.
4
+ */
5
+ export type SymbolKey = "status.success" | "status.error" | "status.warning" | "status.info" | "status.pending" | "status.disabled" | "status.enabled" | "status.running" | "status.shadowed" | "status.aborted" | "status.done" | "nav.cursor" | "nav.selected" | "nav.expand" | "nav.collapse" | "nav.back" | "tree.branch" | "tree.last" | "tree.vertical" | "tree.horizontal" | "tree.hook" | "boxRound.topLeft" | "boxRound.topRight" | "boxRound.bottomLeft" | "boxRound.bottomRight" | "boxRound.horizontal" | "boxRound.vertical" | "boxSharp.topLeft" | "boxSharp.topRight" | "boxSharp.bottomLeft" | "boxSharp.bottomRight" | "boxSharp.horizontal" | "boxSharp.vertical" | "boxSharp.cross" | "boxSharp.teeDown" | "boxSharp.teeUp" | "boxSharp.teeRight" | "boxSharp.teeLeft" | "sep.powerline" | "sep.powerlineThin" | "sep.powerlineLeft" | "sep.powerlineRight" | "sep.powerlineThinLeft" | "sep.powerlineThinRight" | "sep.block" | "sep.space" | "sep.asciiLeft" | "sep.asciiRight" | "sep.dot" | "sep.slash" | "sep.pipe" | "icon.model" | "icon.plan" | "icon.prewalk" | "icon.goal" | "icon.pause" | "icon.loop" | "icon.folder" | "icon.worktree" | "icon.search" | "icon.scratchFolder" | "icon.file" | "icon.git" | "icon.branch" | "icon.pr" | "icon.tokens" | "icon.context" | "icon.cost" | "icon.time" | "icon.pi" | "icon.ghost" | "icon.agents" | "icon.job" | "icon.cache" | "icon.cacheMiss" | "icon.input" | "icon.output" | "icon.throughput" | "icon.host" | "icon.session" | "icon.package" | "icon.warning" | "icon.rewind" | "icon.auto" | "icon.fast" | "icon.extensionSkill" | "icon.extensionTool" | "icon.extensionSlashCommand" | "icon.extensionMcp" | "icon.extensionRule" | "icon.extensionHook" | "icon.extensionPrompt" | "icon.extensionContextFile" | "icon.extensionInstruction" | "icon.mic" | "icon.camera" | "thinking.minimal" | "thinking.low" | "thinking.medium" | "thinking.high" | "thinking.xhigh" | "thinking.max" | "thinking.autoPending" | "checkbox.checked" | "checkbox.unchecked" | "radio.selected" | "radio.unselected" | "format.bullet" | "format.dash" | "format.bracketLeft" | "format.bracketRight" | "md.quoteBorder" | "md.hrChar" | "md.bullet" | "md.colorSwatch" | "advisor.rail" | "lang.default" | "lang.typescript" | "lang.javascript" | "lang.python" | "lang.rust" | "lang.go" | "lang.java" | "lang.c" | "lang.cpp" | "lang.csharp" | "lang.ruby" | "lang.julia" | "lang.php" | "lang.swift" | "lang.kotlin" | "lang.shell" | "lang.html" | "lang.css" | "lang.json" | "lang.yaml" | "lang.markdown" | "lang.sql" | "lang.docker" | "lang.lua" | "lang.text" | "lang.env" | "lang.toml" | "lang.xml" | "lang.ini" | "lang.conf" | "lang.log" | "lang.csv" | "lang.tsv" | "lang.image" | "lang.pdf" | "lang.archive" | "lang.binary" | "tab.appearance" | "tab.model" | "tab.interaction" | "tab.context" | "tab.files" | "tab.shell" | "tab.tools" | "tab.memory" | "tab.tasks" | "tab.providers" | "tool.write" | "tool.edit" | "tool.bash" | "tool.ssh" | "tool.lsp" | "tool.gh" | "tool.webSearch" | "tool.exa" | "tool.browser" | "tool.eval" | "tool.debug" | "tool.mcp" | "tool.job" | "tool.launch" | "tool.task" | "tool.todo" | "tool.memory" | "tool.ask" | "tool.resolve" | "tool.review" | "tool.inspectImage" | "tool.goal" | "tool.irc" | "tool.delete" | "tool.move";
6
+ export type SymbolMap = Record<SymbolKey, string>;
7
+ export declare const SYMBOL_PRESETS: Record<SymbolPreset, SymbolMap>;
8
+ export type SpinnerType = "status" | "activity";
9
+ export declare const SPINNER_FRAMES: Record<SymbolPreset, Record<SpinnerType, string[]>>;
10
+ /**
11
+ * Shape accepted by `themeJson.symbols.spinnerFrames`. A flat array applies to
12
+ * both spinner types; an object lets a theme override `status` and/or
13
+ * `activity` independently. Anything not specified falls back to the symbol
14
+ * preset's default frames.
15
+ */
16
+ export type SpinnerFramesOverride = string[] | {
17
+ status?: string[];
18
+ activity?: string[];
19
+ };
20
+ export declare function normalizeSpinnerFramesOverride(value: SpinnerFramesOverride | undefined): Partial<Record<SpinnerType, string[]>>;
21
+ /**
22
+ * Get available symbol presets.
23
+ */
24
+ export declare function getAvailableSymbolPresets(): SymbolPreset[];
25
+ /**
26
+ * Check if a string is a valid symbol preset.
27
+ */
28
+ export declare function isValidSymbolPreset(preset: string): preset is SymbolPreset;