@cstar.help/js 0.16.0 → 0.17.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.
@@ -1,3 +1,5 @@
1
+ export { A as ApiErrorBody, C as CStarAuthenticationError, a as CStarConflictError, b as CStarError, c as CStarFeatureDisabledError, d as CStarNotFoundError, e as CStarPermissionError, f as CStarRateLimitError, g as CStarRealtimeUnavailableError, h as CStarServerError, i as CStarValidationError, E as ErrorType, p as parseError, j as parsePublicError } from '../errors-b5A4wfAg.cjs';
2
+
1
3
  /**
2
4
  * Options for the QuickHelpClient. No auth — Quick Help is anonymous by
3
5
  * design.
@@ -55,403 +57,6 @@ interface QuickHelpAskResult {
55
57
  turnNumber: number;
56
58
  }
57
59
 
58
- /**
59
- * Error classes for the cStar SDK.
60
- *
61
- * NEW-v3-01 — Cross-subpath instanceof identity.
62
- *
63
- * Each public subpath (`/library`, `/auth`, `/community`, `/quickhelp`, ...)
64
- * is bundled as a separate tsup entry with `splitting: false`, so each one
65
- * carries its own copy of this module. Without deduplication, errors thrown
66
- * by `LibraryClient` carry the LibraryClient-bundled `CStarError` class —
67
- * not the one a consumer imports from `@cstar.help/js`. That makes
68
- * `instanceof CStarError` checks fail silently, invalidating every "did the
69
- * SDK throw a typed cStar error?" branch in user code.
70
- *
71
- * Fix: register each class on a `Symbol.for(...)` slot of `globalThis`. The
72
- * symbol is realm-shared, so every bundled copy of this module resolves to
73
- * the SAME class identity at runtime — the first copy to load wins, and all
74
- * subsequent copies surface the canonical class via the same slot. The
75
- * inline `Impl` definitions are only used as the seed for the very first
76
- * copy to register. Internal `parseError` / `parsePublicError` reference the
77
- * EXPORTED canonical names so instances they construct also land on the
78
- * canonical class.
79
- */
80
- /** Error type constants matching the cStar API. */
81
- declare const ErrorType: {
82
- readonly AUTHENTICATION_ERROR: "authentication_error";
83
- readonly PERMISSION_ERROR: "permission_error";
84
- readonly INVALID_REQUEST_ERROR: "invalid_request_error";
85
- readonly NOT_FOUND_ERROR: "not_found_error";
86
- readonly CONFLICT_ERROR: "conflict_error";
87
- readonly RATE_LIMIT_ERROR: "rate_limit_error";
88
- readonly FEATURE_NOT_CONFIGURED: "feature_not_configured";
89
- readonly API_ERROR: "api_error";
90
- readonly SERVER_ERROR: "server_error";
91
- };
92
- /** Shape of the error object returned by the cStar API. */
93
- interface ApiErrorBody {
94
- type: string;
95
- code: string;
96
- message: string;
97
- param?: string;
98
- doc_url: string;
99
- request_id?: string;
100
- feature?: string;
101
- enable_url?: string;
102
- }
103
- /** Base error class for all cStar API errors. */
104
- declare const CStarErrorImpl: {
105
- new (messageOrStatus: string | number, body?: ApiErrorBody): {
106
- readonly type: string;
107
- readonly code: string;
108
- readonly param?: string;
109
- readonly docUrl: string;
110
- readonly requestId?: string;
111
- readonly statusCode: number;
112
- name: string;
113
- message: string;
114
- stack?: string;
115
- };
116
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
117
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
118
- stackTraceLimit: number;
119
- };
120
- declare const CStarAuthenticationErrorImpl: {
121
- new (messageOrStatus: string | number, body?: ApiErrorBody): {
122
- readonly type: string;
123
- readonly code: string;
124
- readonly param?: string;
125
- readonly docUrl: string;
126
- readonly requestId?: string;
127
- readonly statusCode: number;
128
- name: string;
129
- message: string;
130
- stack?: string;
131
- };
132
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
133
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
134
- stackTraceLimit: number;
135
- };
136
- declare const CStarRateLimitErrorImpl: {
137
- new (messageOrStatus: string | number, body?: ApiErrorBody, retryAfter?: number): {
138
- readonly retryAfter: number;
139
- readonly type: string;
140
- readonly code: string;
141
- readonly param?: string;
142
- readonly docUrl: string;
143
- readonly requestId?: string;
144
- readonly statusCode: number;
145
- name: string;
146
- message: string;
147
- stack?: string;
148
- };
149
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
150
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
151
- stackTraceLimit: number;
152
- };
153
- declare const CStarNotFoundErrorImpl: {
154
- new (messageOrStatus: string | number, body?: ApiErrorBody): {
155
- readonly type: string;
156
- readonly code: string;
157
- readonly param?: string;
158
- readonly docUrl: string;
159
- readonly requestId?: string;
160
- readonly statusCode: number;
161
- name: string;
162
- message: string;
163
- stack?: string;
164
- };
165
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
166
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
167
- stackTraceLimit: number;
168
- };
169
- declare const CStarValidationErrorImpl: {
170
- new (messageOrStatus: string | number, body?: ApiErrorBody): {
171
- readonly type: string;
172
- readonly code: string;
173
- readonly param?: string;
174
- readonly docUrl: string;
175
- readonly requestId?: string;
176
- readonly statusCode: number;
177
- name: string;
178
- message: string;
179
- stack?: string;
180
- };
181
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
182
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
183
- stackTraceLimit: number;
184
- };
185
- declare const CStarPermissionErrorImpl: {
186
- new (messageOrStatus: string | number, body?: ApiErrorBody): {
187
- readonly type: string;
188
- readonly code: string;
189
- readonly param?: string;
190
- readonly docUrl: string;
191
- readonly requestId?: string;
192
- readonly statusCode: number;
193
- name: string;
194
- message: string;
195
- stack?: string;
196
- };
197
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
198
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
199
- stackTraceLimit: number;
200
- };
201
- declare const CStarConflictErrorImpl: {
202
- new (messageOrStatus: string | number, body?: ApiErrorBody): {
203
- readonly type: string;
204
- readonly code: string;
205
- readonly param?: string;
206
- readonly docUrl: string;
207
- readonly requestId?: string;
208
- readonly statusCode: number;
209
- name: string;
210
- message: string;
211
- stack?: string;
212
- };
213
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
214
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
215
- stackTraceLimit: number;
216
- };
217
- declare const CStarServerErrorImpl: {
218
- new (messageOrStatus: string | number, body?: ApiErrorBody): {
219
- readonly type: string;
220
- readonly code: string;
221
- readonly param?: string;
222
- readonly docUrl: string;
223
- readonly requestId?: string;
224
- readonly statusCode: number;
225
- name: string;
226
- message: string;
227
- stack?: string;
228
- };
229
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
230
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
231
- stackTraceLimit: number;
232
- };
233
- declare const CStarFeatureDisabledErrorImpl: {
234
- new (messageOrStatus: string | number, body?: ApiErrorBody): {
235
- readonly feature: string;
236
- readonly enableUrl: string;
237
- readonly type: string;
238
- readonly code: string;
239
- readonly param?: string;
240
- readonly docUrl: string;
241
- readonly requestId?: string;
242
- readonly statusCode: number;
243
- name: string;
244
- message: string;
245
- stack?: string;
246
- };
247
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
248
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
249
- stackTraceLimit: number;
250
- };
251
- declare const CStarRealtimeUnavailableErrorImpl: {
252
- new (message?: string): {
253
- readonly type: string;
254
- readonly code: string;
255
- readonly param?: string;
256
- readonly docUrl: string;
257
- readonly requestId?: string;
258
- readonly statusCode: number;
259
- name: string;
260
- message: string;
261
- stack?: string;
262
- };
263
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
264
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
265
- stackTraceLimit: number;
266
- };
267
- declare const CStarError: {
268
- new (messageOrStatus: string | number, body?: ApiErrorBody): {
269
- readonly type: string;
270
- readonly code: string;
271
- readonly param?: string;
272
- readonly docUrl: string;
273
- readonly requestId?: string;
274
- readonly statusCode: number;
275
- name: string;
276
- message: string;
277
- stack?: string;
278
- };
279
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
280
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
281
- stackTraceLimit: number;
282
- };
283
- type CStarError = InstanceType<typeof CStarErrorImpl>;
284
- declare const CStarAuthenticationError: {
285
- new (messageOrStatus: string | number, body?: ApiErrorBody): {
286
- readonly type: string;
287
- readonly code: string;
288
- readonly param?: string;
289
- readonly docUrl: string;
290
- readonly requestId?: string;
291
- readonly statusCode: number;
292
- name: string;
293
- message: string;
294
- stack?: string;
295
- };
296
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
297
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
298
- stackTraceLimit: number;
299
- };
300
- type CStarAuthenticationError = InstanceType<typeof CStarAuthenticationErrorImpl>;
301
- declare const CStarRateLimitError: {
302
- new (messageOrStatus: string | number, body?: ApiErrorBody, retryAfter?: number): {
303
- readonly retryAfter: number;
304
- readonly type: string;
305
- readonly code: string;
306
- readonly param?: string;
307
- readonly docUrl: string;
308
- readonly requestId?: string;
309
- readonly statusCode: number;
310
- name: string;
311
- message: string;
312
- stack?: string;
313
- };
314
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
315
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
316
- stackTraceLimit: number;
317
- };
318
- type CStarRateLimitError = InstanceType<typeof CStarRateLimitErrorImpl>;
319
- declare const CStarNotFoundError: {
320
- new (messageOrStatus: string | number, body?: ApiErrorBody): {
321
- readonly type: string;
322
- readonly code: string;
323
- readonly param?: string;
324
- readonly docUrl: string;
325
- readonly requestId?: string;
326
- readonly statusCode: number;
327
- name: string;
328
- message: string;
329
- stack?: string;
330
- };
331
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
332
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
333
- stackTraceLimit: number;
334
- };
335
- type CStarNotFoundError = InstanceType<typeof CStarNotFoundErrorImpl>;
336
- declare const CStarValidationError: {
337
- new (messageOrStatus: string | number, body?: ApiErrorBody): {
338
- readonly type: string;
339
- readonly code: string;
340
- readonly param?: string;
341
- readonly docUrl: string;
342
- readonly requestId?: string;
343
- readonly statusCode: number;
344
- name: string;
345
- message: string;
346
- stack?: string;
347
- };
348
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
349
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
350
- stackTraceLimit: number;
351
- };
352
- type CStarValidationError = InstanceType<typeof CStarValidationErrorImpl>;
353
- declare const CStarPermissionError: {
354
- new (messageOrStatus: string | number, body?: ApiErrorBody): {
355
- readonly type: string;
356
- readonly code: string;
357
- readonly param?: string;
358
- readonly docUrl: string;
359
- readonly requestId?: string;
360
- readonly statusCode: number;
361
- name: string;
362
- message: string;
363
- stack?: string;
364
- };
365
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
366
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
367
- stackTraceLimit: number;
368
- };
369
- type CStarPermissionError = InstanceType<typeof CStarPermissionErrorImpl>;
370
- declare const CStarConflictError: {
371
- new (messageOrStatus: string | number, body?: ApiErrorBody): {
372
- readonly type: string;
373
- readonly code: string;
374
- readonly param?: string;
375
- readonly docUrl: string;
376
- readonly requestId?: string;
377
- readonly statusCode: number;
378
- name: string;
379
- message: string;
380
- stack?: string;
381
- };
382
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
383
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
384
- stackTraceLimit: number;
385
- };
386
- type CStarConflictError = InstanceType<typeof CStarConflictErrorImpl>;
387
- declare const CStarServerError: {
388
- new (messageOrStatus: string | number, body?: ApiErrorBody): {
389
- readonly type: string;
390
- readonly code: string;
391
- readonly param?: string;
392
- readonly docUrl: string;
393
- readonly requestId?: string;
394
- readonly statusCode: number;
395
- name: string;
396
- message: string;
397
- stack?: string;
398
- };
399
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
400
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
401
- stackTraceLimit: number;
402
- };
403
- type CStarServerError = InstanceType<typeof CStarServerErrorImpl>;
404
- declare const CStarFeatureDisabledError: {
405
- new (messageOrStatus: string | number, body?: ApiErrorBody): {
406
- readonly feature: string;
407
- readonly enableUrl: string;
408
- readonly type: string;
409
- readonly code: string;
410
- readonly param?: string;
411
- readonly docUrl: string;
412
- readonly requestId?: string;
413
- readonly statusCode: number;
414
- name: string;
415
- message: string;
416
- stack?: string;
417
- };
418
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
419
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
420
- stackTraceLimit: number;
421
- };
422
- type CStarFeatureDisabledError = InstanceType<typeof CStarFeatureDisabledErrorImpl>;
423
- declare const CStarRealtimeUnavailableError: {
424
- new (message?: string): {
425
- readonly type: string;
426
- readonly code: string;
427
- readonly param?: string;
428
- readonly docUrl: string;
429
- readonly requestId?: string;
430
- readonly statusCode: number;
431
- name: string;
432
- message: string;
433
- stack?: string;
434
- };
435
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
436
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
437
- stackTraceLimit: number;
438
- };
439
- type CStarRealtimeUnavailableError = InstanceType<typeof CStarRealtimeUnavailableErrorImpl>;
440
- /**
441
- * Parse a public-route response (anonymous LibraryClient, CommunityClient,
442
- * QuickHelpClient, AuthClient) into a typed `CStarError`.
443
- *
444
- * Public routes don't always emit the structured `{error: {type, code,
445
- * doc_url, ...}}` envelope — many emit `{error: 'message string'}` or
446
- * `{message: '...'}`. This helper normalizes both shapes and dispatches
447
- * on HTTP status (closes F-026 and F-034 — Library/Auth used to throw
448
- * plain `Error`).
449
- */
450
- declare function parsePublicError(status: number, body: unknown, fallbackMessage: string): CStarError;
451
- declare function parseError(statusCode: number, body: {
452
- error?: ApiErrorBody;
453
- } | null, retryAfter?: number): CStarError;
454
-
455
60
  /**
456
61
  * Quick Help — anonymous AI Q&A client.
457
62
  *
@@ -524,4 +129,4 @@ declare class QuickHelpError extends Error {
524
129
  });
525
130
  }
526
131
 
527
- export { type ApiErrorBody, CStarAuthenticationError, CStarConflictError, CStarError, CStarFeatureDisabledError, CStarNotFoundError, CStarPermissionError, CStarRateLimitError, CStarRealtimeUnavailableError, CStarServerError, CStarValidationError, ErrorType, type QuickHelpAskParams, type QuickHelpAskResult, QuickHelpClient, type QuickHelpConfig, QuickHelpError, type QuickHelpPublicConfig, type QuickHelpTurnOutcome, parseError, parsePublicError };
132
+ export { type QuickHelpAskParams, type QuickHelpAskResult, QuickHelpClient, type QuickHelpConfig, QuickHelpError, type QuickHelpPublicConfig, type QuickHelpTurnOutcome };