pi-harness-runtime 1.1.328 → 1.1.329
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/harness/wiki-integration.ts +205 -0
- package/index.ts +7 -3
- package/package.json +1 -1
- package/packages/a2a-adapter/package.json +1 -1
- package/packages/agent-policy/package.json +1 -1
- package/packages/architecture-generator/package.json +1 -1
- package/packages/auth/package.json +1 -1
- package/packages/autonomous-refactor/package.json +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- package/packages/cache-strategy/package.json +1 -1
- package/packages/capability-registry/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/cli-plugin-sdk/package.json +1 -1
- package/packages/clipboard/package.json +1 -1
- package/packages/clipboard-plugin/package.json +1 -1
- package/packages/code-generation/package.json +1 -1
- package/packages/code-review/package.json +1 -1
- package/packages/codex-adapter/package.json +1 -1
- package/packages/codex-watcher/package.json +1 -1
- package/packages/config-capture/package.json +1 -1
- package/packages/context-compiler/package.json +1 -1
- package/packages/context-discovery/package.json +1 -1
- package/packages/context-manager/package.json +1 -1
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/cost-optimizer/package.json +1 -1
- package/packages/dependency-analyzer/package.json +1 -1
- package/packages/django-plugin/package.json +1 -1
- package/packages/doc-generator/package.json +1 -1
- package/packages/durable-review/package.json +1 -1
- package/packages/e2e-tester/package.json +1 -1
- package/packages/evaluation-engine/package.json +1 -1
- package/packages/evaluation-runner/package.json +1 -1
- package/packages/event-bus/package.json +1 -1
- package/packages/event-store/package.json +1 -1
- package/packages/experience-replay/package.json +1 -1
- package/packages/feedback-collector/package.json +1 -1
- package/packages/file-copy-helper/package.json +1 -1
- package/packages/framework-detector/package.json +1 -1
- package/packages/framework-plugin-sdk/package.json +1 -1
- package/packages/frappe-plugin/package.json +1 -1
- package/packages/generic-web-plugin/package.json +1 -1
- package/packages/health-monitor/package.json +1 -1
- package/packages/intent-analyzer/package.json +1 -1
- package/packages/jev-judge/package.json +1 -1
- package/packages/knowledge-graph/package.json +1 -1
- package/packages/knowledge-retrieval/package.json +1 -1
- package/packages/laravel-plugin/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/mcp-adapter/package.json +1 -1
- package/packages/memory-engine/package.json +1 -1
- package/packages/milestone-manager/package.json +1 -1
- package/packages/model-registry/package.json +1 -1
- package/packages/nextjs-plugin/package.json +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/observability/package.json +1 -1
- package/packages/okf-indexer/package.json +1 -1
- package/packages/paperclip-integration/package.json +1 -1
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/privilege-broker/package.json +1 -1
- package/packages/project-analyzer/package.json +1 -1
- package/packages/project-bootstrap/package.json +1 -1
- package/packages/projection-engine/package.json +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/prompt-versioning/package.json +1 -1
- package/packages/provider-adapter-sdk/package.json +1 -1
- package/packages/provider-router/package.json +1 -1
- package/packages/provider-selector/package.json +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/qdrant-skills/package.json +1 -1
- package/packages/quota-manager/package.json +1 -1
- package/packages/rate-limiter/package.json +1 -1
- package/packages/react-vite-plugin/package.json +1 -1
- package/packages/release-manager/package.json +1 -1
- package/packages/requirement-compiler/package.json +1 -1
- package/packages/runtime/package.json +1 -1
- package/packages/scheduler/package.json +1 -1
- package/packages/scheduler-adapter/package.json +1 -1
- package/packages/session/package.json +1 -1
- package/packages/session-api/package.json +1 -1
- package/packages/session-export/package.json +1 -1
- package/packages/shared-context/package.json +1 -1
- package/packages/skill-mcp-client/package.json +1 -1
- package/packages/skill-registry/package.json +1 -1
- package/packages/skills/package.json +1 -1
- package/packages/sprint-planner/package.json +1 -1
- package/packages/subscription-engine/package.json +1 -1
- package/packages/task-compiler/package.json +1 -1
- package/packages/telegram/package.json +1 -1
- package/packages/tencentdb-memory/package.json +1 -1
- package/packages/tencentdb-sync/package.json +1 -1
- package/packages/test-data-generator/package.json +1 -1
- package/packages/test-generator/package.json +1 -1
- package/packages/todo-bd-sync/package.json +1 -1
- package/packages/token-estimation/package.json +1 -1
- package/packages/token-optimizer/package.json +1 -1
- package/packages/trajectory/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/webmcp-tester/package.json +1 -1
- package/packages/wiki/dist/index.d.ts.map +1 -1
- package/packages/wiki/dist/index.js +8 -5
- package/packages/wiki/dist/index.js.map +1 -1
- package/packages/wiki/dist/storage.d.ts +5 -5
- package/packages/wiki/dist/storage.d.ts.map +1 -1
- package/packages/wiki/dist/storage.js +55 -26
- package/packages/wiki/dist/storage.js.map +1 -1
- package/packages/wiki/package.json +1 -1
- package/packages/wiki/src/index.ts +9 -6
- package/packages/wiki/src/storage.ts +61 -26
- package/packages/workflow-events/package.json +1 -1
- package/packages/workspace-scanner/package.json +1 -1
- package/packages/worktree/package.json +1 -1
- package/packages/write-review/package.json +1 -1
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wiki Integration for Pi
|
|
3
|
+
*
|
|
4
|
+
* Implements wiki commands per wiki/llm-wiki-integration-minimax-plan.md
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Initialize wiki integration
|
|
11
|
+
*/
|
|
12
|
+
export async function initWiki(pi: ExtensionAPI): Promise<void> {
|
|
13
|
+
// Only initialize if feature flag is set
|
|
14
|
+
if (process.env.HARNESS_KNOWLEDGE_WIKI !== "1") {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const { createWikiManager, isWikiEnabled } = await import(
|
|
20
|
+
"../packages/wiki/dist/index.js"
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
// Get workspace from environment
|
|
24
|
+
const workspaceRoot = process.env.PWD || process.cwd();
|
|
25
|
+
|
|
26
|
+
// Create wiki manager lazily
|
|
27
|
+
let wikiManager: ReturnType<typeof createWikiManager> | null = null;
|
|
28
|
+
|
|
29
|
+
function getWiki() {
|
|
30
|
+
if (!wikiManager) {
|
|
31
|
+
wikiManager = createWikiManager(workspaceRoot, "pi-harness-runtime");
|
|
32
|
+
}
|
|
33
|
+
return wikiManager;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Register /harness-wiki command
|
|
37
|
+
pi.registerCommand("harness-wiki", {
|
|
38
|
+
description: "Manage project wiki: search, read, ingest, lint",
|
|
39
|
+
handler: async (args: string, _ctx: unknown) => {
|
|
40
|
+
if (!isWikiEnabled()) {
|
|
41
|
+
console.log("Wiki feature is disabled. Set HARNESS_KNOWLEDGE_WIKI=1 to enable.");
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const wiki = getWiki();
|
|
46
|
+
const parts = args.trim().split(/\s+/);
|
|
47
|
+
const subcommand = parts[0] || "help";
|
|
48
|
+
const subargs = parts.slice(1).join(" ");
|
|
49
|
+
|
|
50
|
+
switch (subcommand) {
|
|
51
|
+
case "init":
|
|
52
|
+
try {
|
|
53
|
+
const result = wiki.initialize();
|
|
54
|
+
if (result.created) {
|
|
55
|
+
console.log("Wiki initialized.");
|
|
56
|
+
} else {
|
|
57
|
+
console.log("Wiki already exists.");
|
|
58
|
+
}
|
|
59
|
+
console.log(` Root: ${result.config.wikiRoot}`);
|
|
60
|
+
} catch (err) {
|
|
61
|
+
console.log(`Init failed: ${err}`);
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
|
|
65
|
+
case "search":
|
|
66
|
+
if (!subargs) {
|
|
67
|
+
console.log("Usage: /harness-wiki search <query>");
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
const results = wiki.search(subargs);
|
|
72
|
+
if (results.length === 0) {
|
|
73
|
+
console.log("No results found.");
|
|
74
|
+
} else {
|
|
75
|
+
console.log(`Found ${results.length} result(s):`);
|
|
76
|
+
for (const r of results.slice(0, 5)) {
|
|
77
|
+
console.log(` - [${r.page.status}] ${r.page.title} (${r.page.kind})`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} catch (err) {
|
|
81
|
+
console.log(`Search failed: ${err}`);
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
|
|
85
|
+
case "read":
|
|
86
|
+
if (!subargs) {
|
|
87
|
+
console.log("Usage: /harness-wiki read <page-id>");
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const page = wiki.loadPage(subargs);
|
|
92
|
+
if (!page) {
|
|
93
|
+
console.log(`Page not found: ${subargs}`);
|
|
94
|
+
} else {
|
|
95
|
+
console.log(`# ${page.frontmatter.title}`);
|
|
96
|
+
console.log(`Status: ${page.frontmatter.status}`);
|
|
97
|
+
console.log(`Kind: ${page.frontmatter.kind}`);
|
|
98
|
+
console.log(`Updated: ${page.frontmatter.updatedAt}`);
|
|
99
|
+
console.log("");
|
|
100
|
+
console.log(page.body.slice(0, 500) + (page.body.length > 500 ? "..." : ""));
|
|
101
|
+
}
|
|
102
|
+
} catch (err) {
|
|
103
|
+
console.log(`Read failed: ${err}`);
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
|
|
107
|
+
case "ingest":
|
|
108
|
+
if (!subargs) {
|
|
109
|
+
console.log("Usage: /harness-wiki ingest <source-path>");
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
const { snapshot, existing } = wiki.ingestSource(subargs);
|
|
114
|
+
if (existing) {
|
|
115
|
+
console.log(`Already ingested: ${snapshot.id}`);
|
|
116
|
+
} else {
|
|
117
|
+
console.log(`Ingested: ${snapshot.id}`);
|
|
118
|
+
console.log(` Path: ${snapshot.originalPath}`);
|
|
119
|
+
console.log(` Hash: ${snapshot.contentHash.slice(0, 16)}...`);
|
|
120
|
+
}
|
|
121
|
+
} catch (err) {
|
|
122
|
+
console.log(`Ingest failed: ${err}`);
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
|
|
126
|
+
case "lint":
|
|
127
|
+
try {
|
|
128
|
+
const findings = wiki.lint();
|
|
129
|
+
if (findings.length === 0) {
|
|
130
|
+
console.log("No issues found.");
|
|
131
|
+
} else {
|
|
132
|
+
const errors = findings.filter((f) => f.severity === "error");
|
|
133
|
+
const warnings = findings.filter((f) => f.severity === "warning");
|
|
134
|
+
console.log(`${errors.length} error(s), ${warnings.length} warning(s):`);
|
|
135
|
+
for (const f of findings.slice(0, 10)) {
|
|
136
|
+
console.log(` [${f.severity}] ${f.category}: ${f.message}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
} catch (err) {
|
|
140
|
+
console.log(`Lint failed: ${err}`);
|
|
141
|
+
}
|
|
142
|
+
break;
|
|
143
|
+
|
|
144
|
+
case "status":
|
|
145
|
+
try {
|
|
146
|
+
const pages = wiki.getAllPages();
|
|
147
|
+
const index = wiki.getIndex();
|
|
148
|
+
const kinds: Record<string, number> = {};
|
|
149
|
+
const statuses: Record<string, number> = {};
|
|
150
|
+
for (const p of index) {
|
|
151
|
+
kinds[p.kind] = (kinds[p.kind] || 0) + 1;
|
|
152
|
+
statuses[p.status] = (statuses[p.status] || 0) + 1;
|
|
153
|
+
}
|
|
154
|
+
console.log("Wiki Status");
|
|
155
|
+
console.log(` Pages: ${pages.length}`);
|
|
156
|
+
console.log(` Kinds: ${JSON.stringify(kinds)}`);
|
|
157
|
+
console.log(` Statuses: ${JSON.stringify(statuses)}`);
|
|
158
|
+
} catch (err) {
|
|
159
|
+
console.log(`Status failed: ${err}`);
|
|
160
|
+
}
|
|
161
|
+
break;
|
|
162
|
+
|
|
163
|
+
case "help":
|
|
164
|
+
default:
|
|
165
|
+
console.log("Wiki Commands:");
|
|
166
|
+
console.log(" /harness-wiki init - Initialize wiki");
|
|
167
|
+
console.log(" /harness-wiki search <q> - Search pages");
|
|
168
|
+
console.log(" /harness-wiki read <id> - Read page");
|
|
169
|
+
console.log(" /harness-wiki ingest <p> - Ingest source file");
|
|
170
|
+
console.log(" /harness-wiki lint - Check for issues");
|
|
171
|
+
console.log(" /harness-wiki status - Show stats");
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
} catch {
|
|
177
|
+
// Silently fail - wiki is optional
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Get wiki context for injection into system prompt
|
|
183
|
+
*/
|
|
184
|
+
export function getWikiInstruction(): string {
|
|
185
|
+
if (process.env.HARNESS_KNOWLEDGE_WIKI !== "1") {
|
|
186
|
+
return "";
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return `
|
|
190
|
+
## Project Wiki
|
|
191
|
+
|
|
192
|
+
Project knowledge is available via the wiki. Use /harness-wiki to:
|
|
193
|
+
- Search: /harness-wiki search <query>
|
|
194
|
+
- Read: /harness-wiki read <page-id>
|
|
195
|
+
- Ingest: /harness-wiki ingest <source-path>
|
|
196
|
+
|
|
197
|
+
The wiki contains:
|
|
198
|
+
- Design decisions with rationale
|
|
199
|
+
- Architecture concepts
|
|
200
|
+
- Incident records and lessons
|
|
201
|
+
- Implementation plans
|
|
202
|
+
|
|
203
|
+
Always cite wiki sources when providing project-specific information.
|
|
204
|
+
`;
|
|
205
|
+
}
|
package/index.ts
CHANGED
|
@@ -70,6 +70,7 @@ import {
|
|
|
70
70
|
createBlackboard,
|
|
71
71
|
} from "./harness/blackboard.ts";
|
|
72
72
|
import { scheduleAutoResume, cancelAutoResume, getGLMQuotaCountdown } from "./harness/index.js";
|
|
73
|
+
import { initWiki } from "./harness/wiki-integration.js";
|
|
73
74
|
import { startWatcher, classifyMessage, detectReviewMarker } from "./packages/codex-watcher/dist/src/index.js";
|
|
74
75
|
import {
|
|
75
76
|
getPaperclipConfig,
|
|
@@ -1998,7 +1999,7 @@ function processCompletionFile(filePath: string, pi: ExtensionAPI): void {
|
|
|
1998
1999
|
// --- Debug logging (file only, no console override) ---------------
|
|
1999
2000
|
// Logs written to file only. Real console output preserved for pi's TUI.
|
|
2000
2001
|
import { homedir } from "node:os";
|
|
2001
|
-
import { existsSync, mkdirSync, readFileSync, symlinkSync, appendFileSync, realpathSync } from "node:fs";
|
|
2002
|
+
import { existsSync, mkdirSync, readFileSync, symlinkSync, appendFileSync, realpathSync, statSync } from "node:fs";
|
|
2002
2003
|
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
2003
2004
|
import { join, dirname } from "node:path";
|
|
2004
2005
|
|
|
@@ -2411,6 +2412,9 @@ export default async function (pi: ExtensionAPI) {
|
|
|
2411
2412
|
// --- memory: Inject MEMORY.md and USER.md into system prompt -------------
|
|
2412
2413
|
void initMemory(pi);
|
|
2413
2414
|
|
|
2415
|
+
// --- wiki: Knowledge wiki with search/ingest/lint commands ------------
|
|
2416
|
+
void initWiki(pi);
|
|
2417
|
+
|
|
2414
2418
|
// --- ssh-detach-interceptor: Auto-fix bare ssh & → nohup pattern ---------
|
|
2415
2419
|
void initSshDetachInterceptor(pi);
|
|
2416
2420
|
|
|
@@ -2553,7 +2557,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
2553
2557
|
// the first session to appear afterward is treated as new and greeted.
|
|
2554
2558
|
let firstPollDone = false;
|
|
2555
2559
|
try {
|
|
2556
|
-
const { getLatestSession } = await import("./packages/codex-watcher/dist/index.js");
|
|
2560
|
+
const { getLatestSession } = await import("./packages/codex-watcher/dist/src/index.js");
|
|
2557
2561
|
const baseline = getLatestSession();
|
|
2558
2562
|
if (baseline) {
|
|
2559
2563
|
codexSessionState.greetingBaselineSessionId = baseline.id;
|
|
@@ -2691,7 +2695,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
2691
2695
|
if (classification !== "plan" && classification !== "mixed" && !hasReviewMarker) continue;
|
|
2692
2696
|
|
|
2693
2697
|
// Determine stage (for future use in event metadata)
|
|
2694
|
-
|
|
2698
|
+
void classification; // used for classification only
|
|
2695
2699
|
|
|
2696
2700
|
// Only start settle timer for plans (not reviews)
|
|
2697
2701
|
// Reviews don't have a file to watch
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-harness/capability-registry",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.329",
|
|
4
4
|
"description": "Capability Registry for pi-harness-runtime — tracks model capabilities and enables capability-based routing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|