@glasstrace/sdk 1.3.9 → 1.5.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 (81) hide show
  1. package/README.md +124 -0
  2. package/dist/capture-error-BmQz7xF6.d.cts +455 -0
  3. package/dist/capture-error-CTgSYxek.d.ts +455 -0
  4. package/dist/{chunk-XS5W3SPL.js → chunk-4WI7B5FQ.js} +91 -5
  5. package/dist/chunk-4WI7B5FQ.js.map +1 -0
  6. package/dist/{chunk-JZ475QRH.js → chunk-D3QXU2VM.js} +22 -191
  7. package/dist/chunk-D3QXU2VM.js.map +1 -0
  8. package/dist/{chunk-GYTCZSAV.js → chunk-MFYOQOD7.js} +2 -2
  9. package/dist/{chunk-4WUHMLMM.js → chunk-MMKFFF2L.js} +2 -2
  10. package/dist/{chunk-JH7EGRC5.js → chunk-N3XIVM2U.js} +158 -12
  11. package/dist/chunk-N3XIVM2U.js.map +1 -0
  12. package/dist/{chunk-FKBCEOJ5.js → chunk-Q42BY5BA.js} +2 -2
  13. package/dist/{chunk-DBKG6SRI.js → chunk-QU26IKIJ.js} +2 -2
  14. package/dist/{chunk-ADUD4PEK.js → chunk-TANUWTFO.js} +3 -3
  15. package/dist/{chunk-LJMZXJ45.js → chunk-YLY7AGLC.js} +9 -6
  16. package/dist/chunk-YLY7AGLC.js.map +1 -0
  17. package/dist/chunk-ZBQQXVHD.js +208 -0
  18. package/dist/chunk-ZBQQXVHD.js.map +1 -0
  19. package/dist/cli/init.cjs +218 -35
  20. package/dist/cli/init.cjs.map +1 -1
  21. package/dist/cli/init.js +69 -12
  22. package/dist/cli/init.js.map +1 -1
  23. package/dist/cli/mcp-add.cjs +57 -26
  24. package/dist/cli/mcp-add.cjs.map +1 -1
  25. package/dist/cli/mcp-add.js +12 -9
  26. package/dist/cli/mcp-add.js.map +1 -1
  27. package/dist/cli/status.cjs +33 -3
  28. package/dist/cli/status.cjs.map +1 -1
  29. package/dist/cli/status.js +12 -3
  30. package/dist/cli/status.js.map +1 -1
  31. package/dist/cli/uninit.cjs +27 -3
  32. package/dist/cli/uninit.cjs.map +1 -1
  33. package/dist/cli/uninit.d.cts +10 -2
  34. package/dist/cli/uninit.d.ts +10 -2
  35. package/dist/cli/uninit.js +4 -3
  36. package/dist/cli/upgrade-instructions.cjs +440 -0
  37. package/dist/cli/upgrade-instructions.cjs.map +1 -0
  38. package/dist/cli/upgrade-instructions.d.cts +48 -0
  39. package/dist/cli/upgrade-instructions.d.ts +48 -0
  40. package/dist/cli/upgrade-instructions.js +80 -0
  41. package/dist/cli/upgrade-instructions.js.map +1 -0
  42. package/dist/cli/validate.cjs +12 -1
  43. package/dist/cli/validate.cjs.map +1 -1
  44. package/dist/cli/validate.js +2 -2
  45. package/dist/{edge-entry-BSKA1l_0.d.ts → edge-entry-AWO70gje.d.ts} +1 -1
  46. package/dist/{edge-entry-DyMWa6JK.d.cts → edge-entry-DaeG7D7S.d.cts} +1 -1
  47. package/dist/edge-entry.cjs +43 -2
  48. package/dist/edge-entry.cjs.map +1 -1
  49. package/dist/edge-entry.d.cts +2 -2
  50. package/dist/edge-entry.d.ts +2 -2
  51. package/dist/edge-entry.js +2 -2
  52. package/dist/index.cjs +594 -64
  53. package/dist/index.cjs.map +1 -1
  54. package/dist/{index.d-Bo_Rxund.d.cts → index.d-Dq33YwFT.d.cts} +91 -1
  55. package/dist/{index.d-Bo_Rxund.d.ts → index.d-Dq33YwFT.d.ts} +91 -1
  56. package/dist/index.d.cts +91 -431
  57. package/dist/index.d.ts +91 -431
  58. package/dist/index.js +291 -6
  59. package/dist/index.js.map +1 -1
  60. package/dist/node-entry.cjs +282 -71
  61. package/dist/node-entry.cjs.map +1 -1
  62. package/dist/node-entry.d.cts +3 -3
  63. package/dist/node-entry.d.ts +3 -3
  64. package/dist/node-entry.js +8 -7
  65. package/dist/node-subpath.cjs +12 -1
  66. package/dist/node-subpath.cjs.map +1 -1
  67. package/dist/node-subpath.d.cts +1 -1
  68. package/dist/node-subpath.d.ts +1 -1
  69. package/dist/node-subpath.js +3 -3
  70. package/dist/{source-map-uploader-FSTHCYDR.js → source-map-uploader-PB3M4PPP.js} +3 -3
  71. package/package.json +1 -1
  72. package/dist/chunk-JH7EGRC5.js.map +0 -1
  73. package/dist/chunk-JZ475QRH.js.map +0 -1
  74. package/dist/chunk-LJMZXJ45.js.map +0 -1
  75. package/dist/chunk-XS5W3SPL.js.map +0 -1
  76. /package/dist/{chunk-GYTCZSAV.js.map → chunk-MFYOQOD7.js.map} +0 -0
  77. /package/dist/{chunk-4WUHMLMM.js.map → chunk-MMKFFF2L.js.map} +0 -0
  78. /package/dist/{chunk-FKBCEOJ5.js.map → chunk-Q42BY5BA.js.map} +0 -0
  79. /package/dist/{chunk-DBKG6SRI.js.map → chunk-QU26IKIJ.js.map} +0 -0
  80. /package/dist/{chunk-ADUD4PEK.js.map → chunk-TANUWTFO.js.map} +0 -0
  81. /package/dist/{source-map-uploader-FSTHCYDR.js.map → source-map-uploader-PB3M4PPP.js.map} +0 -0
