0xray 3.5.5 → 4.0.1

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 (233) hide show
  1. package/.mcp.json +18 -14
  2. package/.opencode/skills/api-design/SKILL.md +1 -1
  3. package/.opencode/skills/architect-tools/SKILL.md +1 -1
  4. package/.opencode/skills/architecture-patterns/SKILL.md +1 -1
  5. package/.opencode/skills/auto-format/SKILL.md +1 -1
  6. package/.opencode/skills/boot-orchestrator/SKILL.md +2 -6
  7. package/.opencode/skills/bug-triage/SKILL.md +1 -1
  8. package/.opencode/skills/code-analyzer/SKILL.md +1 -1
  9. package/.opencode/skills/code-review/SKILL.md +1 -1
  10. package/.opencode/skills/enforcer/SKILL.md +1 -1
  11. package/.opencode/skills/framework-compliance-audit/SKILL.md +1 -1
  12. package/.opencode/skills/git-workflow/SKILL.md +1 -1
  13. package/.opencode/skills/hermes-agent/SKILL.md +36 -36
  14. package/.opencode/skills/inference-improve/SKILL.md +1 -1
  15. package/.opencode/skills/lint/SKILL.md +1 -1
  16. package/.opencode/skills/log-monitor/SKILL.md +1 -1
  17. package/.opencode/skills/model-health-check/SKILL.md +1 -1
  18. package/.opencode/skills/multimodal-looker/SKILL.md +1 -1
  19. package/.opencode/skills/orchestrator/SKILL.md +38 -14
  20. package/.opencode/skills/performance-analysis/SKILL.md +1 -1
  21. package/.opencode/skills/performance-optimization/SKILL.md +1 -1
  22. package/.opencode/skills/processor-pipeline/SKILL.md +1 -1
  23. package/.opencode/skills/project-analysis/SKILL.md +1 -1
  24. package/.opencode/skills/refactoring-strategies/SKILL.md +1 -1
  25. package/.opencode/skills/registry.json +65 -0
  26. package/.opencode/skills/researcher/SKILL.md +18 -5
  27. package/.opencode/skills/security-audit/SKILL.md +1 -1
  28. package/.opencode/skills/security-scan/SKILL.md +1 -1
  29. package/.opencode/skills/session-management/SKILL.md +1 -1
  30. package/.opencode/skills/state-manager/SKILL.md +1 -1
  31. package/.opencode/skills/storyteller/SKILL.md +1 -1
  32. package/.opencode/skills/strategist/SKILL.md +12 -0
  33. package/.opencode/skills/testing-best-practices/SKILL.md +37 -0
  34. package/.opencode/skills/testing-strategy/SKILL.md +14 -3
  35. package/.opencode/skills/ui-ux-design/SKILL.md +1 -1
  36. package/.opencode/skills/xray-orchestrator/index.ts +267 -0
  37. package/.xray/codex.json +12 -3
  38. package/.xray/features.json +28 -6
  39. package/.xray/features.schema.json +31 -0
  40. package/AGENTS-consumer.md +17 -7
  41. package/AGENTS.md +18 -10
  42. package/README.md +30 -27
  43. package/SKILLS.md +2 -2
  44. package/dist/AGENTS.md +18 -10
  45. package/dist/CHANGELOG.md +81 -11
  46. package/dist/README.md +30 -27
  47. package/dist/SKILLS.md +2 -2
  48. package/dist/cli/commands/hermes-install.js +3 -0
  49. package/dist/cli/commands/openclaw-install.js +14 -0
  50. package/dist/cli/index.js +10 -1
  51. package/dist/core/features-config.d.ts +15 -2
  52. package/dist/infrastructure/schemas/cloud-schemas.d.ts +1 -1
  53. package/dist/integrations/grok/grok-cli.d.ts +3 -0
  54. package/dist/integrations/grok/grok-cli.js +92 -4
  55. package/dist/integrations/grok/hooks/grok-hook-utils.js +53 -7
  56. package/dist/integrations/grok/hooks/post-tool-use.js +68 -46
  57. package/dist/integrations/grok/hooks/pre-tool-use.js +14 -31
  58. package/dist/integrations/grok/hooks/session-start.js +86 -4
  59. package/dist/integrations/grok/plugin/0xray/hooks/hooks.json +31 -24
  60. package/dist/integrations/hermes-agent/bridge.mjs +26 -1
  61. package/dist/integrations/hooks/delegation-gate-runtime.mjs +32 -3
  62. package/dist/integrations/hooks/pipeline-hook-runtime.mjs +1 -1
  63. package/dist/integrations/hooks/station-hook-runtime.cjs +421 -0
  64. package/dist/integrations/hooks/station-hook-runtime.mjs +24 -0
  65. package/dist/integrations/hooks/station-memory-ingest.mjs +45 -0
  66. package/dist/integrations/hooks/station-memory-match.mjs +47 -0
  67. package/dist/integrations/openclaw/client.d.ts +5 -1
  68. package/dist/integrations/openclaw/client.js +17 -9
  69. package/dist/integrations/openclaw/config.js +0 -1
  70. package/dist/integrations/openclaw/hooks/pre-tool-gate-runtime.mjs +102 -0
  71. package/dist/integrations/openclaw/index.js +17 -0
  72. package/dist/integrations/openclaw/plugin/xray-pre-tool/index.js +75 -0
  73. package/dist/integrations/openclaw/plugin/xray-pre-tool/openclaw.plugin.json +10 -0
  74. package/dist/integrations/openclaw/plugin/xray-pre-tool/package.json +12 -0
  75. package/dist/integrations/openclaw/pre-tool-gate.d.ts +19 -0
  76. package/dist/integrations/openclaw/pre-tool-gate.js +39 -0
  77. package/dist/mcps/orchestrator/handlers/complexity-handler.js +2 -2
  78. package/dist/memory-routing/index.d.ts +1 -1
  79. package/dist/memory-routing/index.js +1 -1
  80. package/dist/memory-routing/provider-loader.d.ts +4 -0
  81. package/dist/memory-routing/provider-loader.js +44 -2
  82. package/dist/memory-routing/provider-registry.js +3 -2
  83. package/dist/nucleus/autonomy-kernel.d.ts +2 -2
  84. package/dist/nucleus/autonomy-kernel.js +17 -6
  85. package/dist/nucleus/confer.js +17 -3
  86. package/dist/nucleus/delegation-gate.d.ts +14 -8
  87. package/dist/nucleus/delegation-gate.js +151 -16
  88. package/dist/nucleus/suit-temperament.d.ts +40 -0
  89. package/dist/nucleus/suit-temperament.js +157 -0
  90. package/dist/nucleus/user-aside.js +1 -1
  91. package/dist/plugin/xray-codex-injection.js +14 -3
  92. package/dist/postprocessor/triggers/GitHookTrigger.js +11 -5
  93. package/opencode.json +80 -0
  94. package/package.json +15 -5
  95. package/scripts/hooks/install-hooks.cjs +18 -3
  96. package/scripts/hooks/run-hook.js +67 -3
  97. package/scripts/mjs/run-repertoire-mcp.mjs +39 -0
  98. package/scripts/mjs/verify-confer-core.mjs +1 -1
  99. package/scripts/mjs/verify-delegation-gate-core.mjs +29 -2
  100. package/scripts/mjs/verify-four-floor-compact.mjs +524 -0
  101. package/scripts/mjs/verify-pipeline-facets.mjs +215 -0
  102. package/scripts/mjs/verify-temperament-live.mjs +261 -0
  103. package/scripts/node/bridge-mcp-wiring.cjs +277 -29
  104. package/scripts/node/consumer-install-smoke.mjs +55 -2
  105. package/scripts/node/install-bridges.cjs +195 -33
  106. package/scripts/node/postinstall.cjs +50 -27
  107. package/scripts/node/reconcile-version.mjs +0 -4
  108. package/scripts/node/release-gate.mjs +1 -1
  109. package/scripts/node/release.mjs +2 -2
  110. package/scripts/node/universal-version-manager.js +1 -1
  111. package/scripts/node/validate-release-docs.mjs +20 -33
  112. package/scripts/node/version-manager.mjs +63 -18
  113. package/src/integrations/grok/plugin/0xray/hooks/hooks.json +31 -24
  114. package/src/integrations/openclaw/README.md +134 -0
  115. package/src/integrations/openclaw/plugin/xray-pre-tool/index.js +75 -0
  116. package/src/integrations/openclaw/plugin/xray-pre-tool/openclaw.plugin.json +10 -0
  117. package/src/integrations/openclaw/plugin/xray-pre-tool/package.json +12 -0
  118. package/src/mcps/orchestrator/handlers/complexity-handler.ts +2 -1
  119. package/vendor/@0xray/repertoire/AGENTS.md +163 -0
  120. package/vendor/@0xray/repertoire/LICENSE +21 -0
  121. package/vendor/@0xray/repertoire/README.md +120 -0
  122. package/vendor/@0xray/repertoire/data/curated_signals.json +208 -0
  123. package/vendor/@0xray/repertoire/dist/RepertoireService.d.ts +78 -0
  124. package/vendor/@0xray/repertoire/dist/RepertoireService.d.ts.map +1 -0
  125. package/vendor/@0xray/repertoire/dist/RepertoireService.js +153 -0
  126. package/vendor/@0xray/repertoire/dist/RepertoireService.js.map +1 -0
  127. package/vendor/@0xray/repertoire/dist/governance/ontological-trap-enforcer.d.ts +39 -0
  128. package/vendor/@0xray/repertoire/dist/governance/ontological-trap-enforcer.d.ts.map +1 -0
  129. package/vendor/@0xray/repertoire/dist/governance/ontological-trap-enforcer.js +60 -0
  130. package/vendor/@0xray/repertoire/dist/governance/ontological-trap-enforcer.js.map +1 -0
  131. package/vendor/@0xray/repertoire/dist/index.d.ts +14 -0
  132. package/vendor/@0xray/repertoire/dist/index.d.ts.map +1 -0
  133. package/vendor/@0xray/repertoire/dist/index.js +14 -0
  134. package/vendor/@0xray/repertoire/dist/index.js.map +1 -0
  135. package/vendor/@0xray/repertoire/dist/ingestion/groover-log-ingester.d.ts +26 -0
  136. package/vendor/@0xray/repertoire/dist/ingestion/groover-log-ingester.d.ts.map +1 -0
  137. package/vendor/@0xray/repertoire/dist/ingestion/groover-log-ingester.js +109 -0
  138. package/vendor/@0xray/repertoire/dist/ingestion/groover-log-ingester.js.map +1 -0
  139. package/vendor/@0xray/repertoire/dist/ingestion/groover-log-parser.d.ts +18 -0
  140. package/vendor/@0xray/repertoire/dist/ingestion/groover-log-parser.d.ts.map +1 -0
  141. package/vendor/@0xray/repertoire/dist/ingestion/groover-log-parser.js +94 -0
  142. package/vendor/@0xray/repertoire/dist/ingestion/groover-log-parser.js.map +1 -0
  143. package/vendor/@0xray/repertoire/dist/ingestion/orchestrator-feedback-ingester.d.ts +7 -0
  144. package/vendor/@0xray/repertoire/dist/ingestion/orchestrator-feedback-ingester.d.ts.map +1 -0
  145. package/vendor/@0xray/repertoire/dist/ingestion/orchestrator-feedback-ingester.js +18 -0
  146. package/vendor/@0xray/repertoire/dist/ingestion/orchestrator-feedback-ingester.js.map +1 -0
  147. package/vendor/@0xray/repertoire/dist/ingestion/xray-session-ingester.d.ts +31 -0
  148. package/vendor/@0xray/repertoire/dist/ingestion/xray-session-ingester.d.ts.map +1 -0
  149. package/vendor/@0xray/repertoire/dist/ingestion/xray-session-ingester.js +83 -0
  150. package/vendor/@0xray/repertoire/dist/ingestion/xray-session-ingester.js.map +1 -0
  151. package/vendor/@0xray/repertoire/dist/mcp/server.d.ts +6 -0
  152. package/vendor/@0xray/repertoire/dist/mcp/server.d.ts.map +1 -0
  153. package/vendor/@0xray/repertoire/dist/mcp/server.js +173 -0
  154. package/vendor/@0xray/repertoire/dist/mcp/server.js.map +1 -0
  155. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/RepertoireOrchestratorBridge.d.ts +27 -0
  156. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/RepertoireOrchestratorBridge.d.ts.map +1 -0
  157. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/RepertoireOrchestratorBridge.js +107 -0
  158. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/RepertoireOrchestratorBridge.js.map +1 -0
  159. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/capability-enhancer.d.ts +11 -0
  160. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/capability-enhancer.d.ts.map +1 -0
  161. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/capability-enhancer.js +32 -0
  162. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/capability-enhancer.js.map +1 -0
  163. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/confidence-gate.d.ts +9 -0
  164. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/confidence-gate.d.ts.map +1 -0
  165. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/confidence-gate.js +72 -0
  166. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/confidence-gate.js.map +1 -0
  167. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/signal-agent-affinity.d.ts +5 -0
  168. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/signal-agent-affinity.d.ts.map +1 -0
  169. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/signal-agent-affinity.js +18 -0
  170. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/signal-agent-affinity.js.map +1 -0
  171. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/signal-injector.d.ts +31 -0
  172. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/signal-injector.d.ts.map +1 -0
  173. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/signal-injector.js +218 -0
  174. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/signal-injector.js.map +1 -0
  175. package/vendor/@0xray/repertoire/dist/paths.d.ts +24 -0
  176. package/vendor/@0xray/repertoire/dist/paths.d.ts.map +1 -0
  177. package/vendor/@0xray/repertoire/dist/paths.js +74 -0
  178. package/vendor/@0xray/repertoire/dist/paths.js.map +1 -0
  179. package/vendor/@0xray/repertoire/dist/provider/memory-routing-provider.d.ts +141 -0
  180. package/vendor/@0xray/repertoire/dist/provider/memory-routing-provider.d.ts.map +1 -0
  181. package/vendor/@0xray/repertoire/dist/provider/memory-routing-provider.js +210 -0
  182. package/vendor/@0xray/repertoire/dist/provider/memory-routing-provider.js.map +1 -0
  183. package/vendor/@0xray/repertoire/dist/registry/CuratedSignalsManager.d.ts +48 -0
  184. package/vendor/@0xray/repertoire/dist/registry/CuratedSignalsManager.d.ts.map +1 -0
  185. package/vendor/@0xray/repertoire/dist/registry/CuratedSignalsManager.js +221 -0
  186. package/vendor/@0xray/repertoire/dist/registry/CuratedSignalsManager.js.map +1 -0
  187. package/vendor/@0xray/repertoire/dist/registry/InferenceStateManager.d.ts +11 -0
  188. package/vendor/@0xray/repertoire/dist/registry/InferenceStateManager.d.ts.map +1 -0
  189. package/vendor/@0xray/repertoire/dist/registry/InferenceStateManager.js +43 -0
  190. package/vendor/@0xray/repertoire/dist/registry/InferenceStateManager.js.map +1 -0
  191. package/vendor/@0xray/repertoire/dist/registry/signal-prune.d.ts +15 -0
  192. package/vendor/@0xray/repertoire/dist/registry/signal-prune.d.ts.map +1 -0
  193. package/vendor/@0xray/repertoire/dist/registry/signal-prune.js +35 -0
  194. package/vendor/@0xray/repertoire/dist/registry/signal-prune.js.map +1 -0
  195. package/vendor/@0xray/repertoire/dist/synthesis/concrete-sections.d.ts +3 -0
  196. package/vendor/@0xray/repertoire/dist/synthesis/concrete-sections.d.ts.map +1 -0
  197. package/vendor/@0xray/repertoire/dist/synthesis/concrete-sections.js +24 -0
  198. package/vendor/@0xray/repertoire/dist/synthesis/concrete-sections.js.map +1 -0
  199. package/vendor/@0xray/repertoire/dist/synthesis/meta-inference-engine.d.ts +24 -0
  200. package/vendor/@0xray/repertoire/dist/synthesis/meta-inference-engine.d.ts.map +1 -0
  201. package/vendor/@0xray/repertoire/dist/synthesis/meta-inference-engine.js +148 -0
  202. package/vendor/@0xray/repertoire/dist/synthesis/meta-inference-engine.js.map +1 -0
  203. package/vendor/@0xray/repertoire/dist/synthesis/primitive-confidence-aggregator.d.ts +4 -0
  204. package/vendor/@0xray/repertoire/dist/synthesis/primitive-confidence-aggregator.d.ts.map +1 -0
  205. package/vendor/@0xray/repertoire/dist/synthesis/primitive-confidence-aggregator.js +44 -0
  206. package/vendor/@0xray/repertoire/dist/synthesis/primitive-confidence-aggregator.js.map +1 -0
  207. package/vendor/@0xray/repertoire/dist/synthesis/synthesis-prompt-builder.d.ts +22 -0
  208. package/vendor/@0xray/repertoire/dist/synthesis/synthesis-prompt-builder.d.ts.map +1 -0
  209. package/vendor/@0xray/repertoire/dist/synthesis/synthesis-prompt-builder.js +66 -0
  210. package/vendor/@0xray/repertoire/dist/synthesis/synthesis-prompt-builder.js.map +1 -0
  211. package/vendor/@0xray/repertoire/dist/types.d.ts +210 -0
  212. package/vendor/@0xray/repertoire/dist/types.d.ts.map +1 -0
  213. package/vendor/@0xray/repertoire/dist/types.js +2 -0
  214. package/vendor/@0xray/repertoire/dist/types.js.map +1 -0
  215. package/vendor/@0xray/repertoire/docs/MEMORY-ROUTING-PROVIDER.md +54 -0
  216. package/vendor/@0xray/repertoire/hermes-mcp.example.json +20 -0
  217. package/vendor/@0xray/repertoire/mcp-config.example.json +11 -0
  218. package/vendor/@0xray/repertoire/package.json +124 -0
  219. package/vendor/@0xray/repertoire/schemas/curated-signal.schema.json +68 -0
  220. package/vendor/@0xray/repertoire/schemas/inference-log.schema.json +82 -0
  221. package/vendor/@0xray/repertoire/scripts/confirm-suit-all.mjs +253 -0
  222. package/vendor/@0xray/repertoire/scripts/confirm-suit-harness.mjs +220 -0
  223. package/vendor/@0xray/repertoire/scripts/run-live-synthesis-checkpoint.mjs +215 -0
  224. package/vendor/@0xray/repertoire/scripts/suit-bridge-shared.mjs +139 -0
  225. package/vendor/@0xray/repertoire/scripts/verify-grok-suit.mjs +304 -0
  226. package/vendor/@0xray/repertoire/scripts/verify-hermes-suit.mjs +163 -0
  227. package/vendor/@0xray/repertoire/scripts/verify-openclaw-suit.mjs +125 -0
  228. package/vendor/@0xray/repertoire/scripts/verify-opencode-suit.mjs +127 -0
  229. package/vendor/@0xray/repertoire/scripts/verify-synthesis-dogfood.mjs +207 -0
  230. package/vendor/@0xray/repertoire/skills/repertoire-trap-handling/SKILL.md +206 -0
  231. package/xray/codex.json +12 -3
  232. package/xray/features.json +28 -6
  233. package/xray/features.schema.json +31 -0
