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,18 @@
1
+ /** Default tag → agent affinity for Repertoire-enriched routing */
2
+ export const TAG_AGENT_AFFINITY = {
3
+ 'ontological-trap': ['architect', 'security-auditor', 'researcher'],
4
+ attestation: ['security-auditor', 'architect'],
5
+ 'consumer-boundary': ['architect', 'code-reviewer'],
6
+ interpretation: ['researcher', 'architect'],
7
+ criteria: ['researcher', 'architect'],
8
+ invariant: ['architect', 'security-auditor'],
9
+ 'provenance-failure': ['code-reviewer', 'bug-triage-specialist'],
10
+ representation: ['researcher', 'architect'],
11
+ };
12
+ /** Agents that receive ontological-trap complexity boost in thinDispatch */
13
+ export const ONTOLOGICAL_TRAP_PREFERRED_AGENTS = [
14
+ 'architect',
15
+ 'security-auditor',
16
+ 'researcher',
17
+ ];
18
+ //# sourceMappingURL=signal-agent-affinity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-agent-affinity.js","sourceRoot":"","sources":["../../src/orchestrator-bridge/signal-agent-affinity.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,MAAM,CAAC,MAAM,kBAAkB,GAA6B;IAC1D,kBAAkB,EAAE,CAAC,WAAW,EAAE,kBAAkB,EAAE,YAAY,CAAC;IACnE,WAAW,EAAE,CAAC,kBAAkB,EAAE,WAAW,CAAC;IAC9C,mBAAmB,EAAE,CAAC,WAAW,EAAE,eAAe,CAAC;IACnD,cAAc,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;IAC3C,QAAQ,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;IACrC,SAAS,EAAE,CAAC,WAAW,EAAE,kBAAkB,CAAC;IAC5C,oBAAoB,EAAE,CAAC,eAAe,EAAE,uBAAuB,CAAC;IAChE,cAAc,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;CAC5C,CAAC;AAEF,4EAA4E;AAC5E,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,WAAW;IACX,kBAAkB;IAClB,YAAY;CACJ,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { OrchestrationTask, RepertoireInheritedContext, RepertoireRoutingContext, SynthesisCollocatedContext } from '../types.js';
2
+ import { CuratedSignalsManager } from '../registry/CuratedSignalsManager.js';
3
+ import { getConfidenceForTask } from './confidence-gate.js';
4
+ export declare class SignalInjector {
5
+ private readonly signalsManager;
6
+ private readonly projectRoot;
7
+ private readonly synthesisReportPath?;
8
+ constructor(signalsManager: CuratedSignalsManager, projectRoot?: string, synthesisReportPath?: string | undefined);
9
+ buildRoutingContext(text: string): RepertoireRoutingContext;
10
+ matchSignalsForTasks(tasks: OrchestrationTask[]): OrchestrationTask[];
11
+ buildSynthesisContext(projectRoot: string, dueReason?: string | null): SynthesisCollocatedContext;
12
+ buildInheritedContext(tasks: OrchestrationTask[]): RepertoireInheritedContext;
13
+ /**
14
+ * Signal-aware agent scoring — drop-in replacement logic for AgentCapabilitiesManager.
15
+ */
16
+ scoreAgent(agent: string, caps: {
17
+ capabilities: string[];
18
+ concurrentTasks: number;
19
+ repertoireSignals?: string[];
20
+ repertoireTags?: string[];
21
+ }, requiredCapabilities: string[], repertoireContext: RepertoireRoutingContext, confidenceContext?: ReturnType<typeof getConfidenceForTask>): number;
22
+ /**
23
+ * Complexity adjustment for thinDispatch when Repertoire context is present.
24
+ */
25
+ adjustComplexityScore(baseScore: number, context: RepertoireRoutingContext, confidenceContext?: ReturnType<typeof getConfidenceForTask>): number;
26
+ private resolveSynthesisReportPath;
27
+ private getSynthesisExcerpt;
28
+ private readCodexExcerpt;
29
+ private readPlanExcerpt;
30
+ }
31
+ //# sourceMappingURL=signal-injector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-injector.d.ts","sourceRoot":"","sources":["../../src/orchestrator-bridge/signal-injector.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAIL,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC;gBAFpB,cAAc,EAAE,qBAAqB,EACrC,WAAW,SAAgB,EAC3B,mBAAmB,CAAC,EAAE,MAAM,YAAA;IAG/C,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,wBAAwB;IA2C3D,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,iBAAiB,EAAE;IA4BrE,qBAAqB,CACnB,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,MAAM,GAAG,IAAW,GAC9B,0BAA0B;IAkD7B,qBAAqB,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,0BAA0B;IAmB7E;;OAEG;IACH,UAAU,CACR,KAAK,EAAE,MAAM,EACb,IAAI,EAAE;QACJ,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;QACxB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;QAC7B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;KAC3B,EACD,oBAAoB,EAAE,MAAM,EAAE,EAC9B,iBAAiB,EAAE,wBAAwB,EAC3C,iBAAiB,CAAC,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,GAC1D,MAAM;IAgCT;;OAEG;IACH,qBAAqB,CACnB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,wBAAwB,EACjC,iBAAiB,CAAC,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,GAC1D,MAAM;IAQT,OAAO,CAAC,0BAA0B;IAclC,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,gBAAgB;IAqBxB,OAAO,CAAC,eAAe;CA2BxB"}
@@ -0,0 +1,218 @@
1
+ import { readFileSync, existsSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { applyConfidenceComplexityBoost, confidenceWeightedAgentBoost, DEFAULT_MIN_CONFIDENCE_GATE, getConfidenceForTask, resolveSignalConfidence, } from './confidence-gate.js';
4
+ export class SignalInjector {
5
+ signalsManager;
6
+ projectRoot;
7
+ synthesisReportPath;
8
+ constructor(signalsManager, projectRoot = process.cwd(), synthesisReportPath) {
9
+ this.signalsManager = signalsManager;
10
+ this.projectRoot = projectRoot;
11
+ this.synthesisReportPath = synthesisReportPath;
12
+ }
13
+ buildRoutingContext(text) {
14
+ const matches = this.signalsManager.matchByText(text, 2);
15
+ const ontologicalTrapDetected = /TYPE:\s*ontological-trap/i.test(text) ||
16
+ /ontological-trap/i.test(text) ||
17
+ matches.some((match) => match.signal.tags.includes('ontological-trap'));
18
+ const signalConfidences = Object.fromEntries(matches
19
+ .map((match) => {
20
+ const confidence = resolveSignalConfidence(match.signal.name, this.signalsManager);
21
+ return confidence === null ? null : [match.signal.name, confidence];
22
+ })
23
+ .filter((entry) => entry !== null));
24
+ const confidenceValues = Object.values(signalConfidences);
25
+ const avgMatchConfidence = confidenceValues.length > 0
26
+ ? confidenceValues.reduce((sum, value) => sum + value, 0) / confidenceValues.length
27
+ : 0;
28
+ const trapSignals = matches.filter((match) => match.signal.tags.includes('ontological-trap'));
29
+ const highConfidenceTrapPresent = ontologicalTrapDetected &&
30
+ trapSignals.some((match) => (signalConfidences[match.signal.name] ?? 0) >= DEFAULT_MIN_CONFIDENCE_GATE);
31
+ return {
32
+ matchedSignals: matches.map((match) => match.signal.name),
33
+ matchedTags: [...new Set(matches.flatMap((match) => match.signal.tags))],
34
+ ontologicalTrapDetected,
35
+ synthesisAvailable: this.resolveSynthesisReportPath() != null,
36
+ signalMatches: matches,
37
+ signalConfidences,
38
+ avgMatchConfidence,
39
+ highConfidenceTrapPresent,
40
+ };
41
+ }
42
+ matchSignalsForTasks(tasks) {
43
+ return tasks.map((task) => {
44
+ const confidenceContext = getConfidenceForTask(task, this.signalsManager);
45
+ const ctx = this.buildRoutingContext(`${task.description} ${task.type}`);
46
+ const signalConfidences = Object.fromEntries(confidenceContext.signals.map((entry) => [entry.name, entry.confidence]));
47
+ return {
48
+ ...task,
49
+ metadata: {
50
+ ...task.metadata,
51
+ repertoireSignals: confidenceContext.signals.map((entry) => entry.name),
52
+ matchedPrimitives: confidenceContext.signals.map((entry) => entry.name),
53
+ ontologicalTrapDetected: confidenceContext.ontologicalTrapDetected,
54
+ memorySignalConfidences: signalConfidences,
55
+ memoryAvgConfidence: confidenceContext.avgConfidence,
56
+ memoryHighConfidenceTrap: confidenceContext.highConfidenceTrapPresent,
57
+ memoryComplexityBoost: confidenceContext.complexityBoost,
58
+ match_confidence: signalConfidences,
59
+ synthesisContext: ctx.synthesisAvailable
60
+ ? this.getSynthesisExcerpt(500)
61
+ : undefined,
62
+ },
63
+ };
64
+ });
65
+ }
66
+ buildSynthesisContext(projectRoot, dueReason = null) {
67
+ const operation = 'synthesis checkpoint reflect realign coherence plan codex signals primitives';
68
+ const matches = this.signalsManager.matchByText(operation, 6);
69
+ const signalConfidences = Object.fromEntries(matches
70
+ .map((match) => {
71
+ const confidence = resolveSignalConfidence(match.signal.name, this.signalsManager);
72
+ return confidence === null ? null : [match.signal.name, confidence];
73
+ })
74
+ .filter((entry) => entry !== null));
75
+ const matchedSignals = matches.map((match) => ({
76
+ name: match.signal.name,
77
+ definition: match.signal.definition,
78
+ priority: match.signal.priority,
79
+ ...(signalConfidences[match.signal.name] !== undefined
80
+ ? { confidence: signalConfidences[match.signal.name] }
81
+ : {}),
82
+ }));
83
+ const codex = this.readCodexExcerpt(projectRoot);
84
+ const planExcerpt = this.readPlanExcerpt(projectRoot);
85
+ const synthesisExcerpt = this.getSynthesisExcerpt(2000);
86
+ const sections = [
87
+ '# Synthesis checkpoint',
88
+ dueReason ? `Due: ${dueReason}` : '',
89
+ matchedSignals.length
90
+ ? `## Matched primitives\n${matchedSignals
91
+ .map((s) => `- ${s.name} (${s.priority}): ${s.definition}`)
92
+ .join('\n')}`
93
+ : '',
94
+ codex.excerpt ? `## Codex (${codex.termCount} terms)\n${codex.excerpt}` : '',
95
+ planExcerpt ? `## Lead-dev plan\n${planExcerpt}` : '',
96
+ synthesisExcerpt ? `## Prior synthesis\n${synthesisExcerpt}` : '',
97
+ ].filter(Boolean);
98
+ return {
99
+ primitive: 'synthesis',
100
+ matchedSignals,
101
+ ...(synthesisExcerpt ? { synthesisExcerpt } : {}),
102
+ codexTermCount: codex.termCount,
103
+ codexExcerpt: codex.excerpt,
104
+ planExcerpt,
105
+ collatedText: sections.join('\n\n'),
106
+ };
107
+ }
108
+ buildInheritedContext(tasks) {
109
+ const allText = tasks.map((task) => `${task.description} ${task.type}`).join(' ');
110
+ const matches = this.signalsManager.matchByText(allText, 2);
111
+ const trapSignals = matches
112
+ .filter((match) => match.signal.tags.includes('ontological-trap'))
113
+ .map((match) => match.signal.name);
114
+ return {
115
+ matchedSignals: matches.slice(0, 8).map((match) => ({
116
+ name: match.signal.name,
117
+ definition: match.signal.definition,
118
+ priority: match.signal.priority,
119
+ })),
120
+ synthesisExcerpt: this.getSynthesisExcerpt(2000),
121
+ ontologicalTrapSignals: trapSignals,
122
+ };
123
+ }
124
+ /**
125
+ * Signal-aware agent scoring — drop-in replacement logic for AgentCapabilitiesManager.
126
+ */
127
+ scoreAgent(agent, caps, requiredCapabilities, repertoireContext, confidenceContext) {
128
+ const capMatch = requiredCapabilities.filter((cap) => caps.capabilities.includes(cap)).length;
129
+ const signalMatch = repertoireContext.matchedSignals.reduce((sum, signalName) => {
130
+ if (!caps.repertoireSignals?.includes(signalName) &&
131
+ !caps.capabilities.includes(signalName)) {
132
+ return sum;
133
+ }
134
+ const confidence = repertoireContext.signalConfidences[signalName];
135
+ if (confidence === undefined)
136
+ return sum;
137
+ return sum + confidence;
138
+ }, 0);
139
+ const tagMatch = repertoireContext.matchedTags.filter((tag) => caps.repertoireTags?.includes(tag)).length;
140
+ const trapBoost = confidenceContext
141
+ ? confidenceWeightedAgentBoost(agent, confidenceContext)
142
+ : 0;
143
+ return (capMatch * 10 +
144
+ signalMatch * 8 +
145
+ tagMatch * 5 +
146
+ trapBoost +
147
+ caps.concurrentTasks);
148
+ }
149
+ /**
150
+ * Complexity adjustment for thinDispatch when Repertoire context is present.
151
+ */
152
+ adjustComplexityScore(baseScore, context, confidenceContext) {
153
+ if (confidenceContext) {
154
+ return applyConfidenceComplexityBoost(baseScore, confidenceContext);
155
+ }
156
+ return baseScore;
157
+ }
158
+ resolveSynthesisReportPath() {
159
+ if (this.synthesisReportPath) {
160
+ const custom = this.synthesisReportPath.startsWith('/')
161
+ ? this.synthesisReportPath
162
+ : join(this.projectRoot, this.synthesisReportPath);
163
+ return existsSync(custom) ? custom : null;
164
+ }
165
+ const candidates = [
166
+ join(this.projectRoot, 'logs/meta-inference/synthesis.md'),
167
+ join(this.projectRoot, 'logs/meta-inference/dry-synthesis.md'),
168
+ ];
169
+ return candidates.find((candidate) => existsSync(candidate)) ?? null;
170
+ }
171
+ getSynthesisExcerpt(maxChars) {
172
+ const reportPath = this.resolveSynthesisReportPath();
173
+ if (!reportPath)
174
+ return undefined;
175
+ const content = readFileSync(reportPath, 'utf8');
176
+ const section5 = content.split('## 5. Strategic Recommendations')[1];
177
+ const excerpt = section5 ?? content.slice(-maxChars);
178
+ return excerpt.slice(0, maxChars).trim();
179
+ }
180
+ readCodexExcerpt(projectRoot, maxChars = 1200) {
181
+ const codexPath = join(projectRoot, '.xray', 'codex.json');
182
+ if (!existsSync(codexPath))
183
+ return { termCount: 0, excerpt: '' };
184
+ try {
185
+ const data = JSON.parse(readFileSync(codexPath, 'utf8'));
186
+ const terms = data.terms ?? [];
187
+ const lines = terms.slice(0, 12).map((t) => {
188
+ const label = t.title ?? t.rule ?? '';
189
+ return t.id != null ? `${t.id}. ${label}` : label;
190
+ });
191
+ return { termCount: terms.length, excerpt: lines.join('\n').slice(0, maxChars) };
192
+ }
193
+ catch {
194
+ return { termCount: 0, excerpt: '' };
195
+ }
196
+ }
197
+ readPlanExcerpt(projectRoot, maxChars = 1200) {
198
+ const planPath = join(projectRoot, '.xray', 'state', 'lead-dev-plan.json');
199
+ if (!existsSync(planPath))
200
+ return '';
201
+ try {
202
+ const plan = JSON.parse(readFileSync(planPath, 'utf8'));
203
+ const phases = plan.phases ?? [];
204
+ const lines = [`active: ${plan.active !== false}`];
205
+ for (const phase of phases) {
206
+ lines.push(`## ${phase.id}${phase.name ? ` — ${phase.name}` : ''}`);
207
+ for (const todo of phase.todos) {
208
+ lines.push(`- [${todo.status}] ${todo.id} (${todo.subagent ?? 'agent'}): ${todo.task}`);
209
+ }
210
+ }
211
+ return lines.join('\n').slice(0, maxChars);
212
+ }
213
+ catch {
214
+ return '';
215
+ }
216
+ }
217
+ }
218
+ //# sourceMappingURL=signal-injector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-injector.js","sourceRoot":"","sources":["../../src/orchestrator-bridge/signal-injector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQjC,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;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CAAC,EAAE,QAAQ,CAAC,CAAC;QAC7C,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,24 @@
1
+ /** Compiled to dist/paths.js — one level below package root. */
2
+ export declare const PACKAGE_ROOT: string;
3
+ export declare const DEFAULT_DATA_DIR: string;
4
+ export declare const DEFAULT_SIGNALS_PATH: string;
5
+ export declare const DEFAULT_STATE_PATH: string;
6
+ export declare const DEFAULT_LOG_DIR: string;
7
+ export declare const DEFAULT_FEEDBACK_DIR: string;
8
+ export declare const DEFAULT_MCP_SERVER_PATH: string;
9
+ export declare const DEFAULT_PROVIDER_PATH: string;
10
+ export declare function defaultProjectStateDir(cwd?: string): string;
11
+ export declare function isRepertoirePackageCwd(cwd: string): boolean;
12
+ export declare function isImmutablePackagePath(filePath: string): boolean;
13
+ /** Signals seed is readable; missing consumer path may fall back to the package file. */
14
+ export declare function resolveReadableConfigPath(configured: string | undefined, cwd: string, packageDefault: string): string;
15
+ /** State/feedback paths must not silently fall back into the package. */
16
+ export declare function resolveWritableConfigPath(configured: string | undefined, cwd: string, fallback: string): string;
17
+ /**
18
+ * Package seed stays read-only. Consumer cwd hydrates `.xray/state/repertoire/curated_signals.json`.
19
+ * Running inside this repo keeps the seed path (tests + organ development).
20
+ */
21
+ export declare function hydrateWritableSignals(seedPath: string, cwd?: string): string;
22
+ /** @deprecated use resolveReadableConfigPath */
23
+ export declare const resolveProviderConfigPath: typeof resolveReadableConfigPath;
24
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAIA,gEAAgE;AAChE,eAAO,MAAM,YAAY,QAAsD,CAAC;AAEhF,eAAO,MAAM,gBAAgB,QAA6B,CAAC;AAC3D,eAAO,MAAM,oBAAoB,QAAqD,CAAC;AACvF,eAAO,MAAM,kBAAkB,QAAqD,CAAC;AACrF,eAAO,MAAM,eAAe,QAAkD,CAAC;AAC/E,eAAO,MAAM,oBAAoB,QAAsD,CAAC;AACxF,eAAO,MAAM,uBAAuB,QAAiD,CAAC;AACtF,eAAO,MAAM,qBAAqB,QAKjC,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,GAAG,SAAgB,GAAG,MAAM,CAElE;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAO3D;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAKhE;AAED,yFAAyF;AACzF,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,MAAM,GACrB,MAAM,CAOR;AAED,yEAAyE;AACzE,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACf,MAAM,CAIR;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAgB,GAAG,MAAM,CAcpF;AAED,gDAAgD;AAChD,eAAO,MAAM,yBAAyB,kCAA4B,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { copyFileSync, existsSync, mkdirSync, readFileSync } from 'node:fs';
2
+ import { dirname, join, resolve, sep } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ /** Compiled to dist/paths.js — one level below package root. */
5
+ export const PACKAGE_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
6
+ export const DEFAULT_DATA_DIR = join(PACKAGE_ROOT, 'data');
7
+ export const DEFAULT_SIGNALS_PATH = join(PACKAGE_ROOT, 'data', 'curated_signals.json');
8
+ export const DEFAULT_STATE_PATH = join(PACKAGE_ROOT, 'data', 'inference-state.json');
9
+ export const DEFAULT_LOG_DIR = join(PACKAGE_ROOT, 'logs', 'groover-inference');
10
+ export const DEFAULT_FEEDBACK_DIR = join(PACKAGE_ROOT, 'logs', 'orchestrator-feedback');
11
+ export const DEFAULT_MCP_SERVER_PATH = join(PACKAGE_ROOT, 'dist', 'mcp', 'server.js');
12
+ export const DEFAULT_PROVIDER_PATH = join(PACKAGE_ROOT, 'dist', 'provider', 'memory-routing-provider.js');
13
+ export function defaultProjectStateDir(cwd = process.cwd()) {
14
+ return join(cwd, '.xray', 'state', 'repertoire');
15
+ }
16
+ export function isRepertoirePackageCwd(cwd) {
17
+ try {
18
+ const pkg = JSON.parse(readFileSync(join(cwd, 'package.json'), 'utf8'));
19
+ return pkg.name === '@0xray/repertoire' || pkg.name === 'repertoire';
20
+ }
21
+ catch {
22
+ return false;
23
+ }
24
+ }
25
+ export function isImmutablePackagePath(filePath) {
26
+ const normalized = resolve(filePath);
27
+ const root = resolve(PACKAGE_ROOT);
28
+ if (normalized === root || normalized.startsWith(root + sep))
29
+ return true;
30
+ return normalized.includes(`${sep}node_modules${sep}@0xray${sep}repertoire${sep}`);
31
+ }
32
+ /** Signals seed is readable; missing consumer path may fall back to the package file. */
33
+ export function resolveReadableConfigPath(configured, cwd, packageDefault) {
34
+ if (!configured)
35
+ return packageDefault;
36
+ const fromCwd = resolve(cwd, configured);
37
+ if (existsSync(fromCwd))
38
+ return fromCwd;
39
+ if (existsSync(configured))
40
+ return resolve(configured);
41
+ if (existsSync(packageDefault))
42
+ return packageDefault;
43
+ return fromCwd;
44
+ }
45
+ /** State/feedback paths must not silently fall back into the package. */
46
+ export function resolveWritableConfigPath(configured, cwd, fallback) {
47
+ if (!configured)
48
+ return fallback;
49
+ if (configured.startsWith('/') || /^[A-Za-z]:[\\/]/.test(configured))
50
+ return configured;
51
+ return resolve(cwd, configured);
52
+ }
53
+ /**
54
+ * Package seed stays read-only. Consumer cwd hydrates `.xray/state/repertoire/curated_signals.json`.
55
+ * Running inside this repo keeps the seed path (tests + organ development).
56
+ */
57
+ export function hydrateWritableSignals(seedPath, cwd = process.cwd()) {
58
+ if (!isImmutablePackagePath(seedPath)) {
59
+ return seedPath;
60
+ }
61
+ const seed = existsSync(seedPath) ? seedPath : DEFAULT_SIGNALS_PATH;
62
+ if (isRepertoirePackageCwd(cwd)) {
63
+ return seed;
64
+ }
65
+ const dest = join(defaultProjectStateDir(cwd), 'curated_signals.json');
66
+ mkdirSync(dirname(dest), { recursive: true });
67
+ if (!existsSync(dest) && existsSync(seed)) {
68
+ copyFileSync(seed, dest);
69
+ }
70
+ return dest;
71
+ }
72
+ /** @deprecated use resolveReadableConfigPath */
73
+ export const resolveProviderConfigPath = resolveReadableConfigPath;
74
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AAEhF,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,sBAAsB,CAAC,CAAC;AACvF,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,sBAAsB,CAAC,CAAC;AACrF,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAC/E,MAAM,CAA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;IAC9C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,gDAAgD;AAChD,MAAM,CAAC,MAAM,yBAAyB,GAAG,yBAAyB,CAAC"}
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Repertoire implementation of the 0xRay MemoryRoutingProvider contract.
3
+ *
4
+ * Loaded dynamically by 0xRay via features.json memory_routing.module_path.
5
+ * Other providers can follow the same createMemoryRoutingProvider() export pattern.
6
+ */
7
+ /** Mirrors 0xRay memory-routing/types.ts — kept local to avoid compile-time coupling */
8
+ export interface MemoryAgentCapability {
9
+ capabilities: string[];
10
+ complexityThreshold: number;
11
+ concurrentTasks: number;
12
+ memorySignals?: string[];
13
+ memoryTags?: string[];
14
+ }
15
+ export interface MemoryOrchestrationTask {
16
+ id: string;
17
+ description: string;
18
+ type: string;
19
+ priority?: 'critical' | 'high' | 'medium' | 'low';
20
+ dependencies?: string[];
21
+ estimatedComplexity?: number;
22
+ metadata?: Record<string, unknown>;
23
+ }
24
+ export interface MemoryTaskConfidence {
25
+ signals: Array<{
26
+ name: string;
27
+ confidence: number;
28
+ }>;
29
+ matchedSignals: string[];
30
+ avgConfidence: number;
31
+ maxConfidence: number;
32
+ highConfidenceTrapPresent: boolean;
33
+ ontologicalTrapDetected: boolean;
34
+ complexityBoost: number;
35
+ recommendedAgent: string | null;
36
+ }
37
+ export interface MemoryRoutingContext {
38
+ providerId: string;
39
+ matchedSignals: string[];
40
+ matchedTags: string[];
41
+ flags: Record<string, boolean>;
42
+ synthesisAvailable: boolean;
43
+ signalConfidences?: Record<string, number>;
44
+ avgMatchConfidence?: number;
45
+ }
46
+ export interface MemoryInheritedContext {
47
+ providerId: string;
48
+ matchedSignals: Array<{
49
+ name: string;
50
+ definition: string;
51
+ priority: string;
52
+ }>;
53
+ synthesisExcerpt?: string;
54
+ flags: Record<string, boolean>;
55
+ }
56
+ export interface MemoryThinDispatchResult {
57
+ agent: string;
58
+ adjustedScore: number;
59
+ context: MemoryRoutingContext;
60
+ }
61
+ export interface OrchestratorFeedbackEntry {
62
+ timestamp: string;
63
+ sessionId: string;
64
+ taskId: string;
65
+ assignedAgent: string;
66
+ memorySignals: string[];
67
+ complexity: number;
68
+ success: boolean;
69
+ durationMs: number;
70
+ dynamoResult?: Record<string, unknown>;
71
+ }
72
+ export interface MemoryRoutingProviderConfig {
73
+ dataDir?: string;
74
+ signalsPath?: string;
75
+ logDir?: string;
76
+ statePath?: string;
77
+ feedbackDir?: string;
78
+ projectRoot?: string;
79
+ }
80
+ export interface MemoryRoutingProvider {
81
+ readonly id: string;
82
+ readonly name: string;
83
+ isAvailable(): boolean;
84
+ buildRoutingContext(operation: string): MemoryRoutingContext;
85
+ enhanceAgentCapabilities(base: Map<string, MemoryAgentCapability>): Map<string, MemoryAgentCapability>;
86
+ enrichTasks(tasks: MemoryOrchestrationTask[]): MemoryOrchestrationTask[];
87
+ buildInheritedContext(tasks: MemoryOrchestrationTask[]): MemoryInheritedContext;
88
+ selectAgent(capabilities: Map<string, MemoryAgentCapability>, requiredCapabilities: string[], complexity: number, operation: string): string | null;
89
+ resolveThinDispatch(baseAgent: string, operation: string, complexityScore: number): MemoryThinDispatchResult;
90
+ getTaskConfidence?(task: MemoryOrchestrationTask): MemoryTaskConfidence;
91
+ ingestFeedback?(entry: OrchestratorFeedbackEntry): void;
92
+ buildSynthesisContext?(opts: {
93
+ projectRoot: string;
94
+ dueReason?: string | null;
95
+ }): Record<string, unknown> | null;
96
+ refreshMetaInference?(): Promise<{
97
+ refreshed: boolean;
98
+ }>;
99
+ }
100
+ export type ProviderAvailabilityReason = 'ok' | 'empty_registry' | 'signals_unreadable' | 'signals_missing';
101
+ export interface ProviderAvailabilityStatus {
102
+ available: boolean;
103
+ reason: ProviderAvailabilityReason;
104
+ signalCount: number;
105
+ signalsPath: string;
106
+ }
107
+ export { resolveReadableConfigPath as resolveProviderConfigPath } from '../paths.js';
108
+ export declare class RepertoireMemoryRoutingProvider implements MemoryRoutingProvider {
109
+ readonly id = "repertoire";
110
+ readonly name = "Repertoire (deep memory + primitive registry)";
111
+ private readonly service;
112
+ readonly signalsPath: string;
113
+ constructor(config?: MemoryRoutingProviderConfig);
114
+ getAvailabilityStatus(): ProviderAvailabilityStatus;
115
+ isAvailable(): boolean;
116
+ buildRoutingContext(operation: string): MemoryRoutingContext;
117
+ enhanceAgentCapabilities(base: Map<string, MemoryAgentCapability>): Map<string, MemoryAgentCapability>;
118
+ enrichTasks(tasks: MemoryOrchestrationTask[]): MemoryOrchestrationTask[];
119
+ buildInheritedContext(tasks: MemoryOrchestrationTask[]): MemoryInheritedContext;
120
+ selectAgent(capabilities: Map<string, MemoryAgentCapability>, requiredCapabilities: string[], complexity: number, operation: string): string | null;
121
+ resolveThinDispatch(baseAgent: string, operation: string, complexityScore: number): MemoryThinDispatchResult;
122
+ getTaskConfidence(task: MemoryOrchestrationTask): MemoryTaskConfidence;
123
+ ingestFeedback(entry: OrchestratorFeedbackEntry): {
124
+ logPath: string;
125
+ updatedSignals: Array<{
126
+ signalName: string;
127
+ previousAvgConfidence: number | null;
128
+ updatedAvgConfidence: number | null;
129
+ }>;
130
+ };
131
+ buildSynthesisContext(opts: {
132
+ projectRoot: string;
133
+ dueReason?: string | null;
134
+ }): Record<string, unknown> | null;
135
+ refreshMetaInference(): Promise<{
136
+ refreshed: boolean;
137
+ }>;
138
+ }
139
+ /** Factory export — 0xRay provider-loader calls this by name */
140
+ export declare function createMemoryRoutingProvider(config?: MemoryRoutingProviderConfig): MemoryRoutingProvider;
141
+ //# sourceMappingURL=memory-routing-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-routing-provider.d.ts","sourceRoot":"","sources":["../../src/provider/memory-routing-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAwBH,w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