autotel 2.23.0 → 2.24.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.
Files changed (84) hide show
  1. package/bin/intent.js +6 -0
  2. package/dist/auto.cjs +2 -2
  3. package/dist/auto.js +1 -1
  4. package/dist/{chunk-GY4CRZSV.js → chunk-2D74YR4Z.js} +3 -3
  5. package/dist/{chunk-GY4CRZSV.js.map → chunk-2D74YR4Z.js.map} +1 -1
  6. package/dist/{chunk-724XLWR3.js → chunk-47KW5CV7.js} +87 -4
  7. package/dist/chunk-47KW5CV7.js.map +1 -0
  8. package/dist/{chunk-3ZFDJJWZ.cjs → chunk-AXNPD6XW.cjs} +26 -26
  9. package/dist/{chunk-3ZFDJJWZ.cjs.map → chunk-AXNPD6XW.cjs.map} +1 -1
  10. package/dist/{chunk-BSZP4URK.cjs → chunk-CLR5RQW4.cjs} +5 -5
  11. package/dist/{chunk-BSZP4URK.cjs.map → chunk-CLR5RQW4.cjs.map} +1 -1
  12. package/dist/{chunk-AXFWWJF3.cjs → chunk-CSG2D3BZ.cjs} +7 -7
  13. package/dist/{chunk-AXFWWJF3.cjs.map → chunk-CSG2D3BZ.cjs.map} +1 -1
  14. package/dist/{chunk-MSUHW2I4.cjs → chunk-CZR7PJUZ.cjs} +13 -13
  15. package/dist/{chunk-MSUHW2I4.cjs.map → chunk-CZR7PJUZ.cjs.map} +1 -1
  16. package/dist/{chunk-IPKXURBW.js → chunk-GSZJOYFF.js} +3 -3
  17. package/dist/{chunk-IPKXURBW.js.map → chunk-GSZJOYFF.js.map} +1 -1
  18. package/dist/{chunk-WCIIFRGL.js → chunk-IJMW6CTV.js} +3 -3
  19. package/dist/{chunk-WCIIFRGL.js.map → chunk-IJMW6CTV.js.map} +1 -1
  20. package/dist/{chunk-HSEIUH7F.cjs → chunk-PDRIJURL.cjs} +86 -2
  21. package/dist/chunk-PDRIJURL.cjs.map +1 -0
  22. package/dist/{chunk-4RZ4JUBY.cjs → chunk-W6U2BUHU.cjs} +5 -5
  23. package/dist/{chunk-4RZ4JUBY.cjs.map → chunk-W6U2BUHU.cjs.map} +1 -1
  24. package/dist/{chunk-5XUEHX7J.js → chunk-Z3BQYTZE.js} +3 -3
  25. package/dist/{chunk-5XUEHX7J.js.map → chunk-Z3BQYTZE.js.map} +1 -1
  26. package/dist/{chunk-3AMR5XLZ.js → chunk-ZJTBAUXG.js} +3 -3
  27. package/dist/{chunk-3AMR5XLZ.js.map → chunk-ZJTBAUXG.js.map} +1 -1
  28. package/dist/decorators.cjs +2 -2
  29. package/dist/decorators.js +2 -2
  30. package/dist/enrichers.cjs +90 -0
  31. package/dist/enrichers.cjs.map +1 -0
  32. package/dist/enrichers.d.cts +23 -0
  33. package/dist/enrichers.d.ts +23 -0
  34. package/dist/enrichers.js +86 -0
  35. package/dist/enrichers.js.map +1 -0
  36. package/dist/event.cjs +5 -5
  37. package/dist/event.js +2 -2
  38. package/dist/functional.cjs +9 -9
  39. package/dist/functional.js +2 -2
  40. package/dist/index.cjs +63 -41
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.cts +10 -3
  43. package/dist/index.d.ts +10 -3
  44. package/dist/index.js +28 -11
  45. package/dist/index.js.map +1 -1
  46. package/dist/{init-BC5aN8bh.d.cts → init-Co9CWOY6.d.cts} +16 -0
  47. package/dist/{init-_FG4IbhF.d.ts → init-oLqNJTpj.d.ts} +16 -0
  48. package/dist/instrumentation.cjs +8 -8
  49. package/dist/instrumentation.js +1 -1
  50. package/dist/messaging.cjs +6 -6
  51. package/dist/messaging.js +3 -3
  52. package/dist/semantic-helpers.cjs +7 -7
  53. package/dist/semantic-helpers.js +3 -3
  54. package/dist/webhook.cjs +3 -3
  55. package/dist/webhook.js +2 -2
  56. package/dist/workflow-distributed.cjs +4 -4
  57. package/dist/workflow-distributed.js +2 -2
  58. package/dist/workflow.cjs +7 -7
  59. package/dist/workflow.js +3 -3
  60. package/dist/yaml-config.d.cts +1 -1
  61. package/dist/yaml-config.d.ts +1 -1
  62. package/package.json +45 -33
  63. package/skills/autotel-core/SKILL.md +162 -0
  64. package/skills/autotel-events/SKILL.md +88 -0
  65. package/skills/autotel-frameworks/SKILL.md +97 -0
  66. package/skills/autotel-instrumentation/SKILL.md +125 -0
  67. package/skills/autotel-request-logging/SKILL.md +100 -0
  68. package/skills/autotel-structured-errors/SKILL.md +130 -0
  69. package/src/enrichers.test.ts +150 -0
  70. package/src/enrichers.ts +145 -0
  71. package/src/index.ts +4 -0
  72. package/src/init-redactor.test.ts +8 -0
  73. package/src/init.ts +56 -0
  74. package/src/package-manifest.test.ts +24 -0
  75. package/src/posthog-logs.test.ts +115 -0
  76. package/src/posthog-logs.ts +77 -0
  77. package/src/redact-values.test.ts +76 -0
  78. package/src/redact-values.ts +27 -0
  79. package/src/request-logger.test.ts +14 -1
  80. package/src/request-logger.ts +11 -1
  81. package/src/structured-error.test.ts +30 -0
  82. package/src/structured-error.ts +11 -0
  83. package/dist/chunk-724XLWR3.js.map +0 -1
  84. package/dist/chunk-HSEIUH7F.cjs.map +0 -1
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkAXFWWJF3_cjs = require('./chunk-AXFWWJF3.cjs');
4
- require('./chunk-3ZFDJJWZ.cjs');
3
+ var chunkCSG2D3BZ_cjs = require('./chunk-CSG2D3BZ.cjs');
4
+ require('./chunk-AXNPD6XW.cjs');
5
5
  require('./chunk-W4EUTSB2.cjs');
