@synergenius/flow-weaver-pack-weaver 0.9.180 → 0.9.182

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.
@@ -3,7 +3,7 @@ import { callPlatformWithMessages, callCapabilityTriage } from '../bot/ai-client
3
3
  import type { AiTool, AiCallResult, ChatMessage } from '../bot/ai-client.js';
4
4
  import { auditEmit } from '../bot/audit-logger.js';
5
5
  import { executeStep } from '../bot/step-executor.js';
6
- import { getCapabilitiesByNames, BUILT_IN_CAPABILITIES } from '../bot/capability-registry.js';
6
+ import { getCapabilitiesByNames, BUILT_IN_CAPABILITIES, PROFILE_CAPABILITIES } from '../bot/capability-registry.js';
7
7
 
8
8
  // ---------------------------------------------------------------------------
9
9
  // Tool definitions — built dynamically from capability-granted operations
@@ -168,16 +168,20 @@ export async function weaverPlanTask(
168
168
  }
169
169
  const task = JSON.parse(context.taskJson);
170
170
 
171
- // Resolve available capabilities from behavior config or defaults
171
+ // Resolve available capabilities: profile pool > behavior config > all defaults
172
172
  const behavior = context.behaviorJson ? JSON.parse(context.behaviorJson) : undefined;
173
- const availableCapNames: string[] = behavior?.capabilities ?? BUILT_IN_CAPABILITIES.map(c => c.name);
173
+ const profilePool = task.assignedProfile ? PROFILE_CAPABILITIES[task.assignedProfile] : undefined;
174
+ const availableCapNames: string[] = profilePool ?? behavior?.capabilities ?? BUILT_IN_CAPABILITIES.map(c => c.name);
174
175
  const availableCaps = getCapabilitiesByNames(availableCapNames);
175
176
 
176
- // Capability triage: cheap Haiku call selects which capabilities this task needs
177
+ // Capability triage: only run when using the default (all) pool.
178
+ // Profile pools are already scoped — triage would just add latency + cost.
177
179
  let selectedCaps = availableCaps;
178
- const triageResult = await callCapabilityTriage(pInfo, task.instruction, availableCaps);
179
- if (triageResult) {
180
- selectedCaps = getCapabilitiesByNames(triageResult);
180
+ if (!profilePool) {
181
+ const triageResult = await callCapabilityTriage(pInfo, task.instruction, availableCaps);
182
+ if (triageResult) {
183
+ selectedCaps = getCapabilitiesByNames(triageResult);
184
+ }
181
185
  }
182
186
 
183
187
  // Build system prompt from capabilities
@@ -195,20 +199,14 @@ export async function weaverPlanTask(
195
199
  }
196
200
 
197
201
  // Build tool definitions from capability-granted operations
198
- // Only orchestrators get task_create — workers must execute, not delegate.
199
- const isOrchestrator = availableCapNames.includes('role-orchestrator') ||
200
- availableCapNames.includes('decomposition') ||
201
- (behavior?.role === 'orchestrator');
202
202
  let tools: AiTool[];
203
203
  try {
204
204
  const mod2 = await import('../bot/system-prompt.js');
205
- let grantedTools = mod2.collectToolsFromCapabilities(selectedCaps);
206
- if (!isOrchestrator) {
207
- grantedTools = grantedTools.filter((t: string) => t !== 'task_create');
208
- }
205
+ const grantedTools = mod2.collectToolsFromCapabilities(selectedCaps);
209
206
  tools = buildToolDefinitions(grantedTools);
210
207
  } catch (err) {
211
208
  console.warn('[plan-task] capability resolution failed, using worker defaults:', err);
209
+ // Fallback: worker tools only — NO task_create (that's orchestrator-only)
212
210
  tools = buildToolDefinitions(['read_file', 'write_file', 'patch_file', 'run_shell', 'list_files']);
213
211
  }
214
212