@llm-dev-ops/agentics-cli 2.7.4 → 2.7.5
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.
- package/dist/synthesis/agent-claim-registry.d.ts +87 -0
- package/dist/synthesis/agent-claim-registry.d.ts.map +1 -0
- package/dist/synthesis/agent-claim-registry.js +257 -0
- package/dist/synthesis/agent-claim-registry.js.map +1 -0
- package/dist/synthesis/simulation-artifact-generator.d.ts.map +1 -1
- package/dist/synthesis/simulation-artifact-generator.js +78 -9
- package/dist/synthesis/simulation-artifact-generator.js.map +1 -1
- package/dist/synthesis/simulation-renderers.d.ts +15 -0
- package/dist/synthesis/simulation-renderers.d.ts.map +1 -1
- package/dist/synthesis/simulation-renderers.js +101 -0
- package/dist/synthesis/simulation-renderers.js.map +1 -1
- package/package.json +1 -1
|
@@ -45,6 +45,21 @@ interface FinancialData {
|
|
|
45
45
|
costSavings: string;
|
|
46
46
|
hasData: boolean;
|
|
47
47
|
isEstimated: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* ADR-PIPELINE-096 D3 — per-metric source attribution. Populated when the
|
|
50
|
+
* value was resolved through the agent-claim-registry. Keys mirror the
|
|
51
|
+
* field names above (`budget`, `roi`, etc.). Missing key = no canonical
|
|
52
|
+
* agent source available; cell renders without `src=`. Value `heuristic` =
|
|
53
|
+
* fell through to ADR-095's per-employee fallback.
|
|
54
|
+
*/
|
|
55
|
+
sources?: {
|
|
56
|
+
budget?: string;
|
|
57
|
+
roi?: string;
|
|
58
|
+
npv?: string;
|
|
59
|
+
payback?: string;
|
|
60
|
+
revenue?: string;
|
|
61
|
+
costSavings?: string;
|
|
62
|
+
};
|
|
48
63
|
}
|
|
49
64
|
/**
|
|
50
65
|
* ADR-PIPELINE-026: Synthesize financial data from ALL sources:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulation-renderers.d.ts","sourceRoot":"","sources":["../../src/synthesis/simulation-renderers.ts"],"names":[],"m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EAAE,MAAM,EACb,iBAAiB,EAAE,OAAO,EAC1B,eAAe,EAAE,WAAW,EAAE,GAC7B,MAAM,CAoFR;AA4GD,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,EACb,iBAAiB,EAAE,OAAO,EAC1B,eAAe,EAAE,WAAW,EAAE,GAC7B,MAAM,CAoDR;AAMD,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,iBAAiB,EAAE,OAAO,EAC1B,eAAe,EAAE,WAAW,EAAE,GAC7B,MAAM,CAkER"}
|
|
@@ -383,6 +383,11 @@ export function synthesizeFinancials(simData, platformResults, query) {
|
|
|
383
383
|
const fm = (safeGet(simData, 'financial_model') ?? safeGet(simData, 'cost_model') ?? safeGet(simData, 'financials'));
|
|
384
384
|
// Collect from all possible agent sources — not just costops
|
|
385
385
|
const financialFields = {};
|
|
386
|
+
// ADR-PIPELINE-096 D3 — per-metric source attribution. Keys parallel
|
|
387
|
+
// financialFields. Populated by Source 0 (the agent-claim-registry) only
|
|
388
|
+
// when a registered agent returns a value; otherwise stays empty for that
|
|
389
|
+
// metric, which downstream callers interpret as "fell through to heuristic".
|
|
390
|
+
const financialSources = {};
|
|
386
391
|
const financialKeys = [
|
|
387
392
|
['budget', 'budget', 'investment', 'total_investment', 'allocated_budget', 'total_budget', 'estimated_cost', 'total_cost', 'project_cost'],
|
|
388
393
|
['roi', 'roi', 'expected_roi', 'return_on_investment', 'projected_roi'],
|
|
@@ -391,6 +396,13 @@ export function synthesizeFinancials(simData, platformResults, query) {
|
|
|
391
396
|
['revenue', 'projected_revenue', 'revenue_impact', 'annual_value', 'annual_savings', 'savings'],
|
|
392
397
|
['costSavings', 'cost_savings', 'cost_reduction', 'savings', 'efficiency_gain'],
|
|
393
398
|
];
|
|
399
|
+
// ── Source 0: ADR-096 D3 agent-claim-registry — canonical sourcing ─────
|
|
400
|
+
// The registry is the single declarative table of {metric → agent →
|
|
401
|
+
// response_path}. When a registered agent's response carries the value at
|
|
402
|
+
// the documented path, the renderer uses it AND tags the cell with
|
|
403
|
+
// `src=domain/agent`. Higher-priority agents win. Lower-priority agents
|
|
404
|
+
// contribute to D3 part 2's triangulation surface.
|
|
405
|
+
resolveCanonicalClaims(platformResults, financialFields, financialSources);
|
|
394
406
|
// Source 1: simData direct fields
|
|
395
407
|
for (const [key, ...aliases] of financialKeys) {
|
|
396
408
|
if (!key)
|
|
@@ -454,6 +466,22 @@ export function synthesizeFinancials(simData, platformResults, query) {
|
|
|
454
466
|
if (!hasRealData) {
|
|
455
467
|
return estimateFinancialsFromQuery(query);
|
|
456
468
|
}
|
|
469
|
+
// ADR-096 D3 — surface the per-metric source attribution map. Only emit
|
|
470
|
+
// the `sources` field when at least one metric was resolved through the
|
|
471
|
+
// registry; existing consumers that don't read `sources` see no change.
|
|
472
|
+
const sources = {};
|
|
473
|
+
if (financialSources['budget'])
|
|
474
|
+
sources.budget = financialSources['budget'];
|
|
475
|
+
if (financialSources['roi'])
|
|
476
|
+
sources.roi = financialSources['roi'];
|
|
477
|
+
if (financialSources['npv'])
|
|
478
|
+
sources.npv = financialSources['npv'];
|
|
479
|
+
if (financialSources['payback'])
|
|
480
|
+
sources.payback = financialSources['payback'];
|
|
481
|
+
if (financialSources['revenue'])
|
|
482
|
+
sources.revenue = financialSources['revenue'];
|
|
483
|
+
if (financialSources['costSavings'])
|
|
484
|
+
sources.costSavings = financialSources['costSavings'];
|
|
457
485
|
return {
|
|
458
486
|
budget: financialFields['budget'] ?? '',
|
|
459
487
|
roi: financialFields['roi'] ?? '',
|
|
@@ -463,8 +491,81 @@ export function synthesizeFinancials(simData, platformResults, query) {
|
|
|
463
491
|
costSavings: financialFields['costSavings'] ?? '',
|
|
464
492
|
hasData: true,
|
|
465
493
|
isEstimated: false,
|
|
494
|
+
...(Object.keys(sources).length > 0 ? { sources } : {}),
|
|
466
495
|
};
|
|
467
496
|
}
|
|
497
|
+
/**
|
|
498
|
+
* ADR-PIPELINE-096 D3 — Source 0 stage of synthesizeFinancials.
|
|
499
|
+
*
|
|
500
|
+
* Consults the agent-claim-registry to resolve the four headline metrics
|
|
501
|
+
* (Investment, ROI, NPV, Payback) plus Savings/Revenue when a canonical
|
|
502
|
+
* agent supplied a value. Mutates the passed-in dictionaries in place;
|
|
503
|
+
* never overrides a value already set by an earlier source.
|
|
504
|
+
*
|
|
505
|
+
* Maps registry `kind` values onto the FinancialData field names:
|
|
506
|
+
* investment → budget
|
|
507
|
+
* roi → roi
|
|
508
|
+
* npv → npv
|
|
509
|
+
* payback → payback
|
|
510
|
+
* savings → revenue AND costSavings (both render the same metric)
|
|
511
|
+
*/
|
|
512
|
+
function resolveCanonicalClaims(platformResults, financialFields, financialSources) {
|
|
513
|
+
// Lazy require to avoid pulling the registry in environments that don't
|
|
514
|
+
// need it (e.g. legacy direct callers of synthesizeFinancials).
|
|
515
|
+
let registry = null;
|
|
516
|
+
try {
|
|
517
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
518
|
+
registry = require('./agent-claim-registry.js');
|
|
519
|
+
}
|
|
520
|
+
catch {
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
if (!registry)
|
|
524
|
+
return;
|
|
525
|
+
// Adapt AgentResult[] (the existing simulation-renderers shape) onto the
|
|
526
|
+
// registry's AgentResultLike shape. The two are structurally compatible.
|
|
527
|
+
const adapted = platformResults.map(r => ({
|
|
528
|
+
domain: r.domain ?? '',
|
|
529
|
+
agent: r.agent ?? '',
|
|
530
|
+
status: r.status,
|
|
531
|
+
response: r.response,
|
|
532
|
+
}));
|
|
533
|
+
const writeIfEmpty = (key, claim) => {
|
|
534
|
+
if (financialFields[key])
|
|
535
|
+
return; // earlier source already won
|
|
536
|
+
if (!claim)
|
|
537
|
+
return;
|
|
538
|
+
financialFields[key] = formatClaimValue(key, claim.value, claim.methodology);
|
|
539
|
+
financialSources[key] = claim.source;
|
|
540
|
+
};
|
|
541
|
+
writeIfEmpty('budget', registry.resolveClaim('investment', adapted));
|
|
542
|
+
writeIfEmpty('roi', registry.resolveClaim('roi', adapted));
|
|
543
|
+
writeIfEmpty('npv', registry.resolveClaim('npv', adapted));
|
|
544
|
+
writeIfEmpty('payback', registry.resolveClaim('payback', adapted));
|
|
545
|
+
// Savings maps to BOTH revenue and costSavings (the document templates
|
|
546
|
+
// render annual savings as either depending on context; we populate both
|
|
547
|
+
// so neither cell renders the heuristic when a canonical agent answered).
|
|
548
|
+
const savingsClaim = registry.resolveClaim('savings', adapted);
|
|
549
|
+
writeIfEmpty('revenue', savingsClaim);
|
|
550
|
+
writeIfEmpty('costSavings', savingsClaim);
|
|
551
|
+
}
|
|
552
|
+
/** Format a registry-resolved value into the renderer's expected string shape. */
|
|
553
|
+
function formatClaimValue(key, value, methodology) {
|
|
554
|
+
if (typeof value === 'string')
|
|
555
|
+
return value;
|
|
556
|
+
// Numeric: format per metric kind.
|
|
557
|
+
const fmt = (n) => n >= 1_000_000 ? `$${(n / 1_000_000).toFixed(1)}M` : `$${(n / 1000).toFixed(0)}K`;
|
|
558
|
+
if (key === 'roi') {
|
|
559
|
+
// ROI is typically a percentage. Fmt as integer percent.
|
|
560
|
+
return `${Math.round(value)}% projected (${methodology})`;
|
|
561
|
+
}
|
|
562
|
+
if (key === 'payback') {
|
|
563
|
+
// Payback in months.
|
|
564
|
+
return `${Math.round(value)} months (${methodology})`;
|
|
565
|
+
}
|
|
566
|
+
// Currency fields (budget, npv, revenue, costSavings).
|
|
567
|
+
return `${fmt(value)} (${methodology})`;
|
|
568
|
+
}
|
|
468
569
|
/**
|
|
469
570
|
* ADR-PIPELINE-025 §7a: Generate financial estimates from query context.
|
|
470
571
|
* Uses employee count, industry, and scope to produce rough-order-of-magnitude numbers.
|