6
6
  require('./chunk-GML3FBOT.cjs');
7
7
  require('./chunk-D5LMF53P.cjs');
8
8
  require('./chunk-XRKAL7WJ.cjs');
9
- require('./chunk-HSEIUH7F.cjs');
9
+ require('./chunk-PDRIJURL.cjs');
10
10
  require('./chunk-6YIDHH2S.cjs');
11
11
  require('./chunk-GVLK7YUU.cjs');
12
12
  require('./chunk-ZNMBW67B.cjs');
@@ -25,19 +25,19 @@ require('./chunk-JEQ2X3Z6.cjs');
25
25
 
26
26
  Object.defineProperty(exports, "traceDB", {
27
27
  enumerable: true,
28
- get: function () { return chunkAXFWWJF3_cjs.traceDB; }
28
+ get: function () { return chunkCSG2D3BZ_cjs.traceDB; }
29
29
  });
30
30
  Object.defineProperty(exports, "traceHTTP", {
31
31
  enumerable: true,
32
- get: function () { return chunkAXFWWJF3_cjs.traceHTTP; }
32
+ get: function () { return chunkCSG2D3BZ_cjs.traceHTTP; }
33
33
  });
34
34
  Object.defineProperty(exports, "traceLLM", {
35
35
  enumerable: true,
36
- get: function () { return chunkAXFWWJF3_cjs.traceLLM; }
36
+ get: function () { return chunkCSG2D3BZ_cjs.traceLLM; }
37
37
  });
38
38
  Object.defineProperty(exports, "traceMessaging", {
39
39
  enumerable: true,
40
- get: function () { return chunkAXFWWJF3_cjs.traceMessaging; }
40
+ get: function () { return chunkCSG2D3BZ_cjs.traceMessaging; }
41
41
  });
42
42
  //# sourceMappingURL=semantic-helpers.cjs.map
43
43
  //# sourceMappingURL=semantic-helpers.cjs.map
