@rasputin-ai/node 0.13.1 → 0.15.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 (54) hide show
  1. package/dist/execution-metrics/bind-execution-metrics.d.ts +19 -0
  2. package/dist/execution-metrics/bind-execution-metrics.d.ts.map +1 -0
  3. package/dist/execution-metrics/encode-execution-metrics-upload.d.ts +14 -0
  4. package/dist/execution-metrics/encode-execution-metrics-upload.d.ts.map +1 -0
  5. package/dist/execution-metrics/execution-metrics-batches.d.ts +34 -0
  6. package/dist/execution-metrics/execution-metrics-batches.d.ts.map +1 -0
  7. package/dist/execution-metrics/execution-metrics-collector.d.ts +44 -0
  8. package/dist/execution-metrics/execution-metrics-collector.d.ts.map +1 -0
  9. package/dist/execution-metrics/execution-metrics-exporter.d.ts +23 -0
  10. package/dist/execution-metrics/execution-metrics-exporter.d.ts.map +1 -0
  11. package/dist/execution-recorder/adaptive-recording-options.d.ts +0 -2
  12. package/dist/execution-recorder/adaptive-recording-options.d.ts.map +1 -1
  13. package/dist/execution-recorder/bind-adaptive-recorder.d.ts +4 -0
  14. package/dist/execution-recorder/bind-adaptive-recorder.d.ts.map +1 -1
  15. package/dist/execution-recorder/execution-identity.d.ts +6 -0
  16. package/dist/execution-recorder/execution-identity.d.ts.map +1 -1
  17. package/dist/execution-recorder/execution-journal.d.ts +1 -0
  18. package/dist/execution-recorder/execution-journal.d.ts.map +1 -1
  19. package/dist/execution-recorder/execution-recorder-hooks.d.ts +6 -1
  20. package/dist/execution-recorder/execution-recorder-hooks.d.ts.map +1 -1
  21. package/dist/execution-recorder/execution-recorder-types.d.ts +0 -10
  22. package/dist/execution-recorder/execution-recorder-types.d.ts.map +1 -1
  23. package/dist/execution-recorder/execution-recorder.d.ts.map +1 -1
  24. package/dist/execution-recorder/execution-recording-sync.d.ts +0 -1
  25. package/dist/execution-recorder/execution-recording-sync.d.ts.map +1 -1
  26. package/dist/function-metrics/bind-function-metrics.d.ts +2 -2
  27. package/dist/function-metrics/bind-function-metrics.d.ts.map +1 -1
  28. package/dist/function-metrics/create-metrics-only-runtime.d.ts +7 -1
  29. package/dist/function-metrics/create-metrics-only-runtime.d.ts.map +1 -1
  30. package/dist/function-metrics/function-metrics-batches.d.ts +2 -1
  31. package/dist/function-metrics/function-metrics-batches.d.ts.map +1 -1
  32. package/dist/function-metrics/function-metrics-collector.d.ts +18 -3
  33. package/dist/function-metrics/function-metrics-collector.d.ts.map +1 -1
  34. package/dist/function-metrics/intern-prepared-metrics.d.ts +2 -0
  35. package/dist/function-metrics/intern-prepared-metrics.d.ts.map +1 -1
  36. package/dist/function-metrics/settle-function-metrics.d.ts +7 -4
  37. package/dist/function-metrics/settle-function-metrics.d.ts.map +1 -1
  38. package/dist/index.js +1852 -505
  39. package/dist/instrument/bun.js +1 -1
  40. package/dist/instrument/node.js +1 -1
  41. package/dist/internal.d.ts +3 -0
  42. package/dist/internal.d.ts.map +1 -1
  43. package/dist/internal.js +1830 -498
  44. package/dist/rasputin-init.d.ts +13 -6
  45. package/dist/rasputin-init.d.ts.map +1 -1
  46. package/dist/runtime-timing/call-duration.d.ts +13 -0
  47. package/dist/runtime-timing/call-duration.d.ts.map +1 -0
  48. package/dist/{execution-recorder → runtime-timing}/dynamic-duration-sampling.d.ts +6 -4
  49. package/dist/runtime-timing/dynamic-duration-sampling.d.ts.map +1 -0
  50. package/dist/runtime-timing/execution-duration.d.ts +5 -0
  51. package/dist/runtime-timing/execution-duration.d.ts.map +1 -0
  52. package/dist/sdk-meta.d.ts +1 -1
  53. package/package.json +2 -2
  54. package/dist/execution-recorder/dynamic-duration-sampling.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- import { type FunctionMetricsOptions, type RasputinClient, type RasputinClientStats, type RasputinOptions, type SourceVerification, type TransportFetch } from '@rasputin-ai/core';