@@ -42,6 +42,7 @@ declare const CaptureConfigSchema: z.ZodObject<{
42
42
  importGraph: z.ZodBoolean;
43
43
  consoleErrors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
44
44
  errorResponseBodies: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
45
+ sideEffectEvidence: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
45
46
  }, z.core.$strip>;
46
47
  type CaptureConfig = z.infer<typeof CaptureConfigSchema>;
47
48
  /** Developer-facing config for registerGlasstrace(). */
@@ -110,6 +111,7 @@ declare const SdkInitResponseSchema: z.ZodObject<{
110
111
  importGraph: z.ZodBoolean;
111
112
  consoleErrors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
112
113
  errorResponseBodies: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
114
+ sideEffectEvidence: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
113
115
  }, z.core.$strip>;
114
116
  subscriptionStatus: z.ZodString;
115
117
  linkedAccountId: z.ZodOptional<z.ZodString>;
@@ -191,4 +193,92 @@ type SourceMapManifestResponse = z.infer<typeof SourceMapManifestResponseSchema>
191
193
  */
192
194
  declare function deriveSessionId(apiKey: string, origin: string, date: string, windowIndex: number): SessionId;
193
195
 
194
- 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 };
196
+ /**
197
+ * Side-effect evidence value-enum constants.
198
+ *
199
+ * The runtime `as const` tuples are the source of truth for the
200
+ * allowlisted value sets. TypeScript types are derived via
201
+ * `typeof T[number]` so consumers get a literal-type union without a
202
+ * separate string-literal-union declaration that could silently drift
203
+ * from the runtime allowlist.
204
+ *
205
+ * These tuples align verbatim with the product-side wire schema in
206
+ * `glasstrace-product/shared/types/agent-evidence.ts`. Members must
207
+ * remain in sync across both repos; the SDK enforces these allowlists
208
+ * client-side as defense-in-depth before any attribute reaches the
209
+ * wire (the product's storage filter is a second defense, not the
210
+ * primary boundary).
211
+ *
212
+ * @drift-check ../../glasstrace-product/docs/component-designs/side-effect-evidence-summaries.md
213
+ */
214
+ /**
215
+ * Allowlisted side-effect operation kinds (v1).
216
+ *
217
+ * Each kind names a category of side effect the receiver projects in
218
+ * MCP tool responses. New kinds require a coordinated bump across
219
+ * SCHEMA-036 (product), this tuple (SDK), and any downstream consumer
220
+ * that switches on the kind.
221
+ */
222
+ declare const SIDE_EFFECT_OPERATION_KINDS: readonly ["email", "calendar_link", "webhook", "external_api", "queue", "after_callback"];
223
+ /**
224
+ * One of the allowlisted side-effect operation kinds.
225
+ *
226
+ * @see {@link SIDE_EFFECT_OPERATION_KINDS}
227
+ */
228
+ type SideEffectOperationKind = (typeof SIDE_EFFECT_OPERATION_KINDS)[number];
229
+ /**
230
+ * Allowlisted semantic field keys for `recordSideEffect()` evidence.
231
+ *
232
+ * Only fields named here may be attached to a side-effect operation
233
+ * summary. Any other key is silently dropped at the SDK boundary and
234
+ * counted under the `unsupported_key` omission reason.
235
+ */
236
+ declare const SIDE_EFFECT_SEMANTIC_FIELD_KEYS: readonly ["templateKey", "providerOperation", "role", "locale", "timezone", "status", "phase"];
237
+ /**
238
+ * One of the allowlisted side-effect semantic field keys.
239
+ *
240
+ * @see {@link SIDE_EFFECT_SEMANTIC_FIELD_KEYS}
241
+ */
242
+ type SideEffectSemanticFieldKey = (typeof SIDE_EFFECT_SEMANTIC_FIELD_KEYS)[number];
243
+ /**
244
+ * Allowlisted reasons a side-effect value may be omitted from the
245
+ * emitted summary.
246
+ *
247
+ * The SDK records counts under these reasons rather than the rejected
248
+ * values themselves so unsafe input never appears anywhere on the
249
+ * wire. The set is fixed by SCHEMA-036; new reasons require a
250
+ * coordinated cross-repo bump.
251
+ */
252
+ declare const SIDE_EFFECT_OMISSION_REASONS: readonly ["pii", "secret", "raw_payload", "unsupported_key", "value_too_long", "not_emitted", "capture_disabled"];
253
+ /**
254
+ * One of the allowlisted side-effect omission reasons.
255
+ *
256
+ * @see {@link SIDE_EFFECT_OMISSION_REASONS}
257
+ */
258
+ type SideEffectOmissionReason = (typeof SIDE_EFFECT_OMISSION_REASONS)[number];
259
+ /**
260
+ * Allowlisted side-effect operation lifecycle statuses.
261
+ */
262
+ declare const SIDE_EFFECT_OPERATION_STATUSES: readonly ["scheduled", "started", "succeeded", "failed", "unknown"];
263
+ /**
264
+ * One of the allowlisted side-effect operation statuses.
265
+ *
266
+ * @see {@link SIDE_EFFECT_OPERATION_STATUSES}
267
+ */
268
+ type SideEffectOperationStatus = (typeof SIDE_EFFECT_OPERATION_STATUSES)[number];
269
+ /**
270
+ * Allowlisted side-effect operation execution phases.
271
+ *
272
+ * Distinguishes side effects that ran inside the request handler from
273
+ * those that ran after the response was sent (e.g., `after()` hook,
274
+ * background job).
275
+ */
276
+ declare const SIDE_EFFECT_OPERATION_PHASES: readonly ["request", "post_response", "background", "unknown"];
277
+ /**
278
+ * One of the allowlisted side-effect operation phases.
279
+ *
280
+ * @see {@link SIDE_EFFECT_OPERATION_PHASES}
281
+ */
282
+ type SideEffectOperationPhase = (typeof SIDE_EFFECT_OPERATION_PHASES)[number];
283
+
284
+ export { type AnonApiKey as A, type CaptureConfig as C, type GlasstraceEnvVars as G, type ImportGraphPayload as I, type SideEffectOperationKind as S, type SideEffectOperationStatus as a, type SideEffectOperationPhase as b, type SideEffectSemanticFieldKey as c, deriveSessionId as d, type SideEffectOmissionReason as e, type GlasstraceOptions as f, type SdkInitResponse as g, type SdkHealthReport as h, type SdkDiagnosticCode as i, type SessionId as j, type SourceMapUploadResponse as k, type SourceMapManifestResponse as l };
@@ -42,6 +42,7 @@ declare const CaptureConfigSchema: z.ZodObject<{
42
42
  importGraph: z.ZodBoolean;
43
43
  consoleErrors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
44
44
  errorResponseBodies: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
45
+ sideEffectEvidence: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
45
46
  }, z.core.$strip>;
