pi-harness-runtime 1.1.416 → 1.1.417

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.
Files changed (126) hide show
  1. package/package.json +1 -1
  2. package/packages/a2a-adapter/package.json +1 -1
  3. package/packages/agent-policy/package.json +1 -1
  4. package/packages/architecture-generator/package.json +1 -1
  5. package/packages/auth/package.json +1 -1
  6. package/packages/autonomous-refactor/package.json +1 -1
  7. package/packages/autonomous-runtime/package.json +1 -1
  8. package/packages/cache-strategy/package.json +1 -1
  9. package/packages/capability-registry/package.json +1 -1
  10. package/packages/checkpoint/package.json +1 -1
  11. package/packages/cli-plugin-sdk/package.json +1 -1
  12. package/packages/clipboard/package.json +1 -1
  13. package/packages/clipboard-plugin/package.json +1 -1
  14. package/packages/code-generation/package.json +1 -1
  15. package/packages/code-review/package.json +1 -1
  16. package/packages/codex-adapter/package.json +1 -1
  17. package/packages/codex-watcher/package.json +1 -1
  18. package/packages/config-capture/package.json +1 -1
  19. package/packages/connection-runtime/package.json +1 -1
  20. package/packages/context-compiler/package.json +1 -1
  21. package/packages/context-discovery/package.json +1 -1
  22. package/packages/context-manager/package.json +1 -1
  23. package/packages/contracts/package.json +1 -1
  24. package/packages/cookie-sanitizer/package.json +1 -1
  25. package/packages/cost-optimizer/package.json +1 -1
  26. package/packages/dependency-analyzer/package.json +1 -1
  27. package/packages/django-plugin/package.json +1 -1
  28. package/packages/doc-generator/package.json +1 -1
  29. package/packages/durable-review/package.json +1 -1
  30. package/packages/e2e-tester/package.json +1 -1
  31. package/packages/evaluation-engine/package.json +1 -1
  32. package/packages/evaluation-runner/package.json +1 -1
  33. package/packages/event-bus/package.json +1 -1
  34. package/packages/event-sink/package.json +1 -1
  35. package/packages/event-store/package.json +1 -1
  36. package/packages/experience-replay/package.json +1 -1
  37. package/packages/feedback-collector/package.json +1 -1
  38. package/packages/file-copy-helper/package.json +1 -1
  39. package/packages/framework-detector/package.json +1 -1
  40. package/packages/framework-plugin-sdk/package.json +1 -1
  41. package/packages/frappe-plugin/package.json +1 -1
  42. package/packages/generic-web-plugin/package.json +1 -1
  43. package/packages/health-monitor/package.json +1 -1
  44. package/packages/intent-analyzer/package.json +1 -1
  45. package/packages/jev-judge/package.json +1 -1
  46. package/packages/knowledge-graph/package.json +1 -1
  47. package/packages/knowledge-retrieval/package.json +1 -1
  48. package/packages/laravel-plugin/package.json +1 -1
  49. package/packages/learning-engine/package.json +1 -1
  50. package/packages/logging/package.json +1 -1
  51. package/packages/mcp-adapter/package.json +1 -1
  52. package/packages/memory-engine/package.json +1 -1
  53. package/packages/milestone-manager/package.json +1 -1
  54. package/packages/model-registry/package.json +1 -1
  55. package/packages/nextjs-plugin/package.json +1 -1
  56. package/packages/notification/package.json +1 -1
  57. package/packages/observability/package.json +1 -1
  58. package/packages/okf-indexer/package.json +1 -1
  59. package/packages/paperclip-integration/package.json +1 -1
  60. package/packages/performance-optimizer/package.json +1 -1
  61. package/packages/permission-mode/package.json +1 -1
  62. package/packages/privilege-broker/package.json +1 -1
  63. package/packages/project-analyzer/package.json +1 -1
  64. package/packages/project-bootstrap/package.json +1 -1
  65. package/packages/projection-engine/package.json +1 -1
  66. package/packages/prompt-compiler/package.json +1 -1
  67. package/packages/prompt-versioning/package.json +1 -1
  68. package/packages/provider-adapter-sdk/package.json +1 -1
  69. package/packages/provider-router/package.json +1 -1
  70. package/packages/provider-selector/package.json +1 -1
  71. package/packages/providers/package.json +1 -1
  72. package/packages/qdrant-skills/package.json +1 -1
  73. package/packages/quota-manager/package.json +1 -1
  74. package/packages/rate-limiter/package.json +1 -1
  75. package/packages/react-vite-plugin/package.json +1 -1
  76. package/packages/relay/package.json +1 -1
  77. package/packages/release-manager/package.json +1 -1
  78. package/packages/requirement-compiler/package.json +1 -1
  79. package/packages/runtime/package.json +1 -1
  80. package/packages/scheduler/package.json +1 -1
  81. package/packages/scheduler-adapter/package.json +1 -1
  82. package/packages/session/package.json +1 -1
  83. package/packages/session-api/package.json +1 -1
  84. package/packages/session-export/package.json +1 -1
  85. package/packages/shared-context/package.json +1 -1
  86. package/packages/skill-mcp-client/package.json +1 -1
  87. package/packages/skill-registry/package.json +1 -1
  88. package/packages/skills/dist/loader.d.ts +2 -1
  89. package/packages/skills/dist/loader.d.ts.map +1 -1
  90. package/packages/skills/dist/loader.js +4 -3
  91. package/packages/skills/dist/loader.js.map +1 -1
  92. package/packages/skills/dist/skill-commands.d.ts.map +1 -1
  93. package/packages/skills/dist/skill-commands.js +2 -1
  94. package/packages/skills/dist/skill-commands.js.map +1 -1
  95. package/packages/skills/dist/vector-schema.d.ts +28 -0
  96. package/packages/skills/dist/vector-schema.d.ts.map +1 -1
  97. package/packages/skills/dist/vector-schema.js +28 -0
  98. package/packages/skills/dist/vector-schema.js.map +1 -1
  99. package/packages/skills/package.json +1 -1
  100. package/packages/skills/src/loader.ts +4 -2
  101. package/packages/skills/src/skill-commands.ts +2 -1
  102. package/packages/skills/src/vector-schema.ts +30 -0
  103. package/packages/skills/test/vector-threshold.test.ts +108 -0
  104. package/packages/sprint-planner/package.json +1 -1
  105. package/packages/subscription-engine/package.json +1 -1
  106. package/packages/task-compiler/package.json +1 -1
  107. package/packages/telegram/package.json +1 -1
  108. package/packages/tencentdb-memory/package.json +1 -1
  109. package/packages/tencentdb-sync/package.json +1 -1
  110. package/packages/test-data-generator/package.json +1 -1
  111. package/packages/test-generator/package.json +1 -1
  112. package/packages/todo-bd-sync/package.json +1 -1
  113. package/packages/token-estimation/package.json +1 -1
  114. package/packages/token-optimizer/package.json +1 -1
  115. package/packages/tooling-preference/package.json +1 -1
  116. package/packages/trajectory/package.json +1 -1
  117. package/packages/tui/package.json +1 -1
  118. package/packages/two-phase-review/package.json +1 -1
  119. package/packages/types/package.json +1 -1
  120. package/packages/voice-api/package.json +1 -1
  121. package/packages/webmcp-tester/package.json +1 -1
  122. package/packages/wiki/package.json +1 -1
  123. package/packages/workflow-events/package.json +1 -1
  124. package/packages/workspace-scanner/package.json +1 -1
  125. package/packages/worktree/package.json +1 -1
  126. package/packages/write-review/package.json +1 -1
