@jameslovespancakes/pi-plus 1.0.19 → 1.0.21
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/README.md +133 -246
- package/package.json +3 -2
- package/src/core/claude-remote/LICENSE.md +22 -0
- package/src/core/claude-remote/UPSTREAM.md +40 -0
- package/src/core/claude-remote/bridge.ts +392 -0
- package/src/core/claude-remote/protocol.ts +83 -0
- package/src/core/env.ts +7 -1
- package/src/domains/claude-remote/auth.ts +25 -0
- package/src/domains/claude-remote/index.ts +183 -0
- package/src/domains/claude-remote/picker.ts +36 -0
- package/src/domains/models/provider-picker.ts +3 -46
- package/src/domains/setup/index.ts +12 -1
- package/src/domains/workflows/index.ts +56 -104
- package/src/domains/workflows/runtime/advisory-challenge.ts +3 -3
- package/src/domains/workflows/runtime/agent-attempt.ts +3 -3
- package/src/domains/workflows/runtime/agent-options.ts +18 -0
- package/src/domains/workflows/runtime/agent-runner-types.ts +7 -3
- package/src/domains/workflows/runtime/agent-runner.ts +14 -6
- package/src/domains/workflows/runtime/agent-session.ts +34 -3
- package/src/domains/workflows/runtime/cancellation.ts +5 -0
- package/src/domains/workflows/runtime/engine.ts +19 -40
- package/src/domains/workflows/runtime/journal.ts +4 -4
- package/src/domains/workflows/runtime/live-agent.ts +37 -0
- package/src/domains/workflows/runtime/model-profiles.ts +2 -6
- package/src/domains/workflows/runtime/progress-types.ts +3 -1
- package/src/domains/workflows/runtime/progress.ts +69 -42
- package/src/domains/workflows/runtime/review/review-fix-workflow.ts +3 -3
- package/src/domains/workflows/runtime/types.ts +16 -15
- package/src/domains/workflows/runtime/ui/agent-transcript.ts +59 -0
- package/src/domains/workflows/runtime/ui/workflow-format.ts +6 -2
- package/src/domains/workflows/runtime/ui/workflow-inspector.ts +75 -61
- package/src/domains/workflows/runtime/ui/workflow-widget.ts +26 -66
- package/src/domains/workflows/runtime/workflow-advisory-utils.ts +5 -5
- package/src/domains/workflows/runtime/{background-workflows.ts → workflow-lifecycle.ts} +91 -75
- package/src/domains/workflows/runtime/workflow-management.ts +66 -0
- package/src/domains/workflows/runtime/workflow-run-controller.ts +16 -20
- package/src/domains/workflows/runtime/{workflow-run-background.ts → workflow-run-delivery.ts} +3 -3
- package/src/domains/workflows/runtime/workflow-run-record.ts +7 -4
- package/src/domains/workflows/workflows/code-review.ts +1 -1
- package/src/domains/workflows/workflows/diagnose.ts +1 -1
- package/src/domains/workflows/workflows/perf-review.ts +1 -1
- package/src/domains/workflows/workflows/refactor-scout.ts +1 -1
- package/src/domains/workflows/workflows/research.ts +4 -4
- package/src/ui/settings-picker.ts +26 -0
- package/src/domains/workflows/runtime/background-workflow-tool.ts +0 -75
|
@@ -64,7 +64,7 @@ export default async function run(api: WorkflowApi): Promise<unknown> {
|
|
|
64
64
|
"Inspect repository structure, scripts, likely hot-path files, and any existing benchmark or measurement commands. " +
|
|
65
65
|
"Prefer identifying what to measure before claiming bottlenecks. Return files, commands, summary, and known measurements or the lack of them. " +
|
|
66
66
|
`This workflow will fan out across ${PERF_LENSES.length} lenses with up to ${PER_LENS} candidates per lens. Structured output only.`,
|
|
67
|
-
{ phase: "Scope", label: "scope", tools: DEFAULT_ADVISORY_TOOLS, toolHints: DEFAULT_ADVISORY_TOOL_HINTS,
|
|
67
|
+
{ phase: "Scope", label: "scope", tools: DEFAULT_ADVISORY_TOOLS, toolHints: DEFAULT_ADVISORY_TOOL_HINTS, ...api.modelProfile("medium"), schema: ScopeSchema },
|
|
68
68
|
);
|
|
69
69
|
|
|
70
70
|
if (!scope || scope.files.length === 0) {
|
|
@@ -63,7 +63,7 @@ export default async function run(api: WorkflowApi): Promise<unknown> {
|
|
|
63
63
|
"Inspect repository structure, the target path or module, and relevant AGENTS.md / project docs conventions. " +
|
|
64
64
|
"Return the concrete files that should be considered, a short summary, and any conventions that affect refactor advice. " +
|
|
65
65
|
`This workflow will fan out across ${REFACTOR_LENSES.length} lenses with up to ${PER_LENS} candidates per lens. Structured output only.`,
|
|
66
|
-
{ phase: "Scope", label: "scope", tools: DEFAULT_ADVISORY_TOOLS, toolHints: DEFAULT_ADVISORY_TOOL_HINTS,
|
|
66
|
+
{ phase: "Scope", label: "scope", tools: DEFAULT_ADVISORY_TOOLS, toolHints: DEFAULT_ADVISORY_TOOL_HINTS, ...api.modelProfile("medium"), schema: ScopeSchema },
|
|
67
67
|
);
|
|
68
68
|
|
|
69
69
|
if (!scope || scope.files.length === 0) {
|
|
@@ -50,7 +50,7 @@ export default async function run(api: WorkflowApi): Promise<ResearchReport> {
|
|
|
50
50
|
tools: EXTERNAL_TOOLS,
|
|
51
51
|
toolHints: EXTERNAL_TOOL_HINTS,
|
|
52
52
|
requireToolHints: true,
|
|
53
|
-
|
|
53
|
+
...api.modelProfile("medium"),
|
|
54
54
|
resume: "off",
|
|
55
55
|
schema: ResearchPlanSchema,
|
|
56
56
|
},
|
|
@@ -85,7 +85,7 @@ export default async function run(api: WorkflowApi): Promise<ResearchReport> {
|
|
|
85
85
|
tools: EXTERNAL_TOOLS,
|
|
86
86
|
toolHints: EXTERNAL_TOOL_HINTS,
|
|
87
87
|
requireToolHints: true,
|
|
88
|
-
|
|
88
|
+
...api.modelProfile("small"),
|
|
89
89
|
resume: "off",
|
|
90
90
|
schema: ResearchLaneResultSchema,
|
|
91
91
|
},
|
|
@@ -120,7 +120,7 @@ export default async function run(api: WorkflowApi): Promise<ResearchReport> {
|
|
|
120
120
|
tools: EXTERNAL_TOOLS,
|
|
121
121
|
toolHints: EXTERNAL_TOOL_HINTS,
|
|
122
122
|
requireToolHints: true,
|
|
123
|
-
|
|
123
|
+
...api.modelProfile("medium"),
|
|
124
124
|
resume: "off",
|
|
125
125
|
schema: ResearchVerificationSchema,
|
|
126
126
|
});
|
|
@@ -146,7 +146,7 @@ export default async function run(api: WorkflowApi): Promise<ResearchReport> {
|
|
|
146
146
|
phase: "Synthesize",
|
|
147
147
|
label: "synthesize",
|
|
148
148
|
tools: [],
|
|
149
|
-
|
|
149
|
+
...api.modelProfile("medium"),
|
|
150
150
|
resume: "off",
|
|
151
151
|
schema: ResearchReportSchema,
|
|
152
152
|
},
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { truncateToWidth, type Component, type SettingsListTheme } from "@earendil-works/pi-tui";
|
|
2
|
+
|
|
3
|
+
/** Shared inline chrome for provider-style SettingsList pickers. */
|
|
4
|
+
export function frameSettings(theme: any, list: Component, title: string): Component {
|
|
5
|
+
const rule = (width: number) => theme.fg("accent", "─".repeat(width));
|
|
6
|
+
return {
|
|
7
|
+
invalidate: () => list.invalidate(),
|
|
8
|
+
handleInput: (data) => list.handleInput?.(data),
|
|
9
|
+
handleMouse: (event) => list.handleMouse?.(event),
|
|
10
|
+
render(width) {
|
|
11
|
+
const inner = Math.max(1, width);
|
|
12
|
+
return [rule(inner), truncateToWidth(` ${theme.fg("accent", theme.bold(title))}`, inner, ""),
|
|
13
|
+
...list.render(inner), rule(inner)];
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function settingsTheme(theme: any): SettingsListTheme {
|
|
19
|
+
return {
|
|
20
|
+
label: (text, selected) => selected ? theme.fg("accent", text) : text,
|
|
21
|
+
value: (text) => text,
|
|
22
|
+
description: (text) => theme.fg("dim", text),
|
|
23
|
+
cursor: theme.fg("accent", "›"),
|
|
24
|
+
hint: (text) => theme.fg("dim", text),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { BackgroundWorkflowCoordinator, backgroundOrigin } from "./background-workflows.ts";
|
|
3
|
-
import { createWorkflowRunId } from "./journal.ts";
|
|
4
|
-
import type { ResolvedWorkflowRunOptions } from "./options.ts";
|
|
5
|
-
import { unknownErrorMessage } from "./unknown-error.ts";
|
|
6
|
-
|
|
7
|
-
export interface BackgroundWorkflowToolResult {
|
|
8
|
-
readonly content: Array<{ readonly type: "text"; readonly text: string }>;
|
|
9
|
-
readonly details: Readonly<Record<string, unknown>>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface BackgroundWorkflowToolStartInput {
|
|
13
|
-
readonly coordinator: BackgroundWorkflowCoordinator;
|
|
14
|
-
readonly ctx: ExtensionContext;
|
|
15
|
-
readonly name: string;
|
|
16
|
-
readonly options: ResolvedWorkflowRunOptions;
|
|
17
|
-
readonly execute: (ctx: ExtensionContext, options: ResolvedWorkflowRunOptions) => Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function backgroundUnavailableResult(mode: ExtensionContext["mode"]): BackgroundWorkflowToolResult | undefined {
|
|
21
|
-
if (mode !== "print" && mode !== "json") return undefined;
|
|
22
|
-
return {
|
|
23
|
-
content: [{
|
|
24
|
-
type: "text",
|
|
25
|
-
text: `Background workflows are unavailable in ${mode} mode because pi exits after the prompt. Run synchronously or use TUI/RPC mode.`,
|
|
26
|
-
}],
|
|
27
|
-
details: { error: "background_unavailable", mode },
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export async function startBackgroundWorkflowTool(
|
|
32
|
-
input: BackgroundWorkflowToolStartInput,
|
|
33
|
-
): Promise<BackgroundWorkflowToolResult> {
|
|
34
|
-
const runId = createWorkflowRunId();
|
|
35
|
-
const backgroundOptions: ResolvedWorkflowRunOptions = {
|
|
36
|
-
...input.options,
|
|
37
|
-
inspect: false,
|
|
38
|
-
resultViewer: "skip",
|
|
39
|
-
runId,
|
|
40
|
-
background: backgroundOrigin(input.ctx),
|
|
41
|
-
};
|
|
42
|
-
try {
|
|
43
|
-
await input.coordinator.start({
|
|
44
|
-
ctx: input.ctx,
|
|
45
|
-
runId,
|
|
46
|
-
name: input.name,
|
|
47
|
-
run: async (signal, onStarted) => {
|
|
48
|
-
await input.execute(
|
|
49
|
-
{ ...input.ctx, signal },
|
|
50
|
-
{
|
|
51
|
-
...backgroundOptions,
|
|
52
|
-
signal,
|
|
53
|
-
onRunMetadata(metadata) {
|
|
54
|
-
onStarted();
|
|
55
|
-
return backgroundOptions.onRunMetadata?.(metadata);
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
);
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
} catch (error) {
|
|
62
|
-
const message = unknownErrorMessage(error);
|
|
63
|
-
return {
|
|
64
|
-
content: [{ type: "text", text: `Background workflow did not start: ${message}` }],
|
|
65
|
-
details: { error: "background_start_failed", message, runId },
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
content: [{
|
|
70
|
-
type: "text",
|
|
71
|
-
text: `Background workflow "${input.name}" started.\nRun ID: ${runId}\nDurable record: .pi/.workflow-runs/${runId}.run.json`,
|
|
72
|
-
}],
|
|
73
|
-
details: { background: true, state: "running", name: input.name, runId },
|
|
74
|
-
};
|
|
75
|
-
}
|