@oh-my-pi/pi-coding-agent 16.0.1 → 16.0.3
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 +70 -0
- package/README.md +0 -1
- package/dist/cli.js +316 -371
- package/dist/types/advisor/advise-tool.d.ts +30 -1
- package/dist/types/commands/install.d.ts +1 -1
- package/dist/types/config/model-resolver.d.ts +22 -0
- package/dist/types/config/settings-schema.d.ts +0 -10
- package/dist/types/eval/js/shared/runtime.d.ts +1 -0
- package/dist/types/eval/js/worker-core.d.ts +1 -0
- package/dist/types/exec/non-interactive-env.d.ts +2 -0
- package/dist/types/extensibility/extensions/loader.d.ts +2 -2
- package/dist/types/goals/runtime.d.ts +0 -1
- package/dist/types/mcp/tool-bridge.d.ts +3 -0
- package/dist/types/modes/components/custom-editor.d.ts +14 -4
- package/dist/types/modes/controllers/command-controller.d.ts +1 -1
- package/dist/types/modes/interactive-mode.d.ts +1 -1
- package/dist/types/modes/setup-wizard/wizard-overlay.d.ts +3 -2
- package/dist/types/modes/theme/mermaid-cache.d.ts +18 -1
- package/dist/types/modes/types.d.ts +1 -1
- package/dist/types/registry/agent-lifecycle.d.ts +16 -1
- package/dist/types/sdk.d.ts +8 -0
- package/dist/types/session/agent-session.d.ts +20 -8
- package/dist/types/session/messages.d.ts +3 -0
- package/dist/types/session/session-dump-format.d.ts +8 -2
- package/dist/types/session/session-entries.d.ts +4 -0
- package/dist/types/session/session-history-format.d.ts +2 -0
- package/dist/types/session/session-manager.d.ts +22 -0
- package/dist/types/stt/downloader.d.ts +5 -5
- package/dist/types/task/executor.d.ts +6 -0
- package/dist/types/task/persisted-revive.d.ts +36 -0
- package/dist/types/tiny/models.d.ts +8 -0
- package/dist/types/tools/builtin-names.d.ts +1 -1
- package/dist/types/tools/index.d.ts +0 -1
- package/dist/types/utils/markit.d.ts +8 -0
- package/package.json +12 -12
- package/src/advisor/__tests__/advisor.test.ts +156 -12
- package/src/advisor/advise-tool.ts +48 -6
- package/src/advisor/runtime.ts +10 -3
- package/src/auto-thinking/classifier.ts +12 -3
- package/src/cli/args.ts +1 -0
- package/src/cli.ts +2 -2
- package/src/commands/install.ts +3 -3
- package/src/config/model-resolver.ts +63 -12
- package/src/config/settings-schema.ts +0 -11
- package/src/discovery/github.ts +89 -1
- package/src/eval/agent-bridge.ts +2 -0
- package/src/eval/js/context-manager.ts +2 -1
- package/src/eval/js/shared/runtime.ts +189 -15
- package/src/eval/js/worker-core.ts +19 -0
- package/src/exec/bash-executor.ts +2 -2
- package/src/exec/non-interactive-env.ts +71 -0
- package/src/export/html/index.ts +1 -1
- package/src/export/html/tool-views.generated.js +34 -35
- package/src/extensibility/extensions/loader.ts +21 -9
- package/src/extensibility/extensions/runner.ts +17 -1
- package/src/extensibility/plugins/loader.ts +154 -21
- package/src/extensibility/plugins/manager.ts +40 -33
- package/src/goals/runtime.ts +1 -23
- package/src/internal-urls/docs-index.generated.ts +9 -11
- package/src/main.ts +20 -0
- package/src/mcp/render.ts +11 -1
- package/src/mcp/tool-bridge.ts +3 -0
- package/src/modes/components/custom-editor.test.ts +63 -18
- package/src/modes/components/custom-editor.ts +63 -15
- package/src/modes/controllers/command-controller.ts +2 -2
- package/src/modes/controllers/input-controller.ts +15 -9
- package/src/modes/controllers/selector-controller.ts +13 -8
- package/src/modes/controllers/tan-command-controller.ts +1 -0
- package/src/modes/interactive-mode.ts +4 -2
- package/src/modes/setup-wizard/wizard-overlay.ts +26 -4
- package/src/modes/theme/mermaid-cache.ts +74 -11
- package/src/modes/theme/theme.ts +14 -1
- package/src/modes/types.ts +1 -1
- package/src/prompts/system/system-prompt.md +2 -1
- package/src/registry/agent-lifecycle.ts +60 -8
- package/src/sdk.ts +20 -26
- package/src/session/agent-session.ts +381 -110
- package/src/session/artifacts.ts +19 -1
- package/src/session/messages.ts +1 -1
- package/src/session/session-dump-format.ts +167 -23
- package/src/session/session-entries.ts +4 -0
- package/src/session/session-history-format.ts +37 -3
- package/src/session/session-manager.ts +94 -4
- package/src/slash-commands/builtin-registry.ts +4 -7
- package/src/stt/asr-client.ts +6 -0
- package/src/stt/downloader.ts +13 -6
- package/src/stt/stt-controller.ts +52 -11
- package/src/system-prompt.ts +7 -1
- package/src/task/executor.ts +118 -6
- package/src/task/index.ts +2 -2
- package/src/task/persisted-revive.ts +128 -0
- package/src/tiny/models.ts +10 -0
- package/src/tiny/worker.ts +4 -3
- package/src/tools/builtin-names.ts +0 -1
- package/src/tools/index.ts +0 -4
- package/src/tools/output-meta.ts +17 -3
- package/src/utils/lang-from-path.ts +5 -0
- package/src/utils/markit.ts +24 -1
- package/src/utils/title-generator.ts +4 -4
- package/dist/types/tools/render-mermaid.d.ts +0 -38
- package/src/prompts/tools/render-mermaid.md +0 -9
- package/src/tools/render-mermaid.ts +0 -69
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
|
|
6
6
|
import { type Api, type AssistantMessage, completeSimple, type Model, type Tool } from "@oh-my-pi/pi-ai";
|
|
7
|
-
import { logger, prompt } from "@oh-my-pi/pi-utils";
|
|
7
|
+
import { isTerminalHeadless, logger, prompt } from "@oh-my-pi/pi-utils";
|
|
8
8
|
import type { ModelRegistry } from "../config/model-registry";
|
|
9
9
|
|
|
10
10
|
import { resolveRoleSelection } from "../config/model-resolver";
|
|
@@ -391,7 +391,7 @@ export function formatSessionTerminalTitle(sessionName: string | undefined, cwd?
|
|
|
391
391
|
* Set the terminal title using OSC 0 (sets both tab and window title). Unsupported terminals ignore it.
|
|
392
392
|
*/
|
|
393
393
|
export function setTerminalTitle(title: string): void {
|
|
394
|
-
if (!process.stdout.isTTY) return;
|
|
394
|
+
if (!process.stdout.isTTY || isTerminalHeadless()) return;
|
|
395
395
|
process.stdout.write(`\x1b]0;${sanitizeTerminalTitlePart(title) ?? DEFAULT_TERMINAL_TITLE}\x07`);
|
|
396
396
|
}
|
|
397
397
|
|
|
@@ -403,7 +403,7 @@ export function setSessionTerminalTitle(sessionName: string | undefined, cwd?: s
|
|
|
403
403
|
* Save the current terminal title on terminals that support xterm window ops.
|
|
404
404
|
*/
|
|
405
405
|
export function pushTerminalTitle(): void {
|
|
406
|
-
if (!process.stdout.isTTY) return;
|
|
406
|
+
if (!process.stdout.isTTY || isTerminalHeadless()) return;
|
|
407
407
|
process.stdout.write("\x1b[22;2t");
|
|
408
408
|
}
|
|
409
409
|
|
|
@@ -411,6 +411,6 @@ export function pushTerminalTitle(): void {
|
|
|
411
411
|
* Restore the previously saved terminal title on terminals that support xterm window ops.
|
|
412
412
|
*/
|
|
413
413
|
export function popTerminalTitle(): void {
|
|
414
|
-
if (!process.stdout.isTTY) return;
|
|
414
|
+
if (!process.stdout.isTTY || isTerminalHeadless()) return;
|
|
415
415
|
process.stdout.write("\x1b[23;2t");
|
|
416
416
|
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
|
2
|
-
import { z } from "zod/v4";
|
|
3
|
-
import type { ToolSession } from "./index";
|
|
4
|
-
declare const renderMermaidSchema: z.ZodObject<{
|
|
5
|
-
mermaid: z.ZodString;
|
|
6
|
-
config: z.ZodOptional<z.ZodObject<{
|
|
7
|
-
useAscii: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
-
paddingX: z.ZodOptional<z.ZodNumber>;
|
|
9
|
-
paddingY: z.ZodOptional<z.ZodNumber>;
|
|
10
|
-
boxBorderPadding: z.ZodOptional<z.ZodNumber>;
|
|
11
|
-
}, z.core.$strip>>;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
|
-
type RenderMermaidParams = z.infer<typeof renderMermaidSchema>;
|
|
14
|
-
export interface RenderMermaidToolDetails {
|
|
15
|
-
artifactId?: string;
|
|
16
|
-
}
|
|
17
|
-
export declare class RenderMermaidTool implements AgentTool<typeof renderMermaidSchema, RenderMermaidToolDetails> {
|
|
18
|
-
private readonly session;
|
|
19
|
-
readonly name = "render_mermaid";
|
|
20
|
-
readonly approval: "read";
|
|
21
|
-
readonly label = "RenderMermaid";
|
|
22
|
-
readonly summary = "Render a Mermaid diagram to an image";
|
|
23
|
-
readonly description: string;
|
|
24
|
-
readonly parameters: z.ZodObject<{
|
|
25
|
-
mermaid: z.ZodString;
|
|
26
|
-
config: z.ZodOptional<z.ZodObject<{
|
|
27
|
-
useAscii: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
-
paddingX: z.ZodOptional<z.ZodNumber>;
|
|
29
|
-
paddingY: z.ZodOptional<z.ZodNumber>;
|
|
30
|
-
boxBorderPadding: z.ZodOptional<z.ZodNumber>;
|
|
31
|
-
}, z.core.$strip>>;
|
|
32
|
-
}, z.core.$strip>;
|
|
33
|
-
readonly strict = true;
|
|
34
|
-
readonly loadMode = "discoverable";
|
|
35
|
-
constructor(session: ToolSession);
|
|
36
|
-
execute(_toolCallId: string, params: RenderMermaidParams, _signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<RenderMermaidToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<RenderMermaidToolDetails>>;
|
|
37
|
-
}
|
|
38
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
Convert Mermaid graph source into ASCII diagram output.
|
|
2
|
-
|
|
3
|
-
Parameters:
|
|
4
|
-
- `mermaid` (required): Mermaid graph text to render.
|
|
5
|
-
- `config` (optional): JSON render configuration (spacing and layout options).
|
|
6
|
-
|
|
7
|
-
Behavior:
|
|
8
|
-
- Returns ASCII diagram text.
|
|
9
|
-
- Saves full output to `artifact://<id>`.
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
|
2
|
-
import { type MermaidAsciiRenderOptions, prompt, renderMermaidAscii } from "@oh-my-pi/pi-utils";
|
|
3
|
-
import { z } from "zod/v4";
|
|
4
|
-
import renderMermaidDescription from "../prompts/tools/render-mermaid.md" with { type: "text" };
|
|
5
|
-
import type { ToolSession } from "./index";
|
|
6
|
-
|
|
7
|
-
const renderMermaidSchema = z.object({
|
|
8
|
-
mermaid: z.string().describe("mermaid source"),
|
|
9
|
-
config: z
|
|
10
|
-
.object({
|
|
11
|
-
useAscii: z.boolean().optional(),
|
|
12
|
-
paddingX: z.number().optional(),
|
|
13
|
-
paddingY: z.number().optional(),
|
|
14
|
-
boxBorderPadding: z.number().optional(),
|
|
15
|
-
})
|
|
16
|
-
.optional(),
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
type RenderMermaidParams = z.infer<typeof renderMermaidSchema>;
|
|
20
|
-
|
|
21
|
-
function sanitizeRenderConfig(config: MermaidAsciiRenderOptions | undefined): MermaidAsciiRenderOptions | undefined {
|
|
22
|
-
if (!config) return undefined;
|
|
23
|
-
return {
|
|
24
|
-
useAscii: config.useAscii,
|
|
25
|
-
boxBorderPadding:
|
|
26
|
-
config.boxBorderPadding === undefined ? undefined : Math.max(0, Math.floor(config.boxBorderPadding)),
|
|
27
|
-
paddingX: config.paddingX === undefined ? undefined : Math.max(0, Math.floor(config.paddingX)),
|
|
28
|
-
paddingY: config.paddingY === undefined ? undefined : Math.max(0, Math.floor(config.paddingY)),
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
export interface RenderMermaidToolDetails {
|
|
32
|
-
artifactId?: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export class RenderMermaidTool implements AgentTool<typeof renderMermaidSchema, RenderMermaidToolDetails> {
|
|
36
|
-
readonly name = "render_mermaid";
|
|
37
|
-
readonly approval = "read" as const;
|
|
38
|
-
readonly label = "RenderMermaid";
|
|
39
|
-
readonly summary = "Render a Mermaid diagram to an image";
|
|
40
|
-
readonly description: string;
|
|
41
|
-
readonly parameters = renderMermaidSchema;
|
|
42
|
-
readonly strict = true;
|
|
43
|
-
readonly loadMode = "discoverable";
|
|
44
|
-
|
|
45
|
-
constructor(private readonly session: ToolSession) {
|
|
46
|
-
this.description = prompt.render(renderMermaidDescription);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async execute(
|
|
50
|
-
_toolCallId: string,
|
|
51
|
-
params: RenderMermaidParams,
|
|
52
|
-
_signal?: AbortSignal,
|
|
53
|
-
_onUpdate?: AgentToolUpdateCallback<RenderMermaidToolDetails>,
|
|
54
|
-
_context?: AgentToolContext,
|
|
55
|
-
): Promise<AgentToolResult<RenderMermaidToolDetails>> {
|
|
56
|
-
const ascii = renderMermaidAscii(params.mermaid, sanitizeRenderConfig(params.config));
|
|
57
|
-
const { path: artifactPath, id: artifactId } =
|
|
58
|
-
(await this.session.allocateOutputArtifact?.("render_mermaid")) ?? {};
|
|
59
|
-
if (artifactPath) {
|
|
60
|
-
await Bun.write(artifactPath, ascii);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const artifactLine = artifactId ? `\n\nSaved artifact: artifact://${artifactId}` : "";
|
|
64
|
-
return {
|
|
65
|
-
content: [{ type: "text", text: `${ascii}${artifactLine}` }],
|
|
66
|
-
details: { artifactId },
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
}
|