46
47
  type CaptureConfig = z.infer<typeof CaptureConfigSchema>;
47
48
  /** Developer-facing config for registerGlasstrace(). */
@@ -110,6 +111,7 @@ declare const SdkInitResponseSchema: z.ZodObject<{
110
111
  importGraph: z.ZodBoolean;
111
112
  consoleErrors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
112
113
  errorResponseBodies: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
114
+ sideEffectEvidence: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
113
115
  }, z.core.$strip>;
114
116
  subscriptionStatus: z.ZodString;
115
117
  linkedAccountId: z.ZodOptional<z.ZodString>;
@@ -191,4 +193,92 @@ type SourceMapManifestResponse = z.infer<typeof SourceMapManifestResponseSchema>
191
193
  */
192
194
  declare function deriveSessionId(apiKey: string, origin: string, date: string, windowIndex: number): SessionId;
193
195
 
194
- 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 };
196
+ /**
197
+ * Side-effect evidence value-enum constants.
198
+ *
199
+ * The runtime `as const` tuples are the source of truth for the
200
+ * allowlisted value sets. TypeScript types are derived via
201
+ * `typeof T[number]` so consumers get a literal-type union without a
202
+ * separate string-literal-union declaration that could silently drift
203
+ * from the runtime allowlist.
204
+ *
205
+ * These tuples align verbatim with the product-side wire schema in
206
+ * `glasstrace-product/shared/types/agent-evidence.ts`. Members must
207
+ * remain in sync across both repos; the SDK enforces these allowlists
208
+ * client-side as defense-in-depth before any attribute reaches the
209
+ * wire (the product's storage filter is a second defense, not the
210
+ * primary boundary).
211
+ *
212
+ * @drift-check ../../glasstrace-product/docs/component-designs/side-effect-evidence-summaries.md
213
+ */
214
+ /**
215
+ * Allowlisted side-effect operation kinds (v1).
216
+ *
217
+ * Each kind names a category of side effect the receiver projects in
218
+ * MCP tool responses. New kinds require a coordinated bump across
219
+ * SCHEMA-036 (product), this tuple (SDK), and any downstream consumer
220
+ * that switches on the kind.
221
+ */
222
+ declare const SIDE_EFFECT_OPERATION_KINDS: readonly ["email", "calendar_link", "webhook", "external_api", "queue", "after_callback"];
223
+ /**
224
+ * One of the allowlisted side-effect operation kinds.
225
+ *
226
+ * @see {@link SIDE_EFFECT_OPERATION_KINDS}
227
+ */
228
+ type SideEffectOperationKind = (typeof SIDE_EFFECT_OPERATION_KINDS)[number];
229
+ /**
230
+ * Allowlisted semantic field keys for `recordSideEffect()` evidence.
231
+ *
232
+ * Only fields named here may be attached to a side-effect operation
233
+ * summary. Any other key is silently dropped at the SDK boundary and
234
+ * counted under the `unsupported_key` omission reason.
235
+ */
236
+ declare const SIDE_EFFECT_SEMANTIC_FIELD_KEYS: readonly ["templateKey", "providerOperation", "role", "locale", "timezone", "status", "phase"];
237
+ /**
238
+ * One of the allowlisted side-effect semantic field keys.
239
+ *
240
+ * @see {@link SIDE_EFFECT_SEMANTIC_FIELD_KEYS}
241
+ */
242
+ type SideEffectSemanticFieldKey = (typeof SIDE_EFFECT_SEMANTIC_FIELD_KEYS)[number];
243
+ /**
244
+ * Allowlisted reasons a side-effect value may be omitted from the
245
+ * emitted summary.
246
+ *
247
+ * The SDK records counts under these reasons rather than the rejected
248
+ * values themselves so unsafe input never appears anywhere on the
249
+ * wire. The set is fixed by SCHEMA-036; new reasons require a
250
+ * coordinated cross-repo bump.
251
+ */
252
+ declare const SIDE_EFFECT_OMISSION_REASONS: readonly ["pii", "secret", "raw_payload", "unsupported_key", "value_too_long", "not_emitted", "capture_disabled"];
253
+ /**
254
+ * One of the allowlisted side-effect omission reasons.
255
+ *
256
+ * @see {@link SIDE_EFFECT_OMISSION_REASONS}
257
+ */
258
+ type SideEffectOmissionReason = (typeof SIDE_EFFECT_OMISSION_REASONS)[number];
259
+ /**
260
+ * Allowlisted side-effect operation lifecycle statuses.
261
+ */
262
+ declare const SIDE_EFFECT_OPERATION_STATUSES: readonly ["scheduled", "started", "succeeded", "failed", "unknown"];
263
+ /**
264
+ * One of the allowlisted side-effect operation statuses.
265
+ *
266
+ * @see {@link SIDE_EFFECT_OPERATION_STATUSES}
267
+ */
268
+ type SideEffectOperationStatus = (typeof SIDE_EFFECT_OPERATION_STATUSES)[number];
269
+ /**
270
+ * Allowlisted side-effect operation execution phases.
271
+ *
272
+ * Distinguishes side effects that ran inside the request handler from
273
+ * those that ran after the response was sent (e.g., `after()` hook,
274
+ * background job).
275
+ */
276
+ declare const SIDE_EFFECT_OPERATION_PHASES: readonly ["request", "post_response", "background", "unknown"];
277
+ /**
278
+ * One of the allowlisted side-effect operation phases.
279
+ *
280
+ * @see {@link SIDE_EFFECT_OPERATION_PHASES}
281
+ */
282
+ type SideEffectOperationPhase = (typeof SIDE_EFFECT_OPERATION_PHASES)[number];
283
+
284
+ export { type AnonApiKey as A, type CaptureConfig as C, type GlasstraceEnvVars as G, type ImportGraphPayload as I, type SideEffectOperationKind as S, type SideEffectOperationStatus as a, type SideEffectOperationPhase as b, type SideEffectSemanticFieldKey as c, deriveSessionId as d, type SideEffectOmissionReason as e, type GlasstraceOptions as f, type SdkInitResponse as g, type SdkHealthReport as h, type SdkDiagnosticCode as i, type SessionId as j, type SourceMapUploadResponse as k, type SourceMapManifestResponse as l };