@skillsmith/core 0.9.0 → 0.10.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/CHANGELOG.md +12 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/src/api/client.d.ts.map +1 -1
- package/dist/src/api/client.js +6 -0
- package/dist/src/api/client.js.map +1 -1
- package/dist/src/api/client.test.d.ts +9 -0
- package/dist/src/api/client.test.d.ts.map +1 -0
- package/dist/src/api/client.test.js +81 -0
- package/dist/src/api/client.test.js.map +1 -0
- package/dist/src/exports/services.d.ts +3 -1
- package/dist/src/exports/services.d.ts.map +1 -1
- package/dist/src/exports/services.js +7 -1
- package/dist/src/exports/services.js.map +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/install/agent-config-merge.json-array.d.ts +29 -0
- package/dist/src/install/agent-config-merge.json-array.d.ts.map +1 -0
- package/dist/src/install/agent-config-merge.json-array.js +100 -0
- package/dist/src/install/agent-config-merge.json-array.js.map +1 -0
- package/dist/src/install/agent-config-merge.json.d.ts +37 -0
- package/dist/src/install/agent-config-merge.json.d.ts.map +1 -0
- package/dist/src/install/agent-config-merge.json.js +134 -0
- package/dist/src/install/agent-config-merge.json.js.map +1 -0
- package/dist/src/install/agent-config-merge.toml-block.d.ts +48 -0
- package/dist/src/install/agent-config-merge.toml-block.d.ts.map +1 -0
- package/dist/src/install/agent-config-merge.toml-block.js +107 -0
- package/dist/src/install/agent-config-merge.toml-block.js.map +1 -0
- package/dist/src/install/agent-config-merge.types.d.ts +87 -0
- package/dist/src/install/agent-config-merge.types.d.ts.map +1 -0
- package/dist/src/install/agent-config-merge.types.js +83 -0
- package/dist/src/install/agent-config-merge.types.js.map +1 -0
- package/dist/src/install/agent-config-merge.yaml.d.ts +46 -0
- package/dist/src/install/agent-config-merge.yaml.d.ts.map +1 -0
- package/dist/src/install/agent-config-merge.yaml.js +133 -0
- package/dist/src/install/agent-config-merge.yaml.js.map +1 -0
- package/dist/src/install/agent-config-merge.yaml.test.d.ts +2 -0
- package/dist/src/install/agent-config-merge.yaml.test.d.ts.map +1 -0
- package/dist/src/install/agent-config-merge.yaml.test.js +210 -0
- package/dist/src/install/agent-config-merge.yaml.test.js.map +1 -0
- package/dist/src/install/agent-harness-targets.d.ts +98 -0
- package/dist/src/install/agent-harness-targets.d.ts.map +1 -0
- package/dist/src/install/agent-harness-targets.js +154 -0
- package/dist/src/install/agent-harness-targets.js.map +1 -0
- package/dist/src/install/agent-home-relocate.d.ts +29 -0
- package/dist/src/install/agent-home-relocate.d.ts.map +1 -0
- package/dist/src/install/agent-home-relocate.js +38 -0
- package/dist/src/install/agent-home-relocate.js.map +1 -0
- package/dist/src/install/agent-manifest-path-guard.d.ts +55 -0
- package/dist/src/install/agent-manifest-path-guard.d.ts.map +1 -0
- package/dist/src/install/agent-manifest-path-guard.js +109 -0
- package/dist/src/install/agent-manifest-path-guard.js.map +1 -0
- package/dist/src/install/agent-manifest-path-guard.test.d.ts +2 -0
- package/dist/src/install/agent-manifest-path-guard.test.d.ts.map +1 -0
- package/dist/src/install/agent-manifest-path-guard.test.js +72 -0
- package/dist/src/install/agent-manifest-path-guard.test.js.map +1 -0
- package/dist/src/install/agent-manifest.d.ts +58 -0
- package/dist/src/install/agent-manifest.d.ts.map +1 -0
- package/dist/src/install/agent-manifest.js +103 -0
- package/dist/src/install/agent-manifest.js.map +1 -0
- package/dist/src/install/agent-pack-installer.d.ts +39 -0
- package/dist/src/install/agent-pack-installer.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.entry.d.ts +55 -0
- package/dist/src/install/agent-pack-installer.entry.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.entry.js +90 -0
- package/dist/src/install/agent-pack-installer.entry.js.map +1 -0
- package/dist/src/install/agent-pack-installer.fs-helpers.d.ts +33 -0
- package/dist/src/install/agent-pack-installer.fs-helpers.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.fs-helpers.js +59 -0
- package/dist/src/install/agent-pack-installer.fs-helpers.js.map +1 -0
- package/dist/src/install/agent-pack-installer.harness.d.ts +66 -0
- package/dist/src/install/agent-pack-installer.harness.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.harness.js +310 -0
- package/dist/src/install/agent-pack-installer.harness.js.map +1 -0
- package/dist/src/install/agent-pack-installer.js +221 -0
- package/dist/src/install/agent-pack-installer.js.map +1 -0
- package/dist/src/install/agent-pack-installer.preserve.test.d.ts +11 -0
- package/dist/src/install/agent-pack-installer.preserve.test.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.preserve.test.js +72 -0
- package/dist/src/install/agent-pack-installer.preserve.test.js.map +1 -0
- package/dist/src/install/agent-pack-installer.test.d.ts +2 -0
- package/dist/src/install/agent-pack-installer.test.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.test.js +350 -0
- package/dist/src/install/agent-pack-installer.test.js.map +1 -0
- package/dist/src/install/agent-pack-installer.types.d.ts +51 -0
- package/dist/src/install/agent-pack-installer.types.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.types.js +16 -0
- package/dist/src/install/agent-pack-installer.types.js.map +1 -0
- package/dist/src/install/agent-pack-uninstaller.d.ts +43 -0
- package/dist/src/install/agent-pack-uninstaller.d.ts.map +1 -0
- package/dist/src/install/agent-pack-uninstaller.js +113 -0
- package/dist/src/install/agent-pack-uninstaller.js.map +1 -0
- package/dist/src/install/agent-pack-uninstaller.test.d.ts +2 -0
- package/dist/src/install/agent-pack-uninstaller.test.d.ts.map +1 -0
- package/dist/src/install/agent-pack-uninstaller.test.js +212 -0
- package/dist/src/install/agent-pack-uninstaller.test.js.map +1 -0
- package/dist/src/install/index.d.ts +7 -0
- package/dist/src/install/index.d.ts.map +1 -1
- package/dist/src/install/index.js +7 -0
- package/dist/src/install/index.js.map +1 -1
- package/dist/src/install/paths.d.ts +1 -1
- package/dist/src/install/paths.d.ts.map +1 -1
- package/dist/src/install/paths.js +4 -0
- package/dist/src/install/paths.js.map +1 -1
- package/dist/src/install/paths.test.js +15 -0
- package/dist/src/install/paths.test.js.map +1 -1
- package/dist/src/journal/hash.d.ts +13 -0
- package/dist/src/journal/hash.d.ts.map +1 -0
- package/dist/src/journal/hash.js +16 -0
- package/dist/src/journal/hash.js.map +1 -0
- package/dist/src/journal/index.d.ts +15 -0
- package/dist/src/journal/index.d.ts.map +1 -0
- package/dist/src/journal/index.js +15 -0
- package/dist/src/journal/index.js.map +1 -0
- package/dist/src/journal/journal.test.d.ts +16 -0
- package/dist/src/journal/journal.test.d.ts.map +1 -0
- package/dist/src/journal/journal.test.js +171 -0
- package/dist/src/journal/journal.test.js.map +1 -0
- package/dist/src/journal/path.d.ts +44 -0
- package/dist/src/journal/path.d.ts.map +1 -0
- package/dist/src/journal/path.js +61 -0
- package/dist/src/journal/path.js.map +1 -0
- package/dist/src/journal/reader.d.ts +38 -0
- package/dist/src/journal/reader.d.ts.map +1 -0
- package/dist/src/journal/reader.js +93 -0
- package/dist/src/journal/reader.js.map +1 -0
- package/dist/src/journal/types.d.ts +87 -0
- package/dist/src/journal/types.d.ts.map +1 -0
- package/dist/src/journal/types.js +21 -0
- package/dist/src/journal/types.js.map +1 -0
- package/dist/src/journal/writer.d.ts +52 -0
- package/dist/src/journal/writer.d.ts.map +1 -0
- package/dist/src/journal/writer.js +125 -0
- package/dist/src/journal/writer.js.map +1 -0
- package/dist/src/paywall-triggers/index.d.ts +13 -0
- package/dist/src/paywall-triggers/index.d.ts.map +1 -0
- package/dist/src/paywall-triggers/index.js +13 -0
- package/dist/src/paywall-triggers/index.js.map +1 -0
- package/dist/src/paywall-triggers/path.d.ts +47 -0
- package/dist/src/paywall-triggers/path.d.ts.map +1 -0
- package/dist/src/paywall-triggers/path.js +73 -0
- package/dist/src/paywall-triggers/path.js.map +1 -0
- package/dist/src/paywall-triggers/store.d.ts +75 -0
- package/dist/src/paywall-triggers/store.d.ts.map +1 -0
- package/dist/src/paywall-triggers/store.js +122 -0
- package/dist/src/paywall-triggers/store.js.map +1 -0
- package/dist/src/paywall-triggers/store.test.d.ts +2 -0
- package/dist/src/paywall-triggers/store.test.d.ts.map +1 -0
- package/dist/src/paywall-triggers/store.test.js +121 -0
- package/dist/src/paywall-triggers/store.test.js.map +1 -0
- package/dist/src/paywall-triggers/types.d.ts +24 -0
- package/dist/src/paywall-triggers/types.d.ts.map +1 -0
- package/dist/src/paywall-triggers/types.js +13 -0
- package/dist/src/paywall-triggers/types.js.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.compound.d.ts +13 -0
- package/dist/src/security/scanner/SecurityScanner.compound.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.compound.js +127 -0
- package/dist/src/security/scanner/SecurityScanner.compound.js.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.d.ts.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.js +10 -1
- package/dist/src/security/scanner/SecurityScanner.js.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.pii.d.ts +23 -0
- package/dist/src/security/scanner/SecurityScanner.pii.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.pii.js +152 -0
- package/dist/src/security/scanner/SecurityScanner.pii.js.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.scanners.d.ts +5 -12
- package/dist/src/security/scanner/SecurityScanner.scanners.d.ts.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.scanners.js +63 -137
- package/dist/src/security/scanner/SecurityScanner.scanners.js.map +1 -1
- package/dist/src/security/scanner/patterns.d.ts +2 -0
- package/dist/src/security/scanner/patterns.d.ts.map +1 -1
- package/dist/src/security/scanner/patterns.js +79 -11
- package/dist/src/security/scanner/patterns.js.map +1 -1
- package/dist/src/security/scanner/types.d.ts +2 -0
- package/dist/src/security/scanner/types.d.ts.map +1 -1
- package/dist/src/services/agent-pack/agent-pack.test.d.ts +18 -0
- package/dist/src/services/agent-pack/agent-pack.test.d.ts.map +1 -0
- package/dist/src/services/agent-pack/agent-pack.test.js +344 -0
- package/dist/src/services/agent-pack/agent-pack.test.js.map +1 -0
- package/dist/src/services/agent-pack/hooks.d.ts +29 -0
- package/dist/src/services/agent-pack/hooks.d.ts.map +1 -0
- package/dist/src/services/agent-pack/hooks.js +139 -0
- package/dist/src/services/agent-pack/hooks.js.map +1 -0
- package/dist/src/services/agent-pack/index.d.ts +26 -0
- package/dist/src/services/agent-pack/index.d.ts.map +1 -0
- package/dist/src/services/agent-pack/index.js +109 -0
- package/dist/src/services/agent-pack/index.js.map +1 -0
- package/dist/src/services/agent-pack/prompt-source.d.ts +47 -0
- package/dist/src/services/agent-pack/prompt-source.d.ts.map +1 -0
- package/dist/src/services/agent-pack/prompt-source.js +182 -0
- package/dist/src/services/agent-pack/prompt-source.js.map +1 -0
- package/dist/src/services/agent-pack/shims.d.ts +40 -0
- package/dist/src/services/agent-pack/shims.d.ts.map +1 -0
- package/dist/src/services/agent-pack/shims.js +96 -0
- package/dist/src/services/agent-pack/shims.js.map +1 -0
- package/dist/src/services/agent-pack/skill-md.d.ts +35 -0
- package/dist/src/services/agent-pack/skill-md.d.ts.map +1 -0
- package/dist/src/services/agent-pack/skill-md.js +89 -0
- package/dist/src/services/agent-pack/skill-md.js.map +1 -0
- package/dist/src/services/agent-pack/types.d.ts +118 -0
- package/dist/src/services/agent-pack/types.d.ts.map +1 -0
- package/dist/src/services/agent-pack/types.js +61 -0
- package/dist/src/services/agent-pack/types.js.map +1 -0
- package/dist/src/services/agent-tool-profile.d.ts +59 -0
- package/dist/src/services/agent-tool-profile.d.ts.map +1 -0
- package/dist/src/services/agent-tool-profile.js +76 -0
- package/dist/src/services/agent-tool-profile.js.map +1 -0
- package/dist/src/services/agent-tool-profile.test.d.ts +2 -0
- package/dist/src/services/agent-tool-profile.test.d.ts.map +1 -0
- package/dist/src/services/agent-tool-profile.test.js +28 -0
- package/dist/src/services/agent-tool-profile.test.js.map +1 -0
- package/dist/src/services/bundled-sibling-scan.d.ts +111 -0
- package/dist/src/services/bundled-sibling-scan.d.ts.map +1 -0
- package/dist/src/services/bundled-sibling-scan.js +170 -0
- package/dist/src/services/bundled-sibling-scan.js.map +1 -0
- package/dist/src/services/skill-installation.io.d.ts +16 -5
- package/dist/src/services/skill-installation.io.d.ts.map +1 -1
- package/dist/src/services/skill-installation.io.js +44 -20
- package/dist/src/services/skill-installation.io.js.map +1 -1
- package/dist/src/services/skill-installation.policy.d.ts +96 -0
- package/dist/src/services/skill-installation.policy.d.ts.map +1 -0
- package/dist/src/services/skill-installation.policy.js +144 -0
- package/dist/src/services/skill-installation.policy.js.map +1 -0
- package/dist/src/services/skill-installation.service.d.ts.map +1 -1
- package/dist/src/services/skill-installation.service.js +9 -3
- package/dist/src/services/skill-installation.service.js.map +1 -1
- package/dist/src/sources/index.d.ts +1 -0
- package/dist/src/sources/index.d.ts.map +1 -1
- package/dist/src/sources/index.js +4 -0
- package/dist/src/sources/index.js.map +1 -1
- package/dist/src/sync/index.d.ts +1 -1
- package/dist/src/sync/index.d.ts.map +1 -1
- package/dist/src/sync/index.js +1 -1
- package/dist/src/sync/index.js.map +1 -1
- package/dist/src/sync/inventory-client.d.ts +16 -0
- package/dist/src/sync/inventory-client.d.ts.map +1 -1
- package/dist/src/sync/inventory-client.js +54 -0
- package/dist/src/sync/inventory-client.js.map +1 -1
- package/dist/src/sync/inventory-client.test.js +67 -1
- package/dist/src/sync/inventory-client.test.js.map +1 -1
- package/dist/src/sync/inventory-collector.d.ts.map +1 -1
- package/dist/src/sync/inventory-collector.js +32 -5
- package/dist/src/sync/inventory-collector.js.map +1 -1
- package/dist/src/sync/inventory-collector.test.js +50 -1
- package/dist/src/sync/inventory-collector.test.js.map +1 -1
- package/dist/src/sync/inventory-types.d.ts +9 -0
- package/dist/src/sync/inventory-types.d.ts.map +1 -1
- package/dist/src/sync/inventory-types.js +3 -0
- package/dist/src/sync/inventory-types.js.map +1 -1
- package/dist/src/telemetry/agent-marker.d.ts +137 -0
- package/dist/src/telemetry/agent-marker.d.ts.map +1 -0
- package/dist/src/telemetry/agent-marker.js +242 -0
- package/dist/src/telemetry/agent-marker.js.map +1 -0
- package/dist/src/telemetry/agent-marker.test.d.ts +13 -0
- package/dist/src/telemetry/agent-marker.test.d.ts.map +1 -0
- package/dist/src/telemetry/agent-marker.test.js +202 -0
- package/dist/src/telemetry/agent-marker.test.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +2 -1
- package/dist/src/telemetry/index.d.ts.map +1 -1
- package/dist/src/telemetry/index.js +6 -1
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/posthog.d.ts +10 -0
- package/dist/src/telemetry/posthog.d.ts.map +1 -1
- package/dist/src/telemetry/posthog.js +5 -1
- package/dist/src/telemetry/posthog.js.map +1 -1
- package/dist/src/telemetry/wrap.d.ts +28 -7
- package/dist/src/telemetry/wrap.d.ts.map +1 -1
- package/dist/src/telemetry/wrap.gate.test.d.ts +22 -0
- package/dist/src/telemetry/wrap.gate.test.d.ts.map +1 -0
- package/dist/src/telemetry/wrap.gate.test.js +197 -0
- package/dist/src/telemetry/wrap.gate.test.js.map +1 -0
- package/dist/src/telemetry/wrap.js +111 -26
- package/dist/src/telemetry/wrap.js.map +1 -1
- package/dist/src/telemetry/wrap.marker.test.d.ts +16 -0
- package/dist/src/telemetry/wrap.marker.test.d.ts.map +1 -0
- package/dist/src/telemetry/wrap.marker.test.js +185 -0
- package/dist/src/telemetry/wrap.marker.test.js.map +1 -0
- package/dist/src/telemetry/wrap.test.js +4 -0
- package/dist/src/telemetry/wrap.test.js.map +1 -1
- package/dist/tests/SecurityScanner.exec.test.js +60 -0
- package/dist/tests/SecurityScanner.exec.test.js.map +1 -1
- package/dist/tests/security/ContinuousSecurity.test.js +10 -4
- package/dist/tests/security/ContinuousSecurity.test.js.map +1 -1
- package/dist/tests/security/SecurityScanner.chmod-evasion.test.d.ts +2 -0
- package/dist/tests/security/SecurityScanner.chmod-evasion.test.d.ts.map +1 -0
- package/dist/tests/security/SecurityScanner.chmod-evasion.test.js +126 -0
- package/dist/tests/security/SecurityScanner.chmod-evasion.test.js.map +1 -0
- package/dist/tests/security/chmod-compound.test.d.ts +2 -0
- package/dist/tests/security/chmod-compound.test.d.ts.map +1 -0
- package/dist/tests/security/chmod-compound.test.js +188 -0
- package/dist/tests/security/chmod-compound.test.js.map +1 -0
- package/dist/tests/security/pii-detection.test.js +24 -0
- package/dist/tests/security/pii-detection.test.js.map +1 -1
- package/dist/tests/security/scanner-regression-guard.test.d.ts +23 -7
- package/dist/tests/security/scanner-regression-guard.test.d.ts.map +1 -1
- package/dist/tests/security/scanner-regression-guard.test.js +27 -11
- package/dist/tests/security/scanner-regression-guard.test.js.map +1 -1
- package/dist/tests/security/sensitive-path-fp.test.d.ts +2 -0
- package/dist/tests/security/sensitive-path-fp.test.d.ts.map +1 -0
- package/dist/tests/security/sensitive-path-fp.test.js +142 -0
- package/dist/tests/security/sensitive-path-fp.test.js.map +1 -0
- package/dist/tests/services/bundled-sibling-scan.test.d.ts +2 -0
- package/dist/tests/services/bundled-sibling-scan.test.d.ts.map +1 -0
- package/dist/tests/services/bundled-sibling-scan.test.js +139 -0
- package/dist/tests/services/bundled-sibling-scan.test.js.map +1 -0
- package/dist/tests/unit/services/skill-installation.io.test.js +166 -0
- package/dist/tests/unit/services/skill-installation.io.test.js.map +1 -1
- package/dist/tests/unit/services/skill-installation.policy.test.d.ts +8 -0
- package/dist/tests/unit/services/skill-installation.policy.test.d.ts.map +1 -0
- package/dist/tests/unit/services/skill-installation.policy.test.js +151 -0
- package/dist/tests/unit/services/skill-installation.policy.test.js.map +1 -0
- package/package.json +23 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,GACjB,MAAM,aAAa,CAAA;AAGpB,OAAO,EACL,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,eAAe,GACrB,MAAM,cAAc,CAAA;AAGrB,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,KAAK,uBAAuB,GAC7B,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,GACjB,MAAM,aAAa,CAAA;AAGpB,OAAO,EACL,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,eAAe,GACrB,MAAM,cAAc,CAAA;AAGrB,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,KAAK,uBAAuB,GAC7B,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAA;AAOrB,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,iBAAiB,GACvB,MAAM,WAAW,CAAA;AAGlB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EACxB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,eAAe,GACrB,MAAM,mBAAmB,CAAA;AAE1B;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,CAAC,EAAE;IACjD,OAAO,CAAC,EAAE,OAAO,aAAa,EAAE,YAAY,CAAA;IAC5C,OAAO,CAAC,EAAE,OAAO,cAAc,EAAE,aAAa,CAAA;CAC/C,GAAG,OAAO,CAAC,IAAI,CAAC,CAKhB;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAGvD"}
|
|
@@ -16,7 +16,12 @@ export { exportToPrometheus, getPrometheusMetrics, createPrometheusHandler, } fr
|
|
|
16
16
|
export { initializePostHog, shutdownPostHog, flushPostHog, trackEvent, trackSkillSearch, trackSkillView, trackSkillInstall, trackSkillInvoke, trackApiError, identifyUser, isFeatureFlagEnabled, getPostHog, isPostHogEnabled, ALLOWED_TRAITS, } from './posthog.js';
|
|
17
17
|
// In-process HOF + registry (SMI-5016)
|
|
18
18
|
// Emission gate (SMI-5019 wire-in) — privacy-safe default-suppress.
|
|
19
|
-
|
|
19
|
+
// - `runWithEmissionGate` (SMI-5479) — AsyncLocalStorage-scoped, per-call
|
|
20
|
+
// primary gate; `setEmissionGate` — deprecated process-wide fallback thunk.
|
|
21
|
+
// Marker context (SMI-5456) — AsyncLocalStorage-scoped agent-mediation marker.
|
|
22
|
+
export { withTelemetry, isTelemetered, setEmissionGate, runWithEmissionGate, runWithMarkerContext, } from './wrap.js';
|
|
23
|
+
// Agent-mediation marker channel (SMI-5456) — `_meta` + session marker file.
|
|
24
|
+
export { resolveAgentMarker, readSessionMarker, extractMarkerMeta, NO_AGENT_MARKER, AGENT_MARKER_TTL_MS, AGENT_MARKER_SCHEMA_VERSION, KNOWN_HARNESS_FRAMEWORKS, } from './agent-marker.js';
|
|
20
25
|
/**
|
|
21
26
|
* Initialize all telemetry (tracing + metrics)
|
|
22
27
|
* Call this at application startup
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,iBAAiB;AACjB,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,MAAM,GAIP,MAAM,aAAa,CAAA;AAEpB,kBAAkB;AAClB,OAAO,EACL,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,eAAe,GAOhB,MAAM,cAAc,CAAA;AAErB,gCAAgC;AAChC,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,GAExB,MAAM,iBAAiB,CAAA;AAExB,6BAA6B;AAC7B,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EAChB,cAAc,GAMf,MAAM,cAAc,CAAA;AAErB,uCAAuC;AACvC,oEAAoE;AACpE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,iBAAiB;AACjB,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,MAAM,GAIP,MAAM,aAAa,CAAA;AAEpB,kBAAkB;AAClB,OAAO,EACL,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,eAAe,GAOhB,MAAM,cAAc,CAAA;AAErB,gCAAgC;AAChC,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,GAExB,MAAM,iBAAiB,CAAA;AAExB,6BAA6B;AAC7B,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EAChB,cAAc,GAMf,MAAM,cAAc,CAAA;AAErB,uCAAuC;AACvC,oEAAoE;AACpE,4EAA4E;AAC5E,gFAAgF;AAChF,+EAA+E;AAC/E,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,oBAAoB,GAErB,MAAM,WAAW,CAAA;AAElB,6EAA6E;AAC7E,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,GAIzB,MAAM,mBAAmB,CAAA;AAE1B;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,MAGzC;IACC,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAA;IACzD,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAA;IAE1D,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;AAC7F,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAA;IACvD,MAAM,eAAe,EAAE,CAAA;AACzB,CAAC"}
|
|
@@ -152,6 +152,16 @@ export interface TrackSkillInvokeParams {
|
|
|
152
152
|
durationMs: number;
|
|
153
153
|
success: boolean;
|
|
154
154
|
distinctId?: string;
|
|
155
|
+
/**
|
|
156
|
+
* SMI-5456 agent-mediation marker fields. Per-event, non-identifying; they
|
|
157
|
+
* ride the same consent-gated event as the rest of the payload.
|
|
158
|
+
*/
|
|
159
|
+
/** True when the invocation is part of an agent-mediated session. */
|
|
160
|
+
agentSession?: boolean;
|
|
161
|
+
/** True when the invocation originated from a nudge. */
|
|
162
|
+
nudgeOrigin?: boolean;
|
|
163
|
+
/** Paywall / nudge trigger id, or null. */
|
|
164
|
+
triggerId?: string | null;
|
|
155
165
|
}
|
|
156
166
|
/**
|
|
157
167
|
* Convenience function to track skill invocation events (SMI-5016).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posthog.d.ts","sourceRoot":"","sources":["../../../src/telemetry/posthog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,4CAA4C;IAC5C,KAAK,CAAC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Install()` — positional for resolved-ID callers.
|
|
206
206
|
*/
|
|
207
207
|
export function trackSkillInvoke(params) {
|
|
208
|
-
const { skillId, source, framework, durationMs, success, distinctId = 'anonymous' } = params;
|
|
208
|
+
const { skillId, source, framework, durationMs, success, distinctId = 'anonymous', agentSession = false, nudgeOrigin = false, triggerId = null, } = params;
|
|
209
209
|
trackEvent(distinctId, 'skill_invoke', {
|
|
210
210
|
skill_id: skillId,
|
|
211
211
|
invoke_source: source,
|
|
212
212
|
framework,
|
|
213
213
|
duration_ms: durationMs,
|
|
214
214
|
success,
|
|
215
|
+
// SMI-5456: agent-mediation marker (per-event booleans + trigger id).
|
|
216
|
+
agent_session: agentSession,
|
|
217
|
+
nudge_origin: nudgeOrigin,
|
|
218
|
+
trigger_id: triggerId,
|
|
215
219
|
});
|
|
216
220
|
}
|
|
217
221
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posthog.js","sourceRoot":"","sources":["../../../src/telemetry/posthog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AA0DtC,qBAAqB;AACrB,IAAI,eAAe,GAAmB,IAAI,CAAA;AAC1C,IAAI,UAAU,GAAG,KAAK,CAAA;AAEtB;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAqB;IACrD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,UAAU,GAAG,IAAI,CAAA;QACjB,OAAM;IACR,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAA;QACjE,UAAU,GAAG,IAAI,CAAA;QACjB,OAAM;IACR,CAAC;IAED,eAAe,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;QAC3C,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,yBAAyB;QAC9C,aAAa,EAAE,MAA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IAE7B,UAAU,CAAC,UAAU,EAAE,YAAY,EAAE;QACnC,QAAQ,EAAE,OAAO;QACjB,MAAM;KACP,CAAC,CAAA;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,UAAkB,EAClB,OAAe,EACf,MAA6B;IAE7B,UAAU,CAAC,UAAU,EAAE,eAAe,EAAE;QACtC,QAAQ,EAAE,OAAO;QACjB,MAAM;KACP,CAAC,CAAA;AACJ,CAAC;AA0BD;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAA8B;IAC7D,MAAM,EACJ,OAAO,EACP,MAAM,EACN,SAAS,EACT,UAAU,EACV,OAAO,EACP,UAAU,GAAG,WAAW,EACxB,YAAY,GAAG,KAAK,EACpB,WAAW,GAAG,KAAK,EACnB,SAAS,GAAG,IAAI,GACjB,GAAG,MAAM,CAAA;IACV,UAAU,CAAC,UAAU,EAAE,cAAc,EAAE;QACrC,QAAQ,EAAE,OAAO;QACjB,aAAa,EAAE,MAAM;QACrB,SAAS;QACT,WAAW,EAAE,UAAU;QACvB,OAAO;QACP,sEAAsE;QACtE,aAAa,EAAE,YAAY;QAC3B,YAAY,EAAE,WAAW;QACzB,UAAU,EAAE,SAAS;KACtB,CAAC,CAAA;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,UAAkB,EAClB,SAAiB,EACjB,QAAgB,EAChB,UAAmB;IAEnB,UAAU,CAAC,UAAU,EAAE,WAAW,EAAE;QAClC,UAAU,EAAE,SAAS;QACrB,QAAQ;QACR,WAAW,EAAE,UAAU;KACxB,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -10,19 +10,40 @@
|
|
|
10
10
|
* mutation) so arrow-const exports can be wrapped without mutation.
|
|
11
11
|
* Applied review change H4: `framework` is captured per-call, not memoised.
|
|
12
12
|
*/
|
|
13
|
+
import type { AgentMarker } from './agent-marker.js';
|
|
13
14
|
type AnyFunction = (...args: never[]) => unknown;
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
+
* Run `fn` with `enabled` installed as the emission-gate decision for every
|
|
17
|
+
* telemetry emit inside its async continuation. Concurrency-safe: parallel
|
|
18
|
+
* invocations each see only their own value; code outside any
|
|
19
|
+
* `runWithEmissionGate` scope falls back to the module `let` (default-suppress
|
|
20
|
+
* when that too is unset).
|
|
16
21
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
22
|
+
* Takes a resolved boolean VALUE (consent resolved once at dispatch) — contrast
|
|
23
|
+
* `setEmissionGate`, which takes a predicate thunk. The value is read live in
|
|
24
|
+
* the emit path, so an in-flight call always observes the gate active for ITS
|
|
25
|
+
* OWN scope, never a sibling's.
|
|
26
|
+
*/
|
|
27
|
+
export declare function runWithEmissionGate<T>(enabled: boolean, fn: () => Promise<T>): Promise<T>;
|
|
28
|
+
/**
|
|
29
|
+
* Install (or clear) the process-wide FALLBACK emission gate.
|
|
21
30
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
31
|
+
* @deprecated Prefer `runWithEmissionGate`, which scopes the decision to a
|
|
32
|
+
* single call's async continuation and auto-unwinds — no reset discipline, no
|
|
33
|
+
* cross-call leak. `setEmissionGate` survives only as a test seam and the
|
|
34
|
+
* pre-SMI-5479 fallback: its predicate is consulted (evaluated once per wrapped
|
|
35
|
+
* call, in the `finally` block) ONLY when no `runWithEmissionGate` scope is
|
|
36
|
+
* active. Pass a predicate to enable emission when it returns true; pass
|
|
37
|
+
* `undefined` to revert to default-suppress.
|
|
24
38
|
*/
|
|
25
39
|
export declare function setEmissionGate(gate: (() => boolean) | undefined): void;
|
|
40
|
+
/**
|
|
41
|
+
* Run `fn` with `marker` installed as the agent-mediation context for every
|
|
42
|
+
* telemetry emit inside its async continuation. Concurrency-safe: parallel
|
|
43
|
+
* invocations each see only their own marker; code outside any
|
|
44
|
+
* `runWithMarkerContext` scope sees no marker (fields default false/false/null).
|
|
45
|
+
*/
|
|
46
|
+
export declare function runWithMarkerContext<T>(marker: AgentMarker, fn: () => Promise<T>): Promise<T>;
|
|
26
47
|
/**
|
|
27
48
|
* Options for `withTelemetry`.
|
|
28
49
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../../src/telemetry/wrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../../src/telemetry/wrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AASpD,KAAK,WAAW,GAAG,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,CAAA;AAwChD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEzF;AAOD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,CAEvE;AAsBD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAE7F;AAMD;;;;;;GAMG;AAMH,MAAM,WAAW,iBAAiB,CAAC,KAAK,SAAS,SAAS,OAAO,EAAE;IACjE,8EAA8E;IAC9E,MAAM,EAAE,UAAU,GAAG,KAAK,GAAG,kBAAkB,CAAA;IAC/C,qEAAqE;IACrE,cAAc,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAA;IACvC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAA;CAC3C;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,KAAK,SAAS,SAAS,OAAO,EAAE,EAAE,OAAO,EACrE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,EACvD,IAAI,EAAE,iBAAiB,CAAC,KAAK,CAAC,GAC7B,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CA0DtC;AAMD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAEtD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-5479: `runWithEmissionGate` (AsyncLocalStorage emission gate) unit +
|
|
3
|
+
* concurrency coverage. Sibling to `wrap.test.ts` (split per the 500-line file
|
|
4
|
+
* gate); the pre-SMI-5479 module-`let` emission-gate cases stay in
|
|
5
|
+
* `wrap.test.ts` §9 untouched, proving the retained fallback's zero churn.
|
|
6
|
+
*
|
|
7
|
+
* Covers:
|
|
8
|
+
* - T5: `runWithEmissionGate` unit — basic emit/suppress, nested scopes
|
|
9
|
+
* (inner shadows outer), auto-unwind on return AND on throw,
|
|
10
|
+
* ALS-store-beats-module-`let` precedence, fallback to the module `let`
|
|
11
|
+
* when no store is present, and the false-shadow pin
|
|
12
|
+
* (`setEmissionGate(() => true)` + active `runWithEmissionGate(false, …)`
|
|
13
|
+
* → zero emit — pins `??` vs `||` at the emit read; an accidental `||`
|
|
14
|
+
* would leak emission from a consent-off call).
|
|
15
|
+
* - T3: parallel no-bleed for the GATE (P-5 heart) — manually-resolved
|
|
16
|
+
* promises interleave one scope's exit against an in-flight call in another
|
|
17
|
+
* scope; the in-flight call still emits per ITS OWN scope. The committed
|
|
18
|
+
* regression pin for the `wrap.ts` ALS-precedence read — it fails if that
|
|
19
|
+
* read is ever reverted to consult the module `let` only.
|
|
20
|
+
*/
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=wrap.gate.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap.gate.test.d.ts","sourceRoot":"","sources":["../../../src/telemetry/wrap.gate.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-5479: `runWithEmissionGate` (AsyncLocalStorage emission gate) unit +
|
|
3
|
+
* concurrency coverage. Sibling to `wrap.test.ts` (split per the 500-line file
|
|
4
|
+
* gate); the pre-SMI-5479 module-`let` emission-gate cases stay in
|
|
5
|
+
* `wrap.test.ts` §9 untouched, proving the retained fallback's zero churn.
|
|
6
|
+
*
|
|
7
|
+
* Covers:
|
|
8
|
+
* - T5: `runWithEmissionGate` unit — basic emit/suppress, nested scopes
|
|
9
|
+
* (inner shadows outer), auto-unwind on return AND on throw,
|
|
10
|
+
* ALS-store-beats-module-`let` precedence, fallback to the module `let`
|
|
11
|
+
* when no store is present, and the false-shadow pin
|
|
12
|
+
* (`setEmissionGate(() => true)` + active `runWithEmissionGate(false, …)`
|
|
13
|
+
* → zero emit — pins `??` vs `||` at the emit read; an accidental `||`
|
|
14
|
+
* would leak emission from a consent-off call).
|
|
15
|
+
* - T3: parallel no-bleed for the GATE (P-5 heart) — manually-resolved
|
|
16
|
+
* promises interleave one scope's exit against an in-flight call in another
|
|
17
|
+
* scope; the in-flight call still emits per ITS OWN scope. The committed
|
|
18
|
+
* regression pin for the `wrap.ts` ALS-precedence read — it fails if that
|
|
19
|
+
* read is ever reverted to consult the module `let` only.
|
|
20
|
+
*/
|
|
21
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
22
|
+
import { withTelemetry, setEmissionGate, runWithEmissionGate } from './wrap.js';
|
|
23
|
+
vi.mock('./posthog.js', () => ({
|
|
24
|
+
trackSkillInvoke: vi.fn(),
|
|
25
|
+
}));
|
|
26
|
+
import { trackSkillInvoke } from './posthog.js';
|
|
27
|
+
const mockTrack = vi.mocked(trackSkillInvoke);
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
mockTrack.mockReset();
|
|
30
|
+
// No module `let` gate by default — the ALS scope is the unit under test.
|
|
31
|
+
// Cases that exercise the fallback / false-shadow install one explicitly.
|
|
32
|
+
setEmissionGate(undefined);
|
|
33
|
+
});
|
|
34
|
+
afterEach(() => {
|
|
35
|
+
setEmissionGate(undefined);
|
|
36
|
+
// The ALS gate needs no reset — `runWithEmissionGate` auto-scopes to its
|
|
37
|
+
// callback, so nothing can leak across tests.
|
|
38
|
+
});
|
|
39
|
+
const BASE_OPTS = {
|
|
40
|
+
source: 'mcp-tool',
|
|
41
|
+
extractSkillId: () => 'test/skill',
|
|
42
|
+
};
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
// T5 — runWithEmissionGate unit
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
describe('runWithEmissionGate (T5 — ALS emission gate)', () => {
|
|
47
|
+
it('emits inside a runWithEmissionGate(true) scope', async () => {
|
|
48
|
+
const wrapped = withTelemetry(() => 'ok', BASE_OPTS);
|
|
49
|
+
await runWithEmissionGate(true, () => wrapped());
|
|
50
|
+
expect(mockTrack).toHaveBeenCalledOnce();
|
|
51
|
+
});
|
|
52
|
+
it('suppresses inside a runWithEmissionGate(false) scope', async () => {
|
|
53
|
+
const wrapped = withTelemetry(() => 'ok', BASE_OPTS);
|
|
54
|
+
await runWithEmissionGate(false, () => wrapped());
|
|
55
|
+
expect(mockTrack).not.toHaveBeenCalled();
|
|
56
|
+
});
|
|
57
|
+
it('nested scopes — inner false shadows outer true (no emit)', async () => {
|
|
58
|
+
const wrapped = withTelemetry(() => 'ok', BASE_OPTS);
|
|
59
|
+
await runWithEmissionGate(true, () => runWithEmissionGate(false, () => wrapped()));
|
|
60
|
+
expect(mockTrack).not.toHaveBeenCalled();
|
|
61
|
+
});
|
|
62
|
+
it('nested scopes — inner true shadows outer false (emit)', async () => {
|
|
63
|
+
const wrapped = withTelemetry(() => 'ok', BASE_OPTS);
|
|
64
|
+
await runWithEmissionGate(false, () => runWithEmissionGate(true, () => wrapped()));
|
|
65
|
+
expect(mockTrack).toHaveBeenCalledOnce();
|
|
66
|
+
});
|
|
67
|
+
it('auto-unwinds on return — a call after the scope resolves falls back to default-suppress', async () => {
|
|
68
|
+
const wrapped = withTelemetry(() => 'ok', BASE_OPTS);
|
|
69
|
+
await runWithEmissionGate(true, () => wrapped());
|
|
70
|
+
expect(mockTrack).toHaveBeenCalledOnce();
|
|
71
|
+
mockTrack.mockReset();
|
|
72
|
+
// Outside the scope now — no module gate installed → default-suppress.
|
|
73
|
+
await wrapped();
|
|
74
|
+
expect(mockTrack).not.toHaveBeenCalled();
|
|
75
|
+
});
|
|
76
|
+
it('auto-unwinds on throw — the scope does not leak to a later out-of-scope call', async () => {
|
|
77
|
+
const boom = withTelemetry(() => {
|
|
78
|
+
throw new Error('handler exploded');
|
|
79
|
+
}, BASE_OPTS);
|
|
80
|
+
await expect(runWithEmissionGate(true, () => boom())).rejects.toThrow('handler exploded');
|
|
81
|
+
// The throwing call itself emits (success:false) — the `finally` runs inside
|
|
82
|
+
// the still-live scope.
|
|
83
|
+
expect(mockTrack).toHaveBeenCalledOnce();
|
|
84
|
+
expect(mockTrack).toHaveBeenCalledWith(expect.objectContaining({ success: false }));
|
|
85
|
+
mockTrack.mockReset();
|
|
86
|
+
// The scope has unwound — a later out-of-scope call must not inherit `true`.
|
|
87
|
+
const wrapped = withTelemetry(() => 'ok', BASE_OPTS);
|
|
88
|
+
await wrapped();
|
|
89
|
+
expect(mockTrack).not.toHaveBeenCalled();
|
|
90
|
+
});
|
|
91
|
+
it('ALS store beats the module `let` — store true wins over a module-`let` false', async () => {
|
|
92
|
+
setEmissionGate(() => false);
|
|
93
|
+
const wrapped = withTelemetry(() => 'ok', BASE_OPTS);
|
|
94
|
+
await runWithEmissionGate(true, () => wrapped());
|
|
95
|
+
expect(mockTrack).toHaveBeenCalledOnce();
|
|
96
|
+
});
|
|
97
|
+
it('false-shadow pin (`??` not `||`) — store false wins over a permissive module `let`', async () => {
|
|
98
|
+
// The heart of the `??` vs `||` pin: a permissive module gate is installed,
|
|
99
|
+
// but an active consent-OFF ALS scope must suppress. `||` would let the
|
|
100
|
+
// module `true` leak emission from a consent-off call.
|
|
101
|
+
setEmissionGate(() => true);
|
|
102
|
+
const wrapped = withTelemetry(() => 'ok', BASE_OPTS);
|
|
103
|
+
await runWithEmissionGate(false, () => wrapped());
|
|
104
|
+
expect(mockTrack).not.toHaveBeenCalled();
|
|
105
|
+
});
|
|
106
|
+
it('falls back to the module `let` when no ALS scope is present (thunk true → emit)', async () => {
|
|
107
|
+
setEmissionGate(() => true);
|
|
108
|
+
const wrapped = withTelemetry(() => 'ok', BASE_OPTS);
|
|
109
|
+
await wrapped();
|
|
110
|
+
expect(mockTrack).toHaveBeenCalledOnce();
|
|
111
|
+
});
|
|
112
|
+
it('falls back to the module `let` when no ALS scope is present (thunk false → no emit)', async () => {
|
|
113
|
+
setEmissionGate(() => false);
|
|
114
|
+
const wrapped = withTelemetry(() => 'ok', BASE_OPTS);
|
|
115
|
+
await wrapped();
|
|
116
|
+
expect(mockTrack).not.toHaveBeenCalled();
|
|
117
|
+
});
|
|
118
|
+
it('default-suppress — no ALS scope and no module gate → no emit', async () => {
|
|
119
|
+
const wrapped = withTelemetry(() => 'ok', BASE_OPTS);
|
|
120
|
+
await wrapped();
|
|
121
|
+
expect(mockTrack).not.toHaveBeenCalled();
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
// ---------------------------------------------------------------------------
|
|
125
|
+
// T3 — parallel no-bleed for the GATE (P-5 heart; committed regression pin)
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
describe('parallel no-bleed for the emission gate (T3 — P-5 invariant)', () => {
|
|
128
|
+
it('concurrent calls in different gate scopes each emit per their OWN scope', async () => {
|
|
129
|
+
// Failure mode this guards: if the emit read ignored the ALS store (a
|
|
130
|
+
// revert of the `wrap.ts` precedence read to the module `let` only), a
|
|
131
|
+
// consent-ON call's emit would be governed by whatever shared state last
|
|
132
|
+
// held — here call A's consent-OFF scope exiting mid-flight of B. Force the
|
|
133
|
+
// interleaving with manually-resolved promises: A (gate OFF) and B (gate
|
|
134
|
+
// ON) both start; A finishes (and must NOT emit) while B is still awaiting;
|
|
135
|
+
// then B finishes and MUST still emit per its own ON scope.
|
|
136
|
+
let releaseA;
|
|
137
|
+
let releaseB;
|
|
138
|
+
const blockA = new Promise((r) => (releaseA = r));
|
|
139
|
+
const blockB = new Promise((r) => (releaseB = r));
|
|
140
|
+
const emitted = [];
|
|
141
|
+
mockTrack.mockImplementation((p) => {
|
|
142
|
+
emitted.push(p.skillId);
|
|
143
|
+
});
|
|
144
|
+
const wrappedA = withTelemetry(async () => {
|
|
145
|
+
await blockA;
|
|
146
|
+
return 'A';
|
|
147
|
+
}, { ...BASE_OPTS, extractSkillId: () => 'tool-a' });
|
|
148
|
+
const wrappedB = withTelemetry(async () => {
|
|
149
|
+
await blockB;
|
|
150
|
+
return 'B';
|
|
151
|
+
}, { ...BASE_OPTS, extractSkillId: () => 'tool-b' });
|
|
152
|
+
// A in a consent-OFF scope, B in a consent-ON scope, both in flight.
|
|
153
|
+
const callA = runWithEmissionGate(false, () => wrappedA());
|
|
154
|
+
const callB = runWithEmissionGate(true, () => wrappedB());
|
|
155
|
+
// A completes (its `finally` runs inside A's OFF scope) while B still awaits.
|
|
156
|
+
releaseA();
|
|
157
|
+
await callA;
|
|
158
|
+
expect(emitted).toEqual([]); // A suppressed correctly; B not yet emitted.
|
|
159
|
+
// B completes — its emit reads B's OWN ON scope, not A's exited OFF scope.
|
|
160
|
+
releaseB();
|
|
161
|
+
await callB;
|
|
162
|
+
expect(emitted).toEqual(['tool-b']);
|
|
163
|
+
});
|
|
164
|
+
it('a sibling ON call still emits after a nested (middleware-style) ON scope unwinds', async () => {
|
|
165
|
+
// Models the double-gate reconciliation (Steps 2-3): an outer dispatch
|
|
166
|
+
// scope (ON) drives call X through a NESTED runWithEmissionGate (the
|
|
167
|
+
// middleware's own scope) that resolves and auto-unwinds first, while a
|
|
168
|
+
// sibling direct-dispatch call Y (ON) is still in flight. Y's emit must
|
|
169
|
+
// still fire — the inner scope's exit must not disturb Y's own scope.
|
|
170
|
+
let releaseX;
|
|
171
|
+
let releaseY;
|
|
172
|
+
const blockX = new Promise((r) => (releaseX = r));
|
|
173
|
+
const blockY = new Promise((r) => (releaseY = r));
|
|
174
|
+
const emitted = [];
|
|
175
|
+
mockTrack.mockImplementation((p) => {
|
|
176
|
+
emitted.push(p.skillId);
|
|
177
|
+
});
|
|
178
|
+
const wrappedX = withTelemetry(async () => {
|
|
179
|
+
await blockX;
|
|
180
|
+
return 'X';
|
|
181
|
+
}, { ...BASE_OPTS, extractSkillId: () => 'tool-x' });
|
|
182
|
+
const wrappedY = withTelemetry(async () => {
|
|
183
|
+
await blockY;
|
|
184
|
+
return 'Y';
|
|
185
|
+
}, { ...BASE_OPTS, extractSkillId: () => 'tool-y' });
|
|
186
|
+
// X: a nested ON scope inside an ON dispatch scope (the double-gate shape).
|
|
187
|
+
const callX = runWithEmissionGate(true, () => runWithEmissionGate(true, () => wrappedX()));
|
|
188
|
+
// Y: a sibling direct-dispatch ON scope, in flight.
|
|
189
|
+
const callY = runWithEmissionGate(true, () => wrappedY());
|
|
190
|
+
releaseX();
|
|
191
|
+
await callX;
|
|
192
|
+
releaseY();
|
|
193
|
+
await callY;
|
|
194
|
+
expect(emitted).toEqual(['tool-x', 'tool-y']);
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
//# sourceMappingURL=wrap.gate.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap.gate.test.js","sourceRoot":"","sources":["../../../src/telemetry/wrap.gate.test.ts"],"names":[],"mappings":"AAAA;;;;;;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G,aAAa,CAC5B,KAAK,IAAI,EAAE;YACT,MAAM,MAAM,CAAA;YACZ,OAAO,GAAG,CAAA;QACZ,CAAC,EACD,EAAE,GAAG,SAAS,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CACjD,CAAA;QACD,MAAM,QAAQ,GAAG,aAAa,CAC5B,KAAK,IAAI,EAAE;YACT,MAAM,MAAM,CAAA;YACZ,OAAO,GAAG,CAAA;QACZ,CAAC,EACD,EAAE,GAAG,SAAS,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CACjD,CAAA;QAED,4EAA4E;QAC5E,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;QAC1F,oDAAoD;QACpD,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAA;QAEzD,QAAQ,EAAE,CAAA;QACV,MAAM,KAAK,CAAA;QACX,QAAQ,EAAE,CAAA;QACV,MAAM,KAAK,CAAA;QAEX,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAA;IAC/C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -10,43 +10,106 @@
|
|
|
10
10
|
* mutation) so arrow-const exports can be wrapped without mutation.
|
|
11
11
|
* Applied review change H4: `framework` is captured per-call, not memoised.
|
|
12
12
|
*/
|
|
13
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
13
14
|
import { trackSkillInvoke } from './posthog.js';
|
|
14
15
|
const wrapped = new Set();
|
|
15
16
|
// ---------------------------------------------------------------------------
|
|
16
|
-
// Emission gate (SMI-5019 wire-in)
|
|
17
|
+
// Emission gate (SMI-5019 wire-in; SMI-5479 AsyncLocalStorage refactor)
|
|
17
18
|
// ---------------------------------------------------------------------------
|
|
18
19
|
//
|
|
19
|
-
// Default-suppress: until an emission gate is
|
|
20
|
-
//
|
|
21
|
-
// (e.g. the mcp-server license-gate middleware) MUST call `setEmissionGate`
|
|
22
|
-
// during request handling to enable emission for their context.
|
|
23
|
-
//
|
|
24
|
-
// The alternative (default-emit) would be backwards-compatible but risks
|
|
20
|
+
// Default-suppress: until an emission gate is active, `withTelemetry` does NOT
|
|
21
|
+
// emit. Privacy-safe by construction — the alternative (default-emit) risks
|
|
25
22
|
// emitting telemetry for an unknown anonymous_id before consent has been
|
|
26
|
-
// resolved. We pick the privacy-safe default per SMI-5019; a misconfigured
|
|
27
|
-
//
|
|
28
|
-
//
|
|
23
|
+
// resolved. We pick the privacy-safe default per SMI-5019; a misconfigured host
|
|
24
|
+
// that never opens a gate simply emits no telemetry, which is observable
|
|
25
|
+
// (counts stay at zero) and recoverable.
|
|
29
26
|
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
|
|
27
|
+
// Two gates feed the emit-path read (in the `finally` block below), in
|
|
28
|
+
// precedence order:
|
|
29
|
+
//
|
|
30
|
+
// 1. `emissionGateStorage` (PRIMARY) — an `AsyncLocalStorage<boolean>`
|
|
31
|
+
// scoped per tool call via `runWithEmissionGate`. New call sites (the
|
|
32
|
+
// mcp-server dispatch handler + license-gate middleware) resolve consent
|
|
33
|
+
// ONCE at dispatch and pass that resolved VALUE into the scope; the store
|
|
34
|
+
// then governs every emit for the whole of that call's async
|
|
35
|
+
// continuation. Mirrors the marker-context ALS below one-for-one — the
|
|
36
|
+
// reason nested / concurrent installs are safe: `.run()` is reentrant and
|
|
37
|
+
// each async continuation is isolated, so a sibling call can never observe
|
|
38
|
+
// or clear this call's gate.
|
|
39
|
+
// 2. `emissionGate` (FALLBACK) — a process-wide module `let`, a THUNK
|
|
40
|
+
// installed via `setEmissionGate`, consulted only when no ALS store is
|
|
41
|
+
// present. Retained solely as a test seam and a deprecated fallback for
|
|
42
|
+
// the pre-SMI-5479 shape; new production code MUST use
|
|
43
|
+
// `runWithEmissionGate`.
|
|
44
|
+
//
|
|
45
|
+
// Multi-tenancy caveat (RESOLVED by SMI-5479): the gate used to be purely
|
|
46
|
+
// module-scoped, which a future multi-tenant transport could not share safely.
|
|
47
|
+
// The `AsyncLocalStorage`-backed per-request state that caveat deferred is now
|
|
48
|
+
// applied here — per-call scope isolates concurrent consents. See the matching
|
|
49
|
+
// note in `license.gate.ts`.
|
|
50
|
+
const emissionGateStorage = new AsyncLocalStorage();
|
|
35
51
|
/**
|
|
36
|
-
*
|
|
52
|
+
* Run `fn` with `enabled` installed as the emission-gate decision for every
|
|
53
|
+
* telemetry emit inside its async continuation. Concurrency-safe: parallel
|
|
54
|
+
* invocations each see only their own value; code outside any
|
|
55
|
+
* `runWithEmissionGate` scope falls back to the module `let` (default-suppress
|
|
56
|
+
* when that too is unset).
|
|
37
57
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
58
|
+
* Takes a resolved boolean VALUE (consent resolved once at dispatch) — contrast
|
|
59
|
+
* `setEmissionGate`, which takes a predicate thunk. The value is read live in
|
|
60
|
+
* the emit path, so an in-flight call always observes the gate active for ITS
|
|
61
|
+
* OWN scope, never a sibling's.
|
|
62
|
+
*/
|
|
63
|
+
export function runWithEmissionGate(enabled, fn) {
|
|
64
|
+
return emissionGateStorage.run(enabled, fn);
|
|
65
|
+
}
|
|
66
|
+
// Process-wide FALLBACK gate — a module `let` thunk (test-only / deprecated).
|
|
67
|
+
// Superseded by `runWithEmissionGate`; retained so existing unit tests and any
|
|
68
|
+
// pre-SMI-5479 caller keep working with zero churn.
|
|
69
|
+
let emissionGate;
|
|
70
|
+
/**
|
|
71
|
+
* Install (or clear) the process-wide FALLBACK emission gate.
|
|
42
72
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
73
|
+
* @deprecated Prefer `runWithEmissionGate`, which scopes the decision to a
|
|
74
|
+
* single call's async continuation and auto-unwinds — no reset discipline, no
|
|
75
|
+
* cross-call leak. `setEmissionGate` survives only as a test seam and the
|
|
76
|
+
* pre-SMI-5479 fallback: its predicate is consulted (evaluated once per wrapped
|
|
77
|
+
* call, in the `finally` block) ONLY when no `runWithEmissionGate` scope is
|
|
78
|
+
* active. Pass a predicate to enable emission when it returns true; pass
|
|
79
|
+
* `undefined` to revert to default-suppress.
|
|
45
80
|
*/
|
|
46
81
|
export function setEmissionGate(gate) {
|
|
47
82
|
emissionGate = gate;
|
|
48
83
|
}
|
|
49
84
|
// ---------------------------------------------------------------------------
|
|
85
|
+
// Agent-mediation marker context (SMI-5456)
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
//
|
|
88
|
+
// The three per-event marker fields (`agent_session`, `nudge_origin`,
|
|
89
|
+
// `trigger_id`) do not live in the handler's arguments — they arrive on the MCP
|
|
90
|
+
// request's `_meta` or a session marker file, both resolved by the dispatch
|
|
91
|
+
// layer. The dispatcher runs each dispatch inside `runWithMarkerContext` and
|
|
92
|
+
// `withTelemetry` reads the store live in its emit path — never memoised,
|
|
93
|
+
// mirroring the per-call `framework` capture (H4).
|
|
94
|
+
//
|
|
95
|
+
// `AsyncLocalStorage` (not a module-scoped variable) because harnesses batch
|
|
96
|
+
// PARALLEL tool calls to one server process (Claude Code emits multiple
|
|
97
|
+
// tool_use blocks in one response). A module-scoped slot would let call A's
|
|
98
|
+
// completion clear call B's still-in-flight marker — silently zeroing
|
|
99
|
+
// `agent_session` on genuinely mediated calls and undercounting the mediation
|
|
100
|
+
// gate metric. ALS scopes the marker to each call's own async continuation, so
|
|
101
|
+
// concurrent calls cannot observe or clear each other's context.
|
|
102
|
+
const markerStorage = new AsyncLocalStorage();
|
|
103
|
+
/**
|
|
104
|
+
* Run `fn` with `marker` installed as the agent-mediation context for every
|
|
105
|
+
* telemetry emit inside its async continuation. Concurrency-safe: parallel
|
|
106
|
+
* invocations each see only their own marker; code outside any
|
|
107
|
+
* `runWithMarkerContext` scope sees no marker (fields default false/false/null).
|
|
108
|
+
*/
|
|
109
|
+
export function runWithMarkerContext(marker, fn) {
|
|
110
|
+
return markerStorage.run(marker, fn);
|
|
111
|
+
}
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
50
113
|
// HOF
|
|
51
114
|
// ---------------------------------------------------------------------------
|
|
52
115
|
/**
|
|
@@ -86,15 +149,37 @@ export function withTelemetry(handler, opts) {
|
|
|
86
149
|
// Emit BEFORE the catch re-throw lands; swallow telemetry errors so they
|
|
87
150
|
// never affect the wrapped function's observable behaviour.
|
|
88
151
|
try {
|
|
89
|
-
// SMI-5019 wire-in: consult the emission gate.
|
|
90
|
-
//
|
|
91
|
-
|
|
152
|
+
// SMI-5019 wire-in / SMI-5479 refactor: consult the emission gate. The
|
|
153
|
+
// per-call ALS store (PRIMARY) wins over the module `let` thunk
|
|
154
|
+
// (FALLBACK). `??` — not `||` — so an ALS `false` suppresses even when a
|
|
155
|
+
// permissive module gate is installed: a consent-off scope must never
|
|
156
|
+
// leak emission. Default-suppress holds when neither is present (no
|
|
157
|
+
// store + no thunk → `undefined` → no emit).
|
|
158
|
+
const gateOn = emissionGateStorage.getStore() ?? (emissionGate ? emissionGate() : undefined);
|
|
159
|
+
if (gateOn) {
|
|
160
|
+
// SMI-5456: thread the marker from this call's ALS scope into the
|
|
161
|
+
// event. Read here (not memoised) so it reflects the marker installed
|
|
162
|
+
// for THIS call's async continuation — concurrent calls each see
|
|
163
|
+
// their own. Consent parity is automatic — these fields only ride an
|
|
164
|
+
// event that the emission gate already permitted.
|
|
165
|
+
const marker = markerStorage.getStore();
|
|
92
166
|
trackSkillInvoke({
|
|
93
167
|
skillId,
|
|
94
168
|
source: opts.source,
|
|
95
|
-
|
|
169
|
+
// Per-harness attribution: the marker channel's vocabulary-validated
|
|
170
|
+
// `harness` wins over the extractor result — every MCP-tool call
|
|
171
|
+
// site hardcodes `extractFramework: () => 'unknown'`, so without
|
|
172
|
+
// this the per-harness split never survives to the wire. H4
|
|
173
|
+
// (per-call, never memoised) is preserved: the ALS store IS
|
|
174
|
+
// per-request state, read here on every emit. CLI / VS Code
|
|
175
|
+
// callers never install marker context, so `getStore()` is
|
|
176
|
+
// undefined there and their real extractors keep winning.
|
|
177
|
+
framework: marker?.harness ?? framework,
|
|
96
178
|
durationMs: Date.now() - start,
|
|
97
179
|
success,
|
|
180
|
+
agentSession: marker?.agentSession ?? false,
|
|
181
|
+
nudgeOrigin: marker?.nudgeOrigin ?? false,
|
|
182
|
+
triggerId: marker?.triggerId ?? null,
|
|
98
183
|
});
|
|
99
184
|
}
|
|
100
185
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap.js","sourceRoot":"","sources":["../../../src/telemetry/wrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"wrap.js","sourceRoot":"","sources":["../../../src/telemetry/wrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAY/C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAe,CAAA;AAEtC,8EAA8E;AAC9E,wEAAwE;AACxE,8EAA8E;AAC9E,EAAE;AACF,+EAA+E;AAC/E,4EAA4E;AAC5E,yEAAyE;AACzE,gFAAgF;AAChF,yEAAyE;AACzE,yCAAyC;AACzC,EAAE;AACF,uEAAuE;AACvE,oBAAoB;AACpB,EAAE;AACF,yEAAyE;AACzE,2EAA2E;AAC3E,8EAA8E;AAC9E,+EAA+E;AAC/E,kEAAkE;AAClE,4EAA4E;AAC5E,+EAA+E;AAC/E,gFAAgF;AAChF,kCAAkC;AAClC,wEAAwE;AACxE,4EAA4E;AAC5E,6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,MAAM,EAAE,WAAW,IAAI,KAAK;wBACzC,SAAS,EAAE,MAAM,EAAE,SAAS,IAAI,IAAI;qBACrC,CAAC,CAAA;gBACJ,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,kEAAkE;YACpE,CAAC;QACH,CAAC;IACH,CAAC,CAAA;IAED,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACtB,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,EAAe;IAC3C,OAAO,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AACxB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-5456: withTelemetry agent-mediation marker threading + Tier-2 framework
|
|
3
|
+
* emission. Sibling to `wrap.test.ts` (split per the 500-line file gate).
|
|
4
|
+
*
|
|
5
|
+
* Covers:
|
|
6
|
+
* - marker context threaded into the emitted payload (via runWithMarkerContext)
|
|
7
|
+
* - defaults false / false / null outside any marker scope
|
|
8
|
+
* - consent parity (suppressed gate emits nothing, marker or not)
|
|
9
|
+
* - concurrent no-bleed (P-5 invariant) — parallel calls each emit their
|
|
10
|
+
* OWN marker; an unscoped call stays neutral while others' scopes are live
|
|
11
|
+
* - per-framework emission incl. the opencode / hermes enum additions
|
|
12
|
+
* - marker `harness` feeds the event's `framework` (single-point per-harness
|
|
13
|
+
* attribution — MCP call sites hardcode `extractFramework: () => 'unknown'`)
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=wrap.marker.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap.marker.test.d.ts","sourceRoot":"","sources":["../../../src/telemetry/wrap.marker.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|