ultimate-pi 0.6.1 → 0.8.0
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/.agents/skills/harness-decisions/SKILL.md +20 -1
- package/.agents/skills/harness-eval/SKILL.md +11 -13
- package/.agents/skills/harness-orchestration/SKILL.md +36 -30
- package/.agents/skills/harness-plan/SKILL.md +13 -14
- package/.agents/skills/harness-sentrux-setup/SKILL.md +3 -4
- package/.pi/PACKAGING.md +1 -1
- package/.pi/agents/harness/adversary.md +20 -12
- package/.pi/agents/harness/evaluator.md +25 -14
- package/.pi/agents/harness/executor.md +27 -16
- package/.pi/agents/harness/incident-recorder.md +37 -0
- package/.pi/agents/harness/meta-optimizer.md +18 -15
- package/.pi/agents/harness/planner.md +27 -30
- package/.pi/agents/harness/tie-breaker.md +4 -2
- package/.pi/agents/harness/trace-librarian.md +18 -11
- package/.pi/agents/pi-pi/ext-expert.md +1 -1
- package/.pi/agents/pi-pi/keybinding-expert.md +1 -1
- package/.pi/agents/pi-pi/tui-expert.md +3 -3
- package/.pi/extensions/00-ultimate-pi-system-prompt.ts +194 -0
- package/.pi/extensions/budget-guard.ts +11 -3
- package/.pi/extensions/custom-footer.ts +8 -3
- package/.pi/extensions/custom-header.ts +2 -2
- package/.pi/extensions/debate-orchestrator.ts +11 -3
- package/.pi/extensions/dotenv-loader.ts +1 -1
- package/.pi/extensions/drift-monitor.ts +1 -1
- package/.pi/extensions/harness-ask-user.ts +1 -1
- package/.pi/extensions/harness-live-widget.ts +11 -4
- package/.pi/extensions/harness-run-context.ts +745 -0
- package/.pi/extensions/harness-telemetry.ts +1 -1
- package/.pi/extensions/harness-web-guard.ts +1 -1
- package/.pi/extensions/harness-web-tools.ts +1 -1
- package/.pi/extensions/lib/ask-user/dialog.ts +2 -2
- package/.pi/extensions/lib/ask-user/fallback.ts +1 -1
- package/.pi/extensions/lib/ask-user/render.ts +3 -3
- package/.pi/extensions/lib/harness-subagents/agent-loader.ts +1 -1
- package/.pi/extensions/lib/harness-subagents/agent-parser.ts +1 -1
- package/.pi/extensions/lib/harness-subagents/blackboard-tool.ts +1 -1
- package/.pi/extensions/lib/harness-subagents/harness-subagent-policy.ts +134 -0
- package/.pi/extensions/lib/harness-subagents/vendored/agent-manager.ts +2 -2
- package/.pi/extensions/lib/harness-subagents/vendored/agent-runner.ts +9 -5
- package/.pi/extensions/lib/harness-subagents/vendored/context.ts +1 -1
- package/.pi/extensions/lib/harness-subagents/vendored/env.ts +1 -1
- package/.pi/extensions/lib/harness-subagents/vendored/index.ts +2 -2
- package/.pi/extensions/lib/harness-subagents/vendored/output-file.ts +1 -1
- package/.pi/extensions/lib/harness-subagents/vendored/schedule.ts +1 -1
- package/.pi/extensions/lib/harness-subagents/vendored/settings.ts +1 -1
- package/.pi/extensions/lib/harness-subagents/vendored/skill-loader.ts +1 -1
- package/.pi/extensions/lib/harness-subagents/vendored/types.ts +2 -2
- package/.pi/extensions/lib/harness-subagents/vendored/ui/agent-widget.ts +1 -1
- package/.pi/extensions/lib/harness-subagents/vendored/ui/conversation-viewer.ts +2 -2
- package/.pi/extensions/lib/harness-subagents/vendored/ui/schedule-menu.ts +1 -1
- package/.pi/extensions/observation-bus.ts +8 -10
- package/.pi/extensions/pi-model-router-harness.ts +1 -1
- package/.pi/extensions/policy-gate.ts +136 -84
- package/.pi/extensions/provider-payload-sanitize.ts +1 -1
- package/.pi/extensions/review-integrity.ts +76 -22
- package/.pi/extensions/sentrux-rules-sync.ts +1 -1
- package/.pi/extensions/soundboard.ts +1 -1
- package/.pi/extensions/test-diff-integrity.ts +1 -1
- package/.pi/extensions/trace-recorder.ts +81 -21
- package/.pi/extensions/ultimate-pi-vcc.ts +1 -1
- package/.pi/harness/README.md +2 -0
- package/.pi/harness/agents.manifest.json +17 -13
- package/.pi/harness/docs/adrs/0009-sentrux-rules-lifecycle.md +1 -1
- package/.pi/harness/docs/adrs/0031-harness-run-context.md +41 -0
- package/.pi/harness/docs/adrs/0032-harness-command-orchestration.md +37 -0
- package/.pi/harness/docs/adrs/README.md +2 -0
- package/.pi/harness/evals/smoke/run-context.fixture.json +17 -0
- package/.pi/harness/specs/harness-run-context.schema.json +80 -0
- package/.pi/harness/specs/harness-spawn-context.schema.json +65 -0
- package/.pi/lib/harness-agent-output.ts +41 -0
- package/.pi/lib/harness-run-context.ts +1139 -0
- package/.pi/lib/harness-ui-state.ts +12 -1
- package/.pi/prompts/harness-abort.md +9 -6
- package/.pi/prompts/harness-auto.md +36 -61
- package/.pi/prompts/harness-critic.md +17 -32
- package/.pi/prompts/harness-eval.md +22 -30
- package/.pi/prompts/harness-incident.md +17 -34
- package/.pi/prompts/harness-plan.md +32 -36
- package/.pi/prompts/harness-review.md +18 -33
- package/.pi/prompts/harness-router-tune.md +16 -38
- package/.pi/prompts/harness-run.md +23 -40
- package/.pi/prompts/harness-setup.md +7 -27
- package/.pi/prompts/harness-trace.md +15 -34
- package/.pi/scripts/harness-generate-model-router.mjs +16 -13
- package/.pi/scripts/harness-verify.mjs +34 -0
- package/.pi/scripts/vendor-sync-pi-model-router.sh +10 -10
- package/CHANGELOG.md +34 -1
- package/README.md +31 -15
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/package.json +14 -9
- package/vendor/pi-model-router/UPSTREAM_PIN.md +1 -1
- package/vendor/pi-model-router/extensions/commands.ts +2 -2
- package/vendor/pi-model-router/extensions/config.ts +2 -2
- package/vendor/pi-model-router/extensions/index.ts +1 -1
- package/vendor/pi-model-router/extensions/provider.ts +2 -2
- package/vendor/pi-model-router/extensions/routing.ts +2 -2
- package/vendor/pi-model-router/extensions/types.ts +1 -1
- package/vendor/pi-model-router/extensions/ui.ts +1 -1
- package/vendor/pi-model-router/package.json +4 -4
- package/vendor/pi-vcc/index.ts +1 -1
- package/vendor/pi-vcc/package.json +1 -1
- package/vendor/pi-vcc/src/commands/pi-vcc.ts +1 -1
- package/vendor/pi-vcc/src/commands/vcc-recall.ts +1 -1
- package/vendor/pi-vcc/src/core/content.ts +1 -1
- package/vendor/pi-vcc/src/core/load-messages.ts +1 -1
- package/vendor/pi-vcc/src/core/normalize.ts +1 -1
- package/vendor/pi-vcc/src/core/render-entries.ts +1 -1
- package/vendor/pi-vcc/src/core/report.ts +1 -1
- package/vendor/pi-vcc/src/core/search-entries.ts +1 -1
- package/vendor/pi-vcc/src/core/summarize.ts +1 -1
- package/vendor/pi-vcc/src/hooks/before-compact.ts +2 -2
- package/vendor/pi-vcc/src/tools/recall.ts +1 -1
- package/vendor/pi-vcc/src/types.ts +1 -1
- package/vendor/pi-vcc/tests/fixtures.ts +1 -1
- package/vendor/pi-vcc/tests/render-entries.test.ts +1 -1
- package/vendor/pi-vcc/tests/search-entries.test.ts +1 -1
- package/vendor/pi-vcc/tests/support/load-session.ts +2 -2
|
@@ -1,32 +1,39 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Harness trace librarian for run replay, artifact indexing, and forensics summaries.
|
|
3
|
-
tools: read,
|
|
3
|
+
tools: read, grep, find, ls
|
|
4
|
+
extensions: false
|
|
4
5
|
thinking: medium
|
|
5
6
|
max_turns: 20
|
|
7
|
+
inherit_context: false
|
|
6
8
|
---
|
|
7
9
|
|
|
8
10
|
You are the Harness Trace Librarian.
|
|
9
11
|
|
|
10
12
|
## Mission
|
|
11
13
|
|
|
12
|
-
Maintain replayable trace narratives and artifact integrity checks.
|
|
14
|
+
Maintain replayable trace narratives and artifact integrity checks from `HarnessSpawnContext` (`run_dir`, optional `--phase` filter).
|
|
13
15
|
|
|
14
16
|
## Process
|
|
15
17
|
|
|
16
|
-
1. Gather trace and artifact records
|
|
17
|
-
2. Index artifacts by
|
|
18
|
+
1. Gather trace and artifact records from `.pi/harness/runs/<run_id>/` and spawn context paths.
|
|
19
|
+
2. Index artifacts by phase: `plan`, `execute`, `evaluate`, `adversary`, `merge`.
|
|
18
20
|
3. Surface missing artifacts required by strict pre-PR gates.
|
|
19
21
|
4. Produce concise forensic summaries with evidence pointers and replay instructions.
|
|
20
22
|
|
|
21
23
|
## Guardrails
|
|
22
24
|
|
|
23
|
-
-
|
|
24
|
-
- Only report artifacts
|
|
25
|
-
- Never speculate
|
|
26
|
-
- Keep references stable and machine-readable.
|
|
25
|
+
- Read-only — no mutations.
|
|
26
|
+
- Only report artifacts for the requested run/phases.
|
|
27
|
+
- Never speculate without checking canonical run locations.
|
|
27
28
|
|
|
28
29
|
## Output
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"trace_completeness": "complete",
|
|
34
|
+
"timeline_summary": "…",
|
|
35
|
+
"artifact_index": {},
|
|
36
|
+
"missing_artifacts": [],
|
|
37
|
+
"next_command_hint": "/harness-review"
|
|
38
|
+
}
|
|
39
|
+
```
|
|
@@ -19,7 +19,7 @@ You are an extensions expert for the Pi coding agent. You know EVERYTHING about
|
|
|
19
19
|
- Flags via `pi.registerFlag()`
|
|
20
20
|
- State management via tool result details and `pi.appendEntry()`
|
|
21
21
|
- Custom rendering via renderCall/renderResult
|
|
22
|
-
- Available imports: `@
|
|
22
|
+
- Available imports: `@earendil-works/pi-coding-agent`, `@sinclair/typebox`, `@earendil-works/pi-ai` (StringEnum), `@earendil-works/pi-tui`
|
|
23
23
|
- System prompt override via before_agent_start
|
|
24
24
|
- Context manipulation via context event
|
|
25
25
|
- Tool blocking and result modification
|
|
@@ -87,7 +87,7 @@ This is CRITICAL for building extensions that work on macOS:
|
|
|
87
87
|
- When a reserved action is remapped away from a key, that key becomes available for extensions
|
|
88
88
|
- The conflict check uses EFFECTIVE keybindings (after user remaps), not defaults
|
|
89
89
|
|
|
90
|
-
### Key Helper (from @
|
|
90
|
+
### Key Helper (from @earendil-works/pi-tui)
|
|
91
91
|
|
|
92
92
|
- `Key.ctrl("x")` → `"ctrl+x"`
|
|
93
93
|
- `Key.shift("tab")` → `"shift+tab"`
|
|
@@ -19,7 +19,7 @@ You are a TUI (Terminal User Interface) expert for the Pi coding agent. You know
|
|
|
19
19
|
- wantsKeyRelease? — for Kitty protocol key release events
|
|
20
20
|
- invalidate() — clear cached render state
|
|
21
21
|
|
|
22
|
-
### Built-in Components (from @
|
|
22
|
+
### Built-in Components (from @earendil-works/pi-tui)
|
|
23
23
|
|
|
24
24
|
- Text: multi-line text with word wrapping, paddingX, paddingY, background function
|
|
25
25
|
- Box: container with padding and background color
|
|
@@ -30,7 +30,7 @@ You are a TUI (Terminal User Interface) expert for the Pi coding agent. You know
|
|
|
30
30
|
- SelectList: selection dialog with theme, onSelect/onCancel
|
|
31
31
|
- SettingsList: toggle settings with theme
|
|
32
32
|
|
|
33
|
-
### From @
|
|
33
|
+
### From @earendil-works/pi-coding-agent
|
|
34
34
|
|
|
35
35
|
- DynamicBorder: border with color function — ALWAYS type the param: `(s: string) => theme.fg("accent", s)`
|
|
36
36
|
- BorderedLoader: spinner with abort support
|
|
@@ -93,7 +93,7 @@ Then read the fetched file. Also search the local codebase for existing TUI comp
|
|
|
93
93
|
## How to Respond
|
|
94
94
|
|
|
95
95
|
- Provide COMPLETE, WORKING component code
|
|
96
|
-
- Include all imports from @
|
|
96
|
+
- Include all imports from @earendil-works/pi-tui and @earendil-works/pi-coding-agent
|
|
97
97
|
- Show the ctx.ui.custom() wrapper for interactive components
|
|
98
98
|
- Handle invalidation properly for theme changes
|
|
99
99
|
- Include keyboard input handling where relevant
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System prompt for ultimate-pi end users:
|
|
3
|
+
* 1. Workspace override: `cwd/.pi/system.md` (lowercase)
|
|
4
|
+
* 2. Package default: `<ultimate-pi>/.pi/SYSTEM.md` (via package root resolution)
|
|
5
|
+
*
|
|
6
|
+
* Does not copy or seed workspace files. Uses `before_agent_start` →
|
|
7
|
+
* `systemPrompt` replacement (runs early via `00-` prefix so harness extensions
|
|
8
|
+
* can still append).
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import type {
|
|
14
|
+
BuildSystemPromptOptions,
|
|
15
|
+
ExtensionAPI,
|
|
16
|
+
} from "@earendil-works/pi-coding-agent";
|
|
17
|
+
import { formatSkillsForPrompt } from "@earendil-works/pi-coding-agent";
|
|
18
|
+
import { resolveHarnessAsset } from "./lib/harness-paths.js";
|
|
19
|
+
|
|
20
|
+
// @ts-expect-error pi extensions run as ESM
|
|
21
|
+
const MODULE_URL = import.meta.url;
|
|
22
|
+
|
|
23
|
+
/** Workspace override path (lowercase only — not Pi's SYSTEM.md discovery). */
|
|
24
|
+
const WORKSPACE_SYSTEM_MD = join(".pi", "system.md");
|
|
25
|
+
|
|
26
|
+
/** Mirror Pi `buildSystemPrompt` customPrompt branch (see system-prompt.js). */
|
|
27
|
+
function buildFromCustomPrompt(
|
|
28
|
+
customPrompt: string,
|
|
29
|
+
options: BuildSystemPromptOptions,
|
|
30
|
+
): string {
|
|
31
|
+
const {
|
|
32
|
+
appendSystemPrompt,
|
|
33
|
+
cwd,
|
|
34
|
+
contextFiles: providedContextFiles,
|
|
35
|
+
skills: providedSkills,
|
|
36
|
+
selectedTools,
|
|
37
|
+
} = options;
|
|
38
|
+
const promptCwd = cwd.replace(/\\/g, "/");
|
|
39
|
+
const now = new Date();
|
|
40
|
+
const year = now.getFullYear();
|
|
41
|
+
const month = String(now.getMonth() + 1).padStart(2, "0");
|
|
42
|
+
const day = String(now.getDate()).padStart(2, "0");
|
|
43
|
+
const date = `${year}-${month}-${day}`;
|
|
44
|
+
const appendSection = appendSystemPrompt ? `\n\n${appendSystemPrompt}` : "";
|
|
45
|
+
const contextFiles = providedContextFiles ?? [];
|
|
46
|
+
const skills = providedSkills ?? [];
|
|
47
|
+
let prompt = customPrompt;
|
|
48
|
+
if (appendSection) {
|
|
49
|
+
prompt += appendSection;
|
|
50
|
+
}
|
|
51
|
+
if (contextFiles.length > 0) {
|
|
52
|
+
prompt += "\n\n# Project Context\n\n";
|
|
53
|
+
prompt += "Project-specific instructions and guidelines:\n\n";
|
|
54
|
+
for (const { path: filePath, content } of contextFiles) {
|
|
55
|
+
prompt += `## ${filePath}\n\n${content}\n\n`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const customPromptHasRead = !selectedTools || selectedTools.includes("read");
|
|
59
|
+
if (customPromptHasRead && skills.length > 0) {
|
|
60
|
+
prompt += formatSkillsForPrompt(skills);
|
|
61
|
+
}
|
|
62
|
+
prompt += `\nCurrent date: ${date}`;
|
|
63
|
+
prompt += `\nCurrent working directory: ${promptCwd}`;
|
|
64
|
+
return prompt;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function isDisabled(): boolean {
|
|
68
|
+
const raw = process.env.ULTIMATE_PI_SYSTEM_PROMPT?.trim().toLowerCase();
|
|
69
|
+
return raw === "0" || raw === "false" || raw === "off" || raw === "no";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function workspaceSystemPromptPath(cwd: string): string {
|
|
73
|
+
return join(cwd, WORKSPACE_SYSTEM_MD);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function packageSystemPromptPath(): string {
|
|
77
|
+
return resolveHarnessAsset(MODULE_URL, ".pi", "SYSTEM.md");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
type PromptSource = "workspace" | "package";
|
|
81
|
+
|
|
82
|
+
function resolveSystemPromptPath(cwd: string): {
|
|
83
|
+
path: string;
|
|
84
|
+
source: PromptSource;
|
|
85
|
+
} | null {
|
|
86
|
+
const workspacePath = workspaceSystemPromptPath(cwd);
|
|
87
|
+
if (existsSync(workspacePath)) {
|
|
88
|
+
return { path: workspacePath, source: "workspace" };
|
|
89
|
+
}
|
|
90
|
+
const packagePath = packageSystemPromptPath();
|
|
91
|
+
if (existsSync(packagePath)) {
|
|
92
|
+
return { path: packagePath, source: "package" };
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
interface PromptCache {
|
|
98
|
+
path: string;
|
|
99
|
+
source: PromptSource;
|
|
100
|
+
mtimeMs: number;
|
|
101
|
+
content: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function readPromptFile(path: string): string | null {
|
|
105
|
+
try {
|
|
106
|
+
const content = readFileSync(path, "utf-8").trim();
|
|
107
|
+
return content.length > 0 ? content : null;
|
|
108
|
+
} catch {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export default function ultimatePiSystemPrompt(pi: ExtensionAPI) {
|
|
114
|
+
if (isDisabled()) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let cache: PromptCache | null = null;
|
|
119
|
+
let warnedMissing = false;
|
|
120
|
+
|
|
121
|
+
const loadSystemPrompt = (
|
|
122
|
+
cwd: string,
|
|
123
|
+
): { content: string; path: string; source: PromptSource } | null => {
|
|
124
|
+
const resolved = resolveSystemPromptPath(cwd);
|
|
125
|
+
if (!resolved) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
const { mtimeMs } = statSync(resolved.path);
|
|
130
|
+
if (
|
|
131
|
+
cache &&
|
|
132
|
+
cache.path === resolved.path &&
|
|
133
|
+
cache.source === resolved.source &&
|
|
134
|
+
cache.mtimeMs === mtimeMs
|
|
135
|
+
) {
|
|
136
|
+
return {
|
|
137
|
+
content: cache.content,
|
|
138
|
+
path: cache.path,
|
|
139
|
+
source: cache.source,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
const content = readPromptFile(resolved.path);
|
|
143
|
+
if (!content) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
cache = {
|
|
147
|
+
path: resolved.path,
|
|
148
|
+
source: resolved.source,
|
|
149
|
+
mtimeMs,
|
|
150
|
+
content,
|
|
151
|
+
};
|
|
152
|
+
return { content, path: resolved.path, source: resolved.source };
|
|
153
|
+
} catch {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const invalidateCache = () => {
|
|
159
|
+
cache = null;
|
|
160
|
+
warnedMissing = false;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
pi.on("session_start", () => {
|
|
164
|
+
invalidateCache();
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
pi.on("before_agent_start", async (event, ctx) => {
|
|
168
|
+
const cwd = ctx.cwd ?? process.cwd();
|
|
169
|
+
const loaded = loadSystemPrompt(cwd);
|
|
170
|
+
|
|
171
|
+
if (!loaded) {
|
|
172
|
+
if (!warnedMissing) {
|
|
173
|
+
const workspacePath = workspaceSystemPromptPath(cwd);
|
|
174
|
+
const pkgPath = packageSystemPromptPath();
|
|
175
|
+
ctx.ui.notify(
|
|
176
|
+
`[ultimate-pi] No system prompt found.\n` +
|
|
177
|
+
` Workspace override: ${workspacePath}\n` +
|
|
178
|
+
` Package default: ${pkgPath}\n` +
|
|
179
|
+
`Using Pi default system prompt.`,
|
|
180
|
+
"warning",
|
|
181
|
+
);
|
|
182
|
+
warnedMissing = true;
|
|
183
|
+
}
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return {
|
|
188
|
+
systemPrompt: buildFromCustomPrompt(
|
|
189
|
+
loaded.content,
|
|
190
|
+
event.systemPromptOptions,
|
|
191
|
+
),
|
|
192
|
+
};
|
|
193
|
+
});
|
|
194
|
+
}
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
import { appendFile, mkdir, readFile } from "node:fs/promises";
|
|
9
9
|
import { join } from "node:path";
|
|
10
|
-
import type { ExtensionAPI } from "@
|
|
10
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
11
|
+
import { getRunIdFromSession } from "../lib/harness-run-context.js";
|
|
11
12
|
|
|
12
13
|
type HarnessPhase = "plan" | "execute" | "evaluate" | "adversary" | "merge";
|
|
13
14
|
|
|
@@ -129,8 +130,15 @@ function getPolicyContext(ctx: {
|
|
|
129
130
|
return { phase: null, budgetBypass: false };
|
|
130
131
|
}
|
|
131
132
|
|
|
132
|
-
function getRunId(ctx: {
|
|
133
|
-
|
|
133
|
+
function getRunId(ctx: {
|
|
134
|
+
sessionManager: { getEntries(): unknown[]; getSessionId(): string };
|
|
135
|
+
}): string {
|
|
136
|
+
return (
|
|
137
|
+
getRunIdFromSession(
|
|
138
|
+
ctx.sessionManager.getEntries(),
|
|
139
|
+
ctx.sessionManager.getSessionId(),
|
|
140
|
+
) ?? ctx.sessionManager.getSessionId()
|
|
141
|
+
);
|
|
134
142
|
}
|
|
135
143
|
|
|
136
144
|
async function readDebateCapsFromSchema(): Promise<{
|
|
@@ -9,9 +9,14 @@ import type {
|
|
|
9
9
|
ExtensionAPI,
|
|
10
10
|
ExtensionContext,
|
|
11
11
|
ThemeColor,
|
|
12
|
-
} from "@
|
|
13
|
-
import type { TUI } from "@
|
|
14
|
-
import {
|
|
12
|
+
} from "@earendil-works/pi-coding-agent";
|
|
13
|
+
import type { TUI } from "@earendil-works/pi-tui";
|
|
14
|
+
import {
|
|
15
|
+
Box,
|
|
16
|
+
Text,
|
|
17
|
+
truncateToWidth,
|
|
18
|
+
visibleWidth,
|
|
19
|
+
} from "@earendil-works/pi-tui";
|
|
15
20
|
|
|
16
21
|
// ── router decision reader ──────────────────────────────────────────
|
|
17
22
|
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* doubling vertical resolution in the same terminal footprint.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { ExtensionAPI } from "@
|
|
10
|
-
import { truncateToWidth } from "@
|
|
9
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
10
|
+
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
11
11
|
import * as JimpModule from "jimp";
|
|
12
12
|
import { resolveHarnessAsset } from "./lib/harness-paths.js";
|
|
13
13
|
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
import { appendFile, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
18
18
|
import { join } from "node:path";
|
|
19
|
-
import type { ExtensionAPI } from "@
|
|
19
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
20
|
+
import { getRunIdFromSession } from "../lib/harness-run-context.js";
|
|
20
21
|
|
|
21
22
|
type DebateParticipant =
|
|
22
23
|
| "EvaluatorAgent"
|
|
@@ -92,8 +93,15 @@ async function ensureDebatesDir(): Promise<void> {
|
|
|
92
93
|
await mkdir(DEBATES_DIR, { recursive: true });
|
|
93
94
|
}
|
|
94
95
|
|
|
95
|
-
function getRunId(ctx: {
|
|
96
|
-
|
|
96
|
+
function getRunId(ctx: {
|
|
97
|
+
sessionManager: { getEntries(): unknown[]; getSessionId(): string };
|
|
98
|
+
}): string {
|
|
99
|
+
return (
|
|
100
|
+
getRunIdFromSession(
|
|
101
|
+
ctx.sessionManager.getEntries(),
|
|
102
|
+
ctx.sessionManager.getSessionId(),
|
|
103
|
+
) ?? ctx.sessionManager.getSessionId()
|
|
104
|
+
);
|
|
97
105
|
}
|
|
98
106
|
|
|
99
107
|
async function readRoundCapsFromSchema(): Promise<{
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
import { existsSync, readFileSync } from "node:fs";
|
|
15
15
|
import { resolve } from "node:path";
|
|
16
|
-
import type { ExtensionAPI } from "@
|
|
16
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
17
17
|
|
|
18
18
|
// ── .env parser ──────────────────────────────────────────────────
|
|
19
19
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Emits harness-drift-report custom entries for harness-telemetry + observation bus.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { ExtensionAPI } from "@
|
|
7
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
8
8
|
|
|
9
9
|
type HarnessPhase = "plan" | "execute" | "evaluate" | "adversary" | "merge";
|
|
10
10
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Design references: pi-ask-user, @pi-unipi/ask-user, rpiv-ask-user-question (not vendored).
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { ExtensionAPI } from "@
|
|
6
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
7
7
|
import { runAskDialog } from "./lib/ask-user/dialog.js";
|
|
8
8
|
import { runAskFallback } from "./lib/ask-user/fallback.js";
|
|
9
9
|
import { renderAskCall, renderAskResult } from "./lib/ask-user/render.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
ExtensionAPI,
|
|
3
3
|
ExtensionContext,
|
|
4
|
-
} from "@
|
|
4
|
+
} from "@earendil-works/pi-coding-agent";
|
|
5
5
|
import {
|
|
6
6
|
type HarnessUiState,
|
|
7
7
|
HarnessUiStateStore,
|
|
@@ -285,9 +285,16 @@ class HarnessWidgetComponent {
|
|
|
285
285
|
const toolDisplay = this.inFlight.lastToolName
|
|
286
286
|
? `${this.inFlight.toolCount}:${this.inFlight.lastToolName}`
|
|
287
287
|
: String(this.inFlight.toolCount);
|
|
288
|
-
const
|
|
288
|
+
const nextDisplay =
|
|
289
|
+
this.state.nextRecommendedCommand != null
|
|
290
|
+
? this.state.nextRecommendedCommand.length > 36
|
|
291
|
+
? `${this.state.nextRecommendedCommand.slice(0, 33)}...`
|
|
292
|
+
: this.state.nextRecommendedCommand
|
|
293
|
+
: null;
|
|
289
294
|
const row3Left = `${planFlag} ${reviewFlag} ${budgetFlag} ${testsFlag}`;
|
|
290
|
-
const row3Right =
|
|
295
|
+
const row3Right = nextDisplay
|
|
296
|
+
? `${theme.fg("dim", "inFlight:")}${theme.fg("accent", toolDisplay)} ${theme.fg("dim", "next:")}${theme.fg("accent", nextDisplay)}`
|
|
297
|
+
: `${theme.fg("dim", "inFlight:")}${theme.fg("accent", toolDisplay)}`;
|
|
291
298
|
const row3 = composeZones(row3Left, row3Right, rowWidth);
|
|
292
299
|
|
|
293
300
|
const lines: string[] = [truncateToWidth(row1, rowWidth)];
|
|
@@ -353,7 +360,7 @@ export default function harnessLiveWidget(pi: ExtensionAPI) {
|
|
|
353
360
|
policyDecision: state.policyDecision,
|
|
354
361
|
consensusDelta: state.consensusDelta,
|
|
355
362
|
severity: state.severity,
|
|
356
|
-
|
|
363
|
+
nextRecommendedCommand: state.nextRecommendedCommand,
|
|
357
364
|
inFlight,
|
|
358
365
|
});
|
|
359
366
|
}
|