@oh-my-pi/pi-coding-agent 1.341.0 → 2.1.1337
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +86 -0
- package/README.md +1 -1
- package/examples/custom-tools/subagent/index.ts +1 -1
- package/package.json +10 -9
- package/src/bun-imports.d.ts +16 -0
- package/src/cli/args.ts +5 -6
- package/src/cli/file-processor.ts +3 -3
- package/src/cli/list-models.ts +2 -2
- package/src/cli/plugin-cli.ts +1 -1
- package/src/cli/session-picker.ts +2 -2
- package/src/cli/update-cli.ts +273 -0
- package/src/cli.ts +1 -1
- package/src/config.ts +23 -75
- package/src/core/agent-session.ts +158 -16
- package/src/core/auth-storage.ts +2 -3
- package/src/core/bash-executor.ts +50 -10
- package/src/core/compaction/branch-summarization.ts +5 -5
- package/src/core/compaction/compaction.ts +3 -3
- package/src/core/compaction/index.ts +3 -3
- package/src/core/custom-commands/bundled/review/index.ts +156 -0
- package/src/core/custom-commands/index.ts +15 -0
- package/src/core/custom-commands/loader.ts +232 -0
- package/src/core/custom-commands/types.ts +112 -0
- package/src/core/custom-tools/index.ts +3 -3
- package/src/core/custom-tools/loader.ts +10 -8
- package/src/core/custom-tools/types.ts +11 -6
- package/src/core/custom-tools/wrapper.ts +2 -1
- package/src/core/exec.ts +22 -12
- package/src/core/export-html/index.ts +38 -123
- package/src/core/export-html/template.css +0 -7
- package/src/core/export-html/template.html +3 -4
- package/src/core/export-html/template.macro.ts +24 -0
- package/src/core/file-mentions.ts +54 -0
- package/src/core/hooks/index.ts +5 -5
- package/src/core/hooks/loader.ts +21 -16
- package/src/core/hooks/runner.ts +6 -6
- package/src/core/hooks/tool-wrapper.ts +2 -2
- package/src/core/hooks/types.ts +12 -15
- package/src/core/index.ts +6 -6
- package/src/core/logger.ts +112 -0
- package/src/core/mcp/client.ts +3 -3
- package/src/core/mcp/config.ts +1 -1
- package/src/core/mcp/index.ts +12 -12
- package/src/core/mcp/loader.ts +2 -2
- package/src/core/mcp/manager.ts +6 -6
- package/src/core/mcp/tool-bridge.ts +3 -3
- package/src/core/mcp/transports/http.ts +1 -1
- package/src/core/mcp/transports/index.ts +2 -2
- package/src/core/mcp/transports/stdio.ts +1 -1
- package/src/core/messages.ts +22 -0
- package/src/core/model-registry.ts +2 -2
- package/src/core/model-resolver.ts +2 -2
- package/src/core/plugins/doctor.ts +1 -1
- package/src/core/plugins/index.ts +6 -6
- package/src/core/plugins/installer.ts +4 -4
- package/src/core/plugins/loader.ts +4 -9
- package/src/core/plugins/manager.ts +5 -5
- package/src/core/plugins/paths.ts +3 -3
- package/src/core/sdk.ts +77 -35
- package/src/core/session-manager.ts +6 -6
- package/src/core/settings-manager.ts +16 -3
- package/src/core/skills.ts +5 -5
- package/src/core/slash-commands.ts +60 -45
- package/src/core/system-prompt.ts +6 -6
- package/src/core/title-generator.ts +2 -2
- package/src/core/tools/bash.ts +32 -155
- package/src/core/tools/context.ts +2 -2
- package/src/core/tools/edit-diff.ts +3 -3
- package/src/core/tools/edit.ts +18 -5
- package/src/core/tools/exa/company.ts +3 -3
- package/src/core/tools/exa/index.ts +16 -17
- package/src/core/tools/exa/linkedin.ts +3 -3
- package/src/core/tools/exa/mcp-client.ts +9 -9
- package/src/core/tools/exa/render.ts +5 -5
- package/src/core/tools/exa/researcher.ts +3 -3
- package/src/core/tools/exa/search.ts +6 -5
- package/src/core/tools/exa/types.ts +5 -6
- package/src/core/tools/exa/websets.ts +3 -3
- package/src/core/tools/find.ts +3 -3
- package/src/core/tools/grep.ts +3 -3
- package/src/core/tools/index.ts +48 -34
- package/src/core/tools/ls.ts +4 -4
- package/src/core/tools/lsp/client.ts +161 -90
- package/src/core/tools/lsp/config.ts +1 -1
- package/src/core/tools/lsp/edits.ts +2 -2
- package/src/core/tools/lsp/index.ts +15 -13
- package/src/core/tools/lsp/render.ts +2 -2
- package/src/core/tools/lsp/rust-analyzer.ts +3 -3
- package/src/core/tools/lsp/utils.ts +1 -1
- package/src/core/tools/notebook.ts +1 -1
- package/src/core/tools/output.ts +175 -0
- package/src/core/tools/read.ts +7 -7
- package/src/core/tools/renderers.ts +92 -13
- package/src/core/tools/review.ts +268 -0
- package/src/core/tools/task/agents.ts +22 -38
- package/src/core/tools/task/bundled-agents/reviewer.md +52 -37
- package/src/core/tools/task/commands.ts +31 -10
- package/src/core/tools/task/discovery.ts +2 -2
- package/src/core/tools/task/executor.ts +145 -28
- package/src/core/tools/task/index.ts +78 -30
- package/src/core/tools/task/model-resolver.ts +30 -20
- package/src/core/tools/task/parallel.ts +1 -1
- package/src/core/tools/task/render.ts +219 -30
- package/src/core/tools/task/subprocess-tool-registry.ts +89 -0
- package/src/core/tools/task/types.ts +36 -2
- package/src/core/tools/web-fetch.ts +5 -3
- package/src/core/tools/web-search/auth.ts +1 -1
- package/src/core/tools/web-search/index.ts +17 -15
- package/src/core/tools/web-search/providers/anthropic.ts +2 -2
- package/src/core/tools/web-search/providers/exa.ts +3 -5
- package/src/core/tools/web-search/providers/perplexity.ts +1 -1
- package/src/core/tools/web-search/render.ts +3 -3
- package/src/core/tools/write.ts +4 -4
- package/src/index.ts +29 -18
- package/src/main.ts +50 -33
- package/src/migrations.ts +3 -3
- package/src/modes/index.ts +5 -5
- package/src/modes/interactive/components/armin.ts +1 -1
- package/src/modes/interactive/components/assistant-message.ts +1 -1
- package/src/modes/interactive/components/bash-execution.ts +4 -4
- package/src/modes/interactive/components/bordered-loader.ts +2 -2
- package/src/modes/interactive/components/branch-summary-message.ts +2 -2
- package/src/modes/interactive/components/compaction-summary-message.ts +2 -2
- package/src/modes/interactive/components/diff.ts +1 -1
- package/src/modes/interactive/components/dynamic-border.ts +1 -1
- package/src/modes/interactive/components/footer.ts +5 -5
- package/src/modes/interactive/components/hook-editor.ts +2 -2
- package/src/modes/interactive/components/hook-input.ts +2 -2
- package/src/modes/interactive/components/hook-message.ts +3 -3
- package/src/modes/interactive/components/hook-selector.ts +2 -2
- package/src/modes/interactive/components/model-selector.ts +281 -59
- package/src/modes/interactive/components/oauth-selector.ts +3 -3
- package/src/modes/interactive/components/plugin-settings.ts +4 -4
- package/src/modes/interactive/components/queue-mode-selector.ts +2 -2
- package/src/modes/interactive/components/session-selector.ts +4 -4
- package/src/modes/interactive/components/settings-defs.ts +1 -1
- package/src/modes/interactive/components/settings-selector.ts +5 -5
- package/src/modes/interactive/components/show-images-selector.ts +2 -2
- package/src/modes/interactive/components/theme-selector.ts +2 -2
- package/src/modes/interactive/components/thinking-selector.ts +2 -2
- package/src/modes/interactive/components/tool-execution.ts +26 -8
- package/src/modes/interactive/components/tree-selector.ts +3 -3
- package/src/modes/interactive/components/user-message-selector.ts +2 -2
- package/src/modes/interactive/components/user-message.ts +1 -1
- package/src/modes/interactive/components/welcome.ts +2 -2
- package/src/modes/interactive/interactive-mode.ts +86 -42
- package/src/modes/interactive/theme/theme.ts +15 -17
- package/src/modes/print-mode.ts +4 -3
- package/src/modes/rpc/rpc-client.ts +4 -4
- package/src/modes/rpc/rpc-mode.ts +22 -12
- package/src/modes/rpc/rpc-types.ts +3 -3
- package/src/utils/changelog.ts +2 -2
- package/src/utils/clipboard.ts +1 -1
- package/src/utils/shell-snapshot.ts +218 -0
- package/src/utils/shell.ts +93 -13
- package/src/utils/tools-manager.ts +1 -1
- package/examples/custom-tools/subagent/agents/reviewer.md +0 -35
- package/src/core/tools/exa/logger.ts +0 -56
package/src/core/tools/write.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import { dirname } from "node:path";
|
|
1
3
|
import type { AgentTool } from "@oh-my-pi/pi-agent-core";
|
|
2
4
|
import { Type } from "@sinclair/typebox";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import type { FileDiagnosticsResult, FileFormatResult } from "./lsp/index.js";
|
|
6
|
-
import { resolveToCwd } from "./path-utils.js";
|
|
5
|
+
import type { FileDiagnosticsResult, FileFormatResult } from "./lsp/index";
|
|
6
|
+
import { resolveToCwd } from "./path-utils";
|
|
7
7
|
|
|
8
8
|
const writeSchema = Type.Object({
|
|
9
9
|
path: Type.String({ description: "Path to the file to write (relative or absolute)" }),
|
package/src/index.ts
CHANGED
|
@@ -10,9 +10,9 @@ export {
|
|
|
10
10
|
type ModelCycleResult,
|
|
11
11
|
type PromptOptions,
|
|
12
12
|
type SessionStats,
|
|
13
|
-
} from "./core/agent-session
|
|
13
|
+
} from "./core/agent-session";
|
|
14
14
|
// Auth and model registry
|
|
15
|
-
export { type ApiKeyCredential, type AuthCredential, AuthStorage, type OAuthCredential } from "./core/auth-storage
|
|
15
|
+
export { type ApiKeyCredential, type AuthCredential, AuthStorage, type OAuthCredential } from "./core/auth-storage";
|
|
16
16
|
// Compaction
|
|
17
17
|
export {
|
|
18
18
|
type BranchPreparation,
|
|
@@ -35,7 +35,16 @@ export {
|
|
|
35
35
|
prepareBranchEntries,
|
|
36
36
|
serializeConversation,
|
|
37
37
|
shouldCompact,
|
|
38
|
-
} from "./core/compaction/index
|
|
38
|
+
} from "./core/compaction/index";
|
|
39
|
+
// Custom commands
|
|
40
|
+
export type {
|
|
41
|
+
CustomCommand,
|
|
42
|
+
CustomCommandAPI,
|
|
43
|
+
CustomCommandFactory,
|
|
44
|
+
CustomCommandSource,
|
|
45
|
+
CustomCommandsLoadResult,
|
|
46
|
+
LoadedCustomCommand,
|
|
47
|
+
} from "./core/custom-commands/types";
|
|
39
48
|
// Custom tools
|
|
40
49
|
export type {
|
|
41
50
|
AgentToolUpdateCallback,
|
|
@@ -49,9 +58,9 @@ export type {
|
|
|
49
58
|
ExecResult,
|
|
50
59
|
LoadedCustomTool,
|
|
51
60
|
RenderResultOptions,
|
|
52
|
-
} from "./core/custom-tools/index
|
|
53
|
-
export { discoverAndLoadCustomTools, loadCustomTools } from "./core/custom-tools/index
|
|
54
|
-
export type * from "./core/hooks/index
|
|
61
|
+
} from "./core/custom-tools/index";
|
|
62
|
+
export { discoverAndLoadCustomTools, loadCustomTools } from "./core/custom-tools/index";
|
|
63
|
+
export type * from "./core/hooks/index";
|
|
55
64
|
// Hook system types and type guards
|
|
56
65
|
export {
|
|
57
66
|
isBashToolResult,
|
|
@@ -61,9 +70,11 @@ export {
|
|
|
61
70
|
isLsToolResult,
|
|
62
71
|
isReadToolResult,
|
|
63
72
|
isWriteToolResult,
|
|
64
|
-
} from "./core/hooks/index
|
|
65
|
-
|
|
66
|
-
export {
|
|
73
|
+
} from "./core/hooks/index";
|
|
74
|
+
// Logging
|
|
75
|
+
export { type Logger, logger } from "./core/logger";
|
|
76
|
+
export { convertToLlm } from "./core/messages";
|
|
77
|
+
export { ModelRegistry } from "./core/model-registry";
|
|
67
78
|
// SDK for programmatic usage
|
|
68
79
|
export {
|
|
69
80
|
type BuildSystemPromptOptions,
|
|
@@ -98,7 +109,7 @@ export {
|
|
|
98
109
|
loadSettings,
|
|
99
110
|
// Pre-built tools (use process.cwd())
|
|
100
111
|
readOnlyTools,
|
|
101
|
-
} from "./core/sdk
|
|
112
|
+
} from "./core/sdk";
|
|
102
113
|
export {
|
|
103
114
|
type BranchSummaryEntry,
|
|
104
115
|
buildSessionContext,
|
|
@@ -120,7 +131,7 @@ export {
|
|
|
120
131
|
SessionManager,
|
|
121
132
|
type SessionMessageEntry,
|
|
122
133
|
type ThinkingLevelChangeEntry,
|
|
123
|
-
} from "./core/session-manager
|
|
134
|
+
} from "./core/session-manager";
|
|
124
135
|
export {
|
|
125
136
|
type CompactionSettings,
|
|
126
137
|
type LspSettings,
|
|
@@ -128,7 +139,7 @@ export {
|
|
|
128
139
|
type Settings,
|
|
129
140
|
SettingsManager,
|
|
130
141
|
type SkillsSettings,
|
|
131
|
-
} from "./core/settings-manager
|
|
142
|
+
} from "./core/settings-manager";
|
|
132
143
|
// Skills
|
|
133
144
|
export {
|
|
134
145
|
formatSkillsForPrompt,
|
|
@@ -139,7 +150,7 @@ export {
|
|
|
139
150
|
type Skill,
|
|
140
151
|
type SkillFrontmatter,
|
|
141
152
|
type SkillWarning,
|
|
142
|
-
} from "./core/skills
|
|
153
|
+
} from "./core/skills";
|
|
143
154
|
// Tools
|
|
144
155
|
export {
|
|
145
156
|
type BashToolDetails,
|
|
@@ -159,14 +170,14 @@ export {
|
|
|
159
170
|
type WriteToolDetails,
|
|
160
171
|
type WriteToolOptions,
|
|
161
172
|
writeTool,
|
|
162
|
-
} from "./core/tools/index
|
|
163
|
-
export type { FileDiagnosticsResult } from "./core/tools/lsp/index
|
|
173
|
+
} from "./core/tools/index";
|
|
174
|
+
export type { FileDiagnosticsResult } from "./core/tools/lsp/index";
|
|
164
175
|
// Main entry point
|
|
165
|
-
export { main } from "./main
|
|
176
|
+
export { main } from "./main";
|
|
166
177
|
// UI components for hooks and custom tools
|
|
167
|
-
export { BorderedLoader } from "./modes/interactive/components/bordered-loader
|
|
178
|
+
export { BorderedLoader } from "./modes/interactive/components/bordered-loader";
|
|
168
179
|
// Theme utilities for custom tools
|
|
169
|
-
export { getMarkdownTheme } from "./modes/interactive/theme/theme
|
|
180
|
+
export { getMarkdownTheme } from "./modes/interactive/theme/theme";
|
|
170
181
|
|
|
171
182
|
// TypeBox helper for string enums (convenience for custom tools)
|
|
172
183
|
import { type TSchema, Type } from "@sinclair/typebox";
|
package/src/main.ts
CHANGED
|
@@ -5,33 +5,34 @@
|
|
|
5
5
|
* createAgentSession() options. The SDK does the heavy lifting.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { existsSync } from "node:fs";
|
|
9
|
+
import { join } from "node:path";
|
|
8
10
|
import { type ImageContent, supportsXhigh } from "@oh-my-pi/pi-ai";
|
|
9
11
|
import chalk from "chalk";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import type {
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import type {
|
|
22
|
-
import type
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import { ensureTool } from "./utils/tools-manager.js";
|
|
12
|
+
import { type Args, parseArgs, printHelp } from "./cli/args";
|
|
13
|
+
import { processFileArguments } from "./cli/file-processor";
|
|
14
|
+
import { listModels } from "./cli/list-models";
|
|
15
|
+
import { parsePluginArgs, printPluginHelp, runPluginCommand } from "./cli/plugin-cli";
|
|
16
|
+
import { selectSession } from "./cli/session-picker";
|
|
17
|
+
import { parseUpdateArgs, printUpdateHelp, runUpdateCommand } from "./cli/update-cli";
|
|
18
|
+
import { CONFIG_DIR_NAME, getAgentDir, getModelsPath, VERSION } from "./config";
|
|
19
|
+
import type { AgentSession } from "./core/agent-session";
|
|
20
|
+
import type { LoadedCustomTool } from "./core/custom-tools/index";
|
|
21
|
+
import { exportFromFile } from "./core/export-html/index";
|
|
22
|
+
import type { HookUIContext } from "./core/index";
|
|
23
|
+
import type { ModelRegistry } from "./core/model-registry";
|
|
24
|
+
import { parseModelPattern, resolveModelScope, type ScopedModel } from "./core/model-resolver";
|
|
25
|
+
import { type CreateAgentSessionOptions, createAgentSession, discoverAuthStorage, discoverModels } from "./core/sdk";
|
|
26
|
+
import { SessionManager } from "./core/session-manager";
|
|
27
|
+
import { SettingsManager } from "./core/settings-manager";
|
|
28
|
+
import { resolvePromptInput } from "./core/system-prompt";
|
|
29
|
+
import { printTimings, time } from "./core/timings";
|
|
30
|
+
import { allTools } from "./core/tools/index";
|
|
31
|
+
import { runMigrations } from "./migrations";
|
|
32
|
+
import { InteractiveMode, installTerminalCrashHandlers, runPrintMode, runRpcMode } from "./modes/index";
|
|
33
|
+
import { initTheme, stopThemeWatcher } from "./modes/interactive/theme/theme";
|
|
34
|
+
import { getChangelogPath, getNewEntries, parseChangelog } from "./utils/changelog";
|
|
35
|
+
import { ensureTool } from "./utils/tools-manager";
|
|
35
36
|
|
|
36
37
|
async function checkForNewVersion(currentVersion: string): Promise<string | undefined> {
|
|
37
38
|
try {
|
|
@@ -213,12 +214,12 @@ function discoverSystemPromptFile(): string | undefined {
|
|
|
213
214
|
return undefined;
|
|
214
215
|
}
|
|
215
216
|
|
|
216
|
-
function buildSessionOptions(
|
|
217
|
+
async function buildSessionOptions(
|
|
217
218
|
parsed: Args,
|
|
218
219
|
scopedModels: ScopedModel[],
|
|
219
220
|
sessionManager: SessionManager | undefined,
|
|
220
221
|
modelRegistry: ModelRegistry,
|
|
221
|
-
): CreateAgentSessionOptions {
|
|
222
|
+
): Promise<CreateAgentSessionOptions> {
|
|
222
223
|
const options: CreateAgentSessionOptions = {};
|
|
223
224
|
|
|
224
225
|
// Auto-discover SYSTEM.md if no CLI system prompt provided
|
|
@@ -230,11 +231,15 @@ function buildSessionOptions(
|
|
|
230
231
|
options.sessionManager = sessionManager;
|
|
231
232
|
}
|
|
232
233
|
|
|
233
|
-
// Model from CLI
|
|
234
|
-
if (parsed.
|
|
235
|
-
const
|
|
234
|
+
// Model from CLI (--model) - uses same fuzzy matching as --models
|
|
235
|
+
if (parsed.model) {
|
|
236
|
+
const available = await modelRegistry.getAvailable();
|
|
237
|
+
const { model, warning } = parseModelPattern(parsed.model, available);
|
|
238
|
+
if (warning) {
|
|
239
|
+
console.warn(chalk.yellow(`Warning: ${warning}`));
|
|
240
|
+
}
|
|
236
241
|
if (!model) {
|
|
237
|
-
console.error(chalk.red(`Model ${parsed.
|
|
242
|
+
console.error(chalk.red(`Model "${parsed.model}" not found`));
|
|
238
243
|
process.exit(1);
|
|
239
244
|
}
|
|
240
245
|
options.model = model;
|
|
@@ -269,6 +274,7 @@ function buildSessionOptions(
|
|
|
269
274
|
// Tools
|
|
270
275
|
if (parsed.tools) {
|
|
271
276
|
options.tools = parsed.tools.map((name) => allTools[name]);
|
|
277
|
+
options.explicitTools = parsed.tools;
|
|
272
278
|
}
|
|
273
279
|
|
|
274
280
|
// Skills
|
|
@@ -303,6 +309,17 @@ export async function main(args: string[]) {
|
|
|
303
309
|
return;
|
|
304
310
|
}
|
|
305
311
|
|
|
312
|
+
// Handle update subcommand
|
|
313
|
+
const updateCmd = parseUpdateArgs(args);
|
|
314
|
+
if (updateCmd) {
|
|
315
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
316
|
+
printUpdateHelp();
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
await runUpdateCommand(updateCmd);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
|
|
306
323
|
// Run migrations
|
|
307
324
|
const { migratedAuthProviders: migratedProviders } = runMigrations();
|
|
308
325
|
|
|
@@ -333,7 +350,7 @@ export async function main(args: string[]) {
|
|
|
333
350
|
if (parsed.export) {
|
|
334
351
|
try {
|
|
335
352
|
const outputPath = parsed.messages.length > 0 ? parsed.messages[0] : undefined;
|
|
336
|
-
const result = exportFromFile(parsed.export, outputPath);
|
|
353
|
+
const result = await exportFromFile(parsed.export, outputPath);
|
|
337
354
|
console.log(`Exported to: ${result}`);
|
|
338
355
|
return;
|
|
339
356
|
} catch (error: unknown) {
|
|
@@ -398,7 +415,7 @@ export async function main(args: string[]) {
|
|
|
398
415
|
sessionManager = SessionManager.open(selectedPath);
|
|
399
416
|
}
|
|
400
417
|
|
|
401
|
-
const sessionOptions = buildSessionOptions(parsed, scopedModels, sessionManager, modelRegistry);
|
|
418
|
+
const sessionOptions = await buildSessionOptions(parsed, scopedModels, sessionManager, modelRegistry);
|
|
402
419
|
sessionOptions.authStorage = authStorage;
|
|
403
420
|
sessionOptions.modelRegistry = modelRegistry;
|
|
404
421
|
sessionOptions.hasUI = isInteractive;
|
package/src/migrations.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* One-time migrations that run on startup.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync } from "fs";
|
|
6
|
-
import { dirname, join } from "path";
|
|
7
|
-
import { getAgentDir } from "./config
|
|
5
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { dirname, join } from "node:path";
|
|
7
|
+
import { getAgentDir } from "./config";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Migrate legacy oauth.json and settings.json apiKeys to auth.json.
|
package/src/modes/index.ts
CHANGED
|
@@ -36,8 +36,8 @@ export function installTerminalCrashHandlers(): void {
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export { InteractiveMode } from "./interactive/interactive-mode
|
|
40
|
-
export { runPrintMode } from "./print-mode
|
|
41
|
-
export { type ModelInfo, RpcClient, type RpcClientOptions, type RpcEventListener } from "./rpc/rpc-client
|
|
42
|
-
export { runRpcMode } from "./rpc/rpc-mode
|
|
43
|
-
export type { RpcCommand, RpcResponse, RpcSessionState } from "./rpc/rpc-types
|
|
39
|
+
export { InteractiveMode } from "./interactive/interactive-mode";
|
|
40
|
+
export { runPrintMode } from "./print-mode";
|
|
41
|
+
export { type ModelInfo, RpcClient, type RpcClientOptions, type RpcEventListener } from "./rpc/rpc-client";
|
|
42
|
+
export { runRpcMode } from "./rpc/rpc-mode";
|
|
43
|
+
export type { RpcCommand, RpcResponse, RpcSessionState } from "./rpc/rpc-types";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AssistantMessage } from "@oh-my-pi/pi-ai";
|
|
2
2
|
import { Container, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui";
|
|
3
|
-
import { getMarkdownTheme, theme } from "../theme/theme
|
|
3
|
+
import { getMarkdownTheme, theme } from "../theme/theme";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Component that renders a complete assistant message
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
DEFAULT_MAX_LINES,
|
|
10
10
|
type TruncationResult,
|
|
11
11
|
truncateTail,
|
|
12
|
-
} from "../../../core/tools/truncate
|
|
13
|
-
import { theme } from "../theme/theme
|
|
14
|
-
import { DynamicBorder } from "./dynamic-border
|
|
15
|
-
import { truncateToVisualLines } from "./visual-truncate
|
|
12
|
+
} from "../../../core/tools/truncate";
|
|
13
|
+
import { theme } from "../theme/theme";
|
|
14
|
+
import { DynamicBorder } from "./dynamic-border";
|
|
15
|
+
import { truncateToVisualLines } from "./visual-truncate";
|
|
16
16
|
|
|
17
17
|
// Preview line limit when not expanded (matches tool execution behavior)
|
|
18
18
|
const PREVIEW_LINES = 20;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CancellableLoader, Container, Spacer, Text, type TUI } from "@oh-my-pi/pi-tui";
|
|
2
|
-
import type { Theme } from "../theme/theme
|
|
3
|
-
import { DynamicBorder } from "./dynamic-border
|
|
2
|
+
import type { Theme } from "../theme/theme";
|
|
3
|
+
import { DynamicBorder } from "./dynamic-border";
|
|
4
4
|
|
|
5
5
|
/** Loader wrapped with borders for hook UI */
|
|
6
6
|
export class BorderedLoader extends Container {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui";
|
|
2
|
-
import type { BranchSummaryMessage } from "../../../core/messages
|
|
3
|
-
import { getMarkdownTheme, theme } from "../theme/theme
|
|
2
|
+
import type { BranchSummaryMessage } from "../../../core/messages";
|
|
3
|
+
import { getMarkdownTheme, theme } from "../theme/theme";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Component that renders a branch summary message with collapsed/expanded state.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui";
|
|
2
|
-
import type { CompactionSummaryMessage } from "../../../core/messages
|
|
3
|
-
import { getMarkdownTheme, theme } from "../theme/theme
|
|
2
|
+
import type { CompactionSummaryMessage } from "../../../core/messages";
|
|
3
|
+
import { getMarkdownTheme, theme } from "../theme/theme";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Component that renders a compaction message with collapsed/expanded state.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { execSync } from "node:child_process";
|
|
2
|
+
import { existsSync, type FSWatcher, readFileSync, watch } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
1
4
|
import type { AssistantMessage } from "@oh-my-pi/pi-ai";
|
|
2
5
|
import { type Component, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { dirname, join } from "path";
|
|
6
|
-
import type { AgentSession } from "../../../core/agent-session.js";
|
|
7
|
-
import { theme } from "../theme/theme.js";
|
|
6
|
+
import type { AgentSession } from "../../../core/agent-session";
|
|
7
|
+
import { theme } from "../theme/theme";
|
|
8
8
|
|
|
9
9
|
// Nerd Font icons (matching Claude/statusline-nerd.sh)
|
|
10
10
|
const ICONS = {
|
|
@@ -7,8 +7,8 @@ import * as fs from "node:fs";
|
|
|
7
7
|
import * as os from "node:os";
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import { Container, Editor, isCtrlG, isEscape, Spacer, Text, type TUI } from "@oh-my-pi/pi-tui";
|
|
10
|
-
import { getEditorTheme, theme } from "../theme/theme
|
|
11
|
-
import { DynamicBorder } from "./dynamic-border
|
|
10
|
+
import { getEditorTheme, theme } from "../theme/theme";
|
|
11
|
+
import { DynamicBorder } from "./dynamic-border";
|
|
12
12
|
|
|
13
13
|
export class HookEditorComponent extends Container {
|
|
14
14
|
private editor: Editor;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { Container, Input, isEnter, isEscape, Spacer, Text } from "@oh-my-pi/pi-tui";
|
|
6
|
-
import { theme } from "../theme/theme
|
|
7
|
-
import { DynamicBorder } from "./dynamic-border
|
|
6
|
+
import { theme } from "../theme/theme";
|
|
7
|
+
import { DynamicBorder } from "./dynamic-border";
|
|
8
8
|
|
|
9
9
|
export class HookInputComponent extends Container {
|
|
10
10
|
private input: Input;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { TextContent } from "@oh-my-pi/pi-ai";
|
|
2
2
|
import type { Component } from "@oh-my-pi/pi-tui";
|
|
3
3
|
import { Box, Container, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui";
|
|
4
|
-
import type { HookMessageRenderer } from "../../../core/hooks/types
|
|
5
|
-
import type { HookMessage } from "../../../core/messages
|
|
6
|
-
import { getMarkdownTheme, theme } from "../theme/theme
|
|
4
|
+
import type { HookMessageRenderer } from "../../../core/hooks/types";
|
|
5
|
+
import type { HookMessage } from "../../../core/messages";
|
|
6
|
+
import { getMarkdownTheme, theme } from "../theme/theme";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Component that renders a custom message entry from hooks.
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { Container, isArrowDown, isArrowUp, isEnter, isEscape, Spacer, Text } from "@oh-my-pi/pi-tui";
|
|
7
|
-
import { theme } from "../theme/theme
|
|
8
|
-
import { DynamicBorder } from "./dynamic-border
|
|
7
|
+
import { theme } from "../theme/theme";
|
|
8
|
+
import { DynamicBorder } from "./dynamic-border";
|
|
9
9
|
|
|
10
10
|
export class HookSelectorComponent extends Container {
|
|
11
11
|
private options: string[];
|