@viccydev/pi-fpa 0.2.0 → 0.3.0
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 +18 -3
- package/extensions/fpa-artifacts/contracts.ts +624 -0
- package/extensions/fpa-artifacts/index.ts +42 -0
- package/extensions/fpa-artifacts/store.ts +129 -0
- package/extensions/fpa-dashboard/actuals.ts +185 -0
- package/extensions/fpa-dashboard/index.ts +145 -0
- package/extensions/fpa-dashboard/projector.ts +482 -0
- package/extensions/fpa-dashboard/publisher.ts +170 -0
- package/extensions/fpa-dashboard/schema.ts +115 -0
- package/extensions/fpa-dashboard/source.ts +152 -0
- package/extensions/fpa-dashboard/status.ts +154 -0
- package/extensions/fpa-data/index.ts +2 -27
- package/extensions/fpa-data/registry.ts +3 -1
- package/extensions/fpa-data/runtime.ts +22 -0
- package/extensions/fpa-data/sql.ts +32 -0
- package/package.json +6 -4
- package/skills/fpa-execute-approved-strategy/SKILL.md +2 -2
- package/skills/fpa-execute-approved-strategy/references/artifact-contract.md +14 -1
- package/skills/fpa-forecast-approved-strategy/SKILL.md +2 -2
- package/skills/fpa-forecast-approved-strategy/references/artifact-contract.md +14 -4
- package/skills/fpa-refresh-dashboard/SKILL.md +29 -0
- package/skills/fpa-refresh-dashboard/references/dashboard-policy.md +12 -0
|
@@ -25,7 +25,7 @@ If approval evidence is absent, ambiguous, expired, conditional but unmet, or re
|
|
|
25
25
|
3. Recalculate future-period operating outcomes from that allocation using the declared model.
|
|
26
26
|
4. Provide downside, base, and upside values for each supported KPI.
|
|
27
27
|
5. Reconcile allocation totals, formulas, and cross-metric identities.
|
|
28
|
-
6.
|
|
28
|
+
6. Build the canonical `approved_cycle_forecast` input using [artifact-contract.md](references/artifact-contract.md), then call `fpa_artifact_commit`.
|
|
29
29
|
|
|
30
30
|
## Boundaries
|
|
31
31
|
|
|
@@ -36,4 +36,4 @@ If approval evidence is absent, ambiguous, expired, conditional but unmet, or re
|
|
|
36
36
|
|
|
37
37
|
## Completion
|
|
38
38
|
|
|
39
|
-
The planning workflow ends after
|
|
39
|
+
The planning workflow ends only after `fpa_artifact_commit` returns `status: committed` and an `immutable_fingerprint`. A Markdown report is optional context, not the frozen source of truth. Execution, if requested, is a separate workflow using `$fpa-execute-approved-strategy`. Review waits for the next cycle's Actuals and uses `$fpa-review-cycle`.
|
|
@@ -14,7 +14,13 @@ source_snapshot_ids: []
|
|
|
14
14
|
assumption_version: string
|
|
15
15
|
model_version: string
|
|
16
16
|
reporting_currency: string
|
|
17
|
-
approved_allocation:
|
|
17
|
+
approved_allocation:
|
|
18
|
+
- app_id: string
|
|
19
|
+
store: string
|
|
20
|
+
channel_group: string
|
|
21
|
+
baseline_spend: number | null
|
|
22
|
+
approved_spend: number
|
|
23
|
+
action: stop | decrease | hold | increase | explore
|
|
18
24
|
forecast_by_slice:
|
|
19
25
|
- app_id: string
|
|
20
26
|
store: string
|
|
@@ -25,12 +31,16 @@ forecast_by_slice:
|
|
|
25
31
|
base: number | null
|
|
26
32
|
upside: number | null
|
|
27
33
|
unit: string
|
|
28
|
-
window: string
|
|
34
|
+
window: string # exactly <start_inclusive>..<end_exclusive>@<timezone>
|
|
29
35
|
consolidated_forecast: {}
|
|
36
|
+
calibration_policy:
|
|
37
|
+
stop_loss_roas_lt: number
|
|
38
|
+
deviation_warning_abs_gte: number
|
|
39
|
+
deviation_trigger_abs_gt: number
|
|
40
|
+
policy_version: string
|
|
30
41
|
unsupported_metrics: []
|
|
31
42
|
reconciliation_checks: []
|
|
32
43
|
frozen_at: timestamp
|
|
33
|
-
immutable_fingerprint: string
|
|
34
44
|
```
|
|
35
45
|
|
|
36
|
-
|
|
46
|
+
Do not include `immutable_fingerprint` in the tool input. `fpa_artifact_commit` validates exact fields, approval state, allocation totals, every scenario's slice-to-consolidated totals, and supplied ROAS against aggregated revenue/spend. It computes the fingerprint and returns it after durable storage. The agent must not claim the artifact is frozen until that tool succeeds.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fpa-refresh-dashboard
|
|
3
|
+
description: Preview, validate, and atomically publish the forecast closed-loop FP&A dashboard from a committed approved forecast, optional execution receipt, and current read-only Actuals. Use when the user asks to inspect, rebuild, or publish the tenant dashboard.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# FP&A Dashboard Refresh
|
|
7
|
+
|
|
8
|
+
Load `$fpa-apply-core-rules` first. Follow [dashboard-policy.md](references/dashboard-policy.md).
|
|
9
|
+
|
|
10
|
+
## Entry gate
|
|
11
|
+
|
|
12
|
+
Require a committed `approved_cycle_forecast` for the target project. Treat a committed `execution_receipt` as optional execution evidence; never describe manual reported execution as independently verified.
|
|
13
|
+
|
|
14
|
+
## Procedure
|
|
15
|
+
|
|
16
|
+
1. Call `fpa_dashboard_status` to inspect the current generation and diagnostics.
|
|
17
|
+
2. Call `fpa_dashboard_refresh` with `preset: forecast-closed-loop-v1` and `mode: preview`.
|
|
18
|
+
3. Review the returned lineage, coverage, query receipts, warnings, widget list, and `preview_fingerprint`.
|
|
19
|
+
4. If the user asked only to inspect or preview, stop without publishing.
|
|
20
|
+
5. Publish only when the user explicitly asked to rebuild or publish the dashboard. Call the same tool with `mode: publish` and the exact preview fingerprint.
|
|
21
|
+
6. Report the published generation, source forecast fingerprint, data cutoff, warnings, and dashboard path.
|
|
22
|
+
|
|
23
|
+
## Boundaries
|
|
24
|
+
|
|
25
|
+
- Never write `.fpa-dashboard` with generic file or shell tools.
|
|
26
|
+
- Never fabricate Actuals, replace missing values with zero, or average row-level ratios.
|
|
27
|
+
- Do not edit the approved forecast during projection.
|
|
28
|
+
- If inputs change between preview and publish, preview again rather than bypassing the fingerprint check.
|
|
29
|
+
- This skill performs one bounded refresh; it does not continuously monitor the dashboard.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Dashboard projection policy
|
|
2
|
+
|
|
3
|
+
The dashboard is a deterministic projection, not a second planning model.
|
|
4
|
+
|
|
5
|
+
- Source of truth: committed `approved_cycle_forecast`, optional committed `execution_receipt`, and read-only Actuals returned by the FP&A data Extension. Like-for-like totals are scoped to the exact approved App + Store + Channel tuples; other paid slices generate warnings and stay out of forecast comparisons.
|
|
6
|
+
- Join grain: `app_id + store + channel_group`.
|
|
7
|
+
- Ratios: aggregate additive numerators and denominators first, then divide. Division by zero or unavailable inputs returns `NULL`.
|
|
8
|
+
- Coverage: retain the Actuals cutoff and query receipts. Planned slices with no Actuals remain null; paid Actuals outside the approved allocation are reported as warnings.
|
|
9
|
+
- Comparison: the prior-period window must contain the same number of covered calendar days as the current Actuals window, using the forecast timezone.
|
|
10
|
+
- Execution truth: `reported` means reported, not verified. Only `verified` external evidence may be labelled verified.
|
|
11
|
+
- Publication: preview first, then atomically publish content-addressed datasets and promote `manifest.json` last.
|
|
12
|
+
- Ownership: only `fpa_dashboard_refresh` may publish this projection.
|