1
+ import { type RasputinClient, type RasputinClientStats, type RasputinOptions, type SourceVerification, type TransportFetch } from '@rasputin-ai/core';
2
2
  import { type ExecutionRecorderOptions, type ExecutionRecorderStats, type RasputinExecution } from './execution-recorder';
3
3
  export type RasputinNodeOptions = RasputinOptions & {
4
4
  /**
@@ -25,12 +25,19 @@ export type RasputinNodeOptions = RasputinOptions & {
25
25
  */
26
26
  installTransportSignalHandlers?: boolean;
27
27
  /**
28
- * Function-level counts, failures, and duration histograms. On with a
29
- * valid client. Set `enabled: false` to turn them off. Independent of
30
- * `executionRecorder`. A build key is optional; omit it to use the
31
- * server artifact id or a process fallback.
28
+ * Measure durations on a progressive schedule shared by function metrics,
29
+ * execution metrics, and lightweight execution recording. Default false
30
+ * times every eligible call and execution. True counts every call,
31
+ * execution, and failure, and times a subset. Function durations are
32
+ * keyed by function, direct caller, and execution type. Execution
33
+ * durations use a separate counter per execution type so they cannot
34
+ * move function sampling. Counters reset hourly. After 5,000 samples
35
+ * the tail rate still samples. Selected sessions, activations, and full
36
+ * capture still record every duration; metric duration statistics follow
37
+ * this schedule so incident traffic does not bias aggregates. Invalid
38
+ * values are treated as false.
32
39
  */
33
- functionMetrics?: FunctionMetricsOptions;
40
+ dynamicDurationSampling?: boolean;
34
41
  };
35
42
  /** @internal Test seams omitted from the published declaration surface. */
36
43
  type RasputinNodeHooks = {
@@ -1 +1 @@
1
- {"version":3,"file":"rasputin-init.d.ts","sourceRoot":"","sources":["../src/rasputin-init.ts"],"names":[],"mappings":"AAMA,OAAO,EAIN,KAAK,sBAAsB,EAE3B,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EAEpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAEN,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAE3B,KAAK,iBAAiB,EACtB,MAAM,sBAAsB,CAAC;AAY9B,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG;IACnD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,wBAAwB,CAAC;IAC7C;;;;OAIG;IACH,2BAA2B,CAA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iB,CAAC,EAAE,wBAAwB,CAAC;IAC7C;;;;OAIG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;IACzC;;;;;;;;;;;;OAYG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF,2EAA2E;AAC3E,KAAK,iBAAiB,GAAG;IACxB,KAAK,CAAC,EAAE,cAAc,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,GAAG;IAC3D,qFAAqF;IACrF,QAAQ,EAAE,sBAAsB,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,GAAG;IACnE,+EAA+E;IAC/E,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,EAAE,MAAM,uBAAuB,CAAC;IACxC;;;OAGG;IACH,mBAAmB,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACvD,CAAC;AA4EF;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,kBAAkB,CAAC;AAC/E,+EAA+E;AAC/E,wBAAgB,YAAY,CAC3B,OAAO,EAAE,mBAAmB,EAC5B,KAAK,EAAE,iBAAiB,GACtB,kBAAkB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { DurationSampler } from './dynamic-duration-sampling';
2
+ type CallDurationPlan = {
3
+ selected: boolean;
4
+ measure: boolean;
5
+ };
6
+ export declare const planCallDuration: (sampler: DurationSampler | undefined, input: {
7
+ forceMeasure: boolean;
8
+ executionType: string | undefined;
9
+ callerFunctionId: string;
10
+ functionId: string;
11
+ }) => CallDurationPlan;
12
+ export {};
13
+ //# sourceMappingURL=call-duration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-duration.d.ts","sourceRoot":"","sources":["../../src/runtime-timing/call-duration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,KAAK,gBAAgB,GAAG;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC5B,SAAS,eAAe,GAAG,SAAS,EACpC,OAAO;IACN,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACnB,KACC,gBAKF,CAAC"}
@@ -1,6 +1,11 @@
1
1
  export declare const DYNAMIC_DURATION_SAMPLE_TAIL_AFTER = 5000;
2
2
  export declare const DYNAMIC_DURATION_SAMPLE_TAIL_DIVISOR = 100;
3
3
  export declare const DYNAMIC_DURATION_SAMPLE_RESET_MS: number;
4
+ export type DurationSampler = {
5
+ take: (executionType: string, callerFunctionId: string, functionId: string) => boolean;
6
+ takeExecution: (executionType: string) => boolean;
7
+ stop: () => void;
8
+ };
4
9
  export declare const dynamicDurationSampleDivisor: (index: number) => number;
5
10
  export declare const shouldSampleDynamicDuration: (index: number) => boolean;
6
11
  /** Stay in the tail stage so `% 100` remains exact after MAX_SAFE_INTEGER. */
@@ -9,8 +14,5 @@ export declare const createDynamicDurationSampleBuckets: (options: {
9
14
  nowMs: () => number;
10
15
  maxBuckets?: number;
11
16
  resetMs?: number;
12
- }) => {
13
- take: (executionType: string, callerFunctionId: string, functionId: string) => boolean;
14
- stop: () => void;
15
- };
17
+ }) => DurationSampler;
16
18
  //# sourceMappingURL=dynamic-duration-sampling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamic-duration-sampling.d.ts","sourceRoot":"","sources":["../../src/runtime-timing/dynamic-duration-sampling.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,kCAAkC,OAAO,CAAC;AACvD,eAAO,MAAM,oCAAoC,MAAM,CAAC;AACxD,eAAO,MAAM,gCAAgC,QAAiB,CAAC;AAI/D,MAAM,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;IACvF,aAAa,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC;IAClD,IAAI,EAAE,MAAM,IAAI,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,OAAO,MAAM,KAAG,MAM5D,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,OAAO,MAAM,KAAG,OAE3D,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,uBAAuB,GAAI,OAAO,MAAM,KAAG,MAOvD,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAAI,SAAS;IAC3D,KAAK,EAAE,MAAM,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,KAAG,eAoDH,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { DurationSampler } from './dynamic-duration-sampling';