@@ -42,6 +42,36 @@ export const LEGACY_SKILL_COLLECTION_MODEL = "sentence-transformers/all-MiniLM-L
42
42
  /** The vector size of the legacy collection. */
43
43
  export const LEGACY_SKILL_COLLECTION_DIMENSIONS = 384;
44
44
 
45
+ /**
46
+ * The score below which a hit of the runtime collection is not a hit.
47
+ *
48
+ * The score of a vector search is a cosine between two vectors, and its
49
+ * scale belongs to the model that produced them. Measured against the
50
+ * runtime collection (123 skills, `text-embedding-3-small`):
51
+ *
52
+ * - a query that names a skill scores 0.31 to 0.56,
53
+ * - a query about something else scores 0.10 to 0.23, and the wrong
54
+ * skill that it matched tops out at 0.2305.
55
+ *
56
+ * The threshold sits between the two (0.27). The old value of 0.5 belonged
57
+ * to the MiniLM collection, whose vectors are not comparable, and it
58
+ * threw away even a clear match (0.47) - so a search of the runtime
59
+ * collection returned nothing at all.
60
+ *
61
+ * It lives here, next to the model and the collection, so that the two
62
+ * cannot drift apart.
63
+ */
64
+ export const SKILL_MIN_SCORE = 0.27;
65
+
66
+ /**
67
+ * The score below which a hit of the legacy collection is not a hit.
68
+ *
69
+ * The legacy collection holds MiniLM vectors. Their scale was never
70
+ * measured against a query, so the old value is kept. It is named here
71
+ * so it is not mistaken for the threshold of the runtime.
72
+ */
73
+ export const LEGACY_SKILL_MIN_SCORE = 0.5;
74
+
45
75
  /** The schema a skill collection is expected to have. */