@@ -0,0 +1,31 @@
1
+ import { CuratedSignalsManager } from '../registry/CuratedSignalsManager.js';
2
+ export interface XraySessionFile {
3
+ sessionId: string;
4
+ timestamp: string;
5
+ problems?: string[];
6
+ approaches?: string[];
7
+ wrongTurns?: string[];
8
+ solutions?: string[];
9
+ patterns?: Array<{
10
+ type: string;
11
+ description: string;
12
+ }>;
13
+ }
14
+ export interface XraySessionIngesterOptions {
15
+ sourceDir: string;
16
+ targetDir?: string;
17
+ signalsManager?: CuratedSignalsManager;
18
+ }
19
+ export declare class XraySessionIngester {
20
+ private readonly sourceDir;
21
+ private readonly targetDir;
22
+ private readonly signalsManager;
23
+ constructor(options: XraySessionIngesterOptions);
24
+ ingest(): {
25
+ imported: number;
26
+ skipped: number;
27
+ };
28
+ private sessionToInferenceEntry;
29
+ private loadExistingSessionIds;
30
+ }
31
+ //# sourceMappingURL=xray-session-ingester.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xray-session-ingester.d.ts","sourceRoot":"","sources":["../../src/ingestion/xray-session-ingester.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAG7E,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACzD;AAED,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,qBAAqB,CAAC;CACxC;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAwB;gBAE3C,OAAO,EAAE,0BAA0B;IAM/C,MAAM,IAAI;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;IA0C/C,OAAO,CAAC,uBAAuB;IAqB/B,OAAO,CAAC,sBAAsB;CAkB/B"}
@@ -0,0 +1,83 @@
1
+ import { readFileSync, appendFileSync, existsSync, mkdirSync, readdirSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { CuratedSignalsManager } from '../registry/CuratedSignalsManager.js';
4
+ export class XraySessionIngester {
5
+ sourceDir;
6
+ targetDir;
7
+ signalsManager;
8
+ constructor(options) {
9
+ this.sourceDir = options.sourceDir;
10
+ this.targetDir = options.targetDir ?? 'logs/groover-inference';
11
+ this.signalsManager = options.signalsManager ?? new CuratedSignalsManager();
12
+ }
13
+ ingest() {
14
+ if (!existsSync(this.sourceDir)) {
15
+ return { imported: 0, skipped: 0 };
16
+ }
17
+ if (!existsSync(this.targetDir)) {
18
+ mkdirSync(this.targetDir, { recursive: true });
19
+ }
20
+ const existingIds = this.loadExistingSessionIds();
21
+ let imported = 0;
22
+ let skipped = 0;
23
+ const files = readdirSync(this.sourceDir).filter((f) => f.startsWith('session-') && f.endsWith('.json'));
24
+ for (const file of files) {
25
+ try {
26
+ const session = JSON.parse(readFileSync(join(this.sourceDir, file), 'utf8'));
27
+ if (!session.sessionId || existingIds.has(session.sessionId)) {
28
+ skipped++;
29
+ continue;
30
+ }
31
+ const entry = this.sessionToInferenceEntry(session);
32
+ const targetFile = join(this.targetDir, `${session.timestamp.split('T')[0]}.jsonl`);
33
+ appendFileSync(targetFile, JSON.stringify(entry) + '\n');
34
+ existingIds.add(session.sessionId);
35
+ imported++;
36
+ }
37
+ catch {
38
+ skipped++;
39
+ }
40
+ }
41
+ return { imported, skipped };
42
+ }
43
+ sessionToInferenceEntry(session) {
44
+ const inferenceParts = [
45
+ `Session: ${session.sessionId}`,
46
+ session.problems?.length ? `Problems: ${session.problems.join('; ')}` : '',
47
+ session.wrongTurns?.length ? `Wrong turns: ${session.wrongTurns.join('; ')}` : '',
48
+ session.solutions?.length ? `Solutions: ${session.solutions.join('; ')}` : '',
49
+ session.patterns?.length
50
+ ? `Patterns: ${session.patterns.map((p) => `${p.type}: ${p.description}`).join('; ')}`
51
+ : '',
52
+ ].filter(Boolean);
53
+ const inference = inferenceParts.join('\n');
54
+ return {
55
+ timestamp: session.timestamp,
56
+ source: 'xray',
57
+ session_id: session.sessionId,
58
+ inference,
59
+ };
60
+ }
61
+ loadExistingSessionIds() {
62
+ const ids = new Set();
63
+ if (!existsSync(this.targetDir))
64
+ return ids;
65
+ for (const file of readdirSync(this.targetDir).filter((f) => f.endsWith('.jsonl'))) {
66
+ const lines = readFileSync(join(this.targetDir, file), 'utf8').trim().split('\n');
67
+ for (const line of lines) {
68
+ if (!line)
69
+ continue;
70
+ try {
71
+ const e = JSON.parse(line);
72
+ if (e.session_id)
73
+ ids.add(e.session_id);
74
+ }
75
+ catch {
76
+ // skip
77
+ }
78
+ }
79
+ }
80
+ return ids;
81
+ }
82
+ }
83
+ //# sourceMappingURL=xray-session-ingester.js.map
@@ -0,0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CAAC;gBACzB,IAAI,CAAC,IAAI;oBAAE,SAAS;gBACpB,IAAI,CAAC;oBACH,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAmB,CAAC;oBAC7C,IAAI,CAAC,CAAC,UAAU;wBAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;gBAC1C,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO;gBACT,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Repertoire MCP Server
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";AACA;;GAEG"}
@@ -0,0 +1,173 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Repertoire MCP Server
4
+ */
5
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
6
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
7
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
8
+ import { RepertoireService } from '../RepertoireService.js';
9
+ import { DEFAULT_SIGNALS_PATH, defaultProjectStateDir, isRepertoirePackageCwd, } from '../paths.js';
10
+ import { join } from 'node:path';
11
+ function serviceOptionsFromEnv() {
12
+ const cwd = process.cwd();
13
+ const projectState = defaultProjectStateDir(cwd);
14
+ const inOrganRepo = isRepertoirePackageCwd(cwd);
15
+ return {
16
+ dataDir: process.env.REPERTOIRE_DATA_DIR ?? (inOrganRepo ? undefined : projectState),
17
+ signalsPath: process.env.CURATED_SIGNALS_PATH ?? DEFAULT_SIGNALS_PATH,
18
+ statePath: process.env.REPERTOIRE_STATE_PATH ??
19
+ (inOrganRepo ? undefined : join(projectState, 'inference-state.json')),
20
+ logDir: process.env.REPERTOIRE_LOG_DIR ?? (inOrganRepo ? undefined : join(projectState, 'logs')),
21
+ feedbackDir: process.env.REPERTOIRE_FEEDBACK_DIR ??
22
+ (inOrganRepo ? undefined : join(projectState, 'feedback')),
23
+ };
24
+ }
25
+ const service = new RepertoireService(serviceOptionsFromEnv());
26
+ /** Unprefixed names — Grok TUI namespaces as repertoire__<name> and drops names that already contain __. */
27
+ const TOOLS = [
28
+ {
29
+ name: 'get_high_confidence_signals',
30
+ description: 'List curated signals at or above a confidence threshold, optionally filtered by tags',
31
+ inputSchema: {
32
+ type: 'object',
33
+ properties: {
34
+ minConfidence: {
35
+ type: 'number',
36
+ minimum: 0,
37
+ maximum: 1,
38
+ description: 'Minimum avg_confidence from observation_stats (default 0.55)',
39
+ },
40
+ tags: {
41
+ type: 'array',
42
+ items: { type: 'string' },
43
+ description: 'Filter to signals containing any of these tags',
44
+ },
45
+ limit: { type: 'number', minimum: 1, maximum: 50, description: 'Max results (default 20)' },
46
+ },
47
+ },
48
+ },
49
+ {
50
+ name: 'get_task_confidence',
51
+ description: 'Evaluate confidence context for a task description (trap detection, complexity boost, matched signals)',
52
+ inputSchema: {
53
+ type: 'object',
54
+ properties: {
55
+ description: { type: 'string', description: 'Task or operation description' },
56
+ type: { type: 'string', description: 'Task type (e.g. design, governance)' },
57
+ taskId: { type: 'string', description: 'Optional task identifier' },
58
+ },
59
+ required: ['description'],
60
+ },
61
+ },
62
+ {
63
+ name: 'search_primitives',
64
+ description: 'Search curated primitives by text using registry observation_stats confidence',
65
+ inputSchema: {
66
+ type: 'object',
67
+ properties: {
68
+ query: { type: 'string', description: 'Text to match against signal registry' },
69
+ minConfidence: {
70
+ type: 'number',
71
+ minimum: 0,
72
+ maximum: 1,
73
+ description: 'Minimum confidence threshold (default 0.55)',
74
+ },
75
+ limit: { type: 'number', minimum: 1, maximum: 50, description: 'Max results (default 10)' },
76
+ },
77
+ required: ['query'],
78
+ },
79
+ },
80
+ {
81
+ name: 'ingest_feedback',
82
+ description: 'Record orchestrator routing outcome for meta-inference feedback loop',
83
+ inputSchema: {
84
+ type: 'object',
85
+ properties: {
86
+ sessionId: { type: 'string' },
87
+ taskId: { type: 'string' },
88
+ assignedAgent: { type: 'string' },
89
+ memorySignals: { type: 'array', items: { type: 'string' } },
90
+ complexity: { type: 'number' },
91
+ success: { type: 'boolean' },
92
+ durationMs: { type: 'number' },
93
+ },
94
+ required: ['sessionId', 'taskId', 'assignedAgent', 'success', 'durationMs'],
95
+ },
96
+ },
97
+ ];
98
+ const server = new Server({ name: 'repertoire', version: '0.2.0' }, { capabilities: { tools: {} } });
99
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
100
+ tools: TOOLS.map((tool) => ({
101
+ name: tool.name,
102
+ description: tool.description,
103
+ inputSchema: tool.inputSchema,
104
+ })),
105
+ }));
106
+ function jsonResult(data) {
107
+ return {
108
+ content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
109
+ };
110
+ }
111
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
112
+ const { name, arguments: args } = request.params;
113
+ const a = (args ?? {});
114
+ switch (name) {
115
+ case 'get_high_confidence_signals':
116
+ case 'repertoire__get_high_confidence_signals': {
117
+ const tags = Array.isArray(a.tags)
118
+ ? a.tags.filter((tag) => typeof tag === 'string')
119
+ : undefined;
120
+ return jsonResult(service.getHighConfidenceSignals({
121
+ minConfidence: typeof a.minConfidence === 'number' ? a.minConfidence : undefined,
122
+ tags,
123
+ limit: typeof a.limit === 'number' ? a.limit : undefined,
124
+ }));
125
+ }
126
+ case 'get_task_confidence':
127
+ case 'repertoire__get_task_confidence': {
128
+ return jsonResult(service.getTaskConfidence({
129
+ description: String(a.description),
130
+ type: typeof a.type === 'string' ? a.type : undefined,
131
+ id: typeof a.taskId === 'string' ? a.taskId : undefined,
132
+ }));
133
+ }
134
+ case 'search_primitives':
135
+ case 'repertoire__search_primitives': {
136
+ return jsonResult(service.searchPrimitives(String(a.query), {
137
+ minConfidence: typeof a.minConfidence === 'number' ? a.minConfidence : undefined,
138
+ limit: typeof a.limit === 'number' ? a.limit : undefined,
139
+ }));
140
+ }
141
+ case 'ingest_feedback':
142
+ case 'repertoire__ingest_feedback': {
143
+ const result = service.ingestOrchestratorFeedback({
144
+ timestamp: new Date().toISOString(),
145
+ sessionId: String(a.sessionId),
146
+ taskId: String(a.taskId),
147
+ assignedAgent: String(a.assignedAgent),
148
+ repertoireSignals: a.memorySignals ?? [],
149
+ complexity: Number(a.complexity ?? 30),
150
+ success: Boolean(a.success),
151
+ durationMs: Number(a.durationMs),
152
+ });
153
+ return jsonResult({
154
+ logPath: result.logPath,
155
+ updatedSignals: result.updatedSignals,
156
+ });
157
+ }
158
+ default:
159
+ return {
160
+ content: [{ type: 'text', text: `Unknown tool: ${name}` }],
161
+ isError: true,
162
+ };
163
+ }
164
+ });
165
+ async function main() {
166
+ const transport = new StdioServerTransport();
167
+ await server.connect(transport);
168
+ }
169
+ main().catch((err) => {
170
+ process.stderr.write(`FATAL: ${err}\n`);
171
+ process.exit(1);
172
+ });
173
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";AACA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,SAAS,qBAAqB;IAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,YAAY,GAAG,sBAA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,CAAC;gBAC1D,OAAO,EAAE,IAAI;aACd,CAAC;IACN,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { AgentCapability, ExecutionPlan, OrchestrationTask, RepertoireInheritedContext, RepertoireRoutingContext, SynthesisCollocatedContext, TaskConfidenceContext } from '../types.js';
2
+ import { CuratedSignalsManager } from '../registry/CuratedSignalsManager.js';
3
+ export declare class RepertoireOrchestratorBridge {
4
+ private readonly signalsManager;
5
+ private readonly enhancer;
6
+ private readonly injector;
7
+ constructor(signalsManager: CuratedSignalsManager);
8
+ enhanceAgentCapabilities(baseCapabilities: Map<string, AgentCapability>): Map<string, AgentCapability>;
9
+ buildRoutingContext(operation: string): RepertoireRoutingContext;
10
+ getConfidenceForTask(task: OrchestrationTask): TaskConfidenceContext;
11
+ injectSignalsIntoTasks(tasks: OrchestrationTask[]): OrchestrationTask[];
12
+ buildInheritedContext(tasks: OrchestrationTask[]): RepertoireInheritedContext;
13
+ buildSynthesisContext(projectRoot: string, dueReason?: string | null): SynthesisCollocatedContext;
14
+ enrichExecutionPlan(plan: ExecutionPlan, tasks: OrchestrationTask[]): ExecutionPlan;
15
+ selectAgentForTask(capabilities: Map<string, AgentCapability>, requiredCapabilities: string[], complexity: number, operationDescription: string, task?: OrchestrationTask): string | null;
16
+ /**
17
+ * High-confidence trap tasks route to recommendedAgent (default architect)
18
+ * without applying complexityThreshold — boost is for scoring, not exclusion.
19
+ */
20
+ resolveTrapCapableAgent(confidenceContext: TaskConfidenceContext, capabilities: Map<string, AgentCapability>): string | null;
21
+ resolveThinDispatchAgent(baseAgent: string, operation: string, complexityScore: number): {
22
+ agent: string;
23
+ adjustedScore: number;
24
+ repertoireContext: RepertoireRoutingContext;
25
+ };
26
+ }
27
+ //# sourceMappingURL=RepertoireOrchestratorBridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RepertoireOrchestratorBridge.d.ts","sourceRoot":"","sources":["../../src/orchestrator-bridge/RepertoireOrchestratorBridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAK7E,qBAAa,4BAA4B;IAI3B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAH3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAC9C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;gBAEb,cAAc,EAAE,qBAAqB;IAKlE,wBAAwB,CACtB,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,GAC7C,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC;IAI/B,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,wBAAwB;IAIhE,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,qBAAqB;IAIpE,sBAAsB,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,iBAAiB,EAAE;IAIvE,qBAAqB,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,0BAA0B;IAI7E,qBAAqB,CACnB,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,MAAM,GAAG,IAAW,GAC9B,0BAA0B;IAI7B,mBAAmB,CACjB,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,iBAAiB,EAAE,GACzB,aAAa;IAShB,kBAAkB,CAChB,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,EAC1C,oBAAoB,EAAE,MAAM,EAAE,EAC9B,UAAU,EAAE,MAAM,EAClB,oBAAoB,EAAE,MAAM,EAC5B,IAAI,CAAC,EAAE,iBAAiB,GACvB,MAAM,GAAG,IAAI;IAqChB;;;OAGG;IACH,uBAAuB,CACrB,iBAAiB,EAAE,qBAAqB,EACxC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,GACzC,MAAM,GAAG,IAAI;IAuBhB,wBAAwB,CACtB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,GACtB;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,wBAAwB,CAAA;KAAE;CA0BzF"}
@@ -0,0 +1,107 @@
1
+ import { CapabilityEnhancer } from './capability-enhancer.js';
2
+ import { getConfidenceForTask, TRAP_CAPABLE_AGENTS } from './confidence-gate.js';
3
+ import { SignalInjector } from './signal-injector.js';
4
+ export class RepertoireOrchestratorBridge {
5
+ signalsManager;
6
+ enhancer;
7
+ injector;
8
+ constructor(signalsManager) {
9
+ this.signalsManager = signalsManager;
10
+ this.enhancer = new CapabilityEnhancer(signalsManager);
11
+ this.injector = new SignalInjector(signalsManager);
12
+ }
13
+ enhanceAgentCapabilities(baseCapabilities) {
14
+ return this.enhancer.enhance(baseCapabilities);
15
+ }
16
+ buildRoutingContext(operation) {
17
+ return this.injector.buildRoutingContext(operation);
18
+ }
19
+ getConfidenceForTask(task) {
20
+ return getConfidenceForTask(task, this.signalsManager);
21
+ }
22
+ injectSignalsIntoTasks(tasks) {
23
+ return this.injector.matchSignalsForTasks(tasks);
24
+ }
25
+ buildInheritedContext(tasks) {
26
+ return this.injector.buildInheritedContext(tasks);
27
+ }
28
+ buildSynthesisContext(projectRoot, dueReason = null) {
29
+ return this.injector.buildSynthesisContext(projectRoot, dueReason);
30
+ }
31
+ enrichExecutionPlan(plan, tasks) {
32
+ const enrichedTasks = this.injectSignalsIntoTasks(tasks);
33
+ return {
34
+ ...plan,
35
+ tasks: enrichedTasks,
36
+ repertoireContext: this.buildInheritedContext(enrichedTasks),
37
+ };
38
+ }
39
+ selectAgentForTask(capabilities, requiredCapabilities, complexity, operationDescription, task) {
40
+ const syntheticTask = task ?? {
41
+ id: 'routing-op',
42
+ description: operationDescription,
43
+ type: requiredCapabilities[0] ?? 'general',
44
+ };
45
+ const confidenceContext = getConfidenceForTask(syntheticTask, this.signalsManager);
46
+ const trapAgent = this.resolveTrapCapableAgent(confidenceContext, capabilities);
47
+ if (trapAgent) {
48
+ return trapAgent;
49
+ }
50
+ const repertoireContext = this.buildRoutingContext(operationDescription);
51
+ let bestAgent = null;
52
+ let bestScore = -1;
53
+ for (const [agent, caps] of capabilities) {
54
+ if (complexity > caps.complexityThreshold)
55
+ continue;
56
+ const score = this.injector.scoreAgent(agent, caps, requiredCapabilities, repertoireContext, confidenceContext);
57
+ if (score > bestScore) {
58
+ bestScore = score;
59
+ bestAgent = agent;
60
+ }
61
+ }
62
+ return bestAgent;
63
+ }
64
+ /**
65
+ * High-confidence trap tasks route to recommendedAgent (default architect)
66
+ * without applying complexityThreshold — boost is for scoring, not exclusion.
67
+ */
68
+ resolveTrapCapableAgent(confidenceContext, capabilities) {
69
+ if (!confidenceContext.highConfidenceTrapPresent)
70
+ return null;
71
+ const candidates = [];
72
+ const recommended = confidenceContext.recommendedAgent;
73
+ if (recommended &&
74
+ TRAP_CAPABLE_AGENTS.includes(recommended)) {
75
+ candidates.push(recommended);
76
+ }
77
+ for (const agent of TRAP_CAPABLE_AGENTS) {
78
+ if (!candidates.includes(agent))
79
+ candidates.push(agent);
80
+ }
81
+ for (const agent of candidates) {
82
+ if (capabilities.has(agent))
83
+ return agent;
84
+ }
85
+ return null;
86
+ }
87
+ resolveThinDispatchAgent(baseAgent, operation, complexityScore) {
88
+ const syntheticTask = {
89
+ id: 'thin-dispatch',
90
+ description: operation,
91
+ type: 'routing',
92
+ };
93
+ const confidenceContext = getConfidenceForTask(syntheticTask, this.signalsManager);
94
+ const repertoireContext = this.buildRoutingContext(operation);
95
+ const adjustedScore = this.injector.adjustComplexityScore(complexityScore, repertoireContext, confidenceContext);
96
+ let agent = baseAgent;
97
+ if (confidenceContext.highConfidenceTrapPresent && adjustedScore >= 26) {
98
+ agent = 'architect';
99
+ }
100
+ else if (repertoireContext.matchedTags.includes('provenance-failure') &&
101
+ adjustedScore < 51) {
102
+ agent = 'bug-triage-specialist';
103
+ }
104
+ return { agent, adjustedScore, repertoireContext };
105
+ }
106
+ }
107
+ //# sourceMappingURL=RepertoireOrchestratorBridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RepertoireOrchestratorBridge.js","sourceRoot":"","sources":["../../src/orchestrator-bridge/RepertoireOrchestratorBridge.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,OAAO,4BAA4B;IAIV;IAHZ,QAAQ,CAAqB;IAC7B,QAAQ,CAAiB;IAE1C,YAA6B,cAAqC;QAArC,mBAAc,GAAd,cAAc,CAAuB;QAChE,IAAI,CAAC,QAAQ,GAAG,IAAI,kBAAkB,CAAC,cAAc,CAAC,CAAC;QACvD,IAAI,CAAC,QAAQ,GAAG,IAAI,cAAc,CAAC,cAAc,CAAC,CAAC;IACrD,CAAC;IAED,wBAAwB,CACtB,gBAA8C;QAE9C,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACjD,CAAC;IAED,mBAAmB,CAAC,SAAiB;QACn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AAO,KAAK,CAAC;QAC5C,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,wBAAwB,CACtB,SAAiB,EACjB,SAAiB,EACjB,eAAuB;QAEvB,MAAM,aAAa,GAAsB;YACvC,EAAE,EAAE,eAAe;YACnB,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,SAAS;SAChB,CAAC;QACF,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACnF,MAAM,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QAC9D,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CACvD,eAAe,EACf,iBAAiB,EACjB,iBAAiB,CAClB,CAAC;QAEF,IAAI,KAAK,GAAG,SAAS,CAAC;QACtB,IAAI,iBAAiB,CAAC,yBAAyB,IAAI,aAAa,IAAI,EAAE,EAAE,CAAC;YACvE,KAAK,GAAG,WAAW,CAAC;QACtB,CAAC;aAAM,IACL,iBAAiB,CAAC,WAAW,CAAC,QAAQ,CAAC,oBAAoB,CAAC;YAC5D,aAAa,GAAG,EAAE,EAClB,CAAC;YACD,KAAK,GAAG,uBAAuB,CAAC;QAClC,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC;IACrD,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import type { AgentCapability } from '../types.js';
2
+ import { CuratedSignalsManager } from '../registry/CuratedSignalsManager.js';
3
+ export declare class CapabilityEnhancer {
4
+ private readonly signalsManager;
5
+ constructor(signalsManager: CuratedSignalsManager);
6
+ /**
7
+ * Seeds repertoireSignals and repertoireTags onto each agent capability map entry.
8
+ */
9
+ enhance(baseCapabilities: Map<string, AgentCapability>): Map<string, AgentCapability>;
10
+ }
11
+ //# sourceMappingURL=capability-enhancer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-enhancer.d.ts","sourceRoot":"","sources":["../../src/orchestrator-bridge/capability-enhancer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,qBAAqB;IAElE;;OAEG;IACH,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC;CA0BtF"}
@@ -0,0 +1,32 @@
1
+ import { TAG_AGENT_AFFINITY } from './signal-agent-affinity.js';
2
+ export class CapabilityEnhancer {
3
+ signalsManager;
4
+ constructor(signalsManager) {
5
+ this.signalsManager = signalsManager;
6
+ }
7
+ /**
8
+ * Seeds repertoireSignals and repertoireTags onto each agent capability map entry.
9
+ */
10
+ enhance(baseCapabilities) {
11
+ const highPriority = this.signalsManager.getHighPrioritySignals();
12
+ const signalNames = highPriority.map((s) => s.name);
13
+ const allTags = [...new Set(highPriority.flatMap((s) => s.tags))];
14
+ const enriched = new Map();
15
+ for (const [agent, caps] of baseCapabilities) {
16
+ const tagAffinities = Object.entries(TAG_AGENT_AFFINITY)
17
+ .filter(([, agents]) => agents.includes(agent))
18
+ .map(([tag]) => tag);
19
+ const agentSignals = highPriority
20
+ .filter((s) => s.tags.some((t) => tagAffinities.includes(t)))
21
+ .map((s) => s.name);
22
+ enriched.set(agent, {
23
+ ...caps,
24
+ capabilities: [...new Set([...caps.capabilities, ...signalNames, ...agentSignals])],
25
+ repertoireSignals: [...new Set([...(caps.repertoireSignals ?? []), ...agentSignals])],
26
+ repertoireTags: [...new Set([...(caps.repertoireTags ?? []), ...tagAffinities, ...allTags])],
27
+ });
28
+ }
29
+ return enriched;
30
+ }
31
+ }
32
+ //# sourceMappingURL=capability-enhancer.js.map
@@ -0,0 +1 @@
1
+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CAAC,CAAC,IAAI,CAAC,CAAC;YAEtB,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE;gBAClB,GAAG,IAAI;gBACP,YAAY,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,EAAE,GAAG,WAAW,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;gBACnF,iBAAiB,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,iBAAiB,IAAI,EAAE,CAAC,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;gBACrF,cAAc,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,IAAI,EAAE,CAAC,EAAE,GAAG,aAAa,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;aAC7F,CAAC,CAAC;QACL,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import { CuratedSignalsManager } from '../registry/CuratedSignalsManager.js';
2
+ import type { OrchestrationTask, TaskConfidenceContext } from '../types.js';
3
+ export declare const DEFAULT_MIN_CONFIDENCE_GATE = 0.55;
4
+ export declare const TRAP_CAPABLE_AGENTS: readonly ["architect", "security-auditor", "researcher"];
5
+ export declare function resolveSignalConfidence(signalName: string, signalsManager: CuratedSignalsManager, metadataConfidence?: number): number | null;
6
+ export declare function getConfidenceForTask(task: OrchestrationTask, signalsManager: CuratedSignalsManager): TaskConfidenceContext;
7
+ export declare function confidenceWeightedAgentBoost(agent: string, context: TaskConfidenceContext): number;
8
+ export declare function applyConfidenceComplexityBoost(baseComplexity: number, context: TaskConfidenceContext): number;
9
+ //# sourceMappingURL=confidence-gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confidence-gate.d.ts","sourceRoot":"","sources":["../../src/orchestrator-bridge/confidence-gate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAEtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5E,eAAO,MAAM,2BAA2B,OAAmC,CAAC;AAC5E,eAAO,MAAM,mBAAmB,0DAA2D,CAAC;AAE5F,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,qBAAqB,EACrC,kBAAkB,CAAC,EAAE,MAAM,GAC1B,MAAM,GAAG,IAAI,CAWf;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,iBAAiB,EACvB,cAAc,EAAE,qBAAqB,GACpC,qBAAqB,CA6DvB;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,qBAAqB,GAC7B,MAAM,CAMR;AAED,wBAAgB,8BAA8B,CAC5C,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,qBAAqB,GAC7B,MAAM,CAER"}
@@ -0,0 +1,72 @@
1
+ import { DEFAULT_PROMOTION_MIN_CONFIDENCE, } from '../registry/CuratedSignalsManager.js';
2
+ export const DEFAULT_MIN_CONFIDENCE_GATE = DEFAULT_PROMOTION_MIN_CONFIDENCE;
3
+ export const TRAP_CAPABLE_AGENTS = ['architect', 'security-auditor', 'researcher'];
4
+ export function resolveSignalConfidence(signalName, signalsManager, metadataConfidence) {
5
+ if (typeof metadataConfidence === 'number') {
6
+ return metadataConfidence;
7
+ }
8
+ const signal = signalsManager.getByName(signalName);
9
+ if (signal?.observation_stats?.avg_confidence !== undefined) {
10
+ return signal.observation_stats.avg_confidence;
11
+ }
12
+ return null;
13
+ }
14
+ export function getConfidenceForTask(task, signalsManager) {
15
+ const text = `${task.description} ${task.type}`;
16
+ const textMatches = signalsManager.matchByText(text, 2);
17
+ const trapDetected = /TYPE:\s*ontological-trap/i.test(text) ||
18
+ Boolean(task.metadata?.ontologicalTrapDetected) ||
19
+ textMatches.some((match) => match.signal.tags.includes('ontological-trap'));
20
+ const metadataConfidences = task.metadata?.memorySignalConfidences ?? {};
21
+ const signals = textMatches
22
+ .map((match) => {
23
+ const confidence = resolveSignalConfidence(match.signal.name, signalsManager, metadataConfidences[match.signal.name]);
24
+ if (confidence === null)
25
+ return null;
26
+ return {
27
+ name: match.signal.name,
28
+ confidence,
29
+ source: 'registry',
30
+ matchedVia: match.matchedOn,
31
+ };
32
+ })
33
+ .filter((entry) => entry !== null)
34
+ .filter((entry) => entry.confidence >= DEFAULT_MIN_CONFIDENCE_GATE);
35
+ const trapSignals = signals.filter((entry) => signalsManager.getByName(entry.name)?.tags.includes('ontological-trap'));
36
+ const highConfidenceTrapPresent = trapDetected &&
37
+ trapSignals.some((entry) => entry.confidence >= DEFAULT_MIN_CONFIDENCE_GATE);
38
+ const avgConfidence = signals.length > 0
39
+ ? signals.reduce((sum, entry) => sum + entry.confidence, 0) / signals.length
40
+ : 0;
41
+ const maxConfidence = signals.length > 0 ? Math.max(...signals.map((entry) => entry.confidence)) : 0;
42
+ let complexityBoost = 0;
43
+ if (highConfidenceTrapPresent) {
44
+ complexityBoost += Math.round(10 + maxConfidence * 10);
45
+ }
46
+ const highConfidenceCount = signals.length;
47
+ if (highConfidenceCount >= 2)
48
+ complexityBoost += 5;
49
+ return {
50
+ signals,
51
+ matchedSignals: signals.map((entry) => entry.name),
52
+ avgConfidence,
53
+ maxConfidence,
54
+ highConfidenceTrapPresent,
55
+ ontologicalTrapDetected: trapDetected,
56
+ minConfidenceGate: DEFAULT_MIN_CONFIDENCE_GATE,
57
+ complexityBoost,
58
+ recommendedAgent: highConfidenceTrapPresent ? 'architect' : null,
59
+ };
60
+ }
61
+ export function confidenceWeightedAgentBoost(agent, context) {
62
+ if (!context.highConfidenceTrapPresent)
63
+ return 0;
64
+ if (!TRAP_CAPABLE_AGENTS.includes(agent)) {
65
+ return 0;
66
+ }
67
+ return Math.round(12 + context.maxConfidence * 10);
68
+ }
69
+ export function applyConfidenceComplexityBoost(baseComplexity, context) {
70
+ return Math.min(Math.max(Math.round(baseComplexity + context.complexityBoost), 1), 100);
71
+ }
72
+ //# sourceMappingURL=confidence-gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confidence-gate.js","sourceRoot":"","sources":["../../src/orchestrator-bridge/confidence-gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gCAAgC,GACjC,MAAM,sCAAsC,CAAC;AAG9C,MAAM,CAAC,MAAM,2BAA2B,GAAG,gCAAgC,CAAC;AAC5E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,WAAW,EAAE,kBAAkB,EAAE,YAAY,CAAU,CAAC;AAE5F,MAAM,UAAU,uBAAuB,CACrC,UAAkB,EAClB,cAAqC,EACrC,kBAA2B;IAE3B,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE,CAAC;QAC3C,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACpD,IAAI,MAAM,EAAE,iBAAiB,EAAE,cAAc,KAAK,SAAS,EAAE,CAAC;QAC5D,OAAO,MAAM,CAAC,iBAAiB,CAAC,cAAc,CAAC;IACjD,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,IAAuB,EACvB,cAAqC;IAErC,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;IAChD,MAAM,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACxD,MAAM,YAAY,GAChB,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,uBAAuB,CAAC;QAC/C,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,C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OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC1F,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** Default tag → agent affinity for Repertoire-enriched routing */
2
+ export declare const TAG_AGENT_AFFINITY: Record<string, string[]>;
3
+ /** Agents that receive ontological-trap complexity boost in thinDispatch */
4
+ export declare const ONTOLOGICAL_TRAP_PREFERRED_AGENTS: readonly ["architect", "security-auditor", "researcher"];
5
+ //# sourceMappingURL=signal-agent-affinity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-agent-affinity.d.ts","sourceRoot":"","sources":["../../src/orchestrator-bridge/signal-agent-affinity.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CASvD,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,iCAAiC,0DAIpC,CAAC"}