nexus-agents 2.28.0 → 2.29.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 (118) hide show
  1. package/README.md +11 -10
  2. package/dist/adaptive-memory-RST6DZYR.js +15 -0
  3. package/dist/chunk-2UR7YN6T.js +700 -0
  4. package/dist/chunk-2UR7YN6T.js.map +1 -0
  5. package/dist/chunk-2UUUKVNR.js +61 -0
  6. package/dist/chunk-2UUUKVNR.js.map +1 -0
  7. package/dist/chunk-3EVVQ32X.js +838 -0
  8. package/dist/chunk-3EVVQ32X.js.map +1 -0
  9. package/dist/{chunk-UGNLR4NZ.js → chunk-3GXDN4AX.js} +2 -2
  10. package/dist/{chunk-LKSTILEE.js → chunk-4AGPR6XZ.js} +194 -1461
  11. package/dist/chunk-4AGPR6XZ.js.map +1 -0
  12. package/dist/chunk-4HA5PAL7.js +246 -0
  13. package/dist/chunk-4HA5PAL7.js.map +1 -0
  14. package/dist/chunk-633WH2ML.js +127 -0
  15. package/dist/chunk-633WH2ML.js.map +1 -0
  16. package/dist/chunk-7SKAKA4I.js +90 -0
  17. package/dist/chunk-7SKAKA4I.js.map +1 -0
  18. package/dist/chunk-AP2FD37C.js +127 -0
  19. package/dist/chunk-AP2FD37C.js.map +1 -0
  20. package/dist/chunk-BC3M4VLP.js +359 -0
  21. package/dist/chunk-BC3M4VLP.js.map +1 -0
  22. package/dist/chunk-BQ4YXGGQ.js +127 -0
  23. package/dist/chunk-BQ4YXGGQ.js.map +1 -0
  24. package/dist/chunk-C2C5ONFR.js +195 -0
  25. package/dist/chunk-C2C5ONFR.js.map +1 -0
  26. package/dist/chunk-CGWRJ4EM.js +12661 -0
  27. package/dist/chunk-CGWRJ4EM.js.map +1 -0
  28. package/dist/chunk-CLYZ7FWP.js +30 -0
  29. package/dist/chunk-CLYZ7FWP.js.map +1 -0
  30. package/dist/chunk-ED6VQWNG.js +63 -0
  31. package/dist/chunk-ED6VQWNG.js.map +1 -0
  32. package/dist/{chunk-L2SHSW4T.js → chunk-ELIFTCYM.js} +2705 -2473
  33. package/dist/chunk-ELIFTCYM.js.map +1 -0
  34. package/dist/chunk-FYJVXQHX.js +944 -0
  35. package/dist/chunk-FYJVXQHX.js.map +1 -0
  36. package/dist/{chunk-QZEAD6AG.js → chunk-FZFZ77UJ.js} +19434 -38182
  37. package/dist/chunk-FZFZ77UJ.js.map +1 -0
  38. package/dist/chunk-IECE6DBS.js +1585 -0
  39. package/dist/chunk-IECE6DBS.js.map +1 -0
  40. package/dist/chunk-LLGUX44Z.js +356 -0
  41. package/dist/chunk-LLGUX44Z.js.map +1 -0
  42. package/dist/chunk-MRU6L7YJ.js +931 -0
  43. package/dist/chunk-MRU6L7YJ.js.map +1 -0
  44. package/dist/chunk-N5SY7V45.js +44 -0
  45. package/dist/chunk-N5SY7V45.js.map +1 -0
  46. package/dist/chunk-OOIPRRPX.js +3790 -0
  47. package/dist/chunk-OOIPRRPX.js.map +1 -0
  48. package/dist/chunk-SRECH7OQ.js +354 -0
  49. package/dist/chunk-SRECH7OQ.js.map +1 -0
  50. package/dist/{chunk-YSDUVCCZ.js → chunk-VKRMXD62.js} +6 -6
  51. package/dist/{chunk-E7EX2KQJ.js → chunk-XU3NADFE.js} +2 -2
  52. package/dist/chunk-YSTJEMQX.js +122 -0
  53. package/dist/chunk-YSTJEMQX.js.map +1 -0
  54. package/dist/cli-circuit-breaker-5FAODXVY.js +13 -0
  55. package/dist/cli.d.ts +2 -2
  56. package/dist/cli.js +1485 -683
  57. package/dist/cli.js.map +1 -1
  58. package/dist/codebase-search-CZUA37RU.js +9 -0
  59. package/dist/composite-router-FNW7ZWL7.js +17 -0
  60. package/dist/composite-router-FNW7ZWL7.js.map +1 -0
  61. package/dist/consensus-vote-757YULIP.js +25 -0
  62. package/dist/consensus-vote-757YULIP.js.map +1 -0
  63. package/dist/{dist-H5XNXVAV.js → dist-CV74KUT7.js} +1521 -972
  64. package/dist/dist-CV74KUT7.js.map +1 -0
  65. package/dist/{doctor-deep-BDE2PHVX.js → doctor-deep-LMCEAFU4.js} +4 -3
  66. package/dist/doctor-deep-LMCEAFU4.js.map +1 -0
  67. package/dist/expert-bridge-L2D4OXOR.js +10 -0
  68. package/dist/expert-bridge-L2D4OXOR.js.map +1 -0
  69. package/dist/expert-config-A5CHKUGI.js +22 -0
  70. package/dist/expert-config-A5CHKUGI.js.map +1 -0
  71. package/dist/factory-ELEDP2WD.js +17 -0
  72. package/dist/factory-ELEDP2WD.js.map +1 -0
  73. package/dist/factory-IDTIBX6B.js +14 -0
  74. package/dist/factory-IDTIBX6B.js.map +1 -0
  75. package/dist/index.d.ts +1814 -777
  76. package/dist/index.js +785 -355
  77. package/dist/index.js.map +1 -1
  78. package/dist/issue-triage-SJPKJLXH.js +15 -0
  79. package/dist/issue-triage-SJPKJLXH.js.map +1 -0
  80. package/dist/learning-persistence-WMWZJZ35.js +16 -0
  81. package/dist/learning-persistence-WMWZJZ35.js.map +1 -0
  82. package/dist/mcp-config-2OXIOMJ6.js +12 -0
  83. package/dist/mcp-config-2OXIOMJ6.js.map +1 -0
  84. package/dist/mobimem-5S3VLNSU.js +13 -0
  85. package/dist/mobimem-5S3VLNSU.js.map +1 -0
  86. package/dist/{model-capabilities-types-CSWO27YN.d.ts → model-capabilities-types-B57GZryc.d.ts} +1 -1
  87. package/dist/repo-analyze-HWMXSK5C.js +24 -0
  88. package/dist/repo-analyze-HWMXSK5C.js.map +1 -0
  89. package/dist/repo-security-plan-MUFDGWSQ.js +17 -0
  90. package/dist/repo-security-plan-MUFDGWSQ.js.map +1 -0
  91. package/dist/research-helpers-synthesize-OBQJ5BGX.js +10 -0
  92. package/dist/research-helpers-synthesize-OBQJ5BGX.js.map +1 -0
  93. package/dist/routing-memory-3QBQTS4A.js +13 -0
  94. package/dist/routing-memory-3QBQTS4A.js.map +1 -0
  95. package/dist/session-memory-VXWLOFRC.js +22 -0
  96. package/dist/session-memory-VXWLOFRC.js.map +1 -0
  97. package/dist/{setup-command-SS7LMN7Y.js → setup-command-E6MXO5RZ.js} +9 -5
  98. package/dist/setup-command-E6MXO5RZ.js.map +1 -0
  99. package/dist/setup-config-O5F3AZBL.js +10 -0
  100. package/dist/setup-config-O5F3AZBL.js.map +1 -0
  101. package/dist/shared-memory-AEO2HJLC.js +8 -0
  102. package/dist/shared-memory-AEO2HJLC.js.map +1 -0
  103. package/dist/symbol-extractor-UEBANFSN.js +10 -0
  104. package/dist/symbol-extractor-UEBANFSN.js.map +1 -0
  105. package/dist/weather-report-MUGSIOU5.js +15 -0
  106. package/dist/weather-report-MUGSIOU5.js.map +1 -0
  107. package/package.json +18 -19
  108. package/dist/chunk-L2SHSW4T.js.map +0 -1
  109. package/dist/chunk-LKSTILEE.js.map +0 -1
  110. package/dist/chunk-QZEAD6AG.js.map +0 -1
  111. package/dist/dist-H5XNXVAV.js.map +0 -1
  112. package/dist/setup-config-DSMOOLVW.js +0 -9
  113. /package/dist/{doctor-deep-BDE2PHVX.js.map → adaptive-memory-RST6DZYR.js.map} +0 -0
  114. /package/dist/{chunk-UGNLR4NZ.js.map → chunk-3GXDN4AX.js.map} +0 -0
  115. /package/dist/{chunk-YSDUVCCZ.js.map → chunk-VKRMXD62.js.map} +0 -0
  116. /package/dist/{chunk-E7EX2KQJ.js.map → chunk-XU3NADFE.js.map} +0 -0
  117. /package/dist/{setup-command-SS7LMN7Y.js.map → cli-circuit-breaker-5FAODXVY.js.map} +0 -0
  118. /package/dist/{setup-config-DSMOOLVW.js.map → codebase-search-CZUA37RU.js.map} +0 -0
