pi-harness-runtime 1.1.411 → 1.1.413

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 (157) hide show
  1. package/harness/notification-settings.ts +130 -0
  2. package/harness/skill-remote-source.ts +157 -0
  3. package/harness/skill-sync.ts +74 -22
  4. package/harness/skills-startup.ts +229 -0
  5. package/harness/startup-report.ts +98 -56
  6. package/harness-startup-status.ts +31 -2
  7. package/index.ts +125 -31
  8. package/package.json +1 -1
  9. package/packages/a2a-adapter/package.json +1 -1
  10. package/packages/agent-policy/package.json +1 -1
  11. package/packages/architecture-generator/package.json +1 -1
  12. package/packages/auth/package.json +1 -1
  13. package/packages/autonomous-refactor/package.json +1 -1
  14. package/packages/autonomous-runtime/package.json +1 -1
  15. package/packages/cache-strategy/package.json +1 -1
  16. package/packages/capability-registry/package.json +1 -1
  17. package/packages/checkpoint/package.json +1 -1
  18. package/packages/cli-plugin-sdk/package.json +1 -1
  19. package/packages/clipboard/package.json +1 -1
  20. package/packages/clipboard-plugin/package.json +1 -1
  21. package/packages/code-generation/package.json +1 -1
  22. package/packages/code-review/package.json +1 -1
  23. package/packages/codex-adapter/package.json +1 -1
  24. package/packages/codex-watcher/package.json +1 -1
  25. package/packages/config-capture/package.json +1 -1
  26. package/packages/connection-runtime/package.json +1 -1
  27. package/packages/context-compiler/package.json +1 -1
  28. package/packages/context-discovery/package.json +1 -1
  29. package/packages/context-manager/package.json +1 -1
  30. package/packages/contracts/package.json +1 -1
  31. package/packages/cookie-sanitizer/package.json +1 -1
  32. package/packages/cost-optimizer/package.json +1 -1
  33. package/packages/dependency-analyzer/package.json +1 -1
  34. package/packages/django-plugin/package.json +1 -1
  35. package/packages/doc-generator/package.json +1 -1
  36. package/packages/durable-review/package.json +1 -1
  37. package/packages/e2e-tester/package.json +1 -1
  38. package/packages/evaluation-engine/package.json +1 -1
  39. package/packages/evaluation-runner/package.json +1 -1
  40. package/packages/event-bus/package.json +1 -1
  41. package/packages/event-sink/package.json +1 -1
  42. package/packages/event-store/package.json +1 -1
  43. package/packages/experience-replay/package.json +1 -1
  44. package/packages/feedback-collector/package.json +1 -1
  45. package/packages/file-copy-helper/package.json +1 -1
  46. package/packages/framework-detector/package.json +1 -1
  47. package/packages/framework-plugin-sdk/package.json +1 -1
  48. package/packages/frappe-plugin/package.json +1 -1
  49. package/packages/generic-web-plugin/package.json +1 -1
  50. package/packages/health-monitor/package.json +1 -1
  51. package/packages/intent-analyzer/package.json +1 -1
  52. package/packages/jev-judge/package.json +1 -1
  53. package/packages/knowledge-graph/package.json +1 -1
  54. package/packages/knowledge-retrieval/package.json +1 -1
  55. package/packages/laravel-plugin/package.json +1 -1
  56. package/packages/learning-engine/package.json +1 -1
  57. package/packages/logging/package.json +1 -1
  58. package/packages/mcp-adapter/package.json +1 -1
  59. package/packages/memory-engine/package.json +1 -1
  60. package/packages/milestone-manager/package.json +1 -1
  61. package/packages/model-registry/package.json +1 -1
  62. package/packages/nextjs-plugin/package.json +1 -1
  63. package/packages/notification/package.json +1 -1
  64. package/packages/observability/package.json +1 -1
  65. package/packages/okf-indexer/package.json +1 -1
  66. package/packages/paperclip-integration/package.json +1 -1
  67. package/packages/performance-optimizer/package.json +1 -1
  68. package/packages/permission-mode/package.json +1 -1
  69. package/packages/privilege-broker/package.json +1 -1
  70. package/packages/project-analyzer/package.json +1 -1
  71. package/packages/project-bootstrap/package.json +1 -1
  72. package/packages/projection-engine/package.json +1 -1
  73. package/packages/prompt-compiler/package.json +1 -1
  74. package/packages/prompt-versioning/package.json +1 -1
  75. package/packages/provider-adapter-sdk/package.json +1 -1
  76. package/packages/provider-router/package.json +1 -1
  77. package/packages/provider-selector/package.json +1 -1
  78. package/packages/providers/package.json +1 -1
  79. package/packages/qdrant-skills/dist/client.d.ts +10 -0
  80. package/packages/qdrant-skills/dist/client.d.ts.map +1 -1
  81. package/packages/qdrant-skills/dist/client.js +41 -9
  82. package/packages/qdrant-skills/dist/client.js.map +1 -1
  83. package/packages/qdrant-skills/dist/embedder.d.ts +10 -0
  84. package/packages/qdrant-skills/dist/embedder.d.ts.map +1 -1
  85. package/packages/qdrant-skills/dist/embedder.js +12 -2
  86. package/packages/qdrant-skills/dist/embedder.js.map +1 -1
  87. package/packages/qdrant-skills/dist/index.d.ts +2 -2
  88. package/packages/qdrant-skills/dist/index.d.ts.map +1 -1
  89. package/packages/qdrant-skills/dist/index.js +2 -2
  90. package/packages/qdrant-skills/dist/index.js.map +1 -1
  91. package/packages/qdrant-skills/package.json +1 -1
  92. package/packages/qdrant-skills/src/client.ts +38 -9
  93. package/packages/qdrant-skills/src/embedder.ts +14 -2
  94. package/packages/qdrant-skills/src/index.ts +3 -0
  95. package/packages/qdrant-skills/test/collection-info.test.ts +165 -0
  96. package/packages/quota-manager/package.json +1 -1
  97. package/packages/rate-limiter/package.json +1 -1
  98. package/packages/react-vite-plugin/package.json +1 -1
  99. package/packages/relay/package.json +1 -1
  100. package/packages/release-manager/package.json +1 -1
  101. package/packages/requirement-compiler/package.json +1 -1
  102. package/packages/runtime/package.json +1 -1
  103. package/packages/scheduler/package.json +1 -1
  104. package/packages/scheduler-adapter/package.json +1 -1
  105. package/packages/session/package.json +1 -1
  106. package/packages/session-api/package.json +1 -1
  107. package/packages/session-export/package.json +1 -1
  108. package/packages/shared-context/package.json +1 -1
  109. package/packages/skill-mcp-client/package.json +1 -1
  110. package/packages/skill-registry/package.json +1 -1
  111. package/packages/skills/dist/index.d.ts +14 -1
  112. package/packages/skills/dist/index.d.ts.map +1 -1
  113. package/packages/skills/dist/index.js +3 -1
  114. package/packages/skills/dist/index.js.map +1 -1
  115. package/packages/skills/dist/loader.d.ts +209 -0
  116. package/packages/skills/dist/loader.d.ts.map +1 -1
  117. package/packages/skills/dist/loader.js +386 -15
  118. package/packages/skills/dist/loader.js.map +1 -1
  119. package/packages/skills/dist/remote-source.d.ts +107 -0
  120. package/packages/skills/dist/remote-source.d.ts.map +1 -0
  121. package/packages/skills/dist/remote-source.js +79 -0
  122. package/packages/skills/dist/remote-source.js.map +1 -0
  123. package/packages/skills/dist/vector-schema.d.ts +58 -0
  124. package/packages/skills/dist/vector-schema.d.ts.map +1 -0
  125. package/packages/skills/dist/vector-schema.js +55 -0
  126. package/packages/skills/dist/vector-schema.js.map +1 -0
  127. package/packages/skills/package.json +1 -1
  128. package/packages/skills/src/index.ts +16 -2
  129. package/packages/skills/src/loader.ts +532 -39
  130. package/packages/skills/src/remote-source.ts +148 -0
  131. package/packages/skills/src/vector-schema.ts +72 -0
  132. package/packages/skills/test/remote-skills.test.ts +292 -0
  133. package/packages/skills/test/remote-source.test.ts +248 -0
  134. package/packages/sprint-planner/package.json +1 -1
  135. package/packages/subscription-engine/package.json +1 -1
  136. package/packages/task-compiler/package.json +1 -1
  137. package/packages/telegram/package.json +1 -1
  138. package/packages/tencentdb-memory/package.json +1 -1
  139. package/packages/tencentdb-sync/package.json +1 -1
  140. package/packages/test-data-generator/package.json +1 -1
  141. package/packages/test-generator/package.json +1 -1
  142. package/packages/todo-bd-sync/package.json +1 -1
  143. package/packages/token-estimation/package.json +1 -1
  144. package/packages/token-optimizer/package.json +1 -1
  145. package/packages/tooling-preference/package.json +1 -1
  146. package/packages/trajectory/package.json +1 -1
  147. package/packages/tui/package.json +1 -1
  148. package/packages/two-phase-review/package.json +1 -1
  149. package/packages/types/package.json +1 -1
  150. package/packages/voice-api/package.json +1 -1
  151. package/packages/webmcp-tester/package.json +1 -1
  152. package/packages/wiki/package.json +1 -1
  153. package/packages/workflow-events/package.json +1 -1
  154. package/packages/workspace-scanner/package.json +1 -1
  155. package/packages/worktree/package.json +1 -1
  156. package/packages/write-review/package.json +1 -1
  157. package/scripts/sync-to-qdrant.ts +79 -14
