@v11g/agents-rock 1.0.7 → 1.0.9
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/README.md +1 -1
- package/package.json +1 -1
- package/plugins/reasoning/.claude-plugin/plugin.json +1 -1
- package/plugins/reasoning/evals/format-handoff-folder/graders/folder-named.md +8 -0
- package/plugins/reasoning/evals/format-handoff-folder/graders/skill-fired.md +7 -0
- package/plugins/reasoning/evals/format-handoff-folder/prompt.md +9 -0
- package/plugins/reasoning/evals/format-ids-and-supports/graders/ids-in-chat.md +8 -0
- package/plugins/reasoning/evals/format-ids-and-supports/graders/skill-fired.md +7 -0
- package/plugins/reasoning/evals/format-ids-and-supports/graders/supports-resolve.md +11 -0
- package/plugins/reasoning/evals/format-ids-and-supports/prompt.md +8 -0
- package/plugins/reasoning/evals/format-root-candidate-status/graders/candidate-status.md +11 -0
- package/plugins/reasoning/evals/format-root-candidate-status/graders/skill-fired.md +7 -0
- package/plugins/reasoning/evals/format-root-candidate-status/prompt.md +8 -0
- package/plugins/reasoning/evals/format-unsaved-continues/graders/analysis-completes.md +9 -0
- package/plugins/reasoning/evals/format-unsaved-continues/graders/not-saved-stated.md +9 -0
- package/plugins/reasoning/evals/format-unsaved-continues/graders/skill-fired.md +7 -0
- package/plugins/reasoning/evals/format-unsaved-continues/prompt.md +8 -0
- package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/names-closest-available.md +5 -6
- package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/no-improvised-levels.md +4 -6
- package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/skill-fired.md +1 -1
- package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/states-unavailable.md +4 -5
- package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/systemic-design-fired.md +10 -0
- package/plugins/reasoning/evals/guardrail-unavailable-framework/prompt.md +2 -2
- package/plugins/reasoning/evals/ps-interview-first-question/graders/look-in-present.md +10 -0
- package/plugins/reasoning/evals/ps-interview-first-question/graders/no-fixed-exits.md +11 -0
- package/plugins/reasoning/evals/ps-interview-first-question/graders/options-from-input.md +15 -0
- package/plugins/reasoning/evals/ps-interview-first-question/graders/skill-fired.md +7 -0
- package/plugins/reasoning/evals/ps-interview-first-question/graders/source-hint.md +11 -0
- package/plugins/reasoning/evals/ps-interview-first-question/graders/targets-gap.md +13 -0
- package/plugins/reasoning/evals/ps-interview-first-question/prompt.md +8 -0
- package/plugins/reasoning/evals/ps-interview-five-whys/graders/look-in-present.md +10 -0
- package/plugins/reasoning/evals/ps-interview-five-whys/graders/no-fixed-exits.md +11 -0
- package/plugins/reasoning/evals/ps-interview-five-whys/graders/options-from-input.md +11 -0
- package/plugins/reasoning/evals/ps-interview-five-whys/graders/skill-fired.md +7 -0
- package/plugins/reasoning/evals/ps-interview-five-whys/graders/source-hint.md +11 -0
- package/plugins/reasoning/evals/ps-interview-five-whys/graders/targets-gap.md +15 -0
- package/plugins/reasoning/evals/ps-interview-five-whys/prompt.md +8 -0
- package/plugins/reasoning/evals/ps-router-handoff/graders/no-reselection.md +11 -0
- package/plugins/reasoning/evals/ps-router-handoff/graders/runs-rca.md +8 -0
- package/plugins/reasoning/evals/ps-router-handoff/graders/skill-fired.md +7 -0
- package/plugins/reasoning/evals/ps-router-handoff/prompt.md +11 -0
- package/plugins/reasoning/evals/routing-adaptive-discriminator/graders/confidence-single-word.md +10 -0
- package/plugins/reasoning/evals/routing-ambiguous-feature-request/graders/confidence-single-word.md +10 -0
- package/plugins/reasoning/evals/routing-classify-only/graders/confidence-single-word.md +10 -0
- package/plugins/reasoning/evals/routing-complex-adaptive-org-change/graders/confidence-single-word.md +10 -0
- package/plugins/reasoning/evals/routing-complex-adaptive-org-change/graders/no-unavailability-claim.md +10 -0
- package/plugins/reasoning/evals/routing-complex-delivery-slowdown/graders/confidence-single-word.md +10 -0
- package/plugins/reasoning/evals/routing-simple-null-pointer/graders/confidence-single-word.md +10 -0
- package/plugins/reasoning/evals/routing-thin-input-provisional/graders/confidence-single-word.md +10 -0
- package/plugins/reasoning/evals/sd-default-selection/graders/dates-traced.md +15 -0
- package/plugins/reasoning/evals/sd-default-selection/graders/interventions-cite-entries.md +12 -0
- package/plugins/reasoning/evals/sd-default-selection/graders/owners-from-input.md +8 -0
- package/plugins/reasoning/evals/sd-default-selection/graders/plan-steps-complete.md +21 -0
- package/plugins/reasoning/evals/sd-default-selection/graders/selects-systemic-design.md +12 -0
- package/plugins/reasoning/evals/sd-default-selection/graders/skill-fired.md +7 -0
- package/plugins/reasoning/evals/sd-default-selection/graders/systemic-design-fired.md +10 -0
- package/plugins/reasoning/evals/sd-default-selection/prompt.md +11 -0
- package/plugins/reasoning/evals/sd-named-framework-software/graders/names-no-skill.md +11 -0
- package/plugins/reasoning/evals/sd-named-framework-software/graders/no-systemic-block.md +10 -0
- package/plugins/reasoning/evals/sd-named-framework-software/graders/systemic-design-fired.md +10 -0
- package/plugins/reasoning/evals/sd-named-framework-software/prompt.md +8 -0
- package/plugins/reasoning/evals/sd-not-software/graders/no-systemic-block.md +10 -0
- package/plugins/reasoning/evals/sd-not-software/graders/says-out-of-scope.md +10 -0
- package/plugins/reasoning/evals/sd-not-software/prompt.md +8 -0
- package/plugins/reasoning/evals/sd-raw-input/graders/first-question-targets-model.md +11 -0
- package/plugins/reasoning/evals/sd-raw-input/graders/look-in-present.md +10 -0
- package/plugins/reasoning/evals/sd-raw-input/graders/model-gap-blocks-stop.md +14 -0
- package/plugins/reasoning/evals/sd-raw-input/graders/model-in-assumptions.md +13 -0
- package/plugins/reasoning/evals/sd-raw-input/graders/no-fixed-exits.md +11 -0
- package/plugins/reasoning/evals/sd-raw-input/graders/skill-fired.md +7 -0
- package/plugins/reasoning/evals/sd-raw-input/graders/systemic-design-fired.md +10 -0
- package/plugins/reasoning/evals/sd-raw-input/prompt.md +8 -0
- package/plugins/reasoning/evals/sd-theory-of-change/graders/links-carry-assumptions.md +9 -0
- package/plugins/reasoning/evals/sd-theory-of-change/graders/no-dates.md +8 -0
- package/plugins/reasoning/evals/sd-theory-of-change/graders/skill-fired.md +7 -0
- package/plugins/reasoning/evals/sd-theory-of-change/graders/systemic-design-fired.md +10 -0
- package/plugins/reasoning/evals/sd-theory-of-change/graders/toc-block.md +10 -0
- package/plugins/reasoning/evals/sd-theory-of-change/prompt.md +8 -0
- package/plugins/reasoning/evals/sd-three-horizons/graders/dates-are-assumptions.md +11 -0
- package/plugins/reasoning/evals/sd-three-horizons/graders/owners-are-roles.md +8 -0
- package/plugins/reasoning/evals/sd-three-horizons/graders/skill-fired.md +7 -0
- package/plugins/reasoning/evals/sd-three-horizons/graders/systemic-design-fired.md +10 -0
- package/plugins/reasoning/evals/sd-three-horizons/graders/three-horizons-block.md +10 -0
- package/plugins/reasoning/evals/sd-three-horizons/prompt.md +9 -0
- package/plugins/reasoning/evals/st-causal-loop-unclosed/graders/edges-carry-support-labels.md +2 -2
- package/plugins/reasoning/evals/st-causal-loop-unclosed/graders/no-invented-delays.md +7 -4
- package/plugins/reasoning/evals/st-interview-first-question/graders/look-in-present.md +10 -0
- package/plugins/reasoning/evals/st-interview-first-question/graders/no-fixed-exits.md +11 -0
- package/plugins/reasoning/evals/st-interview-first-question/graders/options-from-input.md +11 -0
- package/plugins/reasoning/evals/st-interview-first-question/graders/skill-fired.md +7 -0
- package/plugins/reasoning/evals/st-interview-first-question/graders/source-hint.md +11 -0
- package/plugins/reasoning/evals/st-interview-first-question/graders/targets-gap.md +13 -0
- package/plugins/reasoning/evals/st-interview-first-question/prompt.md +8 -0
- package/plugins/reasoning/evals/st-selection-boundary/graders/one-block-only.md +9 -6
- package/plugins/reasoning/skills/problem-router/README.md +6 -0
- package/plugins/reasoning/skills/problem-router/SKILL.md +11 -11
- package/plugins/reasoning/skills/problem-router/references/contract.md +117 -16
- package/plugins/reasoning/skills/problem-solving/README.md +10 -0
- package/plugins/reasoning/skills/problem-solving/SKILL.md +15 -3
- package/plugins/reasoning/skills/problem-solving/references/contract.md +117 -16
- package/plugins/reasoning/skills/problem-solving/references/interview.md +68 -0
- package/plugins/reasoning/skills/systemic-design/README.md +45 -0
- package/plugins/reasoning/skills/systemic-design/SKILL.md +184 -0
- package/plugins/reasoning/skills/systemic-design/frameworks/systemic-design.md +39 -0
- package/plugins/reasoning/skills/systemic-design/frameworks/theory-of-change.md +34 -0
- package/plugins/reasoning/skills/systemic-design/frameworks/three-horizons.md +28 -0
- package/plugins/reasoning/skills/systemic-design/references/contract.md +205 -0
- package/plugins/reasoning/skills/systemic-design/references/interview.md +68 -0
- package/plugins/reasoning/skills/systems-thinking/README.md +13 -6
- package/plugins/reasoning/skills/systems-thinking/SKILL.md +18 -6
- package/plugins/reasoning/skills/systems-thinking/frameworks/causal-loop.md +5 -2
- package/plugins/reasoning/skills/systems-thinking/frameworks/leverage-points.md +16 -7
- package/plugins/reasoning/skills/systems-thinking/frameworks/system-map.md +4 -5
- package/plugins/reasoning/skills/systems-thinking/references/contract.md +117 -16
- package/plugins/reasoning/skills/systems-thinking/references/interview.md +68 -0
- package/plugins/solution-architect/.claude-plugin/plugin.json +1 -1
- package/plugins/solution-architect/skills/analyze-requirements/SKILL.md +3 -2
- package/plugins/solution-architect/skills/analyze-requirements/references/rewriting.md +108 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/drift.mjs +64 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/cdp.mjs +4 -1
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/drift.mjs +31 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/git-diff.mjs +27 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/quality-gate.mjs +16 -1
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/state.mjs +52 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/record.mjs +87 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/drift-cli.test.mjs +178 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/drift.test.mjs +76 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/git-diff.test.mjs +62 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/quality-gate.test.mjs +9 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/record-cli.test.mjs +136 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/rerun-safety.test.mjs +53 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/rewriting.test.mjs +80 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/state.test.mjs +123 -0
- package/plugins/solution-architect/skills/estimate/README.md +20 -15
- package/plugins/solution-architect/skills/estimate/SKILL.md +10 -6
- package/plugins/solution-architect/skills/estimate/assets/estimate-template-agentic.html +111 -138
- package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +361 -247
- package/plugins/solution-architect/skills/estimate/assets/scores-review-template.html +5 -4
- package/plugins/solution-architect/skills/estimate/evals/evals.json +7 -7
- package/plugins/solution-architect/skills/estimate/references/agentic-estimation.md +4 -2
- package/plugins/solution-architect/skills/estimate/references/ai-multipliers.md +38 -82
- package/plugins/solution-architect/skills/estimate/references/interview.md +56 -35
- package/plugins/solution-architect/skills/estimate/references/scoring-guide.md +40 -4
- package/plugins/solution-architect/skills/estimate/references/techniques.md +29 -21
- package/plugins/solution-architect/skills/estimate/references/writing.md +75 -43
- package/plugins/solution-architect/skills/estimate/scripts/lib/checks.mjs +37 -5
- package/plugins/solution-architect/skills/estimate/scripts/lib/context-schema.mjs +35 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/estimate-math.mjs +17 -75
- package/plugins/solution-architect/skills/estimate/scripts/lib/inline.mjs +5 -5
- package/plugins/solution-architect/skills/estimate/scripts/lib/pricing.mjs +78 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/project-price.mjs +96 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/redact.mjs +67 -19
- package/plugins/solution-architect/skills/estimate/scripts/lib/roadmap.mjs +4 -5
- package/plugins/solution-architect/skills/estimate/scripts/lib/rollup.mjs +48 -73
- package/plugins/solution-architect/skills/estimate/scripts/lib/schema.mjs +28 -13
- package/plugins/solution-architect/skills/estimate/scripts/lib/score-csv.mjs +2 -2
- package/plugins/solution-architect/skills/estimate/scripts/lib/score-html.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/scripts/lib/scoring.mjs +2 -2
- package/plugins/solution-architect/skills/estimate/scripts/render.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/scripts/score-review.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/scripts/test/browser-agentic.test.mjs +143 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/browser.test.mjs +209 -50
- package/plugins/solution-architect/skills/estimate/scripts/test/compute.test.mjs +57 -32
- package/plugins/solution-architect/skills/estimate/scripts/test/e2e.test.mjs +52 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/estimate-math.test.mjs +25 -112
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-estimation-fail.md +0 -10
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-estimation-pass.md +0 -10
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-inputs.json +1 -7
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/booking-inputs.json +11 -10
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-fail.md +6 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-pass.md +17 -21
- package/plugins/solution-architect/skills/estimate/scripts/test/pricing.test.mjs +88 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/project-price.test.mjs +93 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/references.test.mjs +86 -24
- package/plugins/solution-architect/skills/estimate/scripts/test/render.test.mjs +185 -31
- package/plugins/solution-architect/skills/estimate/scripts/test/schema.test.mjs +114 -61
- package/plugins/solution-architect/skills/estimate/scripts/test/score-review.test.mjs +34 -1
- package/plugins/solution-architect/skills/estimate/scripts/test/validate.test.mjs +103 -9
- package/plugins/solution-architect/skills/estimate/scripts/test/xlsx-export.test.mjs +292 -71
- package/plugins/solution-architect/skills/new-lead/SKILL.md +4 -3
- package/plugins/solution-architect/skills/proposal/README.md +9 -7
- package/plugins/solution-architect/skills/proposal/SKILL.md +10 -7
- package/plugins/solution-architect/skills/proposal/evals/evals.json +29 -11
- package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/ARCHITECTURE.md +65 -0
- package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/brief.md +21 -0
- package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/estimation-inputs.json +126 -0
- package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/estimation.json +215 -0
- package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation-inputs.json +224 -34
- package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation.json +103 -114
- package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation.md +48 -22
- package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation-inputs.json +211 -33
- package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation.json +102 -117
- package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation.md +48 -25
- package/plugins/solution-architect/skills/proposal/references/interview.md +3 -6
- package/plugins/solution-architect/skills/proposal/references/review.md +5 -4
- package/plugins/solution-architect/skills/proposal/references/writing.md +33 -31
- package/plugins/solution-architect/skills/proposal/scripts/derive.mjs +1 -1
- package/plugins/solution-architect/skills/proposal/scripts/lib/checks-client.mjs +5 -22
- package/plugins/solution-architect/skills/proposal/scripts/lib/checks-doc.mjs +18 -8
- package/plugins/solution-architect/skills/proposal/scripts/lib/checks.mjs +6 -2
- package/plugins/solution-architect/skills/proposal/scripts/lib/figures.mjs +24 -33
- package/plugins/solution-architect/skills/proposal/scripts/lib/sections.mjs +1 -1
- package/plugins/solution-architect/skills/proposal/scripts/test/checks-client.test.mjs +50 -47
- package/plugins/solution-architect/skills/proposal/scripts/test/checks-doc.test.mjs +99 -40
- package/plugins/solution-architect/skills/proposal/scripts/test/docs.test.mjs +11 -5
- package/plugins/solution-architect/skills/proposal/scripts/test/e2e.test.mjs +1 -1
- package/plugins/solution-architect/skills/proposal/scripts/test/evals-fixtures.test.mjs +39 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/figures.test.mjs +67 -54
- package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-fail.md +6 -1
- package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-pass.md +8 -12
- package/plugins/solution-architect/skills/proposal/scripts/test/render.test.mjs +1 -1
- package/plugins/solution-architect/skills/proposal/scripts/test/validate.test.mjs +3 -2
- package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/names-owning-skill.md +0 -9
- package/plugins/reasoning/evals/routing-complex-adaptive-org-change/graders/states-systemic-design-unavailable.md +0 -15
- package/plugins/solution-architect/skills/estimate/scripts/lib/scenario-schema.mjs +0 -39
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
// The --client-only export embeds the full estimation JSON in the page; this
|
|
2
|
-
// strips the
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
2
|
+
// strips the pricing build-up before it ships, unless the inputs opt out via
|
|
3
|
+
// exposeRatesToClient. Stripped, from computed.price: featurePoints (the
|
|
4
|
+
// summed feature-price subtotal), contextMultiplier and adjustedBase (the
|
|
5
|
+
// multiplier and the base it scales — adjustedBase = featurePoints ×
|
|
6
|
+
// contextMultiplier, so both factors have to go for either to be hidden),
|
|
7
|
+
// and overheads (the line items and their total), plus inputs.contextLevels
|
|
8
|
+
// and inputs.contextProvenance (see redactContext). Stripped, per feature in
|
|
9
|
+
// computed.features: tier, point, priceLow and priceHigh — the score band
|
|
10
|
+
// and the price it bought.
|
|
11
|
+
//
|
|
12
|
+
// Deliberately kept, and not a gap: presentLow, presentHigh, singleNumber,
|
|
13
|
+
// contingencyRate and impliedAccuracy are what the client is quoted, always.
|
|
14
|
+
// p50, sigma, p20, p80, p95 also stay — presentLow/presentHigh are just
|
|
15
|
+
// ceil(p50)/ceil(p95) rounded to the nearest 500, so those two are the
|
|
16
|
+
// unrounded form of a number the client already has, not hidden working, and
|
|
17
|
+
// sigma is recoverable from the percentiles regardless of whether it ships.
|
|
18
|
+
// Per-feature spread and flag stay too: spread yields no price once tier,
|
|
19
|
+
// point, priceLow and priceHigh are gone. Assumptions, risks, component names
|
|
20
|
+
// and the scores a feature was judged on are client-facing per spec.
|
|
6
21
|
//
|
|
7
22
|
// Agentic-only fields are stripped unconditionally (not gated on
|
|
8
23
|
// exposeRatesToClient, which is a pricing-transparency opt-out, not a
|
|
@@ -11,15 +26,28 @@
|
|
|
11
26
|
// descriptions (the global measurements store can carry other projects'
|
|
12
27
|
// task descriptions). These fields don't exist in team-mode estimations, so
|
|
13
28
|
// team-mode output is unaffected.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
29
|
+
//
|
|
30
|
+
// recommendedReason is stripped unconditionally too, for the same reason as
|
|
31
|
+
// a score's cite: it is free text an internal agent writes under a contract
|
|
32
|
+
// (references/writing.md) that never warns it the sentence reaches the
|
|
33
|
+
// client. The client receives the file, not a rendered view, so hiding the
|
|
34
|
+
// node from the DOM is not enough — the key is removed from the JSON, the
|
|
35
|
+
// same way measurementsPath/repository/evidence descriptions are (R48).
|
|
36
|
+
//
|
|
37
|
+
// A task's name, category and three-point o/m/p are the estimate itself —
|
|
38
|
+
// the same class as computed.features[*].hours/low/high, which already ship
|
|
39
|
+
// unconditionally. What's internal is the judgment behind that number: how
|
|
40
|
+
// sure we were (confidence), where it came from (provenance) and what we
|
|
41
|
+
// quietly assumed (assumptions) — the same class as a score's cite, so these
|
|
42
|
+
// three are stripped unconditionally too, from every task (R49).
|
|
43
|
+
const PRICE_WORKING = ['contextMultiplier', 'adjustedBase', 'overheads', 'featurePoints'];
|
|
44
|
+
const FEATURE_WORKING = ['tier', 'point', 'priceLow', 'priceHigh'];
|
|
45
|
+
const TASK_JUDGMENT = ['confidence', 'provenance', 'assumptions'];
|
|
46
|
+
|
|
47
|
+
const omit = (obj, keys) => Object.fromEntries(Object.entries(obj).filter(([k]) => !keys.includes(k)));
|
|
17
48
|
|
|
18
|
-
function
|
|
19
|
-
return Object.fromEntries(Object.entries(
|
|
20
|
-
const { laborCost, toolingCost, taskHours, ...rest } = s;
|
|
21
|
-
return [id, rest];
|
|
22
|
-
}));
|
|
49
|
+
function redactComputedFeatures(features) {
|
|
50
|
+
return Object.fromEntries(Object.entries(features).map(([id, f]) => [id, omit(f, FEATURE_WORKING)]));
|
|
23
51
|
}
|
|
24
52
|
|
|
25
53
|
function redactAgenticInputs({ measurementsPath, agentContext, ...rest }) {
|
|
@@ -28,6 +56,10 @@ function redactAgenticInputs({ measurementsPath, agentContext, ...rest }) {
|
|
|
28
56
|
return { ...rest, agentContext: clientAgentContext };
|
|
29
57
|
}
|
|
30
58
|
|
|
59
|
+
function redactRecommendedReason({ recommendedReason, ...rest }) {
|
|
60
|
+
return rest;
|
|
61
|
+
}
|
|
62
|
+
|
|
31
63
|
// A score's cite is internal shorthand — the ticket phrase, file name or
|
|
32
64
|
// meeting wording the judgment rests on — so it is blanked unconditionally,
|
|
33
65
|
// like the agentic fields above. The rubric anchor is the sentence the client
|
|
@@ -38,6 +70,23 @@ function blankCites(feature) {
|
|
|
38
70
|
return { ...feature, scores: Object.fromEntries(scores) };
|
|
39
71
|
}
|
|
40
72
|
|
|
73
|
+
function redactFeatureInputs(feature) {
|
|
74
|
+
const cited = blankCites(feature);
|
|
75
|
+
return { ...cited, tasks: cited.tasks.map((t) => omit(t, TASK_JUDGMENT)) };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// The five context levels are our written rating of the client's own spec
|
|
79
|
+
// and decision-making, and the input to the context multiplier — pricing
|
|
80
|
+
// working, so they leave the file with the rest of it. Exposed or not, the
|
|
81
|
+
// cite is internal file references and is blanked like a score's cite.
|
|
82
|
+
function redactContext(inputs, expose) {
|
|
83
|
+
const { contextLevels, contextProvenance, ...rest } = inputs;
|
|
84
|
+
if (!expose) return rest;
|
|
85
|
+
if (!contextProvenance) return inputs;
|
|
86
|
+
const blanked = Object.entries(contextProvenance).map(([k, p]) => [k, { ...p, cite: '' }]);
|
|
87
|
+
return { ...inputs, contextProvenance: Object.fromEntries(blanked) };
|
|
88
|
+
}
|
|
89
|
+
|
|
41
90
|
function redactComputedTasks(tasks) {
|
|
42
91
|
return Object.fromEntries(Object.entries(tasks).map(([id, t]) => [
|
|
43
92
|
id,
|
|
@@ -46,19 +95,18 @@ function redactComputedTasks(tasks) {
|
|
|
46
95
|
}
|
|
47
96
|
|
|
48
97
|
export function redactForClient(estimation) {
|
|
49
|
-
const agentic = redactAgenticInputs(estimation.inputs);
|
|
50
|
-
const
|
|
98
|
+
const agentic = redactRecommendedReason(redactAgenticInputs(estimation.inputs));
|
|
99
|
+
const context = redactContext(agentic, estimation.inputs.exposeRatesToClient);
|
|
100
|
+
const inputs = { ...context, features: context.features.map(redactFeatureInputs) };
|
|
51
101
|
const computed = { ...estimation.computed, tasks: redactComputedTasks(estimation.computed.tasks) };
|
|
52
102
|
if (estimation.inputs.exposeRatesToClient) return { ...estimation, inputs, computed };
|
|
53
103
|
return {
|
|
54
104
|
...estimation,
|
|
55
|
-
inputs
|
|
56
|
-
...inputs,
|
|
57
|
-
scenarios: inputs.scenarios.map((s) => ({ ...s, team: redactScenarioTeam(s.team) })),
|
|
58
|
-
},
|
|
105
|
+
inputs,
|
|
59
106
|
computed: {
|
|
60
107
|
...computed,
|
|
61
|
-
|
|
108
|
+
features: redactComputedFeatures(computed.features),
|
|
109
|
+
price: omit(computed.price, PRICE_WORKING),
|
|
62
110
|
},
|
|
63
111
|
};
|
|
64
112
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// group's scenario task hours, and lets roadmapBands turn shares into bands.
|
|
4
4
|
// Returns undefined when no feature carries a milestone — the roadmap is
|
|
5
5
|
// optional and its absence must stay a missing key, not an empty array.
|
|
6
|
-
import { roadmapBands } from './estimate-math.mjs';
|
|
6
|
+
import { roadmapBands, round2 } from './estimate-math.mjs';
|
|
7
7
|
|
|
8
8
|
function milestonesFrom(features, taskHours) {
|
|
9
9
|
const order = [];
|
|
@@ -20,13 +20,12 @@ function milestonesFrom(features, taskHours) {
|
|
|
20
20
|
return order.map((name) => byName[name]);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export function roadmapFor({ features, taskHours
|
|
23
|
+
export function roadmapFor({ features, taskHours }) {
|
|
24
24
|
const milestones = milestonesFrom(features, taskHours);
|
|
25
25
|
if (!milestones) return undefined;
|
|
26
|
-
return roadmapBands({ milestones
|
|
26
|
+
return roadmapBands({ milestones }).map((band, i) => ({
|
|
27
27
|
milestone: band.name,
|
|
28
28
|
features: milestones[i].features,
|
|
29
|
-
|
|
30
|
-
endMonths: band.endMonths,
|
|
29
|
+
share: round2(band.share),
|
|
31
30
|
}));
|
|
32
31
|
}
|
|
@@ -1,55 +1,19 @@
|
|
|
1
1
|
// Turns validated estimation-inputs into the estimation.json truth: PERT per
|
|
2
|
-
// task,
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from './
|
|
2
|
+
// task, per-feature price bands, and the project price roll-up. The dynamic,
|
|
3
|
+
// id-keyed maps (tasks, features, components) are assembled with sorted keys
|
|
4
|
+
// so repeat runs are byte-identical.
|
|
5
|
+
import { pert, round2 } from './estimate-math.mjs';
|
|
6
|
+
import { featurePrice } from './pricing.mjs';
|
|
7
|
+
import { projectPrice } from './project-price.mjs';
|
|
7
8
|
import { roadmapFor } from './roadmap.mjs';
|
|
8
9
|
import { componentHoursFor } from './components.mjs';
|
|
9
10
|
import { agenticTask } from './baselines.mjs';
|
|
10
|
-
import { scoreSummary } from './scoring.mjs';
|
|
11
|
+
import { scoreNumbers, scoreSummary } from './scoring.mjs';
|
|
11
12
|
|
|
12
13
|
function sortedMap(entries) {
|
|
13
14
|
return Object.fromEntries(entries.sort(([a], [b]) => a.localeCompare(b)));
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
export function round2(n) {
|
|
17
|
-
return Math.round(n * 100) / 100;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function taskHoursFor(scenario, tasks) {
|
|
21
|
-
const seniority = dominantSeniority(scenario.team);
|
|
22
|
-
const entries = Object.keys(tasks).map((id) => [id, tasks[id].evidence !== undefined
|
|
23
|
-
? tasks[id].e
|
|
24
|
-
: taskHours({
|
|
25
|
-
e: tasks[id].e, seniority, aiAssisted: scenario.aiAssisted,
|
|
26
|
-
category: tasks[id].category, verificationPct: tasks[id].verificationPct,
|
|
27
|
-
})]);
|
|
28
|
-
return sortedMap(entries);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function scenarioBlock(scenario, ctx) {
|
|
32
|
-
const taskHours = taskHoursFor(scenario, ctx.tasks);
|
|
33
|
-
const sumTaskHours = Object.values(taskHours).reduce((a, b) => a + b, 0);
|
|
34
|
-
const hours = sumTaskHours + sumTaskHours * ctx.overheadPct + ctx.spreadBufferHours + ctx.riskBufferHours;
|
|
35
|
-
const rollup = scenarioRollup({ hours, team: scenario.team, toolingCostPerSeat: scenario.toolingCostPerSeat });
|
|
36
|
-
const roadmap = roadmapFor({ features: ctx.features, taskHours, months: rollup.months })
|
|
37
|
-
?.map((b) => ({ ...b, startMonths: round2(b.startMonths), endMonths: round2(b.endMonths) }));
|
|
38
|
-
const notes = [];
|
|
39
|
-
if (scenario.team.length === 1) notes.push('bus factor: single engineer');
|
|
40
|
-
if (scenario.team.length > 3) notes.push('coordination overhead grows past 3 engineers');
|
|
41
|
-
return {
|
|
42
|
-
taskHours: sortedMap(Object.entries(taskHours).map(([id, h]) => [id, round2(h)])),
|
|
43
|
-
hours: round2(hours),
|
|
44
|
-
months: round2(rollup.months),
|
|
45
|
-
laborCost: round2(rollup.laborCost),
|
|
46
|
-
toolingCost: round2(rollup.toolingCost),
|
|
47
|
-
totalCost: round2(rollup.totalCost),
|
|
48
|
-
notes,
|
|
49
|
-
...(roadmap ? { roadmap } : {}),
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
17
|
const CONFIDENCE_RANK = { HIGH: 0, MED: 1, LOW: 2, UNCALIBRATED: 3 };
|
|
54
18
|
|
|
55
19
|
export function criticalConfidence(features, tasks) {
|
|
@@ -92,32 +56,51 @@ function buildAgenticTasks(inputs, measurements) {
|
|
|
92
56
|
return tasks;
|
|
93
57
|
}
|
|
94
58
|
|
|
59
|
+
// Prices a scored feature onto `row` and pushes its price inputs onto
|
|
60
|
+
// `priced` for the project roll-up. scoreSummary stays the single authority
|
|
61
|
+
// for a feature's scoreTotal/tier; featurePrice only supplies the money.
|
|
62
|
+
function scoredFeatureRow(feature, row, priced) {
|
|
63
|
+
const n = scoreNumbers(feature.scores);
|
|
64
|
+
const p = featurePrice(n);
|
|
65
|
+
Object.assign(row, scoreSummary(feature), {
|
|
66
|
+
point: round2(p.point), spread: round2(p.spread),
|
|
67
|
+
priceLow: round2(p.low), priceHigh: round2(p.high), flag: p.flag,
|
|
68
|
+
});
|
|
69
|
+
priced.push({ point: p.point, spread: p.spread, unc: n.unc, risk: n.risk });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Feature rows carry both halves now: hours for planning, price for the
|
|
73
|
+
// quote. They come from different inputs and never convert into each other.
|
|
95
74
|
function buildFeatures(inputs, tasks) {
|
|
96
75
|
const features = {};
|
|
97
76
|
const summaries = [];
|
|
77
|
+
const priced = [];
|
|
98
78
|
for (const feature of inputs.features) {
|
|
99
79
|
const taskIds = feature.tasks.map((t) => t.id);
|
|
100
80
|
const hours = taskIds.reduce((sum, id) => sum + tasks[id].e, 0);
|
|
101
81
|
const low = taskIds.reduce((sum, id) => sum + tasks[id].o, 0);
|
|
102
82
|
const high = taskIds.reduce((sum, id) => sum + tasks[id].p, 0);
|
|
103
|
-
|
|
83
|
+
const row = { hours: round2(hours), low: round2(low), high: round2(high) };
|
|
84
|
+
if (feature.scores) scoredFeatureRow(feature, row, priced);
|
|
85
|
+
features[feature.id] = row;
|
|
104
86
|
summaries.push({ hours, taskIds });
|
|
105
87
|
}
|
|
106
|
-
return { features: sortedMap(Object.entries(features)), summaries };
|
|
88
|
+
return { features: sortedMap(Object.entries(features)), summaries, priced };
|
|
107
89
|
}
|
|
108
90
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
91
|
+
// Rounds every top-level money/rate field on the price block, plus the one
|
|
92
|
+
// nested money field (overheads.amount) the top-level pass can't reach
|
|
93
|
+
// because `overheads` itself is an object, not a number.
|
|
94
|
+
function roundedPrice(price) {
|
|
95
|
+
const block = Object.fromEntries(
|
|
96
|
+
Object.entries(price).map(([k, v]) => [k, typeof v === 'number' ? round2(v) : v]),
|
|
97
|
+
);
|
|
98
|
+
block.overheads = { ...price.overheads, amount: round2(price.overheads.amount) };
|
|
99
|
+
return block;
|
|
113
100
|
}
|
|
114
101
|
|
|
115
102
|
const isAgentic = (inputs) => inputs.deliveryMode === 'agentic';
|
|
116
103
|
|
|
117
|
-
const normalizeRisks = (inputs) => (isAgentic(inputs)
|
|
118
|
-
? inputs.risks.map((r) => ({ ...r, impactHours: r.impactMinutes / 60 }))
|
|
119
|
-
: inputs.risks);
|
|
120
|
-
|
|
121
104
|
const taskSummary = (t) => (t.evidence !== undefined
|
|
122
105
|
? {
|
|
123
106
|
e: round2(t.e), sigma: round2(t.sigma), minutes: t.minutes, samples: t.samples,
|
|
@@ -125,30 +108,22 @@ const taskSummary = (t) => (t.evidence !== undefined
|
|
|
125
108
|
}
|
|
126
109
|
: { e: round2(t.e), sigma: round2(t.sigma) });
|
|
127
110
|
|
|
128
|
-
const computedBlock = (ctx) => ({
|
|
129
|
-
tasks: sortedMap(Object.entries(ctx.tasks).map(([id, t]) => [id, taskSummary(t)])),
|
|
130
|
-
features: ctx.features,
|
|
131
|
-
...(ctx.components ? { components: ctx.components } : {}),
|
|
132
|
-
devHours: round2(ctx.buffers.devHours),
|
|
133
|
-
overheadHours: round2(ctx.buffers.devHours * ctx.overheadPct),
|
|
134
|
-
spreadBufferHours: round2(ctx.buffers.spreadBufferHours),
|
|
135
|
-
riskBufferHours: round2(ctx.buffers.riskBufferHours),
|
|
136
|
-
scenarios: ctx.scenarios,
|
|
137
|
-
projectConfidence: criticalConfidence(ctx.summaries, ctx.tasks),
|
|
138
|
-
});
|
|
139
|
-
|
|
140
111
|
export function computeEstimation(inputs, measurements) {
|
|
141
|
-
const risks = normalizeRisks(inputs);
|
|
142
112
|
const tasks = isAgentic(inputs) ? buildAgenticTasks(inputs, measurements) : buildTasks(inputs);
|
|
143
|
-
const { features, summaries } = buildFeatures(inputs, tasks);
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const scenarios = sortedMap(inputs.scenarios.map((s) => [s.id, scenarioBlock(s, ctx)]));
|
|
113
|
+
const { features, summaries, priced } = buildFeatures(inputs, tasks);
|
|
114
|
+
const taskHours = Object.fromEntries(Object.entries(tasks).map(([id, t]) => [id, t.e]));
|
|
115
|
+
const roadmap = roadmapFor({ features: inputs.features, taskHours });
|
|
147
116
|
const components = componentHoursFor(inputs, features);
|
|
117
|
+
const price = projectPrice({ features: priced, levels: inputs.contextLevels ?? {} });
|
|
148
118
|
return {
|
|
149
119
|
inputs,
|
|
150
|
-
computed:
|
|
151
|
-
tasks
|
|
152
|
-
|
|
120
|
+
computed: {
|
|
121
|
+
tasks: sortedMap(Object.entries(tasks).map(([id, t]) => [id, taskSummary(t)])),
|
|
122
|
+
features,
|
|
123
|
+
...(components ? { components } : {}),
|
|
124
|
+
...(roadmap ? { roadmap } : {}),
|
|
125
|
+
price: roundedPrice(price),
|
|
126
|
+
projectConfidence: criticalConfidence(summaries, tasks),
|
|
127
|
+
},
|
|
153
128
|
};
|
|
154
129
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// checks here are the contract that keeps interview output honest before any
|
|
3
3
|
// arithmetic happens. Findings are strings with the offending id in them.
|
|
4
4
|
import { AI_CATEGORIES } from './estimate-math.mjs';
|
|
5
|
-
import {
|
|
5
|
+
import { checkContext } from './context-schema.mjs';
|
|
6
6
|
import { checkScoring } from './scoring-schema.mjs';
|
|
7
7
|
import { TASK_SHAPES } from './measurements.mjs';
|
|
8
8
|
|
|
@@ -53,6 +53,12 @@ function checkFeature(feature, out, agentic) {
|
|
|
53
53
|
}
|
|
54
54
|
if (!(feature.tasks?.length > 0)) out.push(`feature ${feature.id}: must have at least one task`);
|
|
55
55
|
for (const task of feature.tasks ?? []) (agentic ? checkAgenticTask(task, out) : checkTask(task, out));
|
|
56
|
+
// The waiver is an escape hatch from the one failure mode the pricing model
|
|
57
|
+
// has — a bare `true` must not buy a pass, so it has to carry a reason.
|
|
58
|
+
if (feature.deepEstimateWaiver !== undefined
|
|
59
|
+
&& !(typeof feature.deepEstimateWaiver === 'string' && feature.deepEstimateWaiver.trim())) {
|
|
60
|
+
out.push(`feature ${feature.id}: deepEstimateWaiver must be a non-empty string`);
|
|
61
|
+
}
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
// Roadmap is all-or-nothing: a half-labeled feature list would render a
|
|
@@ -123,7 +129,6 @@ function checkComponents(inputs, out) {
|
|
|
123
129
|
// optional (rollup.mjs falls back to `project`) but must be a real value
|
|
124
130
|
// when set — rung 1 of the retrieval ladder needs it to mean something.
|
|
125
131
|
function checkGlobals(inputs, out, agentic) {
|
|
126
|
-
if (!pct(inputs.overheadPct)) out.push('overheadPct must be a number in [0, 1)');
|
|
127
132
|
if (!agentic && !pct(inputs.verificationPct)) out.push('verificationPct must be a number in [0, 1)');
|
|
128
133
|
const ctx = inputs.agentContext;
|
|
129
134
|
if (agentic && typeof ctx === 'object' && ctx !== null && 'repository' in ctx
|
|
@@ -139,24 +144,34 @@ function checkGlobals(inputs, out, agentic) {
|
|
|
139
144
|
}
|
|
140
145
|
}
|
|
141
146
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
147
|
+
// Top-level shape: the five required keys, the removed ones that must be
|
|
148
|
+
// refused rather than silently ignored (an old inputs file may still carry
|
|
149
|
+
// them), and — in agentic mode — the agentContext the rest of the checks
|
|
150
|
+
// and rollup.mjs both depend on existing.
|
|
151
|
+
function checkTopLevel(inputs, out, agentic) {
|
|
145
152
|
if (inputs.deliveryMode !== undefined && !DELIVERY_MODES.includes(inputs.deliveryMode)) out.push('deliveryMode must be traditional|agentic');
|
|
146
|
-
for (const key of ['project', 'technique', 'features', 'risks', 'assumptions'
|
|
153
|
+
for (const key of ['project', 'technique', 'features', 'risks', 'assumptions']) {
|
|
147
154
|
if (!(key in inputs)) out.push(`missing top-level "${key}"`);
|
|
148
155
|
}
|
|
149
|
-
if (
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
156
|
+
if ('scenarios' in inputs) out.push('"scenarios" was removed — pricing no longer depends on team or rates');
|
|
157
|
+
if ('recommendedScenario' in inputs) out.push('"recommendedScenario" was removed with scenarios');
|
|
158
|
+
if ('overheadPct' in inputs) out.push('"overheadPct" was removed — overhead now comes from OVERHEADS in project-price.mjs');
|
|
159
|
+
if (!agentic) return;
|
|
160
|
+
const ctx = inputs.agentContext;
|
|
161
|
+
if (typeof ctx !== 'object' || ctx === null) { out.push('agentic mode requires top-level agentContext'); return; }
|
|
162
|
+
for (const key of ['agent', 'model']) {
|
|
163
|
+
if (!(typeof ctx[key] === 'string' && ctx[key].trim())) out.push(`agentContext.${key} must be a non-empty string`);
|
|
155
164
|
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function checkInputs(inputs) {
|
|
168
|
+
const out = [];
|
|
169
|
+
const agentic = isAgentic(inputs);
|
|
170
|
+
checkTopLevel(inputs, out, agentic);
|
|
156
171
|
for (const feature of inputs.features ?? []) checkFeature(feature, out, agentic);
|
|
157
172
|
checkMilestones(inputs.features ?? [], out);
|
|
158
173
|
checkComponents(inputs, out);
|
|
159
|
-
|
|
174
|
+
checkContext(inputs, out);
|
|
160
175
|
checkScoring(inputs, out);
|
|
161
176
|
checkGlobals(inputs, out, agentic);
|
|
162
177
|
return out;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
// "note" column come back. Anchors and cites travel beside each score so the
|
|
4
4
|
// reviewer sees the reason without opening anything else.
|
|
5
5
|
import { SCORE_FACTORS, scoreNumbers } from './scoring.mjs';
|
|
6
|
-
import { tierFor } from './
|
|
6
|
+
import { tierFor } from './pricing.mjs';
|
|
7
7
|
|
|
8
8
|
export const CSV_HEADERS = ['id', 'feature',
|
|
9
|
-
...SCORE_FACTORS.flatMap((k) => [k, `${k}_why`, `${k}_cite`]), '
|
|
9
|
+
...SCORE_FACTORS.flatMap((k) => [k, `${k}_why`, `${k}_cite`]), 'score', 'tier', 'why_this_tier', 'note'];
|
|
10
10
|
|
|
11
11
|
const quote = (v) => {
|
|
12
12
|
const s = String(v ?? '');
|
|
@@ -11,7 +11,7 @@ export function toHtml({ draft, template, guideHtml, mathSrc }) {
|
|
|
11
11
|
TITLE: draft.project ?? 'Estimate',
|
|
12
12
|
DATA: JSON.stringify(draft).replaceAll('</script', '<\\/script'),
|
|
13
13
|
GUIDE: guideHtml,
|
|
14
|
-
MATH: inlineModule(extractExports(mathSrc, ['
|
|
14
|
+
MATH: inlineModule(extractExports(mathSrc, ['WEIGHTS', 'BANDS', 'weightedScore', 'bandFor', 'tierFor'])),
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Factor scores are human judgments recorded in estimation-inputs.json.
|
|
2
2
|
// This module owns their vocabulary, the rubric loader (references/
|
|
3
3
|
// scoring-guide.md is the single source of anchor text), and the two
|
|
4
|
-
// derived facts compute copies into estimation.json:
|
|
4
|
+
// derived facts compute copies into estimation.json: score and tier.
|
|
5
5
|
import { readFileSync } from 'node:fs';
|
|
6
6
|
import { escapeHtml } from '../../../analyze-requirements/scripts/lib/md-inline.mjs';
|
|
7
|
-
import { tierFor } from './
|
|
7
|
+
import { tierFor } from './pricing.mjs';
|
|
8
8
|
|
|
9
9
|
export const SCORE_FACTORS = ['tech', 'size', 'deps', 'unc', 'risk'];
|
|
10
10
|
export const FACTOR_LABELS = {
|
|
@@ -43,7 +43,7 @@ if (findings.length) {
|
|
|
43
43
|
// quoted — so it rides along in both renders.
|
|
44
44
|
const figures = typeof args.figures === 'string' ? JSON.parse(readFileSync(args.figures, 'utf8')) : null;
|
|
45
45
|
const base = args['client-only'] ? redactForClient(estimation) : estimation;
|
|
46
|
-
const dataForEmbed = figures ? { ...base, figures: { cost: figures.cost,
|
|
46
|
+
const dataForEmbed = figures ? { ...base, figures: { cost: figures.cost, singleNumber: figures.singleNumber } } : base;
|
|
47
47
|
// Companion mode: --viewer carries the caller-known path back to the analyze-requirements
|
|
48
48
|
// viewer. It sits in the header's internal range, so the client render (which
|
|
49
49
|
// must not point at an internal document set) strips it with everything else.
|
|
@@ -17,7 +17,7 @@ function parseArgs(argv) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const templatePath = new URL('../assets/scores-review-template.html', import.meta.url).pathname;
|
|
20
|
-
const mathPath = new URL('./lib/
|
|
20
|
+
const mathPath = new URL('./lib/pricing.mjs', import.meta.url).pathname;
|
|
21
21
|
const json = (path) => JSON.parse(readFileSync(path, 'utf8'));
|
|
22
22
|
|
|
23
23
|
function write(args) {
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { execFileSync } from 'node:child_process';
|
|
5
|
+
import { tmpdir } from 'node:os';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { pathToFileURL } from 'node:url';
|
|
8
|
+
import { findChrome } from '../../../analyze-requirements/scripts/lib/chrome.mjs';
|
|
9
|
+
import { openPage } from '../../../analyze-requirements/scripts/lib/cdp.mjs';
|
|
10
|
+
|
|
11
|
+
const skip = { skip: !findChrome() && 'no chrome on PATH' };
|
|
12
|
+
const fixture = new URL('./fixtures/agentic-inputs.json', import.meta.url).pathname;
|
|
13
|
+
const passMd = new URL('./fixtures/agentic-estimation-pass.md', import.meta.url).pathname;
|
|
14
|
+
const measurementsFixture = new URL('./fixtures/measurements.jsonl', import.meta.url).pathname;
|
|
15
|
+
|
|
16
|
+
// Agentic estimation.json never carries scenarios or months (schema.mjs
|
|
17
|
+
// refuses `scenarios` outright), so this is the browser-level guard the
|
|
18
|
+
// team fixture already gets in browser.test.mjs: build the page, actually
|
|
19
|
+
// open it in Chrome and read the DOM, rather than pattern-matching template
|
|
20
|
+
// source or the embedded JSON blob the way render.test.mjs does.
|
|
21
|
+
function buildPage(extra = [], mutate = () => {}, mdExtra = '') {
|
|
22
|
+
const dir = mkdtempSync(join(tmpdir(), 'estimate-browser-agentic-'));
|
|
23
|
+
const scripts = new URL('..', import.meta.url).pathname;
|
|
24
|
+
const inputs = JSON.parse(readFileSync(fixture, 'utf8'));
|
|
25
|
+
inputs.measurementsPath = measurementsFixture;
|
|
26
|
+
mutate(inputs);
|
|
27
|
+
const inputsPath = join(dir, 'inputs.json');
|
|
28
|
+
writeFileSync(inputsPath, JSON.stringify(inputs));
|
|
29
|
+
const json = join(dir, 'estimation.json');
|
|
30
|
+
const md = join(dir, 'estimation.md');
|
|
31
|
+
writeFileSync(md, readFileSync(passMd, 'utf8') + mdExtra);
|
|
32
|
+
execFileSync('node', [join(scripts, 'compute.mjs'), '--inputs', inputsPath, '--out', json]);
|
|
33
|
+
execFileSync('node', [join(scripts, 'render.mjs'), '--json', json, '--md', md, '--out', dir, ...extra]);
|
|
34
|
+
return pathToFileURL(join(dir, 'estimate.html')).href;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// What a reader actually sees: a clone of <body> with <script>/<style> torn
|
|
38
|
+
// out, then its textContent. Not `document.body.textContent` (which walks
|
|
39
|
+
// the JS source and embedded JSON, so it flags a `$0`/`month` that only
|
|
40
|
+
// exists in a code comment — a false positive, not the leak this check is
|
|
41
|
+
// for). Not `innerText` either — that also drops nodes the client-view
|
|
42
|
+
// toggle hides via `display:none` without removing from the DOM
|
|
43
|
+
// ([data-internal]), which is exactly where a leaked `$0` would hide.
|
|
44
|
+
function readerText(page) {
|
|
45
|
+
return page.eval(`(() => {
|
|
46
|
+
const clone = document.body.cloneNode(true);
|
|
47
|
+
clone.querySelectorAll('script,style').forEach((n) => n.remove());
|
|
48
|
+
return clone.textContent;
|
|
49
|
+
})()`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// The binding user decision: agentic mode is not priced, and the page must
|
|
53
|
+
// never present a bare zero as if it were a quote. R50 keys this off
|
|
54
|
+
// computed.price.p50 === 0, which every agentic estimate hits today (no
|
|
55
|
+
// feature ever carries a score under this model).
|
|
56
|
+
async function assertUnpriced(page) {
|
|
57
|
+
assert.deepEqual(page.errors, []);
|
|
58
|
+
assert.match(await page.eval(`document.querySelector('#summary .lead')?.textContent`), /not priced/i);
|
|
59
|
+
assert.match(await page.eval(`document.querySelector('#summary .figures')?.textContent`), /\d+(\.\d+)? h$/);
|
|
60
|
+
const body = await readerText(page);
|
|
61
|
+
assert.doesNotMatch(body, /\$0\b/);
|
|
62
|
+
assert.doesNotMatch(body, /month/i);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
test('the agentic page renders measured hours and states plainly it is not priced', skip, async () => {
|
|
66
|
+
const page = await openPage(buildPage());
|
|
67
|
+
try { await assertUnpriced(page); } finally { page.close(); }
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('the --client-only agentic page renders the same unpriced state without throwing', skip, async () => {
|
|
71
|
+
const page = await openPage(buildPage(['--client-only']));
|
|
72
|
+
try { await assertUnpriced(page); } finally { page.close(); }
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// redact.mjs strips a task's provenance/assumptions (R49) and an evidence
|
|
76
|
+
// entry's description (R48) from the client render — taskRow/renderEvidence
|
|
77
|
+
// must not throw or print "undefined" once those keys are gone.
|
|
78
|
+
test('the client-only page tolerates redacted task fields without throwing', skip, async () => {
|
|
79
|
+
const page = await openPage(buildPage(['--client-only']));
|
|
80
|
+
try {
|
|
81
|
+
assert.deepEqual(page.errors, []);
|
|
82
|
+
assert.ok(await page.eval(`document.querySelectorAll('#detail tbody tr').length > 0`));
|
|
83
|
+
assert.doesNotMatch(await page.eval(`document.getElementById('detail').textContent`), /undefined/);
|
|
84
|
+
assert.doesNotMatch(await page.eval(`document.getElementById('evidence').textContent`), /undefined/);
|
|
85
|
+
} finally { page.close(); }
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// Milestone-tagged features do exist for agentic estimations even though the
|
|
89
|
+
// shared fixture carries none — the roadmap must draw the same share-of-effort
|
|
90
|
+
// bars the team page does, not the retired month Gantt.
|
|
91
|
+
const ROADMAP_MD = `
|
|
92
|
+
### Roadmap
|
|
93
|
+
|
|
94
|
+
Bands are relative shares of total effort, not durations.
|
|
95
|
+
|
|
96
|
+
| Milestone | Share |
|
|
97
|
+
| --- | --- |
|
|
98
|
+
| M1 - Plan | 50% |
|
|
99
|
+
| M2 - Swap | 50% |
|
|
100
|
+
`;
|
|
101
|
+
|
|
102
|
+
test('a milestone-tagged agentic estimate draws share-based roadmap bars, not months', skip, async () => {
|
|
103
|
+
const page = await openPage(buildPage([], (inputs) => {
|
|
104
|
+
inputs.features[0].milestone = 'M1 - Plan';
|
|
105
|
+
inputs.features[1].milestone = 'M2 - Swap';
|
|
106
|
+
}, ROADMAP_MD));
|
|
107
|
+
try {
|
|
108
|
+
assert.deepEqual(page.errors, []);
|
|
109
|
+
const shares = await page.eval(`[...document.querySelectorAll('#roadmap .roadmap-share')].map((s) => s.textContent)`);
|
|
110
|
+
assert.equal(shares.length, 2);
|
|
111
|
+
assert.ok(shares.every((s) => /%$/.test(s)), `expected percentages, got ${shares}`);
|
|
112
|
+
assert.equal(await page.eval(`document.querySelector('#roadmap .roadmap-months')`), null);
|
|
113
|
+
assert.doesNotMatch(await page.eval(`document.getElementById('roadmap').textContent`), /\bmo\b/);
|
|
114
|
+
} finally { page.close(); }
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// R51: recommendedReason is not scenario-specific (schema.mjs only refuses
|
|
118
|
+
// scenarios/recommendedScenario) and redact.mjs still strips it
|
|
119
|
+
// unconditionally from every client render — so the agentic page must render
|
|
120
|
+
// it internally, the way the team page's summaryApproach() does, and never
|
|
121
|
+
// carry it in the --client-only bytes.
|
|
122
|
+
test('a written approach note renders under the agentic summary, internal-only', skip, async () => {
|
|
123
|
+
const page = await openPage(buildPage([], (inputs) => {
|
|
124
|
+
inputs.recommendedReason = 'the client wants a spike before committing scope';
|
|
125
|
+
}));
|
|
126
|
+
try {
|
|
127
|
+
assert.equal(await page.eval(`document.querySelector('#summary .why')?.textContent`),
|
|
128
|
+
'Approach: the client wants a spike before committing scope.');
|
|
129
|
+
assert.ok(await page.eval(`document.querySelector('#summary .why')?.closest('[data-internal]')`),
|
|
130
|
+
'the approach note must be marked internal-only');
|
|
131
|
+
assert.deepEqual(page.errors, []);
|
|
132
|
+
} finally { page.close(); }
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test('the client-only agentic page does not carry the written approach note', skip, async () => {
|
|
136
|
+
const page = await openPage(buildPage(['--client-only'], (inputs) => {
|
|
137
|
+
inputs.recommendedReason = 'we quoted low to beat the incumbent bid';
|
|
138
|
+
}));
|
|
139
|
+
try {
|
|
140
|
+
assert.equal(await page.eval(`document.querySelector('#summary .why')`), null);
|
|
141
|
+
assert.deepEqual(page.errors, []);
|
|
142
|
+
} finally { page.close(); }
|
|
143
|
+
});
|