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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* harness-web-guard — block bash that bypasses web_search / web_fetch tools.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { ExtensionAPI } from "@
|
|
5
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
6
6
|
|
|
7
7
|
const BLOCK_REASON =
|
|
8
8
|
"harness-web-guard: use web_search (SERP) or web_fetch (page content) instead of raw curl/wget/firecrawl/scrapling fetch. " +
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* harness-web-tools — web_search + web_fetch pi tools wrapping harness-web.py.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { ExtensionAPI } from "@
|
|
5
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import { Type } from "@sinclair/typebox";
|
|
7
7
|
import {
|
|
8
8
|
harnessWebContextLine,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { ExtensionUIContext } from "@
|
|
1
|
+
import type { ExtensionUIContext } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import {
|
|
3
3
|
Editor,
|
|
4
4
|
type EditorTheme,
|
|
5
5
|
Key,
|
|
6
6
|
matchesKey,
|
|
7
7
|
truncateToWidth,
|
|
8
|
-
} from "@
|
|
8
|
+
} from "@earendil-works/pi-tui";
|
|
9
9
|
import type { AskResponse, DialogResult, ValidatedAskParams } from "./types.js";
|
|
10
10
|
|
|
11
11
|
type DisplayOption = {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { AgentToolResult } from "@
|
|
1
|
+
import type { AgentToolResult } from "@earendil-works/pi-agent-core";
|
|
2
2
|
import type {
|
|
3
3
|
Theme,
|
|
4
4
|
ToolRenderResultOptions,
|
|
5
|
-
} from "@
|
|
6
|
-
import { Text } from "@
|
|
5
|
+
} from "@earendil-works/pi-coding-agent";
|
|
6
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
7
7
|
import type { AskToolDetails } from "./types.js";
|
|
8
8
|
|
|
9
9
|
export function renderAskCall(
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { type Dirent, existsSync, readdirSync, readFileSync } from "node:fs";
|
|
7
7
|
import { join, relative } from "node:path";
|
|
8
|
-
import { getAgentDir } from "@
|
|
8
|
+
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
9
9
|
import { parseAgentMarkdown } from "./agent-parser.js";
|
|
10
10
|
import type { AgentConfig } from "./vendored/types.js";
|
|
11
11
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Parse harness agent .md files into AgentConfig (path id = posix relative path).
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { parseFrontmatter } from "@
|
|
5
|
+
import { parseFrontmatter } from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import { BUILTIN_TOOL_NAMES } from "./vendored/agent-types.js";
|
|
7
7
|
import type {
|
|
8
8
|
AgentConfig,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Orchestrator blackboard tool (list/read/query/wait/delete).
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { defineTool, type ExtensionAPI } from "@
|
|
5
|
+
import { defineTool, type ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import { Type } from "@sinclair/typebox";
|
|
7
7
|
import type { Blackboard } from "./blackboard.js";
|
|
8
8
|
import type { BlackboardQuery } from "./types-blackboard.js";
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-agent tool policy for harness/* subagents (defense in depth with frontmatter).
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
evaluateSubagentToolCall,
|
|
7
|
+
type ToolCallDecision,
|
|
8
|
+
} from "./spawn-policy.js";
|
|
9
|
+
|
|
10
|
+
export type HarnessAgentKind =
|
|
11
|
+
| "planner"
|
|
12
|
+
| "executor"
|
|
13
|
+
| "evaluator"
|
|
14
|
+
| "adversary"
|
|
15
|
+
| "tie_breaker"
|
|
16
|
+
| "meta"
|
|
17
|
+
| "trace"
|
|
18
|
+
| "incident"
|
|
19
|
+
| "other";
|
|
20
|
+
|
|
21
|
+
const MUTATING_TOOLS = new Set(["write", "edit"]);
|
|
22
|
+
|
|
23
|
+
const BASH_MUTATION_PATTERNS = [
|
|
24
|
+
/\brm\s+-/i,
|
|
25
|
+
/\bmv\s+/i,
|
|
26
|
+
/\bcp\s+/i,
|
|
27
|
+
/\btouch\s+/i,
|
|
28
|
+
/\bmkdir\s+/i,
|
|
29
|
+
/\btee\s+/i,
|
|
30
|
+
/\bgit\s+(add|commit|push|reset|checkout|merge|rebase|cherry-pick|apply)\b/i,
|
|
31
|
+
/\bnpm\s+(install|uninstall|ci)\b/i,
|
|
32
|
+
/\bpnpm\s+(add|install|remove)\b/i,
|
|
33
|
+
/\byarn\s+(add|install|remove)\b/i,
|
|
34
|
+
/\bsed\s+-i\b/i,
|
|
35
|
+
/\bperl\s+-i\b/i,
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const READ_ONLY_KINDS = new Set<HarnessAgentKind>([
|
|
39
|
+
"planner",
|
|
40
|
+
"evaluator",
|
|
41
|
+
"adversary",
|
|
42
|
+
"tie_breaker",
|
|
43
|
+
"trace",
|
|
44
|
+
"incident",
|
|
45
|
+
"meta",
|
|
46
|
+
]);
|
|
47
|
+
|
|
48
|
+
export function classifyHarnessAgent(agentType: string): HarnessAgentKind {
|
|
49
|
+
const id = agentType.replace(/^harness\//, "");
|
|
50
|
+
switch (id) {
|
|
51
|
+
case "planner":
|
|
52
|
+
return "planner";
|
|
53
|
+
case "executor":
|
|
54
|
+
return "executor";
|
|
55
|
+
case "evaluator":
|
|
56
|
+
return "evaluator";
|
|
57
|
+
case "adversary":
|
|
58
|
+
return "adversary";
|
|
59
|
+
case "tie-breaker":
|
|
60
|
+
return "tie_breaker";
|
|
61
|
+
case "meta-optimizer":
|
|
62
|
+
return "meta";
|
|
63
|
+
case "trace-librarian":
|
|
64
|
+
return "trace";
|
|
65
|
+
case "incident-recorder":
|
|
66
|
+
return "incident";
|
|
67
|
+
default:
|
|
68
|
+
return agentType.startsWith("harness/") ? "other" : "other";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function isMutatingBash(command: string): boolean {
|
|
73
|
+
return BASH_MUTATION_PATTERNS.some((pattern) => pattern.test(command));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function isHarnessPackageAgent(agentType: string): boolean {
|
|
77
|
+
return agentType.startsWith("harness/");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function evaluateHarnessSubagentToolCall(
|
|
81
|
+
toolName: string,
|
|
82
|
+
input: Record<string, unknown> | undefined,
|
|
83
|
+
agentType: string,
|
|
84
|
+
): ToolCallDecision {
|
|
85
|
+
const base = evaluateSubagentToolCall(toolName);
|
|
86
|
+
if (base.action === "block") {
|
|
87
|
+
return base;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (!isHarnessPackageAgent(agentType)) {
|
|
91
|
+
return { action: "allow" };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const kind = classifyHarnessAgent(agentType);
|
|
95
|
+
if (!READ_ONLY_KINDS.has(kind)) {
|
|
96
|
+
return { action: "allow" };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (MUTATING_TOOLS.has(toolName)) {
|
|
100
|
+
return {
|
|
101
|
+
action: "block",
|
|
102
|
+
reason: `harness-subagent-policy: ${toolName} blocked for harness/${kind} (read-only phase agent).`,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (toolName === "bash") {
|
|
107
|
+
const command = String(input?.command ?? "");
|
|
108
|
+
if (command && isMutatingBash(command)) {
|
|
109
|
+
return {
|
|
110
|
+
action: "block",
|
|
111
|
+
reason: `harness-subagent-policy: mutating bash blocked for harness/${kind}.`,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return { action: "allow" };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Policy phase hint seeded into subagent system prompt appendix when extensions load policy-gate. */
|
|
120
|
+
export function harnessSubagentPhaseHint(agentType: string): string | null {
|
|
121
|
+
const kind = classifyHarnessAgent(agentType);
|
|
122
|
+
switch (kind) {
|
|
123
|
+
case "planner":
|
|
124
|
+
return "plan";
|
|
125
|
+
case "executor":
|
|
126
|
+
return "execute";
|
|
127
|
+
case "evaluator":
|
|
128
|
+
return "evaluate";
|
|
129
|
+
case "adversary":
|
|
130
|
+
return "adversary";
|
|
131
|
+
default:
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
10
|
-
import type { Model } from "@
|
|
10
|
+
import type { Model } from "@earendil-works/pi-ai";
|
|
11
11
|
import type {
|
|
12
12
|
AgentSession,
|
|
13
13
|
ExtensionAPI,
|
|
14
14
|
ExtensionContext,
|
|
15
|
-
} from "@
|
|
15
|
+
} from "@earendil-works/pi-coding-agent";
|
|
16
16
|
import { resumeAgent, runAgent, type ToolActivity } from "./agent-runner.js";
|
|
17
17
|
import type {
|
|
18
18
|
AgentInvocation,
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as os from "node:os";
|
|
7
7
|
import * as path from "node:path";
|
|
8
|
-
import type { Model } from "@
|
|
9
|
-
import type { ExtensionContext } from "@
|
|
8
|
+
import type { Model } from "@earendil-works/pi-ai";
|
|
9
|
+
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
10
10
|
import {
|
|
11
11
|
type AgentSession,
|
|
12
12
|
type AgentSessionEvent,
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
getAgentDir,
|
|
17
17
|
SessionManager,
|
|
18
18
|
SettingsManager,
|
|
19
|
-
} from "@
|
|
20
|
-
import {
|
|
19
|
+
} from "@earendil-works/pi-coding-agent";
|
|
20
|
+
import { evaluateHarnessSubagentToolCall } from "../harness-subagent-policy.js";
|
|
21
21
|
import {
|
|
22
22
|
getAgentConfig,
|
|
23
23
|
getConfig,
|
|
@@ -331,7 +331,11 @@ export async function runAgent(
|
|
|
331
331
|
const extensionFactories: Array<(pi: ExtensionAPI) => void> = [
|
|
332
332
|
(pi) => {
|
|
333
333
|
pi.on("tool_call", (event) => {
|
|
334
|
-
const decision =
|
|
334
|
+
const decision = evaluateHarnessSubagentToolCall(
|
|
335
|
+
event.toolName,
|
|
336
|
+
event.input as Record<string, unknown> | undefined,
|
|
337
|
+
type,
|
|
338
|
+
);
|
|
335
339
|
if (decision.action === "block") {
|
|
336
340
|
return { block: true, reason: decision.reason };
|
|
337
341
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* context.ts — Extract parent conversation context for subagent inheritance.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { ExtensionContext } from "@
|
|
5
|
+
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
6
6
|
|
|
7
7
|
/** Extract text from a message content block array. */
|
|
8
8
|
export function extractText(content: unknown[]): string {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* env.ts — Detect environment info (git, platform) for subagent system prompts.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { ExtensionAPI } from "@
|
|
5
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import type { EnvInfo } from "./types.js";
|
|
7
7
|
|
|
8
8
|
export async function detectEnv(
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
type ExtensionCommandContext,
|
|
15
15
|
type ExtensionContext,
|
|
16
16
|
getAgentDir,
|
|
17
|
-
} from "@
|
|
18
|
-
import { Text } from "@
|
|
17
|
+
} from "@earendil-works/pi-coding-agent";
|
|
18
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
19
19
|
import { Type } from "@sinclair/typebox";
|
|
20
20
|
import { getDriftReport } from "../agent-manifest.js";
|
|
21
21
|
import { Blackboard } from "../blackboard.js";
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import type {
|
|
19
19
|
ExtensionAPI,
|
|
20
20
|
ExtensionContext,
|
|
21
|
-
} from "@
|
|
21
|
+
} from "@earendil-works/pi-coding-agent";
|
|
22
22
|
import { Cron } from "croner";
|
|
23
23
|
import { nanoid } from "nanoid";
|
|
24
24
|
import type { AgentManager } from "./agent-manager.js";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
7
|
-
import { getAgentDir } from "@
|
|
7
|
+
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
8
8
|
import type { JoinMode } from "./types.js";
|
|
9
9
|
|
|
10
10
|
export interface SubagentsSettings {
|
|
@@ -22,7 +22,7 @@ import type { Dirent } from "node:fs";
|
|
|
22
22
|
import { existsSync, readdirSync } from "node:fs";
|
|
23
23
|
import { homedir } from "node:os";
|
|
24
24
|
import { join } from "node:path";
|
|
25
|
-
import { getAgentDir } from "@
|
|
25
|
+
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
26
26
|
import { isSymlink, isUnsafeName, safeReadFile } from "./memory.js";
|
|
27
27
|
|
|
28
28
|
export interface PreloadedSkill {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* types.ts — Type definitions for the subagent system.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { ThinkingLevel } from "@
|
|
6
|
-
import type { AgentSession } from "@
|
|
5
|
+
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
|
|
6
|
+
import type { AgentSession } from "@earendil-works/pi-coding-agent";
|
|
7
7
|
import type { LifetimeUsage } from "./usage.js";
|
|
8
8
|
|
|
9
9
|
export type { ThinkingLevel };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Uses the callback form of setWidget for themed rendering.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { truncateToWidth } from "@
|
|
8
|
+
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
9
9
|
import type { AgentManager } from "../agent-manager.js";
|
|
10
10
|
import { getConfig } from "../agent-types.js";
|
|
11
11
|
import type { AgentInvocation, SubagentType } from "../types.js";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Subscribes to session events for real-time streaming updates.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type { AgentSession } from "@
|
|
8
|
+
import type { AgentSession } from "@earendil-works/pi-coding-agent";
|
|
9
9
|
import {
|
|
10
10
|
type Component,
|
|
11
11
|
matchesKey,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
truncateToWidth,
|
|
14
14
|
visibleWidth,
|
|
15
15
|
wrapTextWithAnsi,
|
|
16
|
-
} from "@
|
|
16
|
+
} from "@earendil-works/pi-tui";
|
|
17
17
|
import { extractText } from "../context.js";
|
|
18
18
|
import type { AgentRecord } from "../types.js";
|
|
19
19
|
import { getLifetimeTotal, getSessionContextPercent } from "../usage.js";
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* if real demand emerges.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type { ExtensionCommandContext } from "@
|
|
11
|
+
import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
12
12
|
import type { SubagentScheduler } from "../schedule.js";
|
|
13
13
|
import type { ScheduledSubagent } from "../types.js";
|
|
14
14
|
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { randomUUID } from "node:crypto";
|
|
9
|
-
import type { ExtensionAPI } from "@
|
|
9
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
10
|
+
import { getRunIdFromSession } from "../lib/harness-run-context.js";
|
|
10
11
|
|
|
11
12
|
type HarnessPhase = "plan" | "execute" | "evaluate" | "adversary" | "merge";
|
|
12
13
|
type ObservationKind =
|
|
@@ -77,15 +78,12 @@ function nowIso(): string {
|
|
|
77
78
|
function getRunId(ctx: {
|
|
78
79
|
sessionManager: { getEntries(): unknown[]; getSessionId(): string };
|
|
79
80
|
}): string {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (typeof runId === "string" && runId.length > 0) return runId;
|
|
87
|
-
}
|
|
88
|
-
return ctx.sessionManager.getSessionId();
|
|
81
|
+
return (
|
|
82
|
+
getRunIdFromSession(
|
|
83
|
+
ctx.sessionManager.getEntries(),
|
|
84
|
+
ctx.sessionManager.getSessionId(),
|
|
85
|
+
) ?? ctx.sessionManager.getSessionId()
|
|
86
|
+
);
|
|
89
87
|
}
|
|
90
88
|
|
|
91
89
|
export default function observationBus(pi: ExtensionAPI) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { existsSync, readFileSync } from "node:fs";
|
|
8
8
|
import { join } from "node:path";
|
|
9
|
-
import type { ExtensionAPI } from "@
|
|
9
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
10
10
|
import vendorModelRouter from "../../vendor/pi-model-router/extensions/index.js";
|
|
11
11
|
|
|
12
12
|
function isHarnessRouterReady(cwd: string): boolean {
|