@@ -0,0 +1,107 @@
1
+ /**
2
+ * The server-held skills.
3
+ *
4
+ * The vector store holds an INDEX: the name, the description and a
5
+ * truncated body. That is enough to FIND a skill, but not to use it - a
6
+ * complete SKILL.md (with its references and examples) is larger than a
7
+ * vector store payload should be.
8
+ *
9
+ * The remote source is therefore the authoritative store of the complete
10
+ * skill content. It is reached through an authenticated service, so the
11
+ * SERVER decides which skills this user may see. A client never decides
12
+ * that on its own.
13
+ */
14
+ import type { Skill } from "./types.js";
15
+ /** A skill the server holds. */
16
+ export interface RemoteSkill {
17
+ /** The id the server knows the skill by. */
18
+ id: string;
19
+ /** The name of the skill. */
20
+ name: string;
21
+ /** What the skill does. */
22
+ description: string;
23
+ /** The version of the content. */
24
+ version?: string;
25
+ /** When the content changed the last time. */
26
+ updatedAt?: string;
27
+ /** The content of the skill (the body of SKILL.md). */
28
+ content?: string;
29
+ /**
30
+ * Whether the content is the COMPLETE skill.
31
+ *
32
+ * A vector store payload carries a truncated body - that is not a
33
+ * complete skill. The service returns the whole thing, so it sets
34
+ * this flag.
35
+ */
36
+ contentComplete?: boolean;
37
+ }
38
+ /** Where the server-held skills come from. */
39
+ export interface RemoteSkillSource {
40
+ /**
41
+ * The skills the server holds for this user and workspace.
42
+ *
43
+ * @param options The search term and the number of skills to return.
44
+ */
45
+ list(options?: {
46
+ search?: string;
47
+ limit?: number;
48
+ }): Promise<RemoteSkill[]>;
49
+ /** The complete content of one skill. */
50
+ get(id: string): Promise<RemoteSkill | null>;
51
+ }
52
+ /** The reasons a call to the remote source can fail. */
53
+ export type RemoteSkillFailure =
54
+ /** The service refused the call - the token is missing or wrong. */
55
+ "denied"
56
+ /** The service could not be reached. */
57
+ | "unavailable";
58
+ /** The state of the server-held skills. */
59
+ export type RemoteSkillState =
60
+ /** No service is configured. */
61
+ "not-configured"
62
+ /** The service refused the call. */
63
+ | "denied"
64
+ /** The service could not be reached. */
65
+ | "unavailable"
66
+ /** The service holds no skill for this user. */
67
+ | "empty"
68
+ /** The service holds skills. */
69
+ | "populated";
70
+ /** What the remote source knows. */
71
+ export interface RemoteSkillStats {
72
+ /** The state of the source. */
73
+ state: RemoteSkillState;
74
+ /** The number of skills the source holds. */
75
+ count: number;
76
+ /** The reason of a failed call. */
77
+ error?: string;
78
+ }
79
+ /**
80
+ * A skill from a remote record.
81
+ *
82
+ * The record carries the content, so the skill is usable without a local
83
+ * copy. The path stays empty: a server skill has no directory on this
84
+ * machine.
85
+ */
86
+ export declare function skillFromRemote(record: RemoteSkill): Skill;
87
+ /**
88
+ * The version of a cached remote skill.
89
+ *
90
+ * A skill without a version cannot be compared - the cache keeps it.
91
+ */
92
+ export declare function remoteVersion(skill: Skill | undefined): string | undefined;
93
+ /**
94
+ * The safe reason of a failed call.
95
+ *
96
+ * The message never carries a credential: a token that a service echoed
97
+ * back is removed before the message leaves the process.
98
+ */
99
+ export declare function describeRemoteFailure(error: unknown): string;
100
+ /**
101
+ * Whether the cached skill is older than the record.
102
+ *
103
+ * A record without a version never replaces a cached skill: an unknown
104
+ * version is not evidence of a change.
105
+ */
106
+ export declare function isStale(cached: Skill | undefined, record: RemoteSkill): boolean;
107
+ //# sourceMappingURL=remote-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-source.d.ts","sourceRoot":"","sources":["../src/remote-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,gCAAgC;AAChC,MAAM,WAAW,WAAW;IAC3B,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,8CAA8C;AAC9C,MAAM,WAAW,iBAAiB;IACjC;;;;OAIG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAC5E,yCAAyC;IACzC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC7C;AAED,wDAAwD;AACxD,MAAM,MAAM,kBAAkB;AAC7B,oEAAoE;AAClE,QAAQ;AACV,wCAAwC;GACtC,aAAa,CAAC;AAEjB,2CAA2C;AAC3C,MAAM,MAAM,gBAAgB;AAC3B,gCAAgC;AAC9B,gBAAgB;AAClB,oCAAoC;GAClC,QAAQ;AACV,wCAAwC;GACtC,aAAa;AACf,gDAAgD;GAC9C,OAAO;AACT,gCAAgC;GAC9B,WAAW,CAAC;AAEf,oCAAoC;AACpC,MAAM,WAAW,gBAAgB;IAChC,+BAA+B;IAC/B,KAAK,EAAE,gBAAgB,CAAC;IACxB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,KAAK,CAqB1D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAE1E;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAQ5D;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,KAAK,GAAG,SAAS,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAI/E"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * The server-held skills.
3
+ *
4
+ * The vector store holds an INDEX: the name, the description and a
5
+ * truncated body. That is enough to FIND a skill, but not to use it - a
6
+ * complete SKILL.md (with its references and examples) is larger than a
7
+ * vector store payload should be.
8
+ *
9
+ * The remote source is therefore the authoritative store of the complete
10
+ * skill content. It is reached through an authenticated service, so the
11
+ * SERVER decides which skills this user may see. A client never decides
12
+ * that on its own.
13
+ */
14
+ /**
15
+ * A skill from a remote record.
16
+ *
17
+ * The record carries the content, so the skill is usable without a local
18
+ * copy. The path stays empty: a server skill has no directory on this
19
+ * machine.
20
+ */
21
+ export function skillFromRemote(record) {
22
+ const version = record.version;
23
+ return {
24
+ id: record.id,
25
+ path: "",
26
+ frontmatter: {
27
+ name: record.name,
28
+ description: record.description,
29
+ ...(version ? { version } : {}),
30
+ },
31
+ body: record.content ?? "",
32
+ references: [],
33
+ examples: [],
34
+ metadata: {
35
+ name: record.name,
36
+ description: record.description,
37
+ ...(version ? { version } : {}),
38
+ ...(record.updatedAt ? { updated_at: record.updatedAt } : {}),
39
+ },
40
+ loaded: true,
41
+ };
42
+ }
43
+ /**
44
+ * The version of a cached remote skill.
45
+ *
46
+ * A skill without a version cannot be compared - the cache keeps it.
47
+ */
48
+ export function remoteVersion(skill) {
49
+ return skill?.frontmatter.version ?? skill?.metadata.version;
50
+ }
51
+ /**
52
+ * The safe reason of a failed call.
53
+ *
54
+ * The message never carries a credential: a token that a service echoed
55
+ * back is removed before the message leaves the process.
56
+ */
57
+ export function describeRemoteFailure(error) {
58
+ const raw = error instanceof Error ? error.message : String(error ?? "");
59
+ const safe = raw
60
+ .replace(/bearer\s+\S+/gi, "bearer <redacted>")
61
+ .replace(/\b[A-Za-z0-9_-]{32,}\b/g, "<redacted>")
62
+ .replace(/\s+/g, " ")
63
+ .trim();
64
+ return safe.slice(0, 200) || "the service could not be reached";
65
+ }
66
+ /**
67
+ * Whether the cached skill is older than the record.
68
+ *
69
+ * A record without a version never replaces a cached skill: an unknown
70
+ * version is not evidence of a change.
71
+ */
72
+ export function isStale(cached, record) {
73
+ if (!cached)
74
+ return true;
75
+ if (!record.version)
76
+ return false;
77
+ return remoteVersion(cached) !== record.version;
78
+ }
79
+ //# sourceMappingURL=remote-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-source.js","sourceRoot":"","sources":["../src/remote-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAsEH;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,MAAmB;IAClD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAC/B,OAAO;QACN,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,IAAI,EAAE,EAAE;QACR,WAAW,EAAE;YACZ,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC/B;QACD,IAAI,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE;QAC1B,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE;YACT,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/B,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC7D;QACD,MAAM,EAAE,IAAI;KACZ,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAwB;IACrD,OAAO,KAAK,EAAE,WAAW,CAAC,OAAO,IAAI,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC;AAC9D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IACzE,MAAM,IAAI,GAAG,GAAG;SACb,OAAO,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;SAC9C,OAAO,CAAC,yBAAyB,EAAE,YAAY,CAAC;SAChD,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CAAC;IACV,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,kCAAkC,CAAC;AAClE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,MAAyB,EAAE,MAAmB;IACrE,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAClC,OAAO,aAAa,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,OAAO,CAAC;AACjD,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * The vector schema of the skill collection.
3
+ *
4
+ * A Qdrant collection holds vectors of exactly ONE size. Two different
5
+ * embedding models produce two different vector sizes, so they must never
6
+ * write into the same collection: the second writer is rejected by the
7
+ * server with a dimension error, and the data of the first writer becomes
8
+ * unsearchable by the second.
9
+ *
10
+ * The collection name carries the model and a version, so a change of the
11
+ * model leads to a NEW collection instead of a silent mix of two vector
12
+ * spaces.
13
+ *
14
+ * The model itself lives in the Qdrant package (the embedder owns it). This
15
+ * module owns the collection - that is a decision of the skills domain, not
16
+ * of the vector store.
17
+ */
18
+ /**
19
+ * The collection the runtime indexes into and searches.
20
+ *
21
+ * `QDRANT_COLLECTION` overrides it, so a cluster that already holds a
22
+ * collection under another name keeps working.
23
+ */
24
+ export declare const SKILL_COLLECTION = "pi-harness-skills-openai-v1";
25
+ /**
26
+ * The collection that was used before the schema was versioned.
27
+ *
28
+ * It holds 384-dimensional vectors - the model that
29
+ * `scripts/sync-to-qdrant.ts` used - and is NOT compatible with the
30
+ * runtime. It is named here so a mismatch can name the real cause instead
31
+ * of only the numbers.
32
+ */
33
+ export declare const LEGACY_SKILL_COLLECTION = "pi-harness-skills";
34
+ /** The model of the legacy collection. */
35
+ export declare const LEGACY_SKILL_COLLECTION_MODEL = "sentence-transformers/all-MiniLM-L6-v2";
36
+ /** The vector size of the legacy collection. */
37
+ export declare const LEGACY_SKILL_COLLECTION_DIMENSIONS = 384;
38
+ /** The schema a skill collection is expected to have. */
39
+ export interface SkillVectorSchema {
40
+ /** The vector size. */
41
+ dimensions: number;
42
+ /** The distance metric. */
43
+ distance: string;
44
+ /** The embedding model, when it is known. */
45
+ model?: string;
46
+ }
47
+ /**
48
+ * Why the collection does not match the expected schema - or null when it
49
+ * does.
50
+ *
51
+ * The message names the numbers, so the reader can tell WHICH schema the
52
+ * collection was built with.
53
+ */
54
+ export declare function describeSkillSchemaMismatch(actual: {
55
+ dimensions?: number;
56
+ distance?: string;
57
+ }, expected: SkillVectorSchema): string | null;
58
+ //# sourceMappingURL=vector-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector-schema.d.ts","sourceRoot":"","sources":["../src/vector-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,gCAAgC,CAAC;AAE9D;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAE3D,0CAA0C;AAC1C,eAAO,MAAM,6BAA6B,2CAA2C,CAAC;AAEtF,gDAAgD;AAChD,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAEtD,yDAAyD;AACzD,MAAM,WAAW,iBAAiB;IACjC,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,EAClD,QAAQ,EAAE,iBAAiB,GACzB,MAAM,GAAG,IAAI,CASf"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * The vector schema of the skill collection.
3
+ *
4
+ * A Qdrant collection holds vectors of exactly ONE size. Two different
5
+ * embedding models produce two different vector sizes, so they must never
6
+ * write into the same collection: the second writer is rejected by the
7
+ * server with a dimension error, and the data of the first writer becomes
8
+ * unsearchable by the second.
9
+ *
10
+ * The collection name carries the model and a version, so a change of the
11
+ * model leads to a NEW collection instead of a silent mix of two vector
12
+ * spaces.
13
+ *
14
+ * The model itself lives in the Qdrant package (the embedder owns it). This
15
+ * module owns the collection - that is a decision of the skills domain, not
16
+ * of the vector store.
17
+ */
18
+ /**
19
+ * The collection the runtime indexes into and searches.
20
+ *
21
+ * `QDRANT_COLLECTION` overrides it, so a cluster that already holds a
22
+ * collection under another name keeps working.
23
+ */
24
+ export const SKILL_COLLECTION = "pi-harness-skills-openai-v1";
25
+ /**
26
+ * The collection that was used before the schema was versioned.
27
+ *
28
+ * It holds 384-dimensional vectors - the model that
29
+ * `scripts/sync-to-qdrant.ts` used - and is NOT compatible with the
30
+ * runtime. It is named here so a mismatch can name the real cause instead
31
+ * of only the numbers.
32
+ */
33
+ export const LEGACY_SKILL_COLLECTION = "pi-harness-skills";
34
+ /** The model of the legacy collection. */
35
+ export const LEGACY_SKILL_COLLECTION_MODEL = "sentence-transformers/all-MiniLM-L6-v2";
36
+ /** The vector size of the legacy collection. */
37
+ export const LEGACY_SKILL_COLLECTION_DIMENSIONS = 384;
38
+ /**
39
+ * Why the collection does not match the expected schema - or null when it
40
+ * does.
41
+ *
42
+ * The message names the numbers, so the reader can tell WHICH schema the
43
+ * collection was built with.
44
+ */
45
+ export function describeSkillSchemaMismatch(actual, expected) {
46
+ if (actual.dimensions !== undefined && actual.dimensions !== expected.dimensions) {
47
+ const model = expected.model ? ` (${expected.model})` : "";
48
+ return `the collection holds ${actual.dimensions}-dimensional vectors, the runtime embeds with ${expected.dimensions}${model}`;
49
+ }
50
+ if (actual.distance !== undefined && actual.distance !== expected.distance) {
51
+ return `the collection uses the ${actual.distance} distance, the runtime expects ${expected.distance}`;
52
+ }
53
+ return null;
54
+ }
55
+ //# sourceMappingURL=vector-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector-schema.js","sourceRoot":"","sources":["../src/vector-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,6BAA6B,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAE3D,0CAA0C;AAC1C,MAAM,CAAC,MAAM,6BAA6B,GAAG,wCAAwC,CAAC;AAEtF,gDAAgD;AAChD,MAAM,CAAC,MAAM,kCAAkC,GAAG,GAAG,CAAC;AAYtD;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CAC1C,MAAkD,EAClD,QAA2B;IAE3B,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,IAAI,MAAM,CAAC,UAAU,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC;QAClF,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,OAAO,wBAAwB,MAAM,CAAC,UAAU,iDAAiD,QAAQ,CAAC,UAAU,GAAG,KAAK,EAAE,CAAC;IAChI,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC5E,OAAO,2BAA2B,MAAM,CAAC,QAAQ,kCAAkC,QAAQ,CAAC,QAAQ,EAAE,CAAC;IACxG,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/skills",
3
- "version": "1.1.411",
3
+ "version": "1.1.413",
4
4
  "description": "File-based skill system with pi.dev compatibility and Hermes self-improvement",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -13,6 +13,8 @@ export * from "./types.js";
