@llm-dev-ops/agentics-cli 1.5.72 → 1.5.74

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.
@@ -1 +1 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAUxD,UAAU,WAAW;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAwIrD,CAAC;AAMF,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACtG,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAMD,wBAAsB,wBA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CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,UAAU,EAAE,kBAAkB,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAChC,WAAW,EAAE,KAAK,CAAC;QACjB,MAAM,EAAE,oBAAoB,CAAC;QAC7B,MAAM,EAAE,kBAAkB,GAAG;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC;KAChD,CAAC,CAAC;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,0BAA0B,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE,CAAC;AAwqDrD,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,WAAW,CAAC,CAkhBtB;AAED,wBAAgB,oCAAoC,CAAC,MAAM,EAAE,0BAA0B,GAAG,MAAM,CAY/F;AAED,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,CAwBrF;AAED,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAK5E;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAsBlF"}
@@ -13,6 +13,87 @@ import { loadEndpointConfig } from '../config/endpoints.js';
13
13
  import { createAdapter } from '../adapters/base-adapter.js';
14
14
  import { getAnthropicApiKey } from '../utils/credentials.js';
15
15
  import { executeSimulateCommand } from './simulate.js';
16
+ import { execFileSync } from 'node:child_process';
17
+ // ============================================================================
18
+ // ADR-066: Copilot agents via claude --print (Claude Max — no API key needed)
19
+ // ============================================================================
20
+ const COPILOT_PROMPTS = {
21
+ planner: 'You are a project planner. Break down the following objective into actionable steps with dependencies, estimated effort, and success criteria. Return JSON: { steps: [{ name, description, dependencies, effort, criteria }] }',
22
+ decomposer: 'You are a task decomposer. Break down the following task into sub-objectives with complexity and acceptance criteria. Return JSON: { sub_objectives: [{ title, complexity, acceptance_criteria, description }] }',
23
+ clarifier: 'You are a requirements clarifier. Identify ambiguities, missing requirements, and assumptions in the following request. Return JSON: { clarifications: [{ question, context, importance }], assumptions: [{ assumption, risk }] }',
24
+ intent: 'You are an intent classifier. Classify the intent of the following text. Return JSON: { intent, confidence, entities: [{ type, value }] }',
25
+ config: 'You are a configuration advisor. Recommend optimal configuration for the following system. Return JSON: { recommendations: [{ setting, value, rationale }] }',
26
+ reflection: 'You are a decision analyst. Reflect on the following decision and assess its quality. Return JSON: { assessment, confidence, risks: [], improvements: [] }',
27
+ 'meta-reasoner': 'You are a meta-reasoning agent. Analyze the reasoning traces and identify optimization opportunities. Return JSON: { insights: [], optimizations: [], confidence: number }',
28
+ };
29
+ async function runCopilotViaClaudeMax(agent, payload, correlationId) {
30
+ // Find claude binary
31
+ let claudeBin = null;
32
+ const envBin = process.env['AGENTICS_CLAUDE_BIN'];
33
+ if (envBin) {
34
+ claudeBin = envBin;
35
+ }
36
+ else {
37
+ for (const candidate of ['claude', 'claude-code']) {
38
+ try {
39
+ const found = execFileSync(process.platform === 'win32' ? 'where' : 'which', [candidate], { stdio: ['pipe', 'pipe', 'pipe'], timeout: 5_000, encoding: 'utf-8' }).trim().split(/\r?\n/)[0]?.trim();
40
+ if (found) {
41
+ claudeBin = found;
42
+ break;
43
+ }
44
+ }
45
+ catch { /* not found */ }
46
+ }
47
+ }
48
+ if (!claudeBin)
49
+ return null; // claude not available — fall through to cloud function
50
+ const systemPrompt = COPILOT_PROMPTS[agent] ?? `You are a ${agent} agent. Analyze the following and return structured JSON.`;
51
+ const query = String(payload['objective'] ?? payload['text'] ?? payload['query'] ?? JSON.stringify(payload));
52
+ const fullPrompt = `${systemPrompt}\n\nInput:\n${query}\n\nReturn ONLY valid JSON, no markdown fences.`;
53
+ try {
54
+ const rawOutput = execFileSync(claudeBin, [
55
+ '--print',
56
+ '--output-format', 'text',
57
+ '--model', process.env['AGENTICS_CLAUDE_MODEL'] || 'claude-sonnet-4-20250514',
58
+ fullPrompt,
59
+ ], {
60
+ encoding: 'utf-8',
61
+ timeout: 60_000,
62
+ maxBuffer: 5 * 1024 * 1024,
63
+ stdio: ['pipe', 'pipe', 'pipe'],
64
+ env: { ...process.env, MCP_SERVER_MODE: undefined },
65
+ });
66
+ // Parse JSON from output
67
+ let cleaned = rawOutput.trim();
68
+ if (cleaned.startsWith('```')) {
69
+ cleaned = cleaned.replace(/^```(?:json)?\s*\n?/, '').replace(/\n?```\s*$/, '');
70
+ }
71
+ const jsonMatch = cleaned.match(/\{[\s\S]*\}/);
72
+ if (jsonMatch) {
73
+ const parsed = JSON.parse(jsonMatch[0]);
74
+ return {
75
+ data: parsed,
76
+ _source: 'claude-max',
77
+ execution_metadata: {
78
+ trace_id: correlationId,
79
+ timestamp: new Date().toISOString(),
80
+ service: 'copilot-agents',
81
+ execution_id: correlationId,
82
+ agent: `copilot-${agent}`,
83
+ engine: 'claude-max',
84
+ },
85
+ layers_executed: [
86
+ { layer: 'AGENT_ROUTING', status: 'completed' },
87
+ { layer: `COPILOT_${agent.toUpperCase()}`, status: 'completed' },
88
+ ],
89
+ };
90
+ }
91
+ return null;
92
+ }
93
+ catch {
94
+ return null; // claude --print failed — fall through to cloud function
95
+ }
96
+ }
16
97
  export const AGENT_DOMAINS = {
17
98
  'test-bench': {
18
99
  serviceName: 'test-bench-agents',
@@ -222,15 +303,25 @@ export async function executeAgentsInvokeCommand(domain, agent, payload, options
222
303
  // Go directly to Cloud Run services — no repo-local fallback chain
223
304
  const config = loadEndpointConfig(domainConfig.serviceName);
224
305
  const adapter = createAdapter(domainConfig.serviceName, config, correlationId);
225
- // ADR-066: For copilot agents, try Anthropic API key first; fall back to claude --print (Claude Max)
306
+ // ADR-066: Copilot agents run via claude --print (Claude Max) — no API key needed
307
+ // This intercepts BEFORE the cloud function call so end-users never need an Anthropic key
226
308
  const invokeHeaders = {};
227
- if (domainConfig.serviceName === 'copilot-agents') {
309
+ if (domain === 'copilot') {
310
+ const copilotResult = await runCopilotViaClaudeMax(agent, normalizedPayload, correlationId);
311
+ if (copilotResult) {
312
+ return {
313
+ domain,
314
+ agent,
315
+ status: 200,
316
+ response: copilotResult,
317
+ timing: Date.now() - start,
318
+ };
319
+ }
320
+ // If claude --print not available, try cloud function with API key
228
321
  const anthropicKey = await getAnthropicApiKey();
229
322
  if (anthropicKey) {
230
323
  invokeHeaders['X-Anthropic-Api-Key'] = anthropicKey;
231
324
  }
232
- // If no API key, the cloud function will fail — the local fallback in the catch
233
- // block will handle it via computeUniversalFallback which uses claude --print when available
234
325
  }
235
326
  // governance-dashboard and policy-engine require execution context in HTTP headers
236
327
  if (domain === 'governance-dashboard' || domain === 'policy-engine') {