@glasstrace/sdk 0.20.0 → 1.0.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 (61) hide show
  1. package/README.md +37 -5
  2. package/dist/chunk-3TU62WD6.js +142 -0
  3. package/dist/chunk-3TU62WD6.js.map +1 -0
  4. package/dist/chunk-67RIOAXV.js +105 -0
  5. package/dist/chunk-67RIOAXV.js.map +1 -0
  6. package/dist/{chunk-VN3GZDV6.js → chunk-7PDDBLST.js} +4 -141
  7. package/dist/chunk-7PDDBLST.js.map +1 -0
  8. package/dist/chunk-BT2OCXCG.js +178 -0
  9. package/dist/chunk-BT2OCXCG.js.map +1 -0
  10. package/dist/chunk-D3WYZBQA.js +4547 -0
  11. package/dist/chunk-D3WYZBQA.js.map +1 -0
  12. package/dist/{chunk-F2TZRBEH.js → chunk-DO2YPMQ5.js} +9 -181
  13. package/dist/chunk-DO2YPMQ5.js.map +1 -0
  14. package/dist/{chunk-YPXW2TN3.js → chunk-IP4NMDJK.js} +2 -2
  15. package/dist/{chunk-6JRI4OGB.js → chunk-LU3PPAOQ.js} +5 -3
  16. package/dist/{chunk-6JRI4OGB.js.map → chunk-LU3PPAOQ.js.map} +1 -1
  17. package/dist/{chunk-5N2IR4EO.js → chunk-TQ54WLCZ.js} +1 -1
  18. package/dist/{chunk-5N2IR4EO.js.map → chunk-TQ54WLCZ.js.map} +1 -1
  19. package/dist/cli/init.cjs +5 -3
  20. package/dist/cli/init.cjs.map +1 -1
  21. package/dist/cli/init.js +8 -6
  22. package/dist/cli/init.js.map +1 -1
  23. package/dist/cli/mcp-add.cjs.map +1 -1
  24. package/dist/cli/mcp-add.js +2 -2
  25. package/dist/cli/uninit.cjs +3 -1
  26. package/dist/cli/uninit.cjs.map +1 -1
  27. package/dist/cli/uninit.js +2 -2
  28. package/dist/edge-entry-CFq085RZ.d.ts +130 -0
  29. package/dist/edge-entry-DYl05SJ-.d.cts +130 -0
  30. package/dist/edge-entry.cjs +14839 -0
  31. package/dist/edge-entry.cjs.map +1 -0
  32. package/dist/edge-entry.d.cts +6 -0
  33. package/dist/edge-entry.d.ts +6 -0
  34. package/dist/edge-entry.js +14 -0
  35. package/dist/index.cjs +38 -244
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d-CYYe3PxB.d.cts +191 -0
  38. package/dist/index.d-CYYe3PxB.d.ts +191 -0
  39. package/dist/index.d.cts +8 -461
  40. package/dist/index.d.ts +8 -461
  41. package/dist/index.js +25 -4636
  42. package/dist/index.js.map +1 -1
  43. package/dist/node-entry.cjs +22481 -0
  44. package/dist/node-entry.cjs.map +1 -0
  45. package/dist/node-entry.d.cts +10 -0
  46. package/dist/node-entry.d.ts +10 -0
  47. package/dist/node-entry.js +100 -0
  48. package/dist/node-entry.js.map +1 -0
  49. package/dist/node-subpath.cjs +14506 -0
  50. package/dist/node-subpath.cjs.map +1 -0
  51. package/dist/node-subpath.d.cts +132 -0
  52. package/dist/node-subpath.d.ts +132 -0
  53. package/dist/node-subpath.js +31 -0
  54. package/dist/node-subpath.js.map +1 -0
  55. package/dist/{source-map-uploader-VPDZWWM2.js → source-map-uploader-ZHA3B4GE.js} +4 -3
  56. package/dist/source-map-uploader-ZHA3B4GE.js.map +1 -0
  57. package/package.json +13 -1
  58. package/dist/chunk-F2TZRBEH.js.map +0 -1
  59. package/dist/chunk-VN3GZDV6.js.map +0 -1
  60. /package/dist/{chunk-YPXW2TN3.js.map → chunk-IP4NMDJK.js.map} +0 -0
  61. /package/dist/{source-map-uploader-VPDZWWM2.js.map → edge-entry.js.map} +0 -0