package/dist/index.js CHANGED
@@ -1,19 +1,19 @@
1
+ import {
2
+ createGitHubProvider,
3
+ createScmProvider
4
+ } from "./chunk-N5SY7V45.js";
1
5
  import {
2
6
  ALLOWED_COMMANDS,
3
7
  ARTIFACT_TYPES,
8
+ AUDIT_PIPELINE_TEMPLATE,
4
9
  ActivationStrategySchema,
5
- AdapterModelError,
6
- AgentActionSchema,
7
10
  AgentEventSchema,
8
- AgentFindingSchema,
9
11
  AgentMessageSchema,
10
- AgentPerformanceSchema,
11
12
  AgentRoleSchema,
12
13
  AgentRoleSchema2,
13
14
  AgentRoleSchema3,
14
15
  AgentRunnerError,
15
16
  AgentStateMachine,
16
- AgentStateSchema,
17
17
  AnalysisError,
18
18
  AppConfigSchema,
19
19
  ArchitectureExpert,
@@ -32,36 +32,22 @@ import {
32
32
  AuditTrail,
33
33
  AuthorizationMethodSchema,
34
34
  AvailabilityCache,
35
- BUILT_IN_EXPERTS,
36
35
  BUILT_IN_RULES,
37
36
  BUILT_IN_TEMPLATES,
38
- BaseAdapter,
39
37
  BaseAgent,
40
38
  BaseAgentOptionsSchema,
41
39
  BestSolutionSchema,
42
- BuiltInExpertTypeSchema,
43
40
  CHECKPOINT_SCHEMA_VERSION,
44
- CLAUDE_MODELS,
45
- CLAUDE_MODEL_ALIASES,
46
41
  COMPLEXITY_ORDER,
47
42
  CORE_PLUGINS,
48
- ClaudeAdapter,
49
43
  CliAgentExecutor,
50
- CliCircuitBreakerIntegration,
51
44
  CodeChangeSchema,
52
45
  CodeExpert,
53
46
  CollaborationConfigSchema,
54
47
  CollaborationPatternSchema,
55
48
  CollaborationSession,
56
49
  CompactDashboardRenderer,
57
- ConsensusAlgorithmSchema,
58
- ConsensusEngine,
59
- ConsensusEngineConfigSchema,
60
- ConsensusError,
61
- ConsensusMetricsSchema,
62
50
  ConsensusProtocol,
63
- ConsensusResultSchema,
64
- ConsensusVoteInputSchema,
65
51
  ContentPriority,
66
52
  ContextBudgetSchema,
67
53
  ContextFilterSchema,
@@ -70,9 +56,6 @@ import {
70
56
  ContextPruneStrategySchema,
71
57
  ContextPruner,
72
58
  ContextPrunerConfigSchema,
73
- CorrelationCoefficientSchema,
74
- CorrelationTracker,
75
- CorrelationTrackerStatsSchema,
76
59
  CostEstimateSchema,
77
60
  CoverageMetricsSchema,
78
61
  CreateExpertInputSchema,
@@ -83,7 +66,6 @@ import {
83
66
  DEFAULT_BUDGET,
84
67
  DEFAULT_CAPABILITIES as DEFAULT_CAPABILITIES2,
85
68
  DEFAULT_COMPOSER_CONFIG,
86
- DEFAULT_CONSENSUS_CONFIG,
87
69
  DEFAULT_DASHBOARD_CONFIG,
88
70
  DEFAULT_DASHBOARD_RENDER_OPTIONS,
89
71
  DEFAULT_EVALUATION_CONFIG,
@@ -92,7 +74,6 @@ import {
92
74
  DEFAULT_FEEDBACK_INTEGRATION_CONFIG,
93
75
  DEFAULT_FOREST_CONFIG,
94
76
  DEFAULT_HARNESS_EXECUTION_CONFIG,
95
- DEFAULT_HIGHER_ORDER_CONFIG,
96
77
  DEFAULT_MAX_RETRIES,
97
78
  DEFAULT_PATCH_OPTIONS,
98
79
  DEFAULT_PATH_SCORING_OPTIONS,
@@ -110,15 +91,13 @@ import {
110
91
  DEFAULT_TEST_RUNNER_CONFIG,
111
92
  DEFAULT_TIMEOUTS,
112
93
  DEFAULT_TRINITY_CONFIG,
113
- DEFAULT_VOTING_PROTOCOL_CONFIG,
114
94
  DEFAULT_WAVE_CONFIG,
115
- DEFAULT_WEIGHTED_VOTING_CONFIG,
95
+ DEV_PIPELINE_TEMPLATE,
116
96
  Dashboard,
117
97
  DashboardConfigSchema,
118
98
  DatasetLoadError,
119
99
  DelegateInputSchema,
120
100
  DelegateOutputSchema,
121
- DelegateRequestSchema,
122
101
  DependencyErrorCodeSchema,
123
102
  DependencyErrorSchema,
124
103
  DependencyGraph,
@@ -128,17 +107,14 @@ import {
128
107
  EXPERT_CAPABILITIES,
129
108
  EXPERT_DEFAULT_CAPABILITIES,
130
109
  EXPERT_DEFAULT_TEMPERATURES,
131
- EXPERT_TYPE_TO_ROLE,
132
110
  EvaluationHarness,
133
111
  EvaluationHarnessError,
134
- EventBus,
135
112
  ExecuteExpertInputSchema,
136
113
  ExecuteSpecInputSchema,
137
114
  Expert,
138
115
  ExpertAssignmentSchema,
139
116
  ExpertCollaborationPattern,
140
117
  ExpertConfigSchema,
141
- ExpertConfigSchema2,
142
118
  ExpertDefinitionSchema,
143
119
  ExpertDomainSchema,
144
120
  ExpertFactory,
@@ -148,39 +124,29 @@ import {
148
124
  ExpertOutputSchema,
149
125
  ExpertParticipationSchema,
150
126
  ExpertRegistry,
151
- ExpertRequestSchema,
152
127
  ExplorationEventSchema,
153
128
  ExplorationEventTypeSchema,
154
- FALLBACK_SCANNER_DATA,
129
+ ExtractSymbolsInputSchema,
155
130
  FactoryError,
156
131
  FailurePatternSchema,
157
132
  FeedbackCollectorConfigSchema,
158
133
  FeedbackIntegration,
159
134
  FileAuditStorage,
160
- FindingVoteSchema,
161
135
  ForestConfigSchema,
162
136
  ForestPruningStrategySchema,
163
137
  ForestResultSchema,
164
138
  ForestStateSchema,
165
139
  ForestStatisticsSchema,
140
+ GENERAL_PIPELINE_TEMPLATE,
166
141
  GeminiResponseParser,
167
142
  GeneratedTestSchema,
168
- GitHubProvider,
169
- GitHubReviewer,
170
- GitHubUserInfo,
171
- GitHubUserRoleSchema,
172
143
  GraphBuilder,
173
144
  HarnessExecutor,
174
145
  HarnessExecutorError,
175
- HigherOrderVotingConfigSchema,
176
- HigherOrderVotingResultSchema,
177
- HigherOrderVotingStrategy,
178
146
  ICTMConfigSchema,
179
147
  ICTMInferenceResultSchema,
180
148
  InMemoryAuditStorage,
181
149
  InMemoryCheckpointStore,
182
- IndependentSubsetSchema,
183
- InjectionFlagSchema,
184
150
  InputDefinitionSchema,
185
151
  InputDefinitionSchema2,
186
152
  InputTypeSchema,
@@ -194,73 +160,64 @@ import {
194
160
  MAX_EXECUTION_TIME_MS,
195
161
  MIN_EXPERTS_FOR_PATTERN,
196
162
  MODEL_CAPABILITIES,
163
+ MemoryQueryInputSchema,
164
+ MemoryStatsInputSchema,
165
+ MemoryWriteInputSchema,
197
166
  ModelConfigSchema,
198
- ModelPreferenceSchema,
199
167
  ModelSelectionSchema,
200
168
  ModelTiersSchema,
201
- NOOP_NOTIFIER,
202
169
  NexusAgentExecutor,
203
- NoAdapterError,
204
170
  NodeStateSchema,
205
- OWVoting,
206
- ObserverTopics,
207
171
  OrchestrateInputSchema,
208
172
  OrchestrateOutputSchema,
209
- OrchestrateRequestSchema,
210
173
  OrchestrationError,
211
- OrchestrationObserver,
212
- OrchestrationObserverConfigSchema,
213
174
  OrchestrationUnavailableError,
214
175
  Orchestrator,
215
176
  OrchestratorFactory,
216
177
  OrchestratorOptionsSchema,
217
178
  OutcomeFeedbackCollector,
179
+ PIPELINE_STATE_KEYS,
180
+ PIPELINE_TEMPLATES,
218
181
  PLUGIN_TRUST_LEVELS,
219
182
  PROMPT_DEFINITIONS,
220
- PROVIDER_ENV_KEYS,
221
- PairwiseVotingHistorySchema,
222
183
  ParallelProtocol,
223
184
  PatchApplicator,
224
185
  PatchApplicatorError,
225
186
  PathScoreBreakdownSchema,
226
187
  PathScoreSchema,
227
- PersistentOutcomeStore,
228
188
  PipelineRunner,
229
189
  PlanContractSchema,
230
190
  PluginManifestSchema,
231
191
  PluginRegistry,
232
- PolicyConfigSchema,
233
192
  PolicyEngine,
234
- PolicyError,
235
- PolicyFirewall,
236
193
  PolicyGateSpecSchema,
237
194
  PredictionWriteError,
238
195
  PredictionWriter,
239
- ProofOfLearningStrategy,
240
- ProposalSchema,
241
- ProposalStatusSchema,
242
196
  ProtocolFactory,
243
197
  ProviderConfigSchema,
244
198
  PruningStrategy,
245
199
  QualitySignalsSchema,
246
- REJECTION_CATEGORIES,
200
+ QueryTraceInputSchema,
247
201
  REPO_COMPLEXITY,
248
- ROLE_DEFAULT_TRUST,
249
- RateLimiter,
202
+ RESEARCH_PIPELINE_TEMPLATE,
250
203
  ReasoningDepthSchema,
251
204
  ReasoningNodeMetadataSchema,
252
205
  ReasoningNodeSchema,
253
206
  ReasoningStepTypeSchema,
254
207
  ReasoningTreeSchema,
255
208
  RegistryError,
256
- RejectionCategorySchema,
209
+ RegistryImportInputSchema,
257
210
  RepoAnalyzeInputSchema,
258
211
  RepoSecurityPlanInputSchema,
259
212
  ReportGenerationError,
260
213
  ReportGenerator,
261
- ReputationCache,
262
- RestApiConfigSchema,
263
- RestApiServer,
214
+ ResearchAddInputSchema,
215
+ ResearchAddSourceInputSchema,
216
+ ResearchAnalyzeInputSchema,
217
+ ResearchCatalogReviewInputSchema,
218
+ ResearchDiscoverInputSchema,
219
+ ResearchQueryInputSchema,
220
+ ResearchSynthesizeInputSchema,
264
221
  ResultAggregator,
265
222
  ReviewProtocol,
266
223
  ReviewResponseMessageSchema,
@@ -275,11 +232,8 @@ import {
275
232
  SWEBenchRunnerError,
276
233
  SWE_BENCH_DATASETS,
277
234
  SWE_BENCH_SYSTEM_PROMPT,
278
- SanitizedInputSchema,
279
- SanitizerConfigSchema,
280
- ScmError,
281
235
  ScoreBreakdownSchema,
282
- SdkAdapter,
236
+ SearchCodebaseInputSchema,
283
237
  SecurityConfigSchema,
284
238
  SecurityErrorCodeSchema,
285
239
  SecurityExpert,
@@ -291,7 +245,6 @@ import {
291
245
  SharedConclusionSchema,
292
246
  SharedInsightSchema,
293
247
  SimpleAgent,
294
- SimpleMajorityStrategy,
295
248
  SkillAttestationSchema,
296
249
  SkillCapabilitiesSchema,
297
250
  SkillComposer,
@@ -306,23 +259,14 @@ import {
306
259
  SkillProvenanceSchema,
307
260
  SkillRBACSchema,
308
261
  SkillSecurityErrorSchema,
309
- SourceCitationSchema,
310
262
  StageResultSchema,
311
263
  StageSpecSchema,
312
264
  StepExecutor,
313
- StreamCancelledError,
314
- StreamController,
315
- StreamError,
316
- StrippedElementSchema,
317
265
  SubTaskSchema,
318
266
  SubtaskPrioritySchema,
319
267
  SubtaskStatusSchema,
320
- SupermajorityStrategy,
321
- SuspiciousSignalSchema,
322
268
  SwarmObserver,
323
- SwarmObserver2,
324
269
  SwarmObserverConfigSchema,
325
- SwarmObserverConfigSchema2,
326
270
  SynthesizedResultSchema,
327
271
  TASK_STATUSES,
328
272
  TASK_TYPE_EXPERTS,
@@ -331,7 +275,6 @@ import {
331
275
  TRINITY_ROLE_MAX_TOKENS,
332
276
  TRINITY_ROLE_PROMPTS,
333
277
  TRINITY_ROLE_TEMPERATURES,
334
- TRUST_TIER_NUMERIC,
335
278
  TaskAnalysisResultSchema,
336
279
  TaskAnalysisSchema,
337
280
  TaskComplexity,
@@ -357,87 +300,57 @@ import {
357
300
  TrinityPhaseSchema,
358
301
  TrinityRoleSchema,
359
302
  TrinityStopReasonSchema,
360
- TrustTierSchema,
361
- UnanimousStrategy,
362
- VOTING_THRESHOLDS,
363
303
  ValidationDashboard,
364
304
  VerifierVerdictSchema,
365
- ViolationSchema,
366
305
  VoteDecisionSchema,
367
306
  VoteMessageSchema,
368
- VoteSchema,
369
- VotingObservationSchema,
370
- VotingProtocol,
371
- VotingProtocolConfigSchema,
372
- VotingRoundPhaseSchema,
373
- VotingRoundStatusSchema,
374
- VotingStrategyFactory,
375
307
  VulnerabilitySchema,
376
308
  VulnerabilitySeveritySchema,
377
309
  WaveScheduler,
378
- WeightedVoting,
379
310
  WorkflowConfigSchema,
380
311
  WorkflowDefinitionSchema,
381
312
  WorkflowDefinitionSchema2,
382
313
  WorkflowInputsSchema,
383
314
  WorkflowOrchestratorAdapter,
384
- WorkflowRequestSchema,
385
315
  WorkflowStepSchema,
386
316
  WorkflowStepSchema2,
387
- actorFromContext,
388
317
  aggregateResults,
389
318
  analyzeFailures,
390
- analyzeGitHubRepo,
391
- analyzeRepo,
392
319
  analyzeTask,
393
320
  analyzeTask2,
394
321
  append,
395
322
  applyPatch,
396
323
  areStepsCompleted,
397
- assessReputation,
398
- bufferStream,
399
324
  buildDependencyGraph,
400
325
  buildDependencyGraph2,
401
326
  buildDockerArgs,
402
327
  buildEnrichedPrompt,
403
- buildFinalResult,
404
328
  buildHarnessArgs,
405
329
  buildHarnessCommand,
406
- buildPendingResult,
407
- buildPlanFromAnalysis,
408
- buildTimeoutResult,
409
330
  calculateDistributionStats,
410
331
  calculateEstimatedRemaining,
411
332
  calculateMetrics,
412
- calculateMetricsTotals,
413
333
  calculateMinSampleSize,
414
334
  calculateRegret,
415
335
  calculateRepositoryMetrics,
416
- calculateRoutingDistribution,
417
- calculateTokenCost,
418
- calculateVoteWeight,
419
336
  calculateWinLoss,
420
337
  canApplyPatch,
421
338
  canExecuteSkill,
422
- canInfluenceDecisions,
423
- canProceed,
424
339
  cancelExecution,
425
340
  checkPermissionBoundary,
426
341
  checkPipelinePolicy,
342
+ checkpointToResult,
427
343
  chunkByDirectory,
428
- classifyTrust,
429
- clearRegistryCache,
344
+ classifyTask,
345
+ cleanupCheckpoint,
430
346
  clearTemplateCache,
431
- collectRealVotes,
432
- collectStream,
433
347
  compareProportions,
348
+ compilePipelineGraph,
434
349
  compilePlan,
435
350
  compileSpecToGraph,
436
351
  computeOutcomeReward,
437
- concatStreams,
438
352
  containsExpressions,
439
- countActiveSessions,
440
- createAgentPairKey,
353
+ createAgentStages,
441
354
  createArchitectureExpert,
442
355
  createAttestation,
443
356
  createAuditLogger,
@@ -445,24 +358,19 @@ import {
445
358
  createBenchmarkMemory,
446
359
  createCheckpoint,
447
360
  createCheckpointStore,
448
- createClaudeAdapter,
449
- createCliCircuitBreakerIntegration,
450
361
  createCliExecutor,
451
362
  createCodeExpert,
452
363
  createCollaborationSession,
453
- createConsensusEngine,
454
364
  createContextItem,
455
365
  createCorePluginRegistry,
456
- createCorrelationTracker,
457
366
  createDashboard,
458
367
  createDashboardRenderer,
459
368
  createDefaultDeps,
460
369
  createDefaultPolicyEngine,
461
- createDefaultPolicyFirewall,
462
- createDefaultRateLimiter,
463
370
  createDefaultRegistry,
464
371
  createDelegatePipeline,
465
372
  createDependencyError,
373
+ createDevStageRegistry,
466
374
  createDocumentationExpert,
467
375
  createDryRunHandler,
468
376
  createEmptyContext,
@@ -473,36 +381,26 @@ import {
473
381
  createExecutor,
474
382
  createExplorationPrompt,
475
383
  createFeedbackIntegration,
476
- createFullGitHubProvider,
477
384
  createGraphAuditBridge,
478
385
  createHarnessExecutor,
479
- createHigherOrderVotingStrategy,
480
- createInitialCostMetrics,
481
386
  createInitialProgress,
482
- createInitialSessionMetrics,
483
- createInitialTokenUsage,
484
387
  createInitializedWorkflowEngine,
485
388
  createInstancePrompt,
486
389
  createInteractionGraph,
487
390
  createIsolatedRegistry,
488
391
  createMcpLogger,
489
- createMcpNotifier,
490
392
  createMockExecutor,
491
393
  createNexusExecutorFromEnv,
492
- createOWVoting,
493
- createOrchestrationObserver,
494
394
  createOrchestrator,
495
395
  createOrchestratorFactory,
496
396
  createOutcomeFeedbackCollector,
497
397
  createPatchApplicator,
498
- createPolicyContext,
499
398
  createPrediction,
500
399
  createProductionWorkflowEngine,
501
400
  createProgressAdapter,
502
401
  createProtocolFactory,
503
402
  createRealWorkflowEngine,
504
403
  createReportGenerator,
505
- createRestApiServer,
506
404
  createResultAggregator,
507
405
  createRetryPrompt,
508
406
  createRoutingDecision,
@@ -519,11 +417,8 @@ import {
519
417
  createStateGuard,
520
418
  createStateMachine,
521
419
  createStepExecutor,
522
- createStrategyFactory,
523
- createStream,
524
420
  createSummaryPrompt,
525
421
  createSwarmObserver,
526
- createSwarmObserver2,
527
422
  createTaskOutcome,
528
423
  createTaskQueue,
529
424
  createTemplateRegistry,
@@ -531,16 +426,12 @@ import {
531
426
  createTestingExpert,
532
427
  createTimer,
533
428
  createToolLogger,
534
- createTrackedAgent,
535
429
  createTrinityCoordinator,
536
430
  createValidatedExecutor,
537
431
  createValidatedHarness,
538
432
  createValidationDashboard,
539
- createValidator,
540
433
  createVariantRunner,
541
- createVotingProtocol,
542
434
  createWaveScheduler,
543
- createWeightedVoting,
544
435
  createWorkflowEngineDeps,
545
436
  createWorkflowEngineDepsAsync,
546
437
  createWorkflowRouter,
@@ -549,27 +440,25 @@ import {
549
440
  decomposeSpec,
550
441
  defaultConfig,
551
442
  delegateInputToTaskContract,
552
- denyMutationsWithoutModeRule,
553
443
  detectTestFramework,
554
- determineFinalStatus,
555
444
  emitCorroborationEvent,
556
445
  emitExecutionComplete,
557
446
  emitGraphExecutionEvent,
558
447
  emitNodeResults,
559
448
  emitNodeStarted,
449
+ emitPipelineStageEvent,
560
450
  emitPolicyEvent,
561
451
  emitReputationEvent,
562
452
  emitSanitizationEvent,
453
+ emitStageCompleted,
454
+ emitStageFailed,
455
+ emitStageStarted,
563
456
  emitStateUpdated,
564
457
  emitStepCompleted,
565
- emitThresholdUpdate,
566
- emitTrendDetected,
567
458
  emitTrustEvent,
568
459
  estimateDifficulty,
569
460
  estimateTokens,
570
- evaluatePolicy,
571
- evaluatePolicy2,
572
- evaluatePolicy3,
461
+ evaluatePolicy as evaluatePolicy2,
573
462
  evaluatePredictions,
574
463
  executeDelegatePipeline,
575
464
  executeGraph,
@@ -580,33 +469,24 @@ import {
580
469
  executeSpec,
581
470
  exportReport,
582
471
  extractApproach,
583
- extractBooleanField,
584
472
  extractExpressions,
585
473
  extractFilesFromResponse,
586
474
  extractHypothesis,
587
475
  extractModelName,
588
- extractNumberField,
589
476
  extractPastSuccessRates,
590
477
  extractPatch,
591
478
  extractRepoFromInstanceId,
592
479
  extractRepoName,
593
- extractSessionId,
594
- extractStringArrayField,
595
- extractStringField,
480
+ extractStateValue,
596
481
  filterAvailableModels,
597
482
  filterByRepo,
598
483
  filterByVersion,
599
- filterStream,
600
- findActiveSession,
601
484
  findMissingDependencies,
485
+ flushPipelineMemory,
602
486
  formatCompileError,
603
487
  formatContextForPrompt,
604
488
  formatValidationResult,
605
- fromArray,
606
- generateMcpConfig,
607
- generateProposalId,
608
489
  generateReport,
609
- generateSecurityPlan,
610
490
  getAvailabilityCache,
611
491
  getAvailableRoles,
612
492
  getBuiltInTemplates,
@@ -616,10 +496,8 @@ import {
616
496
  getCliForModelId,
617
497
  getCompletedInstanceIds,
618
498
  getCompletedSteps,
619
- getCorroborationRules,
620
499
  getCpuCores,
621
500
  getDatasetInfo,
622
- getDefaultAllowedTools,
623
501
  getDockerVersion,
624
502
  getEventBusStats,
625
503
  getExecutionDuration,
@@ -637,50 +515,39 @@ import {
637
515
  getPythonVersion,
638
516
  getRecommendedRole,
639
517
  getReferencedSteps,
640
- getRegistryManifest,
641
- getRequiredTrustTier,
642
518
  getResultsFilePath,
643
519
  getSkillSetForTask,
644
520
  getSkillsForTask,
645
521
  getStepResult,
646
522
  getSwarmObserver,
647
523
  getSwebenchVersion,
648
- getTokenEnvVars,
524
+ getTemplate,
649
525
  getTopologicalOrder,
650
526
  getVariable,
651
- hasToken,
652
527
  ictmToExpertConfig,
653
- identifySessionsToRemove,
654
528
  inferICTM,
655
529
  initializeAgentSkills,
656
530
  initializeBuiltInTemplates,
657
531
  initializeEventBusBridge,
658
532
  isCancelled,
659
533
  isCliAvailable as isCliAvailable2,
660
- isMutatingAction,
661
- isReadOnlyAction,
662
534
  isStepCompleted,
663
535
  listInstances,
536
+ listTemplateIds,
537
+ loadCheckpointState,
664
538
  loadDataset,
665
539
  loadTemplateFile,
666
540
  loadTemplatesFromDirectory,
667
541
  loadWorkflowFile,
668
- logPolicyAudit,
669
- logRateLimitAudit,
670
542
  logToolError,
671
- logToolInvocationAudit,
672
543
  logToolStart,
673
544
  logToolSuccess,
674
- mapAuthorAssociation,
675
545
  mapResolutionStatus,
676
546
  mapStateToPhase,
677
547
  mapTestStatus,
678
548
  meanConfidenceInterval,
679
- mergeStreams,
680
- normalizeRepoId,
681
549
  orchestrateInputToTaskContract,
682
550
  overwrite,
683
- parseAgentPairKey,
684
551
  parseExpression,
685
552
  parseJsonResults,
686
553
  parseProgressLine,
@@ -696,52 +563,60 @@ import {
696
563
  readJsonResults,
697
564
  readPredictions,
698
565
  recordOutcome,
699
- reduceStream,
700
- registerConsensusVoteTool,
701
566
  registerCorePlugins,
702
567
  registerCreateExpertTool,
703
568
  registerDelegateToModelTool,
704
569
  registerExecuteExpertTool,
705
570
  registerExecuteSpecTool,
706
571
  registerExpertsResource,
572
+ registerExtractSymbolsTool,
707
573
  registerIssueTriageTool,
708
574
  registerListExpertsTool,
709
575
  registerListWorkflowsTool,
576
+ registerMemoryQueryTool,
577
+ registerMemoryStatsTool,
578
+ registerMemoryWriteTool,
710
579
  registerModelsResource,
711
580
  registerOrchestrateTool,
712
581
  registerPrompts,
582
+ registerQueryTraceTool,
583
+ registerRegistryImportTool,
713
584
  registerRepoAnalyzeTool,
714
585
  registerRepoSecurityPlanTool,
586
+ registerResearchAddSourceTool,
587
+ registerResearchAddTool,
588
+ registerResearchAnalyzeTool,
589
+ registerResearchCatalogReviewTool,
590
+ registerResearchDiscoverTool,
591
+ registerResearchQueryTool,
715
592
  registerResearchResource,
593
+ registerResearchSynthesizeTool,
716
594
  registerResources,
717
595
  registerRunGraphWorkflowTool,
718
596
  registerRunWorkflowTool,
597
+ registerSearchCodebaseTool,
719
598
  registerTools,
720
- requireApiKey,
721
- requiresCitation,
722
- requiresCorroboration,
599
+ registerWeatherReportTool,
723
600
  resetAvailabilityCache,
724
601
  resetPipelinePluginRegistry,
725
602
  resetRegistry,
726
603
  resolveExpression,
727
604
  resolveFallback,
728
605
  resolveInput,
729
- resolveScannerData,
730
606
  resolveStringExpressions,
731
- resolveToken,
732
607
  resolveV2Config,
733
608
  resolveWithFallbacks,
734
- resultToOutcome,
609
+ runAdaptiveOrchestrator,
735
610
  runAgentOnInstance,
736
611
  runBenchmarkInstances,
737
612
  runBenchmarkParallel,
613
+ runDevPipeline,
614
+ runGraphPipeline,
738
615
  runPreconditions,
739
616
  runSingleInstance,
740
617
  runTests,
741
618
  runVerification,
742
- safePathsRule,
743
- safeValidateExpertConfig,
744
- sanitizeInput,
619
+ saveStageCheckpoint,
745
620
  scoreByHybrid,
746
621
  scoreByImportance,
747
622
  scoreByRecency,
@@ -749,32 +624,20 @@ import {
749
624
  selectModel,
750
625
  setSwarmObserver,
751
626
  setVariable,
752
- skip,
753
627
  snapshotContext,
754
628
  sortByPriority,
755
629
  storeStepResult,
756
- take,
757
- takeUntil,
758
- tapStream,
759
- toolError,
760
- toolSuccess,
761
- toolSuccessStructured,
762
630
  transformHarnessOutput,
763
631
  transformHarnessProgress,
764
632
  transformInstanceResult,
765
- transformStream,
766
633
  transformTestResult,
767
634
  updateContext,
768
- validateAgentAction,
769
- validateApiKeyPresence,
770
635
  validateCapabilities,
771
636
  validateCommand,
772
- validateCorroboration,
773
637
  validateDependencyGraph,
774
638
  validateDiskSpace,
775
639
  validateDocker,
776
640
  validateEnvironment,
777
- validateExpertConfig,
778
641
  validateExpressions,
779
642
  validateICTM,
780
643
  validateNexusEnv,
@@ -789,13 +652,219 @@ import {
789
652
  validateSkillExecution,
790
653
  validateSkillProvenance,
791
654
  validateSwebench,
792
- validateToolInput,
793
655
  validateWorkflow,
794
656
  validateWorkflowDependencies,
795
657
  withLogging,
796
- withTimeout,
797
658
  writePredictions
798
- } from "./chunk-QZEAD6AG.js";
659
+ } from "./chunk-FZFZ77UJ.js";
660
+ import {
661
+ getTokenEnvVars,
662
+ hasToken,
663
+ resolveToken
664
+ } from "./chunk-7SKAKA4I.js";
665
+ import "./chunk-X2M7OF27.js";
666
+ import {
667
+ AdapterModelError,
668
+ AgentFindingSchema,
669
+ AgentPerformanceSchema,
670
+ BaseAdapter,
671
+ CLAUDE_MODELS,
672
+ CLAUDE_MODEL_ALIASES,
673
+ ClaudeAdapter,
674
+ ConsensusAlgorithmSchema,
675
+ ConsensusEngine,
676
+ ConsensusEngineConfigSchema,
677
+ ConsensusError,
678
+ ConsensusMetricsSchema,
679
+ ConsensusResultSchema,
680
+ ConsensusVoteInputSchema,
681
+ CorrelationCoefficientSchema,
682
+ CorrelationTracker,
683
+ CorrelationTrackerStatsSchema,
684
+ DEFAULT_CONSENSUS_CONFIG,
685
+ DEFAULT_HIGHER_ORDER_CONFIG,
686
+ DEFAULT_VOTING_PROTOCOL_CONFIG,
687
+ DEFAULT_WEIGHTED_VOTING_CONFIG,
688
+ FindingVoteSchema,
689
+ HigherOrderVotingConfigSchema,
690
+ HigherOrderVotingResultSchema,
691
+ HigherOrderVotingStrategy,
692
+ IndependentSubsetSchema,
693
+ NOOP_NOTIFIER,
694
+ NoAdapterError,
695
+ OWVoting,
696
+ PROVIDER_ENV_KEYS,
697
+ PairwiseVotingHistorySchema,
698
+ PersistentOutcomeStore,
699
+ PolicyConfigSchema,
700
+ PolicyError,
701
+ PolicyFirewall,
702
+ ProofOfLearningStrategy,
703
+ ProposalSchema,
704
+ ProposalStatusSchema,
705
+ REJECTION_CATEGORIES,
706
+ RateLimiter,
707
+ RejectionCategorySchema,
708
+ SdkAdapter,
709
+ SimpleMajorityStrategy,
710
+ StreamCancelledError,
711
+ StreamController,
712
+ StreamError,
713
+ SupermajorityStrategy,
714
+ UnanimousStrategy,
715
+ VOTING_THRESHOLDS,
716
+ VoteSchema,
717
+ VotingObservationSchema,
718
+ VotingProtocol,
719
+ VotingProtocolConfigSchema,
720
+ VotingRoundPhaseSchema,
721
+ VotingRoundStatusSchema,
722
+ VotingStrategyFactory,
723
+ WeightedVoting,
724
+ actorFromContext,
725
+ bufferStream,
726
+ buildFinalResult,
727
+ buildPendingResult,
728
+ buildTimeoutResult,
729
+ calculateVoteWeight,
730
+ collectRealVotes,
731
+ collectStream,
732
+ concatStreams,
733
+ createAgentPairKey,
734
+ createClaudeAdapter,
735
+ createConsensusEngine,
736
+ createCorrelationTracker,
737
+ createDefaultPolicyFirewall,
738
+ createDefaultRateLimiter,
739
+ createHigherOrderVotingStrategy,
740
+ createMcpNotifier,
741
+ createOWVoting,
742
+ createPolicyContext,
743
+ createStrategyFactory,
744
+ createStream,
745
+ createValidator,
746
+ createVotingProtocol,
747
+ createWeightedVoting,
748
+ denyMutationsWithoutModeRule,
749
+ determineFinalStatus,
750
+ emitThresholdUpdate,
751
+ emitTrendDetected,
752
+ evaluatePolicy,
753
+ extractRequestSystemPrompt,
754
+ extractSystemPrompt,
755
+ filterStream,
756
+ fromArray,
757
+ generateCacheKey,
758
+ generateProposalId,
759
+ logPolicyAudit,
760
+ logRateLimitAudit,
761
+ logToolInvocationAudit,
762
+ mergeStreams,
763
+ messagesToAnthropicFormat,
764
+ parseAgentPairKey,
765
+ reduceStream,
766
+ registerConsensusVoteTool,
767
+ requireApiKey,
768
+ resultToOutcome,
769
+ safePathsRule,
770
+ skip,
771
+ take,
772
+ takeUntil,
773
+ tapStream,
774
+ toolError,
775
+ toolSuccess,
776
+ toolSuccessStructured,
777
+ transformStream,
778
+ validateApiKeyPresence,
779
+ validateToolInput,
780
+ withTimeout
781
+ } from "./chunk-CGWRJ4EM.js";
782
+ import "./chunk-MRU6L7YJ.js";
783
+ import {
784
+ AgentActionSchema,
785
+ GitHubReviewer,
786
+ GitHubUserInfo,
787
+ GitHubUserRoleSchema,
788
+ InjectionFlagSchema,
789
+ ROLE_DEFAULT_TRUST,
790
+ ReputationCache,
791
+ SanitizedInputSchema,
792
+ SanitizerConfigSchema,
793
+ SourceCitationSchema,
794
+ StrippedElementSchema,
795
+ SuspiciousSignalSchema,
796
+ TRUST_TIER_NUMERIC,
797
+ TrustTierSchema,
798
+ ViolationSchema,
799
+ assessReputation,
800
+ canInfluenceDecisions,
801
+ canProceed,
802
+ classifyTrust,
803
+ createFullGitHubProvider,
804
+ evaluatePolicy as evaluatePolicy3,
805
+ getCorroborationRules,
806
+ getRequiredTrustTier,
807
+ isMutatingAction,
808
+ isReadOnlyAction,
809
+ mapAuthorAssociation,
810
+ requiresCitation,
811
+ requiresCorroboration,
812
+ sanitizeInput,
813
+ validateAgentAction,
814
+ validateCorroboration
815
+ } from "./chunk-IECE6DBS.js";
816
+ import {
817
+ GitHubProvider,
818
+ ScmError
819
+ } from "./chunk-4HA5PAL7.js";
820
+ import {
821
+ FALLBACK_SCANNER_DATA,
822
+ buildPlanFromAnalysis,
823
+ clearRegistryCache,
824
+ generateSecurityPlan,
825
+ getRegistryManifest,
826
+ resolveScannerData
827
+ } from "./chunk-2UR7YN6T.js";
828
+ import {
829
+ analyzeGitHubRepo,
830
+ analyzeRepo,
831
+ normalizeRepoId
832
+ } from "./chunk-BC3M4VLP.js";
833
+ import "./chunk-AP2FD37C.js";
834
+ import "./chunk-BQ4YXGGQ.js";
835
+ import {
836
+ SharedMemoryStore
837
+ } from "./chunk-ED6VQWNG.js";
838
+ import {
839
+ BUILT_IN_EXPERTS,
840
+ BuiltInExpertTypeSchema,
841
+ EXPERT_TYPE_TO_ROLE,
842
+ ExpertConfigSchema as ExpertConfigSchema2,
843
+ ModelPreferenceSchema,
844
+ safeValidateExpertConfig,
845
+ validateExpertConfig
846
+ } from "./chunk-OOIPRRPX.js";
847
+ import {
848
+ VERSION,
849
+ closeServer,
850
+ connectTransport,
851
+ createServer,
852
+ startStdioServer
853
+ } from "./chunk-3EVVQ32X.js";
854
+ import "./chunk-SRECH7OQ.js";
855
+ import "./chunk-FYJVXQHX.js";
856
+ import "./chunk-633WH2ML.js";
857
+ import {
858
+ generateMcpConfig,
859
+ getDefaultAllowedTools
860
+ } from "./chunk-2UUUKVNR.js";
861
+ import {
862
+ CliCircuitBreakerIntegration,
863
+ createCliCircuitBreakerIntegration
864
+ } from "./chunk-C2C5ONFR.js";
865
+ import {
866
+ executeExpert
867
+ } from "./chunk-YSTJEMQX.js";
799
868
  import {
800
869
  BaseCliAdapter,
801
870
  CLI_TIMEOUT_PROFILES,
@@ -811,22 +880,21 @@ import {
811
880
  GeminiCliAdapter,
812
881
  OpenCodeCliAdapter,
813
882
  SubprocessCliAdapter,
814
- VERSION,
815
- closeServer,
816
- connectTransport,
883
+ calculateBackoffDelay,
884
+ categorizeError,
817
885
  createAllAdapters,
818
886
  createCliAdapter,
819
887
  createCliDetectionCache,
820
- createServer,
821
888
  estimateTaskComplexity,
889
+ executeCliRetryLoop,
822
890
  getAvailableClis,
823
891
  getTimeoutForTask,
824
892
  getTimeoutForTaskAuto,
825
893
  isCliAvailable,
826
- sleep,
827
- startStdioServer
828
- } from "./chunk-LKSTILEE.js";
829
- import "./chunk-X2M7OF27.js";
894
+ isRetryableError,
895
+ sleep
896
+ } from "./chunk-4AGPR6XZ.js";
897
+ import "./chunk-LLGUX44Z.js";
830
898
  import {
831
899
  AgentCapability,
832
900
  AgentError,
@@ -842,6 +910,7 @@ import {
842
910
  DEFAULT_DISTILLER_CONFIG,
843
911
  DEFAULT_PREFERENCE_ROUTER_CONFIG,
844
912
  ErrorCode,
913
+ EventBus,
845
914
  InMemoryPreferenceStore,
846
915
  ModelCapability,
847
916
  ModelError,
@@ -854,7 +923,6 @@ import {
854
923
  PreferenceRouter,
855
924
  PreferenceRouterConfigSchema,
856
925
  QueryFeatureExtractor,
857
- RULES_FILE,
858
926
  RateLimitError,
859
927
  RoutingMemoryError,
860
928
  SecurityError,
@@ -862,6 +930,7 @@ import {
862
930
  TaskOutcomeSchema,
863
931
  TimeoutError,
864
932
  ValidationError,
933
+ WeatherReportInputSchema,
865
934
  WorkflowError,
866
935
  categorizeOutcomeError,
867
936
  categorizeOutcomeErrorMessage,
@@ -874,7 +943,6 @@ import {
874
943
  detectLatencyPatterns,
875
944
  detectSuccessPatterns,
876
945
  detectTrend,
877
- ensureLearningDir,
878
946
  err,
879
947
  extractNonErrorMessage,
880
948
  formatZodError,
@@ -897,7 +965,11 @@ import {
897
965
  toError,
898
966
  unwrap,
899
967
  unwrapOr
900
- } from "./chunk-L2SHSW4T.js";
968
+ } from "./chunk-ELIFTCYM.js";
969
+ import {
970
+ RULES_FILE,
971
+ ensureLearningDir
972
+ } from "./chunk-CLYZ7FWP.js";
901
973
  import "./chunk-UP2VWCW5.js";
902
974
 
903
975
  // src/adapters/factory.ts
@@ -1430,7 +1502,7 @@ function getStatusCode(error) {
1430
1502
  }
1431
1503
  return void 0;
1432
1504
  }
1433
- function isRetryableError(error) {
1505
+ function isRetryableError2(error) {
1434
1506
  if (error === null || error === void 0) {
1435
1507
  return false;
1436
1508
  }
@@ -1472,7 +1544,7 @@ function mergeConfig(config) {
1472
1544
  }
1473
1545
  async function withRetry(operation, options = {}) {
1474
1546
  const config = mergeConfig(options.config ?? {});
1475
- const isRetryable = options.isRetryable ?? isRetryableError;
1547
+ const isRetryable = options.isRetryable ?? isRetryableError2;
1476
1548
  const onRetry = options.onRetry;
1477
1549
  const maxAttempts = config.maxRetries + 1;
1478
1550
  let lastError;
@@ -2179,14 +2251,6 @@ var OllamaAdapter = class extends BaseAdapter {
2179
2251
  controller.error(this.transformError(error));
2180
2252
  }
2181
2253
  }
2182
- extractSystemPrompt(request) {
2183
- if (request.systemPrompt !== void 0 && request.systemPrompt !== "")
2184
- return request.systemPrompt;
2185
- const sys = request.messages.find((m) => m.role === "system");
2186
- if (sys === void 0) return void 0;
2187
- if (typeof sys.content === "string") return sys.content;
2188
- return sys.content.filter((b) => b.type === "text").map((b) => b.text).join("\n");
2189
- }
2190
2254
  buildOptions(request) {
2191
2255
  const options = {
2192
2256
  num_predict: request.maxTokens ?? DEFAULT_MAX_TOKENS2
@@ -2204,7 +2268,7 @@ var OllamaAdapter = class extends BaseAdapter {
2204
2268
  }
2205
2269
  buildRequestParams(request) {
2206
2270
  const messages = request.messages.filter((m) => m.role !== "system").map(mapMessage2);
2207
- const systemPrompt = this.extractSystemPrompt(request);
2271
+ const systemPrompt = extractRequestSystemPrompt(request);
2208
2272
  if (systemPrompt !== void 0) messages.unshift({ role: "system", content: systemPrompt });
2209
2273
  const params = {
2210
2274
  model: this.modelId,
@@ -2484,29 +2548,13 @@ var GeminiAdapter = class extends BaseAdapter {
2484
2548
  controller.error(this.transformError(error));
2485
2549
  }
2486
2550
  }
2487
- /**
2488
- * Extracts system prompt from request.
2489
- */
2490
- extractSystemPrompt(request) {
2491
- if (request.systemPrompt !== void 0 && request.systemPrompt !== "") {
2492
- return request.systemPrompt;
2493
- }
2494
- const systemMessage = request.messages.find((m) => m.role === "system");
2495
- if (systemMessage === void 0) {
2496
- return void 0;
2497
- }
2498
- if (typeof systemMessage.content === "string") {
2499
- return systemMessage.content;
2500
- }
2501
- return systemMessage.content.filter((b) => b.type === "text").map((b) => b.text).join("\n");
2502
- }
2503
2551
  /**
2504
2552
  * Builds generation config from request parameters.
2505
2553
  */
2506
2554
  buildGenerationConfig(request) {
2507
2555
  const config = {};
2508
2556
  config.maxOutputTokens = request.maxTokens ?? DEFAULT_MAX_TOKENS3;
2509
- const systemPrompt = this.extractSystemPrompt(request);
2557
+ const systemPrompt = extractRequestSystemPrompt(request);
2510
2558
  if (systemPrompt !== void 0) config.systemInstruction = systemPrompt;
2511
2559
  if (request.temperature !== void 0) config.temperature = request.temperature;
2512
2560
  if (request.stop !== void 0 && request.stop.length > 0) config.stopSequences = request.stop;
@@ -2590,7 +2638,7 @@ function createGeminiAdapter(config) {
2590
2638
  }
2591
2639
 
2592
2640
  // src/context/token-counter.ts
2593
- import Anthropic2 from "@anthropic-ai/sdk";
2641
+ import Anthropic from "@anthropic-ai/sdk";
2594
2642
  import { GoogleGenAI as GoogleGenAI2 } from "@google/genai";
2595
2643
  import { encoding_for_model } from "tiktoken";
2596
2644
 
@@ -2630,56 +2678,6 @@ var TIKTOKEN_MODEL_MAP = {
2630
2678
  "o1-preview": "o1"
2631
2679
  };
2632
2680
 
2633
- // src/context/token-counter-helpers.ts
2634
- import "@anthropic-ai/sdk";
2635
- function generateCacheKey(content, provider, model) {
2636
- const contentStr = typeof content === "string" ? content : JSON.stringify(content);
2637
- return `${provider}:${model ?? "default"}:${contentStr}`;
2638
- }
2639
- function messagesToAnthropicFormat(messages) {
2640
- return messages.filter((m) => m.role !== "system").map((m) => {
2641
- const role = m.role === "user" ? "user" : "assistant";
2642
- if (typeof m.content === "string") {
2643
- return { role, content: m.content };
2644
- }
2645
- const content = m.content.map((block) => {
2646
- if (block.type === "text") {
2647
- return { type: "text", text: block.text };
2648
- }
2649
- if (block.type === "tool_use") {
2650
- return {
2651
- type: "tool_use",
2652
- id: block.id,
2653
- name: block.name,
2654
- input: block.input
2655
- };
2656
- }
2657
- if (block.type === "tool_result") {
2658
- return {
2659
- type: "tool_result",
2660
- tool_use_id: block.tool_use_id,
2661
- content: block.content
2662
- };
2663
- }
2664
- return {
2665
- type: "image",
2666
- source: block.source
2667
- };
2668
- });
2669
- return { role, content };
2670
- });
2671
- }
2672
- function extractSystemPrompt(messages) {
2673
- const systemMsg = messages.find((m) => m.role === "system");
2674
- if (systemMsg === void 0) {
2675
- return void 0;
2676
- }
2677
- if (typeof systemMsg.content === "string") {
2678
- return systemMsg.content;
2679
- }
2680
- return systemMsg.content.filter((b) => b.type === "text").map((b) => b.text).join("\n");
2681
- }
2682
-
2683
2681
  // src/context/token-counter.ts
2684
2682
  var TokenCounter = class {
2685
2683
  anthropicClient;
@@ -2699,7 +2697,7 @@ var TokenCounter = class {
2699
2697
  this.cacheTtlMs = config.cacheTtlMs ?? DEFAULT_CACHE_TTL_MS;
2700
2698
  this.cache = /* @__PURE__ */ new Map();
2701
2699
  if (config.anthropicApiKey !== void 0 && config.anthropicApiKey !== "") {
2702
- this.anthropicClient = new Anthropic2({ apiKey: config.anthropicApiKey });
2700
+ this.anthropicClient = new Anthropic({ apiKey: config.anthropicApiKey });
2703
2701
  }
2704
2702
  if (config.googleApiKey !== void 0 && config.googleApiKey !== "") {
2705
2703
  this.geminiClient = new GoogleGenAI2({ apiKey: config.googleApiKey });
@@ -3403,10 +3401,10 @@ var RulesSnapshotSchema = z4.object({
3403
3401
  var PersistentStrategyDistiller = class extends StrategyDistiller {
3404
3402
  filePath;
3405
3403
  persistLogger;
3406
- constructor(outcomeStore, persistConfig, logger5, distillerConfig) {
3407
- super(outcomeStore, logger5, distillerConfig);
3404
+ constructor(outcomeStore, persistConfig, logger10, distillerConfig) {
3405
+ super(outcomeStore, logger10, distillerConfig);
3408
3406
  this.filePath = persistConfig?.filePath ?? RULES_FILE;
3409
- this.persistLogger = logger5 ?? createLogger({ component: "PersistentStrategyDistiller" });
3407
+ this.persistLogger = logger10 ?? createLogger({ component: "PersistentStrategyDistiller" });
3410
3408
  const dataDir = persistConfig?.dataDir;
3411
3409
  ensureLearningDir(dataDir);
3412
3410
  this.hydrate();
@@ -3482,7 +3480,7 @@ var PersistentStrategyDistiller = class extends StrategyDistiller {
3482
3480
  }
3483
3481
  };
3484
3482
  registerPersistentDistillerFactory(
3485
- (outcomeStore, logger5) => new PersistentStrategyDistiller(outcomeStore, void 0, logger5)
3483
+ (outcomeStore, logger10) => new PersistentStrategyDistiller(outcomeStore, void 0, logger10)
3486
3484
  );
3487
3485
 
3488
3486
  // src/learning/ab-test-tracker.ts
@@ -5030,6 +5028,14 @@ var FileReferenceSchema = z9.object({
5030
5028
  /** Optional line number */
5031
5029
  line: z9.number().int().positive().optional()
5032
5030
  });
5031
+ var TechStackSchema = z9.object({
5032
+ /** Programming language */
5033
+ language: z9.string().optional(),
5034
+ /** Framework or library */
5035
+ framework: z9.string().optional(),
5036
+ /** Package manager */
5037
+ packageManager: z9.string().optional()
5038
+ });
5033
5039
  var ParsedSpecSchema = z9.object({
5034
5040
  /** Spec title (from first H1 or H2 heading) */
5035
5041
  title: z9.string().min(1),
@@ -5048,7 +5054,9 @@ var ParsedSpecSchema = z9.object({
5048
5054
  /** Sections that were missing from the spec */
5049
5055
  missingSections: z9.array(z9.string()),
5050
5056
  /** Raw markdown source */
5051
- rawMarkdown: z9.string()
5057
+ rawMarkdown: z9.string(),
5058
+ /** Inferred technology stack */
5059
+ techStack: TechStackSchema.optional()
5052
5060
  });
5053
5061
  var KNOWN_SECTIONS = [
5054
5062
  "overview",
@@ -5180,6 +5188,131 @@ var ConsensusPlanConfigSchema = z14.object({
5180
5188
  // src/orchestration/consensus-plan.ts
5181
5189
  var moduleLogger2 = createLogger({ component: "consensus-plan" });
5182
5190
 
5191
+ // src/agents/observability/orchestration-observer-types.ts
5192
+ import { z as z15 } from "zod";
5193
+ var AgentStateSchema = z15.enum(["idle", "thinking", "executing", "waiting", "error"]);
5194
+ var OrchestrationObserverConfigSchema = z15.object({
5195
+ /** Maximum routing decisions to retain in history */
5196
+ maxRoutingHistory: z15.number().positive().optional().default(100),
5197
+ /** Maximum session metrics to retain */
5198
+ maxSessionHistory: z15.number().positive().optional().default(50),
5199
+ /** Metrics update interval in ms */
5200
+ metricsUpdateIntervalMs: z15.number().positive().optional().default(5e3),
5201
+ /** Enable detailed event logging */
5202
+ verboseLogging: z15.boolean().optional().default(false),
5203
+ /** Token cost rates per model (USD per 1K tokens) */
5204
+ tokenCostRates: z15.record(z15.string(), z15.number().nonnegative()).optional().default({
5205
+ claude: 0.015,
5206
+ gemini: 1e-3,
5207
+ codex: 0.01
5208
+ })
5209
+ });
5210
+
5211
+ // src/agents/observability/orchestration-observer-helpers.ts
5212
+ function extractStringField(payload, field) {
5213
+ const value = payload[field];
5214
+ return typeof value === "string" ? value : "";
5215
+ }
5216
+ function extractNumberField(payload, field, defaultValue = 0) {
5217
+ const value = payload[field];
5218
+ return typeof value === "number" ? value : defaultValue;
5219
+ }
5220
+ function extractBooleanField(payload, field) {
5221
+ return payload[field] === true;
5222
+ }
5223
+ function extractStringArrayField(payload, field) {
5224
+ const value = payload[field];
5225
+ return Array.isArray(value) ? value : [];
5226
+ }
5227
+ function extractSessionId(event, payload) {
5228
+ if (event.sessionId !== void 0 && event.sessionId !== "") {
5229
+ return event.sessionId;
5230
+ }
5231
+ return extractStringField(payload, "sessionId");
5232
+ }
5233
+ function createInitialSessionMetrics(sessionId) {
5234
+ return {
5235
+ sessionId,
5236
+ startedAt: getTimeProvider().nowIso(),
5237
+ durationMs: 0,
5238
+ taskCount: 0,
5239
+ successCount: 0,
5240
+ failureCount: 0,
5241
+ tokenUsage: createInitialTokenUsage(),
5242
+ costMetrics: createInitialCostMetrics(),
5243
+ routingDecisions: 0,
5244
+ eventsProcessed: 0
5245
+ };
5246
+ }
5247
+ function createInitialTokenUsage() {
5248
+ return {
5249
+ inputTokens: 0,
5250
+ outputTokens: 0,
5251
+ totalTokens: 0
5252
+ };
5253
+ }
5254
+ function createInitialCostMetrics() {
5255
+ return {
5256
+ totalCostUsd: 0,
5257
+ costPerModel: /* @__PURE__ */ new Map()
5258
+ };
5259
+ }
5260
+ function createTrackedAgent(agentId, state, role = "unknown", currentTask) {
5261
+ return {
5262
+ id: agentId,
5263
+ role,
5264
+ state,
5265
+ currentTask,
5266
+ lastUpdated: getTimeProvider().nowIso(),
5267
+ taskCount: 0,
5268
+ errorCount: 0
5269
+ };
5270
+ }
5271
+ function calculateRoutingDistribution(routingHistory) {
5272
+ const distribution = { claude: 0, gemini: 0, codex: 0, opencode: 0 };
5273
+ for (const decision of routingHistory) {
5274
+ distribution[decision.selectedCli]++;
5275
+ }
5276
+ return distribution;
5277
+ }
5278
+ function calculateMetricsTotals(sessionMetrics) {
5279
+ let totalTokens = 0;
5280
+ let totalCost = 0;
5281
+ for (const metrics of sessionMetrics) {
5282
+ totalTokens += metrics.tokenUsage.totalTokens;
5283
+ totalCost += metrics.costMetrics.totalCostUsd;
5284
+ }
5285
+ return { totalTokens, totalCost };
5286
+ }
5287
+ function countActiveSessions(sessionMetrics) {
5288
+ let count = 0;
5289
+ for (const metrics of sessionMetrics) {
5290
+ if (metrics.completedAt === void 0) {
5291
+ count++;
5292
+ }
5293
+ }
5294
+ return count;
5295
+ }
5296
+ function findActiveSession(sessionMetrics) {
5297
+ for (const metrics of sessionMetrics) {
5298
+ if (metrics.completedAt === void 0) {
5299
+ return metrics;
5300
+ }
5301
+ }
5302
+ return void 0;
5303
+ }
5304
+ function identifySessionsToRemove(sessions, maxSessions) {
5305
+ if (sessions.length <= maxSessions) {
5306
+ return [];
5307
+ }
5308
+ const sorted = sessions.sort((a, b) => a[1].startedAt.localeCompare(b[1].startedAt));
5309
+ const toRemove = sorted.slice(0, sessions.length - maxSessions);
5310
+ return toRemove.map(([sessionId]) => sessionId);
5311
+ }
5312
+ function calculateTokenCost(tokens, ratePerThousand) {
5313
+ return tokens.totalTokens / 1e3 * ratePerThousand;
5314
+ }
5315
+
5183
5316
  // src/pipeline/v1-adapters.ts
5184
5317
  import { randomUUID } from "crypto";
5185
5318
  function analysisToTaskContract(description, analysis) {
@@ -5393,71 +5526,315 @@ function normalizeCli(cli) {
5393
5526
  }
5394
5527
 
5395
5528
  // src/pipeline/trace-schema.ts
5396
- import { z as z15 } from "zod";
5397
- var ExecutionTraceEntrySchema = z15.object({
5529
+ import { z as z16 } from "zod";
5530
+ var ExecutionTraceEntrySchema = z16.object({
5398
5531
  /** Unix timestamp (ms). */
5399
- timestamp: z15.number(),
5532
+ timestamp: z16.number(),
5400
5533
  /** Run identifier (typically TaskContract.id). */
5401
- runId: z15.string().min(1),
5534
+ runId: z16.string().min(1),
5402
5535
  /** Pipeline event type that produced this trace entry. */
5403
- eventType: z15.string().min(1),
5536
+ eventType: z16.string().min(1),
5404
5537
  /** Execution ID for pipeline correlation. */
5405
- executionId: z15.string().optional(),
5538
+ executionId: z16.string().optional(),
5406
5539
  /** Graph node or stage that produced this event. */
5407
- nodeId: z15.string().optional(),
5540
+ nodeId: z16.string().optional(),
5408
5541
  /** Agent that executed this step. */
5409
- agentId: z15.string().optional(),
5542
+ agentId: z16.string().optional(),
5410
5543
  /** Model used for this step. */
5411
- modelId: z15.string().optional(),
5544
+ modelId: z16.string().optional(),
5412
5545
  /** Agent role (e.g., code_expert, security_expert). */
5413
- role: z15.string().optional(),
5546
+ role: z16.string().optional(),
5414
5547
  /** Duration in milliseconds. */
5415
- durationMs: z15.number().optional(),
5548
+ durationMs: z16.number().optional(),
5416
5549
  /** Human-readable model selection reasoning. */
5417
- reasoning: z15.string().optional(),
5550
+ reasoning: z16.string().optional(),
5418
5551
  /** Routing decision path (stage:result pairs). */
5419
- decisionPath: z15.array(z15.string()).optional(),
5552
+ decisionPath: z16.array(z16.string()).optional(),
5420
5553
  /** Error classification. */
5421
- errorTaxonomy: z15.enum(["retriable", "fatal"]).optional(),
5554
+ errorTaxonomy: z16.enum(["retriable", "fatal"]).optional(),
5422
5555
  /** Error message if this is a failure event. */
5423
- error: z15.string().optional(),
5556
+ error: z16.string().optional(),
5424
5557
  /** Wave number (1-based) for wave dispatch events. */
5425
- waveNumber: z15.number().optional(),
5558
+ waveNumber: z16.number().optional(),
5426
5559
  /** Total waves in the dispatch plan. */
5427
- totalWaves: z15.number().optional(),
5560
+ totalWaves: z16.number().optional(),
5428
5561
  /** Number of workers in this wave. */
5429
- workerCount: z15.number().optional()
5562
+ workerCount: z16.number().optional()
5430
5563
  });
5431
5564
 
5432
- // src/scm/factory.ts
5433
- async function createScmProvider(config) {
5434
- const platform = config.platform ?? "github";
5435
- const explicitToken = config.token?.token;
5436
- const explicitEnvVar = config.token?.envVar;
5437
- const tokenResult = await resolveToken({
5438
- platform,
5439
- ...explicitToken !== void 0 ? { token: explicitToken } : {},
5440
- ...explicitEnvVar !== void 0 ? { envVar: explicitEnvVar } : {}
5441
- });
5442
- if (!tokenResult.ok) {
5443
- }
5444
- switch (platform) {
5445
- case "github":
5446
- return ok(new GitHubProvider(config.repo));
5447
- case "gitlab":
5448
- return err(new ScmError("GitLab provider not yet implemented", "gitlab"));
5449
- case "gitea":
5450
- return err(new ScmError("Gitea provider not yet implemented", "gitea"));
5451
- default:
5452
- return err(new ScmError(`Unsupported platform: ${String(platform)}`, platform));
5565
+ // src/security/quality-gate-types.ts
5566
+ import { z as z17 } from "zod";
5567
+ var PipelineStageSchema = z17.enum([
5568
+ "research",
5569
+ "plan",
5570
+ "vote",
5571
+ "implement",
5572
+ "scan",
5573
+ "qa",
5574
+ "ship"
5575
+ ]);
5576
+ var GateVerdictSchema = z17.enum(["pass", "fail", "skip"]);
5577
+ var GateCheckResultSchema = z17.object({
5578
+ /** Name of the check (e.g., 'tests_pass', 'lint_clean'). */
5579
+ name: z17.string().min(1),
5580
+ /** Pass/fail/skip verdict. */
5581
+ verdict: GateVerdictSchema,
5582
+ /** Human-readable details. */
5583
+ details: z17.string().max(500),
5584
+ /** Duration of the check in ms. */
5585
+ durationMs: z17.number().nonnegative().optional()
5586
+ });
5587
+
5588
+ // src/pipeline/quality-pipeline.ts
5589
+ var logger5 = createLogger({ component: "quality-pipeline" });
5590
+
5591
+ // src/pipeline/research-trigger.ts
5592
+ var logger6 = createLogger({ component: "research-trigger" });
5593
+ var DEFAULT_QUALITY_THRESHOLD = 7;
5594
+ var DEFAULT_MAX_TRIGGERS = 3;
5595
+ function parseDiscoveries(text) {
5596
+ const items = [];
5597
+ const lines = text.split("\n");
5598
+ for (const line of lines) {
5599
+ const match = /(?:quality|score)[:\s]*(\d+(?:\.\d+)?)/i.exec(line);
5600
+ if (match !== null) {
5601
+ const quality = parseFloat(match[1]);
5602
+ const title = line.replace(match[0], "").replace(/\(\s*\)/g, "").replace(/^[-*•\s]+/, "").trim();
5603
+ if (title.length > 5) {
5604
+ items.push({ title, quality, source: "research_discover" });
5605
+ }
5606
+ }
5607
+ }
5608
+ return items;
5609
+ }
5610
+ function titleToId(title) {
5611
+ return `research-${title.toLowerCase().replace(/[^a-z0-9]+/g, "-").slice(0, 50)}`;
5612
+ }
5613
+ async function checkForResearchTriggers(config = {}) {
5614
+ const threshold = config.qualityThreshold ?? DEFAULT_QUALITY_THRESHOLD;
5615
+ const maxTriggers = config.maxTriggers ?? DEFAULT_MAX_TRIGGERS;
5616
+ const existing = config.existingTaskIds ?? /* @__PURE__ */ new Set();
5617
+ const topic = config.topic ?? "multi-agent orchestration";
5618
+ try {
5619
+ const result = await executeExpert(
5620
+ "research",
5621
+ `Use research_discover to find recent papers and repos about "${topic}". For each result, include: title, quality score (1-10), and source URL.`
5622
+ );
5623
+ if (!result.success) {
5624
+ logger6.debug("Research trigger: expert unavailable", { error: result.error });
5625
+ return [];
5626
+ }
5627
+ const discoveries = parseDiscoveries(result.text);
5628
+ const qualified = discoveries.filter((d) => d.quality >= threshold).filter((d) => !existing.has(titleToId(d.title)));
5629
+ const tasks = qualified.slice(0, maxTriggers).map((d) => ({
5630
+ id: titleToId(d.title),
5631
+ title: `Assess research: ${d.title}`,
5632
+ description: `Auto-triggered by research_discover (quality: ${String(d.quality)}/10).
5633
+ Source: ${d.source}
5634
+
5635
+ Assess this research for applicability to nexus-agents.`,
5636
+ assignedTo: "researcher",
5637
+ status: "pending"
5638
+ }));
5639
+ if (tasks.length > 0) {
5640
+ logger6.info("Research triggers created", {
5641
+ total: discoveries.length,
5642
+ qualified: qualified.length,
5643
+ triggered: tasks.length
5644
+ });
5645
+ }
5646
+ return tasks;
5647
+ } catch (error) {
5648
+ logger6.debug("Research trigger failed gracefully", { error: String(error) });
5649
+ return [];
5650
+ }
5651
+ }
5652
+
5653
+ // src/pipeline/research-pipeline.ts
5654
+ var logger7 = createLogger({ component: "research-pipeline" });
5655
+
5656
+ // src/pipeline/iterative-consensus.ts
5657
+ var defaultLogger = createLogger({ component: "iterative-consensus" });
5658
+ var DEFAULT_MAX_ITERATIONS = 3;
5659
+ var DEFAULT_MAX_PROPOSAL_LENGTH = 4e3;
5660
+ var DEFAULT_STRATEGY = "higher_order";
5661
+ var DEFAULT_PREFIX = "pipeline";
5662
+ async function runOneIteration(state, iteration) {
5663
+ state.log.info("Consensus iteration", { iteration });
5664
+ emitPipelineStageEvent(state.prefix, "vote", "started");
5665
+ state.lastVote = await executeSingleVote(state.plan, state.config, state.log);
5666
+ const iterMs = getTimeProvider().now() - state.globalStart;
5667
+ const status = isVoteAccepted(state.lastVote) ? "completed" : "failed";
5668
+ emitPipelineStageEvent(state.prefix, "vote", status, { durationMs: iterMs });
5669
+ if (isVoteAccepted(state.lastVote)) {
5670
+ return { vote: state.lastVote, iterations: iteration, durationMs: iterMs };
5671
+ }
5672
+ return void 0;
5673
+ }
5674
+ async function runIterativeConsensus(initialPlan, revisePlan, config) {
5675
+ const maxIter = config?.maxIterations ?? DEFAULT_MAX_ITERATIONS;
5676
+ const state = {
5677
+ plan: initialPlan,
5678
+ lastVote: void 0,
5679
+ config,
5680
+ log: config?.logger ?? defaultLogger,
5681
+ prefix: config?.pipelinePrefix ?? DEFAULT_PREFIX,
5682
+ globalStart: getTimeProvider().now()
5683
+ };
5684
+ for (let i = 0; i < maxIter; i++) {
5685
+ const accepted = await runOneIteration(state, i + 1);
5686
+ if (accepted !== void 0) return accepted;
5687
+ await maybeRevise(state, i, maxIter, revisePlan);
5688
+ }
5689
+ return buildExhaustedResult(state, maxIter);
5690
+ }
5691
+ function isVoteAccepted(vote) {
5692
+ return vote.kind === "approved" || vote.kind === "conditional_go";
5693
+ }
5694
+ function extractFeedback(vote) {
5695
+ if (vote === void 0) return "";
5696
+ return vote.kind === "rejected" ? vote.feedback : "";
5697
+ }
5698
+ async function maybeRevise(state, iteration, maxIter, revisePlan) {
5699
+ if (iteration >= maxIter - 1) return;
5700
+ state.log.info("Vote rejected, revising plan", { iteration: iteration + 1 });
5701
+ state.plan = await revisePlan(state.plan, extractFeedback(state.lastVote));
5702
+ }
5703
+ function buildExhaustedResult(state, maxIter) {
5704
+ const totalMs = getTimeProvider().now() - state.globalStart;
5705
+ const fallback = {
5706
+ kind: "rejected",
5707
+ feedback: "No votes executed",
5708
+ approvalPercentage: 0
5709
+ };
5710
+ return { vote: state.lastVote ?? fallback, iterations: maxIter, durationMs: totalMs };
5711
+ }
5712
+ function buildVotingInput(plan, config) {
5713
+ const maxLen = config?.maxProposalLength ?? DEFAULT_MAX_PROPOSAL_LENGTH;
5714
+ return {
5715
+ proposal: plan.slice(0, maxLen),
5716
+ strategy: config?.strategy ?? DEFAULT_STRATEGY,
5717
+ simulateVotes: config?.simulateVotes ?? false,
5718
+ quickMode: config?.quickMode ?? false
5719
+ };
5720
+ }
5721
+ async function executeSingleVote(plan, config, log) {
5722
+ try {
5723
+ const { executeVoting } = await import("./consensus-vote-757YULIP.js");
5724
+ const input = buildVotingInput(plan, config);
5725
+ const result = await executeVoting(input, log);
5726
+ return parseVotingResult(result);
5727
+ } catch (error) {
5728
+ const msg = error instanceof Error ? error.message : String(error);
5729
+ log.warn("Vote execution failed, auto-approving", { error: msg });
5730
+ return { kind: "approved", approvalPercentage: 0 };
5453
5731
  }
5454
5732
  }
5455
- function createGitHubProvider(repo) {
5456
- return new GitHubProvider(repo);
5733
+ function parseVotingResult(result) {
5734
+ const approved = result.result.outcome === "approved";
5735
+ const total = Math.max(1, result.result.voteCounts.approve + result.result.voteCounts.reject);
5736
+ const pct = result.result.voteCounts.approve / total * 100;
5737
+ if (approved) {
5738
+ return { kind: "approved", approvalPercentage: pct };
5739
+ }
5740
+ const feedback = result.votes.filter((v) => v.vote.decision !== "approve").map((v) => v.vote.reasoning).join("\n");
5741
+ return { kind: "rejected", feedback, approvalPercentage: pct };
5742
+ }
5743
+
5744
+ // src/pipeline/incomplete-result.ts
5745
+ function isIncompleteResult(value) {
5746
+ if (typeof value !== "object" || value === null) return false;
5747
+ const obj = value;
5748
+ return typeof obj["stageId"] === "string" && typeof obj["severity"] === "string" && typeof obj["justification"] === "string" && typeof obj["canProceed"] === "boolean" && Array.isArray(obj["missing"]);
5749
+ }
5750
+ function createIncompleteResult(stageId, partialOutput, missing, severity, justification) {
5751
+ return {
5752
+ stageId,
5753
+ partialOutput,
5754
+ missing,
5755
+ severity,
5756
+ justification,
5757
+ canProceed: severity !== "critical"
5758
+ };
5759
+ }
5760
+ function canPipelineProceed(results) {
5761
+ return results.every((r) => r.canProceed);
5457
5762
  }
5763
+ function filterBySeverity(results, minSeverity) {
5764
+ const severityOrder = {
5765
+ info: 0,
5766
+ warning: 1,
5767
+ error: 2,
5768
+ critical: 3
5769
+ };
5770
+ const threshold = severityOrder[minSeverity];
5771
+ return results.filter((r) => severityOrder[r.severity] >= threshold);
5772
+ }
5773
+
5774
+ // src/pipeline/dynamic-expert.ts
5775
+ var logger8 = createLogger({ component: "dynamic-expert" });
5776
+ var MAX_DYNAMIC_EXPERTS = 2;
5777
+ var DynamicExpertManager = class {
5778
+ experts = [];
5779
+ maxExperts;
5780
+ constructor(maxExperts = MAX_DYNAMIC_EXPERTS) {
5781
+ this.maxExperts = maxExperts;
5782
+ }
5783
+ /** Create a new dynamic expert. Returns null if limit reached. */
5784
+ create(spec) {
5785
+ if (this.experts.length >= this.maxExperts) {
5786
+ logger8.warn("Dynamic expert limit reached", {
5787
+ limit: this.maxExperts,
5788
+ requested: spec.id
5789
+ });
5790
+ return null;
5791
+ }
5792
+ if (spec.id.trim() === "" || spec.name.trim() === "") {
5793
+ logger8.warn("Invalid dynamic expert spec", { id: spec.id });
5794
+ return null;
5795
+ }
5796
+ if (this.experts.some((e) => e.spec.id === spec.id)) {
5797
+ logger8.warn("Duplicate dynamic expert ID", { id: spec.id });
5798
+ return null;
5799
+ }
5800
+ const expert = {
5801
+ spec,
5802
+ createdAt: Date.now(),
5803
+ promoted: false
5804
+ };
5805
+ this.experts.push(expert);
5806
+ logger8.info("Dynamic expert created", {
5807
+ id: spec.id,
5808
+ name: spec.name,
5809
+ total: this.experts.length,
5810
+ max: this.maxExperts
5811
+ });
5812
+ return expert;
5813
+ }
5814
+ /** Get all created experts. */
5815
+ list() {
5816
+ return [...this.experts];
5817
+ }
5818
+ /** Get an expert by ID. */
5819
+ get(id) {
5820
+ return this.experts.find((e) => e.spec.id === id);
5821
+ }
5822
+ /** How many more experts can be created. */
5823
+ get remaining() {
5824
+ return Math.max(0, this.maxExperts - this.experts.length);
5825
+ }
5826
+ /** Whether the limit has been reached. */
5827
+ get atLimit() {
5828
+ return this.experts.length >= this.maxExperts;
5829
+ }
5830
+ };
5831
+
5832
+ // src/replay/replay-executor.ts
5833
+ var logger9 = createLogger({ component: "ReplayExecutor" });
5458
5834
  export {
5459
5835
  ALLOWED_COMMANDS,
5460
5836
  ARTIFACT_TYPES,
5837
+ AUDIT_PIPELINE_TEMPLATE,
5461
5838
  AbTestTracker,
5462
5839
  ActivationStrategySchema,
5463
5840
  AdapterConfigSchema,
@@ -5474,7 +5851,6 @@ export {
5474
5851
  AgentRoleSchema3 as AgentRoleSchema,
5475
5852
  AgentRunnerError,
5476
5853
  AgentStateMachine,
5477
- AgentStateSchema,
5478
5854
  StepExecutor as AgentStepExecutor,
5479
5855
  AnalysisError,
5480
5856
  AppConfigSchema,
@@ -5604,6 +5980,7 @@ export {
5604
5980
  DEFAULT_VOTING_PROTOCOL_CONFIG,
5605
5981
  DEFAULT_WAVE_CONFIG,
5606
5982
  DEFAULT_WEIGHTED_VOTING_CONFIG,
5983
+ DEV_PIPELINE_TEMPLATE,
5607
5984
  DagEdgeSchema,
5608
5985
  Dashboard,
5609
5986
  DashboardConfigSchema,
@@ -5615,6 +5992,7 @@ export {
5615
5992
  DependencyGraph,
5616
5993
  DirectedInteractionGraph,
5617
5994
  DocumentationExpert,
5995
+ DynamicExpertManager,
5618
5996
  END,
5619
5997
  EXPERT_CAPABILITIES,
5620
5998
  EXPERT_DEFAULT_CAPABILITIES,
@@ -5643,6 +6021,7 @@ export {
5643
6021
  ExpertRegistry,
5644
6022
  ExplorationEventSchema,
5645
6023
  ExplorationEventTypeSchema,
6024
+ ExtractSymbolsInputSchema,
5646
6025
  FALLBACK_SCANNER_DATA,
5647
6026
  FactoryError,
5648
6027
  FailurePatternSchema,
@@ -5659,6 +6038,7 @@ export {
5659
6038
  ForestStatisticsSchema,
5660
6039
  GEMINI_MODELS,
5661
6040
  GEMINI_MODEL_ALIASES,
6041
+ GENERAL_PIPELINE_TEMPLATE,
5662
6042
  GeminiAdapter,
5663
6043
  GeminiCliAdapter,
5664
6044
  GeminiResponseParser,
@@ -5687,8 +6067,8 @@ export {
5687
6067
  InjectionFlagSchema,
5688
6068
  InputDefinitionSchema2 as InputDefinitionSchema,
5689
6069
  InputTypeSchema,
5690
- SwarmObserverConfigSchema2 as InteractionObserverConfigSchema,
5691
- SwarmObserver2 as InteractionSwarmObserver,
6070
+ SwarmObserverConfigSchema as InteractionObserverConfigSchema,
6071
+ SwarmObserver as InteractionSwarmObserver,
5692
6072
  IssueReferenceSchema,
5693
6073
  IssueTriageInputSchema,
5694
6074
  JsonDashboardRenderer,
@@ -5699,10 +6079,14 @@ export {
5699
6079
  LockedWriter,
5700
6080
  LoggingConfigSchema,
5701
6081
  MANIPULATION_CATEGORY,
6082
+ MAX_DYNAMIC_EXPERTS,
5702
6083
  MAX_EXECUTION_TIME_MS,
5703
6084
  MIN_EXPERTS_FOR_PATTERN,
5704
6085
  MODEL_CAPABILITIES,
5705
6086
  RateLimiter as McpRateLimiter,
6087
+ MemoryQueryInputSchema,
6088
+ MemoryStatsInputSchema,
6089
+ MemoryWriteInputSchema,
5706
6090
  ModelCapability,
5707
6091
  ModelConfigSchema,
5708
6092
  ModelError,
@@ -5718,15 +6102,12 @@ export {
5718
6102
  OPENAI_MODELS,
5719
6103
  OPENAI_MODEL_ALIASES,
5720
6104
  OWVoting,
5721
- ObserverTopics,
5722
6105
  OllamaAdapter,
5723
6106
  OpenAIAdapter,
5724
6107
  OpenCodeCliAdapter,
5725
6108
  OrchestrateInputSchema,
5726
6109
  OrchestrateOutputSchema,
5727
6110
  OrchestrationError,
5728
- OrchestrationObserver,
5729
- OrchestrationObserverConfigSchema,
5730
6111
  OrchestrationUnavailableError,
5731
6112
  Orchestrator,
5732
6113
  OrchestratorError,
@@ -5739,6 +6120,8 @@ export {
5739
6120
  OutcomeStore,
5740
6121
  TaskOutcomeSchema as OutcomeTaskSchema,
5741
6122
  PIPELINE_EVENT_TYPES,
6123
+ PIPELINE_STATE_KEYS,
6124
+ PIPELINE_TEMPLATES,
5742
6125
  PLUGIN_TRUST_LEVELS,
5743
6126
  PRIVACY_CATEGORY,
5744
6127
  PROMPT_DEFINITIONS,
@@ -5773,8 +6156,10 @@ export {
5773
6156
  PruningStrategy,
5774
6157
  QualitySignalsSchema,
5775
6158
  QueryFeatureExtractor,
6159
+ QueryTraceInputSchema,
5776
6160
  REJECTION_CATEGORIES,
5777
6161
  REPO_COMPLEXITY,
6162
+ RESEARCH_PIPELINE_TEMPLATE,
5778
6163
  RISK_AWARENESS_CATEGORY,
5779
6164
  ROBUSTNESS_CATEGORY,
5780
6165
  ROLE_DEFAULT_TRUST,
@@ -5785,18 +6170,20 @@ export {
5785
6170
  ReasoningStepTypeSchema,
5786
6171
  ReasoningTreeSchema,
5787
6172
  RegistryError,
6173
+ RegistryImportInputSchema,
5788
6174
  RejectionCategorySchema,
5789
6175
  RepoAnalyzeInputSchema,
5790
6176
  RepoSecurityPlanInputSchema,
5791
6177
  ReportGenerationError,
5792
6178
  ReportGenerator,
5793
6179
  ReputationCache,
5794
- RestApiConfigSchema,
5795
- RestApiServer,
5796
- DelegateRequestSchema as RestDelegateRequestSchema,
5797
- ExpertRequestSchema as RestExpertRequestSchema,
5798
- OrchestrateRequestSchema as RestOrchestrateRequestSchema,
5799
- WorkflowRequestSchema as RestWorkflowRequestSchema,
6180
+ ResearchAddInputSchema,
6181
+ ResearchAddSourceInputSchema,
6182
+ ResearchAnalyzeInputSchema,
6183
+ ResearchCatalogReviewInputSchema,
6184
+ ResearchDiscoverInputSchema,
6185
+ ResearchQueryInputSchema,
6186
+ ResearchSynthesizeInputSchema,
5800
6187
  ResultAggregator,
5801
6188
  RetryExhaustedError,
5802
6189
  ReviewProtocol,
@@ -5830,6 +6217,7 @@ export {
5830
6217
  ScmError,
5831
6218
  ScoreBreakdownSchema,
5832
6219
  SdkAdapter,
6220
+ SearchCodebaseInputSchema,
5833
6221
  SecurityConfigSchema,
5834
6222
  SecurityError,
5835
6223
  SecurityErrorCodeSchema,
@@ -5841,6 +6229,7 @@ export {
5841
6229
  SessionStatusSchema,
5842
6230
  SharedConclusionSchema,
5843
6231
  SharedInsightSchema,
6232
+ SharedMemoryStore,
5844
6233
  SimpleAgent,
5845
6234
  SimpleMajorityStrategy,
5846
6235
  AgentRoleSchema as SkillAgentRoleSchema,
@@ -5878,8 +6267,6 @@ export {
5878
6267
  SubtaskTypeSchema,
5879
6268
  SupermajorityStrategy,
5880
6269
  SuspiciousSignalSchema,
5881
- SwarmObserver,
5882
- SwarmObserverConfigSchema,
5883
6270
  SynthesizedResultSchema,
5884
6271
  TASK_STATUSES,
5885
6272
  TASK_TYPE_EXPERTS,
@@ -5939,6 +6326,7 @@ export {
5939
6326
  VulnerabilitySchema,
5940
6327
  VulnerabilitySeveritySchema,
5941
6328
  WaveScheduler,
6329
+ WeatherReportInputSchema,
5942
6330
  WeightedVoting,
5943
6331
  WorkflowConfigSchema,
5944
6332
  WorkflowDefinitionSchema2 as WorkflowDefinitionSchema,
@@ -5984,20 +6372,28 @@ export {
5984
6372
  canApplyPatch,
5985
6373
  canExecuteSkill,
5986
6374
  canInfluenceDecisions,
6375
+ canPipelineProceed,
5987
6376
  canProceed,
5988
6377
  cancelExecution,
5989
6378
  categorizeOutcomeError,
5990
6379
  categorizeOutcomeErrorMessage,
6380
+ checkForResearchTriggers,
5991
6381
  checkPermissionBoundary,
5992
6382
  checkPipelinePolicy,
6383
+ checkpointToResult,
5993
6384
  chunkByDirectory,
6385
+ classifyTask,
5994
6386
  classifyTrust,
6387
+ cleanupCheckpoint,
5995
6388
  clearRegistryCache,
5996
6389
  clearTemplateCache,
6390
+ calculateBackoffDelay as cliCalculateBackoffDelay,
6391
+ categorizeError as cliCategorizeError,
5997
6392
  closeServer,
5998
6393
  collectRealVotes,
5999
6394
  collectStream,
6000
6395
  compareProportions,
6396
+ compilePipelineGraph,
6001
6397
  compilePlan,
6002
6398
  compileSpecToGraph,
6003
6399
  computeAdaptiveThresholds,
@@ -6008,6 +6404,7 @@ export {
6008
6404
  countActiveSessions,
6009
6405
  createAbTestTracker,
6010
6406
  createAgentPairKey,
6407
+ createAgentStages,
6011
6408
  createStepExecutor as createAgentStepExecutor,
6012
6409
  createAllAdapters,
6013
6410
  createArchitectureExpert,
@@ -6038,6 +6435,7 @@ export {
6038
6435
  createDefaultRegistry,
6039
6436
  createDelegatePipeline,
6040
6437
  createDependencyError,
6438
+ createDevStageRegistry,
6041
6439
  createDocumentationExpert,
6042
6440
  createDryRunHandler,
6043
6441
  createEmptyContext,
@@ -6056,6 +6454,7 @@ export {
6056
6454
  createGraphAuditBridge,
6057
6455
  createHarnessExecutor,
6058
6456
  createHigherOrderVotingStrategy,
6457
+ createIncompleteResult,
6059
6458
  createInitialCostMetrics,
6060
6459
  createInitialProgress,
6061
6460
  createInitialSessionMetrics,
@@ -6063,7 +6462,7 @@ export {
6063
6462
  createInitializedWorkflowEngine,
6064
6463
  createInstancePrompt,
6065
6464
  createInteractionGraph,
6066
- createSwarmObserver2 as createInteractionSwarmObserver,
6465
+ createSwarmObserver as createInteractionSwarmObserver,
6067
6466
  createIsolatedRegistry,
6068
6467
  createLogger,
6069
6468
  createMcpLogger,
@@ -6073,7 +6472,6 @@ export {
6073
6472
  createOWVoting,
6074
6473
  createOllamaAdapter,
6075
6474
  createOpenAIAdapter,
6076
- createOrchestrationObserver,
6077
6475
  createOrchestrator,
6078
6476
  createOrchestratorFactory,
6079
6477
  createOutcomeFeedbackCollector,
@@ -6088,7 +6486,6 @@ export {
6088
6486
  createRateLimiter,
6089
6487
  createRealWorkflowEngine,
6090
6488
  createReportGenerator,
6091
- createRestApiServer,
6092
6489
  createResultAggregator,
6093
6490
  createRetryPrompt,
6094
6491
  createRoutingDecision,
@@ -6110,7 +6507,6 @@ export {
6110
6507
  createStrategyFactory,
6111
6508
  createStream,
6112
6509
  createSummaryPrompt,
6113
- createSwarmObserver,
6114
6510
  createTaskOutcome,
6115
6511
  createTaskQueue,
6116
6512
  createTemplateRegistry,
@@ -6149,9 +6545,13 @@ export {
6149
6545
  emitGraphExecutionEvent,
6150
6546
  emitNodeResults,
6151
6547
  emitNodeStarted,
6548
+ emitPipelineStageEvent,
6152
6549
  emitPolicyEvent,
6153
6550
  emitReputationEvent,
6154
6551
  emitSanitizationEvent,
6552
+ emitStageCompleted,
6553
+ emitStageFailed,
6554
+ emitStageStarted,
6155
6555
  emitStateUpdated,
6156
6556
  emitStepCompleted,
6157
6557
  emitThresholdUpdate,
@@ -6165,7 +6565,9 @@ export {
6165
6565
  evaluatePolicy,
6166
6566
  evaluatePredictions,
6167
6567
  evaluatePolicy3 as evaluateSecurityPolicy,
6568
+ executeCliRetryLoop,
6168
6569
  executeDelegatePipeline,
6570
+ executeExpert,
6169
6571
  executeGraph,
6170
6572
  executeHarness,
6171
6573
  executeInDocker,
@@ -6186,14 +6588,17 @@ export {
6186
6588
  extractRepoFromInstanceId,
6187
6589
  extractRepoName,
6188
6590
  extractSessionId,
6591
+ extractStateValue,
6189
6592
  extractStringArrayField,
6190
6593
  extractStringField,
6191
6594
  filterAvailableModels,
6192
6595
  filterByRepo,
6596
+ filterBySeverity,
6193
6597
  filterByVersion,
6194
6598
  filterStream,
6195
6599
  findActiveSession,
6196
6600
  findMissingDependencies,
6601
+ flushPipelineMemory,
6197
6602
  formatCompileError,
6198
6603
  formatContextForPrompt,
6199
6604
  formatValidationResult,
@@ -6249,6 +6654,7 @@ export {
6249
6654
  getStepResult,
6250
6655
  getSwarmObserver,
6251
6656
  getSwebenchVersion,
6657
+ getTemplate,
6252
6658
  getTestCasesByTags,
6253
6659
  getTimeoutForTask,
6254
6660
  getTimeoutForTaskAuto,
@@ -6264,15 +6670,19 @@ export {
6264
6670
  initializeEventBusBridge,
6265
6671
  isCancelled,
6266
6672
  isCliAvailable,
6673
+ isRetryableError as isCliRetryableError,
6267
6674
  isErr,
6675
+ isIncompleteResult,
6268
6676
  isMutatingAction,
6269
6677
  isOk,
6270
6678
  isReadOnlyAction,
6271
- isRetryableError,
6679
+ isRetryableError2 as isRetryableError,
6272
6680
  isCliAvailable2 as isSWEBenchCliAvailable,
6273
6681
  isStepCompleted,
6274
6682
  isZodError,
6275
6683
  listInstances,
6684
+ listTemplateIds,
6685
+ loadCheckpointState,
6276
6686
  loadDataset,
6277
6687
  loadTemplateFile,
6278
6688
  loadTemplatesFromDirectory,
@@ -6321,19 +6731,34 @@ export {
6321
6731
  registerExecuteExpertTool,
6322
6732
  registerExecuteSpecTool,
6323
6733
  registerExpertsResource,
6734
+ registerExtractSymbolsTool,
6324
6735
  registerIssueTriageTool,
6325
6736
  registerListExpertsTool,
6326
6737
  registerListWorkflowsTool,
6738
+ registerMemoryQueryTool,
6739
+ registerMemoryStatsTool,
6740
+ registerMemoryWriteTool,
6327
6741
  registerModelsResource,
6328
6742
  registerOrchestrateTool,
6329
6743
  registerPrompts,
6744
+ registerQueryTraceTool,
6745
+ registerRegistryImportTool,
6330
6746
  registerRepoAnalyzeTool,
6331
6747
  registerRepoSecurityPlanTool,
6748
+ registerResearchAddSourceTool,
6749
+ registerResearchAddTool,
6750
+ registerResearchAnalyzeTool,
6751
+ registerResearchCatalogReviewTool,
6752
+ registerResearchDiscoverTool,
6753
+ registerResearchQueryTool,
6332
6754
  registerResearchResource,
6755
+ registerResearchSynthesizeTool,
6333
6756
  registerResources,
6334
6757
  registerRunGraphWorkflowTool,
6335
6758
  registerRunWorkflowTool,
6759
+ registerSearchCodebaseTool,
6336
6760
  registerTools,
6761
+ registerWeatherReportTool,
6337
6762
  requiresCitation,
6338
6763
  requiresCorroboration,
6339
6764
  resetAvailabilityCache,
@@ -6349,9 +6774,13 @@ export {
6349
6774
  resolveV2Config,
6350
6775
  resolveWithFallbacks,
6351
6776
  resultToOutcome,
6777
+ runAdaptiveOrchestrator,
6352
6778
  runAgentOnInstance,
6353
6779
  runBenchmarkInstances,
6354
6780
  runBenchmarkParallel,
6781
+ runDevPipeline,
6782
+ runGraphPipeline,
6783
+ runIterativeConsensus,
6355
6784
  runPreconditions,
6356
6785
  runSingleInstance,
6357
6786
  runTests,
@@ -6360,6 +6789,7 @@ export {
6360
6789
  safeValidateExpertConfig,
6361
6790
  sanitize,
6362
6791
  sanitizeInput,
6792
+ saveStageCheckpoint,
6363
6793
  scoreByHybrid,
6364
6794
  scoreByImportance,
6365
6795
  scoreByRecency,