46
76
  export interface SkillVectorSchema {
47
77
  /** The vector size. */
@@ -0,0 +1,108 @@
1
+ /**
2
+ * The score that decides whether a hit of the vector store is a hit.
3
+ *
4
+ * The score of a vector search is a cosine between two vectors, and its
5
+ * scale belongs to the model that produced them. The runtime embeds with
6
+ * `text-embedding-3-small`, whose cosines for a query that names a skill
7
+ * land between 0.31 and 0.56 - while a query about something else reaches
8
+ * 0.23 at most.
9
+ *
10
+ * The threshold used to be 0.5, a value of the MiniLM collection, whose
11
+ * vectors are not comparable. Against the runtime collection it threw away
12
+ * every clear match (0.47) - a search of a filled collection returned
13
+ * nothing at all, and the skill was invisible.
14
+ *
15
+ * The threshold therefore lives next to the model, and the tests below
16
+ * hold it there.
17
+ */
18
+
19
+ import { describe, expect, it } from "bun:test";
20
+ import { readFileSync } from "node:fs";
21
+ import { fileURLToPath } from "node:url";
22
+
23
+ import {
24
+ createSkillRegistry,
25
+ type QdrantClientLike,
26
+ type QdrantEmbedderLike,
27
+ } from "../src/loader.js";
28
+ import { SKILL_MIN_SCORE } from "../src/vector-schema.js";
29
+
30
+ /** A client that answers a query with the given points. */
31
+ function fakeClient(points: Array<{ id: number; score: number }>): QdrantClientLike {
32
+ return {
33
+ async upsert(): Promise<void> {},
34
+ async query(): Promise<unknown> {
35
+ return { points };
36
+ },
37
+ async getCollection(): Promise<unknown> {
38
+ return { config: { params: { vectors: { size: 1536, distance: "Cosine" } } } };
39
+ },
40
+ };
41
+ }
42
+
43
+ /** An embedder that returns a fixed vector. */
44
+ const fakeEmbedder: QdrantEmbedderLike = {
45
+ async createEmbedding() {
46
+ return { embedding: [0.1, 0.2, 0.3], tokens: 3 };
47
+ },
48
+ };
49
+
50
+ const registryWith = (scores: number[]) =>
51
+ createSkillRegistry({
52
+ qdrantClient: fakeClient(
53
+ scores.map((score, index) => ({
54
+ id: index + 1,
55
+ score,
56
+ payload: { name: `skill-${index}`, description: "d", body: "b" },
57
+ })),
58
+ ),
59
+ embedder: fakeEmbedder,
60
+ collection: "pi-harness-skills-test",
61
+ });
62
+
63
+ describe("the score that decides whether a hit is a hit", () => {
64
+ it("belongs to the model of the collection", () => {
65
+ // The measured values: a query that names a skill scores 0.31 to
66
+ // 0.56, a query about something else 0.10 to 0.23.
67
+ expect(SKILL_MIN_SCORE).toBeGreaterThan(0.23);
68
+ expect(SKILL_MIN_SCORE).toBeLessThan(0.31);
69
+ });
70
+
71
+ it("keeps a clear match that the old threshold of 0.5 threw away", async () => {
72
+ // 0.47 is a clear match of the runtime model - and below 0.5.
73
+ const registry = registryWith([0.47]);
74
+
75
+ const results = await registry.findVector("approve a purchase order");
76
+
77
+ expect(results).toHaveLength(1);
78
+ expect(results[0].score).toBe(0.47);
79
+ });
80
+
81
+ it("drops a hit that is noise", async () => {
82
+ const registry = registryWith([0.23]);
83
+
84
+ const results = await registry.findVector("cook a risotto");
85
+
86
+ expect(results).toHaveLength(0);
87
+ });
88
+
89
+ it("keeps the hits above it and drops the hits below it", async () => {
90
+ const registry = registryWith([0.55, 0.12, 0.4, 0.2]);
91
+
92
+ const results = await registry.findVector("a query");
93
+
94
+ expect(results.map((r) => r.score)).toEqual([0.55, 0.4]);
95
+ });
96
+
97
+ it("is the threshold of the skill command too", () => {
98
+ // The command passed 0.5 itself, so the fix of the default would
99
+ // not have reached the search of the user.
100
+ const source = readFileSync(
101
+ fileURLToPath(new URL("../src/skill-commands.ts", import.meta.url)),
102
+ "utf8",
103
+ );
104
+
105
+ expect(source).toContain("SKILL_MIN_SCORE");
106
+ expect(source).not.toMatch(/findVector\([^)]*,\s*5,\s*0\.5/);
107
+ });
108
+ });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/sprint-planner",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "type": "module",
5
5
  "description": "Sprint planning engine for pi-harness",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/subscription-engine",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/task-compiler",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "Task Compiler for pi-harness-runtime — produces deterministic task DAG from CompiledRequirement",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/telegram",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "pi-harness-runtime — Telegram inbound/outbound",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moocoding/tencentdb-memory",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "TencentDB Agent Memory client - sync skills to centralized knowledge base",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/tencentdb-sync",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "Sync SKILL.md skills to TencentDB-Agent-Memory server (RFC-0105/0106)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/test-data-generator",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "Test data generation for pi-harness-runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/test-generator",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "Auto-Test Generator — generate unit and E2E tests from source code (RFC-0013)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moocoding/todo-bd-sync",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "Two-way sync between rpiv-todo overlay and bd issue tracker",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/token-estimation",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "pi-harness-runtime — token-estimation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/token-optimizer",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "Token Budget Optimizer — maximize prompt value within token limits (RFC-0011)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/tooling-preference",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "pi-harness-runtime — JS/TS tooling preference (Biome vs ESLint/Prettier) proposal",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/trajectory",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "Trajectory capture for the write-review loop — persists cycle records for learning",
5
5
  "type": "module",
6
6
  "main": "./dist/src/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/tui",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "pi-harness-runtime — tui",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/two-phase-review",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
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",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/types",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "Shared TypeScript types for pi-harness-runtime packages",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/voice-api",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "type": "module",
5
5
  "description": "Voice-to-text API using Whisper for Telegram and LINE integration",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/webmcp-tester",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "WebMCP-powered E2E testing for pi-harness - natural language test scenarios",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/wiki",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "LLM Wiki integration for pi-harness-runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/workflow-events",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/workspace-scanner",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/worktree",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "pi-harness-runtime — worktree",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moocoding/write-review",
3
- "version": "1.1.416",
3
+ "version": "1.1.417",
4
4
  "description": "Two-agent write-review loop with blackboard coordination",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",