@@ -0,0 +1,191 @@
1
+ import * as z from './v4/classic/external.cjs';
2
+
3
+ /**
4
+ * Anonymous API key: `gt_anon_` + 48 hex chars.
5
+ *
6
+ * @drift-check ../glasstrace-product/docs/component-designs/sdk-2.0.md §1.2 Lens B — SDK-Facing Security Primitives (row `Anon API key gt_anon_[a-f0-9]{48}`)
7
+ */
8
+ declare const AnonApiKeySchema: z.core.$ZodBranded<z.ZodString, "AnonApiKey", "out">;
9
+ type AnonApiKey = z.infer<typeof AnonApiKeySchema>;
10
+ /**
11
+ * Session ID: 16 hex chars (deterministic, derived from API key + time window).
12
+ *
13
+ * @drift-check ../glasstrace-product/docs/product-spec.md §4.5 Session Lifecycle
14
+ */
15
+ declare const SessionIdSchema: z.core.$ZodBranded<z.ZodString, "SessionId", "out">;
16
+ type SessionId = z.infer<typeof SessionIdSchema>;
17
+
18
+ /**
19
+ * SDK-specific enums.
20
+ */
21
+
22
+ /** Diagnostic codes the SDK can report during health checks. */
23
+ declare const SdkDiagnosticCodeSchema: z.ZodEnum<{
24
+ ingestion_unreachable: "ingestion_unreachable";
25
+ ingestion_auth_failed: "ingestion_auth_failed";
26
+ ingestion_rate_limited: "ingestion_rate_limited";
27
+ config_sync_failed: "config_sync_failed";
28
+ source_map_upload_failed: "source_map_upload_failed";
29
+ }>;
30
+ type SdkDiagnosticCode = z.infer<typeof SdkDiagnosticCodeSchema>;
31
+
32
+ /**
33
+ * SDK configuration types.
34
+ */
35
+
36
+ /** SDK capture configuration: which events to capture. */
37
+ declare const CaptureConfigSchema: z.ZodObject<{
38
+ requestBodies: z.ZodBoolean;
39
+ queryParamValues: z.ZodBoolean;
40
+ envVarValues: z.ZodBoolean;
41
+ fullConsoleOutput: z.ZodBoolean;
42
+ importGraph: z.ZodBoolean;
43
+ consoleErrors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
44
+ errorResponseBodies: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
45
+ }, z.core.$strip>;
46
+ type CaptureConfig = z.infer<typeof CaptureConfigSchema>;
47
+ /** Developer-facing config for registerGlasstrace(). */
48
+ declare const GlasstraceOptionsSchema: z.ZodObject<{
49
+ apiKey: z.ZodOptional<z.ZodString>;
50
+ endpoint: z.ZodOptional<z.ZodString>;
51
+ forceEnable: z.ZodOptional<z.ZodBoolean>;
52
+ verbose: z.ZodOptional<z.ZodBoolean>;
53
+ }, z.core.$strip>;
54
+ type GlasstraceOptions = z.infer<typeof GlasstraceOptionsSchema>;
55
+ /** All recognized SDK environment variables. */
56
+ declare const GlasstraceEnvVarsSchema: z.ZodObject<{
57
+ GLASSTRACE_API_KEY: z.ZodOptional<z.ZodString>;
58
+ GLASSTRACE_FORCE_ENABLE: z.ZodOptional<z.ZodString>;
59
+ GLASSTRACE_ENV: z.ZodOptional<z.ZodString>;
60
+ GLASSTRACE_COVERAGE_MAP: z.ZodOptional<z.ZodString>;
61
+ NODE_ENV: z.ZodOptional<z.ZodString>;
62
+ VERCEL_ENV: z.ZodOptional<z.ZodString>;
63
+ }, z.core.$strip>;
64
+ type GlasstraceEnvVars = z.infer<typeof GlasstraceEnvVarsSchema>;
65
+
66
+ /**
67
+ * Wire format types for SDK ↔ backend communication.
68
+ *
69
+ * These schemas define the request/response shapes for:
70
+ * - SDK initialization (POST /v1/sdk/init)
71
+ * - SDK health diagnostics (embedded in init requests)
72
+ * - Discovery endpoint (GET /__glasstrace/config)
73
+ * - Source map upload (POST /v1/source-maps)
74
+ * - Presigned source map upload (POST /v1/source-maps/presign, POST /v1/source-maps/manifest)
75
+ */
76
+
77
+ /** Test file import relationships, embedded in SDK init request. */
78
+ declare const ImportGraphPayloadSchema: z.ZodObject<{
79
+ buildHash: z.core.$ZodBranded<z.ZodString, "BuildHash", "out">;
80
+ graph: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
81
+ }, z.core.$strip>;
82
+ type ImportGraphPayload = z.infer<typeof ImportGraphPayloadSchema>;
83
+ /** SDK health diagnostics included in init requests. */
84
+ declare const SdkHealthReportSchema: z.ZodObject<{
85
+ tracesExportedSinceLastInit: z.ZodNumber;
86
+ tracesDropped: z.ZodNumber;
87
+ initFailures: z.ZodNumber;
88
+ configAge: z.ZodNumber;
89
+ sdkVersion: z.ZodString;
90
+ }, z.core.$strip>;
91
+ type SdkHealthReport = z.infer<typeof SdkHealthReportSchema>;
92
+ /**
93
+ * Response from POST /v1/sdk/init.
94
+ *
95
+ * Note: SdkInitRequest is intentionally NOT in the protocol package.
96
+ * The request schema includes backend-specific types (TierLimits,
97
+ * SubscriptionStatus) that are not part of the public contract.
98
+ * The backend owns the request validation; the SDK only needs to
99
+ * understand the response.
100
+ */
101
+ declare const SdkInitResponseSchema: z.ZodObject<{
102
+ config: z.ZodObject<{
103
+ requestBodies: z.ZodBoolean;
104
+ queryParamValues: z.ZodBoolean;
105
+ envVarValues: z.ZodBoolean;
106
+ fullConsoleOutput: z.ZodBoolean;
107
+ importGraph: z.ZodBoolean;
108
+ consoleErrors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
109
+ errorResponseBodies: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
110
+ }, z.core.$strip>;
111
+ subscriptionStatus: z.ZodString;
112
+ linkedAccountId: z.ZodOptional<z.ZodString>;
113
+ minimumSdkVersion: z.ZodString;
114
+ apiVersion: z.ZodString;
115
+ tierLimits: z.ZodObject<{
116
+ tracesPerMinute: z.ZodNumber;
117
+ storageTtlHours: z.ZodNumber;
118
+ maxTraceSizeBytes: z.ZodNumber;
119
+ maxConcurrentSessions: z.ZodNumber;
120
+ }, z.core.$strip>;
121
+ claimResult: z.ZodOptional<z.ZodObject<{
122
+ newApiKey: z.core.$ZodBranded<z.ZodString, "DevApiKey", "out">;
123
+ accountId: z.ZodString;
124
+ graceExpiresAt: z.ZodNumber;
125
+ }, z.core.$strip>>;
126
+ }, z.core.$strip>;
127
+ type SdkInitResponse = z.infer<typeof SdkInitResponseSchema>;
128
+ /** Response from POST /v1/source-maps. */
129
+ declare const SourceMapUploadResponseSchema: z.ZodObject<{
130
+ success: z.ZodLiteral<true>;
131
+ buildHash: z.core.$ZodBranded<z.ZodString, "BuildHash", "out">;
132
+ fileCount: z.ZodNumber;
133
+ totalSizeBytes: z.ZodNumber;
134
+ }, z.core.$strip>;
135
+ type SourceMapUploadResponse = z.infer<typeof SourceMapUploadResponseSchema>;
136
+ /** Response confirming source map manifest activation. */
137
+ declare const SourceMapManifestResponseSchema: z.ZodObject<{
138
+ success: z.ZodLiteral<true>;
139
+ buildHash: z.core.$ZodBranded<z.ZodString, "BuildHash", "out">;
140
+ fileCount: z.ZodNumber;
141
+ totalSizeBytes: z.ZodNumber;
142
+ activatedAt: z.ZodNumber;
143
+ }, z.core.$strip>;
144
+ type SourceMapManifestResponse = z.infer<typeof SourceMapManifestResponseSchema>;
145
+
146
+ /**
147
+ * Session ID derivation — part of the public Glasstrace wire contract.
148
+ *
149
+ * Deriving the session ID is deterministic: given the same inputs,
150
+ * every runtime that implements this module produces the same
151
+ * 16-character hex identifier. That determinism is the contract — it
152
+ * lets independent clients (SDK, browser extension, server tooling)
153
+ * agree on the same session without coordination.
154
+ *
155
+ * This module is pure: it has no module-level state and no
156
+ * runtime-dependent branches. It is safe to import from Node 20+,
157
+ * modern browsers, Vercel Edge, and Cloudflare Workers. The SHA-256
158
+ * implementation is pure JavaScript; no `node:crypto`, no Web Crypto,
159
+ * no bundler-specific shims.
160
+ */
161
+
162
+ /**
163
+ * Derives a deterministic session ID from the inputs that define a
164
+ * Glasstrace session. The output is a 16-character lowercase hex
165
+ * string validated through {@link SessionIdSchema}.
166
+ *
167
+ * This function is part of the Glasstrace wire contract: any consumer
168
+ * (SDK, browser extension, server tooling) that calls it with the same
169
+ * arguments receives the same `SessionId`. That property is what lets
170
+ * independent clients agree on a session without coordination.
171
+ *
172
+ * Uses a pure-JavaScript SHA-256 so the output is identical across
173
+ * every runtime this package supports (Node 20+, modern browsers,
174
+ * Vercel Edge, Cloudflare Workers).
175
+ *
176
+ * Security note: the session ID is an **identifier**, not a secret or
177
+ * an authentication token. It is never used for authorization.
178
+ *
179
+ * @param apiKey - The project's API key (or anonymous placeholder).
180
+ * @param origin - The origin string identifying the deployment
181
+ * environment (for example `localhost:3000` or `production`).
182
+ * @param date - UTC date as `YYYY-MM-DD`.
183
+ * @param windowIndex - Zero-based index of the 4-hour activity window
184
+ * within the day.
185
+ * @returns A 16-character hex {@link SessionId}.
186
+ *
187
+ * @drift-check ../glasstrace-product/docs/product-spec.md §4.5 Session Lifecycle
188
+ */
189
+ declare function deriveSessionId(apiKey: string, origin: string, date: string, windowIndex: number): SessionId;
190
+
191
+ export { type AnonApiKey as A, type CaptureConfig as C, type GlasstraceEnvVars as G, type ImportGraphPayload as I, type SdkInitResponse as S, type GlasstraceOptions as a, type SdkHealthReport as b, type SdkDiagnosticCode as c, deriveSessionId as d, type SessionId as e, type SourceMapUploadResponse as f, type SourceMapManifestResponse as g };
@@ -0,0 +1,191 @@
1
+ import * as z from './v4/classic/external.cjs';
2
+
3
+ /**
4
+ * Anonymous API key: `gt_anon_` + 48 hex chars.
5
+ *
6
+ * @drift-check ../glasstrace-product/docs/component-designs/sdk-2.0.md §1.2 Lens B — SDK-Facing Security Primitives (row `Anon API key gt_anon_[a-f0-9]{48}`)
7
+ */
8
+ declare const AnonApiKeySchema: z.core.$ZodBranded<z.ZodString, "AnonApiKey", "out">;
9
+ type AnonApiKey = z.infer<typeof AnonApiKeySchema>;
10
+ /**
11
+ * Session ID: 16 hex chars (deterministic, derived from API key + time window).
12
+ *
13
+ * @drift-check ../glasstrace-product/docs/product-spec.md §4.5 Session Lifecycle
14
+ */
15
+ declare const SessionIdSchema: z.core.$ZodBranded<z.ZodString, "SessionId", "out">;
16
+ type SessionId = z.infer<typeof SessionIdSchema>;
17
+
18
+ /**
19
+ * SDK-specific enums.
20
+ */
21
+
22
+ /** Diagnostic codes the SDK can report during health checks. */
23
+ declare const SdkDiagnosticCodeSchema: z.ZodEnum<{
24
+ ingestion_unreachable: "ingestion_unreachable";
25
+ ingestion_auth_failed: "ingestion_auth_failed";
26
+ ingestion_rate_limited: "ingestion_rate_limited";
27
+ config_sync_failed: "config_sync_failed";
28
+ source_map_upload_failed: "source_map_upload_failed";
29
+ }>;
30
+ type SdkDiagnosticCode = z.infer<typeof SdkDiagnosticCodeSchema>;
31
+
32
+ /**
33
+ * SDK configuration types.
34
+ */
35
+
36
+ /** SDK capture configuration: which events to capture. */
37
+ declare const CaptureConfigSchema: z.ZodObject<{
38
+ requestBodies: z.ZodBoolean;
39
+ queryParamValues: z.ZodBoolean;
40
+ envVarValues: z.ZodBoolean;
41
+ fullConsoleOutput: z.ZodBoolean;
42
+ importGraph: z.ZodBoolean;
43
+ consoleErrors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
44
+ errorResponseBodies: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
45
+ }, z.core.$strip>;
46
+ type CaptureConfig = z.infer<typeof CaptureConfigSchema>;
47
+ /** Developer-facing config for registerGlasstrace(). */
48
+ declare const GlasstraceOptionsSchema: z.ZodObject<{
49
+ apiKey: z.ZodOptional<z.ZodString>;
50
+ endpoint: z.ZodOptional<z.ZodString>;
51
+ forceEnable: z.ZodOptional<z.ZodBoolean>;
52
+ verbose: z.ZodOptional<z.ZodBoolean>;
53
+ }, z.core.$strip>;
54
+ type GlasstraceOptions = z.infer<typeof GlasstraceOptionsSchema>;
55
+ /** All recognized SDK environment variables. */
56
+ declare const GlasstraceEnvVarsSchema: z.ZodObject<{
57
+ GLASSTRACE_API_KEY: z.ZodOptional<z.ZodString>;
58
+ GLASSTRACE_FORCE_ENABLE: z.ZodOptional<z.ZodString>;
59
+ GLASSTRACE_ENV: z.ZodOptional<z.ZodString>;
60
+ GLASSTRACE_COVERAGE_MAP: z.ZodOptional<z.ZodString>;
61
+ NODE_ENV: z.ZodOptional<z.ZodString>;
62
+ VERCEL_ENV: z.ZodOptional<z.ZodString>;
63
+ }, z.core.$strip>;
64
+ type GlasstraceEnvVars = z.infer<typeof GlasstraceEnvVarsSchema>;
65
+
66
+ /**
67
+ * Wire format types for SDK ↔ backend communication.
68
+ *
69
+ * These schemas define the request/response shapes for:
70
+ * - SDK initialization (POST /v1/sdk/init)
71
+ * - SDK health diagnostics (embedded in init requests)
72
+ * - Discovery endpoint (GET /__glasstrace/config)
73
+ * - Source map upload (POST /v1/source-maps)
74
+ * - Presigned source map upload (POST /v1/source-maps/presign, POST /v1/source-maps/manifest)
75
+ */
76
+
77
+ /** Test file import relationships, embedded in SDK init request. */
78
+ declare const ImportGraphPayloadSchema: z.ZodObject<{
79
+ buildHash: z.core.$ZodBranded<z.ZodString, "BuildHash", "out">;
80
+ graph: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
81
+ }, z.core.$strip>;
82
+ type ImportGraphPayload = z.infer<typeof ImportGraphPayloadSchema>;
83
+ /** SDK health diagnostics included in init requests. */
84
+ declare const SdkHealthReportSchema: z.ZodObject<{
85
+ tracesExportedSinceLastInit: z.ZodNumber;
86
+ tracesDropped: z.ZodNumber;
87
+ initFailures: z.ZodNumber;
88
+ configAge: z.ZodNumber;
89
+ sdkVersion: z.ZodString;
90
+ }, z.core.$strip>;
91
+ type SdkHealthReport = z.infer<typeof SdkHealthReportSchema>;
92
+ /**
93
+ * Response from POST /v1/sdk/init.
94
+ *
95
+ * Note: SdkInitRequest is intentionally NOT in the protocol package.
96
+ * The request schema includes backend-specific types (TierLimits,
97
+ * SubscriptionStatus) that are not part of the public contract.
98
+ * The backend owns the request validation; the SDK only needs to
99
+ * understand the response.
100
+ */
101
+ declare const SdkInitResponseSchema: z.ZodObject<{
102
+ config: z.ZodObject<{
103
+ requestBodies: z.ZodBoolean;
104
+ queryParamValues: z.ZodBoolean;
105
+ envVarValues: z.ZodBoolean;
106
+ fullConsoleOutput: z.ZodBoolean;
107
+ importGraph: z.ZodBoolean;
108
+ consoleErrors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
109
+ errorResponseBodies: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
110
+ }, z.core.$strip>;
111
+ subscriptionStatus: z.ZodString;
112
+ linkedAccountId: z.ZodOptional<z.ZodString>;
113
+ minimumSdkVersion: z.ZodString;
114
+ apiVersion: z.ZodString;
115
+ tierLimits: z.ZodObject<{
116
+ tracesPerMinute: z.ZodNumber;
117
+ storageTtlHours: z.ZodNumber;
118
+ maxTraceSizeBytes: z.ZodNumber;
119
+ maxConcurrentSessions: z.ZodNumber;
120
+ }, z.core.$strip>;
121
+ claimResult: z.ZodOptional<z.ZodObject<{
122
+ newApiKey: z.core.$ZodBranded<z.ZodString, "DevApiKey", "out">;
123
+ accountId: z.ZodString;
124
+ graceExpiresAt: z.ZodNumber;
125
+ }, z.core.$strip>>;
126
+ }, z.core.$strip>;
127
+ type SdkInitResponse = z.infer<typeof SdkInitResponseSchema>;
128
+ /** Response from POST /v1/source-maps. */
129
+ declare const SourceMapUploadResponseSchema: z.ZodObject<{
130
+ success: z.ZodLiteral<true>;
131
+ buildHash: z.core.$ZodBranded<z.ZodString, "BuildHash", "out">;
132
+ fileCount: z.ZodNumber;
133
+ totalSizeBytes: z.ZodNumber;
134
+ }, z.core.$strip>;
135
+ type SourceMapUploadResponse = z.infer<typeof SourceMapUploadResponseSchema>;
136
+ /** Response confirming source map manifest activation. */
137
+ declare const SourceMapManifestResponseSchema: z.ZodObject<{
138
+ success: z.ZodLiteral<true>;
139
+ buildHash: z.core.$ZodBranded<z.ZodString, "BuildHash", "out">;
140
+ fileCount: z.ZodNumber;
141
+ totalSizeBytes: z.ZodNumber;
142
+ activatedAt: z.ZodNumber;
143
+ }, z.core.$strip>;
144
+ type SourceMapManifestResponse = z.infer<typeof SourceMapManifestResponseSchema>;
145
+
146
+ /**
147
+ * Session ID derivation — part of the public Glasstrace wire contract.
148
+ *
149
+ * Deriving the session ID is deterministic: given the same inputs,
150
+ * every runtime that implements this module produces the same
151
+ * 16-character hex identifier. That determinism is the contract — it
152
+ * lets independent clients (SDK, browser extension, server tooling)
153
+ * agree on the same session without coordination.
154
+ *
155
+ * This module is pure: it has no module-level state and no
156
+ * runtime-dependent branches. It is safe to import from Node 20+,
157
+ * modern browsers, Vercel Edge, and Cloudflare Workers. The SHA-256
158
+ * implementation is pure JavaScript; no `node:crypto`, no Web Crypto,
159
+ * no bundler-specific shims.
160
+ */
161
+
162
+ /**
163
+ * Derives a deterministic session ID from the inputs that define a
164
+ * Glasstrace session. The output is a 16-character lowercase hex
165
+ * string validated through {@link SessionIdSchema}.
166
+ *
167
+ * This function is part of the Glasstrace wire contract: any consumer
168
+ * (SDK, browser extension, server tooling) that calls it with the same
169
+ * arguments receives the same `SessionId`. That property is what lets
170
+ * independent clients agree on a session without coordination.
171
+ *
172
+ * Uses a pure-JavaScript SHA-256 so the output is identical across
173
+ * every runtime this package supports (Node 20+, modern browsers,
174
+ * Vercel Edge, Cloudflare Workers).
175
+ *
176
+ * Security note: the session ID is an **identifier**, not a secret or
177
+ * an authentication token. It is never used for authorization.
178
+ *
179
+ * @param apiKey - The project's API key (or anonymous placeholder).
180
+ * @param origin - The origin string identifying the deployment
181
+ * environment (for example `localhost:3000` or `production`).
182
+ * @param date - UTC date as `YYYY-MM-DD`.
183
+ * @param windowIndex - Zero-based index of the 4-hour activity window
184
+ * within the day.
185
+ * @returns A 16-character hex {@link SessionId}.
186
+ *
187
+ * @drift-check ../glasstrace-product/docs/product-spec.md §4.5 Session Lifecycle
188
+ */
189
+ declare function deriveSessionId(apiKey: string, origin: string, date: string, windowIndex: number): SessionId;
190
+
191
+ export { type AnonApiKey as A, type CaptureConfig as C, type GlasstraceEnvVars as G, type ImportGraphPayload as I, type SdkInitResponse as S, type GlasstraceOptions as a, type SdkHealthReport as b, type SdkDiagnosticCode as c, deriveSessionId as d, type SessionId as e, type SourceMapUploadResponse as f, type SourceMapManifestResponse as g };