2
+ export declare const planExecutionDuration: (sampler: DurationSampler | undefined, executionType: string | undefined) => {
3
+ selected: boolean;
4
+ };
5
+ //# sourceMappingURL=execution-duration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-duration.d.ts","sourceRoot":"","sources":["../../src/runtime-timing/execution-duration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,eAAO,MAAM,qBAAqB,GACjC,SAAS,eAAe,GAAG,SAAS,EACpC,eAAe,MAAM,GAAG,SAAS,KAC/B;IAAE,QAAQ,EAAE,OAAO,CAAA;CAIrB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  /** Generated by scripts/generate-sdk-meta.ts — do not edit. */
2
2
  export declare const SDK_NAME = "@rasputin-ai/node";
3
- export declare const SDK_VERSION = "0.13.1";
3
+ export declare const SDK_VERSION = "0.15.0";
4
4
  //# sourceMappingURL=sdk-meta.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rasputin-ai/node",
3
- "version": "0.13.1",
3
+ "version": "0.15.0",
4
4
  "description": "Official Rasputin AI SDK for Node and Bun.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@jridgewell/trace-mapping": "0.3.31",
52
- "@rasputin-ai/core": "0.13.1",
52
+ "@rasputin-ai/core": "0.15.0",
53
53
  "typescript": "5"
54
54
  },
55
55
  "devDependencies": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"dynamic-duration-sampling.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/dynamic-duration-sampling.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,kCAAkC,OAAO,CAAC;AACvD,eAAO,MAAM,oCAAoC,MAAM,CAAC;AACxD,eAAO,MAAM,gCAAgC,QAAiB,CAAC;AAG/D,eAAO,MAAM,4BAA4B,GAAI,OAAO,MAAM,KAAG,MAK5D,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,OAAO,MAAM,KAAG,OAE3D,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,uBAAuB,GAAI,OAAO,MAAM,KAAG,MAOvD,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAAI,SAAS;IAC3D,KAAK,EAAE,MAAM,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,KAAG;IACH,IAAI,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;IACvF,IAAI,EAAE,MAAM,IAAI,CAAC;CA4CjB,CAAC"}