pi-harness-runtime 1.1.411 → 1.1.412
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/notification-settings.ts +130 -0
- package/harness/skill-remote-source.ts +157 -0
- package/harness/skill-sync.ts +74 -22
- package/harness/skills-startup.ts +202 -0
- package/harness/startup-report.ts +98 -56
- package/harness-startup-status.ts +31 -2
- package/index.ts +125 -31
- 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/connection-runtime/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/contracts/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-sink/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/logging/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/permission-mode/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/dist/client.d.ts.map +1 -1
- package/packages/qdrant-skills/dist/client.js +21 -8
- package/packages/qdrant-skills/dist/client.js.map +1 -1
- package/packages/qdrant-skills/dist/embedder.d.ts +10 -0
- package/packages/qdrant-skills/dist/embedder.d.ts.map +1 -1
- package/packages/qdrant-skills/dist/embedder.js +12 -2
- package/packages/qdrant-skills/dist/embedder.js.map +1 -1
- package/packages/qdrant-skills/dist/index.d.ts +1 -1
- package/packages/qdrant-skills/dist/index.d.ts.map +1 -1
- package/packages/qdrant-skills/dist/index.js +1 -1
- package/packages/qdrant-skills/dist/index.js.map +1 -1
- package/packages/qdrant-skills/package.json +1 -1
- package/packages/qdrant-skills/src/client.ts +19 -8
- package/packages/qdrant-skills/src/embedder.ts +14 -2
- package/packages/qdrant-skills/src/index.ts +2 -0
- package/packages/qdrant-skills/test/collection-info.test.ts +129 -0
- 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/relay/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/dist/index.d.ts +14 -1
- package/packages/skills/dist/index.d.ts.map +1 -1
- package/packages/skills/dist/index.js +3 -1
- package/packages/skills/dist/index.js.map +1 -1
- package/packages/skills/dist/loader.d.ts +179 -0
- package/packages/skills/dist/loader.d.ts.map +1 -1
- package/packages/skills/dist/loader.js +337 -15
- package/packages/skills/dist/loader.js.map +1 -1
- package/packages/skills/dist/remote-source.d.ts +107 -0
- package/packages/skills/dist/remote-source.d.ts.map +1 -0
- package/packages/skills/dist/remote-source.js +79 -0
- package/packages/skills/dist/remote-source.js.map +1 -0
- package/packages/skills/dist/vector-schema.d.ts +58 -0
- package/packages/skills/dist/vector-schema.d.ts.map +1 -0
- package/packages/skills/dist/vector-schema.js +55 -0
- package/packages/skills/dist/vector-schema.js.map +1 -0
- package/packages/skills/package.json +1 -1
- package/packages/skills/src/index.ts +16 -2
- package/packages/skills/src/loader.ts +458 -39
- package/packages/skills/src/remote-source.ts +148 -0
- package/packages/skills/src/vector-schema.ts +72 -0
- package/packages/skills/test/remote-skills.test.ts +242 -0
- package/packages/skills/test/remote-source.test.ts +248 -0
- 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/tooling-preference/package.json +1 -1
- package/packages/trajectory/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/two-phase-review/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/voice-api/package.json +1 -1
- package/packages/webmcp-tester/package.json +1 -1
- package/packages/wiki/package.json +1 -1
- 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
- package/scripts/sync-to-qdrant.ts +79 -14
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-harness/two-phase-review",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.412",
|
|
4
4
|
"description": "pi-harness-runtime — two-phase implementation and review workflow (queue review signals, gate the phase, scope the diff)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,6 +14,21 @@
|
|
|
14
14
|
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
15
15
|
import { join, basename } from "node:path";
|
|
16
16
|
import { QdrantClient } from "@qdrant/js-client-rest";
|
|
17
|
+
// The runtime and this script must write into the SAME collection with the
|
|
18
|
+
// SAME vectors: a collection holds vectors of exactly one size, and a vector
|
|
19
|
+
// of a different size cannot be searched with the vectors of the other one.
|
|
20
|
+
// The embedder and the collection name are therefore imported from the
|
|
21
|
+
// packages that own them - they are not repeated here.
|
|
22
|
+
import {
|
|
23
|
+
EMBEDDING_DIMENSIONS,
|
|
24
|
+
EMBEDDING_MODEL,
|
|
25
|
+
createEmbedding,
|
|
26
|
+
createEmbeddingsBatch,
|
|
27
|
+
} from "../packages/qdrant-skills/dist/index.js";
|
|
28
|
+
import {
|
|
29
|
+
LEGACY_SKILL_COLLECTION,
|
|
30
|
+
SKILL_COLLECTION,
|
|
31
|
+
} from "../packages/skills/dist/vector-schema.js";
|
|
17
32
|
|
|
18
33
|
// =============================================================================
|
|
19
34
|
// SANITIZATION: Replace client-specific names with placeholders
|
|
@@ -81,17 +96,17 @@ interface QdrantConfig {
|
|
|
81
96
|
function getQdrantConfig(): QdrantConfig | null {
|
|
82
97
|
let apiKey = process.env.QDRANT_API_KEY;
|
|
83
98
|
const url = process.env.QDRANT_CLUSTER_ENDPOINT || "https://api.qdrant.tech";
|
|
84
|
-
const collection = process.env.QDRANT_COLLECTION ||
|
|
85
|
-
|
|
99
|
+
const collection = process.env.QDRANT_COLLECTION || SKILL_COLLECTION;
|
|
100
|
+
|
|
86
101
|
if (!apiKey) {
|
|
87
102
|
const keyPath = `${process.env.HOME}/.pi-harness-runtime/keys/qdrant-api-key.txt`;
|
|
88
103
|
if (existsSync(keyPath)) {
|
|
89
104
|
apiKey = readFileSync(keyPath, "utf-8").trim();
|
|
90
105
|
}
|
|
91
106
|
}
|
|
92
|
-
|
|
107
|
+
|
|
93
108
|
if (!apiKey) return null;
|
|
94
|
-
|
|
109
|
+
|
|
95
110
|
return { url, apiKey, collection };
|
|
96
111
|
}
|
|
97
112
|
|
|
@@ -180,15 +195,58 @@ function findSkillDirs(dir: string): string[] {
|
|
|
180
195
|
// =============================================================================
|
|
181
196
|
|
|
182
197
|
async function ensureCollection(client: QdrantClient, name: string): Promise<void> {
|
|
198
|
+
const existing = await collectionSchema(client, name);
|
|
199
|
+
if (existing?.dimensions !== undefined && existing.dimensions !== EMBEDDING_DIMENSIONS) {
|
|
200
|
+
// The collection holds vectors of another size. Writing into it would
|
|
201
|
+
// fail, and recreating it would destroy the skills of the other model.
|
|
202
|
+
// The name says so the user can act.
|
|
203
|
+
console.error(
|
|
204
|
+
`[Sync] The collection ${name} holds ${existing.dimensions}-dimensional vectors,` +
|
|
205
|
+
` but the runtime embeds with ${EMBEDDING_DIMENSIONS} (${EMBEDDING_MODEL}).`,
|
|
206
|
+
);
|
|
207
|
+
if (name === LEGACY_SKILL_COLLECTION) {
|
|
208
|
+
console.error(
|
|
209
|
+
`[Sync] ${LEGACY_SKILL_COLLECTION} is the legacy collection of the MiniLM model.`,
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
console.error(
|
|
213
|
+
`[Sync] Use a different collection (QDRANT_COLLECTION) or re-create this one.`,
|
|
214
|
+
);
|
|
215
|
+
process.exit(1);
|
|
216
|
+
}
|
|
183
217
|
try {
|
|
184
218
|
await client.createCollection(name, {
|
|
185
|
-
vectors: { size:
|
|
219
|
+
vectors: { size: EMBEDDING_DIMENSIONS, distance: "Cosine" }
|
|
186
220
|
});
|
|
187
221
|
} catch {
|
|
188
222
|
// Already exists - OK
|
|
189
223
|
}
|
|
190
224
|
}
|
|
191
225
|
|
|
226
|
+
/**
|
|
227
|
+
* The vector size and the distance of a collection.
|
|
228
|
+
*
|
|
229
|
+
* `null` means the collection does not exist (or cannot be read).
|
|
230
|
+
*/
|
|
231
|
+
async function collectionSchema(
|
|
232
|
+
client: QdrantClient,
|
|
233
|
+
name: string,
|
|
234
|
+
): Promise<{ dimensions?: number; distance?: string } | null> {
|
|
235
|
+
try {
|
|
236
|
+
// SAFETY: the Qdrant client answers with the collection description;
|
|
237
|
+
// the shape below is the one field this function reads. The cast is
|
|
238
|
+
// needed because the generated client types the response as `unknown`.
|
|
239
|
+
const info = (await client.getCollection(name)) as unknown as {
|
|
240
|
+
config?: { params?: { vectors?: { size?: number; distance?: string } } };
|
|
241
|
+
};
|
|
242
|
+
const vectors = info?.config?.params?.vectors;
|
|
243
|
+
if (!vectors) return { };
|
|
244
|
+
return { dimensions: vectors.size, distance: vectors.distance };
|
|
245
|
+
} catch {
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
192
250
|
async function clearCollection(client: QdrantClient, name: string): Promise<void> {
|
|
193
251
|
try {
|
|
194
252
|
await client.deleteCollection(name);
|
|
@@ -203,6 +261,17 @@ async function upsertSkills(
|
|
|
203
261
|
collectionName: string,
|
|
204
262
|
skills: SkillDoc[]
|
|
205
263
|
): Promise<void> {
|
|
264
|
+
// The vectors are produced by the same embedder the runtime uses, so the
|
|
265
|
+
// two can search each other's points. The embedding happens in batches:
|
|
266
|
+
// one request per 64 skills instead of one per skill.
|
|
267
|
+
const { embeddings } = await createEmbeddingsBatch(skills.map((skill) => skill.text));
|
|
268
|
+
if (embeddings.length !== skills.length) {
|
|
269
|
+
console.error(
|
|
270
|
+
`[Sync] The embedder returned ${embeddings.length} vectors for ${skills.length} skills.`,
|
|
271
|
+
);
|
|
272
|
+
process.exit(1);
|
|
273
|
+
}
|
|
274
|
+
|
|
206
275
|
const points = skills.map((skill, idx) => ({
|
|
207
276
|
id: idx + 1,
|
|
208
277
|
payload: {
|
|
@@ -210,12 +279,9 @@ async function upsertSkills(
|
|
|
210
279
|
description: skill.description,
|
|
211
280
|
body: skill.body,
|
|
212
281
|
},
|
|
213
|
-
vector:
|
|
214
|
-
text: skill.text,
|
|
215
|
-
model: "sentence-transformers/all-MiniLM-L6-v2"
|
|
216
|
-
}
|
|
282
|
+
vector: embeddings[idx],
|
|
217
283
|
}));
|
|
218
|
-
|
|
284
|
+
|
|
219
285
|
await client.upsert(collectionName, { wait: true, points });
|
|
220
286
|
}
|
|
221
287
|
|
|
@@ -224,11 +290,10 @@ async function searchSkills(
|
|
|
224
290
|
collectionName: string,
|
|
225
291
|
query: string
|
|
226
292
|
): Promise<void> {
|
|
293
|
+
// The query is embedded with the same model as the stored vectors.
|
|
294
|
+
const { embedding } = await createEmbedding(query);
|
|
227
295
|
const results = await client.query(collectionName, {
|
|
228
|
-
query:
|
|
229
|
-
text: query,
|
|
230
|
-
model: "sentence-transformers/all-MiniLM-L6-v2"
|
|
231
|
-
},
|
|
296
|
+
query: embedding,
|
|
232
297
|
limit: 10,
|
|
233
298
|
with_payload: true,
|
|
234
299
|
} as Parameters<typeof client.query>[1]);
|