@@ -1,10 +1,10 @@
1
- export { traceDB, traceHTTP, traceLLM, traceMessaging } from './chunk-IPKXURBW.js';
2
- import './chunk-GY4CRZSV.js';
1
+ export { traceDB, traceHTTP, traceLLM, traceMessaging } from './chunk-GSZJOYFF.js';
2
+ import './chunk-2D74YR4Z.js';
3
3
  import './chunk-SR35DG5A.js';
4
4
  import './chunk-B3ZHLLMP.js';
5
5
  import './chunk-WD4RP6IV.js';
6
6
  import './chunk-USSL3D6L.js';
7
- import './chunk-724XLWR3.js';
7
+ import './chunk-47KW5CV7.js';
8
8
  import './chunk-YTGF4L2C.js';
9
9
  import './chunk-X4RMFFMR.js';
10
10
  import './chunk-WGWSHJ2N.js';
package/dist/webhook.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunk3ZFDJJWZ_cjs = require('./chunk-3ZFDJJWZ.cjs');
3
+ var chunkAXNPD6XW_cjs = require('./chunk-AXNPD6XW.cjs');
4
4
  require('./chunk-W4EUTSB2.cjs');
5
5
  require('./chunk-GML3FBOT.cjs');
6
6
  require('./chunk-D5LMF53P.cjs');
7
7
  require('./chunk-XRKAL7WJ.cjs');
8
- require('./chunk-HSEIUH7F.cjs');
8
+ require('./chunk-PDRIJURL.cjs');
9
9
  require('./chunk-6YIDHH2S.cjs');
10
10
  require('./chunk-GVLK7YUU.cjs');
11
11
  require('./chunk-ZNMBW67B.cjs');
@@ -148,7 +148,7 @@ function createParkingLot(config) {
148
148
  },
