@event4u/agent-config 8.12.0 → 9.0.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/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +164 -0
- package/README.md +1 -1
- package/dist/agent-src/commands/agent-handoff.md +35 -0
- package/dist/agent-src/commands/agents/init.md +1 -0
- package/dist/agent-src/commands/agents/optimize.md +1 -0
- package/dist/agent-src/commands/agents/user/accept.md +3 -2
- package/dist/agent-src/commands/agents/user/init.md +5 -4
- package/dist/agent-src/commands/agents/user/update.md +3 -2
- package/dist/agent-src/commands/agents/user.md +1 -0
- package/dist/agent-src/commands/agents.md +1 -0
- package/dist/agent-src/commands/analytics/show.md +1 -0
- package/dist/agent-src/commands/analytics.md +1 -0
- package/dist/agent-src/commands/analyze/decision.md +1 -0
- package/dist/agent-src/commands/analyze/incident.md +1 -0
- package/dist/agent-src/commands/analyze/near-miss.md +1 -0
- package/dist/agent-src/commands/analyze/postmortem.md +1 -0
- package/dist/agent-src/commands/analyze/premortem.md +1 -0
- package/dist/agent-src/commands/analyze/reference-repo.md +1 -0
- package/dist/agent-src/commands/analyze.md +3 -2
- package/dist/agent-src/commands/brand/identity.md +6 -5
- package/dist/agent-src/commands/brand/review.md +6 -5
- package/dist/agent-src/commands/brand/strategy.md +6 -4
- package/dist/agent-src/commands/brand/tokens.md +7 -6
- package/dist/agent-src/commands/brand/voice.md +5 -4
- package/dist/agent-src/commands/brand.md +9 -7
- package/dist/agent-src/commands/bug/fix.md +1 -0
- package/dist/agent-src/commands/bug/investigate.md +1 -0
- package/dist/agent-src/commands/bug.md +2 -1
- package/dist/agent-src/commands/challenge-me/vision.md +1 -0
- package/dist/agent-src/commands/challenge-me/with-docs.md +1 -0
- package/dist/agent-src/commands/challenge-me.md +28 -6
- package/dist/agent-src/commands/chat-history.md +1 -0
- package/dist/agent-src/commands/check-current-md.md +1 -0
- package/dist/agent-src/commands/commit.md +1 -0
- package/dist/agent-src/commands/context/create.md +3 -2
- package/dist/agent-src/commands/context.md +1 -0
- package/dist/agent-src/commands/cost/profile.md +1 -0
- package/dist/agent-src/commands/cost.md +2 -1
- package/dist/agent-src/commands/council/analysis.md +1 -0
- package/dist/agent-src/commands/council/debate.md +1 -0
- package/dist/agent-src/commands/council/default.md +21 -20
- package/dist/agent-src/commands/council/design.md +1 -0
- package/dist/agent-src/commands/council/optimize.md +1 -0
- package/dist/agent-src/commands/council/pr.md +1 -0
- package/dist/agent-src/commands/council.md +1 -0
- package/dist/agent-src/commands/estimate-ticket.md +1 -0
- package/dist/agent-src/commands/feature/dev.md +1 -0
- package/dist/agent-src/commands/feature/explore.md +1 -0
- package/dist/agent-src/commands/feature/plan.md +1 -0
- package/dist/agent-src/commands/feature/refactor.md +1 -0
- package/dist/agent-src/commands/feature/roadmap.md +1 -0
- package/dist/agent-src/commands/feature.md +2 -1
- package/dist/agent-src/commands/fix/pr-comments.md +19 -0
- package/dist/agent-src/commands/fix.md +2 -1
- package/dist/agent-src/commands/ghostwriter/delete.md +1 -0
- package/dist/agent-src/commands/ghostwriter/fetch.md +1 -0
- package/dist/agent-src/commands/ghostwriter/show.md +1 -0
- package/dist/agent-src/commands/ghostwriter/write.md +1 -0
- package/dist/agent-src/commands/ghostwriter.md +1 -0
- package/dist/agent-src/commands/grill-me.md +17 -12
- package/dist/agent-src/commands/humanize.md +1 -0
- package/dist/agent-src/commands/image/analyse.md +2 -1
- package/dist/agent-src/commands/image/create.md +1 -0
- package/dist/agent-src/commands/image/verify.md +1 -0
- package/dist/agent-src/commands/image.md +16 -12
- package/dist/agent-src/commands/implement-ticket.md +1 -0
- package/dist/agent-src/commands/judge/on-diff.md +1 -0
- package/dist/agent-src/commands/judge/solo.md +1 -0
- package/dist/agent-src/commands/judge/steps.md +1 -0
- package/dist/agent-src/commands/judge.md +1 -0
- package/dist/agent-src/commands/knowledge/cross-repo.md +1 -0
- package/dist/agent-src/commands/knowledge/forget.md +1 -0
- package/dist/agent-src/commands/knowledge/ingest.md +1 -0
- package/dist/agent-src/commands/knowledge/list.md +10 -0
- package/dist/agent-src/commands/knowledge.md +1 -0
- package/dist/agent-src/commands/memory/learn-low-impact.md +1 -0
- package/dist/agent-src/commands/memory/mine-session.md +1 -0
- package/dist/agent-src/commands/memory/promote.md +3 -2
- package/dist/agent-src/commands/memory.md +1 -0
- package/dist/agent-src/commands/mission/upgrade.md +45 -24
- package/dist/agent-src/commands/mode.md +1 -0
- package/dist/agent-src/commands/module/create.md +1 -0
- package/dist/agent-src/commands/module/explore.md +1 -0
- package/dist/agent-src/commands/module.md +1 -0
- package/dist/agent-src/commands/optimize/agents-dir.md +1 -0
- package/dist/agent-src/commands/optimize/project.md +1 -0
- package/dist/agent-src/commands/optimize/prompt.md +1 -0
- package/dist/agent-src/commands/optimize.md +2 -1
- package/dist/agent-src/commands/orchestrate.md +1 -0
- package/dist/agent-src/commands/override.md +1 -0
- package/dist/agent-src/commands/package.md +2 -1
- package/dist/agent-src/commands/post-as/ghostwriter.md +1 -0
- package/dist/agent-src/commands/post-as/me.md +1 -0
- package/dist/agent-src/commands/post-as.md +1 -0
- package/dist/agent-src/commands/pr/create/description-only.md +1 -0
- package/dist/agent-src/commands/pr/create.md +28 -0
- package/dist/agent-src/commands/prediction-pool.md +7 -6
- package/dist/agent-src/commands/prepare-for-review.md +1 -0
- package/dist/agent-src/commands/profile/activate.md +1 -0
- package/dist/agent-src/commands/profile/deactivate.md +1 -0
- package/dist/agent-src/commands/profile.md +1 -0
- package/dist/agent-src/commands/project.md +2 -1
- package/dist/agent-src/commands/refine-ticket.md +7 -0
- package/dist/agent-src/commands/research/deep.md +1 -0
- package/dist/agent-src/commands/research.md +1 -0
- package/dist/agent-src/commands/review/routing.md +1 -0
- package/dist/agent-src/commands/review.md +2 -1
- package/dist/agent-src/commands/roadmap/ai-council.md +1 -0
- package/dist/agent-src/commands/roadmap/materialize.md +1 -0
- package/dist/agent-src/commands/roadmap/process-full.md +1 -0
- package/dist/agent-src/commands/roadmap/process-phase.md +1 -0
- package/dist/agent-src/commands/roadmap/process-step.md +1 -0
- package/dist/agent-src/commands/roadmap.md +1 -0
- package/dist/agent-src/commands/security-audit-config.md +2 -1
- package/dist/agent-src/commands/skill/preview.md +1 -0
- package/dist/agent-src/commands/skill.md +1 -0
- package/dist/agent-src/commands/skills/discover.md +1 -0
- package/dist/agent-src/commands/skills.md +1 -0
- package/dist/agent-src/commands/sync/agent-settings.md +1 -0
- package/dist/agent-src/commands/sync.md +2 -1
- package/dist/agent-src/commands/team/adversarial.md +97 -0
- package/dist/agent-src/commands/team/delegate.md +110 -0
- package/dist/agent-src/commands/team/review.md +85 -0
- package/dist/agent-src/commands/team/status.md +123 -0
- package/dist/agent-src/commands/team-knowledge.md +8 -6
- package/dist/agent-src/commands/team.md +152 -0
- package/dist/agent-src/commands/tests/e2e-heal.md +1 -0
- package/dist/agent-src/commands/tests/e2e-plan.md +1 -0
- package/dist/agent-src/commands/tests/execute.md +1 -0
- package/dist/agent-src/commands/tests.md +2 -1
- package/dist/agent-src/commands/update-form-request-messages.md +1 -0
- package/dist/agent-src/commands/upstream-contribute.md +1 -0
- package/dist/agent-src/commands/video/from-script.md +3 -2
- package/dist/agent-src/commands/video/from-song.md +22 -21
- package/dist/agent-src/commands/video/scene.md +1 -0
- package/dist/agent-src/commands/video/stitch.md +2 -1
- package/dist/agent-src/commands/video/storyboard.md +1 -0
- package/dist/agent-src/commands/video.md +1 -0
- package/dist/agent-src/commands/work.md +1 -0
- package/dist/agent-src/commands/worktree/cleanup.md +8 -7
- package/dist/agent-src/commands/worktree/create.md +1 -0
- package/dist/agent-src/commands/worktree/verify.md +1 -0
- package/dist/agent-src/commands/worktree.md +1 -0
- package/dist/agent-src/rules/active-remediation.md +12 -36
- package/dist/agent-src/rules/artifact-drafting-protocol.md +7 -64
- package/dist/agent-src/rules/context-hygiene.md +19 -113
- package/dist/agent-src/rules/design-fidelity.md +4 -60
- package/dist/agent-src/rules/domain-adoption-policy.md +10 -106
- package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +12 -60
- package/dist/agent-src/rules/improve-before-implement.md +6 -0
- package/dist/agent-src/rules/minimal-safe-diff.md +6 -86
- package/dist/agent-src/rules/size-enforcement.md +10 -0
- package/dist/agent-src/rules/tool-safety.md +17 -3
- package/dist/agent-src/skills/agent-security-review/SKILL.md +12 -1
- package/dist/agent-src/skills/ai-council/SKILL.md +11 -0
- package/dist/agent-src/skills/bug-analyzer/SKILL.md +24 -2
- package/dist/agent-src/skills/code-review/SKILL.md +105 -93
- package/dist/agent-src/skills/code-review/checklists/backend.md +50 -0
- package/dist/agent-src/skills/code-review/checklists/database.md +19 -0
- package/dist/agent-src/skills/code-review/checklists/dependency.md +18 -0
- package/dist/agent-src/skills/code-review/checklists/docs.md +14 -0
- package/dist/agent-src/skills/code-review/checklists/frontend.md +19 -0
- package/dist/agent-src/skills/code-review/checklists/infra.md +17 -0
- package/dist/agent-src/skills/code-review/checklists/producing-the-review.md +62 -0
- package/dist/agent-src/skills/code-review/checklists/test-only.md +13 -0
- package/dist/agent-src/skills/code-review/evals/evals.json +53 -15
- package/dist/agent-src/skills/condense-memory/SKILL.md +3 -2
- package/dist/agent-src/skills/conventional-commits-writing/evals/evals.json +15 -0
- package/dist/agent-src/skills/docker/SKILL.md +10 -0
- package/dist/agent-src/skills/docx-authoring/SKILL.md +102 -0
- package/dist/agent-src/skills/github-ci/evals/evals.json +25 -0
- package/dist/agent-src/skills/humanizer/SKILL.md +79 -3
- package/dist/agent-src/skills/humanizer/references/anti-aiisms.md +112 -0
- package/dist/agent-src/skills/humanizer/references/fixtures.md +70 -0
- package/dist/agent-src/skills/judge-bug-hunter/SKILL.md +7 -1
- package/dist/agent-src/skills/laravel/SKILL.md +10 -0
- package/dist/agent-src/skills/launch-readiness/SKILL.md +35 -0
- package/dist/agent-src/skills/merge-conflicts/SKILL.md +30 -0
- package/dist/agent-src/skills/pdf-tools/SKILL.md +101 -0
- package/dist/agent-src/skills/quality-tools/evals/evals.json +15 -0
- package/dist/agent-src/skills/security-audit/SKILL.md +29 -0
- package/dist/agent-src/skills/security-maturity-assessment/SKILL.md +90 -0
- package/dist/agent-src/skills/security-maturity-assessment/evals/triggers.json +52 -0
- package/dist/agent-src/skills/skill-writing/SKILL.md +79 -0
- package/dist/agent-src/skills/spreadsheet-authoring/SKILL.md +11 -3
- package/dist/agent-src/skills/subagent-orchestration/schemas/team-review-status.json +103 -0
- package/dist/agent-src/skills/terraform/SKILL.md +10 -0
- package/dist/agent-src/skills/test-driven-development/SKILL.md +31 -0
- package/dist/agent-src/skills/threat-modeling/SKILL.md +15 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/scripts/telemetry/aggregator.ts +0 -0
- package/dist/agent-src/templates/scripts/telemetry/engagement.ts +30 -0
- package/dist/agent-src/templates/scripts/telemetry/report_renderer.ts +22 -9
- package/dist/agent-src/templates/scripts/telemetry_record.ts +5 -0
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +378 -174
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +4 -4
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +16 -8
- package/dist/discovery/trust-report.md +3 -3
- package/dist/discovery/workspaces.json +14 -6
- package/dist/install/install.mjs +46 -0
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/router.json +1 -1
- package/dist/scripts/condense.js +5 -0
- package/dist/scripts/condense.js.map +1 -1
- package/dist/server/schemas/settings.js +11 -0
- package/dist/server/schemas/settings.js.map +1 -1
- package/docs/CLAIMS.md +9 -2
- package/docs/SKILL_CENSUS.md +8 -0
- package/docs/architecture.md +3 -3
- package/docs/benchmark.md +67 -2
- package/docs/catalog.md +10 -4
- package/docs/command-flows.md +6 -1
- package/docs/contracts/ai-council-config.md +9 -2
- package/docs/contracts/ai-team-config.md +224 -0
- package/docs/contracts/command-clusters.md +1 -0
- package/docs/contracts/prelaunch-diagnostics.md +151 -0
- package/docs/contracts/release-pr-gating.md +1 -0
- package/docs/decisions/ADR-049-configuration-trust-boundary.md +9 -1
- package/docs/featured-skills.md +2 -2
- package/docs/getting-started-by-role.md +3 -1
- package/docs/getting-started.md +42 -1
- package/docs/governance-advantage.md +1 -1
- package/docs/guidelines/agent-infra/active-remediation-mechanics.md +45 -0
- package/docs/guidelines/agent-infra/agent-interaction-and-decision-quality.md +28 -0
- package/docs/guidelines/agent-infra/artifact-drafting-protocol-mechanics.md +76 -0
- package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +90 -0
- package/docs/guidelines/agent-infra/domain-adoption-gates.md +112 -0
- package/docs/guidelines/agent-infra/framework-neutrality-patterns.md +66 -0
- package/docs/guidelines/agent-infra/minimal-safe-diff-mechanics.md +99 -0
- package/docs/guidelines/agent-infra/skill-quality-checklist.md +13 -0
- package/docs/guidelines/design-fidelity-mechanics.md +76 -0
- package/docs/maintainers/branch-protection.md +18 -0
- package/docs/parity/command-frontmatter.md +60 -0
- package/docs/proof.md +7 -6
- package/package.json +1 -1
- package/src/agent-src/templates/scripts/telemetry/aggregator.ts +0 -0
- package/src/agent-src/templates/scripts/telemetry/engagement.ts +30 -0
- package/src/agent-src/templates/scripts/telemetry/report_renderer.ts +22 -9
- package/src/agent-src/templates/scripts/telemetry_record.ts +5 -0
- package/src/config/agent-settings.template.yml +71 -7
- package/src/config/prelaunch-areas.yml +36 -0
- package/src/scripts/_cli/cmd_doctor.ts +288 -1
- package/src/scripts/_lib/claude_plugin.ts +114 -4
- package/src/scripts/_lib/orchestration_record.ts +5 -0
- package/src/scripts/_lib/tool_adapter_registry.ts +120 -0
- package/src/scripts/ai_team/config.ts +234 -0
- package/src/scripts/ai_team/review_gate.ts +636 -0
- package/src/scripts/ai_team/team_dispatch.ts +612 -0
- package/src/scripts/bench_ab_task_runner.ts +11 -1
- package/src/scripts/bench_parity_count.ts +279 -0
- package/src/scripts/build_linear_digest.ts +3 -1
- package/src/scripts/check_bridge_derivation.ts +172 -0
- package/src/scripts/check_consumer_scope_flip.ts +179 -0
- package/src/scripts/check_council_config_location.ts +115 -15
- package/src/scripts/check_host_loadability.ts +81 -0
- package/src/scripts/condense.ts +5 -0
- package/src/scripts/hook_manifest.yaml +12 -1
- package/src/scripts/install.ts +39 -0
- package/src/scripts/lint_handoffs.ts +42 -0
- package/src/scripts/lint_skill_descriptions.ts +228 -0
- package/src/scripts/lint_skill_descriptions_allowlist.json +1 -0
- package/src/scripts/lint_skill_scripts_readonly.ts +145 -0
- package/src/scripts/lint_skill_scripts_readonly_allowlist.json +8 -0
- package/src/scripts/lint_supported_tools_matrix.ts +35 -0
- package/src/scripts/optimize_skill_description.ts +144 -0
- package/src/scripts/orchestration_record.ts +2 -1
- package/src/scripts/prelaunch_diagnostics.ts +248 -0
- package/src/scripts/rule_backlinks.ts +0 -0
- package/src/scripts/run_skill_evals.ts +70 -4
- package/src/scripts/schemas/command.schema.json +7 -0
- package/src/scripts/schemas/evals.schema.json +105 -14
- package/src/scripts/schemas/prelaunch-report.schema.json +107 -0
- package/src/scripts/schemas/skill.schema.json +18 -1
- package/src/scripts/schemas/subagent.schema.json +6 -0
- package/src/scripts/skill_linter.ts +43 -3
- package/src/scripts/smoke_host_loadability.sh +73 -0
- package/src/scripts/team_review_gate_hook.ts +115 -0
- package/src/scripts/trigger_eval_grandfather.json +1 -2
- package/src/scripts/utilization_report.ts +225 -0
- package/src/server/schemas/settings.ts +25 -0
|
@@ -93,6 +93,21 @@ For every distinct abuse case, answer:
|
|
|
93
93
|
Prioritize by **impact × plausibility**, not by novelty. Skip generic
|
|
94
94
|
OWASP bullets unless you can anchor them in a concrete file or line.
|
|
95
95
|
|
|
96
|
+
### 3b. STRIDE coverage check
|
|
97
|
+
|
|
98
|
+
Sweep the six STRIDE categories once against the change so no threat class is silently skipped. Each row names the question + control family the suite already teaches — anchor any hit in a concrete file per § 3.
|
|
99
|
+
|
|
100
|
+
| STRIDE category | Ask about this change | Control family (suite reference) |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| **S**poofing | Can an actor claim another identity on this path? | Authentication at the boundary; token/session verification — [`security`](../security/SKILL.md) |
|
|
103
|
+
| **T**ampering | Can the payload or stored state be modified in transit or at rest? | Request-boundary validation + signed webhooks + parameterized queries — [`laravel-validation`](../laravel-validation/SKILL.md) / [`sql-writing`](../sql-writing/SKILL.md) |
|
|
104
|
+
| **R**epudiation | Could the actor later deny having performed the action? | Audit logging of security events (actor + outcome, no credentials) — [`logging-monitoring`](../logging-monitoring/SKILL.md) |
|
|
105
|
+
| **I**nformation disclosure | What leaks if this path errors, over-serializes, or logs? | Field whitelisting + scrubbed errors/logs — [`domain-safety-pii`](../../rules/domain-safety-pii.md) |
|
|
106
|
+
| **D**enial of service | Can this path be made expensive or unbounded by an attacker? | Rate limiting + bounded queries/uploads — [`security-audit`](../security-audit/SKILL.md) § rate limiting, [`performance`](../performance/SKILL.md) |
|
|
107
|
+
| **E**levation of privilege | Can a lower-privilege actor reach a higher-privilege action or object? | Per-object authorization + tenant scope — [`authz-review`](../authz-review/SKILL.md), [`broken-access-control`](../../rules/broken-access-control.md) |
|
|
108
|
+
|
|
109
|
+
Category with no plausible abuse case for this change → mark "n/a — no boundary crossed", never silently omit.
|
|
110
|
+
|
|
96
111
|
### 4. Convert risks to engineering actions
|
|
97
112
|
|
|
98
113
|
For each prioritized abuse case, propose the **smallest effective control**
|
|
@@ -39,7 +39,7 @@ schema_version: 1
|
|
|
39
39
|
# CI guard: a release bump of `package.json` must update this value
|
|
40
40
|
# in lockstep — see scripts/check_template_pin_drift.ts (road-to-
|
|
41
41
|
# portable-runtime-and-update-check P3.3).
|
|
42
|
-
agent_config_version: "
|
|
42
|
+
agent_config_version: "9.0.0"
|
|
43
43
|
|
|
44
44
|
# --- Project identity ---
|
|
45
45
|
project:
|
|
Binary file
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
* "boundary_kind": "task" | "phase-step" | "tool-call",
|
|
16
16
|
* "consulted": {"skills": [...], "rules": [...], ...},
|
|
17
17
|
* "applied": {"skills": [...], "rules": [...], ...},
|
|
18
|
+
* "loaded": {"skills": [...], "rules": [...], ...} # optional (U1a):
|
|
19
|
+
* what was AVAILABLE/INJECTED at the boundary — the Fired/Loaded
|
|
20
|
+
* denominator. Superset contract: consulted ⊆ loaded. Ids only
|
|
21
|
+
* (same PII-exclusion-by-construction shape as consulted).
|
|
18
22
|
* "outcomes": ["blocked", "verification_failed", ...] # optional
|
|
19
23
|
* "tokens_estimate": {"consulted_load": <int>} # optional
|
|
20
24
|
* }
|
|
@@ -127,6 +131,7 @@ export interface EngagementEventInit {
|
|
|
127
131
|
boundary_kind: string;
|
|
128
132
|
consulted?: Record<string, string[]>;
|
|
129
133
|
applied?: Record<string, string[]>;
|
|
134
|
+
loaded?: Record<string, string[]> | null;
|
|
130
135
|
outcomes?: string[] | null;
|
|
131
136
|
tokens_estimate?: Record<string, number> | null;
|
|
132
137
|
schema_version?: number;
|
|
@@ -138,6 +143,7 @@ export class EngagementEvent {
|
|
|
138
143
|
boundary_kind: string;
|
|
139
144
|
consulted: Record<string, string[]>;
|
|
140
145
|
applied: Record<string, string[]>;
|
|
146
|
+
loaded: Record<string, string[]> | null;
|
|
141
147
|
outcomes: string[] | null;
|
|
142
148
|
tokens_estimate: Record<string, number> | null;
|
|
143
149
|
schema_version: number;
|
|
@@ -148,6 +154,7 @@ export class EngagementEvent {
|
|
|
148
154
|
this.boundary_kind = init.boundary_kind;
|
|
149
155
|
this.consulted = init.consulted ?? {};
|
|
150
156
|
this.applied = init.applied ?? {};
|
|
157
|
+
this.loaded = init.loaded ?? null;
|
|
151
158
|
this.outcomes = init.outcomes ?? null;
|
|
152
159
|
this.tokens_estimate = init.tokens_estimate ?? null;
|
|
153
160
|
this.schema_version = init.schema_version ?? SCHEMA_VERSION;
|
|
@@ -171,6 +178,20 @@ export class EngagementEvent {
|
|
|
171
178
|
}
|
|
172
179
|
_validate_artefact_dict('consulted', this.consulted);
|
|
173
180
|
_validate_artefact_dict('applied', this.applied);
|
|
181
|
+
if (this.loaded !== null) {
|
|
182
|
+
_validate_artefact_dict('loaded', this.loaded);
|
|
183
|
+
for (const [kind, ids] of Object.entries(this.consulted)) {
|
|
184
|
+
const avail = new Set(this.loaded[kind] ?? []);
|
|
185
|
+
for (const art_id of ids) {
|
|
186
|
+
if (!avail.has(art_id)) {
|
|
187
|
+
throw new EngagementSchemaError(
|
|
188
|
+
`consulted.${kind} id '${art_id}' missing from loaded.${kind}; `
|
|
189
|
+
+ 'superset contract: consulted \u2286 loaded',
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
174
195
|
if (this.outcomes !== null) {
|
|
175
196
|
_validate_outcomes(this.outcomes);
|
|
176
197
|
}
|
|
@@ -206,6 +227,12 @@ export class EngagementEvent {
|
|
|
206
227
|
consulted: _normalise_artefact_dict(this.consulted),
|
|
207
228
|
applied: _normalise_artefact_dict(this.applied),
|
|
208
229
|
};
|
|
230
|
+
if (this.loaded !== null) {
|
|
231
|
+
const norm = _normalise_artefact_dict(this.loaded);
|
|
232
|
+
if (Object.keys(norm).length > 0) {
|
|
233
|
+
out['loaded'] = norm;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
209
236
|
if (this.outcomes && this.outcomes.length > 0) {
|
|
210
237
|
out['outcomes'] = [...this.outcomes];
|
|
211
238
|
}
|
|
@@ -310,6 +337,9 @@ export function parse_event(line: string): EngagementEvent {
|
|
|
310
337
|
boundary_kind: (r['boundary_kind'] as string) ?? '',
|
|
311
338
|
consulted: _orEmptyDict(r['consulted']),
|
|
312
339
|
applied: _orEmptyDict(r['applied']),
|
|
340
|
+
loaded: r['loaded'] === undefined || r['loaded'] === null
|
|
341
|
+
? null
|
|
342
|
+
: _orEmptyDict(r['loaded']),
|
|
313
343
|
outcomes: (r['outcomes'] as string[] | null | undefined) ?? null,
|
|
314
344
|
tokens_estimate: (r['tokens_estimate'] as Record<string, number> | null | undefined) ?? null,
|
|
315
345
|
schema_version: r['schema_version'] === undefined
|
|
@@ -121,15 +121,19 @@ export function render_markdown(aggregate: AggregateResult, opts: RenderOptions
|
|
|
121
121
|
lines.push('');
|
|
122
122
|
continue;
|
|
123
123
|
}
|
|
124
|
-
|
|
125
|
-
lines.push(
|
|
124
|
+
const withLoaded = aggregate.loaded_events > 0;
|
|
125
|
+
lines.push(withLoaded
|
|
126
|
+
? '| kind | id | loaded | consulted | applied | fired/loaded | applied/consulted | last seen |'
|
|
127
|
+
: '| kind | id | consulted | applied | applied/consulted | last seen |');
|
|
128
|
+
lines.push(withLoaded ? '|---|---|---:|---:|---:|---:|---:|---|' : '|---|---|---:|---:|---:|---|');
|
|
126
129
|
for (const entry of rows) {
|
|
127
130
|
const s = entry.stat;
|
|
128
131
|
check_id_redaction(`buckets.${s.kind}.id`, s.artefact_id);
|
|
129
|
-
lines.push(
|
|
130
|
-
`| ${s.kind} | \`${s.artefact_id}\` | ${s.consulted} | ${s.applied} `
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
lines.push(withLoaded
|
|
133
|
+
? `| ${s.kind} | \`${s.artefact_id}\` | ${s.loaded} | ${s.consulted} | ${s.applied} `
|
|
134
|
+
+ `| ${_pyFixed(s.fired_ratio, 2)} | ${_pyFixed(s.applied_ratio, 2)} | \`${s.last_seen_ts}\` |`
|
|
135
|
+
: `| ${s.kind} | \`${s.artefact_id}\` | ${s.consulted} | ${s.applied} `
|
|
136
|
+
+ `| ${_pyFixed(s.applied_ratio, 2)} | \`${s.last_seen_ts}\` |`);
|
|
133
137
|
}
|
|
134
138
|
lines.push('');
|
|
135
139
|
}
|
|
@@ -147,7 +151,9 @@ export function render_json(aggregate: AggregateResult, opts: RenderOptions = {}
|
|
|
147
151
|
[BUCKET_BOTTOM]: [],
|
|
148
152
|
};
|
|
149
153
|
for (const entry of bucketed) {
|
|
150
|
-
(grouped[entry.bucket] as Array<Record<string, unknown>>).push(
|
|
154
|
+
(grouped[entry.bucket] as Array<Record<string, unknown>>).push(
|
|
155
|
+
_stat_to_dict(entry.stat, aggregate.loaded_events > 0),
|
|
156
|
+
);
|
|
151
157
|
}
|
|
152
158
|
if (top !== null) {
|
|
153
159
|
for (const bucket of Object.keys(grouped)) {
|
|
@@ -179,9 +185,9 @@ export function render_json(aggregate: AggregateResult, opts: RenderOptions = {}
|
|
|
179
185
|
return `${_py_json_dumps_indent2_sorted(payload)}\n`;
|
|
180
186
|
}
|
|
181
187
|
|
|
182
|
-
function _stat_to_dict(stat: ArtefactStat): Record<string, unknown> {
|
|
188
|
+
function _stat_to_dict(stat: ArtefactStat, withLoaded = false): Record<string, unknown> {
|
|
183
189
|
check_id_redaction(`buckets.${stat.kind}.id`, stat.artefact_id);
|
|
184
|
-
|
|
190
|
+
const out: Record<string, unknown> = {
|
|
185
191
|
kind: stat.kind,
|
|
186
192
|
id: stat.artefact_id,
|
|
187
193
|
consulted: stat.consulted,
|
|
@@ -189,6 +195,13 @@ function _stat_to_dict(stat: ArtefactStat): Record<string, unknown> {
|
|
|
189
195
|
applied_ratio: new PyFloat(_pyRound(stat.applied_ratio, 4)),
|
|
190
196
|
last_seen_ts: stat.last_seen_ts,
|
|
191
197
|
};
|
|
198
|
+
// U1a: emitted only when the log carries the loaded denominator, so
|
|
199
|
+
// pre-U1a logs render byte-identically to the frozen parity oracle.
|
|
200
|
+
if (withLoaded) {
|
|
201
|
+
out['loaded'] = stat.loaded;
|
|
202
|
+
out['fired_ratio'] = new PyFloat(_pyRound(stat.fired_ratio, 4));
|
|
203
|
+
}
|
|
204
|
+
return out;
|
|
192
205
|
}
|
|
193
206
|
|
|
194
207
|
// ── Python-parity helpers ───────────────────────────────────────────────
|
|
@@ -63,6 +63,7 @@ interface RecordArgs {
|
|
|
63
63
|
boundary: string;
|
|
64
64
|
consulted: string[] | null;
|
|
65
65
|
applied: string[] | null;
|
|
66
|
+
loaded: string[] | null;
|
|
66
67
|
outcome: string[] | null;
|
|
67
68
|
ts: string;
|
|
68
69
|
payload_file: string | null;
|
|
@@ -78,6 +79,7 @@ function _build_event_from_args(args: RecordArgs): EngagementEvent {
|
|
|
78
79
|
boundary_kind: args.boundary,
|
|
79
80
|
consulted: _parse_kv_list(args.consulted ?? []),
|
|
80
81
|
applied: _parse_kv_list(args.applied ?? []),
|
|
82
|
+
loaded: args.loaded && args.loaded.length > 0 ? _parse_kv_list(args.loaded) : null,
|
|
81
83
|
outcomes: args.outcome && args.outcome.length > 0 ? [...args.outcome] : null,
|
|
82
84
|
});
|
|
83
85
|
}
|
|
@@ -101,6 +103,7 @@ function _build_event_from_payload(raw: string): EngagementEvent {
|
|
|
101
103
|
boundary_kind: (d['boundary_kind'] as string) ?? '',
|
|
102
104
|
consulted: _orEmpty(d['consulted']),
|
|
103
105
|
applied: _orEmpty(d['applied']),
|
|
106
|
+
loaded: d['loaded'] === undefined || d['loaded'] === null ? null : _orEmpty(d['loaded']),
|
|
104
107
|
outcomes: (d['outcomes'] as string[] | null | undefined) ?? null,
|
|
105
108
|
tokens_estimate: (d['tokens_estimate'] as Record<string, number> | null | undefined) ?? null,
|
|
106
109
|
});
|
|
@@ -121,6 +124,7 @@ function _parseArgs(argv: string[]): RecordArgs {
|
|
|
121
124
|
boundary: 'task',
|
|
122
125
|
consulted: null,
|
|
123
126
|
applied: null,
|
|
127
|
+
loaded: null,
|
|
124
128
|
outcome: null,
|
|
125
129
|
ts: '',
|
|
126
130
|
payload_file: null,
|
|
@@ -155,6 +159,7 @@ function _parseArgs(argv: string[]): RecordArgs {
|
|
|
155
159
|
}
|
|
156
160
|
a.boundary = v;
|
|
157
161
|
} else if (tok === '--consulted') (a.consulted ??= []).push(next());
|
|
162
|
+
else if (tok === '--loaded') (a.loaded ??= []).push(next());
|
|
158
163
|
else if (tok === '--applied') (a.applied ??= []).push(next());
|
|
159
164
|
else if (tok === '--outcome') {
|
|
160
165
|
const v = next();
|