13
13
  export * from "./parser.js";
14
14
  export * from "./scanner.js";
15
15
  export * from "./loader.js";
16
+ export * from "./vector-schema.js";
17
+ export * from "./remote-source.js";
16
18
  export * from "./skill-commands.js";
17
19
  export * from "./skill-tool.js";
18
20
  export * from "./skill-versioning.js";
@@ -22,6 +24,18 @@ import type { SkillsConfig, ScanResult, ScanOptions } from "./types.js";
22
24
  import { scanForSkillsSync } from "./scanner.js";
23
25
  import { getGlobalSkillRegistry, type SkillRegistry } from "./loader.js";
24
26
 
27
+ /**
28
+ * The result of the skill initialization.
29
+ *
30
+ * The registry is part of the result so a caller can ask the vector store
31
+ * about its state (how many skills it holds) without reaching for the
32
+ * global registry.
33
+ */
34
+ export interface SkillsInitResult extends ScanResult {
35
+ /** The registry the skills were registered in. */
36
+ registry: SkillRegistry;
37
+ }
38
+
25
39
  /**
26
40
  * Initialize skills system
27
41
  *
@@ -36,7 +50,7 @@ export function initSkills(
36
50
  registry?: SkillRegistry;
37
51
  }
38
52
  >
39
- ): ScanResult {
53
+ ): SkillsInitResult {
40
54
  const registry = config?.registry ?? getGlobalSkillRegistry();
41
55
 
42
56
  // Scan for skills
@@ -58,7 +72,7 @@ export function initSkills(
58
72
  // Hint: if ~/.pi-harness-runtime/skills/ is empty, suggest the sync script
59
73
  checkEmptySkillsDir();
60
74
 
61
- return result;
75
+ return { ...result, registry };
62
76
  }
63
77
 
64
78
  /** Show sync hint if the harness skills dir is empty. */