@event4u/agent-config 14.18.0 → 14.20.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/.augment-plugin/marketplace.json +3 -3
- package/.augment-plugin/plugin.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +120 -129
- package/README.md +71 -149
- package/dist/agent-src/README.md +1 -1
- package/dist/agent-src/commands/agent-handoff.md +44 -43
- package/dist/agent-src/commands/review/changes.md +19 -19
- package/dist/agent-src/commands/review.md +2 -2
- package/dist/agent-src/contexts/execution/host-capability-manifest.md +37 -4
- package/dist/agent-src/rules/autonomous-execution.md +1 -1
- package/dist/agent-src/rules/git-history-discipline.md +2 -2
- package/dist/agent-src/rules/guidelines.md +1 -1
- package/dist/agent-src/rules/session-canary.md +2 -2
- package/dist/agent-src/rules/token-efficiency.md +1 -1
- package/dist/agent-src/rules/untrusted-input-defense.md +0 -2
- package/dist/agent-src/skills/adversarial-review/SKILL.md +0 -8
- package/dist/agent-src/skills/canvas-design/SKILL.md +1 -1
- package/dist/agent-src/skills/design-intelligence/SKILL.md +1 -1
- package/dist/agent-src/skills/design-intelligence/data/app-interface.csv +1 -1
- package/dist/agent-src/skills/design-intelligence/data/motion.csv +17 -17
- package/dist/agent-src/skills/design-intelligence/data/ux-guidelines.csv +2 -2
- package/dist/agent-src/skills/design-intelligence/references/context-and-registers.md +17 -0
- package/dist/agent-src/skills/design-intelligence/references/design-rules-checklist.md +4 -4
- package/dist/agent-src/skills/design-review/SKILL.md +1 -1
- package/dist/agent-src/skills/design-variations/SKILL.md +1 -1
- package/dist/agent-src/skills/evaluate-llm-feature/SKILL.md +1 -1
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +1 -1
- package/dist/agent-src/skills/fe-design/SKILL.md +32 -5
- package/dist/agent-src/skills/fe-design/references/craft-floor.md +7 -0
- package/dist/agent-src/skills/fe-design/references/design-patterns.md +47 -2
- package/dist/agent-src/skills/laravel-scheduling/SKILL.md +3 -1
- package/dist/agent-src/skills/markitdown/SKILL.md +1 -1
- package/dist/agent-src/skills/project-analyzer/SKILL.md +0 -6
- package/dist/agent-src/skills/react-native-setup/SKILL.md +3 -3
- package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +1 -1
- package/dist/agent-src/skills/sequential-thinking/SKILL.md +18 -8
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +28 -6
- package/dist/agent-src/skills/tailwind-engineer/SKILL.md +1 -1
- package/dist/agent-src/skills/test-driven-development/SKILL.md +1 -3
- package/dist/agent-src/skills/ui-apply-generic/SKILL.md +1 -1
- package/dist/agent-src/skills/ui-component-architect/SKILL.md +1 -1
- package/dist/agent-src/skills/using-git-worktrees/SKILL.md +17 -2
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +14 -1
- package/dist/agent-src/templates/scripts/telemetry/mcp_lite.ts +213 -0
- package/dist/agent-src/templates/scripts/telemetry/report_renderer.ts +16 -0
- package/dist/agent-src/templates/scripts/telemetry_report.ts +22 -2
- package/dist/cli/commands/recordTriggerEval.js +2 -2
- package/dist/cli/main.js +1 -1
- package/dist/cli/mcp/dispatch.js +10 -0
- package/dist/cli/mcp/stdio.js +33 -2
- package/dist/cli/mcp/telemetry.js +227 -0
- package/dist/cli-delegate/{chunk-AKJGUQNO.js → chunk-C6IPZRDA.js} +484 -353
- package/dist/cli-delegate/{chunk-CYH5SP6M.js → chunk-I6RHFQEG.js} +151 -16
- package/dist/cli-delegate/{chunk-7RXIKF62.js → chunk-NUMQHLS5.js} +304 -136
- package/dist/cli-delegate/{chunk-PMEKGDED.js → chunk-PI2GU3DP.js} +163 -1
- package/dist/cli-delegate/{chunk-7PRE6ZV2.js → chunk-YS6XTLEK.js} +199 -4
- package/dist/cli-delegate/chunk-ZVBOHSVF.js +1109 -0
- package/dist/cli-delegate/cmd_adr_effective.js +318 -81
- package/dist/cli-delegate/cmd_conformance.js +489 -121
- package/dist/cli-delegate/cmd_doctor.js +2 -2
- package/dist/cli-delegate/cmd_export.js +2 -2
- package/dist/cli-delegate/cmd_handoff.js +42 -12
- package/dist/cli-delegate/cmd_memory_get.js +1 -1
- package/dist/cli-delegate/cmd_prune.js +2 -2
- package/dist/cli-delegate/cmd_route_audit.js +2 -2
- package/dist/cli-delegate/cmd_session_recycle.js +59 -902
- package/dist/cli-delegate/cmd_settings_migrate.js +2 -2
- package/dist/cli-delegate/cmd_sync.js +2 -2
- package/dist/cli-delegate/cmd_uninstall.js +2 -2
- package/dist/cli-delegate/cmd_validate.js +2 -2
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +34 -33
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +1 -1
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +2 -2
- package/dist/discovery/trust-report.md +1 -1
- package/dist/discovery/workspaces.json +2 -2
- package/dist/hooks/dispatch.js +4455 -3025
- package/dist/install/install.mjs +975 -689
- package/dist/mcp/registry-manifest.json +2 -2
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +2087 -1134
- package/dist/scripts/_lib/model_tier.js +1 -1
- package/dist/scripts/mcp_server/telemetry.js +148 -0
- package/docs/guidelines/agent-infra/evaluator-independence-mechanics.md +1 -1
- package/docs/guidelines/agent-infra/naming.md +1 -1
- package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
- package/docs/guidelines/agent-infra/security-lint-containment.md +46 -6
- package/docs/guidelines/agent-infra/self-improvement-pipeline.md +4 -4
- package/docs/guidelines/agent-infra/untrusted-input-spotlighting.md +1 -1
- package/docs/guidelines/design-antipatterns.md +87 -64
- package/docs/guidelines/redundancy-taxonomy.md +28 -0
- package/package.json +1 -1
- package/src/agent-src/README.md +1 -1
- package/src/agent-src/templates/scripts/telemetry/mcp_lite.ts +213 -0
- package/src/agent-src/templates/scripts/telemetry/report_renderer.ts +16 -0
- package/src/agent-src/templates/scripts/telemetry_report.ts +22 -2
- package/src/config/assurance-capability-registry.json +9 -0
- package/src/config/ci-local-parity.yml +6 -0
- package/src/config/gate-coverage.yml +225 -0
- package/src/config/gate-violation-baselines.json +18 -6
- package/src/config/release-gate-locality.yml +12 -0
- package/src/scripts/_cli/cmd_doctor.ts +2 -2
- package/src/scripts/_cli/cmd_handoff.ts +1 -1
- package/src/scripts/_cli/cmd_session_recycle.ts +51 -3
- package/src/scripts/_cli/cmd_update.ts +1 -1
- package/src/scripts/_cli/cmd_versions.ts +1 -1
- package/src/scripts/_lib/adr_frontmatter.ts +44 -0
- package/src/scripts/_lib/audit_field_provenance.ts +44 -3
- package/src/scripts/_lib/consequence_objects.ts +152 -0
- package/src/scripts/_lib/exec_evidence.ts +7 -0
- package/src/scripts/_lib/global_deploy_inventory.ts +2 -2
- package/src/scripts/_lib/host_capability.ts +38 -0
- package/src/scripts/_lib/host_permission_checks.ts +251 -0
- package/src/scripts/_lib/install_reach_checks.ts +33 -1
- package/src/scripts/_lib/mcp_bridge.ts +222 -10
- package/src/scripts/_lib/mcp_consent_residual.ts +173 -0
- package/src/scripts/_lib/model_tier.ts +1 -1
- package/src/scripts/_lib/obligation_frequency.ts +2 -2
- package/src/scripts/_lib/orchestration_record.ts +23 -1
- package/src/scripts/_lib/recycle_envelope_paths.ts +190 -0
- package/src/scripts/_lib/release_highlights.ts +93 -0
- package/src/scripts/_lib/release_material.ts +64 -1
- package/src/scripts/_lib/release_position.ts +96 -0
- package/src/scripts/_lib/review_skipped_record.ts +17 -1
- package/src/scripts/_lib/runtime_journal.ts +26 -3
- package/src/scripts/_lib/runtime_wiring_checks.ts +12 -1
- package/src/scripts/_lib/security_lint.ts +179 -7
- package/src/scripts/_lib/self_repair.ts +141 -6
- package/src/scripts/_lib/self_repair_store.ts +273 -7
- package/src/scripts/_lib/session_register.ts +11 -6
- package/src/scripts/_lib/sqlite_schema.ts +22 -0
- package/src/scripts/_lib/subagent_capsule.ts +155 -3
- package/src/scripts/_lib/surface.ts +86 -0
- package/src/scripts/_lib/ui_authority.ts +116 -0
- package/src/scripts/adr/regenerate_index.ts +54 -1
- package/src/scripts/adr_cite_check.ts +71 -15
- package/src/scripts/ai_council/clients.ts +1 -1
- package/src/scripts/autonomy_friction_corpus.ts +229 -0
- package/src/scripts/build_proof.ts +15 -2
- package/src/scripts/build_rule_trigger_matrix.ts +5 -0
- package/src/scripts/check_beta_review_markers.ts +141 -17
- package/src/scripts/check_enforcement_coverage.ts +1 -1
- package/src/scripts/check_enforcement_denominator.ts +121 -11
- package/src/scripts/check_finding_dispositions.ts +66 -9
- package/src/scripts/check_gate_coverage.ts +96 -0
- package/src/scripts/check_mcp_doc_drift.ts +217 -0
- package/src/scripts/check_pack_size.ts +321 -3
- package/src/scripts/check_release_highlights.ts +74 -1
- package/src/scripts/check_skill_activation_claim.ts +179 -0
- package/src/scripts/check_trigger_evals.ts +1 -1
- package/src/scripts/conformance_scan.ts +44 -3
- package/src/scripts/explain_run.ts +1 -1
- package/src/scripts/generate_capability_matrix.ts +1 -1
- package/src/scripts/git_authorization_hook.ts +75 -1
- package/src/scripts/handoff_context_hook.ts +54 -7
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +14 -11
- package/src/scripts/hooks/augment-dispatcher.sh +1 -1
- package/src/scripts/hooks/category_a.ts +291 -0
- package/src/scripts/hooks/cline-dispatcher.sh +1 -1
- package/src/scripts/hooks/cursor-dispatcher.sh +11 -5
- package/src/scripts/hooks/dispatch_hook.ts +17 -22
- package/src/scripts/hooks/git_command_classifier.ts +156 -1
- package/src/scripts/hooks/host_lowering.ts +215 -0
- package/src/scripts/hooks/host_lowering.yaml +185 -0
- package/src/scripts/hooks/host_semantics.ts +105 -37
- package/src/scripts/hooks/journal_record_hook.ts +10 -0
- package/src/scripts/hooks/permission_gate.ts +117 -0
- package/src/scripts/hooks/session_eol_hook.ts +18 -7
- package/src/scripts/hooks_status.ts +12 -10
- package/src/scripts/install.ts +57 -86
- package/src/scripts/install_anthropic_key.sh +2 -2
- package/src/scripts/lint_agent_security.ts +316 -25
- package/src/scripts/lint_confusables.ts +42 -6
- package/src/scripts/lint_design_antipattern_parity.ts +80 -0
- package/src/scripts/lint_evidence_artifacts.ts +45 -1
- package/src/scripts/lint_handoffs.ts +0 -132
- package/src/scripts/lint_hidden_unicode.ts +49 -7
- package/src/scripts/lint_hook_manifest.ts +87 -3
- package/src/scripts/lint_instruction_smuggling.ts +42 -6
- package/src/scripts/lint_mcp_config_security.ts +42 -6
- package/src/scripts/lint_motion_authority_drift.ts +731 -0
- package/src/scripts/lint_readme_size.ts +158 -12
- package/src/scripts/lint_reasoning_fixtures.ts +216 -0
- package/src/scripts/lint_roadmap_later_disposition.ts +217 -27
- package/src/scripts/lint_skill_frontmatter_safety.ts +43 -7
- package/src/scripts/lint_skill_trigger_contradiction.ts +161 -0
- package/src/scripts/mcp_server/resources.ts +41 -0
- package/src/scripts/mcp_server/telemetry.ts +19 -4
- package/src/scripts/measure_sibling_naming.ts +150 -0
- package/src/scripts/orchestration_record.ts +12 -1
- package/src/scripts/redact_hook_capture.ts +1 -1
- package/src/scripts/release.ts +24 -24
- package/src/scripts/release_publication.ts +6 -2
- package/src/scripts/report_skill_activation.ts +319 -7
- package/src/scripts/schemas/review-findings.schema.json +5 -0
- package/src/scripts/schemas/skill.schema.json +2 -2
- package/src/scripts/self_repair_cli.ts +31 -1
- package/src/scripts/session_canary_hook.ts +1 -1
- package/src/scripts/session_register_hook.ts +4 -3
- package/src/scripts/skill_scout.ts +69 -0
- package/src/scripts/trigger_eval_grandfather.json +5 -1
- package/src/scripts/validate_agent_settings.ts +1 -1
- package/dist/cli-delegate/chunk-2GNWGMAL.js +0 -172
- package/dist/cli-delegate/chunk-LPPWO5CE.js +0 -161
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Call telemetry for the stdio-lite MCP server (roadmap step 4.1).
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS EXISTS. Before it, `grep -rn 'telemetry|collector|record'
|
|
5
|
+
* src/cli/mcp/*.ts` was empty: the two lite tools were invisible, so every
|
|
6
|
+
* statement about whether the lite surface is used at all was an assumption.
|
|
7
|
+
* One row per `tools/call` turns that into a reading — including a zero, which
|
|
8
|
+
* is a result.
|
|
9
|
+
*
|
|
10
|
+
* THREE CONSTRAINTS THE ROADMAP SET, AND HOW EACH IS MET.
|
|
11
|
+
*
|
|
12
|
+
* - **No second sink.** Rows go to the sink that already collects MCP
|
|
13
|
+
* `tools/call` records, `agents/runtime/mcp-telemetry/calls.jsonl`, through
|
|
14
|
+
* the same `record_call` the kernel server uses. Nothing new is created.
|
|
15
|
+
* - **No new consent gate.** The switch is the EXISTING
|
|
16
|
+
* `telemetry.artifact_engagement.enabled` key, default `false`. No key is
|
|
17
|
+
* introduced, so a consumer who has not opted into telemetry does not
|
|
18
|
+
* acquire a new thing to opt out of.
|
|
19
|
+
* - **One row per call, none when off.** `recordLiteCall` is the only writer
|
|
20
|
+
* and returns `null` without touching the filesystem when the gate is off.
|
|
21
|
+
*
|
|
22
|
+
* PRIVACY BY CONSTRUCTION. Two fields are caller-influenced and both are
|
|
23
|
+
* clamped at the boundary. `host` is resolved against a CLOSED vocabulary; an
|
|
24
|
+
* unrecognised client name becomes `other`, never the string the client sent.
|
|
25
|
+
* `tool_name` is caller-supplied on the wire — a client may call
|
|
26
|
+
* `tools/call` with ANY name — so a name outside a conservative identifier
|
|
27
|
+
* shape is recorded as `other_tool` rather than stored verbatim. Without that
|
|
28
|
+
* clamp the sink would accept a path or a secret as a tool name and this
|
|
29
|
+
* report would print it. The record therefore has no field capable of carrying
|
|
30
|
+
* free-form text, and there is no scrubbing pass that could fail because there
|
|
31
|
+
* is nothing to scrub. The client-install hash comes from the kernel collector
|
|
32
|
+
* unchanged.
|
|
33
|
+
*
|
|
34
|
+
* NEVER THROWS. Telemetry must not break the wire surface; every path here
|
|
35
|
+
* either records or returns `null`.
|
|
36
|
+
*/
|
|
37
|
+
import * as fs from 'node:fs';
|
|
38
|
+
import * as path from 'node:path';
|
|
39
|
+
import { record_call } from '../../scripts/mcp_server/telemetry.js';
|
|
40
|
+
/** Transport label for this surface — distinguishes it from the kernel server. */
|
|
41
|
+
export const LITE_TRANSPORT = 'stdio-lite';
|
|
42
|
+
/** The settings key that gates every row. Deliberately an EXISTING key. */
|
|
43
|
+
export const LITE_TELEMETRY_SETTING = 'telemetry.artifact_engagement.enabled';
|
|
44
|
+
/**
|
|
45
|
+
* The closed host vocabulary.
|
|
46
|
+
*
|
|
47
|
+
* Membership is what makes the field non-identifying: a value is either one of
|
|
48
|
+
* these literals, `other`, or `unknown`. It is matched against the MCP
|
|
49
|
+
* `clientInfo.name` a client sends at `initialize`, lower-cased, with `_` and
|
|
50
|
+
* spaces folded to `-`; a name that merely CONTAINS one of these is resolved to
|
|
51
|
+
* it, because clients ship names like `claude-code-cli` and `Cursor (0.42)`.
|
|
52
|
+
*/
|
|
53
|
+
export const KNOWN_HOSTS = [
|
|
54
|
+
'claude-code',
|
|
55
|
+
'claude-desktop',
|
|
56
|
+
'cursor',
|
|
57
|
+
'windsurf',
|
|
58
|
+
'cline',
|
|
59
|
+
'gemini-cli',
|
|
60
|
+
'copilot',
|
|
61
|
+
'augment',
|
|
62
|
+
'aider',
|
|
63
|
+
'codex',
|
|
64
|
+
'roocode',
|
|
65
|
+
'continue',
|
|
66
|
+
'kilocode',
|
|
67
|
+
'zed',
|
|
68
|
+
'jetbrains',
|
|
69
|
+
'kiro',
|
|
70
|
+
'opencode',
|
|
71
|
+
'trae',
|
|
72
|
+
'warp',
|
|
73
|
+
];
|
|
74
|
+
/** No `initialize` seen yet, or it carried no client name. */
|
|
75
|
+
export const HOST_UNKNOWN = 'unknown';
|
|
76
|
+
/** A client name that is not in the closed vocabulary. Never the raw string. */
|
|
77
|
+
export const HOST_OTHER = 'other';
|
|
78
|
+
/**
|
|
79
|
+
* Resolve a client-supplied name onto the closed vocabulary.
|
|
80
|
+
*
|
|
81
|
+
* Longest match first, so `claude-desktop` is not swallowed by a shorter
|
|
82
|
+
* sibling and `claude-code` wins over a bare `claude` substring.
|
|
83
|
+
*/
|
|
84
|
+
export function normalizeHost(clientName) {
|
|
85
|
+
if (typeof clientName !== 'string')
|
|
86
|
+
return HOST_UNKNOWN;
|
|
87
|
+
const folded = clientName.trim().toLowerCase().replace(/[_\s]+/g, '-');
|
|
88
|
+
if (folded === '')
|
|
89
|
+
return HOST_UNKNOWN;
|
|
90
|
+
const byLength = [...KNOWN_HOSTS].sort((a, b) => b.length - a.length);
|
|
91
|
+
for (const known of byLength) {
|
|
92
|
+
if (folded === known || folded.includes(known))
|
|
93
|
+
return known;
|
|
94
|
+
}
|
|
95
|
+
return HOST_OTHER;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The shape a tool name must have to be stored verbatim.
|
|
99
|
+
*
|
|
100
|
+
* Conservative on purpose: MCP tool names are identifiers, so anything with a
|
|
101
|
+
* separator, whitespace, or unusual length is not a tool name that this surface
|
|
102
|
+
* could ever serve — it is caller-supplied text, and text is what must not
|
|
103
|
+
* reach the store.
|
|
104
|
+
*/
|
|
105
|
+
const TOOL_NAME_RE = /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$/;
|
|
106
|
+
/** A caller-supplied name that is not identifier-shaped. Never the raw string. */
|
|
107
|
+
export const TOOL_OTHER = 'other_tool';
|
|
108
|
+
/**
|
|
109
|
+
* Clamp a wire tool name onto a storable one.
|
|
110
|
+
*
|
|
111
|
+
* A name this surface actually serves always passes; an unknown but
|
|
112
|
+
* identifier-shaped name passes too, because that is the latent-demand signal
|
|
113
|
+
* the store exists to carry. Everything else becomes `other_tool`.
|
|
114
|
+
*/
|
|
115
|
+
export function normalizeToolName(name, isLiteTool) {
|
|
116
|
+
if (typeof name !== 'string' || name === '')
|
|
117
|
+
return '';
|
|
118
|
+
if (isLiteTool)
|
|
119
|
+
return name;
|
|
120
|
+
return TOOL_NAME_RE.test(name) ? name : TOOL_OTHER;
|
|
121
|
+
}
|
|
122
|
+
/** `str.strip()` on both ends, matching the sibling settings peeks in `src/cli`. */
|
|
123
|
+
function _strip(s) {
|
|
124
|
+
return s.replace(/^[ \t\r\f\v]+/, '').replace(/[ \t\r\f\v]+$/, '');
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Read `telemetry.artifact_engagement.enabled` from a project settings file.
|
|
128
|
+
*
|
|
129
|
+
* A deliberately small nested-key peek over the YAML subset this package's own
|
|
130
|
+
* settings files are written in — the same shape `workspace_crypto.isEnabled`
|
|
131
|
+
* and `workspace_analytics` already use in `src/cli`, and for the same reason:
|
|
132
|
+
* the lite server must stay pure-Node with no YAML dependency.
|
|
133
|
+
*
|
|
134
|
+
* Every failure resolves to `false`. Missing file, unreadable file, missing
|
|
135
|
+
* section, missing key and an unparseable value are all indistinguishable and
|
|
136
|
+
* all mean OFF — the default-off doctrine the engagement collector states for
|
|
137
|
+
* itself.
|
|
138
|
+
*/
|
|
139
|
+
export function liteTelemetryEnabled(settingsPath) {
|
|
140
|
+
const p = settingsPath ?? path.join(process.cwd(), '.agent-settings.yml');
|
|
141
|
+
let text;
|
|
142
|
+
try {
|
|
143
|
+
text = fs.readFileSync(p, 'utf-8');
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
// Track the two nesting levels the key needs: `telemetry:` at column 0,
|
|
149
|
+
// then `artifact_engagement:` beneath it, then `enabled:` beneath that.
|
|
150
|
+
let inTelemetry = false;
|
|
151
|
+
let inSection = false;
|
|
152
|
+
let sectionIndent = -1;
|
|
153
|
+
for (const raw of text.split(/\r\n|\r|\n/)) {
|
|
154
|
+
const line = raw.replace(/[ \t\r\f\v]+$/, '');
|
|
155
|
+
if (line === '' || _strip(line).startsWith('#'))
|
|
156
|
+
continue;
|
|
157
|
+
const indent = line.length - line.replace(/^ +/, '').length;
|
|
158
|
+
const body = _strip(line);
|
|
159
|
+
if (indent === 0) {
|
|
160
|
+
inTelemetry = body === 'telemetry:';
|
|
161
|
+
inSection = false;
|
|
162
|
+
sectionIndent = -1;
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (!inTelemetry)
|
|
166
|
+
continue;
|
|
167
|
+
if (!inSection) {
|
|
168
|
+
if (body === 'artifact_engagement:') {
|
|
169
|
+
inSection = true;
|
|
170
|
+
sectionIndent = indent;
|
|
171
|
+
}
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
// Left the section — a sibling key at or above its indent closes it.
|
|
175
|
+
if (indent <= sectionIndent) {
|
|
176
|
+
inSection = body === 'artifact_engagement:';
|
|
177
|
+
if (inSection)
|
|
178
|
+
sectionIndent = indent;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (body.startsWith('enabled:')) {
|
|
182
|
+
const value = _strip(body.slice('enabled:'.length)).toLowerCase();
|
|
183
|
+
return value === 'true' || value === 'yes' || value === 'on';
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Classify one lite `tools/call`.
|
|
190
|
+
*
|
|
191
|
+
* `implemented` — a lite tool ran. `stub` — the name is not on this surface, so
|
|
192
|
+
* the `not_implemented` envelope was returned, which is exactly the condition
|
|
193
|
+
* the kernel collector defines that outcome for. The lite server cannot
|
|
194
|
+
* distinguish "in the kernel catalogue but absent here" from "in no catalogue
|
|
195
|
+
* at all", so it never claims `latent_demand`: the kernel server owns that
|
|
196
|
+
* distinction, and guessing it here would put an unearned claim in the store.
|
|
197
|
+
*/
|
|
198
|
+
export function classifyLiteOutcome(isLiteTool) {
|
|
199
|
+
return isLiteTool ? 'implemented' : 'stub';
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Append exactly one row for one `tools/call`, or nothing.
|
|
203
|
+
*
|
|
204
|
+
* Returns the record written, or `null` when the gate is off or the write
|
|
205
|
+
* failed. Never throws.
|
|
206
|
+
*/
|
|
207
|
+
export function recordLiteCall(options) {
|
|
208
|
+
const { toolName, isLiteTool, host, consumerRoot, settingsPath } = options;
|
|
209
|
+
const stored = normalizeToolName(toolName, isLiteTool);
|
|
210
|
+
if (stored === '')
|
|
211
|
+
return null;
|
|
212
|
+
try {
|
|
213
|
+
if (!liteTelemetryEnabled(settingsPath))
|
|
214
|
+
return null;
|
|
215
|
+
return record_call({
|
|
216
|
+
tool_name: stored,
|
|
217
|
+
outcome: classifyLiteOutcome(isLiteTool),
|
|
218
|
+
transport: LITE_TRANSPORT,
|
|
219
|
+
consumer_root: consumerRoot,
|
|
220
|
+
host,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
catch {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=telemetry.js.map
|