149
149
  traceCallback(callbackConfig) {
150
150
  return (fnFactory) => {
151
- return chunk3ZFDJJWZ_cjs.trace(
151
+ return chunkAXNPD6XW_cjs.trace(
152
152
  {
153
153
  name: callbackConfig.name,
154
154
  spanKind: api.SpanKind.SERVER
package/dist/webhook.js CHANGED
@@ -1,9 +1,9 @@
1
- import { trace } from './chunk-GY4CRZSV.js';
1
+ import { trace } from './chunk-2D74YR4Z.js';
2
2
  import './chunk-SR35DG5A.js';
3
3
  import './chunk-B3ZHLLMP.js';
4
4
  import './chunk-WD4RP6IV.js';
5
5
  import './chunk-USSL3D6L.js';
6
- import './chunk-724XLWR3.js';
6
+ import './chunk-47KW5CV7.js';
7
7
  import './chunk-YTGF4L2C.js';
8
8
  import './chunk-X4RMFFMR.js';
9
9
  import './chunk-WGWSHJ2N.js';
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkINJD3G4K_cjs = require('./chunk-INJD3G4K.cjs');
4
- var chunk3ZFDJJWZ_cjs = require('./chunk-3ZFDJJWZ.cjs');
4
+ var chunkAXNPD6XW_cjs = require('./chunk-AXNPD6XW.cjs');
5
5
  require('./chunk-W4EUTSB2.cjs');
6
6
  require('./chunk-GML3FBOT.cjs');
7
7
  require('./chunk-D5LMF53P.cjs');
8
8
  require('./chunk-XRKAL7WJ.cjs');
9
- require('./chunk-HSEIUH7F.cjs');
9
+ require('./chunk-PDRIJURL.cjs');
10
10
  require('./chunk-6YIDHH2S.cjs');
11
11
  require('./chunk-GVLK7YUU.cjs');
12
12
  require('./chunk-ZNMBW67B.cjs');
@@ -59,7 +59,7 @@ var WorkflowBaggage = chunkINJD3G4K_cjs.createSafeBaggageSchema(workflowBaggageF
59
59
  function traceDistributedWorkflow(config) {
60
60
  const spanName = `workflow.${config.name}`;
61
61
  return (fnFactory) => {
62
- return chunk3ZFDJJWZ_cjs.trace(
62
+ return chunkAXNPD6XW_cjs.trace(
63
63
  { name: spanName, spanKind: api.SpanKind.INTERNAL },
64
64
  (baseCtx) => {
65
65
  return async (...args) => {
@@ -158,7 +158,7 @@ function traceDistributedWorkflow(config) {
158
158
  function traceDistributedStep(config) {
159
159
  const spanName = `workflow.step.${config.name}`;
160
160
  return (fnFactory) => {
161
- return chunk3ZFDJJWZ_cjs.trace(
161
+ return chunkAXNPD6XW_cjs.trace(
162
162
  { name: spanName, spanKind: api.SpanKind.INTERNAL },
163
163
  (baseCtx) => {
164
164
  return async (...args) => {
@@ -1,10 +1,10 @@
1
1
  import { createSafeBaggageSchema } from './chunk-4IFSYQVX.js';
2
- import { trace } from './chunk-GY4CRZSV.js';
2
+ import { trace } from './chunk-2D74YR4Z.js';
3
3
  import './chunk-SR35DG5A.js';
4
4
  import './chunk-B3ZHLLMP.js';
5
5
  import './chunk-WD4RP6IV.js';
6
6
  import './chunk-USSL3D6L.js';
7
- import './chunk-724XLWR3.js';
7
+ import './chunk-47KW5CV7.js';
8
8
  import './chunk-YTGF4L2C.js';
9
9
  import './chunk-X4RMFFMR.js';
10
10
  import './chunk-WGWSHJ2N.js';
package/dist/workflow.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkBSZP4URK_cjs = require('./chunk-BSZP4URK.cjs');
4
- require('./chunk-3ZFDJJWZ.cjs');
3
+ var chunkCLR5RQW4_cjs = require('./chunk-CLR5RQW4.cjs');
4
+ require('./chunk-AXNPD6XW.cjs');
5
5
  require('./chunk-W4EUTSB2.cjs');
6
6
  require('./chunk-GML3FBOT.cjs');
7
7
  require('./chunk-D5LMF53P.cjs');
8
8
  require('./chunk-XRKAL7WJ.cjs');
9
- require('./chunk-HSEIUH7F.cjs');
9
+ require('./chunk-PDRIJURL.cjs');
10
10
  require('./chunk-6YIDHH2S.cjs');
11
11
  require('./chunk-GVLK7YUU.cjs');
12
12
  require('./chunk-ZNMBW67B.cjs');
@@ -25,19 +25,19 @@ require('./chunk-JEQ2X3Z6.cjs');
25
25
 
26
26
  Object.defineProperty(exports, "getCurrentWorkflowContext", {
27
27
  enumerable: true,
28
- get: function () { return chunkBSZP4URK_cjs.getCurrentWorkflowContext; }
28
+ get: function () { return chunkCLR5RQW4_cjs.getCurrentWorkflowContext; }
29
29
  });
30
30
  Object.defineProperty(exports, "isInWorkflow", {
31
31
  enumerable: true,
32
- get: function () { return chunkBSZP4URK_cjs.isInWorkflow; }
32
+ get: function () { return chunkCLR5RQW4_cjs.isInWorkflow; }
33
33
  });
34
34
  Object.defineProperty(exports, "traceStep", {
35
35
  enumerable: true,
36
- get: function () { return chunkBSZP4URK_cjs.traceStep; }
36
+ get: function () { return chunkCLR5RQW4_cjs.traceStep; }
37
37
  });
38
38
  Object.defineProperty(exports, "traceWorkflow", {
39
39
  enumerable: true,
40
- get: function () { return chunkBSZP4URK_cjs.traceWorkflow; }
40
+ get: function () { return chunkCLR5RQW4_cjs.traceWorkflow; }
41
41
  });
42
42
  //# sourceMappingURL=workflow.cjs.map
43
43
  //# sourceMappingURL=workflow.cjs.map
package/dist/workflow.js CHANGED
@@ -1,10 +1,10 @@
1
- export { getCurrentWorkflowContext, isInWorkflow, traceStep, traceWorkflow } from './chunk-WCIIFRGL.js';
2
- import './chunk-GY4CRZSV.js';
1
+ export { getCurrentWorkflowContext, isInWorkflow, traceStep, traceWorkflow } from './chunk-IJMW6CTV.js';
2
+ import './chunk-2D74YR4Z.js';
3
3
  import './chunk-SR35DG5A.js';
4
4
  import './chunk-B3ZHLLMP.js';
5
5
  import './chunk-WD4RP6IV.js';
6
6
  import './chunk-USSL3D6L.js';
7
- import './chunk-724XLWR3.js';
7
+ import './chunk-47KW5CV7.js';
8
8
  import './chunk-YTGF4L2C.js';
9
9
  import './chunk-X4RMFFMR.js';
10
10
  import './chunk-WGWSHJ2N.js';
@@ -1,4 +1,4 @@
1
- import { A as AutotelConfig } from './init-BC5aN8bh.cjs';
1
+ import { A as AutotelConfig } from './init-Co9CWOY6.cjs';
2
2
  import '@opentelemetry/sdk-trace-base';
3
3
  import '@opentelemetry/sdk-node';
4
4
  import '@opentelemetry/resources';
@@ -1,4 +1,4 @@
1
- import { A as AutotelConfig } from './init-_FG4IbhF.js';
1
+ import { A as AutotelConfig } from './init-oLqNJTpj.js';
2
2
  import '@opentelemetry/sdk-trace-base';
3
3
  import '@opentelemetry/sdk-node';
4
4
  import '@opentelemetry/resources';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autotel",
3
- "version": "2.23.0",
3
+ "version": "2.24.0",
4
4
  "description": "Write Once, Observe Anywhere",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -212,12 +212,20 @@
212
212
  "types": "./dist/drain-pipeline.d.ts",
213
213
  "import": "./dist/drain-pipeline.js",
214
214
  "require": "./dist/drain-pipeline.cjs"
215
+ },
216
+ "./enrichers": {
217
+ "types": "./dist/enrichers.d.ts",
218
+ "import": "./dist/enrichers.js",
219
+ "require": "./dist/enrichers.cjs"
215
220
  }
216
221
  },
217
222
  "files": [
218
223
  "dist",
219
224
  "src",
220
- "README.md"
225
+ "README.md",
226
+ "skills",
227
+ "!skills/_artifacts",
228
+ "bin"
221
229
  ],
222
230
  "keywords": [
223
231
  "opentelemetry",
@@ -240,29 +248,30 @@
240
248
  "license": "MIT",
241
249
  "dependencies": {
242
250
  "@opentelemetry/api": "^1.9.0",
243
- "@opentelemetry/api-logs": "^0.212.0",
244
- "@opentelemetry/exporter-metrics-otlp-http": "^0.212.0",
245
- "@opentelemetry/exporter-trace-otlp-http": "^0.212.0",
246
- "@opentelemetry/instrumentation": "^0.212.0",
247
- "@opentelemetry/resources": "^2.5.1",
248
- "@opentelemetry/sdk-metrics": "^2.5.1",
249
- "@opentelemetry/sdk-node": "^0.212.0",
250
- "@opentelemetry/sdk-trace-base": "^2.5.1",
251
+ "@tanstack/intent": "^0.0.13",
252
+ "@opentelemetry/api-logs": "^0.213.0",
253
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.213.0",
254
+ "@opentelemetry/exporter-trace-otlp-http": "^0.213.0",
255
+ "@opentelemetry/instrumentation": "^0.213.0",
256
+ "@opentelemetry/resources": "^2.6.0",
257
+ "@opentelemetry/sdk-metrics": "^2.6.0",
258
+ "@opentelemetry/sdk-node": "^0.213.0",
259
+ "@opentelemetry/sdk-trace-base": "^2.6.0",
251
260
  "@opentelemetry/semantic-conventions": "^1.40.0",
252
261
  "import-in-the-middle": "^3.0.0"
253
262
  },
254
263
  "peerDependencies": {
255
- "@opentelemetry/auto-instrumentations-node": "^0.70.1",
256
- "@opentelemetry/exporter-logs-otlp-grpc": "^0.212.0",
257
- "@opentelemetry/exporter-logs-otlp-http": "^0.212.0",
258
- "@opentelemetry/exporter-metrics-otlp-grpc": "^0.212.0",
259
- "@opentelemetry/exporter-trace-otlp-grpc": "^0.212.0",
260
- "@opentelemetry/resource-detector-aws": "^2.12.0",
261
- "@opentelemetry/resource-detector-container": "^0.8.3",
262
- "@opentelemetry/resource-detector-gcp": "^0.47.0",
263
- "@opentelemetry/sdk-logs": "^0.212.0",
264
- "@opentelemetry/sdk-trace-node": "^2.5.1",
265
- "@traceloop/node-server-sdk": "^0.22.7",
264
+ "@opentelemetry/auto-instrumentations-node": "^0.71.0",
265
+ "@opentelemetry/exporter-logs-otlp-grpc": "^0.213.0",
266
+ "@opentelemetry/exporter-logs-otlp-http": "^0.213.0",
267
+ "@opentelemetry/exporter-metrics-otlp-grpc": "^0.213.0",
268
+ "@opentelemetry/exporter-trace-otlp-grpc": "^0.213.0",
269
+ "@opentelemetry/resource-detector-aws": "^2.13.0",
270
+ "@opentelemetry/resource-detector-container": "^0.8.4",
271
+ "@opentelemetry/resource-detector-gcp": "^0.48.0",
272
+ "@opentelemetry/sdk-logs": "^0.213.0",
273
+ "@opentelemetry/sdk-trace-node": "^2.6.0",
274
+ "@traceloop/node-server-sdk": "^0.22.8",
266
275
  "pino": "^10.3.1",
267
276
  "pino-pretty": "^13.1.3",
268
277
  "yaml": "^2.8.2"
@@ -314,21 +323,21 @@
314
323
  "devDependencies": {
315
324
  "@arethetypeswrong/cli": "^0.18.2",
316
325
  "@edge-runtime/vm": "^5.0.0",
317
- "@opentelemetry/auto-instrumentations-node": "^0.70.1",
318
- "@opentelemetry/context-async-hooks": "^2.5.1",
319
- "@opentelemetry/exporter-logs-otlp-grpc": "^0.212.0",
320
- "@opentelemetry/exporter-logs-otlp-http": "^0.212.0",
321
- "@opentelemetry/exporter-metrics-otlp-grpc": "^0.212.0",
322
- "@opentelemetry/exporter-trace-otlp-grpc": "^0.212.0",
323
- "@opentelemetry/resource-detector-aws": "^2.12.0",
324
- "@opentelemetry/resource-detector-container": "^0.8.3",
325
- "@opentelemetry/resource-detector-gcp": "^0.47.0",
326
- "@opentelemetry/sdk-logs": "^0.212.0",
327
- "@opentelemetry/sdk-trace-node": "^2.5.1",
326
+ "@opentelemetry/auto-instrumentations-node": "^0.71.0",
327
+ "@opentelemetry/context-async-hooks": "^2.6.0",
328
+ "@opentelemetry/exporter-logs-otlp-grpc": "^0.213.0",
329
+ "@opentelemetry/exporter-logs-otlp-http": "^0.213.0",
330
+ "@opentelemetry/exporter-metrics-otlp-grpc": "^0.213.0",
331
+ "@opentelemetry/exporter-trace-otlp-grpc": "^0.213.0",
332
+ "@opentelemetry/resource-detector-aws": "^2.13.0",
333
+ "@opentelemetry/resource-detector-container": "^0.8.4",
334
+ "@opentelemetry/resource-detector-gcp": "^0.48.0",
335
+ "@opentelemetry/sdk-logs": "^0.213.0",
336
+ "@opentelemetry/sdk-trace-node": "^2.6.0",
328
337
  "@total-typescript/ts-reset": "^0.6.1",
329
338
  "@total-typescript/tsconfig": "^1.0.4",
330
339
  "@types/eslint-config-prettier": "^6.11.3",
331
- "@types/node": "^25.3.3",
340
+ "@types/node": "^25.3.5",
332
341
  "@typescript-eslint/eslint-plugin": "^8.56.1",
333
342
  "@typescript-eslint/parser": "^8.56.1",
334
343
  "eslint-config-prettier": "^10.1.8",
@@ -354,6 +363,9 @@
354
363
  "url": "https://github.com/jagreehal/autotel/issues"
355
364
  },
356
365
  "homepage": "https://github.com/jagreehal/autotel#readme",
366
+ "bin": {
367
+ "intent": "./bin/intent.js"
368
+ },
357
369
  "scripts": {
358
370
  "build": "tsup",
359
371
  "ci": "npm run build && npm run check-format && npm run check-exports && npm run lint && npm run test",
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: autotel-core
3
+ description: >
4
+ When to use trace vs span vs request logger vs events in Autotel. Init once at startup, package exports (autotel, autotel/event, autotel/testing). Use for setup and choosing the right API.
5
+ type: core
6
+ library: autotel
7
+ library_version: '2.23.0'
8
+ sources:
9
+ - jagreehal/autotel:AGENTS.md
10
+ - jagreehal/autotel:docs/AGENT-GUIDE.md
11
+ - jagreehal/autotel:packages/autotel/CLAUDE.md
12
+ ---
13
+
14
+ # Autotel — Core
15
+
16
+ OpenTelemetry instrumentation for Node.js and edge. Instrument once; stream to any OTLP backend. Use `trace()`/`span()` for spans, `getRequestLogger()` for one snapshot per request, `createStructuredError`/`parseError` for errors, `track()` for product events.
17
+
18
+ ## When to Use What
19
+
20
+ | Need | API | Import |
21
+ | ------------------------------------- | ---------------------------------------------------------------- | -------------------------------------- |
22
+ | Wrap a function with a span | `trace(fn)`, `span('Name', fn)` | `autotel` |
23
+ | Request-scoped attributes + emit once | `getRequestLogger(ctx?)` → `.set()`, `.emitNow()` | `autotel` |
24
+ | Throw with why/fix/link | `createStructuredError({ message, why?, fix?, link?, status? })` | `autotel` |
25
+ | Parse API errors (client) | `parseError(err)` → `message`, `why`, `fix`, `link` | `autotel` |
26
+ | Product/analytics events | `track(name, attrs)` or `Event` from `autotel/event` | `autotel`, `autotel/event` |
27
+ | Init (once at startup) | `init({ service, ... })` | `autotel` or `autotel/instrumentation` |
28
+ | Testing | `createTraceCollector()`, `InMemorySpanExporter` | `autotel/testing`, `autotel/exporters` |
29
+
30
+ Request logger requires an active span. Wrap HTTP handlers with `trace()` or framework middleware that creates a span, then call `getRequestLogger()` inside.
31
+
32
+ ## Setup
33
+
34
+ ```typescript
35
+ import { init, trace, getRequestLogger } from 'autotel';
36
+
37
+ init({ service: 'my-app' });
38
+
39
+ const handler = trace((ctx) => async (req: Request) => {
40
+ const log = getRequestLogger(ctx);
41
+ log.set({ path: req.url });
42
+ const result = await doWork(req);
43
+ log.emitNow();
44
+ return result;
45
+ });
46
+ ```
47
+
48
+ ## Core Patterns
49
+
50
+ **Factory pattern when you need context (attributes, request logger):**
51
+
52
+ ```typescript
53
+ const createUser = trace((ctx) => async (data: UserInput) => {
54
+ ctx.setAttribute('user.id', data.id);
55
+ const log = getRequestLogger(ctx);
56
+ log.set({ user: { id: data.id } });
57
+ return db.users.create(data);
58
+ });
59
+ ```
60
+
61
+ **Direct pattern when you don't need context:**
62
+
63
+ ```typescript
64
+ const getUser = trace(async (id: string) => {
65
+ return db.users.findById(id);
66
+ });
67
+ ```
68
+
69
+ **Structured errors in API routes:**
70
+
71
+ ```typescript
72
+ import { createStructuredError } from 'autotel';
73
+ throw createStructuredError({
74
+ message: 'Not found',
75
+ status: 404,
76
+ why: `No user "${id}"`,
77
+ fix: 'Check the ID and try again',
78
+ });
79
+ ```
80
+
81
+ **Client: parseError for UI:**
82
+
83
+ ```typescript
84
+ import { parseError } from 'autotel';
85
+ const e = parseError(err);
86
+ toast.error(e.message, { description: e.why });
87
+ ```
88
+
89
+ ## Common Mistakes
90
+
91
+ ### HIGH Call getRequestLogger() without active span
92
+
93
+ Wrong:
94
+
95
+ ```typescript
96
+ app.get('/api/x', () => {
97
+ const log = getRequestLogger();
98
+ log.set({ route: 'x' });
99
+ });
100
+ ```
101
+
102
+ Correct:
103
+
104
+ ```typescript
105
+ app.use(autotelMiddleware()); // or wrap route with trace()
106
+ app.get('/api/x', () => {
107
+ const log = getRequestLogger();
108
+ log.set({ route: 'x' });
109
+ });
110
+ ```
111
+
112
+ getRequestLogger() requires an active span. Register middleware that creates a span per request, or wrap the handler with `trace()`.
113
+
114
+ Source: packages/autotel/src/request-logger.ts
115
+
116
+ ### HIGH Use await import() for init-time optional deps
117
+
118
+ Wrong:
119
+
120
+ ```typescript
121
+ const pkg = await import('optional-dep');
122
+ ```
123
+
124
+ Correct:
125
+
126
+ ```typescript
127
+ import { safeRequire } from 'autotel';
128
+ const pkg = safeRequire('optional-dep');
129
+ ```
130
+
131
+ init() must stay synchronous. Use node-require helpers for optional dependencies.
132
+
133
+ Source: packages/autotel/CLAUDE.md
134
+
135
+ ### MEDIUM Use trace() without ctx when you need attributes or request logger
136
+
137
+ Wrong:
138
+
139
+ ```typescript
140
+ const handler = trace(async (req) => {
141
+ const log = getRequestLogger(); // may throw if span not set up for request logger
142
+ });
143
+ ```
144
+
145
+ Correct:
146
+
147
+ ```typescript
148
+ const handler = trace((ctx) => async (req) => {
149
+ const log = getRequestLogger(ctx);
150
+ log.set({ route: req.url });
151
+ });
152
+ ```
153
+
154
+ Use the factory pattern `(ctx) => async (...)` when you need to set attributes or use the request logger.
155
+
156
+ Source: docs/AGENT-GUIDE.md
157
+
158
+ ## Version
159
+
160
+ Targets autotel v2.23.x.
161
+
162
+ See also: autotel-instrumentation/SKILL.md — init and trace/span in depth. autotel-request-logging/SKILL.md — request logger usage.
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: autotel-events
3
+ description: >
4
+ track(), Event API, subscribers (e.g. PostHog). Configure subscribers in init(); use track() or Event for product/analytics events.
5
+ type: core
6
+ library: autotel
7
+ library_version: '2.23.0'
8
+ sources:
9
+ - jagreehal/autotel:packages/autotel/src/event.ts
10
+ - jagreehal/autotel:packages/autotel/src/event-subscriber.ts
11
+ ---
12
+
13
+ # Autotel — Events
14
+
15
+ Send product and analytics events with `track(name, attributes)` or the `Event` class from `autotel/event`. Configure subscribers (e.g. PostHog) in `init()`; they receive events automatically.
16
+
17
+ ## Setup
18
+
19
+ ```typescript
20
+ import { init, track } from 'autotel';
21
+ import { PostHogSubscriber } from 'autotel-subscribers/posthog';
22
+
23
+ init({
24
+ service: 'my-app',
25
+ subscribers: [new PostHogSubscriber({ apiKey: 'phc_...' })],
26
+ });
27
+
28
+ track('checkout.started', { userId: 'u_123', cartId: 'c_456' });
29
+ ```
30
+
31
+ With Event instance (optional override of subscribers):
32
+
33
+ ```typescript
34
+ import { Event } from 'autotel/event';
35
+
36
+ const event = new Event('checkout');
37
+ event.trackEvent('application.submitted', { jobId: '123', userId: '456' });
38
+ ```
39
+
40
+ ## Core Patterns
41
+
42
+ **Simple track (uses subscribers from init):**
43
+
44
+ ```typescript
45
+ track('signup.completed', { plan: 'pro', source: 'web' });
46
+ ```
47
+
48
+ **Event with custom subscribers:**
49
+
50
+ ```typescript
51
+ import { Event } from 'autotel/event';
52
+ import { PostHogSubscriber } from 'autotel-subscribers/posthog';
53
+
54
+ const event = new Event('onboarding', {
55
+ subscribers: [new PostHogSubscriber({ apiKey: 'phc_other_project' })],
56
+ });
57
+ event.trackEvent('step.completed', { step: 2 });
58
+ ```
59
+
60
+ **Validation and config:** See `getEventsConfig()`, `getValidationConfig()` from init; event names and attributes can be validated.
61
+
62
+ ## Common Mistakes
63
+
64
+ ### MEDIUM Call track() before init() with subscribers
65
+
66
+ Wrong:
67
+
68
+ ```typescript
69
+ track('signup', { plan: 'pro' });
70
+ ```
71
+
72
+ Correct:
73
+
74
+ ```typescript
75
+ init({
76
+ service: 'my-app',
77
+ subscribers: [new PostHogSubscriber({ apiKey: 'phc_...' })],
78
+ });
79
+ track('signup', { plan: 'pro' });
80
+ ```
81
+
82
+ Subscribers are configured in init(). track() sends to those subscribers; without init or without subscribers, events may not reach the backend.
83
+
84
+ Source: packages/autotel/src/event.ts
85
+
86
+ ## Version
87
+
88
+ Targets autotel v2.23.x.