avorelo 0.1.0 → 0.2.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/LICENSE +23 -16
- package/README.md +91 -51
- package/bin/avorelo.mjs +7 -0
- package/dist/avorelo.mjs +14337 -0
- package/package.json +106 -120
- package/bin/avorelo +0 -9
- package/scripts/README.md +0 -40
- package/scripts/cco-dashboard.js +0 -252
- package/scripts/cco-status.js +0 -430
- package/scripts/lib/activation/account-state.js +0 -37
- package/scripts/lib/activation/activation-runner.js +0 -546
- package/scripts/lib/activation/activation-self-healing.js +0 -480
- package/scripts/lib/activation/activation-state.js +0 -83
- package/scripts/lib/activation/activation-summary.js +0 -191
- package/scripts/lib/activation/adapters/claude-code.js +0 -77
- package/scripts/lib/activation/adapters/codex-cli.js +0 -52
- package/scripts/lib/activation/adapters/cursor.js +0 -37
- package/scripts/lib/activation/adapters/github-agent.js +0 -39
- package/scripts/lib/activation/adapters/terminal.js +0 -42
- package/scripts/lib/activation/adapters/vscode.js +0 -39
- package/scripts/lib/activation/adapters/windsurf.js +0 -37
- package/scripts/lib/activation/ai-surface-detector.js +0 -151
- package/scripts/lib/activation/connect-account.js +0 -145
- package/scripts/lib/activation/detect-environment.js +0 -75
- package/scripts/lib/activation/detect-hosts.js +0 -62
- package/scripts/lib/activation/format-activation-output.js +0 -109
- package/scripts/lib/activation/next-action.js +0 -43
- package/scripts/lib/activation/repair-engine.js +0 -219
- package/scripts/lib/activation-distribution-readiness.js +0 -507
- package/scripts/lib/adapter-conformance.js +0 -176
- package/scripts/lib/adapter-readiness.js +0 -417
- package/scripts/lib/adapter-safety-boundaries.js +0 -335
- package/scripts/lib/adapter-technical-readiness-gate.js +0 -205
- package/scripts/lib/agent-access-governance.js +0 -455
- package/scripts/lib/agent-enforcement.js +0 -765
- package/scripts/lib/agent-policy-profile.js +0 -210
- package/scripts/lib/agent-security/action-evaluator.js +0 -507
- package/scripts/lib/agent-security/adapter-registry.js +0 -98
- package/scripts/lib/agent-security/auto-policy.js +0 -139
- package/scripts/lib/agent-security/bounded-scan.js +0 -93
- package/scripts/lib/agent-security/enforcement-adapter.js +0 -174
- package/scripts/lib/agent-security/enforcement-engine.js +0 -1129
- package/scripts/lib/agent-security/file-write-adapter.js +0 -183
- package/scripts/lib/agent-security/file-write-rules.js +0 -178
- package/scripts/lib/agent-security/index.js +0 -3342
- package/scripts/lib/agent-security/instruction-risk.js +0 -181
- package/scripts/lib/agent-security/mcp-action-adapter.js +0 -185
- package/scripts/lib/agent-security/mcp-action-rules.js +0 -184
- package/scripts/lib/agent-security/package-action-adapter.js +0 -175
- package/scripts/lib/agent-security/package-action-rules.js +0 -233
- package/scripts/lib/agent-security/performance.js +0 -148
- package/scripts/lib/agent-security/permission-minimizer.js +0 -403
- package/scripts/lib/agent-security/scan-cache.js +0 -74
- package/scripts/lib/agent-security/source-trust.js +0 -146
- package/scripts/lib/ai-install-prompt.js +0 -288
- package/scripts/lib/ai-workspace-hygiene.js +0 -1499
- package/scripts/lib/alpha-activation.js +0 -520
- package/scripts/lib/alpha-feedback.js +0 -263
- package/scripts/lib/alpha-readiness-gate.js +0 -332
- package/scripts/lib/anti-gaming.js +0 -169
- package/scripts/lib/artifact-health.js +0 -431
- package/scripts/lib/attribution.js +0 -180
- package/scripts/lib/audit.js +0 -289
- package/scripts/lib/avorelo-skill-registry.js +0 -810
- package/scripts/lib/batch-jobs.js +0 -71
- package/scripts/lib/brain-pack.js +0 -578
- package/scripts/lib/brand-boundary.js +0 -424
- package/scripts/lib/brand.js +0 -74
- package/scripts/lib/browser-capability.js +0 -1048
- package/scripts/lib/browser-proof-preflight.js +0 -321
- package/scripts/lib/cache-readiness.js +0 -187
- package/scripts/lib/canonical-reentry.js +0 -162
- package/scripts/lib/capability-packs.js +0 -314
- package/scripts/lib/capability-recommender.js +0 -512
- package/scripts/lib/capability-registry.js +0 -1059
- package/scripts/lib/carry-forward-surfacing.js +0 -194
- package/scripts/lib/ccusage-adapter.js +0 -188
- package/scripts/lib/company-loop.js +0 -1149
- package/scripts/lib/config.js +0 -637
- package/scripts/lib/context-acquisition-plan.js +0 -287
- package/scripts/lib/context-budget-guard.js +0 -170
- package/scripts/lib/context-budget-scanner.js +0 -257
- package/scripts/lib/context-optimizer.js +0 -715
- package/scripts/lib/context-reduction-plan.js +0 -178
- package/scripts/lib/context-safety.js +0 -88
- package/scripts/lib/context-savings-engine.js +0 -158
- package/scripts/lib/cost-evidence.js +0 -254
- package/scripts/lib/cross-host-install-plan.js +0 -308
- package/scripts/lib/cross-host-install-readiness.js +0 -237
- package/scripts/lib/cross-host-value-flow.js +0 -268
- package/scripts/lib/dashboard.js +0 -900
- package/scripts/lib/design-partner-feedback.js +0 -346
- package/scripts/lib/entitlements.js +0 -100
- package/scripts/lib/execution-packet.js +0 -559
- package/scripts/lib/experimentation-events.js +0 -547
- package/scripts/lib/external-capability-compliance.js +0 -107
- package/scripts/lib/external-user-simulation.js +0 -166
- package/scripts/lib/failure-recovery-readiness.js +0 -81
- package/scripts/lib/failure-recovery.js +0 -419
- package/scripts/lib/feedback-intelligence.js +0 -537
- package/scripts/lib/feedback-signals.js +0 -205
- package/scripts/lib/file-integrity.js +0 -68
- package/scripts/lib/fsx.js +0 -127
- package/scripts/lib/full-readiness-gate.js +0 -451
- package/scripts/lib/guidance-builder.js +0 -174
- package/scripts/lib/hook-apply.js +0 -1019
- package/scripts/lib/hook-baseline.js +0 -310
- package/scripts/lib/hook-config-preview.js +0 -275
- package/scripts/lib/hook-contracts.js +0 -290
- package/scripts/lib/hook-safety-boundary-readiness.js +0 -80
- package/scripts/lib/host-capability-matrix.js +0 -351
- package/scripts/lib/host-support-context.js +0 -254
- package/scripts/lib/http-hook-action.js +0 -538
- package/scripts/lib/install-ai-readiness.js +0 -84
- package/scripts/lib/install-intake-risk.js +0 -1037
- package/scripts/lib/install-journey-intelligence.js +0 -329
- package/scripts/lib/intervention-guidance.js +0 -57
- package/scripts/lib/known-limitations.js +0 -115
- package/scripts/lib/l8-path-truth.js +0 -146
- package/scripts/lib/launch-hardening-gate.js +0 -436
- package/scripts/lib/launch-readiness.js +0 -628
- package/scripts/lib/learning-memory.js +0 -686
- package/scripts/lib/lifecycle-hooks.js +0 -802
- package/scripts/lib/local-package-smoke.js +0 -423
- package/scripts/lib/local-pricing.js +0 -299
- package/scripts/lib/mcp-enforcement.js +0 -311
- package/scripts/lib/mcp-least-privilege-policy.js +0 -303
- package/scripts/lib/mcp-tool-inventory.js +0 -388
- package/scripts/lib/mcp-tool-risk.js +0 -0
- package/scripts/lib/memory.js +0 -335
- package/scripts/lib/metrics.js +0 -699
- package/scripts/lib/micro-proof.js +0 -133
- package/scripts/lib/next-run-context.js +0 -436
- package/scripts/lib/operating-value.js +0 -1648
- package/scripts/lib/optimization-v3.js +0 -122
- package/scripts/lib/orchestration/adapters/_shared.js +0 -49
- package/scripts/lib/orchestration/adapters/aider.js +0 -18
- package/scripts/lib/orchestration/adapters/claude-code.js +0 -35
- package/scripts/lib/orchestration/adapters/codex.js +0 -35
- package/scripts/lib/orchestration/adapters/gemini-cli.js +0 -18
- package/scripts/lib/orchestration/adapters/git.js +0 -25
- package/scripts/lib/orchestration/adapters/index.js +0 -31
- package/scripts/lib/orchestration/adapters/lm-studio.js +0 -18
- package/scripts/lib/orchestration/adapters/ollama.js +0 -18
- package/scripts/lib/orchestration/adapters/opencode.js +0 -18
- package/scripts/lib/orchestration/adapters/openrouter.js +0 -18
- package/scripts/lib/orchestration/adapters/test-runner.js +0 -25
- package/scripts/lib/orchestration/cli.js +0 -438
- package/scripts/lib/orchestration/execution-manager.js +0 -279
- package/scripts/lib/orchestration/handoff.js +0 -314
- package/scripts/lib/orchestration/index.js +0 -456
- package/scripts/lib/orchestration/inventory.js +0 -47
- package/scripts/lib/orchestration/model-discovery.js +0 -498
- package/scripts/lib/orchestration/model-profiler.js +0 -170
- package/scripts/lib/orchestration/model-profiles.js +0 -252
- package/scripts/lib/orchestration/model-refresh-policy.js +0 -72
- package/scripts/lib/orchestration/proof-writer.js +0 -349
- package/scripts/lib/orchestration/provider-discovery/aider.js +0 -49
- package/scripts/lib/orchestration/provider-discovery/claude-code.js +0 -56
- package/scripts/lib/orchestration/provider-discovery/codex.js +0 -49
- package/scripts/lib/orchestration/provider-discovery/common.js +0 -186
- package/scripts/lib/orchestration/provider-discovery/gemini.js +0 -106
- package/scripts/lib/orchestration/provider-discovery/lm-studio.js +0 -118
- package/scripts/lib/orchestration/provider-discovery/models-dev.js +0 -12
- package/scripts/lib/orchestration/provider-discovery/ollama.js +0 -100
- package/scripts/lib/orchestration/provider-discovery/opencode.js +0 -47
- package/scripts/lib/orchestration/provider-discovery/openrouter.js +0 -44
- package/scripts/lib/orchestration/risk-classifier.js +0 -130
- package/scripts/lib/orchestration/routing-policy.js +0 -486
- package/scripts/lib/orchestration/settings.js +0 -112
- package/scripts/lib/orchestration/state.js +0 -165
- package/scripts/lib/orchestration/verification-manager.js +0 -138
- package/scripts/lib/output-profiles.js +0 -146
- package/scripts/lib/package-content-audit.js +0 -368
- package/scripts/lib/package-runtime.js +0 -278
- package/scripts/lib/plan-surface.js +0 -53
- package/scripts/lib/plans.js +0 -2318
- package/scripts/lib/policy-provider.js +0 -27
- package/scripts/lib/prelaunch-activation-readiness.js +0 -409
- package/scripts/lib/prelaunch-evidence-store.js +0 -816
- package/scripts/lib/prelaunch-intelligence.js +0 -869
- package/scripts/lib/pricing-experiment.js +0 -118
- package/scripts/lib/pro-moment-events.js +0 -77
- package/scripts/lib/pro-moment-state.js +0 -227
- package/scripts/lib/pro-moments.js +0 -1216
- package/scripts/lib/product-learning-events.js +0 -629
- package/scripts/lib/project-profile.js +0 -555
- package/scripts/lib/prompt-compiler.js +0 -280
- package/scripts/lib/prompt-lint.js +0 -32
- package/scripts/lib/prompt-suggestions.js +0 -52
- package/scripts/lib/proof-canonical.js +0 -398
- package/scripts/lib/proof-drilldown.js +0 -383
- package/scripts/lib/proof-events.js +0 -342
- package/scripts/lib/proof-history.js +0 -243
- package/scripts/lib/proof-metrics.js +0 -296
- package/scripts/lib/proof-outcome-evidence.js +0 -134
- package/scripts/lib/proof-receipt.js +0 -335
- package/scripts/lib/proof-record.js +0 -461
- package/scripts/lib/public-activation-distribution-gate.js +0 -258
- package/scripts/lib/public-cli.js +0 -3891
- package/scripts/lib/public-distribution-truth.js +0 -211
- package/scripts/lib/public-install-claim-checker.js +0 -294
- package/scripts/lib/publish-provenance-readiness.js +0 -283
- package/scripts/lib/readiness-delta.js +0 -218
- package/scripts/lib/readiness-evidence-closure.js +0 -196
- package/scripts/lib/reentry-memory-capture.js +0 -241
- package/scripts/lib/reentry-memory-retrieval.js +0 -302
- package/scripts/lib/reentry-memory-status.js +0 -146
- package/scripts/lib/reentry-memory-store.js +0 -178
- package/scripts/lib/reentry-state.js +0 -66
- package/scripts/lib/release-candidate-bundle.js +0 -166
- package/scripts/lib/remediation.js +0 -81
- package/scripts/lib/repo-map.js +0 -391
- package/scripts/lib/run-improvements-lifecycle.js +0 -330
- package/scripts/lib/run-improvements.js +0 -789
- package/scripts/lib/runtime-decision-policy.js +0 -387
- package/scripts/lib/safe-path-engine.js +0 -705
- package/scripts/lib/safe-run-controller.js +0 -887
- package/scripts/lib/score.js +0 -262
- package/scripts/lib/seamless-enforcement.js +0 -329
- package/scripts/lib/seamless-outcome.js +0 -689
- package/scripts/lib/seamless-reality-gate.js +0 -5043
- package/scripts/lib/security-risk-classifier.js +0 -511
- package/scripts/lib/security-scan.js +0 -384
- package/scripts/lib/session-context-optimizer.js +0 -1211
- package/scripts/lib/session-timing.js +0 -315
- package/scripts/lib/skill-hygiene.js +0 -805
- package/scripts/lib/skill-packs.js +0 -161
- package/scripts/lib/skills-operating-layer.js +0 -580
- package/scripts/lib/smart-work-routing.js +0 -768
- package/scripts/lib/source-catalog.js +0 -700
- package/scripts/lib/status-value-summary.js +0 -32
- package/scripts/lib/support-bundle.js +0 -578
- package/scripts/lib/task-continuation.js +0 -440
- package/scripts/lib/test-helpers.js +0 -15
- package/scripts/lib/tier.js +0 -38
- package/scripts/lib/token-context-quality-gate.js +0 -370
- package/scripts/lib/token-cost-capture.js +0 -187
- package/scripts/lib/token-cost-intelligence.js +0 -358
- package/scripts/lib/token-efficiency-evidence.js +0 -213
- package/scripts/lib/token-evidence.js +0 -699
- package/scripts/lib/tokenish.js +0 -17
- package/scripts/lib/tool-output-sandbox.js +0 -304
- package/scripts/lib/trust-audit.js +0 -136
- package/scripts/lib/unified-events.js +0 -396
- package/scripts/lib/upgrade-interruption-recovery.js +0 -407
- package/scripts/lib/usage-ledger.js +0 -201
- package/scripts/lib/value-ledger.js +0 -130
- package/scripts/lib/value-proof-calibration.js +0 -531
- package/scripts/lib/visual-qa.js +0 -231
- package/scripts/lib/voice-alpha.js +0 -29
- package/scripts/lib/work-aware-orchestration.js +0 -976
- package/scripts/lib/work-control-receipts.js +0 -577
- package/scripts/lib/work-ledger.js +0 -1123
- package/scripts/lib/work-panel-preview.js +0 -352
- package/scripts/lib/workflow-discipline.js +0 -280
- package/scripts/lib/workflow-signals.js +0 -419
- package/scripts/lib/workspace-map.js +0 -281
- package/scripts/lib/workspace-registry.js +0 -1367
- package/scripts/lib/workspace-resolver.js +0 -480
|
@@ -1,629 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const crypto = require("crypto");
|
|
6
|
-
const { ensureCcoDirs, nowIso } = require("./fsx");
|
|
7
|
-
|
|
8
|
-
const PRODUCT_LEARNING_EVENTS_REL_PATH = ".claude/cco/events/product-learning.jsonl";
|
|
9
|
-
const VALID_EVENT_NAMES = new Set([
|
|
10
|
-
"capability_recommended",
|
|
11
|
-
"capability_used",
|
|
12
|
-
"capability_skipped",
|
|
13
|
-
"capability_failed",
|
|
14
|
-
"capability_helpful",
|
|
15
|
-
"capability_not_helpful",
|
|
16
|
-
"dogfood_persona_reviewed",
|
|
17
|
-
"dogfood_gap_found",
|
|
18
|
-
"dogfood_action_taken",
|
|
19
|
-
"dogfood_deferred_item",
|
|
20
|
-
"dogfood_user_friction",
|
|
21
|
-
"route_requested",
|
|
22
|
-
"route_selected",
|
|
23
|
-
"route_fallback_used",
|
|
24
|
-
"route_blocked_for_safety",
|
|
25
|
-
"model_unavailable",
|
|
26
|
-
"cheaper_safe_path_selected",
|
|
27
|
-
"expensive_path_avoided",
|
|
28
|
-
"prompt_compiled",
|
|
29
|
-
"context_pressure_detected",
|
|
30
|
-
"broad_scan_avoided",
|
|
31
|
-
"repeated_work_detected",
|
|
32
|
-
"token_waste_warning",
|
|
33
|
-
"compact_context_generated",
|
|
34
|
-
"guard_decision",
|
|
35
|
-
"access_governance_evaluated",
|
|
36
|
-
"access_subject_unknown",
|
|
37
|
-
"access_scope_requires_approval",
|
|
38
|
-
"access_receipt_written",
|
|
39
|
-
"access_blocked",
|
|
40
|
-
"access_warned",
|
|
41
|
-
"source_scan_completed",
|
|
42
|
-
"source_reviewed",
|
|
43
|
-
"source_deferred",
|
|
44
|
-
"source_blocked",
|
|
45
|
-
"source_adoption_receipt_written",
|
|
46
|
-
"skill_parsed",
|
|
47
|
-
"skill_parse_warning",
|
|
48
|
-
"skill_bound",
|
|
49
|
-
"skill_binding_warning",
|
|
50
|
-
"skill_router_hit",
|
|
51
|
-
"skill_router_skipped",
|
|
52
|
-
"adapter_generated",
|
|
53
|
-
"adapter_generation_skipped",
|
|
54
|
-
"safe_path_evaluated",
|
|
55
|
-
"safe_path_recommended",
|
|
56
|
-
"safe_path_applied",
|
|
57
|
-
"safe_path_skipped",
|
|
58
|
-
"access_reduced",
|
|
59
|
-
"approval_boundary_used",
|
|
60
|
-
"block_preserved",
|
|
61
|
-
"jit_temporary_scope_recommended",
|
|
62
|
-
"skill_context_safety_warning",
|
|
63
|
-
"skills_security_dogfood_completed",
|
|
64
|
-
"intake_scan_completed",
|
|
65
|
-
"intake_unknown_item_detected",
|
|
66
|
-
"intake_high_risk_item_detected",
|
|
67
|
-
"intake_blocked_item_detected",
|
|
68
|
-
"intake_safe_next_action_recommended",
|
|
69
|
-
"intake_receipt_written",
|
|
70
|
-
"intake_feeds_governance",
|
|
71
|
-
"intake_feeds_safe_path",
|
|
72
|
-
"suspicious_skill_flagged",
|
|
73
|
-
"prompt_injection_pattern_detected",
|
|
74
|
-
"secret_exposure_prevented",
|
|
75
|
-
"approval_required",
|
|
76
|
-
"activation_started",
|
|
77
|
-
"activation_completed",
|
|
78
|
-
"activation_gap_found",
|
|
79
|
-
"doctor_gap_found",
|
|
80
|
-
"first_value_action_completed",
|
|
81
|
-
"free_capability_used",
|
|
82
|
-
"pro_moment_candidate_detected",
|
|
83
|
-
"pro_moment_eligible",
|
|
84
|
-
"pro_moment_suppressed",
|
|
85
|
-
"pro_nudge_shown",
|
|
86
|
-
"pro_nudge_clicked",
|
|
87
|
-
"pro_nudge_dismissed",
|
|
88
|
-
"pro_nudge_cooldown_started",
|
|
89
|
-
"pro_capability_requested",
|
|
90
|
-
"pro_feature_requested",
|
|
91
|
-
"pro_limit_reached",
|
|
92
|
-
"upgrade_page_viewed",
|
|
93
|
-
"checkout_started",
|
|
94
|
-
"checkout_abandoned",
|
|
95
|
-
"upgrade_completed",
|
|
96
|
-
"pro_nudge_not_now_clicked",
|
|
97
|
-
"pro_nudge_dont_show_again_clicked",
|
|
98
|
-
"pro_nudge_multiple_dismissals",
|
|
99
|
-
"pro_nudge_hidden_due_to_cooldown",
|
|
100
|
-
"disable_avorelo_started",
|
|
101
|
-
"feedback_negative_submitted",
|
|
102
|
-
"gated_capability_hit",
|
|
103
|
-
"upgrade_signal_detected",
|
|
104
|
-
"work_control_receipt_written",
|
|
105
|
-
"work_control_handoff_generated",
|
|
106
|
-
"work_control_block_preserved",
|
|
107
|
-
"work_control_approval_required",
|
|
108
|
-
"work_control_next_action_recommended",
|
|
109
|
-
"work_control_do_not_repeat_generated",
|
|
110
|
-
"session_context_generated",
|
|
111
|
-
"session_context_handoff_generated",
|
|
112
|
-
"context_budget_applied",
|
|
113
|
-
"broad_rediscovery_avoided",
|
|
114
|
-
"huge_json_dump_avoided",
|
|
115
|
-
"continuation_packet_used",
|
|
116
|
-
"model_effort_recommendation_generated",
|
|
117
|
-
"pricing_confusion_detected",
|
|
118
|
-
"feedback_submitted",
|
|
119
|
-
"feedback_category",
|
|
120
|
-
"feedback_sentiment",
|
|
121
|
-
"feature_request",
|
|
122
|
-
"friction_reported",
|
|
123
|
-
"unclear_value_reported",
|
|
124
|
-
// Context Intelligence Completion v1
|
|
125
|
-
"brain_pack_generated",
|
|
126
|
-
"brain_pack_initialized",
|
|
127
|
-
"brain_pack_used_in_session_context",
|
|
128
|
-
"recipe_detected",
|
|
129
|
-
"dynamic_commands_generated",
|
|
130
|
-
"target_specific_handoff_generated",
|
|
131
|
-
"skills_route_fallback_recommended",
|
|
132
|
-
"dogfood_feedback_captured",
|
|
133
|
-
"capability_recommendation_embedded",
|
|
134
|
-
// Workspace Registry v1
|
|
135
|
-
"workspace_registry_generated",
|
|
136
|
-
"workspace_registry_summary_generated",
|
|
137
|
-
"workspace_registry_drift_detected",
|
|
138
|
-
"workspace_asset_unknown_detected",
|
|
139
|
-
"workspace_asset_high_risk_detected",
|
|
140
|
-
"workspace_registry_used_in_session_context",
|
|
141
|
-
"workspace_registry_used_in_brain_pack",
|
|
142
|
-
"workspace_registry_value_measured",
|
|
143
|
-
"workspace_registry_next_action_recommended",
|
|
144
|
-
// Operating Loop Value Surface v1
|
|
145
|
-
"operating_value_generated",
|
|
146
|
-
"operating_value_summary_generated",
|
|
147
|
-
"operating_value_moment_generated",
|
|
148
|
-
"operating_value_validated",
|
|
149
|
-
"rediscovery_avoided_measured",
|
|
150
|
-
"context_reduction_estimated",
|
|
151
|
-
"manual_steps_avoided_estimated",
|
|
152
|
-
"risk_avoided_measured",
|
|
153
|
-
"capability_routing_quality_measured",
|
|
154
|
-
"seamlessness_measured",
|
|
155
|
-
"willingness_to_pay_signal_generated",
|
|
156
|
-
"local_value_dashboard_generated",
|
|
157
|
-
"local_value_dashboard_opened",
|
|
158
|
-
// Value Proof Hardening / Reality Calibration v1
|
|
159
|
-
"value_proof_calibrated",
|
|
160
|
-
"value_claim_overclaim_risk_detected",
|
|
161
|
-
"value_claim_downgraded",
|
|
162
|
-
"value_claim_allowed_for_dashboard",
|
|
163
|
-
"value_claim_blocked_for_website",
|
|
164
|
-
"value_evidence_gap_detected",
|
|
165
|
-
// Seamless Activation + Self-Healing Setup v1
|
|
166
|
-
"activation_scan_completed",
|
|
167
|
-
"activation_safe_fix_planned",
|
|
168
|
-
"activation_safe_fix_applied",
|
|
169
|
-
"activation_verification_completed",
|
|
170
|
-
"activation_ready",
|
|
171
|
-
"activation_hard_blocker_detected",
|
|
172
|
-
"activation_agent_repair_plan_generated",
|
|
173
|
-
"activation_dashboard_ready",
|
|
174
|
-
"activation_model_routing_detected",
|
|
175
|
-
// Skill Hygiene & Routing Guard v1
|
|
176
|
-
"skill_hygiene_completed",
|
|
177
|
-
"skill_duplicate_group_detected",
|
|
178
|
-
"skill_shadow_candidate_detected",
|
|
179
|
-
"skill_bounded_contribution_accepted",
|
|
180
|
-
"skill_bounded_contribution_rejected",
|
|
181
|
-
"skill_conflict_detected",
|
|
182
|
-
"skill_context_heavy_detected",
|
|
183
|
-
"skill_security_hygiene_detected",
|
|
184
|
-
"skill_route_deduped",
|
|
185
|
-
"skill_route_blocked_by_hygiene",
|
|
186
|
-
"skill_intake_checked",
|
|
187
|
-
"skill_intake_blocked",
|
|
188
|
-
"skill_intake_merge_recommended",
|
|
189
|
-
// Measurement Evidence Foundation v1
|
|
190
|
-
"dogfood_reality_gate_completed",
|
|
191
|
-
"dogfood_finding_reconciled",
|
|
192
|
-
"launch_ready_journey_checked",
|
|
193
|
-
"local_pricing_initialized",
|
|
194
|
-
"local_pricing_validated",
|
|
195
|
-
"local_pricing_unavailable",
|
|
196
|
-
"token_evidence_generated",
|
|
197
|
-
"token_evidence_fallback_used",
|
|
198
|
-
"session_timing_event_recorded",
|
|
199
|
-
"session_timing_summary_generated",
|
|
200
|
-
"cost_evidence_generated",
|
|
201
|
-
"cost_estimate_unavailable",
|
|
202
|
-
"cost_estimate_generated",
|
|
203
|
-
"measurement_evidence_calibrated",
|
|
204
|
-
// Install Intake Risk Foundation v1
|
|
205
|
-
"install_intake_risk_scan_completed",
|
|
206
|
-
"install_intake_risk_receipt_written",
|
|
207
|
-
// Agent Model Orchestration Foundation v1
|
|
208
|
-
"orchestration_route_planned",
|
|
209
|
-
"orchestration_stage_planned",
|
|
210
|
-
"worker_limited_detected",
|
|
211
|
-
"fallback_recommended",
|
|
212
|
-
"fallback_used",
|
|
213
|
-
"local_worker_recommended",
|
|
214
|
-
"local_worker_used",
|
|
215
|
-
"escalation_recommended",
|
|
216
|
-
"handoff_prompt_generated",
|
|
217
|
-
"orchestration_receipt_written",
|
|
218
|
-
"worker_selection_blocked",
|
|
219
|
-
// Prompt / Context / Token Optimization Foundation v1
|
|
220
|
-
"context_pack_generated",
|
|
221
|
-
"context_budget_estimated",
|
|
222
|
-
"context_budget_warning",
|
|
223
|
-
"context_over_budget",
|
|
224
|
-
"context_compaction_used",
|
|
225
|
-
"context_item_excluded",
|
|
226
|
-
"skill_context_lazy_loaded",
|
|
227
|
-
"handoff_context_pack_attached",
|
|
228
|
-
"local_worker_context_boundary_used",
|
|
229
|
-
"no_secrets_context_boundary_applied",
|
|
230
|
-
"context_optimization_receipt_written",
|
|
231
|
-
// Seamless Customer Outcome + Value Reality Gate v1
|
|
232
|
-
"seamless_mode_applied",
|
|
233
|
-
"automatic_optimization_applied",
|
|
234
|
-
"user_interrupt_avoided",
|
|
235
|
-
"interruption_required",
|
|
236
|
-
"outcome_preservation_checked",
|
|
237
|
-
"task_completion_preserved",
|
|
238
|
-
"value_summary_generated",
|
|
239
|
-
"estimated_premium_call_avoided",
|
|
240
|
-
"context_tokens_avoided_estimated",
|
|
241
|
-
"manual_decision_avoided",
|
|
242
|
-
"quality_escalation_recommended",
|
|
243
|
-
"seamless_reality_gate_completed",
|
|
244
|
-
// Seamless Automation Enforcement v1
|
|
245
|
-
"enforcement_guard_compact_applied",
|
|
246
|
-
"enforcement_route_compact_applied",
|
|
247
|
-
"enforcement_context_compact_applied",
|
|
248
|
-
"enforcement_block_outcome_preserved",
|
|
249
|
-
"enforcement_escalation_automatic",
|
|
250
|
-
// Task-Specific Continuation + Value Evidence Hardening v1
|
|
251
|
-
"task_continuation_generated",
|
|
252
|
-
"task_specific_safe_next_action_generated",
|
|
253
|
-
"generic_safe_next_action_detected",
|
|
254
|
-
"value_evidence_collected",
|
|
255
|
-
"value_summary_evidence_backed",
|
|
256
|
-
"value_summary_autowrite_completed",
|
|
257
|
-
"value_summary_autowrite_skipped",
|
|
258
|
-
// AI Workspace Hygiene + Capability Registry v1
|
|
259
|
-
"ai_workspace_hygiene_scanned",
|
|
260
|
-
"ai_workspace_asset_detected",
|
|
261
|
-
"ai_workspace_duplicate_instruction_detected",
|
|
262
|
-
"ai_workspace_high_context_cost_detected",
|
|
263
|
-
"ai_workspace_unknown_mcp_detected",
|
|
264
|
-
"ai_workspace_capability_registry_built",
|
|
265
|
-
"ai_workspace_hygiene_report_written",
|
|
266
|
-
// Work-Aware Orchestration + Workspace Relevance v1
|
|
267
|
-
"work_orchestration_plan_generated",
|
|
268
|
-
"work_orchestration_stage_planned",
|
|
269
|
-
"stage_worker_selected",
|
|
270
|
-
"stage_context_selected",
|
|
271
|
-
"local_or_cheap_stage_used",
|
|
272
|
-
"strong_worker_reserved",
|
|
273
|
-
"fallback_worker_planned",
|
|
274
|
-
"workspace_relevance_used",
|
|
275
|
-
"unknown_workspace_asset_excluded",
|
|
276
|
-
"high_context_asset_excluded",
|
|
277
|
-
"stage_handoff_prepared",
|
|
278
|
-
"orchestration_value_evidence_written",
|
|
279
|
-
// PR #136 — AI-Native Company Loop + Unified Work Ledger
|
|
280
|
-
"work_ledger_built",
|
|
281
|
-
"work_ledger_entry_linked",
|
|
282
|
-
"work_ledger_rollup_generated",
|
|
283
|
-
"company_loop_report_generated",
|
|
284
|
-
"internal_persona_review_generated",
|
|
285
|
-
"friction_cluster_detected",
|
|
286
|
-
"feedback_signal_loaded",
|
|
287
|
-
"next_pr_recommendation_generated",
|
|
288
|
-
"cost_cogs_quality_rollup_generated",
|
|
289
|
-
// PR #137 — Execution Packet + Project Profile + Work Panel Preview v1
|
|
290
|
-
"project_profile_detected",
|
|
291
|
-
"execution_packet_compiled",
|
|
292
|
-
"agent_prompt_compiled",
|
|
293
|
-
"work_panel_preview_generated",
|
|
294
|
-
"blocked_scope_applied",
|
|
295
|
-
"proof_requirements_attached",
|
|
296
|
-
"diff_before_write_required",
|
|
297
|
-
"packet_approval_required",
|
|
298
|
-
"packet_ready_for_worker",
|
|
299
|
-
// PR #138 — Seamless Smart Work Routing + Worker Handoff Runtime v1
|
|
300
|
-
"smart_work_route_built",
|
|
301
|
-
"smart_route_execution_path_selected",
|
|
302
|
-
"worker_handoff_prepared",
|
|
303
|
-
"protocol_readiness_evaluated",
|
|
304
|
-
"same_surface_preferred",
|
|
305
|
-
"cross_vendor_blocked_by_default",
|
|
306
|
-
"remote_agent_delegation_blocked",
|
|
307
|
-
"smart_route_receipt_written",
|
|
308
|
-
// PR #139 — Safe Run Command + Execution Controller v1
|
|
309
|
-
"safe_run_started",
|
|
310
|
-
"safe_run_plan_built",
|
|
311
|
-
"safe_run_local_step_allowed",
|
|
312
|
-
"safe_run_local_step_blocked",
|
|
313
|
-
"safe_run_local_step_completed",
|
|
314
|
-
"safe_run_receipt_written",
|
|
315
|
-
"safe_run_approval_required",
|
|
316
|
-
"safe_run_blocked",
|
|
317
|
-
"safe_run_completed",
|
|
318
|
-
// PR #140 — Hook Baseline + Lifecycle Automation Preview v1
|
|
319
|
-
"hook_baseline_built",
|
|
320
|
-
"adapter_readiness_detected",
|
|
321
|
-
"hook_config_preview_generated",
|
|
322
|
-
"lifecycle_hook_handler_invoked",
|
|
323
|
-
"lifecycle_pre_tool_use_blocked",
|
|
324
|
-
"lifecycle_stop_proof_required",
|
|
325
|
-
"lifecycle_session_end_summary_written",
|
|
326
|
-
"hook_preview_receipt_written",
|
|
327
|
-
// PR #141 — Explicit Hook Apply + Lifecycle Live v1
|
|
328
|
-
"hook_apply_plan_built",
|
|
329
|
-
"hook_apply_approval_required",
|
|
330
|
-
"hook_config_applied",
|
|
331
|
-
"hook_apply_validation_passed",
|
|
332
|
-
"hook_apply_validation_failed",
|
|
333
|
-
"hook_rollback_performed",
|
|
334
|
-
"hook_uninstall_performed",
|
|
335
|
-
"hook_doctor_run",
|
|
336
|
-
"hook_recursion_guard_triggered",
|
|
337
|
-
"lifecycle_live_smoke_passed",
|
|
338
|
-
// PR #142 — Activation Alpha Readiness + First Value v1
|
|
339
|
-
"alpha_activation_started",
|
|
340
|
-
"alpha_activation_checked",
|
|
341
|
-
"first_value_path_selected",
|
|
342
|
-
"first_value_completed",
|
|
343
|
-
"alpha_readiness_gate_run",
|
|
344
|
-
"alpha_feedback_added",
|
|
345
|
-
"support_bundle_generated",
|
|
346
|
-
"activation_friction_detected",
|
|
347
|
-
"e2e_value_dogfood_completed",
|
|
348
|
-
// PR #143 — Token Efficiency + Context Quality Hardening v1
|
|
349
|
-
"token_efficiency_evidence_generated",
|
|
350
|
-
"tool_output_sandbox_summary_written",
|
|
351
|
-
"raw_tool_output_artifact_written",
|
|
352
|
-
"repo_map_generated",
|
|
353
|
-
"context_acquisition_plan_generated",
|
|
354
|
-
"cache_readiness_checked",
|
|
355
|
-
"token_context_quality_gate_run",
|
|
356
|
-
"full_repo_dump_blocked",
|
|
357
|
-
"context_quality_fallback_required",
|
|
358
|
-
"e2e_token_value_dogfood_completed",
|
|
359
|
-
// PR #144 — Launch Hardening + Failure Recovery v1
|
|
360
|
-
"launch_hardening_gate_run",
|
|
361
|
-
"failure_recovery_plan_built",
|
|
362
|
-
"artifact_health_scanned",
|
|
363
|
-
"artifact_cleanup_plan_built",
|
|
364
|
-
"artifact_cleanup_applied",
|
|
365
|
-
"doctor_hardening_run",
|
|
366
|
-
"support_bundle_redaction_checked",
|
|
367
|
-
"json_contract_validated",
|
|
368
|
-
"cross_platform_sanity_checked",
|
|
369
|
-
"e2e_failure_mode_dogfood_completed",
|
|
370
|
-
// PR #145 — MCP Least-Privilege Tool Governance v1
|
|
371
|
-
"mcp_tool_inventory_scanned",
|
|
372
|
-
"mcp_tool_risk_classified",
|
|
373
|
-
"mcp_policy_preview_generated",
|
|
374
|
-
"mcp_pre_tool_use_decision_written",
|
|
375
|
-
"mcp_unknown_tool_detected",
|
|
376
|
-
"mcp_suspicious_metadata_detected",
|
|
377
|
-
"mcp_broad_permission_detected",
|
|
378
|
-
"mcp_tool_blocked",
|
|
379
|
-
"mcp_tool_approval_required",
|
|
380
|
-
"e2e_mcp_risk_dogfood_completed",
|
|
381
|
-
// PR #146 — One-Prompt AI Install + Pre-Launch Activation Readiness v1
|
|
382
|
-
"ai_install_prompt_generated",
|
|
383
|
-
"ai_install_prompt_copied_ready",
|
|
384
|
-
"prelaunch_activation_readiness_run",
|
|
385
|
-
"first_value_check_run",
|
|
386
|
-
"ai_install_flow_started",
|
|
387
|
-
"ai_install_flow_completed",
|
|
388
|
-
"ai_install_flow_blocked",
|
|
389
|
-
"ai_install_safety_boundary_detected",
|
|
390
|
-
"e2e_ai_install_dogfood_completed",
|
|
391
|
-
// PR #147 — Pre-Launch Intelligence Layer v1
|
|
392
|
-
"prelaunch_intelligence_run",
|
|
393
|
-
"feedback_intelligence_built",
|
|
394
|
-
"friction_cluster_detected",
|
|
395
|
-
"token_cost_intelligence_built",
|
|
396
|
-
"install_journey_intelligence_built",
|
|
397
|
-
"prelaunch_recommendation_generated",
|
|
398
|
-
"insufficient_prelaunch_data_detected",
|
|
399
|
-
"e2e_prelaunch_intelligence_dogfood_completed",
|
|
400
|
-
// Experimentation / Product Learning Foundation v1
|
|
401
|
-
"experiment_assigned",
|
|
402
|
-
"experiment_exposed",
|
|
403
|
-
"experiment_variant_rendered",
|
|
404
|
-
"experiment_goal_completed",
|
|
405
|
-
"experiment_guardrail_triggered",
|
|
406
|
-
"experiment_result_reviewed",
|
|
407
|
-
"experiment_decision_made",
|
|
408
|
-
"page_viewed",
|
|
409
|
-
"hero_viewed",
|
|
410
|
-
"hero_cta_clicked",
|
|
411
|
-
"secondary_cta_clicked",
|
|
412
|
-
"install_command_copied",
|
|
413
|
-
"docs_clicked",
|
|
414
|
-
"demo_started",
|
|
415
|
-
"demo_completed",
|
|
416
|
-
"pricing_viewed",
|
|
417
|
-
"pricing_plan_clicked",
|
|
418
|
-
"free_plan_clicked",
|
|
419
|
-
"pro_plan_clicked",
|
|
420
|
-
"teams_interest_clicked",
|
|
421
|
-
"faq_opened",
|
|
422
|
-
"security_section_viewed",
|
|
423
|
-
"value_section_viewed",
|
|
424
|
-
"trust_page_viewed",
|
|
425
|
-
"comprehension_survey_shown",
|
|
426
|
-
"comprehension_survey_answered",
|
|
427
|
-
"message_recall_answered",
|
|
428
|
-
"objection_selected",
|
|
429
|
-
"confusion_signal_detected",
|
|
430
|
-
"activation_failed",
|
|
431
|
-
"activation_safe_repair_attempted",
|
|
432
|
-
"activation_safe_repair_completed",
|
|
433
|
-
"activation_next_action_shown",
|
|
434
|
-
"activation_account_skipped",
|
|
435
|
-
"activation_account_connected",
|
|
436
|
-
"first_value_shown",
|
|
437
|
-
"first_value_acknowledged",
|
|
438
|
-
"prompt_shaped",
|
|
439
|
-
"context_pack_created",
|
|
440
|
-
"context_reduction_applied",
|
|
441
|
-
"workspace_map_created",
|
|
442
|
-
"workspace_map_used",
|
|
443
|
-
"skill_risk_scan_completed",
|
|
444
|
-
"risky_instruction_detected",
|
|
445
|
-
"guard_decision_made",
|
|
446
|
-
"unsafe_action_blocked",
|
|
447
|
-
"safe_path_suggested",
|
|
448
|
-
"route_recommended",
|
|
449
|
-
"route_applied",
|
|
450
|
-
"proof_generated",
|
|
451
|
-
"handoff_created",
|
|
452
|
-
"reentry_used",
|
|
453
|
-
"proof_history_requested",
|
|
454
|
-
"proof_export_requested",
|
|
455
|
-
"visual_qa_started",
|
|
456
|
-
"visual_qa_completed",
|
|
457
|
-
"visual_qa_finding_detected",
|
|
458
|
-
"trust_faq_opened",
|
|
459
|
-
"security_concern_clicked",
|
|
460
|
-
"uninstall_started",
|
|
461
|
-
// PR #161 — Public Activation Distribution Truth v1
|
|
462
|
-
"public_distribution_truth_built",
|
|
463
|
-
"package_content_audit_run",
|
|
464
|
-
"local_package_smoke_run",
|
|
465
|
-
"public_install_claim_check_run",
|
|
466
|
-
"publish_provenance_readiness_run",
|
|
467
|
-
"false_install_claim_detected",
|
|
468
|
-
"forbidden_package_file_detected",
|
|
469
|
-
"public_activation_distribution_gate_run",
|
|
470
|
-
"e2e_public_distribution_dogfood_completed",
|
|
471
|
-
]);
|
|
472
|
-
|
|
473
|
-
const FORBIDDEN_PAYLOAD_KEYS = new Set([
|
|
474
|
-
"rawPrompt",
|
|
475
|
-
"prompt",
|
|
476
|
-
"rawCode",
|
|
477
|
-
"code",
|
|
478
|
-
"fileContents",
|
|
479
|
-
"secret",
|
|
480
|
-
"token",
|
|
481
|
-
"credential",
|
|
482
|
-
"apiKey",
|
|
483
|
-
]);
|
|
484
|
-
|
|
485
|
-
function sha256(value) {
|
|
486
|
-
return crypto.createHash("sha256").update(String(value || "")).digest("hex");
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
function redactString(value) {
|
|
490
|
-
const text = String(value || "");
|
|
491
|
-
return text
|
|
492
|
-
.replace(/sk-[A-Za-z0-9]{16,}/g, "[redacted-openai-key]")
|
|
493
|
-
.replace(/ghp_[A-Za-z0-9]{20,}/g, "[redacted-github-token]")
|
|
494
|
-
.replace(/AKIA[0-9A-Z]{16}/g, "[redacted-aws-key]")
|
|
495
|
-
.replace(/((?:api[_ -]?key|token|password|secret|authorization)\s*[:=]\s*)([^\s'"]+)/ig, "$1[redacted]");
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
function redactPayload(payload) {
|
|
499
|
-
if (Array.isArray(payload)) {
|
|
500
|
-
return payload.map((value) => redactPayload(value));
|
|
501
|
-
}
|
|
502
|
-
if (!payload || typeof payload !== "object") {
|
|
503
|
-
if (typeof payload === "string") {
|
|
504
|
-
return redactString(payload);
|
|
505
|
-
}
|
|
506
|
-
return payload;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
const redacted = {};
|
|
510
|
-
Object.keys(payload).forEach((key) => {
|
|
511
|
-
if (FORBIDDEN_PAYLOAD_KEYS.has(key)) {
|
|
512
|
-
redacted[`${key}Hash`] = sha256(JSON.stringify(payload[key]));
|
|
513
|
-
redacted[`${key}Length`] = String(payload[key] || "").length;
|
|
514
|
-
return;
|
|
515
|
-
}
|
|
516
|
-
const value = payload[key];
|
|
517
|
-
if (typeof value === "string" && (key.toLowerCase().includes("path") || key.toLowerCase().includes("file"))) {
|
|
518
|
-
redacted[key] = "[redacted-path]";
|
|
519
|
-
redacted[`${key}Hash`] = sha256(value);
|
|
520
|
-
return;
|
|
521
|
-
}
|
|
522
|
-
redacted[key] = redactPayload(value);
|
|
523
|
-
});
|
|
524
|
-
return redacted;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
function validateProductLearningEvent(event) {
|
|
528
|
-
const errors = [];
|
|
529
|
-
if (!event || typeof event !== "object") {
|
|
530
|
-
errors.push("Event must be an object");
|
|
531
|
-
return { valid: false, errors };
|
|
532
|
-
}
|
|
533
|
-
if (!VALID_EVENT_NAMES.has(event.eventName)) {
|
|
534
|
-
errors.push(`Unknown eventName: ${event.eventName}`);
|
|
535
|
-
}
|
|
536
|
-
if (!event.category) {
|
|
537
|
-
errors.push("Event category is required");
|
|
538
|
-
}
|
|
539
|
-
if (event.payload && typeof event.payload !== "object") {
|
|
540
|
-
errors.push("payload must be an object when present");
|
|
541
|
-
}
|
|
542
|
-
Object.keys(event.payload || {}).forEach((key) => {
|
|
543
|
-
if (FORBIDDEN_PAYLOAD_KEYS.has(key)) {
|
|
544
|
-
errors.push(`Forbidden payload key present: ${key}`);
|
|
545
|
-
}
|
|
546
|
-
});
|
|
547
|
-
return { valid: errors.length === 0, errors };
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
function appendProductLearningEvent(cwd, event) {
|
|
551
|
-
ensureCcoDirs(cwd);
|
|
552
|
-
const normalized = {
|
|
553
|
-
schemaVersion: 1,
|
|
554
|
-
eventName: event.eventName,
|
|
555
|
-
category: event.category,
|
|
556
|
-
occurredAt: event.occurredAt || nowIso(),
|
|
557
|
-
surface: event.surface || "local",
|
|
558
|
-
status: event.status || "observed",
|
|
559
|
-
payload: redactPayload(event.payload || {}),
|
|
560
|
-
};
|
|
561
|
-
const validation = validateProductLearningEvent(normalized);
|
|
562
|
-
if (!validation.valid) {
|
|
563
|
-
return {
|
|
564
|
-
ok: false,
|
|
565
|
-
errors: validation.errors,
|
|
566
|
-
event: normalized,
|
|
567
|
-
};
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
const absPath = path.join(cwd, PRODUCT_LEARNING_EVENTS_REL_PATH);
|
|
571
|
-
fs.mkdirSync(path.dirname(absPath), { recursive: true });
|
|
572
|
-
fs.appendFileSync(absPath, `${JSON.stringify(normalized)}\n`, "utf8");
|
|
573
|
-
return {
|
|
574
|
-
ok: true,
|
|
575
|
-
path: PRODUCT_LEARNING_EVENTS_REL_PATH,
|
|
576
|
-
event: normalized,
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
function readProductLearningEvents(cwd) {
|
|
581
|
-
const absPath = path.join(cwd, PRODUCT_LEARNING_EVENTS_REL_PATH);
|
|
582
|
-
if (!fs.existsSync(absPath)) return [];
|
|
583
|
-
return fs.readFileSync(absPath, "utf8")
|
|
584
|
-
.split(/\r?\n/)
|
|
585
|
-
.map((line) => line.trim())
|
|
586
|
-
.filter(Boolean)
|
|
587
|
-
.map((line) => {
|
|
588
|
-
try {
|
|
589
|
-
return JSON.parse(line);
|
|
590
|
-
} catch {
|
|
591
|
-
return null;
|
|
592
|
-
}
|
|
593
|
-
})
|
|
594
|
-
.filter(Boolean);
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
function summarizeLatestLearningSignals(cwd, limit = 20) {
|
|
598
|
-
const events = readProductLearningEvents(cwd).slice(-limit);
|
|
599
|
-
const counts = {};
|
|
600
|
-
const categoryCounts = {};
|
|
601
|
-
events.forEach((event) => {
|
|
602
|
-
counts[event.eventName] = (counts[event.eventName] || 0) + 1;
|
|
603
|
-
categoryCounts[event.category] = (categoryCounts[event.category] || 0) + 1;
|
|
604
|
-
});
|
|
605
|
-
return {
|
|
606
|
-
totalEvents: events.length,
|
|
607
|
-
topEvents: Object.entries(counts)
|
|
608
|
-
.sort((left, right) => right[1] - left[1])
|
|
609
|
-
.slice(0, 5)
|
|
610
|
-
.map(([eventName, count]) => ({ eventName, count })),
|
|
611
|
-
categories: Object.entries(categoryCounts)
|
|
612
|
-
.sort((left, right) => right[1] - left[1])
|
|
613
|
-
.map(([category, count]) => ({ category, count })),
|
|
614
|
-
latestPath: PRODUCT_LEARNING_EVENTS_REL_PATH,
|
|
615
|
-
};
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
module.exports = {
|
|
619
|
-
PRODUCT_LEARNING_EVENTS_REL_PATH,
|
|
620
|
-
VALID_EVENT_NAMES,
|
|
621
|
-
FORBIDDEN_PAYLOAD_KEYS,
|
|
622
|
-
sha256,
|
|
623
|
-
redactString,
|
|
624
|
-
redactPayload,
|
|
625
|
-
validateProductLearningEvent,
|
|
626
|
-
appendProductLearningEvent,
|
|
627
|
-
readProductLearningEvents,
|
|
628
|
-
summarizeLatestLearningSignals,
|
|
629
|
-
};
|