@hyperdrive.bot/bmad-workflow 1.0.27 → 1.0.28

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.
@@ -20,21 +20,11 @@ export declare function createAgentRunner(provider: AIProvider, logger: pino.Log
20
20
  export declare function isProviderSupported(provider: string): provider is AIProvider;
21
21
  /**
22
22
  * AgentRunnerFactory — discovery-based runner selection
23
- *
24
- * When `config.useChannels` is true, discovers Channel-capable agents via
25
- * `listAgents()` and returns a `ChannelAgentRunner` when a match is found.
26
- * Falls back to the subprocess runner otherwise.
27
23
  */
28
24
  export declare class AgentRunnerFactory {
29
25
  private readonly callbacks?;
30
26
  private readonly logger;
31
27
  constructor(logger: pino.Logger, callbacks?: WorkflowCallbacks);
32
- /**
33
- * Create an AIProviderRunner for the requested agent type.
34
- */
35
28
  create(agentType: string, config: WorkflowConfig, phaseName?: string): AIProviderRunner;
36
- /**
37
- * Fire onChannelFallback callback with defensive error handling.
38
- */
39
29
  private fireChannelFallback;
40
30
  }
@@ -5,30 +5,11 @@
5
5
  * Includes both the legacy `createAgentRunner()` function and the new
6
6
  * `AgentRunnerFactory` class with Channel transport discovery.
7
7
  */
8
+ import { listAgents } from '@hyperdrive.bot/claude-channels/dist/services/discovery.js';
9
+ import { ChannelAgentRunner } from './channel-agent-runner.js';
8
10
  import { ClaudeAgentRunner } from './claude-agent-runner.js';
9
11
  import { GeminiAgentRunner } from './gemini-agent-runner.js';
10
12
  import { OpenCodeAgentRunner } from './opencode-agent-runner.js';
11
- // claude-channels is an optional file: dependency — not available in CI.
12
- // Lazy-loaded at runtime only when --use-channels is set.
13
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
- let _channelsModule = null;
15
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
- let _channelRunnerModule = null;
17
- function loadChannelsSync() {
18
- if (!_channelsModule) {
19
- // eslint-disable-next-line @typescript-eslint/no-require-imports
20
- _channelsModule = require('@hyperdrive.bot/claude-channels/dist/services/discovery.js');
21
- }
22
- return _channelsModule;
23
- }
24
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
- function loadChannelRunner() {
26
- if (!_channelRunnerModule) {
27
- // eslint-disable-next-line @typescript-eslint/no-require-imports
28
- _channelRunnerModule = require('./channel-agent-runner.js');
29
- }
30
- return _channelRunnerModule;
31
- }
32
13
  /**
33
14
  * Create an AI provider runner for the specified provider
34
15
  */
@@ -56,10 +37,6 @@ export function isProviderSupported(provider) {
56
37
  }
57
38
  /**
58
39
  * AgentRunnerFactory — discovery-based runner selection
59
- *
60
- * When `config.useChannels` is true, discovers Channel-capable agents via
61
- * `listAgents()` and returns a `ChannelAgentRunner` when a match is found.
62
- * Falls back to the subprocess runner otherwise.
63
40
  */
64
41
  export class AgentRunnerFactory {
65
42
  callbacks;
@@ -68,17 +45,13 @@ export class AgentRunnerFactory {
68
45
  this.logger = logger;
69
46
  this.callbacks = callbacks;
70
47
  }
71
- /**
72
- * Create an AIProviderRunner for the requested agent type.
73
- */
74
48
  create(agentType, config, phaseName) {
75
49
  if (!config.useChannels) {
76
50
  return createAgentRunner(config.provider ?? 'claude', this.logger);
77
51
  }
78
52
  let agents;
79
53
  try {
80
- const channels = loadChannelsSync();
81
- agents = channels.listAgents();
54
+ agents = listAgents();
82
55
  }
83
56
  catch (error) {
84
57
  this.logger.warn(`[channel] Discovery failed: ${error.message} — falling back to subprocess`);
@@ -91,24 +64,12 @@ export class AgentRunnerFactory {
91
64
  this.fireChannelFallback(agentType, 'not_discovered', phaseName);
92
65
  return createAgentRunner(config.provider ?? 'claude', this.logger);
93
66
  }
94
- // Select most recently started agent
95
67
  const matched = matches.length === 1
96
68
  ? matches[0]
97
69
  : matches.sort((a, b) => b.startedAt.localeCompare(a.startedAt))[0];
98
70
  this.logger.info({ agentType, sessionId: matched.sessionId, webhookUrl: matched.webhookUrl }, `[channel] Discovered Channel agent for ${agentType}`);
99
- try {
100
- const { ChannelAgentRunner } = loadChannelRunner();
101
- return new ChannelAgentRunner(this.logger, matched.webhookUrl, matched.sessionId, this.callbacks);
102
- }
103
- catch (error) {
104
- this.logger.warn(`[channel] Failed to load ChannelAgentRunner: ${error.message} — falling back`);
105
- this.fireChannelFallback(agentType, 'not_discovered', phaseName);
106
- return createAgentRunner(config.provider ?? 'claude', this.logger);
107
- }
71
+ return new ChannelAgentRunner(this.logger, matched.webhookUrl, matched.sessionId, this.callbacks);
108
72
  }
109
- /**
110
- * Fire onChannelFallback callback with defensive error handling.
111
- */
112
73
  fireChannelFallback(agentType, reason, phaseName) {
113
74
  const callback = this.callbacks?.onChannelFallback;
114
75
  if (!callback)
@@ -5,16 +5,7 @@
5
5
  * and returns results as AgentResult. Used by the factory to delegate work
6
6
  * to persistent, context-preserving Claude Code sessions.
7
7
  */
8
- // Lazy-loaded: @hyperdrive.bot/claude-channels is optional (file: dep, not in CI)
9
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
- let _envelopeFactory = null;
11
- function getEnvelopeFactory() {
12
- if (!_envelopeFactory) {
13
- // eslint-disable-next-line @typescript-eslint/no-require-imports
14
- _envelopeFactory = require('@hyperdrive.bot/claude-channels/dist/envelope/factory.js').EnvelopeFactory;
15
- }
16
- return _envelopeFactory;
17
- }
8
+ import { EnvelopeFactory } from '@hyperdrive.bot/claude-channels/dist/envelope/factory.js';
18
9
  /**
19
10
  * Error thrown when the channel agent endpoint is unreachable (ECONNREFUSED).
20
11
  * The factory uses this signal to trigger subprocess fallback.
@@ -126,7 +117,6 @@ export class ChannelAgentRunner {
126
117
  context.systemPrompt = options.systemPrompt;
127
118
  if (options.model)
128
119
  context.model = options.model;
129
- const EnvelopeFactory = getEnvelopeFactory();
130
120
  const envelope = EnvelopeFactory.createTask('bmad-orchestrator', this.sessionId, prompt, Object.keys(context).length > 0 ? context : undefined);
131
121
  this.logger.debug({ agentType: options.agentType, envelopeId: envelope.id, sessionId: this.sessionId }, 'Sending task envelope to channel agent');
132
122
  const controller = new AbortController();
@@ -9,13 +9,7 @@
9
9
  */
10
10
  import { type ChildProcess, spawn as nodeSpawn } from 'node:child_process';
11
11
  import type pino from 'pino';
12
- type AgentRegistration = {
13
- name: string;
14
- port?: number;
15
- sessionId: string;
16
- startedAt: string;
17
- webhookUrl: string;
18
- };
12
+ import type { AgentRegistration } from '@hyperdrive.bot/claude-channels/dist/types/discovery.js';
19
13
  /**
20
14
  * Handle to a managed agent session
21
15
  */
@@ -123,4 +117,3 @@ export declare class ChannelSessionManager {
123
117
  */
124
118
  static resetSigintFlag(): void;
125
119
  }
126
- export {};
@@ -9,17 +9,7 @@
9
9
  */
10
10
  import { randomUUID } from 'node:crypto';
11
11
  import { spawn as nodeSpawn } from 'node:child_process';
12
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
- let _discoveryModule = null;
14
- function loadDiscovery() {
15
- if (!_discoveryModule) {
16
- // eslint-disable-next-line @typescript-eslint/no-require-imports
17
- _discoveryModule = require('@hyperdrive.bot/claude-channels/dist/services/discovery.js');
18
- }
19
- return _discoveryModule;
20
- }
21
- const defaultListAgents = () => loadDiscovery().listAgents();
22
- const defaultDeregister = (sessionId) => loadDiscovery().deregisterAgent(sessionId);
12
+ import { deregisterAgent as defaultDeregister, listAgents as defaultListAgents } from '@hyperdrive.bot/claude-channels/dist/services/discovery.js';
23
13
  /**
24
14
  * Error thrown when agent session start times out waiting for discovery registration
25
15
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hyperdrive.bot/bmad-workflow",
3
3
  "description": "AI-driven development workflow orchestration CLI for BMAD projects",
4
- "version": "1.0.27",
4
+ "version": "1.0.28",
5
5
  "author": {
6
6
  "name": "DevSquad",
7
7
  "email": "marcelo@devsquad.email",
@@ -14,6 +14,7 @@
14
14
  "url": "https://gitlab.com/dev_squad/repo/cli/bmad-orchestrator/issues"
15
15
  },
16
16
  "dependencies": {
17
+ "@hyperdrive.bot/claude-channels": "^0.1.1",
17
18
  "@hyperdrive.bot/plugin-telemetry": "file:../telemetry-plugin",
18
19
  "@inquirer/prompts": "^8.3.2",
19
20
  "@oclif/core": "^4",
@@ -31,7 +32,6 @@
31
32
  "pino": "^10.0.0",
32
33
  "pino-pretty": "^13.1.2",
33
34
  "uuid": "^13.0.0",
34
- "@hyperdrive.bot/claude-channels": "file:../claude-channels",
35
35
  "zod": "^4.1.12"
36
36
  },
37
37
  "devDependencies": {